From e572dbb325b7e040fd8c5ba5601d8372a1edbbff Mon Sep 17 00:00:00 2001 From: lxf Date: Wed, 23 Jul 2025 18:23:41 +0800 Subject: [PATCH] fix: 下单加保险 --- common/api.js | 1 + pages/order/add.vue | 28 ++++++++++++++++++++++++---- pages/order/again-assign.vue | 21 +++++++++++++++++++++ pages/order/change-fee.vue | 12 ++++++++++++ pages/order/detail.vue | 27 +++++++++++++++++++++++++++ pages/order/filter.vue | 10 ++++++++++ pages/order/index.vue | 1 + pages/order/insurance.vue | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------- 8 files changed, 173 insertions(+), 39 deletions(-) diff --git a/common/api.js b/common/api.js index ee17bdb..cd268f0 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), // 修改备注 + freightInsuranceList: params => vm.$u.http.get( freightAPI + '/freightInsuranceProgram/getList', {params}), }, freightMaRecord: { add: params => vm.$u.http.post( freightAPI + '/freightMaRecord/add', params,{custom: {toast:true}}), // 出发到达记录日志 diff --git a/pages/order/add.vue b/pages/order/add.vue index da8b152..e1ab4ed 100644 --- a/pages/order/add.vue +++ b/pages/order/add.vue @@ -134,10 +134,18 @@ - - + + @@ -203,6 +211,7 @@ export default { components: { UTextarea, PopupPlatenumber, payee }, data() { return { + openExternalInsuranceFlag: true, eventCode: '', loading: false, showModal: '', @@ -244,6 +253,10 @@ export default { weightUnitPrice: '', goodsSourceCode: '', goodsSourceBiddingCode: '', + startDate: '', + receiveInsuranceAmount: '', + insuranceProgramCode: '', + coverageLimit: '', }, payeeModel: {}, driverObj: {}, //司机信息 @@ -394,6 +407,7 @@ export default { }, getAllowDriverSeeFreightAmount() { uni.$u.api.freightOrder.currentFreight({}).then(en => { + this.openExternalInsuranceFlag = en.result.openExternalInsuranceFlag !== false; this.currentFreight = en?.result || {}; this.form.allowDriverSeeFreightAmountNode = this.currentFreight.allowDriverSeeFreightAmountNode; }); @@ -517,7 +531,13 @@ export default { uni.navigateTo({ url: `/pages/common/webview?url=${url}&query=${JSON.stringify(params)}` }); }, buyInsurance() { - uni.navigateTo({ url: `/pages/order/insurance` }); + uni.$once('buy-insurance', insuranceForm => { + this.form = { + ...this.form, + ...insuranceForm, + }; + }); + uni.navigateTo({ url: `/pages/order/insurance?paidAmount=${this.form.paidAmount}` }); }, computedDistance() { if (this.form.waypoints[0].lng && this.form.waypoints[1].lng) { diff --git a/pages/order/again-assign.vue b/pages/order/again-assign.vue index dd77c1a..73adbb0 100644 --- a/pages/order/again-assign.vue +++ b/pages/order/again-assign.vue @@ -57,6 +57,12 @@ + + 温馨提示: + + 当前订单已购买保险,保单号[{{ item.policyNo }}],由于你修改了车牌,原保单将会失效,请知悉! + + @@ -65,44 +67,48 @@ export default { }, data() { return { + pdfFile0: 'https://zeyi-tms-product.oss-cn-hangzhou.aliyuncs.com/file/tms/a15401e7-3d44-41ab-9302-39c6574a1233.pdf', + pdfFile: 'https://zeyi-tms-product.oss-cn-hangzhou.aliyuncs.com/file/tms/71c2d1ff-0ea1-491b-b387-d2f18de0b19d.html', + paidAmount: '', checkboxValue: [], haveAgree: false, fileShow: false, showLoadTime: false, loadTimeDef: new Date(), - schemeList: [ - { - title: '货值(赔付限额)', - amountStr: '100万', - amount: 1000000, - subTitle: '', - }, - { - title: '货值(赔付限额)', - amountStr: '200万', - amount: 2000000, - subTitle: '不含大宗及冷藏', - }, - { - title: '货值(赔付限额)', - amountStr: '300万', - amount: 3000000, - subTitle: '不含大宗及冷藏', - }, - ], + choseSchemeIndex: -1, + schemeList: [], form: { - radio: 'true', - amount: '', + startDate: '', + receiveInsuranceAmount: '', + insuranceProgramCode: '', + coverageLimit: '', }, shengYuTime: 10, popupHandel: null, + choseScheme: null, + frightInfo: {}, }; }, + onLoad(option) { + this.paidAmount = option.paidAmount; + this.initData(); + }, methods: { + initData() { + uni.$u.api.freightOrder.freightInsuranceList({}).then(res => { + this.schemeList = res.result || []; + }); + uni.$u.api.freightOrder.currentFreight({}).then(res => { + this.frightInfo = res.result || {}; + }); + }, loadTimeFormat({ value }) { - this.form.loadTime = dayjs(value).format('YYYY-MM-DD HH:mm:ss'); + this.form.startDate = dayjs(value).format('YYYY-MM-DD HH:mm:ss'); this.showLoadTime = false; }, + openWebView() { + uni.navigateTo({ url: '/pages/common/webview?url=' + this.pdfFile }); + }, openPreFile() { if (popupHandel) { clearInterval(popupHandel); @@ -132,6 +138,42 @@ export default { this.haveAgree = true; this.checkboxValue = ['agree']; }, + cancelInsurance() { + let form = { + startDate: '', + receiveInsuranceAmount: '', + insuranceProgramCode: '', + coverageLimit: '', + }; + uni.$emit('buy-insurance', form); + uni.navigateBack(); + }, + submitInsurance() { + if (!this.form.startDate) { + return uni.showToast({ title: '起运时间不能为空', icon: 'none' }); + } + if (!this.form.insuranceProgramCode) { + 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; + }, + choseSchemeFun(index) { + this.choseSchemeIndex = index; + let choseScheme = this.schemeList[index]; + this.form = { + insuranceProgramCode: choseScheme.code, + coverageLimit: choseScheme.coverageLimit, + receiveInsuranceAmount: this.getReceiveInsuranceAmount(choseScheme, this.paidAmount), + startDate: this.form.startDate, + }; + this.choseScheme = choseScheme; + }, }, }; -- libgit2 0.21.0