user.js
1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* @Description:
* @Author: huyue
* @Date: 2024-04-07 18:15:11
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-04-11 21:19:09
*/
// import { setToken, getToken, removeToken } from '@/utils/token';;
export default {
state() {
return {
customerInfo: {
customerName: "",
carBrand: "",
carModel: "",
phoneNumber: "",
salesUuid: "",
staffName: "",
newCarFare:''
},
historyStatus: Date.now(),
carBrands: [],
employeeList: [],
paymentType: [],
};
},
mutations: {
getCustomerInfo(state) {
return state.customerInfo;
},
setCustomerInfo(state, data) {
// state.customerInfo = data;
uni.$storage.set("customerInfo", JSON.stringify(data));
state.customerInfo = JSON.parse(uni.$storage.get("customerInfo") || "{}");
},
clearCustomerInfo(state) {
const info = {
customerName: "",
carBrand: "",
carModel: "",
phoneNumber: "",
salesUuid: "",
staffName: "",
newCarFare:''
};
uni.$storage.set("customerInfo", JSON.stringify(info));
state.customerInfo = JSON.parse(uni.$storage.get("customerInfo") || "{}");
},
},
actions: {
// 获取用户详情
getCustomerInfo({ state }) {
return state.customerInfo;
},
setCustomerInfo({ commit }, value) {
commit("setCustomerInfo", value);
},
clearCustomerInfo({ commit }) {
commit("clearCustomerInfo");
},
clearHistory({ state }) {
state.historyStatus = Date.now();
},
setPaymentType({ state }, value) {
state.paymentType = value;
},
setCarBrandsList({ state }, value) {
state.carBrands = value;
},
setEmployeeList({ state }, value) {
state.employeeList = value;
},
},
};