Commit 072a553f0c959c4c675eab9b24976ca61815db26

Authored by lxf
1 parent 3a84d329

fix: 下单加保险

pages.json
... ... @@ -118,6 +118,11 @@
118 118 "style": {
119 119 "navigationBarTitleText": "填写备注"
120 120 }
  121 + },{
  122 + "path": "pages/order/insurance",
  123 + "style": {
  124 + "navigationBarTitleText": "保险下单"
  125 + }
121 126 },
122 127 {
123 128 "path": "pages/me/index",
... ...
pages/order/add.vue
... ... @@ -134,6 +134,13 @@
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>
  139 + <template #suffix>
  140 + <view style="display: flex; align-items: center">未购买 <u-icon name="arrow-right"></u-icon> </view
  141 + ></template>
  142 + </u-input>
  143 + </u-form-item>
137 144 </view>
138 145 <view class="card" @tap="more = !more">
139 146 <view class="more-action">
... ... @@ -509,6 +516,9 @@ export default {
509 516 };
510 517 uni.navigateTo({ url: `/pages/common/webview?url=${url}&query=${JSON.stringify(params)}` });
511 518 },
  519 + buyInsurance() {
  520 + uni.navigateTo({ url: `/pages/order/insurance` });
  521 + },
512 522 computedDistance() {
513 523 if (this.form.waypoints[0].lng && this.form.waypoints[1].lng) {
514 524 uni.$u.api.freightOrder
... ...
pages/order/insurance.vue 0 → 100644
... ... @@ -0,0 +1,237 @@
  1 +<template>
  2 + <Page name="order-insurance" flank>
  3 + <template #header>
  4 + <u-alert type="warning" description="请务必在起运之前投保,否则不予理赔。一经投保,不可取消!" font-size="12"></u-alert>
  5 + </template>
  6 + <template #content>
  7 + <u-form :model="form" ref="uForm" labelWidth="100">
  8 + <view class="card">
  9 + <u-form-item label="起运时间" @click="showLoadTime = true" required border-bottom>
  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 />
  12 + </u-form-item>
  13 + <u-form-item label="选择方案" required> </u-form-item>
  14 + <u-form-item border-bottom custom-style="paddingTop:0">
  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>
  20 + </view>
  21 + </view>
  22 + </u-form-item>
  23 + <u-form-item label="被保人" label-width="60" border-bottom>
  24 + <span>浙江中邮物流有限公司</span>
  25 + </u-form-item>
  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>
  28 + </u-form-item>
  29 + </view>
  30 + <view class="tips">
  31 + <u-checkbox-group v-model="checkboxValue" placement="column" @change="checkboxChange">
  32 + <u-checkbox :customStyle="{ marginBottom: '8px' }" name="agree"> </u-checkbox>
  33 + </u-checkbox-group>
  34 + <span class="tip-text">投保前请仔细阅读并同意</span>
  35 + <view class="file-name" @click="openPreFile">《保价须知及责任免除》</view>
  36 + </view>
  37 + </u-form>
  38 + <u-popup mode="center" :show="fileShow" @close="fileShow = false" closeable :safe-area-inset-bottom="false">
  39 + <view class="popup-file">
  40 + <view class="popup-file-title">保价须知及责任免除</view>
  41 + <view class="popup-file-text"></view>
  42 + <u-button type="primary" @click="agreeFun" :disabled="shengYuTime"
  43 + >已阅读并同意<text v-if="shengYuTime">({{ shengYuTime }}s)</text></u-button
  44 + >
  45 + </view>
  46 + </u-popup>
  47 + </template>
  48 + <template #footer>
  49 + <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 + </view>
  53 + </template>
  54 + </Page>
  55 +</template>
  56 +<script>
  57 +import dayjs from 'dayjs';
  58 +let popupHandel;
  59 +export default {
  60 + props: {
  61 + showChose: {
  62 + type: Boolean,
  63 + default: true,
  64 + },
  65 + },
  66 + data() {
  67 + return {
  68 + checkboxValue: [],
  69 + haveAgree: false,
  70 + fileShow: false,
  71 + showLoadTime: false,
  72 + 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 + ],
  93 + form: {
  94 + radio: 'true',
  95 + amount: '',
  96 + },
  97 + shengYuTime: 10,
  98 + popupHandel: null,
  99 + };
  100 + },
  101 + methods: {
  102 + loadTimeFormat({ value }) {
  103 + this.form.loadTime = dayjs(value).format('YYYY-MM-DD HH:mm:ss');
  104 + this.showLoadTime = false;
  105 + },
  106 + openPreFile() {
  107 + if (popupHandel) {
  108 + clearInterval(popupHandel);
  109 + }
  110 + this.fileShow = true;
  111 + if (!this.haveAgree) {
  112 + this.shengYuTime = 10;
  113 + popupHandel = setInterval(() => {
  114 + let i = this.shengYuTime - 1;
  115 + if (i === 0) {
  116 + clearInterval(popupHandel);
  117 + }
  118 + this.shengYuTime = i;
  119 + }, 1000);
  120 + }
  121 + },
  122 + checkboxChange(e) {
  123 + this.$nextTick(() => {
  124 + if (!this.haveAgree) {
  125 + this.checkboxValue = [];
  126 + this.openPreFile();
  127 + }
  128 + });
  129 + },
  130 + agreeFun() {
  131 + this.fileShow = false;
  132 + this.haveAgree = true;
  133 + this.checkboxValue = ['agree'];
  134 + },
  135 + },
  136 +};
  137 +</script>
  138 +<style lang="scss">
  139 +.page-order-insurance {
  140 + &__header {
  141 + padding: 0 !important;
  142 + }
  143 + &__content {
  144 + .card {
  145 + color: #999999;
  146 + margin-bottom: $padding-md;
  147 + background-color: $color-white;
  148 + border-radius: $radius-md;
  149 + box-shadow: $shadow-normal;
  150 + .u-form-item {
  151 + padding-left: $padding-md !important;
  152 + padding-right: $padding-sm !important;
  153 + }
  154 + .scheme-box {
  155 + display: flex;
  156 + gap: 20rpx;
  157 + .scheme-item {
  158 + cursor: pointer;
  159 + flex: 1;
  160 + border: #cccccc 1px solid;
  161 + padding: 10rpx;
  162 + background: white;
  163 + .amount {
  164 + font-size: 32rpx;
  165 + font-weight: bold;
  166 + color: #ffcc00;
  167 + }
  168 + .title {
  169 + color: $color-text;
  170 + font-size: 24rpx;
  171 + padding: 20rpx 0;
  172 + }
  173 + .sub-title {
  174 + color: $color-text-caption;
  175 + font-size: 20rpx;
  176 + }
  177 + }
  178 + .scheme-item-active {
  179 + border-color: $color-blue;
  180 + position: relative;
  181 + }
  182 + .scheme-item-active:after {
  183 + content: '✓';
  184 + position: absolute;
  185 + width: 20rpx;
  186 + height: 20rpx;
  187 + top: 0;
  188 + right: 4rpx;
  189 + color: white;
  190 + }
  191 + .scheme-item-active:before {
  192 + content: '';
  193 + position: absolute;
  194 + width: 0;
  195 + height: 0;
  196 + border-left: 30rpx solid transparent;
  197 + border-right: 30rpx solid $color-blue;
  198 + border-top: 30rpx solid $color-blue;
  199 + border-bottom: 30rpx solid transparent;
  200 + top: 0;
  201 + right: 0;
  202 + }
  203 + }
  204 + }
  205 + .tips {
  206 + padding-left: $padding-xs !important;
  207 + padding-right: $padding-xs !important;
  208 + display: flex;
  209 + font-size: 13px;
  210 + .tip-text {
  211 + color: $color-text-caption;
  212 + }
  213 + .file-name {
  214 + display: inline;
  215 + color: $color-blue;
  216 + }
  217 + }
  218 + .popup-file {
  219 + padding: $padding-sm;
  220 + width: 90vw;
  221 + .popup-file-title {
  222 + font-size: 32rpx;
  223 + font-weight: bold;
  224 + padding-bottom: $padding-sm;
  225 + }
  226 + .popup-file-text {
  227 + background-color: $color-bg-disabled;
  228 + height: 60vh;
  229 + overflow: scroll;
  230 + }
  231 + }
  232 + }
  233 + &__footer {
  234 + background-color: $color-white;
  235 + }
  236 +}
  237 +</style>
... ...