From e240f02e4a248fe306314f6c3167b3777dbd9b6f Mon Sep 17 00:00:00 2001 From: gyq <875626088@qq.com> Date: Thu, 4 Dec 2025 16:54:40 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=BB=99=E6=99=BA=E6=85=A7=E5=85=85?= =?UTF-8?q?=E5=80=BC=E6=B7=BB=E5=8A=A0=E5=BC=80=E5=85=B3=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pageRecharge/index.vue | 54 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/pageRecharge/index.vue b/pageRecharge/index.vue index 25c233d..882292f 100644 --- a/pageRecharge/index.vue +++ b/pageRecharge/index.vue @@ -5,6 +5,17 @@ + + + + 是否开启 + + + + + + + \ No newline at end of file +.delete-btn { + background: #ffe7e6; + color: #ff1c1c; +} + diff --git a/pageMarket/couponExchangeCode/index.vue b/pageMarket/couponExchangeCode/index.vue index a8e52dd..b769bcf 100644 --- a/pageMarket/couponExchangeCode/index.vue +++ b/pageMarket/couponExchangeCode/index.vue @@ -1,359 +1,325 @@ diff --git a/pageMarket/rechargeExchangeCode/index.vue b/pageMarket/rechargeExchangeCode/index.vue index 5179f15..97a7cec 100644 --- a/pageMarket/rechargeExchangeCode/index.vue +++ b/pageMarket/rechargeExchangeCode/index.vue @@ -1,372 +1,335 @@ diff --git a/pageRecharge/index.vue b/pageRecharge/index.vue index 882292f..7ff478a 100644 --- a/pageRecharge/index.vue +++ b/pageRecharge/index.vue @@ -87,6 +87,7 @@ + @@ -105,7 +106,7 @@ import $util from '@/commons/utils/getDateArea.js'; import go from '@/commons/utils/go.js'; import { shopRechargePost, shopRechargeGet } from '@/http/api/market/index.js'; import { onLoad } from '@dcloudio/uni-app'; -import { isMainShop } from '@/store/account.js'; +import { isMainShop, isMarketShow } from '@/store/account.js'; const isCanEdit = computed(() => { return isMainShop(); @@ -192,11 +193,12 @@ function useTypeChange(e) { } // 获取设置 +const shopRechargeRes = ref({}); async function shopRechargeGetAjax() { try { - const res = await shopRechargeGet(); - isOpen.value = res.isEnable; - res.rechargeDetailList.forEach((item) => { + shopRechargeRes.value = await shopRechargeGet(); + isOpen.value = shopRechargeRes.value.isEnable; + shopRechargeRes.value.rechargeDetailList.forEach((item) => { item.couponInfoList.forEach((val) => { if (val.coupon && val.coupon !== null) { val.id = val.coupon.id; @@ -204,8 +206,8 @@ async function shopRechargeGetAjax() { } }); }); - settingForm.value = res; - rechargeLists.value = res.rechargeDetailList; + settingForm.value = shopRechargeRes.value; + rechargeLists.value = shopRechargeRes.value.rechargeDetailList; } catch (error) { console.log(error); } diff --git a/store/account.js b/store/account.js index c3bf537..c0990f8 100644 --- a/store/account.js +++ b/store/account.js @@ -1,41 +1,65 @@ // stores/counter.js -import { defineStore } from "pinia"; +import { + defineStore +} from "pinia"; import * as shopApi from "@/http/api/shop.js"; -//判断是否是主店 +// 判断是否是主店,并且是否有查看权限 export const isMainShop = (shopId) => { - const shopInfo=uni.getStorageSync("shopInfo"); - if(shopInfo.isHeadShop){ - return true - } - if(shopInfo.shopType=='only'){ - return true - } - return false + const shopInfo = uni.getStorageSync("shopInfo"); + if (shopInfo.isHeadShop) { + return true + } + if (shopInfo.shopType == 'only') { + return true + } + return false +} + +/** + * 主店在配置该功能时未选择分店 + * 判断分店是否显示活动信息 + * @param {Object} activit + * 活动信息 + */ +export function isMarketShow(activit = null, key = 'shopIdList') { + console.log('isMarketShow===', activit); + if (activit == null || !activit.id) return false + + let flag = false + const shopInfo = uni.getStorageSync("shopInfo"); + + if (!shopInfo.isHeadShop && (!activit[key].some(item => item == shopInfo.id) || !activit.isEnable)) { + flag = true + } else { + flag = false + } + console.log('isMarketShow===', flag); + return flag } // 分销 export const useAccountInfoStore = defineStore("accountInfo", { - state: () => { - return { - shopInfo: {}, - }; - }, - actions: { - getShopInfo() { - return shopApi.getShopInfo().then((res) => { - this.shopInfo = res; - return this.shopInfo; - }); - }, - editShopInfo(data,autoRefresh = true) { - return shopApi.editShopInfo(data).then((res) => { - if(autoRefresh) { - this.getShopInfo() - } - return res - }); - }, - }, - unistorage: true, // 开启后对 state 的数据读写都将持久化 -}); + state: () => { + return { + shopInfo: {}, + }; + }, + actions: { + getShopInfo() { + return shopApi.getShopInfo().then((res) => { + this.shopInfo = res; + return this.shopInfo; + }); + }, + editShopInfo(data, autoRefresh = true) { + return shopApi.editShopInfo(data).then((res) => { + if (autoRefresh) { + this.getShopInfo() + } + return res + }); + }, + }, + unistorage: true, // 开启后对 state 的数据读写都将持久化 +}); \ No newline at end of file