完成货运发布后支付

This commit is contained in:
TOP糯米 2023-03-14 20:52:50 +08:00
parent 4379bd034c
commit 7d3cbde1af
3 changed files with 80 additions and 25 deletions

View File

@ -128,29 +128,39 @@ export default {
carType: { carType: {
url: "/wxapp/index/getallcar" url: "/wxapp/index/getallcar"
}, },
submit: {
url: "/wxapp/project/distribution",
auth: true,
},
pay: {
url: "/wxapp/wxpay/payorderd",
auth: true,
}
} }
}, },
order: { order: {
create: {
t1: {
url: "/wxapp/order/submitordera",
auth: true,
},
t2: {
url: "/wxapp/orderb/addorder",
auth: true,
},
t3: {
url: "/wxapp/project/distribution",
auth: true,
}
},
pay: { pay: {
url: "/wxapp/wxpay/payordera", t1: {
showLoading: true, url: "/wxapp/wxpay/payordera",
auth: true, showLoading: true,
}, auth: true,
createOrder: { },
url: "/wxapp/order/submitordera", t2: {
auth: true, url: "/wxapp/wxpay/payorderc",
}, showLoading: true,
createDemandOrder: { auth: true,
url: "/wxapp/orderb/addorder", },
auth: true, t3: {
url: "/wxapp/wxpay/payorderd",
showLoading: true,
auth: true,
}
}, },
list: { list: {
// 购买订单 // 购买订单

View File

@ -151,7 +151,7 @@ export default {
data: data, data: data,
}).then(response => { }).then(response => {
if (response.code == 1) { if (response.code == 1) {
return resolve(response.data); return resolve(response);
} }
return reject(response.msg); return reject(response.msg);
}).catch(e => { }); }).catch(e => { });
@ -200,7 +200,7 @@ export default {
createDistributionOrder(data) { createDistributionOrder(data) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
prototype.$request({ prototype.$request({
api: "service.distribution.submit", api: "order.create.t3",
data: data, data: data,
}).then(response => { }).then(response => {
if (response.code == 1) { if (response.code == 1) {
@ -210,21 +210,57 @@ export default {
}).catch(e => { }); }).catch(e => { });
}); });
}, },
/**
* 支付需求订单
*/
payDemandOrder(id) {
return new Promise((resolve, reject) => {
prototype.$request({
api: "order.pay.t2",
data: {
id: id
}
}).then(response => {
if (response.code == 1) {
uni.requestPayment({
...response.data,
provider: "wxpay",
success() {
resolve();
},
fail() {
reject();
}
});
}
}).catch(e => {
throw e
});
});
},
/** /**
* 支付货运订单 * 支付货运订单
*/ */
payDistributionOrder(id) { payDistributionOrder(id) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
prototype.$request({ prototype.$request({
api: "service.distribution.pay", api: "order.pay.t3",
data: { data: {
id: id, id: id,
} }
}).then(response => { }).then(response => {
if (response.code == 1) { if (response.code == 1) {
return resolve(response.data); uni.requestPayment({
...response.data,
provider: "wxpay",
success() {
resolve();
},
fail() {
reject();
}
});
} }
return reject(response.msg);
}).catch(e => { }); }).catch(e => { });
}); });
} }

View File

@ -207,7 +207,16 @@ export default {
distance: this.distance, distance: this.distance,
}) })
.then((data) => { .then((data) => {
this.$models.service.payDistributionOrder(data.id); this.$models.service
.payDistributionOrder(data.id)
.then((response) => {
this.$utils.toast(response.msg).then(() => {
this.$utils.toPage("/pages/order/order", {}, "switch");
});
})
.catch(() => {
this.$utils.toPage("/pages/order/order", {}, "switch");
});
}) })
.catch((e) => { .catch((e) => {
this.$utils.toast(e); this.$utils.toast(e);