优化付款
This commit is contained in:
parent
03af516279
commit
70c67dc692
|
@ -62,7 +62,7 @@
|
|||
<!-- 货运 -->
|
||||
<block v-if="order.listType == 't3'">
|
||||
<block v-if="order.state == 0">
|
||||
<view class="btn" @click.stop="payDistributionOrder">
|
||||
<view class="btn" @click.stop="payOrder">
|
||||
<text>立即支付</text>
|
||||
</view>
|
||||
</block>
|
||||
|
@ -93,26 +93,38 @@ export default {
|
|||
destroyed() {},
|
||||
methods: {
|
||||
/**
|
||||
* 支付普通订单
|
||||
* 支付订单
|
||||
*/
|
||||
payOrder() {
|
||||
this.$models.order.payOrder(this.order.id).then(() => {
|
||||
this.$emit("afterPay");
|
||||
});
|
||||
this.$models.order
|
||||
.pay({
|
||||
request: {
|
||||
api: "order.pay." + this.order.listType,
|
||||
data: {
|
||||
id: this.order.id,
|
||||
},
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
this.$emit("afterPay");
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 支付尾款
|
||||
*/
|
||||
payRetainage() {
|
||||
this.$emit("payRetainage");
|
||||
},
|
||||
/**
|
||||
* 支付货运订单
|
||||
*/
|
||||
payDistributionOrder() {
|
||||
this.$models.service.payDistributionOrder(this.order.id).then(() => {
|
||||
this.$emit("afterPay");
|
||||
});
|
||||
this.$models.order
|
||||
.pay({
|
||||
request: {
|
||||
api: "order.retainage." + this.order.listType,
|
||||
data: {
|
||||
id: this.order.id,
|
||||
},
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
this.$emit("afterPay");
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 取消
|
||||
|
|
|
@ -134,14 +134,17 @@ export default {
|
|||
create: {
|
||||
t1: {
|
||||
url: "/wxapp/order/submitordera",
|
||||
showLoading: true,
|
||||
auth: true,
|
||||
},
|
||||
t2: {
|
||||
url: "/wxapp/orderb/addorder",
|
||||
showLoading: true,
|
||||
auth: true,
|
||||
},
|
||||
t3: {
|
||||
url: "/wxapp/project/distribution",
|
||||
showLoading: true,
|
||||
auth: true,
|
||||
}
|
||||
},
|
||||
|
@ -162,20 +165,29 @@ export default {
|
|||
auth: true,
|
||||
}
|
||||
},
|
||||
retainage: {
|
||||
t1: {
|
||||
url: "/wxapp/wxpay/payorderb",
|
||||
showLoading: true,
|
||||
auth: true,
|
||||
},
|
||||
t2: {
|
||||
url: "/wxapp/wxpay/payorderce",
|
||||
showLoading: true,
|
||||
auth: true,
|
||||
}
|
||||
},
|
||||
list: {
|
||||
// 购买订单
|
||||
t1: {
|
||||
url: "/wxapp/order/getmyorder",
|
||||
showLoading: true,
|
||||
auth: true,
|
||||
},
|
||||
// 报/议价订单
|
||||
t2: {
|
||||
url: "/wxapp/orderb/getmyorderblist",
|
||||
showLoading: true,
|
||||
auth: true,
|
||||
},
|
||||
// 货运订单
|
||||
t3: {
|
||||
url: "/wxapp/project/freightorder",
|
||||
showLoading: true,
|
||||
|
@ -183,19 +195,16 @@ export default {
|
|||
},
|
||||
},
|
||||
detail: {
|
||||
// 购买订单
|
||||
t1: {
|
||||
url: "/user/workerorderb/orderinfo",
|
||||
showLoading: true,
|
||||
auth: true,
|
||||
},
|
||||
// 报/议价订单
|
||||
t2: {
|
||||
url: "/wxapp/orderb/getmyorderbbyid",
|
||||
showLoading: true,
|
||||
auth: true,
|
||||
},
|
||||
// 货运订单
|
||||
t3: {
|
||||
url: ""
|
||||
},
|
||||
|
|
|
@ -63,16 +63,11 @@ export default {
|
|||
});
|
||||
},
|
||||
/**
|
||||
* 支付订单
|
||||
* 支付
|
||||
*/
|
||||
payOrder(id) {
|
||||
pay(options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
prototype.$request({
|
||||
api: "order.pay.t1",
|
||||
data: {
|
||||
id: id
|
||||
}
|
||||
}).then(response => {
|
||||
prototype.$request(options.request).then(response => {
|
||||
if (response.code == 1) {
|
||||
uni.requestPayment({
|
||||
...response.data,
|
||||
|
@ -114,6 +109,10 @@ export default {
|
|||
state: item.status,
|
||||
workerList: [],
|
||||
};
|
||||
// 尾款
|
||||
if (options.listType == 't1' || options.listType == 't2') {
|
||||
order.retainageMoney = item.moneyb;
|
||||
}
|
||||
// 师傅
|
||||
if (prototype.$utils.isType(item.shifu, "object")) {
|
||||
order.worker = {
|
||||
|
@ -183,6 +182,7 @@ export default {
|
|||
serviceTime: data.times,
|
||||
orderType: data.types,
|
||||
state: data.status,
|
||||
retainageMoney: data.moneyb,
|
||||
images: prototype.$utils.isType(data.img, "array") ? data.img : [],
|
||||
worker: {},
|
||||
workerList: [],
|
||||
|
|
|
@ -210,58 +210,4 @@ 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: "order.pay.t3",
|
||||
data: {
|
||||
id: id,
|
||||
}
|
||||
}).then(response => {
|
||||
if (response.code == 1) {
|
||||
uni.requestPayment({
|
||||
...response.data,
|
||||
provider: "wxpay",
|
||||
success() {
|
||||
resolve();
|
||||
},
|
||||
fail() {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).catch(e => { });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,12 +160,9 @@
|
|||
</view>
|
||||
<view class="common-bottom-components" :style="{ bottom: pageConfig.safeAreaInsets.bottom + 'px' }">
|
||||
<text class="price">¥ {{ utils.formatNumber(total, 2) }}</text>
|
||||
<view v-if="type == 2" class="btn" @click="submit">
|
||||
<view class="btn" @click="submit">
|
||||
<div class="text">立即发布</div>
|
||||
</view>
|
||||
<view v-if="type == 1" class="btn" @click="submit">
|
||||
<div class="text">去支付</div>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
@ -174,7 +174,21 @@ export default {
|
|||
})
|
||||
.then((id) => {
|
||||
this.$store.dispatch("cart/updateAll");
|
||||
this.$models.order.payOrder(id);
|
||||
this.$models.order
|
||||
.pay({
|
||||
request: {
|
||||
api: "order.pay.t1",
|
||||
data: {
|
||||
id: id,
|
||||
},
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
this.$utils.toPage("/pages/order/order", {}, "switch");
|
||||
})
|
||||
.catch(() => {
|
||||
this.$utils.toPage("/pages/order/order", {}, "switch");
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$utils.toast(e);
|
||||
|
|
|
@ -207,12 +207,17 @@ export default {
|
|||
distance: this.distance,
|
||||
})
|
||||
.then((data) => {
|
||||
this.$models.service
|
||||
.payDistributionOrder(data.id)
|
||||
.then((response) => {
|
||||
this.$utils.toast(response.msg).then(() => {
|
||||
this.$utils.toPage("/pages/order/order", {}, "switch");
|
||||
});
|
||||
this.$models.order
|
||||
.pay({
|
||||
request: {
|
||||
api: "order.pay.t3",
|
||||
data: {
|
||||
id: data.id,
|
||||
},
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
this.$utils.toPage("/pages/order/order", {}, "switch");
|
||||
})
|
||||
.catch(() => {
|
||||
this.$utils.toPage("/pages/order/order", {}, "switch");
|
||||
|
|
Loading…
Reference in New Issue