batchUp.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <div>
  3. <el-button :type="disabled?'':'primary'" size="small" @click="onshow" :disabled="disabled">{{$t(`批量上架`)}}</el-button>
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. name: "batchUp",
  9. props:["rowData","disabled"],
  10. methods:{
  11. onshow(){
  12. this.onBatchUp()
  13. },
  14. onBatchUp(){
  15. this.$confirm(this.$t('确定上架这些商品吗')+'?', this.$t('提示'), {
  16. confirmButtonText: this.$t('确定'),
  17. cancelButtonText: this.$t('取消'),
  18. type: 'warning'
  19. }).then(async () => {
  20. let row = []
  21. this.rowData.forEach(function (item,index) {
  22. row[index] = item.itemid
  23. })
  24. const res = await this.$api.requested({
  25. "id": 20220923154802,
  26. "content": {
  27. "itemids": row,
  28. "isonsale": 1 //0:下架,1:上架
  29. },
  30. })
  31. this.tool.showMessage(res,()=>{
  32. this.$emit('batchUpSuccess')
  33. })
  34. }).catch(async () => {
  35. this.$message({
  36. type: 'info',
  37. message: this.$t('已取消批量上架')
  38. });
  39. });
  40. }
  41. }
  42. }
  43. </script>
  44. <style scoped>
  45. </style>