完成货运发布后支付

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: {
url: "/wxapp/index/getallcar"
},
submit: {
url: "/wxapp/project/distribution",
auth: true,
},
pay: {
url: "/wxapp/wxpay/payorderd",
auth: true,
}
}
},
order: {
create: {
t1: {
url: "/wxapp/order/submitordera",
auth: true,
},
t2: {
url: "/wxapp/orderb/addorder",
auth: true,
},
t3: {
url: "/wxapp/project/distribution",
auth: true,
}
},
pay: {
t1: {
url: "/wxapp/wxpay/payordera",
showLoading: true,
auth: true,
},
createOrder: {
url: "/wxapp/order/submitordera",
t2: {
url: "/wxapp/wxpay/payorderc",
showLoading: true,
auth: true,
},
createDemandOrder: {
url: "/wxapp/orderb/addorder",
t3: {
url: "/wxapp/wxpay/payorderd",
showLoading: true,
auth: true,
}
},
list: {
// 购买订单

View File

@ -151,7 +151,7 @@ export default {
data: data,
}).then(response => {
if (response.code == 1) {
return resolve(response.data);
return resolve(response);
}
return reject(response.msg);
}).catch(e => { });
@ -200,7 +200,7 @@ export default {
createDistributionOrder(data) {
return new Promise((resolve, reject) => {
prototype.$request({
api: "service.distribution.submit",
api: "order.create.t3",
data: data,
}).then(response => {
if (response.code == 1) {
@ -210,21 +210,57 @@ export default {
}).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) {
return new Promise((resolve, reject) => {
prototype.$request({
api: "service.distribution.pay",
api: "order.pay.t3",
data: {
id: id,
}
}).then(response => {
if (response.code == 1) {
return resolve(response.data);
uni.requestPayment({
...response.data,
provider: "wxpay",
success() {
resolve();
},
fail() {
reject();
}
});
}
return reject(response.msg);
}).catch(e => { });
});
}

View File

@ -207,7 +207,16 @@ export default {
distance: this.distance,
})
.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) => {
this.$utils.toast(e);