优化服务详情的addToCart方法
This commit is contained in:
parent
778faddcd4
commit
a1d541ca9c
|
@ -17,7 +17,9 @@ export default {
|
||||||
return resolve(response.msg);
|
return resolve(response.msg);
|
||||||
}
|
}
|
||||||
return reject(response.msg);
|
return reject(response.msg);
|
||||||
}).catch(e => { });
|
}).catch(e => {
|
||||||
|
return reject(e);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -80,7 +80,6 @@
|
||||||
import AppLayout from "@/components/layout/layout";
|
import AppLayout from "@/components/layout/layout";
|
||||||
import AppAppraiseSection from "@/components/appraise/section";
|
import AppAppraiseSection from "@/components/appraise/section";
|
||||||
import AppLoadMore from "@/components/widgets/loadmore";
|
import AppLoadMore from "@/components/widgets/loadmore";
|
||||||
import { mapGetters } from "vuex";
|
|
||||||
export default {
|
export default {
|
||||||
name: "service-detail",
|
name: "service-detail",
|
||||||
data() {
|
data() {
|
||||||
|
@ -111,11 +110,6 @@ export default {
|
||||||
AppAppraiseSection,
|
AppAppraiseSection,
|
||||||
AppLoadMore,
|
AppLoadMore,
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
...mapGetters({
|
|
||||||
isLogin: "user/isLogin",
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
async onLoad(e) {
|
async onLoad(e) {
|
||||||
this.pageConfig = getApp().globalData.pageConfig;
|
this.pageConfig = getApp().globalData.pageConfig;
|
||||||
|
|
||||||
|
@ -159,11 +153,7 @@ export default {
|
||||||
this.changeAppraiseCate(this.appraise.cate[0], 0);
|
this.changeAppraiseCate(this.appraise.cate[0], 0);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {},
|
||||||
if (this.isLogin) {
|
|
||||||
this.$store.dispatch("cart/update");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onReady() {},
|
onReady() {},
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
if (this.tabIndex == 0) return;
|
if (this.tabIndex == 0) return;
|
||||||
|
@ -185,14 +175,17 @@ export default {
|
||||||
/**
|
/**
|
||||||
* 加入购物车
|
* 加入购物车
|
||||||
*/
|
*/
|
||||||
addToCart() {
|
async addToCart() {
|
||||||
if (this.canUseCart) {
|
if (this.canUseCart) {
|
||||||
this.canUseCart = false;
|
this.canUseCart = false;
|
||||||
this.$models.cart.toCart(this.id).then(async (msg) => {
|
await this.$models.cart
|
||||||
|
.toCart(this.id)
|
||||||
|
.then(async (msg) => {
|
||||||
await this.$store.dispatch("cart/update", true);
|
await this.$store.dispatch("cart/update", true);
|
||||||
this.$utils.toast(msg);
|
this.$utils.toast(msg);
|
||||||
|
})
|
||||||
|
.catch((e) => {});
|
||||||
this.canUseCart = true;
|
this.canUseCart = true;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue