增加取消订单

This commit is contained in:
TOP糯米 2023-03-28 21:27:37 +08:00
parent 9d01577024
commit aae15d1ed0
3 changed files with 44 additions and 4 deletions

View File

@ -7,7 +7,7 @@
<text>立即支付</text> <text>立即支付</text>
</view> </view>
</block> </block>
<block v-if="order.state == 1"> <block v-if="order.state == 0 || order.state == 1">
<view class="btn" @click.stop="cancelOrder"> <view class="btn" @click.stop="cancelOrder">
<text>取消订单</text> <text>取消订单</text>
</view> </view>
@ -159,13 +159,26 @@ export default {
* 取消订单 * 取消订单
*/ */
cancelOrder() { cancelOrder() {
this.$emit("cancelOrder"); this.$models.order
.cancelOrder({
request: {
api: "order.cancel." + this.order.listType,
data: {
id: this.order.id,
},
},
})
.then((response) => {
this.$utils.toast(response.msg).then(() => {
this.$emit("refresh");
});
});
}, },
/** /**
* 评价 * 评价
*/ */
appraiseOrder() { appraiseOrder() {
this.$utils.toast("敬请期待"); this.$utils.toPage("/pages/worker/appraise?id=" + this.order.id + "&orderId=" + this.order.orderId);
}, },
/** /**
* 退款 * 退款
@ -195,7 +208,6 @@ export default {
content: this.order.rejectDesc, content: this.order.rejectDesc,
showCancel: false, showCancel: false,
}); });
// this.$utils.toPage("/pages/order/refund?type=reason&id=" + this.order.worker.id);
}, },
}, },
}; };

View File

@ -251,6 +251,21 @@ export default {
url: "" url: ""
}, },
}, },
cancel: {
t1: {
url: "/wxapp/order/cancelorder",
showLoading: true,
auth: true,
},
t2: {
url: "/wxapp/orderb/cancelorder",
showLoading: true,
auth: true,
},
t3: {
url: ""
}
},
chooseWorker: { chooseWorker: {
url: "/wxapp/orderb/chooseshifu", url: "/wxapp/orderb/chooseshifu",
showLoading: true, showLoading: true,

View File

@ -303,6 +303,19 @@ export default {
}).catch(e => { }); }).catch(e => { });
}); });
}, },
/**
* 取消订单
*/
cancelOrder(options) {
return new Promise((resolve, reject) => {
prototype.$request(options.request).then((response) => {
if (response.code == 1) {
return resolve(response);
}
return reject(response.msg);
}).catch(e => { });
});
},
/** /**
* 退款 * 退款
*/ */