diff --git a/src/views/modules/marketing/points-mall/index.vue b/src/views/modules/marketing/points-mall/index.vue index 616dd81..f13439a 100644 --- a/src/views/modules/marketing/points-mall/index.vue +++ b/src/views/modules/marketing/points-mall/index.vue @@ -112,21 +112,37 @@ export default { : 2, marketId: this.marketId, shopId: this.shopId, - shopIdList: this.shopId ? [this.shopId] : [] + shopIdList: [] // 初始为空,等待storeList加载完成后设置 }; this.$nextTick(() => { this.$refs.oTable.reload(); }); }, + watch: { + // 监听storeList变化,设置默认选择所有店铺 + storeList: { + handler(newStoreList) { + if ( + newStoreList && + newStoreList.length > 0 && + this.formInline.shopIdList.length === 0 + ) { + // 默认选择所有店铺 + this.formInline.shopIdList = newStoreList.map(store => store.shopId); + } + }, + immediate: true // 立即执行一次 + } + }, methods: { queryList(pageNo, pageSize) { // 使用新的积分商品分页接口 const queryParams = { shopIdList: this.formInline.shopIdList || [], - productId: this.formInline.productId || 0, + productId: this.formInline.productId || "", productName: this.formInline.productName || "", - productSpecId: this.formInline.productSpecId || 0, - productSpecName: this.formInline.productSpecName || "", + // productSpecId: this.formInline.productSpecId || "", + // productSpecName: this.formInline.productSpecName || "", // 添加分页参数以备后续使用 pageNumber: pageNo, pageSize: pageSize @@ -136,7 +152,10 @@ export default { .membershipPointsProductPage(queryParams) .then(res => { console.log(res); - this.$refs.oTable.complete(res.data || [], Number(res.total || 0)); + this.$refs.oTable.complete( + res.data.data.data || [], + Number(res.data.data.total || 0) + ); }) .catch(err => { console.error("查询积分商品失败:", err); @@ -161,7 +180,7 @@ export default { : 2, marketId: this.marketId, shopId: this.shopId, - shopIdList: this.shopId ? [this.shopId] : [], + shopIdList: this.storeList.map(store => store.shopId), // 重置时也选择所有店铺 productId: "", productName: "", productSpecId: "", @@ -251,22 +270,27 @@ export default { width: "200px", render: ({ row }) => { let edit = () => { - this.$api.marketing - .PointsProductDetail({ - id: row.id - }) - .then(res => { - const productData = { - productId: row.productId, - productName: row.productName, - shopName: row.shopName - }; - this.$refs.pointsProductConfig.show( - productData, - res.data.data - ); - }) - .catch(err => {}); + // 直接使用列表数据,不调用详情接口 + const productData = { + productId: row.productId, + productName: row.productName, + shopName: row.shopName, + productSpecName: row.productSpecName + }; + + // 直接使用列表中的数据作为编辑数据 + const editData = { + id: row.id, + shopId: row.shopId, + productId: row.productId, + productSpecId: row.productSpecId, + exchangeRequiredPoints: row.exchangeRequiredPoints, + exchangeInventory: row.exchangeInventory, + exchangeRestrictions: row.exchangeRestrictions, + exchangeRestrictionsType: row.exchangeRestrictionsType + }; + + this.$refs.pointsProductConfig.show(productData, editData); }; let deleteProduct = () => { this.$api.marketing 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 9a9648a..df46400 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 @@ -7,20 +7,44 @@ :close-on-click-modal="false" @close="handleClose" > - -