diff --git a/common/api.js b/common/api.js
index cd268f0..2decc6f 100644
--- a/common/api.js
+++ b/common/api.js
@@ -165,6 +165,7 @@ module.exports = (vm) => {
getFreightRisk: params => vm.$u.http.get( freightAPI + '/freightRiskException/page', {params}), // 风控异常
riskAppeal: params => vm.$u.http.post( freightAPI + '/freightRiskException/complaint', params), // 风控异常-申诉
maModifyRemark: params => vm.$u.http.post( freightAPI + '/freightOrder/maModifyRemark', params), // 修改备注
+ insure: params => vm.$u.http.post( freightAPI + '/freightOrder/insure', params), // 购买保险
freightInsuranceList: params => vm.$u.http.get( freightAPI + '/freightInsuranceProgram/getList', {params}),
},
freightMaRecord: {
diff --git a/pages/order/add.vue b/pages/order/add.vue
index e1ab4ed..153ad6b 100644
--- a/pages/order/add.vue
+++ b/pages/order/add.vue
@@ -532,6 +532,7 @@ export default {
},
buyInsurance() {
uni.$once('buy-insurance', insuranceForm => {
+ uni.navigateBack();
this.form = {
...this.form,
...insuranceForm,
diff --git a/pages/order/card.vue b/pages/order/card.vue
index 0c9881c..d724aa6 100644
--- a/pages/order/card.vue
+++ b/pages/order/card.vue
@@ -68,7 +68,14 @@
再来一单
删除订单
- 取消订单
+
+ 购买保险
+
+ 取消订单
@@ -78,6 +85,7 @@
+
确认发车
确认到达
{
@@ -318,6 +318,31 @@ export default {
this.loading = false;
});
},
+ buyInsurance(code, data) {
+ uni.$once('buy-insurance', insuranceForm => {
+ uni.showLoading();
+ if (insuranceForm.insuranceProgramCode) {
+ uni.$u.api.freightOrder
+ .insure({
+ orderCode: code,
+ ...insuranceForm,
+ })
+ .then(res => {
+ uni.hideLoading();
+ uni.navigateBack();
+ this.onSearch();
+ })
+ .finally(() => {
+ uni.hideLoading();
+ });
+ } else {
+ uni.navigateBack();
+ }
+ });
+ uni.navigateTo({
+ url: `/pages/order/insurance?paidAmount=${data.paidAmount}`,
+ });
+ },
},
};
diff --git a/pages/order/insurance.vue b/pages/order/insurance.vue
index c6d56a9..904219b 100644
--- a/pages/order/insurance.vue
+++ b/pages/order/insurance.vue
@@ -146,7 +146,6 @@ export default {
coverageLimit: '',
};
uni.$emit('buy-insurance', form);
- uni.navigateBack();
},
submitInsurance() {
if (!this.form.startDate) {
@@ -156,12 +155,11 @@ export default {
return uni.showToast({ title: '请选择方案', icon: 'none' });
}
uni.$emit('buy-insurance', { ...this.form, programName: this.choseScheme.programName });
- uni.navigateBack();
},
getReceiveInsuranceAmount(choseScheme, paidAmount) {
if (!paidAmount || !choseScheme) return '';
let v1 = Number(paidAmount) * Number(choseScheme.receiveRate);
- return v1 >= Number(choseScheme.minReceiveFee) ? Number(v1 + 0.005).toFixed(2) : choseScheme.minReceiveFee;
+ return v1 >= Number(choseScheme.minReceiveFee) ? Number(v1 + 0.004).toFixed(2) : choseScheme.minReceiveFee;
},
choseSchemeFun(index) {
this.choseSchemeIndex = index;
--
libgit2 0.21.0