H5-ThreeDoorder/store/module/card/index.js

86 lines
1.6 KiB
JavaScript

import {
AreaLisrAPI
} from '@/request/index/index.js';
let orderinfor = uni.getStorageSync('orderinfor') ? JSON.parse(uni.getStorageSync('orderinfor')) : {
// 面额
face: 0,
// 张数
sheets: 0,
// 卡面图片地址
card_img: '',
// 购买数量
count: 0,
// 收货地址id
add_id: 0,
// 支付金额
pay_price: 0,
// 邀请码
code: '',
alipayForm:'',
};
let state = {
// 地址列表
AreaList: [],
// 下单信息
orderinfor,
// 下单地址
Taddress:{},
};
if(uni.getStorageSync('VUEXSTATE')){
state = JSON.parse(uni.getStorageSync('VUEXSTATE'))['card'];
};
export default{
namespaced: true,
state:state,
getters: {
/**
* @获取地址
*/
GetList(state) {
return state['AreaList']
},
/**
* @获取订单
*/
Getorderinfor(state) {
return state['orderinfor']
},
/**
* @获取临时地址
*/
GetTaddress(state){
return state['Taddress'];
},
},
mutations: {
SetTaddress(state,data){
console.log('卡');
state['Taddress'] = data;
},
/**
* @设置下单信息
*/
Setorderinfor(state, data) {
console.log(data, 'data');
uni.setStorageSync('orderinfor', JSON.stringify(data));
state['orderinfor'] = data;
},
SetAreaList(state,data){
state['AreaList'] = data;
console.log(state['AreaList'],'AreaList')
}
},
actions: {
// GetAreaLisr({
// commit
// }, data = {}) {
// AreaLisrAPI(data).then(res => {
// commit('SetAreaList',res['data'])
// });
// },
}
}