diff --git a/src/api/modules/marketing.js b/src/api/modules/marketing.js index ea1e4b4..a69779d 100644 --- a/src/api/modules/marketing.js +++ b/src/api/modules/marketing.js @@ -231,5 +231,14 @@ export const marketing = { method: "post", data }); + }, + + // 积分商品启用/禁用状态切换 + changeEnableMembershipPointsProduct: data => { + return $http.request({ + url: `/merchant-api/membershipPointsProduct/changeEnable`, + method: "post", + data + }); } }; diff --git a/src/views/modules/marketing/points-mall/index.vue b/src/views/modules/marketing/points-mall/index.vue index 5c6920d..baca5f9 100644 --- a/src/views/modules/marketing/points-mall/index.vue +++ b/src/views/modules/marketing/points-mall/index.vue @@ -173,17 +173,14 @@ export default { this.$refs.productSelector.show(shopIdList); }, handleEnableChange(row) { - // 使用编辑接口进行启用状态切换 - const updateData = { + // 使用专门的启用/禁用接口 + const changeData = { id: row.id, - exchangeRequiredPoints: row.exchangeRequiredPoints, - increaseInventory: 0, // 默认为0 - exchangeRequiredAmount: row.exchangeRequiredAmount || 0, - enable: row.enable // 使用当前的启用状态 + enable: row.enable }; this.$api.marketing - .updateMembershipPointsProduct(updateData) + .changeEnableMembershipPointsProduct(changeData) .then(() => { this.$message.success("状态切换成功"); this.$refs.oTable.reload(); @@ -314,6 +311,7 @@ export default { // 直接使用列表中的数据作为编辑数据 const editData = { + ...row, id: row.id, shopId: row.shopId, productId: row.productId, diff --git a/src/views/modules/marketing/points-mall/popup/points-product-config.vue b/src/views/modules/marketing/points-mall/popup/points-product-config.vue index 4db8a84..a9629bc 100644 --- a/src/views/modules/marketing/points-mall/popup/points-product-config.vue +++ b/src/views/modules/marketing/points-mall/popup/points-product-config.vue @@ -258,13 +258,20 @@ export default { exchangeRequiredPoints: this.configForm.exchangeRequiredPoints, increaseInventory: this.configForm.exchangeInventory, // 增加库存 exchangeRequiredAmount: - this.configForm.exchangeRequiredAmount || 0, - enable: true // 默认启用 + this.configForm.exchangePointsType === 2 + ? this.configForm.exchangeRequiredAmount || 0 + : 0.01, // 如果不是积分优惠购,固定传0.01 + enable: false // 默认禁用 }; } else { // 新增模式使用原有格式 submitData = { - ...this.configForm + ...this.configForm, + enable: false, // 默认禁用 + exchangeRequiredAmount: + this.configForm.exchangePointsType === 2 + ? this.configForm.exchangeRequiredAmount || 0 + : 0.01 // 如果不是积分优惠购,固定传0.01 }; } console.log(submitData);