diff --git a/src/models/order-model.js b/src/models/order-model.js index a8fe206..1f902c9 100644 --- a/src/models/order-model.js +++ b/src/models/order-model.js @@ -22,7 +22,10 @@ export default { }), cancel: data => utilsModel.config(order.cancel).request({ - data: data + data: data, + headers: { + "Content-Type": "application/x-www-form-urlencoded" + } }), addOrder: data => utilsModel.config(order.addOrder).request({ diff --git a/src/models/utils-model.js b/src/models/utils-model.js index cfc175a..f3cd7ec 100644 --- a/src/models/utils-model.js +++ b/src/models/utils-model.js @@ -10,12 +10,12 @@ let instance = axios.create(); // 添加一个请求拦截器 instance.interceptors.request.use( config => { - // let token = sessionStorage.getItem("token") || ""; - // if (token) { - // config.headers.encodeToken = token; - // } - config.headers.encodeToken = - "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NzEyMjQ3Mjc1OTcsInBheWxvYWQiOiJcIjE4MDYwMTE0MDkyODM4NDEwMXwxNTM5Njg4NzI3NTc5XCIifQ.sJBefUfJwybtWTNauW3j-w8VA6BlV56ASKmgQvDJc_Y"; + let token = sessionStorage.getItem("token") || ""; + if (token) { + config.headers.encodeToken = token; + } + // config.headers.encodeToken = + // "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1NzEyMjQ3Mjc1OTcsInBheWxvYWQiOiJcIjE4MDYwMTE0MDkyODM4NDEwMXwxNTM5Njg4NzI3NTc5XCIifQ.sJBefUfJwybtWTNauW3j-w8VA6BlV56ASKmgQvDJc_Y"; console.log(config); return config; }, diff --git a/src/view/order-check.vue b/src/view/order-check.vue index f74d1f9..a4a4a7c 100644 --- a/src/view/order-check.vue +++ b/src/view/order-check.vue @@ -10,7 +10,7 @@
{{info.goodsName}}
{{info.shortDesc}}
-
¥{{info.totalPrice/100}}
+
¥{{info.totalPrice?info.totalPrice/100:''}}
@@ -40,7 +40,7 @@
{{info.primeCoupon.couponName}}
-
-¥{{info.primeCoupon.amount}}
+
-¥{{info.primeCoupon?info.primeCoupon.amount/100:""}}
@@ -65,17 +65,17 @@
我已阅读并同意
-
+ 《一号家政服务协议书》 -
+
还需支付: -
¥{{info.payPrice?info.payPrice/100:''}}
+
¥{{price}}
- +
@@ -89,19 +89,29 @@ export default { info: { text: "" }, - agree: true, + agree: false, goodsNo: "" }; }, components: { "back-header": backHeader }, + computed: { + price() { + let price = this.info.payPrice; + let discount = this.info.primeCoupon + ? this.info.primeCoupon.amount + : 0; + return price / 100 - discount / 100; + } + }, methods: { getData() { let goodsNo = this.getParam("goodsNo"); let couponNo = this.getParam("couponNo"); - // let orderData = localStorage.getItem("orderData") || ""; - let goodsVersion = this.getParam("goodsVersion"); + let goodsVersion = + sessionStorage.getItem("goodsVersion") || + this.getParam("goodsVersion"); orderApi .checkOrder( qs.stringify({ @@ -112,6 +122,7 @@ export default { ) .then(res => { if (res.code == 0) { + this.agree = true; let data = res.response; this.info = data; } else if (res.code == 666) { @@ -133,6 +144,13 @@ export default { }); }, pay() { + if (!this.agree) { + this.$vux.toast.text( + "请先勾选同意《一号家政服务协议书》", + "middle" + ); + return; + } this.addOrder().then(res => { this.$vux.loading.show({ text: "正在调起支付" @@ -209,7 +227,6 @@ export default { orderApi .addOrder( qs.stringify({ - goodsNo: goodsNo, goodsNo: goodsNo, couponNo: couponNo, goodsVersion: goodsVersion, @@ -247,7 +264,9 @@ export default { return promise; }, go() { - location.href = "/mall/web/coupon_index?" + this.goodsNo; + let goodsVersion = this.getParam("goodsVersion") || ""; + sessionStorage.setItem("goodsVersion", goodsVersion); + location.href = "/mall/web/coupon_index?" + this.goodsNo + "&"; } }, mounted() { @@ -557,11 +576,15 @@ export default { button { width: 3.5rem; height: 1rem; - background-color: #00ba86; - color: white; - font-size: 0.36rem; + background: #00ba86; + color: #fff; border-radius: 0px; border: none; + color: white; + font-size: 0.36rem; + } + .disabled { + opacity: 0.6; } } diff --git a/src/view/order-detail.vue b/src/view/order-detail.vue index ea5345f..e33f5d8 100644 --- a/src/view/order-detail.vue +++ b/src/view/order-detail.vue @@ -30,8 +30,8 @@
【赠品】
-
{{item.goodsName}}
-
x{{item.num}}
+
{{item.name}}
+
 x{{item.num}}
@@ -65,7 +65,7 @@
¥{{info.couponPrice/100}}
-
+
取消订单
@@ -97,6 +97,7 @@