Commit b7e55d83 by 肖康

parent e2d11126
......@@ -65,6 +65,10 @@ export const apis = {
*/
cartCount: productionUrlApi + 'cart/count',
/**
* 获取购物车列表
*/
cartList: productionUrlApi + 'cart/lists',
/**
* 客服统计处理
*/
customsrService: productionUrlApi + 'public/customsrservice',
......@@ -462,6 +466,8 @@ export const services = {
},
defaultClass(params){
return axios.post(apis.defaultClass,params)
}
},
cartList(params){
return axios.post(apis.cartList,params)
},
};
\ No newline at end of file
......@@ -5,37 +5,54 @@ import {services as Services} from '../../../api/index'
Vue.use(Toast);
var qs = require('qs');
const state = {
loading:false
loading:false,
ly1:false,//联营大陆得到数据防止切换多次请求
ly2:false,//联营香港得到数据防止切换多次请求
zy1:false,//自营得到数据防止切换多次请求
ly1Data:[],//大陆数据
ly2Data:[],//香港数据
zy1Data:[],//自营数据
}
const mutations = {
cartList(state, payload) {
if(payload.types_==1){
state.ly1=true;
//大陆
}else if(payload.types_==2){
state.ly2=true;
//香港
}else{
//自营
state.zy1=true;
}
}
}
const actions = {
chainSmsVerify({commit},payload){
cartList({commit},payload){
state.loading=true;
state.formCodeStatus=false;
var params = {
verify: payload.verify,
mobile: payload.mobile
delivery_place: payload.delivery_place,
order_goods_type: payload.order_goods_type
}
Services.smsVerify(qs.stringify(params)).then((res) => {
var types_=1;
if(payload.order_goods_type==1){
types_=3;
}else{
if(payload.delivery_place==2){
types_=2
}
}
Services.cartList(qs.stringify(params)).then((res) => {
state.loading=false;
state.formImgShow=false;
let data = res.data;
if (data.err_code == 0) {
state.formCodeStatus=true;
Toast({
message: data.err_msg,
duration: 2000
});
}else if(data.err_code==23019||data.err_code==11008||data.err_code==11011){
Toast({
message: data.err_msg,
duration: 2000
commit({
type: 'cartList',
data: data.data,
types_:types_
});
state['formImgShow']=true;
}else {
Toast({
message: data.err_msg,
......
......@@ -523,6 +523,7 @@
<span class="f-blue fr clearbtn">清除失效商品</span>
</div>
</div>
<van-loading type="spinner" color="#000" class="loading-background" v-if="loading"/>
</div>
</template>
......@@ -550,10 +551,20 @@
}
},
computed:{
...mapState({
loading: state => state.car.loading,
ly1: state => state.car.ly1,
ly2: state => state.car.ly2,
zy1: state => state.car.zy1,
ly1Data: state => state.car.ly1Data,
ly2Data: state => state.car.ly2Data,
zy1Data: state => state.car.zy1Data,
})
},
created(){
this.loginTip();
this.getData();
},
watch:{
......@@ -602,6 +613,13 @@
// }
console.log(type)
},
getData:function(){
this.$store.dispatch({
type: 'cartList',
delivery_place:this.delivery,
order_goods_type: this.type
})
},
deliveryTab:function(delivery){
this.delivery=delivery;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment