Merge branch 'new_gyq' of https://newgitea.sxczgkj.cn/czg_team/cashier_app into ymf
This commit is contained in:
@@ -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 的数据读写都将持久化
|
||||
});
|
||||
Reference in New Issue
Block a user