MrShi
2024-04-02 22271e641e4505ba906c3770905b7e84e3ad8d85
wx/pages/policyDetails/policyDetails.vue
@@ -92,14 +92,14 @@
      <template v-if="info.solutionType === 0">
         <!-- 保障中 -->
         <view class="details_footer" v-if="info.statusCollect === 2">
            <u-button type="primary" shape="circle" color="#437CB3" :plain="true" text="查看投保单"></u-button>
            <u-button type="primary" shape="circle" color="#437CB3" :plain="true" text="查看投保单" @click="seePdf(info.toubaodanSignedFile.fileurlFull)"></u-button>
            <view style="width: 44rpx; height: 50rpx;"></view>
            <u-button type="primary" shape="circle" color="#437CB3" :plain="true" text="查看保险单"></u-button>
            <u-button type="primary" shape="circle" color="#437CB3" :plain="true" text="查看保险单" @click="seePdf(info.baoxiandanFile.fileurlFull)"></u-button>
         </view>
         <!-- 待审核 -->
         <view class="details_footer" v-if="info.statusCollect === 0">
            <!-- show = true -->
            <u-button type="primary" shape="circle" color="#437CB3" @click="open1" :plain="true" text="申请退回"></u-button>
            <u-button type="primary" shape="circle" color="#437CB3" :plain="true" text="申请退回" @click="show = true"></u-button>
         </view>
         <!-- 待签署 -->
         <view class="details_footer" v-if="info.statusCollect === 7">
@@ -112,7 +112,7 @@
         <view class="details_footer" v-if="info.statusCollect === 1">
            <u-button type="primary" shape="circle" color="#437CB3" :plain="true" text="申请退回" @click="show = true"></u-button>
            <view style="width: 44rpx; height: 50rpx;"></view>
            <u-button type="primary" shape="circle" color="#437CB3" text="查看投保单" @click="seePdf"></u-button>
            <u-button type="primary" shape="circle" color="#437CB3" text="查看投保单" @click="seePdf(info.toubaodanSignedFile.fileurlFull)"></u-button>
         </view>
         <!-- 已退回 -->
         <view class="details_footer" v-if="info.statusCollect === 4">
@@ -123,15 +123,15 @@
      <template v-else>
         <!-- 待签署 -->
         <view class="details_footer" v-if="info.statusCollect === 7">
            <u-button type="primary" shape="circle" color="#437CB3" :plain="true" text="签署确认书"></u-button>
            <u-button type="primary" shape="circle" color="#437CB3" :plain="true" text="签署确认书" @click="openmessage(2)"></u-button>
            <view style="width: 44rpx; height: 50rpx;"></view>
            <u-button type="primary" shape="circle" color="#437CB3" text="签署申请单"></u-button>
            <u-button type="primary" shape="circle" color="#437CB3" text="签署申请单" @click="openmessage(3)"></u-button>
         </view>
         <!-- 待审核/待出账 -->
         <view class="details_footer" v-if="info.statusCollect === 0 || info.statusCollect === 1">
            <u-button type="primary" shape="circle" color="#437CB3" :plain="true" text="查看申请单"></u-button>
            <u-button type="primary" shape="circle" color="#437CB3" :plain="true" text="查看申请单" @click="seePdf(info.shenqingdanFile.fileurlFull)"></u-button>
            <view style="width: 44rpx; height: 50rpx;"></view>
            <u-button type="primary" shape="circle" color="#437CB3" text="查看确认书"></u-button>
            <u-button type="primary" shape="circle" color="#437CB3" text="查看确认书" @click="seePdf(info.fanganFile.fileurlFull)"></u-button>
         </view>
         <!-- 已退回 -->
         <view class="details_footer" v-if="info.statusCollect === 4">
@@ -139,7 +139,7 @@
         </view>
         <!-- 投保中 -->
         <view class="details_footer" v-if="info.statusCollect === 26 && info.unionApplyTbdStatus !== 0">
            <u-button type="primary" shape="circle" color="#437CB3" :plain="true" text="签署投保单"></u-button>
            <u-button type="primary" shape="circle" color="#437CB3" text="签署投保单" @click="openmessage(1)"></u-button>
         </view>
      </template>
      <!-- 申请退回确认弹窗 -->
@@ -154,11 +154,15 @@
      <u-modal :show="show1" title="获取验证码" :showCancelButton="true" confirmColor="#437CB3" @cancel="cancel1" @confirm="confirm1">
         <view class="code">
            <view class="code_input">
               <input type="text" placeholder="输入验证码" />
               <input type="text" v-model="code" placeholder="输入验证码" />
            </view>
            <view class="code_text">
               <text class="code_text_error">验证码错误</text>
               <text>获取验证码</text>
               <text class="code_text_error" v-if="error === 1">验证码不能为空</text>
               <text class="code_text_error" v-else-if="error === 2">验证码错误</text>
               <text v-else></text>
               <text @click="send" v-if="num === 0">获取验证码</text>
               <text v-else>{{num}}</text>
            </view>
         </view>
      </u-modal>
@@ -166,6 +170,7 @@
</template>
<script>
   import { mapState } from 'vuex'
   export default {
      data() {
         return {
@@ -176,8 +181,17 @@
            list: [],
            show: false,
            show1: false,
            show2: false
            show2: false,
            type: null,
            code: '',
            num: 0,
            error: false,
            timer: null
         };
      },
      computed: {
         ...mapState(['userInfo'])
      },
      onLoad(options) {
         this.orderId = options.orderId
@@ -188,15 +202,46 @@
         this.applyDetailPage()
      },
      methods: {
         send () {
            this.$u.api.sendSms({
               phone: this.userInfo.mobile
            }).then(res => {
               if (res.code === 200) {
                  this.num = 60
                  this.setTime()
               }
            })
         },
         setTime () {
            this.timer = setInterval(() => {
               if (this.num === 0) {
                  clearInterval(this.timer)
                  this.timer = null
                  return
               }
               this.num = this.num - 1
            }, 1000)
         },
         // 打开发送验证码弹窗
         openmessage(type) {
            this.code = ''
            clearInterval(this.timer)
            this.error = ''
            this.timer = null
            this.num = 0
            this.type = type
            this.show1 = true
         },
         signApplication() {
            uni.navigateTo({
               url: `/pages/webView/webView?url=https://web.sandbox.junziqian.com/signInfo/viewDetail?ts=1711966477502&signNo=SSN1774742154020143104&sign=GHW6wWRJfEZiXO-gXZwTezR5CYUvhwbmoWHlPsqUCLA`
            })
         },
         // 查看pdf
         seePdf() {
         seePdf(url) {
            if(!url) return;
            uni.downloadFile({
                url: this.info.toubaodanSignedFile.fileurlFull,
                url,
                success: function (res) {
                  var filePath = res.tempFilePath;
                  uni.openDocument({
@@ -235,23 +280,6 @@
               }
            })
         },
         open1() {
            uni.navigateToMiniProgram({
                appId: 'wxf7fd282cd119885f', // 要打开的小程序的appid
                path: 'pages/index/index', // 打开的页面路径,可选
                extraData: {
                    // 需要传递给目标小程序的数据,可选
                },
                success(res) {
                    // 打开成功的回调,可选
                    console.log('打开成功');
                },
                fail(err) {
                    // 打开失败的回调,可选
                    console.log('打开失败', err);
                }
            });
         },
         IdCard(UUserCard) {
            let idcard = UUserCard.toString();
            //获取年龄
@@ -280,7 +308,63 @@
            this.show = false
         },
         confirm1() {
            this.show1 = false
            if (!this.code) {
               this.error = 1
               return
            }
            // 签署投保单
            if (this.type === 1) {
               this.$u.api.validateCode({
                  code: this.code
               }).then(res => {
                  if (res.code === 200) {
                     this.error = ''
                     this.show1 = false
                     this.$u.api.getSignLink(this.info.id)
                        .then(url => {
                           if (url.code === 200) {
                              uni.navigateTo({
                                 url: `/pages/webView/webView?url=${url.data}`
                              })
                           }
                        })
                  } else {
                     this.error = 2
                  }
               })
            // 确认书
            } else if (this.type === 2) {
               this.$u.api.signTBQRSLink({
                  businessId: this.info.id,
                  code: this.code
               }).then(res => {
                  if (res.code === 200) {
                     this.error = ''
                     this.show1 = false
                     uni.navigateTo({
                        url: `/pages/webView/webView?url=${res.data}`
                     })
                  } else {
                     this.error = 2
                  }
               })
            // 签署申请单
            } else if (this.type === 3) {
               this.$u.api.getMemberListOnlineSignLink({
                  businessId: this.info.id,
                  code: this.code
               }).then(res => {
                  if (res.code === 200) {
                     this.error = ''
                     this.show1 = false
                     uni.navigateTo({
                        url: `/pages/webView/webView?url=${res.data}`
                     })
                  } else {
                     this.error = 2
                  }
               })
            }
         },
         cancel1() {
            this.show1 = false