diff --git a/common/js/request.js b/common/js/request.js
index 59d9c04..58e50a4 100644
--- a/common/js/request.js
+++ b/common/js/request.js
@@ -13,7 +13,7 @@ export default {
args.url = 'https://www.opsoul.com' + args.url;
// args.url = 'http://120.79.136.57' + args.url;
// args.url = 'http://127.0.0.1:80' + args.url;
- if (args.data) {
+ if (args.data && Object.prototype && Object.prototype.toString.call(args.data) === '[object Object]') {
args.data.deptId = globalData.deptId;
args.data.from = globalData.from;
}
@@ -457,6 +457,19 @@ export default {
data: params
})
return res[1].data;
+ },
+ async cancelMasterOrder(params = {}) {
+ let res = await uni.request({
+ url: '/order/master/cancel',
+ method: 'POST',
+ data: {
+ orderMasterId: params.orderMasterId
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded'
+ }
+ })
+ return res[1].data;
},
async getHotGoods(params = {}) {
let res = await uni.request({
diff --git a/pages/my/my-address.vue b/pages/my/my-address.vue
index 30e5074..69abe12 100644
--- a/pages/my/my-address.vue
+++ b/pages/my/my-address.vue
@@ -98,12 +98,12 @@
async delAddress() {
let res = await this.$request.delAddressList(this.delAddressInfo.customerAddressId);
if (res.code === 0) {
+ this.loadData();
uni.showToast({
title: '删除成功',
icon: 'success',
mask: true
})
- this.loadData();
} else {
uni.showToast({
title: '删除失败',
diff --git a/pages/my/my-order.vue b/pages/my/my-order.vue
index 9ae9ebc..9a67397 100644
--- a/pages/my/my-order.vue
+++ b/pages/my/my-order.vue
@@ -43,16 +43,16 @@
-
+
-
+
-
+
@@ -220,7 +220,8 @@
if (ifRollback) {
uni.showToast({
title: '订单已回滚至服务中状态,请联系师傅',
- icon: 'none'
+ icon: 'none',
+ duration: 3000
})
}
}
@@ -238,16 +239,21 @@
this.curOrder = null;
},
async cancelOrder() {
- let res = await this.$request.updateOrder({
- id: this.curOrder.orderMasterId,
- orderStatus: 6
+ let res = await this.$request.cancelMasterOrder({
+ orderMasterId: this.curOrder.orderMasterId
});
- if (res.code === 0) {
+ if (res && res.code === 0) {
+ this.reloadOrderPage();
uni.showToast({
title: '取消成功',
- icon: 'success'
+ icon: 'success',
+ duration: 2000
+ })
+ } else {
+ uni.showToast({
+ title: '取消失败',
+ icon: 'error'
})
- this.reloadOrderPage();
}
},
async wxpay(curOrder) {
diff --git a/pages/my/serv-detail.vue b/pages/my/serv-detail.vue
index 9f4d62f..0d17265 100644
--- a/pages/my/serv-detail.vue
+++ b/pages/my/serv-detail.vue
@@ -34,6 +34,7 @@
{{servDetail.goodsName}}
服务中
待上门
+ 已取消
-
+
订单管理
@@ -189,10 +190,16 @@
this.ifShowPageMeta = e.show;
},
togglePopup(e) {
- if (this.ifShowPageMeta) {
- this.$refs[e.currentTarget.dataset.popup].close();
+ let targetPopup = null;
+ if (typeof e === 'string') {
+ targetPopup = e;
} else {
- this.$refs[e.currentTarget.dataset.popup].open();
+ targetPopup = e.currentTarget.dataset.popup;
+ }
+ if (this.ifShowPageMeta) {
+ this.$refs[targetPopup].close();
+ } else {
+ this.$refs[targetPopup].open();
}
},
showModal(e) {
@@ -207,8 +214,24 @@
decideIfCancelOrder() {
this.$refs.confirmModal.showModal();
},
- cancelOrder() {
- console.log("取消订单")
+ async cancelOrder(e) {
+ let res = await this.$request.cancelMasterOrder({
+ orderMasterId: this.servDetail.orderMasterId
+ });
+ if (res && res.code === 0) {
+ this.togglePopup('orderManage');
+ this.loadData(this.servDetail.orderMasterId);
+ uni.showToast({
+ title: '取消成功',
+ icon: 'success',
+ duration: 2000
+ })
+ } else {
+ uni.showToast({
+ title: '取消失败',
+ icon: 'error'
+ })
+ }
}
}
}