{"remainingRequest":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/vue-loader/lib/index.js??vue-loader-options!/data/jenkins/workspace/mer.ws.baibaodun.com.cn/src/views/marketing/limited/index.vue?vue&type=script&lang=js","dependencies":[{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/src/views/marketing/limited/index.vue","mtime":1701742078555},{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/babel-loader/lib/index.js","mtime":456789000000},{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/vue-loader/lib/index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\nimport {\n  limitedGoodsPageApi,\n  updateLimitedRecordApi,\n  deleteLimitedRecordApi\n} from '@/api/marketing';\nimport limitedGoodsListDialog from '../../../components/limited/limitedGoodsListDialog';\nimport limitedSettingDialog from '../../../components/limited/limitedSettingDialog.vue'\n\n\nexport default {\n  name: 'Limited',\n  components: { limitedGoodsListDialog, limitedSettingDialog },\n\n  data() {\n    return {\n      listLoading: false,\n      showLimitedGoodsListDialog: false,\n      showLimitedSettingDialog: false,\n      limitedGoodsList: [],\n      productId: null,\n      goodsName: '',\n      enabled: null,\n      total: 0,\n      totalPage: 0,\n      page: 1,\n      limit: 20\n    };\n  },\n\n  mounted() {\n    this.getLimitedGoodsList();\n  },\n\n  methods: {\n    getLimitedGoodsList() {\n      let params = {\n        page: this.page,\n        limit: this.limit\n      };\n      this.goodsName ? params.name = this.goodsName : null;\n      this.enabled === null ? null : params.enabled = this.enabled;\n\n      limitedGoodsPageApi(params).then(res => {\n        let { page, total, totalPage, list } = res;\n\n        console.info('limit', res);\n\n        this.page = page;\n        this.totalPage = totalPage;\n        this.total = total;\n        this.limitedGoodsList = list;\n      });\n    },\n\n    getListByGoodsName() {\n      this.page = 1;\n      this.getLimitedGoodsList();\n    },\n\n    searchByStatus() {\n      this.page = 1;\n      this.getLimitedGoodsList();\n    },\n\n    openLimitedGoodsListDialog() {\n      this.showLimitedGoodsListDialog = true;\n    },\n\n    closeLimitedGoodsListDialog() {\n      this.showLimitedGoodsListDialog = false;\n    },\n\n    changeLimitedStatus(index, val) {\n      if (!val.id) return;\n\n      let params = {\n        id: val.id,\n        enabled: val.enabled,\n        allQuota: val.allQuota,\n        oneQuota: val.oneQuota,\n        productId: val.productId\n      }\n\n      updateLimitedRecordApi(params).then(res => {\n        let { code } = res;\n\n        if (code && code !== 200) return;\n      }).catch(() => {});\n    },\n\n    openLimitedSettingDialog(row) {\n      this.productId = row.id;\n      this.limitedSettingInfo = row;\n      this.showLimitedSettingDialog = true;\n    },\n\n    closeLimitedSettingDialog(data) {\n      if (!data) {\n        this.showLimitedSettingDialog = false;\n        return;\n      }\n\n      let { productId } = data;\n      this.showLimitedSettingDialog = false;\n      if (productId) {\n        this.getLimitedGoodsList()\n      }\n    },\n\n    delLimitedRecord(id) {\n      deleteLimitedRecordApi(id).then(res => {\n        this.$message({\n          showClose: true,\n          message: '删除成功',\n          type: 'success'\n        });\n        let idx = this.limitedGoodsList.findIndex(el => el.id === id);\n        this.limitedGoodsList.splice(idx, 1);\n        this.total -= 1;\n      }).catch(err => {});\n    },\n\n    pageChange(page) {\n      this.page = page;\n      this.getLimitedGoodsList();\n    },\n\n    handleSizeChange(val) {\n      this.limit = val\n      this.getLimitedGoodsList();\n    },\n\n    addChooseGoodsList(data) {\n      let productIds = [];\n      this.limitedGoodsList.forEach(el => {\n        productIds.push(el.productId);\n      });\n      data.forEach(el => {\n        if (productIds.indexOf(el.productId) < 0) {\n          this.limitedGoodsList.unshift(el);\n        }\n      });\n    },\n  },\n};\n",null]}