// package-basic-data/pages/test/add/add.js
const mixins = require('@/mixins/index.js')
const app = getApp()
Page({
  mixins: [mixins],
  /**
   * 页面的初始数据
   */
  data: {
    cardList: ['main'],
    contentObj: {
      main: [{ code: 'staffId', name: 'staffName', type: 'drop', required: true, dropType: 'staff' }, { code: 'customerName', type: 'str', required: true },
      { code: 'telephone', type: 'phone', title: '客户电话', required: true }, { code: 'address', type: 'address', title: '客户地址', required: true }, { code: 'designStatus', type: 'checkbox', title: '设计制图' }, { code: 'collectAmount', type: 'number', title: '收款金额', required: true }, { code: 'remarks', type: 'textarea', title: '备注' }, { code: 'file', type: 'uploader', title: '附件' }]
    },
    // cardList: [{name:'main',title:'客户信息',expandFlag:true,infoCols:['telephone'],displayNum:2},{name:'relation'},{name:'items',title:'商品明细',displayNum:2,info:'(待入库)'},{name:'other',title:'其他信息'}],
    // contentObj: {
    //   main: [{ code: 'staffId', name: 'staffName', type: 'choose', required: true, dropType: 'staff',urlKey:'follow' },
    //   { code: 'telephone', type: 'phone', title: '客户电话', required: true }, { code: 'address', type: 'address', title: '客户地址', required: true }, { code: 'designStatus', type: 'switch', title: '设计制图' }],
    //   items:[{ code: 'collectType', name: 'collectName', type: 'drop', required: true, dropType: 'collect' },{ code: 'collectAmount', type: 'number', title: '收款金额', required: true }],
    //   relation:[{ code: 'invoice', type: 'choose',title:'关联源单'}],
    //   other:[{ code: 'deliveryDate', type: 'date', title: '送货日期' },{ code: 'remarks', type: 'textarea', title: '备注',readonly:false },{ code: 'test1', type: 'str', title: '测试1' },{ code: 'test2', type: 'address', title: '测试2' },{ code: 'test3', type: 'phone', title: '测试3' }, { code: 'test4', type: 'number', title: '测试4' }, { code: 'test5', type: 'switch', title: '测试5' }, { code: 'test6', type: 'checkbox', title: '测试6`' },{ code: 'file', type: 'uploader', title: '附件' }]
    // },
     // 路由
     routeObjName: 'customer',
  },
  /**
   * @desc   : 绑定数据
   * @author : 周兴
   * @date   : 2024/1/26 11:46
   */
  chooseData(e) {
    console.log('eee1', e, this.data.formData);
  },
    /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    // 接收父页面传递的参数
    const eventChannel = this.getOpenerEventChannel()
    let _this = this;
    eventChannel.on('choose', function (data) {
      console.log('生命周期函数',data)
      // 设置商品明细
      _this.selectComponent('#' + _this.data.formName).setGoods(data);
    })
  }
})