优化分店营销中心的权限问题

This commit is contained in:
gyq
2025-12-05 10:14:39 +08:00
parent e240f02e4a
commit ca77a403b5
8 changed files with 1140 additions and 1210 deletions

View File

@@ -0,0 +1,41 @@
<template>
<view class="mask-conetnt">
<text class="t">门店未参与{{ name }}活动或主店未开启活动如需开启参与请联系主店</text>
</view>
</template>
<script setup>
import { ref } from 'vue';
const props = defineProps({
name: {
type: String,
default: '活动'
}
});
</script>
<style scoped lang="scss">
.mask-conetnt {
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
z-index: 999;
background-color: rgba(255, 255, 255, 0.6);
backdrop-filter: blur(10px);
display: flex;
align-items: center;
justify-content: center;
padding-bottom: 5vh;
.t {
width: 80vw;
font-size: 28upx;
color: #333;
display: flex;
justify-content: center;
text-align: center;
}
}
</style>

View File

@@ -1,50 +1,34 @@
<template> <template>
<view class="boxconstant min-page"> <view class="boxconstant min-page">
<view class="bg-fff u-flex u-m-b-32 top"> <view class="bg-fff u-flex u-m-b-32 top">
<image style="width: 60rpx;height:60rpx;" src="/pageBwc/static/images/bwc.png"></image> <image style="width: 60rpx; height: 60rpx" src="/pageBwc/static/images/bwc.png"></image>
<view class="u-flex-1 u-flex u-p-l-24"> <view class="u-flex-1 u-flex u-p-l-24">
<view class="u-font-28 u-flex-1 u-p-r-4"> <view class="u-font-28 u-flex-1 u-p-r-4">
<view class="color-333 font-bold">霸王餐</view> <view class="color-333 font-bold">霸王餐</view>
<view class="color-666 u-m-t-4 u-font-24">设置充值消费的N倍当前订单立即免单</view> <view class="color-666 u-m-t-4 u-font-24">设置充值消费的N倍当前订单立即免单</view>
</view> </view>
<up-switch v-model="form.enable" size="18" <up-switch v-model="form.enable" size="18" :active-value="1" :inactive-value="0" :disabled="isMainShop() ? false : true"></up-switch>
:active-value="1"
:inactive-value="0"
:disabled="isMainShop()?false:true"
></up-switch>
</view> </view>
</view> </view>
<view class="boxconstantbox" <view class="boxconstantbox">
> <view class="boxconstantbox_one">充值设置</view>
<view class="boxconstantbox_one">
充值设置
</view>
<view class="u-flex u-m-t-32"> <view class="u-flex u-m-t-32">
<input class="number-box" type="number" :min='2' v-model="form.rechargeTimes" @blur="rechargeTimesInput" /> <input class="number-box" type="number" :min="2" v-model="form.rechargeTimes" @blur="rechargeTimesInput" />
<view class="bei"></view> <view class="bei"></view>
</view> </view>
<view class="color-666 u-font-28 u-m-t-16"> <view class="color-666 u-font-28 u-m-t-16">用户消费结账时成功充值订单金额的X倍即可享受免单</view>
用户消费结账时成功充值订单金额的X倍即可享受免单
</view>
<view class="u-m-t-20 u-m-b-20"> <view class="u-m-t-20 u-m-b-20">
<up-line class=""></up-line> <up-line class=""></up-line>
</view> </view>
<view class="boxconstantbox_one"> <view class="boxconstantbox_one">充值门槛</view>
充值门槛
</view>
<view class="u-flex u-m-t-32"> <view class="u-flex u-m-t-32">
<input class="number-box" type="number" v-model="form.rechargeThreshold" @blur="rechargeThresholdInput" /> <input class="number-box" type="number" v-model="form.rechargeThreshold" @blur="rechargeThresholdInput" />
<view class="bei"></view> <view class="bei"></view>
</view> </view>
<view class="color-666 u-font-28 u-m-t-16"> <view class="color-666 u-font-28 u-m-t-16">订单的支付金额满足X元才能使用</view>
订单的支付金额满足X元才能使用
</view>
</view>
<view class="boxconstantbox"
>
<view class="boxconstantbox_one">
可用门店
</view> </view>
<view class="boxconstantbox">
<view class="boxconstantbox_one">可用门店</view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<my-shop-select @shop-select="shopSelect" v-model:selShops="form.shopIdList" v-model:useType="form.useShopType"></my-shop-select> <my-shop-select @shop-select="shopSelect" v-model:selShops="form.shopIdList" v-model:useType="form.useShopType"></my-shop-select>
</view> </view>
@@ -59,12 +43,9 @@
</view> </view>
</view> --> </view> -->
<view class="boxconstantbox"> <view class="boxconstantbox">
<view class="boxconstantbox_one"> <view class="boxconstantbox_one">可使用类型</view>
可使用类型
</view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<my-dine-types v-model="form.useType"></my-dine-types> <my-dine-types v-model="form.useType"></my-dine-types>
</view> </view>
</view> </view>
<view class="boxconstantbox"> <view class="boxconstantbox">
@@ -83,28 +64,26 @@
<up-switch v-model="form.withPoints" size="18"></up-switch> <up-switch v-model="form.withPoints" size="18"></up-switch>
</view> </view>
</view> </view>
<my-bottom-btn-group @cancel="cancel" @save="editFreeDing" isOpenPermission></my-bottom-btn-group> <my-bottom-btn-group @cancel="cancel" @save="editFreeDing" isOpenPermission></my-bottom-btn-group>
<my-marketing-mask name="霸王餐" v-if="isMarketShow(form)"></my-marketing-mask>
</view> </view>
</template> </template>
<script setup> <script setup>
import { onShow, onLoad } from "@dcloudio/uni-app"; import { onShow, onLoad } from '@dcloudio/uni-app';
import { reactive, ref, watch } from "vue"; import { reactive, ref, watch } from 'vue';
import { isMainShop } from "@/store/account"; import { isMainShop, isMarketShow } from '@/store/account';
import { getFreeDing, updateFreeDing } from "@/http/api/freeDing.js"; import { getFreeDing, updateFreeDing } from '@/http/api/freeDing.js';
const form = reactive({ const form = reactive({
rechargeTimes: 2, rechargeTimes: 2,
rechargeThreshold: "", rechargeThreshold: '',
enable: false, enable: false,
rechargeDesc: "", rechargeDesc: '',
useShopType: "all", useShopType: 'all',
useType: [], useType: [],
shopIdList: [], shopIdList: [],
withCoupon: false, withCoupon: false,
withPoints: false, withPoints: false
}); });
onLoad(() => { onLoad(() => {
// uni.$utils.inputReg.bind()() // uni.$utils.inputReg.bind()()
@@ -123,21 +102,21 @@ const getlist = async () => {
let rechargeTimesInput = (e) => { let rechargeTimesInput = (e) => {
console.log(e); console.log(e);
if (e.detail.value == "" || e.detail.value < 2) { if (e.detail.value == '' || e.detail.value < 2) {
form.rechargeTimes = 2; form.rechargeTimes = 2;
uni.showToast({ uni.showToast({
title: "请输入大于等于2的整数", title: '请输入大于等于2的整数',
icon: "none", icon: 'none'
}); });
return; return;
} }
}; };
function rechargeThresholdInput(e) { function rechargeThresholdInput(e) {
if (e.detail.value == "" || e.detail.value <= 0.01) { if (e.detail.value == '' || e.detail.value <= 0.01) {
form.rechargeThreshold = 0.01; form.rechargeThreshold = 0.01;
uni.showToast({ uni.showToast({
title: "请输入大于0的数字", title: '请输入大于0的数字',
icon: "none", icon: 'none'
}); });
return; return;
} }
@@ -148,35 +127,35 @@ function rechargeThresholdInput(e){
const editFreeDing = async () => { const editFreeDing = async () => {
if (!form.rechargeTimes) { if (!form.rechargeTimes) {
uni.showToast({ uni.showToast({
title: "请输入充值设置", title: '请输入充值设置',
icon: "none", icon: 'none'
}); });
return; return;
} }
if (!form.rechargeThreshold) { if (!form.rechargeThreshold) {
uni.showToast({ uni.showToast({
title: "请输入充值门槛", title: '请输入充值门槛',
icon: "none", icon: 'none'
}); });
return; return;
} }
if (form.useShopType != "all" && !form.shopIdList.length) { if (form.useShopType != 'all' && !form.shopIdList.length) {
uni.showToast({ uni.showToast({
title: "请选择可用门店", title: '请选择可用门店',
icon: "none", icon: 'none'
}); });
return; return;
} }
if (form.useType.length == 0) { if (form.useType.length == 0) {
uni.showToast({ uni.showToast({
title: "请选择可使用类型", title: '请选择可使用类型',
icon: "none", icon: 'none'
}); });
return; return;
} }
let res = await updateFreeDing(form); let res = await updateFreeDing(form);
uni.showToast({ uni.showToast({
title: "保存成功", title: '保存成功'
}); });
Object.assign(form, res); Object.assign(form, res);
setTimeout(() => { setTimeout(() => {

View File

@@ -1,34 +1,20 @@
<template> <template>
<view class="box"> <view class="box">
<view class="bg-fff container u-flex u-m-b-32 top"> <view class="bg-fff container u-flex u-m-b-32 top">
<image <image style="width: 60rpx; height: 60rpx" src="/pageMarket/static/images/cost.png"></image>
style="width: 60rpx; height: 60rpx"
src="/pageMarket/static/images/cost.png"
></image>
<view class="u-flex-1 u-flex u-p-l-24"> <view class="u-flex-1 u-flex u-p-l-24">
<view class="u-font-28 u-flex-1 u-p-r-4"> <view class="u-font-28 u-flex-1 u-p-r-4">
<view class="color-333 font-bold">消费返现</view> <view class="color-333 font-bold">消费返现</view>
<view class="color-666 u-m-t-4 u-font-24" <view class="color-666 u-m-t-4 u-font-24">用户下单后返现一定的金额到余额可促进复购</view>
>用户下单后返现一定的金额到余额可促进复购 </view
>
</view> </view>
<up-switch <up-switch v-model="form.isEnable" :disabled="isMainShop() ? false : true" size="18" :active-value="1" :inactive-value="0"></up-switch>
v-model="form.isEnable"
:disabled="isMainShop()?false:true"
size="18"
:active-value="1"
:inactive-value="0"
></up-switch>
</view> </view>
</view> </view>
<view class="u-m-t-32 container"> <view class="u-m-t-32 container">
<view class="u-flex u-row-between u-m-b-16"> <view class="u-flex u-row-between u-m-b-16">
<text class="font-bold color-333">可用门店</text> <text class="font-bold color-333">可用门店</text>
</view> </view>
<my-shop-select <my-shop-select v-model:selShops="form.shopIdList" v-model:useType="form.useType"></my-shop-select>
v-model:selShops="form.shopIdList"
v-model:useType="form.useType"
></my-shop-select>
</view> </view>
<view class="u-m-t-32 container"> <view class="u-m-t-32 container">
@@ -44,12 +30,7 @@
</view> </view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<up-radio-group v-model="form.cashbackType" placement="row"> <up-radio-group v-model="form.cashbackType" placement="row">
<up-radio <up-radio v-for="item in cashbackTypes" :key="item.value" :name="item.value" :label="item.label">
v-for="item in cashbackTypes"
:key="item.value"
:name="item.value"
:label="item.label"
>
<template #label> <template #label>
<text> <text>
{{ item.label }} {{ item.label }}
@@ -61,22 +42,13 @@
<view class="u-flex u-row-between u-m-t-32"> <view class="u-flex u-row-between u-m-t-32">
<text class="font-bold color-333">阶梯设置</text> <text class="font-bold color-333">阶梯设置</text>
</view> </view>
<view <view class="u-m-t-32 u-flex u-row-between gap-40" v-for="(item, index) in form.cashbackStepList" :key="index">
class="u-m-t-32 u-flex u-row-between gap-40"
v-for="(item, index) in form.cashbackStepList"
:key="index"
>
<view class="u-flex u-col-top"> <view class="u-flex u-col-top">
<view class="no-wrap u-m-r-16 u-m-t-14">{{ returnName(index) }}</view> <view class="no-wrap u-m-r-16 u-m-t-14">{{ returnName(index) }}</view>
<view class="u-flex-1"> <view class="u-flex-1">
<view class="u-flex"> <view class="u-flex">
<text class="u-m-r-24">返现门槛</text> <text class="u-m-r-24">返现门槛</text>
<input <input class="my-input" type="digit" v-model="item.amount" placeholder="" />
class="my-input"
type="digit"
v-model="item.amount"
placeholder=""
/>
<text class="text-tips text-tips1"></text> <text class="text-tips text-tips1"></text>
</view> </view>
<view class="u-flex u-m-t-24"> <view class="u-flex u-m-t-24">
@@ -90,9 +62,7 @@
placeholder="" placeholder=""
/> />
<text class="text-tips text-tips1">{{ returnUnit }}</text> <text class="text-tips text-tips1">{{ returnUnit }}</text>
<text class="color-red u-m-l-10" @click="deleteThreshold(index)" <text class="color-red u-m-l-10" @click="deleteThreshold(index)">删除</text>
>删除</text
>
</view> </view>
</view> </view>
</view> </view>
@@ -105,48 +75,41 @@
</template> </template>
<script setup> <script setup>
import { reactive, computed, onMounted } from "vue"; import { reactive, computed, onMounted } from 'vue';
import userTypes from "./user-types.vue"; import userTypes from './user-types.vue';
import * as consumeCashbackApi from "@/http/api/market/consumeCashback.js"; import * as consumeCashbackApi from '@/http/api/market/consumeCashback.js';
import { isMainShop } from "@/store/account"; import { isMainShop } from '@/store/account';
import { import { onLoad, onReady, onShow, onPageScroll, onReachBottom, onBackPress } from '@dcloudio/uni-app';
onLoad,
onReady,
onShow,
onPageScroll,
onReachBottom,
onBackPress,
} from "@dcloudio/uni-app";
//返现类型 //返现类型
const cashbackTypes = [ const cashbackTypes = [
{ {
value: "percentage", value: 'percentage',
label: "按比例返现", label: '按比例返现'
}, },
{ {
value: "fix", value: 'fix',
label: "固定金额", label: '固定金额'
}, }
]; ];
const form = reactive({ const form = reactive({
isEnable: 0, isEnable: 0,
cashbackStepList: [], cashbackStepList: [],
shopIdList: [], shopIdList: [],
useType: "all", useType: 'all',
applicableUser: "all", applicableUser: 'all',
cashbackType: "percentage", cashbackType: 'percentage'
}); });
function addcashbackStepList() { function addcashbackStepList() {
form.cashbackStepList.push({ form.cashbackStepList.push({
amount: 0, amount: 0,
cashbackAmount: 0, cashbackAmount: 0
}); });
} }
function inputBlur(e, index) { function inputBlur(e, index) {
const value = e.detail.value; const value = e.detail.value;
if (form.cashbackType === "percentage") { if (form.cashbackType === 'percentage') {
if (e.detail.value >= 100) { if (e.detail.value >= 100) {
form.cashbackStepList[index].cashbackAmount = 100; form.cashbackStepList[index].cashbackAmount = 100;
} else if (e.detail.value < 0) { } else if (e.detail.value < 0) {
@@ -168,14 +131,14 @@ function inputBlur(e, index) {
async function save() { async function save() {
console.log(form); console.log(form);
const submitData = { const submitData = {
...form, ...form
}; };
const res = await consumeCashbackApi.update(submitData); const res = await consumeCashbackApi.update(submitData);
uni.showToast({ uni.showToast({
title: "更新成功", title: '更新成功',
icon: "none", icon: 'none',
duration: 2000, duration: 2000,
success: function () {}, success: function () {}
}); });
} }
function cancel() { function cancel() {
@@ -186,28 +149,28 @@ function deleteThreshold(index) {
form.cashbackStepList.splice(index, 1); form.cashbackStepList.splice(index, 1);
} }
function setForm(data) { function setForm(data) {
data.cashbackStepList=data.cashbackStepList||[] data.cashbackStepList = data.cashbackStepList || [];
Object.assign(form, data); Object.assign(form, data);
console.log(form); console.log(form);
} }
const returnUnit = computed(() => { const returnUnit = computed(() => {
return form.cashbackType === "percentage" ? "%" : "元"; return form.cashbackType === 'percentage' ? '%' : '元';
}); });
const numChineseMap = { const numChineseMap = {
0: "零", 0: '零',
1: "一", 1: '一',
2: "二", 2: '二',
3: "三", 3: '三',
4: "四", 4: '四',
5: "五", 5: '五',
6: "六", 6: '六',
7: "七", 7: '七',
8: "八", 8: '八',
9: "九", 9: '九',
10: "十", 10: '十',
100: "百", 100: '百',
1000: "千", 1000: '千'
}; };
// 辅助函数:将数字转换为中文数字 // 辅助函数:将数字转换为中文数字
@@ -221,11 +184,9 @@ function numberToChinese(n) {
const ten = Math.floor(n / 10); const ten = Math.floor(n / 10);
const unit = n % 10; const unit = n % 10;
if (ten === 1) { if (ten === 1) {
return unit === 0 ? "十" : `${numChineseMap[unit]}`; return unit === 0 ? '十' : `${numChineseMap[unit]}`;
} else { } else {
return unit === 0 return unit === 0 ? `${numChineseMap[ten]}` : `${numChineseMap[ten]}${numChineseMap[unit]}`;
? `${numChineseMap[ten]}`
: `${numChineseMap[ten]}${numChineseMap[unit]}`;
} }
} }
@@ -236,9 +197,7 @@ function numberToChinese(n) {
if (remainder === 0) { if (remainder === 0) {
return `${numChineseMap[hundred]}`; return `${numChineseMap[hundred]}`;
} else { } else {
return `${numChineseMap[hundred]}${ return `${numChineseMap[hundred]}${remainder < 10 ? '零' : ''}${numberToChinese(remainder)}`;
remainder < 10 ? "零" : ""
}${numberToChinese(remainder)}`;
} }
} }
@@ -249,9 +208,7 @@ function numberToChinese(n) {
if (remainder === 0) { if (remainder === 0) {
return `${numChineseMap[thousand]}`; return `${numChineseMap[thousand]}`;
} else { } else {
return `${numChineseMap[thousand]}${ return `${numChineseMap[thousand]}${remainder < 100 ? '零' : ''}${numberToChinese(remainder)}`;
remainder < 100 ? "零" : ""
}${numberToChinese(remainder)}`;
} }
} }
@@ -265,8 +222,11 @@ function returnName(index) {
const chineseNumber = numberToChinese(groupNumber); const chineseNumber = numberToChinese(groupNumber);
return `${chineseNumber}`; return `${chineseNumber}`;
} }
const emits = defineEmits(['get']);
async function getData() { async function getData() {
const res = await consumeCashbackApi.getConfig(); const res = await consumeCashbackApi.getConfig();
emits('get', res);
if (res) { if (res) {
setForm(res); setForm(res);
} }

View File

@@ -5,18 +5,16 @@
<my-tabs v-model="active" :list="tabs" textKey="label"></my-tabs> <my-tabs v-model="active" :list="tabs" textKey="label"></my-tabs>
<view class="u-flex u-m-t-40" v-if="active == 1"> <view class="u-flex u-m-t-40" v-if="active == 1">
<view class="u-flex color-333" @click="showShopSelActionSheetFun"> <view class="u-flex color-333" @click="showShopSelActionSheetFun">
<text class="u-line-1" style="max-width: 300rpx;">{{selShop.shopName || "全部门店"}}</text> <text class="u-line-1" style="max-width: 300rpx">{{ selShop.shopName || '全部门店' }}</text>
<up-icon name="arrow-down-fill" size="12" color="#333"></up-icon> <up-icon name="arrow-down-fill" size="12" color="#333"></up-icon>
</view> </view>
<view class="u-flex-1 u-p-l-16"> <view class="u-flex-1 u-p-l-16">
<up-search bgColor="#F9F9F9" height="60rpx" :showAction="false" placeholder="搜索订单号" <up-search bgColor="#F9F9F9" height="60rpx" :showAction="false" placeholder="搜索订单号" @search="search" @clear="search" v-model="searchText"></up-search>
@search="search" @clear="search" v-model="searchText"></up-search>
</view> </view>
</view> </view>
</view> </view>
</up-sticky> </up-sticky>
<configVue v-if="active == 0"></configVue> <configVue v-if="active == 0" @get="getConfigData"></configVue>
<view class="list u-font-28" v-if="active == 1"> <view class="list u-font-28" v-if="active == 1">
<view class="u-m-t-32 item" v-for="item in list" :key="item.id"> <view class="u-m-t-32 item" v-for="item in list" :key="item.id">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
@@ -42,14 +40,13 @@
<view class="color-666">返现金额</view> <view class="color-666">返现金额</view>
<view class="color-333 u-m-t-24">{{ item.cashbackAmount || 0 }}</view> <view class="color-333 u-m-t-24">{{ item.cashbackAmount || 0 }}</view>
</view> </view>
<view style="margin-left: 54rpx;"> <view style="margin-left: 54rpx">
<view class="color-666">支付金额</view> <view class="color-666">支付金额</view>
<view class="color-333 u-m-t-24">{{ item.amount || 0 }}</view> <view class="color-333 u-m-t-24">{{ item.amount || 0 }}</view>
</view> </view>
</view> </view>
</view> </view>
<view style="height: 32rpx;"></view> <view style="height: 32rpx"></view>
</view> </view>
<view class="u-p-30"> <view class="u-p-30">
<up-loadmore :status="isEnd ? 'nomore' : 'loading'"></up-loadmore> <up-loadmore :status="isEnd ? 'nomore' : 'loading'"></up-loadmore>
@@ -57,46 +54,41 @@
</view> </view>
<!-- 选择门店 --> <!-- 选择门店 -->
<shopSelActionSheetVue @choose="chooseShop" v-model="showShopSelActionSheet" title="选择门店"> <shopSelActionSheetVue @choose="chooseShop" v-model="showShopSelActionSheet" title="选择门店"></shopSelActionSheetVue>
</shopSelActionSheetVue>
<my-marketing-mask name="消费返现" v-if="isMarketShow(configInfo)"></my-marketing-mask>
</view> </view>
</template> </template>
<script setup> <script setup>
import { import { onLoad, onReady, onShow, onPageScroll, onReachBottom, onBackPress } from '@dcloudio/uni-app';
onLoad, import { isMainShop, isMarketShow } from '@/store/account.js';
onReady, import { ref, onMounted, watch } from 'vue';
onShow, import * as consumeCashbackApi from '@/http/api/market/consumeCashback.js';
onPageScroll, import configVue from './components/config.vue';
onReachBottom, import shopSelActionSheetVue from '@/pageMarket/components/shop-sel-action-sheet.vue';
onBackPress, const tabs = [
} from "@dcloudio/uni-app"; {
import { isMainShop } from "@/store/account.js"; label: '基本设置',
import { value: 'basic'
ref,
onMounted,
watch
} from "vue";
import * as consumeCashbackApi from "@/http/api/market/consumeCashback.js";
import configVue from './components/config.vue'
import shopSelActionSheetVue from '@/pageMarket/components/shop-sel-action-sheet.vue'
const tabs = [{
label: "基本设置",
value: "basic"
}, },
{ {
label: "返现明细", label: '返现明细',
value: "recoders" value: 'recoders'
}, }
]; ];
const configInfo = ref({});
function getConfigData(e) {
configInfo.value = e;
}
const list = ref([]); const list = ref([]);
const pageNum = ref(1); const pageNum = ref(1);
const isEnd = ref(false); const isEnd = ref(false);
const selShop = ref({ const selShop = ref({
shopId: "", shopId: '',
shopName: "", shopName: ''
}) });
const searchText = ref(""); const searchText = ref('');
function search() { function search() {
pageNum.value = 1; pageNum.value = 1;
@@ -107,17 +99,20 @@
selShop.value = e; selShop.value = e;
} }
watch(()=>selShop.value.shopId,(newval)=>{ watch(
() => selShop.value.shopId,
(newval) => {
pageNum.value = 1; pageNum.value = 1;
getList(); getList();
}) }
);
async function getList() { async function getList() {
const res = await consumeCashbackApi.getList({ const res = await consumeCashbackApi.getList({
pageNum: pageNum.value, pageNum: pageNum.value,
pageSize: 10, pageSize: 10,
shopId: selShop.value.shopId, shopId: selShop.value.shopId,
key: searchText.value, key: searchText.value
}); });
if (res) { if (res) {
if (pageNum.value == 1) { if (pageNum.value == 1) {
@@ -143,7 +138,6 @@
console.log(newval); console.log(newval);
pageNum.value = 1; pageNum.value = 1;
getList(); getList();
} }
); );
onReachBottom(() => { onReachBottom(() => {
@@ -162,7 +156,8 @@
background: #f7f7f7; background: #f7f7f7;
} }
.box {} .box {
}
.top { .top {
padding: 32rpx 24rpx; padding: 32rpx 24rpx;

View File

@@ -3,21 +3,15 @@
<up-sticky> <up-sticky>
<view class="bg-fff default-box-padding"> <view class="bg-fff default-box-padding">
<view class="u-flex"> <view class="u-flex">
<image <image style="width: 60rpx; height: 60rpx" src="/pageMarket/static/images/coupon_code.png"></image>
style="width: 60rpx; height: 60rpx"
src="/pageMarket/static/images/coupon_code.png"
></image>
<view class="u-flex-1 u-flex u-p-l-24"> <view class="u-flex-1 u-flex u-p-l-24">
<view class="u-font-28 u-flex-1 u-p-r-24"> <view class="u-font-28 u-flex-1 u-p-r-24">
<view class="color-333 font-bold">券兑换码</view> <view class="color-333 font-bold">券兑换码</view>
<view class="color-666 u-m-t-4 u-font-24" <view class="color-666 u-m-t-4 u-font-24">可添加多券组合兑换</view>
>可添加多券组合兑换
</view>
</view> </view>
<up-switch <up-switch
v-model="accountInfoStore.shopInfo.isProductSuggest" v-model="accountInfoStore.shopInfo.isProductSuggest"
:disabled="isMainShop() ? false : true" :disabled="isMainShop() ? false : true"
size="18" size="18"
:active-value="1" :active-value="1"
:inactive-value="0" :inactive-value="0"
@@ -29,10 +23,7 @@
<view class="u-p-t-60 default-box-x-padding"> <view class="u-p-t-60 default-box-x-padding">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="shop" @click="showShopModal">适用门店</view> <view class="shop" @click="showShopModal">适用门店</view>
<view <view class="u-flex status-sel u-row-between bg-fff u-line-1" @click="showStatusModal">
class="u-flex status-sel u-row-between bg-fff u-line-1"
@click="showStatusModal"
>
<text class="color-999" v-if="returnStatusText == '全部'">全部</text> <text class="color-999" v-if="returnStatusText == '全部'">全部</text>
<text class="color-333" v-else>{{ returnStatusText }}</text> <text class="color-333" v-else>{{ returnStatusText }}</text>
<up-icon name="arrow-down" size="14"></up-icon> <up-icon name="arrow-down" size="14"></up-icon>
@@ -40,25 +31,18 @@
</view> </view>
</view> </view>
<view class="default-box-padding"> <view class="default-box-padding">
<view <view v-for="(item, index) in list" class="u-m-b-56 default-box-radius bg-fff default-box-padding">
v-for="(item, index) in list"
class="u-m-b-56 default-box-radius bg-fff default-box-padding"
>
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<text class="u-font-32 font-bold color-333">{{ item.name }}</text> <text class="u-font-32 font-bold color-333">{{ item.name }}</text>
<view class="status" :class="['status' + item.status]">{{ <view class="status" :class="['status' + item.status]">{{ item.status == 0 ? '有效' : '无效' }}</view>
item.status == 0 ? "有效" : "无效"
}}</view>
</view> </view>
<view class="u-m-t-22 color-666 u-font-24 u-flex"> <view class="u-m-t-22 color-666 u-font-24 u-flex">
<view> <view>
<view>有效期{{ item.startTime }} {{ item.endTime }}</view> <view>有效期{{ item.startTime }} {{ item.endTime }}</view>
<view class="u-m-t-16" <view class="u-m-t-16">
>优惠券 优惠券
<text class="color-333 u-font-28 font-bold">{{ <text class="color-333 u-font-28 font-bold">{{ item.couponNum }}</text>
item.couponNum </view>
}}</text></view
>
<view class="u-m-t-16">{{ returnCoupon(item) }}</view> <view class="u-m-t-16">{{ returnCoupon(item) }}</view>
</view> </view>
@@ -73,24 +57,14 @@
<template v-if="isMainShop()"> <template v-if="isMainShop()">
<view style="height: 100rpx"></view> <view style="height: 100rpx"></view>
<view class="fixed-bottom"> <view class="fixed-bottom">
<my-button @click="go.to('PAGES_MARKET_COUPON_EXCHANGE_CODE_ADD')" <my-button @click="go.to('PAGES_MARKET_COUPON_EXCHANGE_CODE_ADD')">添加兑换码</my-button>
>添加兑换码</my-button
>
</view> </view>
</template> </template>
<Modal <Modal v-model="modalData.show" :title="modalData.title" @confirm="handleConfirm">
v-model="modalData.show"
:title="modalData.title"
@confirm="handleConfirm"
>
<template v-if="modalData.key == 'selShop'"> <template v-if="modalData.key == 'selShop'">
<view class="default-box-padding"> <view class="default-box-padding">
<my-shop-select <my-shop-select @shop-select="shopSelect" v-model:selShops="form.shopIdList" v-model:useType="form.useType"></my-shop-select>
@shop-select="shopSelect"
v-model:selShops="form.shopIdList"
v-model:useType="form.useType"
></my-shop-select>
</view> </view>
</template> </template>
</Modal> </Modal>
@@ -104,54 +78,46 @@
@select="selectStatus" @select="selectStatus"
:show="showAction" :show="showAction"
></u-action-sheet> ></u-action-sheet>
<my-marketing-mask name="充值兑换码" v-if="isMarketShow(form)"></my-marketing-mask>
</view> </view>
</template> </template>
<script setup> <script setup>
import { import { onLoad, onReady, onShow, onPageScroll, onReachBottom, onBackPress } from '@dcloudio/uni-app';
onLoad, import Modal from '@/pageMarket/components/modal.vue';
onReady, import * as couponRedemptionApi from '@/http/api/market/couponRedemption.js';
onShow, import { useAccountInfoStore } from '@/store/account.js';
onPageScroll, import go from '@/commons/utils/go.js';
onReachBottom, import { isMainShop, isMarketShow } from '@/store/account.js';
onBackPress,
} from "@dcloudio/uni-app";
import Modal from "@/pageMarket/components/modal.vue";
import * as couponRedemptionApi from "@/http/api/market/couponRedemption.js";
import { useAccountInfoStore } from "@/store/account.js";
import go from "@/commons/utils/go.js";
import { isMainShop } from "@/store/account.js";
const accountInfoStore = useAccountInfoStore(); const accountInfoStore = useAccountInfoStore();
import { ref, reactive, onMounted, computed, watch } from "vue"; import { ref, reactive, onMounted, computed, watch } from 'vue';
const loadFinish = ref(false); const loadFinish = ref(false);
const form = reactive({ const form = reactive({
isEnable: 0, isEnable: 0,
useType: "all", useType: 'all',
shopIdList: [], shopIdList: []
}); });
const actions = [ const actions = [
{ {
name: "全部", name: '全部',
value: "", value: ''
}, },
{ {
name: "有效", name: '有效',
value: "0", value: '0'
}, },
{ {
name: "无效", name: '无效',
value: "1", value: '1'
}, }
]; ];
const returnStatusText = computed(() => { const returnStatusText = computed(() => {
return actions.find((item) => item.value == query.status)?.name || "全部"; return actions.find((item) => item.value == query.status)?.name || '全部';
}); });
function returnCoupon(item) { function returnCoupon(item) {
return item.couponInfoList return item.couponInfoList.reduce((prev, cur) => prev + cur.title + '*' + cur.num + '、', '').slice(0, -1);
.reduce((prev, cur) => prev + cur.title + "*" + cur.num + "、", "")
.slice(0, -1);
} }
const showAction = ref(false); const showAction = ref(false);
function selectStatus(item) { function selectStatus(item) {
@@ -165,42 +131,42 @@ function showStatusModal() {
function showShopModal() { function showShopModal() {
modalData.show = true; modalData.show = true;
modalData.title = "适用门店"; modalData.title = '适用门店';
modalData.key = "selShop"; modalData.key = 'selShop';
} }
const firstModalTime = ref(0); const firstModalTime = ref(0);
const modalData = reactive({ const modalData = reactive({
show: false, show: false,
title: "", title: '',
key: "", key: ''
}); });
function handleDelete(item) { function handleDelete(item) {
uni.showModal({ uni.showModal({
title: "确认删除吗?", title: '确认删除吗?',
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
couponRedemptionApi couponRedemptionApi
.delete({ .delete({
id: item.id, id: item.id
}) })
.then((res) => { .then((res) => {
uni.showToast({ uni.showToast({
title: "删除成功", title: '删除成功',
icon: "none", icon: 'none'
}); });
refreshList(); refreshList();
}); });
} }
}, }
}); });
} }
const isEnd = ref(false); const isEnd = ref(false);
const query = reactive({ const query = reactive({
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
status: "", status: ''
}); });
const list = ref([]); const list = ref([]);
function refreshList() { function refreshList() {
@@ -210,18 +176,18 @@ function refreshList() {
} }
function handleEdit(item) { function handleEdit(item) {
uni.setStorageSync("couponRedemptionItem", item); uni.setStorageSync('couponRedemptionItem', item);
go.to("PAGES_MARKET_COUPON_EXCHANGE_CODE_DETAIL", { go.to('PAGES_MARKET_COUPON_EXCHANGE_CODE_DETAIL', {
type: "edit", type: 'edit'
}); });
} }
const handleConfirm = async () => { const handleConfirm = async () => {
if (form.useType == "custom") { if (form.useType == 'custom') {
if (form.shopIdList.length == 0) { if (form.shopIdList.length == 0) {
uni.showToast({ uni.showToast({
title: "请选择适用门店", title: '请选择适用门店',
icon: "none", icon: 'none'
}); });
return; return;
} }
@@ -230,11 +196,11 @@ const handleConfirm = async () => {
couponRedemptionApi.enable({ couponRedemptionApi.enable({
shopIdList: form.shopIdList || [], shopIdList: form.shopIdList || [],
useType: form.useType, useType: form.useType,
isEnable: form.isEnable, isEnable: form.isEnable
}); });
uni.showToast({ uni.showToast({
title: "修改成功", title: '修改成功',
icon: "none", icon: 'none'
}); });
modalData.show = false; modalData.show = false;
}; };
@@ -270,11 +236,11 @@ watch(
if (!loadFinish.value) return; if (!loadFinish.value) return;
accountInfoStore.editShopInfo({ accountInfoStore.editShopInfo({
isProductSuggest: newVal, isProductSuggest: newVal,
id: accountInfoStore.shopInfo.id, id: accountInfoStore.shopInfo.id
}); });
uni.showToast({ uni.showToast({
title: "修改成功", title: '修改成功',
icon: "none", icon: 'none'
}); });
} }
); );
@@ -293,7 +259,7 @@ async function getConfig() {
}); });
} }
onReachBottom(() => { onReachBottom(() => {
console.log("触底"); console.log('触底');
getList(); getList();
}); });
onMounted(() => { onMounted(() => {

View File

@@ -3,16 +3,11 @@
<up-sticky> <up-sticky>
<view class="bg-fff default-box-padding"> <view class="bg-fff default-box-padding">
<view class="u-flex"> <view class="u-flex">
<image <image style="width: 60rpx; height: 60rpx" src="/pageMarket/static/images/coupon_code.png"></image>
style="width: 60rpx; height: 60rpx"
src="/pageMarket/static/images/coupon_code.png"
></image>
<view class="u-flex-1 u-flex u-p-l-24"> <view class="u-flex-1 u-flex u-p-l-24">
<view class="u-font-28 u-flex-1 u-p-r-24"> <view class="u-font-28 u-flex-1 u-p-r-24">
<view class="color-333 font-bold">充值兑换码</view> <view class="color-333 font-bold">充值兑换码</view>
<view class="color-666 u-m-t-4 u-font-24" <view class="color-666 u-m-t-4 u-font-24">兑换码直充余额可当作礼品赠送</view>
>兑换码直充余额可当作礼品赠送
</view>
</view> </view>
<up-switch <up-switch
v-model="accountInfoStore.shopInfo.isProductSuggest" v-model="accountInfoStore.shopInfo.isProductSuggest"
@@ -28,10 +23,7 @@
<view class="u-p-t-60 default-box-x-padding"> <view class="u-p-t-60 default-box-x-padding">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="shop" @click="showShopModal">适用门店</view> <view class="shop" @click="showShopModal">适用门店</view>
<view <view class="u-flex status-sel u-row-between bg-fff u-line-1" @click="showStatusModal">
class="u-flex status-sel u-row-between bg-fff u-line-1"
@click="showStatusModal"
>
<text class="color-999" v-if="returnStatusText == '全部'">全部</text> <text class="color-999" v-if="returnStatusText == '全部'">全部</text>
<text class="color-333" v-else>{{ returnStatusText }}</text> <text class="color-333" v-else>{{ returnStatusText }}</text>
<up-icon name="arrow-down" size="14"></up-icon> <up-icon name="arrow-down" size="14"></up-icon>
@@ -39,20 +31,13 @@
</view> </view>
</view> </view>
<view class="default-box-padding"> <view class="default-box-padding">
<view <view v-for="(item, index) in list" class="u-m-b-56 default-box-radius bg-fff default-box-padding">
v-for="(item, index) in list"
class="u-m-b-56 default-box-radius bg-fff default-box-padding"
>
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view> <view>
<text class="u-font-32 font-bold color-333">{{ item.name }}</text> <text class="u-font-32 font-bold color-333">{{ item.name }}</text>
<text class="u-font-24 color-666 u-m-l-20" <text class="u-font-24 color-666 u-m-l-20">金额{{ item.amount }}</text>
>金额{{ item.amount }}</text
>
</view> </view>
<view class="status" :class="['status' + item.status]">{{ <view class="status" :class="['status' + item.status]">{{ item.status == 0 ? '有效' : '无效' }}</view>
item.status == 0 ? "有效" : "无效"
}}</view>
</view> </view>
<view class="u-m-t-22 color-666 u-font-24 u-flex"> <view class="u-m-t-22 color-666 u-font-24 u-flex">
<view> <view>
@@ -60,15 +45,11 @@
<view class="u-m-t-16 u-flex"> <view class="u-m-t-16 u-flex">
<view> <view>
<text>总数</text> <text>总数</text>
<text class="color-333 u-font-28 font-bold">{{ <text class="color-333 u-font-28 font-bold">{{ item.total }}</text>
item.total
}}</text>
</view> </view>
<view> <view>
<text class="u-m-l-20">库存</text> <text class="u-m-l-20">库存</text>
<text class="color-333 u-font-28 font-bold">{{ <text class="color-333 u-font-28 font-bold">{{ item.stock }}</text>
item.stock
}}</text>
</view> </view>
</view> </view>
<!-- <view class="u-m-t-16">{{ returnCoupon(item) }}</view> --> <!-- <view class="u-m-t-16">{{ returnCoupon(item) }}</view> -->
@@ -85,25 +66,14 @@
<template v-if="isMainShop()"> <template v-if="isMainShop()">
<view style="height: 100rpx"></view> <view style="height: 100rpx"></view>
<view class="fixed-bottom"> <view class="fixed-bottom">
<my-button @click="go.to('PAGES_MARKET_RECHARGE_EXCHANGE_CODE_ADD')" <my-button @click="go.to('PAGES_MARKET_RECHARGE_EXCHANGE_CODE_ADD')">添加兑换码</my-button>
>添加兑换码</my-button
>
</view> </view>
</template> </template>
<Modal v-model="modalData.show" :title="modalData.title" @confirm="handleConfirm">
<Modal
v-model="modalData.show"
:title="modalData.title"
@confirm="handleConfirm"
>
<template v-if="modalData.key == 'selShop'"> <template v-if="modalData.key == 'selShop'">
<view class="default-box-padding"> <view class="default-box-padding">
<my-shop-select <my-shop-select @shop-select="shopSelect" v-model:selShops="form.shopIdList" v-model:useType="form.useType"></my-shop-select>
@shop-select="shopSelect"
v-model:selShops="form.shopIdList"
v-model:useType="form.useType"
></my-shop-select>
</view> </view>
</template> </template>
</Modal> </Modal>
@@ -117,54 +87,47 @@
@select="selectStatus" @select="selectStatus"
:show="showAction" :show="showAction"
></u-action-sheet> ></u-action-sheet>
<my-marketing-mask name="充值兑换码" v-if="isMarketShow(form)"></my-marketing-mask>
</view> </view>
</template> </template>
<script setup> <script setup>
import { import { onLoad, onReady, onShow, onPageScroll, onReachBottom, onBackPress } from '@dcloudio/uni-app';
onLoad, import Modal from '@/pageMarket/components/modal.vue';
onReady, import * as rechargeRedemptionApi from '@/http/api/market/rechargeRedemption.js';
onShow, import { useAccountInfoStore } from '@/store/account.js';
onPageScroll, import go from '@/commons/utils/go.js';
onReachBottom, import { isMainShop, isMarketShow } from '@/store/account.js';
onBackPress,
} from "@dcloudio/uni-app";
import Modal from "@/pageMarket/components/modal.vue";
import * as rechargeRedemptionApi from "@/http/api/market/rechargeRedemption.js";
import { useAccountInfoStore } from "@/store/account.js";
import go from "@/commons/utils/go.js";
import {isMainShop} from "@/store/account.js";
const accountInfoStore = useAccountInfoStore(); const accountInfoStore = useAccountInfoStore();
import { ref, reactive, onMounted, computed, watch } from "vue"; import { ref, reactive, onMounted, computed, watch } from 'vue';
const loadFinish = ref(false); const loadFinish = ref(false);
const form = reactive({ const form = reactive({
isEnable: 0, isEnable: 0,
useType: "all", useType: 'all',
shopIdList: [] shopIdList: []
}); });
const actions = [ const actions = [
{ {
name: "全部", name: '全部',
value: "", value: ''
}, },
{ {
name: "有效", name: '有效',
value: "0", value: '0'
}, },
{ {
name: "无效", name: '无效',
value: "1", value: '1'
}, }
]; ];
const returnStatusText = computed(() => { const returnStatusText = computed(() => {
return actions.find((item) => item.value == query.status)?.name || "全部"; return actions.find((item) => item.value == query.status)?.name || '全部';
}); });
function returnCoupon(item) { function returnCoupon(item) {
return item.couponInfoList return item.couponInfoList.reduce((prev, cur) => prev + cur.title + '*' + cur.num + '、', '').slice(0, -1);
.reduce((prev, cur) => prev + cur.title + "*" + cur.num + "、", "")
.slice(0, -1);
} }
const showAction = ref(false); const showAction = ref(false);
function selectStatus(item) { function selectStatus(item) {
@@ -178,42 +141,42 @@ function showStatusModal() {
function showShopModal() { function showShopModal() {
modalData.show = true; modalData.show = true;
modalData.title = "适用门店"; modalData.title = '适用门店';
modalData.key = "selShop"; modalData.key = 'selShop';
} }
const firstModalTime = ref(0); const firstModalTime = ref(0);
const modalData = reactive({ const modalData = reactive({
show: false, show: false,
title: "", title: '',
key: "", key: ''
}); });
function handleDelete(item) { function handleDelete(item) {
uni.showModal({ uni.showModal({
title: "确认删除吗?", title: '确认删除吗?',
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
rechargeRedemptionApi rechargeRedemptionApi
.delete({ .delete({
id: item.id, id: item.id
}) })
.then((res) => { .then((res) => {
uni.showToast({ uni.showToast({
title: "删除成功", title: '删除成功',
icon: "none", icon: 'none'
}); });
refreshList(); refreshList();
}); });
} }
}, }
}); });
} }
const isEnd = ref(false); const isEnd = ref(false);
const query = reactive({ const query = reactive({
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
status: "", status: ''
}); });
const list = ref([]); const list = ref([]);
function refreshList() { function refreshList() {
@@ -223,18 +186,18 @@ function refreshList() {
} }
function handleEdit(item) { function handleEdit(item) {
uni.setStorageSync("rechargeRedemption", item); uni.setStorageSync('rechargeRedemption', item);
go.to("PAGES_MARKET_RECHARGE_EXCHANGE_CODE_ADD_DWTAIL", { go.to('PAGES_MARKET_RECHARGE_EXCHANGE_CODE_ADD_DWTAIL', {
type: "edit", type: 'edit'
}); });
} }
const handleConfirm = async () => { const handleConfirm = async () => {
if (form.useType == "custom") { if (form.useType == 'custom') {
if (form.shopIdList.length == 0) { if (form.shopIdList.length == 0) {
uni.showToast({ uni.showToast({
title: "请选择适用门店", title: '请选择适用门店',
icon: "none", icon: 'none'
}); });
return; return;
} }
@@ -243,11 +206,11 @@ const handleConfirm = async () => {
rechargeRedemptionApi.enable({ rechargeRedemptionApi.enable({
shopIdList: form.shopIdList || [], shopIdList: form.shopIdList || [],
useType: form.useType, useType: form.useType,
isEnable: form.isEnable, isEnable: form.isEnable
}); });
uni.showToast({ uni.showToast({
title: "修改成功", title: '修改成功',
icon: "none", icon: 'none'
}); });
modalData.show = false; modalData.show = false;
}; };
@@ -283,11 +246,11 @@ watch(
if (!loadFinish.value) return; if (!loadFinish.value) return;
accountInfoStore.editShopInfo({ accountInfoStore.editShopInfo({
isProductSuggest: newVal, isProductSuggest: newVal,
id: accountInfoStore.shopInfo.id, id: accountInfoStore.shopInfo.id
}); });
uni.showToast({ uni.showToast({
title: "修改成功", title: '修改成功',
icon: "none", icon: 'none'
}); });
} }
); );
@@ -306,7 +269,7 @@ async function getConfig() {
}); });
} }
onReachBottom(() => { onReachBottom(() => {
console.log("触底"); console.log('触底');
getList(); getList();
}); });
onMounted(() => { onMounted(() => {

View File

@@ -87,6 +87,7 @@
</template> </template>
<my-model ref="model" :desc="modelData.desc"></my-model> <my-model ref="model" :desc="modelData.desc"></my-model>
<my-date-pickerview @confirm="datePickerConfirm" ref="datePicker"></my-date-pickerview> <my-date-pickerview @confirm="datePickerConfirm" ref="datePicker"></my-date-pickerview>
<my-marketing-mask name="智慧充值" v-if="isMarketShow(shopRechargeRes)"></my-marketing-mask>
</view> </view>
</template> </template>
@@ -105,7 +106,7 @@ import $util from '@/commons/utils/getDateArea.js';
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import { shopRechargePost, shopRechargeGet } from '@/http/api/market/index.js'; import { shopRechargePost, shopRechargeGet } from '@/http/api/market/index.js';
import { onLoad } from '@dcloudio/uni-app'; import { onLoad } from '@dcloudio/uni-app';
import { isMainShop } from '@/store/account.js'; import { isMainShop, isMarketShow } from '@/store/account.js';
const isCanEdit = computed(() => { const isCanEdit = computed(() => {
return isMainShop(); return isMainShop();
@@ -192,11 +193,12 @@ function useTypeChange(e) {
} }
// 获取设置 // 获取设置
const shopRechargeRes = ref({});
async function shopRechargeGetAjax() { async function shopRechargeGetAjax() {
try { try {
const res = await shopRechargeGet(); shopRechargeRes.value = await shopRechargeGet();
isOpen.value = res.isEnable; isOpen.value = shopRechargeRes.value.isEnable;
res.rechargeDetailList.forEach((item) => { shopRechargeRes.value.rechargeDetailList.forEach((item) => {
item.couponInfoList.forEach((val) => { item.couponInfoList.forEach((val) => {
if (val.coupon && val.coupon !== null) { if (val.coupon && val.coupon !== null) {
val.id = val.coupon.id; val.id = val.coupon.id;
@@ -204,8 +206,8 @@ async function shopRechargeGetAjax() {
} }
}); });
}); });
settingForm.value = res; settingForm.value = shopRechargeRes.value;
rechargeLists.value = res.rechargeDetailList; rechargeLists.value = shopRechargeRes.value.rechargeDetailList;
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }

View File

@@ -1,8 +1,10 @@
// stores/counter.js // stores/counter.js
import { defineStore } from "pinia"; import {
defineStore
} from "pinia";
import * as shopApi from "@/http/api/shop.js"; import * as shopApi from "@/http/api/shop.js";
//判断是否是主店 // 判断是否是主店,并且是否有查看权限
export const isMainShop = (shopId) => { export const isMainShop = (shopId) => {
const shopInfo = uni.getStorageSync("shopInfo"); const shopInfo = uni.getStorageSync("shopInfo");
if (shopInfo.isHeadShop) { if (shopInfo.isHeadShop) {
@@ -14,6 +16,28 @@ export const isMainShop = (shopId) => {
return false 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", { export const useAccountInfoStore = defineStore("accountInfo", {
state: () => { state: () => {