初始上传
This commit is contained in:
48
addon/cashier/source/os/store/getters.js
Executable file
48
addon/cashier/source/os/store/getters.js
Executable file
@@ -0,0 +1,48 @@
|
||||
const getters = {
|
||||
rootSize: state => state.app.rootSize,
|
||||
firstMenuIndex: state => state.app.firstMenuIndex,
|
||||
secondMenuIndex: state => state.app.secondMenuIndex,
|
||||
thirdMenuIndex: state => state.app.thirdMenuIndex,
|
||||
currRoute: state => state.app.currRoute,
|
||||
globalMemberId: state => state.app.globalMemberId,
|
||||
globalMemberInfo: state => {
|
||||
let info = state.app.globalMemberInfo;
|
||||
if (info) {
|
||||
if (state.app.userInfo && state.app.userInfo.is_admin == 0 && info.mobile) {
|
||||
// 非管理员,不能查看会员手机号
|
||||
if (info.mobile.indexOf('****') == -1) info.originalMobile = info.mobile;
|
||||
info.mobile = info.mobile.substring(0, 4 - 1) + '****' + info.mobile.substring(6 + 1);
|
||||
}
|
||||
}
|
||||
return info;
|
||||
},
|
||||
globalStoreId: state => state.app.globalStoreId,
|
||||
globalStoreInfo: state => state.app.globalStoreInfo,
|
||||
userInfo: state => state.app.userInfo,
|
||||
addon: state => state.app.addon,
|
||||
menu: state => state.app.menu,
|
||||
defaultImg: state => state.app.defaultImg,
|
||||
themeConfig: state => state.app.themeConfig,
|
||||
memberSearchWayConfig: state => state.app.memberSearchWayConfig,
|
||||
|
||||
// 开单
|
||||
pendOrderNum: state => state.billing.pendOrderNum,
|
||||
billingGoodsData: state => state.billing.goodsData,
|
||||
billingOrderData: state => state.billing.orderData,
|
||||
billingGoodsIds: state => state.billing.goodsIds,
|
||||
billingActive: state => state.billing.active,
|
||||
billingIsScanTrigger: state => state.billing.isScanTrigger,
|
||||
billingPendOrderId: state => state.billing.pendOrderId,
|
||||
billingIsShowCashBox: state => state.billing.isShowCashBox,
|
||||
|
||||
// 售卡
|
||||
buyCardGoodsData: state => state.buycard.goodsData,
|
||||
buyCardOrderData: state => state.buycard.orderData,
|
||||
buyCardActive: state => state.buycard.active,
|
||||
|
||||
// 充值
|
||||
rechargeActive: state => state.recharge.active,
|
||||
|
||||
};
|
||||
|
||||
export default getters;
|
||||
23
addon/cashier/source/os/store/index.js
Executable file
23
addon/cashier/source/os/store/index.js
Executable file
@@ -0,0 +1,23 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
|
||||
import app from "./modules/app"
|
||||
import billing from "./modules/billing"
|
||||
import buycard from "./modules/buycard"
|
||||
import recharge from "./modules/recharge"
|
||||
|
||||
import getters from "./getters"
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
||||
const store = new Vuex.Store({
|
||||
modules: {
|
||||
app,
|
||||
billing,
|
||||
buycard,
|
||||
recharge
|
||||
},
|
||||
getters
|
||||
});
|
||||
|
||||
export default store;
|
||||
255
addon/cashier/source/os/store/modules/app.js
Executable file
255
addon/cashier/source/os/store/modules/app.js
Executable file
@@ -0,0 +1,255 @@
|
||||
// 应用数据持久化存储
|
||||
|
||||
import {getAddonIsExist, getDefaultImg, getThemeConfig, getMemberSearchWayConfig} from '@/api/config.js'
|
||||
import {getUserDetail, getUserGroupAuth} from '@/api/user.js'
|
||||
import {getStoreInfo} from '@/api/store.js'
|
||||
import util from '@/common/js/util';
|
||||
|
||||
const state = {
|
||||
rootSize: '100px',
|
||||
firstMenuIndex: 0,
|
||||
secondMenuIndex: -1,
|
||||
thirdMenuIndex: -1,
|
||||
currRoute: '',
|
||||
globalMemberInfo: null,
|
||||
globalStoreId: 0,
|
||||
globalStoreInfo: null,
|
||||
userInfo: null,
|
||||
addon: [],
|
||||
menu: [],
|
||||
defaultImg: {
|
||||
goods: '',
|
||||
head: '',
|
||||
store: '',
|
||||
article: ''
|
||||
},
|
||||
themeConfig: {
|
||||
title: '',
|
||||
name: '',
|
||||
color: ''
|
||||
},
|
||||
memberSearchWayConfig : {
|
||||
way : 'exact' // // exact:精确搜索,list:列表搜索
|
||||
},
|
||||
isSocketConnect:false,
|
||||
overallAudio:null,
|
||||
overallAudioSrc:'',
|
||||
overallAudioSrcConfig:{},
|
||||
overallAudioBindClientId:'',
|
||||
overallAudioIsPlay:false,
|
||||
overallAudioIsEnded:true,
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
setRootSize(state, value) {
|
||||
state.rootSize = value;
|
||||
},
|
||||
setMenuIndex(state, value) {
|
||||
state[value.level] = value.index;
|
||||
},
|
||||
setCurrRoute(state, value) {
|
||||
state.currRoute = value;
|
||||
},
|
||||
setGlobalMemberInfo(state, value) {
|
||||
state.globalMemberInfo = value;
|
||||
if (value) {
|
||||
uni.setStorageSync('globalMemberInfo', value);
|
||||
} else {
|
||||
uni.removeStorageSync('globalMemberInfo');
|
||||
}
|
||||
},
|
||||
setGlobalStoreId(state, value) {
|
||||
state.globalStoreId = value;
|
||||
if (value) {
|
||||
uni.setStorageSync('globalStoreId', value);
|
||||
} else {
|
||||
uni.removeStorageSync('globalStoreId');
|
||||
}
|
||||
},
|
||||
setGlobalStoreInfo(state, value) {
|
||||
state.globalStoreInfo = value;
|
||||
if (value) {
|
||||
uni.setStorageSync('globalStoreInfo', value);
|
||||
} else {
|
||||
uni.removeStorageSync('globalStoreInfo');
|
||||
}
|
||||
},
|
||||
setAddon(state, value) {
|
||||
state.addon = value;
|
||||
if (value) {
|
||||
uni.setStorageSync('addon', value);
|
||||
} else {
|
||||
uni.removeStorageSync('addon');
|
||||
}
|
||||
},
|
||||
setUserInfo(state, value) {
|
||||
state.userInfo = value;
|
||||
if (value) {
|
||||
uni.setStorageSync('userInfo', value);
|
||||
} else {
|
||||
uni.removeStorageSync('userInfo');
|
||||
}
|
||||
},
|
||||
setMenu(state, value) {
|
||||
state.menu = value;
|
||||
if (value) {
|
||||
uni.setStorageSync('menu', value);
|
||||
} else {
|
||||
uni.removeStorageSync('menu');
|
||||
}
|
||||
},
|
||||
setDefaultImg(state, value) {
|
||||
state.defaultImg = value;
|
||||
uni.setStorageSync('defaultImg', value);
|
||||
},
|
||||
setThemeConfig(state, value) {
|
||||
state.themeConfig = value;
|
||||
uni.setStorageSync('themeConfig', value);
|
||||
},
|
||||
setMemberSearchWayConfig(state, value) {
|
||||
state.memberSearchWayConfig = value;
|
||||
uni.setStorageSync('memberSearchWayConfig', value);
|
||||
},
|
||||
setIsSocketConnect(state,value){
|
||||
state.isSocketConnect = value
|
||||
},
|
||||
initOverallAudio(state,value){
|
||||
state.overallAudioSrc = util.img(value.order_pay_audio)
|
||||
state.overallAudioSrcConfig = value
|
||||
state.overallAudio = new Audio(state.overallAudioSrc);
|
||||
state.overallAudio.addEventListener('ended',()=>{
|
||||
state.overallAudioIsEnded = true
|
||||
});
|
||||
},
|
||||
setOverallAudioBindClientId(state,value){
|
||||
state.overallAudioBindClientId = value
|
||||
},
|
||||
overallAudioPlay(state,key){
|
||||
if(state.overallAudioIsPlay&&state.overallAudioIsEnded){
|
||||
if(state.overallAudioSrc != util.img(state.overallAudioSrcConfig[key])){
|
||||
state.overallAudioSrc = util.img(state.overallAudioSrcConfig [key])
|
||||
state.overallAudio.src = util.img(state.overallAudioSrcConfig [key])
|
||||
state.overallAudio.load();
|
||||
}
|
||||
state.overallAudio.play()
|
||||
state.overallAudioIsEnded = false
|
||||
}
|
||||
},
|
||||
setOverallAudioIsPlay(state,value){
|
||||
state.overallAudioIsPlay = value
|
||||
}
|
||||
};
|
||||
|
||||
const actions = {
|
||||
getStoreInfoFn(context, params) {
|
||||
getStoreInfo().then((res) => {
|
||||
if (res.code >= 0) {
|
||||
if (res.data.is_frozen == 1) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/store/close'
|
||||
});
|
||||
return;
|
||||
}
|
||||
context.commit('setGlobalStoreInfo', res.data);
|
||||
if (params && params.callback) params.callback(res.data);
|
||||
}
|
||||
});
|
||||
},
|
||||
getAddonIsExistFn(context) {
|
||||
getAddonIsExist().then((res) => {
|
||||
if (res.code == 0) {
|
||||
context.commit('setAddon', res.data)
|
||||
}
|
||||
})
|
||||
},
|
||||
getUserInfoFn(context) {
|
||||
getUserDetail().then((res) => {
|
||||
if (res.code == 0) {
|
||||
context.commit('setUserInfo', res.data)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 查询菜单权限
|
||||
getUserGroupFn(context) {
|
||||
getUserGroupAuth().then((res) => {
|
||||
if (res.code == 0) {
|
||||
if (res.code == 0 && res.data) {
|
||||
let menu = require('@/common/menu/store.js').default ?? [];
|
||||
let addon = this.state.app.addon;
|
||||
const checkAuth = function (menu, auth) {
|
||||
let newMenu = [];
|
||||
menu.map(item => {
|
||||
if (item.children) {
|
||||
item.children = checkAuth(item.children, auth);
|
||||
}
|
||||
if (item.addon && addon.indexOf(item.addon) == -1)
|
||||
return;
|
||||
if (item.name && !res.data.is_admin && auth.length && auth.indexOf(item.name) == -1) {
|
||||
newMenu.push({});
|
||||
return;
|
||||
}
|
||||
|
||||
newMenu.push(item);
|
||||
});
|
||||
return newMenu;
|
||||
};
|
||||
menu = checkAuth(JSON.parse(JSON.stringify(menu)), res.data.menu_array ? res.data.menu_array.split(',') : []);
|
||||
context.commit('setMenu', menu);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
getDefaultImgFn(context) {
|
||||
getDefaultImg().then((res) => {
|
||||
if (res.code == 0) {
|
||||
context.commit('setDefaultImg', res.data)
|
||||
}
|
||||
})
|
||||
},
|
||||
getThemeConfigFn(context) {
|
||||
getThemeConfig().then((res) => {
|
||||
if (res.code == 0) {
|
||||
context.commit('setThemeConfig', res.data)
|
||||
}else{
|
||||
context.commit('setThemeConfig', {
|
||||
title : '橙色', // 标题
|
||||
name : 'orange', // 标识
|
||||
color : '#FA6400' // 主色调
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
getMemberSearchWayConfigFn(context){
|
||||
getMemberSearchWayConfig().then((res)=>{
|
||||
if (res.code == 0) {
|
||||
context.commit('setMemberSearchWayConfig', res.data)
|
||||
}else{
|
||||
context.commit('setMemberSearchWayConfig', {
|
||||
way : 'exact', // exact:精确搜索,list:列表搜索
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
setIsSocketConnect(context,value){
|
||||
context.commit('setIsSocketConnect',value)
|
||||
},
|
||||
initOverallAudio(context,value){
|
||||
context.commit('initOverallAudio',value)
|
||||
},
|
||||
setOverallAudioBindClientId(context,value){
|
||||
context.commit('setOverallAudioBindClientId',value)
|
||||
},
|
||||
overallAudioPlay(context,key){
|
||||
context.commit('overallAudioPlay',key)
|
||||
},
|
||||
setOverallAudioIsPlay(context,value){
|
||||
context.commit('setOverallAudioIsPlay',value)
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
82
addon/cashier/source/os/store/modules/billing.js
Executable file
82
addon/cashier/source/os/store/modules/billing.js
Executable file
@@ -0,0 +1,82 @@
|
||||
// 开单数据持久化存储
|
||||
|
||||
const state = {
|
||||
goodsData: {},
|
||||
orderData: {
|
||||
goods_num: 0,
|
||||
pay_money: 0,
|
||||
goods_list: [],
|
||||
remark: '',
|
||||
create_time: 0,
|
||||
order_key: '',
|
||||
order_id: 0
|
||||
},
|
||||
goodsIds: [],
|
||||
pendOrderNum: 0,
|
||||
active: '', // 记录当前页面的活跃值
|
||||
isScanTrigger: false, // 扫码枪是否触发
|
||||
pendOrderId: 0,
|
||||
isShowCashBox: false
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
setGoodsIds(state, value) {
|
||||
state.goodsIds = value;
|
||||
if (value) {
|
||||
uni.setStorageSync('billingGoodsIds', state.goodsIds);
|
||||
} else {
|
||||
uni.removeStorageSync('billingGoodsIds');
|
||||
}
|
||||
},
|
||||
setGoodsData(state, value) {
|
||||
state.goodsData = value;
|
||||
if (value) {
|
||||
uni.setStorageSync('billingGoodsData', state.goodsData);
|
||||
} else {
|
||||
uni.removeStorageSync('billingGoodsData');
|
||||
}
|
||||
},
|
||||
setOrderData(state, value) {
|
||||
if (value) {
|
||||
for (let key in value) {
|
||||
if (state.orderData[key] != undefined) state.orderData[key] = value[key];
|
||||
}
|
||||
uni.setStorageSync('billingOrderData', state.orderData);
|
||||
} else {
|
||||
uni.removeStorageSync('billingOrderData');
|
||||
}
|
||||
},
|
||||
setPendOrderNum(state, value) {
|
||||
state.pendOrderNum = value;
|
||||
},
|
||||
setActive(state, value) {
|
||||
state.active = value;
|
||||
if (value) {
|
||||
uni.setStorageSync('billingActive', state.active);
|
||||
} else {
|
||||
uni.removeStorageSync('billingActive');
|
||||
}
|
||||
},
|
||||
setIsScanTrigger(state, value) {
|
||||
state.isScanTrigger = value;
|
||||
uni.setStorageSync('billingIsScanTrigger', state.isScanTrigger);
|
||||
},
|
||||
setPendOrderId(state, value) {
|
||||
state.pendOrderId = value;
|
||||
uni.setStorageSync('pendOrderId', state.pendOrderId);
|
||||
},
|
||||
setIsShowCashBox(state, value) {
|
||||
state.isShowCashBox = value;
|
||||
uni.setStorageSync('isShowCashBox', state.isShowCashBox);
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
const actions = {};
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
54
addon/cashier/source/os/store/modules/buycard.js
Executable file
54
addon/cashier/source/os/store/modules/buycard.js
Executable file
@@ -0,0 +1,54 @@
|
||||
// 售卡数据持久化存储
|
||||
|
||||
const state = {
|
||||
goodsData: {},
|
||||
orderData: {
|
||||
pay_money: 0,
|
||||
goods_list: [],
|
||||
remark: '',
|
||||
goods_num: 0,
|
||||
card_type: 'oncecard',
|
||||
create_time: 0,
|
||||
order_key: '',
|
||||
order_id: 0
|
||||
},
|
||||
active: '', // 记录当前页面的活跃值
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
setGoodsData(state, value) {
|
||||
state.goodsData = value;
|
||||
if (value) {
|
||||
uni.setStorageSync('buyCardGoodsData', state.goodsData);
|
||||
} else {
|
||||
uni.removeStorageSync('buyCardGoodsData');
|
||||
}
|
||||
},
|
||||
setOrderData(state, value) {
|
||||
if (value) {
|
||||
for (let key in value) {
|
||||
if (state.orderData[key] != undefined) state.orderData[key] = value[key];
|
||||
}
|
||||
uni.setStorageSync('buyCardOrderData', state.orderData);
|
||||
} else {
|
||||
uni.removeStorageSync('buyCardOrderData');
|
||||
}
|
||||
},
|
||||
setActive(state, value) {
|
||||
state.active = value;
|
||||
if (value) {
|
||||
uni.setStorageSync('buyCardActive', state.active);
|
||||
} else {
|
||||
uni.removeStorageSync('buyCardActive');
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const actions = {};
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
25
addon/cashier/source/os/store/modules/recharge.js
Executable file
25
addon/cashier/source/os/store/modules/recharge.js
Executable file
@@ -0,0 +1,25 @@
|
||||
// 充值数据持久化存储
|
||||
|
||||
const state = {
|
||||
active: '', // 记录当前页面的活跃值
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
setActive(state, value) {
|
||||
state.active = value;
|
||||
if (value) {
|
||||
uni.setStorageSync('rechagreActive', state.active);
|
||||
} else {
|
||||
uni.removeStorageSync('rechagreActive');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const actions = {};
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
Reference in New Issue
Block a user