/*******************************************************************************
 * Copyright(c) 2022 dongke All rights reserved. / Confidential
 * 类的信息：
 *		1.程序名称：
 * 编辑履历：
 *		作者				日期					版本				修改内容
 *		于继渤		 2024-1-23			1.00		    跟进任务
 *******************************************************************************/
const Constants = require('@/utils/Constants.js');
const util = require('@/utils/util.js')
const mixins = require('@/mixins/index.js')
const app = getApp()
Page({
  mixins: [mixins],
  /** 
   * 页面的初始数据
   */
  data: {
    routeObjName: 'cusFollow',
    cardList: ['main'],
    buttonSaveList:[{code:'add',title:mixins.$t('save'),width:'120rpx'}],
    contentObj: {
      main: [
        { code: 'cusName', type: 'str', required: true, readonly: true, title: mixins.$t('cusName') },
        { code: 'reportStaff', name: 'reportStaffName', type: 'drop', required: true, dropType: 'staff', title: mixins.$t('staffId') },
        { code: 'nextFollowPlan', type: 'textarea', rows: '5', showWordLimit: true, title:  mixins.$t('nextFollowPlan')},
        { code: 'nextFollowTime', type: 'dateTime', required: true, title:mixins.$t('nextFollowTimePlan') },
      ]
    },
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    //接收父页面传递的参数
    let that = this
    const eventChannel = this.getOpenerEventChannel()
    eventChannel.on('params', function (data) {
      let item = that.data.item
      let formData = that.setCus(JSON.parse(that.data.formData), item)
      that.setData({
        formData: formData
      })
    })
  },
  /**
    * @desc : 设置客户信息
    * @date : 2024/2/1 15:49
    * @author : 于继渤
    */
  setCus(formData, item) {
    formData.cusId = item.cusId
    formData.cusName = item.cusName
    formData.cusCode = item.cusCode
    formData.cusPhone = item.cusPhone
    formData.reportStaffName = item.reportStaffName
    formData.address = {
      address: item.addressFull
    } //不这么设置 会不回显
    formData.addressArea = item.addressArea
    formData.addressFull = item.addressFull
    formData.addressGcj02 = item.addressGcj02
    formData.addressName = item.addressName
    formData.addressNo = item.addressNo
    formData.saleStatus = item.saleStatus
    return JSON.stringify(formData)
  },


})