Commit e572dbb325b7e040fd8c5ba5601d8372a1edbbff

Authored by lxf
1 parent ec5a0352

fix: 下单加保险

common/api.js
... ... @@ -165,6 +165,7 @@ module.exports = (vm) => {
165 165 getFreightRisk: params => vm.$u.http.get( freightAPI + '/freightRiskException/page', {params}), // 风控异常
166 166 riskAppeal: params => vm.$u.http.post( freightAPI + '/freightRiskException/complaint', params), // 风控异常-申诉
167 167 maModifyRemark: params => vm.$u.http.post( freightAPI + '/freightOrder/maModifyRemark', params), // 修改备注
  168 + freightInsuranceList: params => vm.$u.http.get( freightAPI + '/freightInsuranceProgram/getList', {params}),
168 169 },
169 170 freightMaRecord: {
170 171 add: params => vm.$u.http.post( freightAPI + '/freightMaRecord/add', params,{custom: {toast:true}}), // 出发到达记录日志
... ...
pages/order/add.vue
... ... @@ -134,10 +134,18 @@
134 134 </template>
135 135 </u-input>
136 136 </u-form-item>
137   - <u-form-item label="货物保险" @click="buyInsurance">
138   - <u-input v-model="form.loadTime" border="none" suffix-icon="arrow-right" placeholder="最高赔付300万" disabledColor="#ffffff" placeholder-style="color:#ffcc00" disabled>
  137 + <u-form-item v-if="openExternalInsuranceFlag && form.paidAmount" label="货物保险" @click="buyInsurance">
  138 + <u-input
  139 + v-model="form.loadTime"
  140 + border="none"
  141 + suffix-icon="arrow-right"
  142 + :placeholder="form.coverageLimit ? `最高赔付${form.coverageLimit}万` : '最高赔付300万'"
  143 + disabledColor="#ffffff"
  144 + placeholder-style="color:#ffcc00"
  145 + disabled
  146 + >
139 147 <template #suffix>
140   - <view style="display: flex; align-items: center">未购买 <u-icon name="arrow-right"></u-icon> </view
  148 + <view style="display: flex; align-items: center">{{ form.insuranceProgramCode ? '已购买' : '未购买' }} <u-icon name="arrow-right"></u-icon> </view
141 149 ></template>
142 150 </u-input>
143 151 </u-form-item>
... ... @@ -203,6 +211,7 @@ export default {
203 211 components: { UTextarea, PopupPlatenumber, payee },
204 212 data() {
205 213 return {
  214 + openExternalInsuranceFlag: true,
206 215 eventCode: '',
207 216 loading: false,
208 217 showModal: '',
... ... @@ -244,6 +253,10 @@ export default {
244 253 weightUnitPrice: '',
245 254 goodsSourceCode: '',
246 255 goodsSourceBiddingCode: '',
  256 + startDate: '',
  257 + receiveInsuranceAmount: '',
  258 + insuranceProgramCode: '',
  259 + coverageLimit: '',
247 260 },
248 261 payeeModel: {},
249 262 driverObj: {}, //司机信息
... ... @@ -394,6 +407,7 @@ export default {
394 407 },
395 408 getAllowDriverSeeFreightAmount() {
396 409 uni.$u.api.freightOrder.currentFreight({}).then(en => {
  410 + this.openExternalInsuranceFlag = en.result.openExternalInsuranceFlag !== false;
397 411 this.currentFreight = en?.result || {};
398 412 this.form.allowDriverSeeFreightAmountNode = this.currentFreight.allowDriverSeeFreightAmountNode;
399 413 });
... ... @@ -517,7 +531,13 @@ export default {
517 531 uni.navigateTo({ url: `/pages/common/webview?url=${url}&query=${JSON.stringify(params)}` });
518 532 },
519 533 buyInsurance() {
520   - uni.navigateTo({ url: `/pages/order/insurance` });
  534 + uni.$once('buy-insurance', insuranceForm => {
  535 + this.form = {
  536 + ...this.form,
  537 + ...insuranceForm,
  538 + };
  539 + });
  540 + uni.navigateTo({ url: `/pages/order/insurance?paidAmount=${this.form.paidAmount}` });
521 541 },
522 542 computedDistance() {
523 543 if (this.form.waypoints[0].lng && this.form.waypoints[1].lng) {
... ...
pages/order/again-assign.vue
... ... @@ -57,6 +57,12 @@
57 57 </view>
58 58 </u-form>
59 59 </view>
  60 + <view v-if="showWarning" class="color-red">
  61 + <view style="font-weight: bold">温馨提示:</view>
  62 + <view style="font-size: 12px; margin-top: 5px">
  63 + 当前订单已购买保险,保单号<span class="color-blue">[{{ item.policyNo }}]</span>,由于你修改了车牌,原保单将会失效,请知悉!
  64 + </view>
  65 + </view>
60 66 </template>
61 67 <template #footer>
62 68 <u-button type="primary" @tap="submit">确认更改</u-button>
... ... @@ -106,6 +112,21 @@ export default {
106 112 }
107 113 : {};
108 114 },
  115 + haveInsurance() {
  116 + return this.item && this.item.insuranceStatus === 'SUCCESS';
  117 + },
  118 + licenseChangeFlag() {
  119 + return this.form.licenseNumber && this.form.licenseNumber !== this.item.vehicleLicenseNum;
  120 + },
  121 + trailerChangeFlag() {
  122 + if (!this.form.trailerNumber && !this.item.trailerLicenseNum) {
  123 + return false;
  124 + }
  125 + return this.form.trailerNumber !== this.item.trailerLicenseNum;
  126 + },
  127 + showWarning() {
  128 + return this.haveInsurance && (this.licenseChangeFlag || this.trailerChangeFlag);
  129 + },
109 130 },
110 131 onLoad(options) {
111 132 if (options.code) {
... ...
pages/order/change-fee.vue
... ... @@ -124,6 +124,12 @@
124 124 </view>
125 125 </view>
126 126 </view>
  127 + <view v-if="showWarning" class="color-red" style="padding: 15px">
  128 + <view style="font-weight: bold">温馨提示:</view>
  129 + <view style="font-size: 12px; margin-top: 5px">
  130 + 当前订单已购买保险,保单号<span class="color-blue">[{{ item.policyNo }}]</span>,由于你增加了运费,出险后将无法足额理赔,请知悉!
  131 + </view>
  132 + </view>
127 133 </template>
128 134 <template #footer>
129 135 <u-button type="primary" @tap="submit">确定更改</u-button>
... ... @@ -191,6 +197,12 @@ export default {
191 197 // 自动计算货到
192 198 return 'OUT_INVITE_ARRIVAL' === this.currentFreight?.autoComputeFeeType;
193 199 },
  200 + haveInsurance() {
  201 + return this.item && this.item.insuranceStatus === 'SUCCESS';
  202 + },
  203 + showWarning() {
  204 + return this.haveInsurance && this.form.paidAmount > this.item.paidAmount;
  205 + },
194 206 },
195 207 onLoad(options) {
196 208 if (options.code) {
... ...
pages/order/detail.vue
... ... @@ -250,6 +250,10 @@
250 250 <view class="card__item_field">综合服务费</view>
251 251 <view class="card__item_content">¥{{ item.serviceAmount ? item.serviceAmount : '' }}</view>
252 252 </view>
  253 + <view class="card__item">
  254 + <view class="card__item_field">保费</view>
  255 + <view class="card__item_content">¥{{ item.receiveInsuranceAmount ? item.receiveInsuranceAmount : '' }}</view>
  256 + </view>
253 257 <view class="count-line">
254 258 <view class="field">订单总额</view>
255 259 <view class="number">¥{{ item.totalAmount ? item.totalAmount : '' }}</view>
... ... @@ -279,6 +283,29 @@
279 283 <view class="number">¥{{ item.freightAmount }}</view>
280 284 </view>
281 285 </view>
  286 + <view class="card" v-if="item.policyNo">
  287 + <view class="card__header">
  288 + <view class="label"> 投保信息 </view>
  289 + </view>
  290 + <view class="card__item">
  291 + <view class="card__item_field" style="width: 200rpx">货值(理赔限额)</view>
  292 + <view class="card__item_content" v-if="item.coverageLimit" style="color: #f39800">{{ item.coverageLimit }}万</view>
  293 + </view>
  294 + <view class="card__item">
  295 + <view class="card__item_field" style="width: 200rpx">投保状态</view>
  296 + <view class="card__item_content" v-if="item.insuranceStatus">
  297 + <render-dict dict="FREIGHT_ORDER_INSURANCE_STATUS" :value="item.insuranceStatus"></render-dict>
  298 + </view>
  299 + </view>
  300 + <view class="card__item">
  301 + <view class="card__item_field" style="width: 200rpx">保单号</view>
  302 + <view class="card__item_content">{{ item.policyNo ? item.policyNo : '' }}</view>
  303 + </view>
  304 + <view class="card__item">
  305 + <view class="card__item_field" style="width: 200rpx">费率</view>
  306 + <view class="card__item_content">{{ item.insuranceReceiveRate ? item.insuranceReceiveRate : '' }}</view>
  307 + </view>
  308 + </view>
282 309 <view class="card">
283 310 <u-steps current="0" direction="column" dot>
284 311 <u-steps-item v-for="(it, i) in item.operateRecords" :key="i" :title="it.type" :desc="it.operateTime"> </u-steps-item>
... ...
pages/order/filter.vue
... ... @@ -37,6 +37,15 @@
37 37 <u-input v-model="searchForm.payStatusName" border="none" suffix-icon="arrow-right" placeholder="请选择" disabledColor="#ffffff" disabled />
38 38 </u-form-item>
39 39 </view>
  40 + <view class="card">
  41 + <u-form-item label="是否已投保" labelWidth="130">
  42 + <u-radio-group v-model="searchForm.insuranceFlag">
  43 + <u-radio v-for="(item, index) in radioList" :key="index" :name="item.value">
  44 + {{ item.text }}
  45 + </u-radio>
  46 + </u-radio-group>
  47 + </u-form-item>
  48 + </view>
40 49 </u-form>
41 50 </template>
42 51 <template #footer>
... ... @@ -71,6 +80,7 @@ export default {
71 80 receiptFlag: '', // 是否已签单
72 81 payStatus: '', // 支付状态
73 82 payStatusName: '', //
  83 + insuranceFlag: '', //
74 84 },
75 85 radioList: [
76 86 { text: '是', value: 'true' },
... ...
pages/order/index.vue
... ... @@ -110,6 +110,7 @@ export default {
110 110 receiptFlag: '', // 是否已签单
111 111 payStatus: '', // 支付状态
112 112 payStatusName: '', //
  113 + insuranceFlag: '', //
113 114 },
114 115 activeTab: 0,
115 116 count: {},
... ...
pages/order/insurance.vue
... ... @@ -8,37 +8,39 @@
8 8 <view class="card">
9 9 <u-form-item label="起运时间" @click="showLoadTime = true" required border-bottom>
10 10 <u-datetime-picker :show="showLoadTime" :value="loadTimeDef" @cancel="showLoadTime = false" @close="showLoadTime = false" @confirm="loadTimeFormat"></u-datetime-picker>
11   - <u-input v-model="form.loadTime" border="none" suffix-icon="arrow-right" placeholder="请选择" disabledColor="#ffffff" disabled />
  11 + <u-input v-model="form.startDate" border="none" suffix-icon="arrow-right" placeholder="请选择" disabledColor="#ffffff" disabled />
12 12 </u-form-item>
13 13 <u-form-item label="选择方案" required> </u-form-item>
14 14 <u-form-item border-bottom custom-style="paddingTop:0">
15 15 <view class="scheme-box">
16   - <view v-for="item in schemeList" :key="item.amount" class="scheme-item" :class="item.amount === form.amount ? 'scheme-item-active' : ''" @click="form.amount = item.amount">
17   - <view class="amount">{{ item.amountStr }}</view>
18   - <view class="title">{{ item.title }}</view>
19   - <view class="sub-title">{{ item.subTitle }}</view>
  16 + <view v-for="(item, index) in schemeList" :key="item.amount" class="scheme-item" :class="index === choseSchemeIndex ? 'scheme-item-active' : ''" @click="choseSchemeFun(index)">
  17 + <view class="amount">{{ item.coverageLimit }}万</view>
  18 + <view class="title">货值(赔付限额)</view>
  19 + <view class="sub-title">{{ item.remark }}</view>
20 20 </view>
21 21 </view>
22 22 </u-form-item>
23 23 <u-form-item label="被保人" label-width="60" border-bottom>
24   - <span>浙江中邮物流有限公司</span>
  24 + <span>{{ frightInfo.name }}</span>
25 25 </u-form-item>
26 26 <u-form-item label="保费" label-width="60">
27   - <text style="font-weight: 400; font-size: 12px"> 运费 * 费率=10000 * 0.0005=<text class="color-red">5元</text>(最低5元每笔)</text>
  27 + <text style="font-weight: 400; font-size: 12px" v-if="choseScheme && paidAmount">
  28 + 运费 * 费率 = {{ paidAmount }} * {{ choseScheme.receiveRate }} = <text class="color-red">{{ form.receiveInsuranceAmount }}元</text>(最低{{ choseScheme.minReceiveFee }}元每笔)
  29 + </text>
28 30 </u-form-item>
29 31 </view>
30 32 <view class="tips">
31   - <u-checkbox-group v-model="checkboxValue" placement="column" @change="checkboxChange">
  33 + <u-checkbox-group v-model="checkboxValue" placement="column">
32 34 <u-checkbox :customStyle="{ marginBottom: '8px' }" name="agree"> </u-checkbox>
33 35 </u-checkbox-group>
34 36 <span class="tip-text">投保前请仔细阅读并同意</span>
35   - <view class="file-name" @click="openPreFile">《保价须知及责任免除》</view>
  37 + <view class="file-name" @click="openWebView">《保价须知及责任免除》</view>
36 38 </view>
37 39 </u-form>
38 40 <u-popup mode="center" :show="fileShow" @close="fileShow = false" closeable :safe-area-inset-bottom="false">
39 41 <view class="popup-file">
40 42 <view class="popup-file-title">保价须知及责任免除</view>
41   - <view class="popup-file-text"></view>
  43 + <view class="popup-file-text"> </view>
42 44 <u-button type="primary" @click="agreeFun" :disabled="shengYuTime"
43 45 >已阅读并同意<text v-if="shengYuTime">({{ shengYuTime }}s)</text></u-button
44 46 >
... ... @@ -47,8 +49,8 @@
47 49 </template>
48 50 <template #footer>
49 51 <view style="display: flex; align-items: center; gap: 20rpx">
50   - <u-button type="primary" plain custom-style="flex:1" @click="fileShow = true">取消</u-button>
51   - <u-button type="primary" custom-style="flex:2">确定投保</u-button>
  52 + <u-button type="primary" plain custom-style="flex:1" @click="cancelInsurance">取消投保</u-button>
  53 + <u-button type="primary" custom-style="flex:2" @click="submitInsurance" :disabled="checkboxValue.length === 0">确定投保</u-button>
52 54 </view>
53 55 </template>
54 56 </Page>
... ... @@ -65,44 +67,48 @@ export default {
65 67 },
66 68 data() {
67 69 return {
  70 + pdfFile0: 'https://zeyi-tms-product.oss-cn-hangzhou.aliyuncs.com/file/tms/a15401e7-3d44-41ab-9302-39c6574a1233.pdf',
  71 + pdfFile: 'https://zeyi-tms-product.oss-cn-hangzhou.aliyuncs.com/file/tms/71c2d1ff-0ea1-491b-b387-d2f18de0b19d.html',
  72 + paidAmount: '',
68 73 checkboxValue: [],
69 74 haveAgree: false,
70 75 fileShow: false,
71 76 showLoadTime: false,
72 77 loadTimeDef: new Date(),
73   - schemeList: [
74   - {
75   - title: '货值(赔付限额)',
76   - amountStr: '100万',
77   - amount: 1000000,
78   - subTitle: '',
79   - },
80   - {
81   - title: '货值(赔付限额)',
82   - amountStr: '200万',
83   - amount: 2000000,
84   - subTitle: '不含大宗及冷藏',
85   - },
86   - {
87   - title: '货值(赔付限额)',
88   - amountStr: '300万',
89   - amount: 3000000,
90   - subTitle: '不含大宗及冷藏',
91   - },
92   - ],
  78 + choseSchemeIndex: -1,
  79 + schemeList: [],
93 80 form: {
94   - radio: 'true',
95   - amount: '',
  81 + startDate: '',
  82 + receiveInsuranceAmount: '',
  83 + insuranceProgramCode: '',
  84 + coverageLimit: '',
96 85 },
97 86 shengYuTime: 10,
98 87 popupHandel: null,
  88 + choseScheme: null,
  89 + frightInfo: {},
99 90 };
100 91 },
  92 + onLoad(option) {
  93 + this.paidAmount = option.paidAmount;
  94 + this.initData();
  95 + },
101 96 methods: {
  97 + initData() {
  98 + uni.$u.api.freightOrder.freightInsuranceList({}).then(res => {
  99 + this.schemeList = res.result || [];
  100 + });
  101 + uni.$u.api.freightOrder.currentFreight({}).then(res => {
  102 + this.frightInfo = res.result || {};
  103 + });
  104 + },
102 105 loadTimeFormat({ value }) {
103   - this.form.loadTime = dayjs(value).format('YYYY-MM-DD HH:mm:ss');
  106 + this.form.startDate = dayjs(value).format('YYYY-MM-DD HH:mm:ss');
104 107 this.showLoadTime = false;
105 108 },
  109 + openWebView() {
  110 + uni.navigateTo({ url: '/pages/common/webview?url=' + this.pdfFile });
  111 + },
106 112 openPreFile() {
107 113 if (popupHandel) {
108 114 clearInterval(popupHandel);
... ... @@ -132,6 +138,42 @@ export default {
132 138 this.haveAgree = true;
133 139 this.checkboxValue = ['agree'];
134 140 },
  141 + cancelInsurance() {
  142 + let form = {
  143 + startDate: '',
  144 + receiveInsuranceAmount: '',
  145 + insuranceProgramCode: '',
  146 + coverageLimit: '',
  147 + };
  148 + uni.$emit('buy-insurance', form);
  149 + uni.navigateBack();
  150 + },
  151 + submitInsurance() {
  152 + if (!this.form.startDate) {
  153 + return uni.showToast({ title: '起运时间不能为空', icon: 'none' });
  154 + }
  155 + if (!this.form.insuranceProgramCode) {
  156 + return uni.showToast({ title: '请选择方案', icon: 'none' });
  157 + }
  158 + uni.$emit('buy-insurance', { ...this.form, programName: this.choseScheme.programName });
  159 + uni.navigateBack();
  160 + },
  161 + getReceiveInsuranceAmount(choseScheme, paidAmount) {
  162 + if (!paidAmount || !choseScheme) return '';
  163 + let v1 = Number(paidAmount) * Number(choseScheme.receiveRate);
  164 + return v1 >= Number(choseScheme.minReceiveFee) ? Number(v1 + 0.005).toFixed(2) : choseScheme.minReceiveFee;
  165 + },
  166 + choseSchemeFun(index) {
  167 + this.choseSchemeIndex = index;
  168 + let choseScheme = this.schemeList[index];
  169 + this.form = {
  170 + insuranceProgramCode: choseScheme.code,
  171 + coverageLimit: choseScheme.coverageLimit,
  172 + receiveInsuranceAmount: this.getReceiveInsuranceAmount(choseScheme, this.paidAmount),
  173 + startDate: this.form.startDate,
  174 + };
  175 + this.choseScheme = choseScheme;
  176 + },
135 177 },
136 178 };
137 179 </script>
... ...