var util = require('../../utils/util.js')
const app = getApp();
Page({

  data: {
 
    
    provinceList: [
       {id: "北京市", name: "北京市"}, {id: "天津市", name: "天津市"}, {id: "河北省", name: "河北省"}, {id: "山西省", name: "山西省"}, {id: "内蒙古自治区", name: "内蒙古自治区"}, {id: "辽宁省", name: "辽宁省"}, {id: "吉林省", name: "吉林省"}, {id: "黑龙江省", name: "黑龙江省"}, {id: "上海市", name: "上海市"}, {id: "江苏省", name: "江苏省"}, {id: "浙江省", name: "浙江省"}, {id: "安徽省", name: "安徽省"}, {id: "福建省", name: "福建省"}, {id: "江西省", name: "江西省"}, {id: "山东省", name: "山东省"}, {id: "河南省", name: "河南省"}, {id: "湖北省", name: "湖北省"}, {id: "湖南省", name: "湖南省"}, {id: "广东省", name: "广东省"}, {id: "广西壮族自治区", name: "广西壮族自治区"}, {id: "海南省", name: "海南省"}, {id: "四川省", name: "四川省"}, {id: "贵州省", name: "贵州省"}, {id: "云南省", name: "云南省"}, {id: "重庆市", name: "重庆市"}, {id: "西藏自治区", name: "西藏自治区"}, {id: "陕西省", name: "陕西省"}, {id: "甘肃省", name: "甘肃省"}, {id: "青海省", name: "青海省"}, {id: "宁夏回族自治区", name: "宁夏回族自治区"}, {id: "新疆维吾尔自治区", name: "新疆维吾尔自治区"}, {id: "香港特别行政区", name: "香港特别行政区"}, {id: "澳门特别行政区", name: "澳门特别行政区"}, {id: "台湾省", name: "台湾省"} 
    ],
    provinceIndex:'',
    province:'',
 
 
    rules: {
      customerName: [{ required: true, message: '客户必填', trigger: 'blur' }],
      groupName: [{ required: true, message: '客户集团必填', trigger: 'blur' }],
      customeStatusName: [{ required: true, message: '客户状态必填', trigger: 'blur' }],
      scode: [{ required: true, message: '必填', trigger: 'blur' }],
      directorName: [{ required: true, message: '负责人必填', trigger: 'blur' }] 
    },
    // 新增/编辑
    create: {
        dialogStatus: '',
        temp: {
           customerId: '',  customerName: '',  groupId: '', groupName: '',  customeStatusId: '', customeStatusName: '',  rangeId: '', rangeName: '', province: '', address: '',scode: '', directorId: '',directorName: '',createrName: '', createrId: '',  createtime: util.getToday(),   remark: '', content: '',  
           receiverChoose: 'true' 
        },
        
    }
  },

  onLoad: function (options) {
    // 表单初始化
    wx.lin.initValidateForm(this)
 
    var id = options.id;
    //获取编辑内容
    util.getDataByName({ name:'getCustomerByIdApp', parammaps: {"id":id} }, this.getShowList)

 
  },
  getShowList:function(res){
    console.log('展示数据======>', res.data.list)
    var customerId = res.data.list[0].customerId
    this.setData({
      ['create.temp']:  res.data.list[0],
 
      customeStatusId: res.data.list[0].customeStatusId, 
      groupId: res.data.list[0].groupId, 
      rangeId: res.data.list[0].rangeId,
      province: res.data.list[0].province,
      directorId: res.data.list[0].directorId
    })

   

     

   
  },
   
   

 

 
  
  onReady: function () {

  },

  
  onShow: function () {

  },

 
  onHide: function () {

  },

   
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

 
  onShareAppMessage: function () {

  }
})