index.js 2.32 KB

import ActivityApi from '~/api/activityApi/index'
Page({
  data: {
    list: [],
    levelQuery: {
      'PC0036':'续保惠享A套餐',
      'PC0037':'续保优享B套餐',
      'PC0038':'续保乐享C套餐',
      'PC0039':'续保尊享D套餐',
    }
  },
  onLoad(options) {
    if (options.query) {
      let _temp = JSON.parse(options.query)
      this.query = {
        customerPhone: _temp.p,
        licenseNumber: _temp.c
      }
    }
    this.judgePhone()
    this.equityAndClaimsInfo();
  },
  toCreateClaims() {
      const {customerInfo:{contractNo,effectiveDate,packageCode,customerName}} = this.data,{customerPhone,licenseNumber} = this.query
    wx.$router.go('/packageStoreAssistant/packageAuth/pages/GHStaff/FillClaims/index', {
        operation:3,
        contractNo,
        effectiveDate,
        packageCode,
        customerPhone,
        licenseNumber,
        customerName
    })
  },
  equityAndClaimsInfo() {
    const { customerPhone, licenseNumber } = this.query || {}
    ActivityApi.equityAndClaimsInfo({ customerPhone, licenseNumber }).then(res => {
      if(res.handlerTime){
        res.handlerTime = new Date(res.handlerTime).format('yyyy-MM-dd hh:mm:ss')
      }
      res.customerPhone = customerPhone
      this.setData({
        customerInfo: res
      }, () => {
        this.equityAndClaimsList(res.accountId,customerPhone)
      })
    })
  },
  equityAndClaimsList(accountId,customerPhone) {
    this.customerPhone = customerPhone
    ActivityApi.equityAndClaimsList({
      pageSize: 100,
      pageNum: 1,
      accountId,
      equitySource:1,
      customerPhone,
      licensePlate:this.query.licenseNumber
    }).then(res => {
      res.list.forEach(el=>{
        el.merchantCommitDate =el.merchantCommitDate?new Date(el.merchantCommitDate).format('yyyy-MM-dd hh:mm:ss'):'--'
    })
      this.setData({
        list: res.list || []
      })
      wx.stopPullDownRefresh()
      this.showBack = true
    })
  },
  judgePhone() {
    const phoneInfo = wx.$storage.get('system_info')
    let isIphoneX = phoneInfo.model.search('iPhone X') != -1 ? true : false
    this.setData({
      isIphoneX
    })
  },
  onShow(){
    if(this.data.customerInfo&&this.showBack){
      this.equityAndClaimsList(this.data.customerInfo.accountId,this.customerPhone)
    }
  },
  onPullDownRefresh(){
    this.equityAndClaimsInfo();
  },
})