const Constants = require('@/utils/Constants.js');
const util = require('@/utils/util.js')
const mixins = require('@/mixins/index.js')
Page({
  mixins: [mixins],
  /**
   * 页面的初始数据
   */
  data: {
    // 查询条件
    searchContent: [{ code: 'createtime', title: '本月', defaultValue: 3, searchType: Constants.searchType.date }, 
    { code: 'staff', title: '业务员', dropType: 'staff' },
    { code: 'org', title: '业务部门', dropType: 'org' },
    { code: 'choose', title: '筛选', searchType: Constants.searchType.pick }],
    // 查询条件-筛选
    pullMenuList: [{ code: 'purchaseStatus', pullType: 'mSelect', typeName: 'purchaseStatus' },
    { code: 'contactName', dataType: '' },
    { code: 'deliveryPhone', dataType: '' },
    { code: 'addressFull', dataType: '' },
    { code: 'makingTime', dataType: 'date' }, { code: 'deliveryTime', dataType: 'date' }],
    // 列表区（内容）
    contentList: [{ name: 'orderNo', title: '核销单号' },
   { name: [{ name: 'orgName', title: '' }, { name: 'staffName', title: '' },], title: '门店/业务员' },  { name: 'makingTime', title: '核销日期' },],
   contentObj: {
    '预收冲应收': [{ name: 'orderNo', title: '核销单号' },
    { name: [{ name: 'orgName', title: '' }, { name: 'staffName', title: '' },], title: '门店/业务员' },  { name: 'makingTime', title: '核销日期' },],
    '预付冲应付':  [{ name: 'orderNo', title: '核销单号' },
    { name: [{ name: 'orgName', title: '' }, { name: 'staffName', title: '' },], title: '门店/业务员' },  { name: 'makingTime', title: '核销日期' },],
    '应收转应收': [{ name: 'orderNo', title: '核销单号' },
    { name: 'staffName1', title: '转出业务员' },
    { name: 'cName', title: '转入客户' },
    { name: 'staffName2', title: '转入业务员' },
     { name: 'makingTime', title: '核销日期' },],
    '应付转应付':  [{ name: 'orderNo', title: '核销单号' },
    { name: 'supplierName1', title: '转入供销商' },
    { name: 'makingTime', title: '核销日期' },]
  },
    // 弹出按钮
    buttonList: [{ name: 'follow', title: '采购作废' }, { name: 'followTask', title: '冲正重开' }, { name: 'purchase-return-repla-sup', title: '采购退货' },
    { name: 'collection', title: '采购退货冲正' }, { name: 'merge', title: '打印票据' }],
    totallength: 6000, //视图下方提醒数量
    selectTotallength: 12,
    selectlength: 5,
    // 路由
    routeObjName: 'other-expenditure-orders',
    tableData: [],
    active: 0,
  },
  getData(){
    this.setData({
      totallength: 6000,
      tableData: [
        {
          supplierName: '张曼曼',
          displayStatus: '预收冲应收',
          makingTime: '2022-04-04',
          orderNo: 'FQ202207061423001',
          sumAccount:2000,
          staffName:"王丽丽",
          orgName:"沈河家天下店",
          collectStatus:'totalWriteOffOrder',
          collectStatusAmount:1,
          backgroundColor: '#95A8CB',
        },
        {
          supplierName: '恒洁卫浴厂家',
          displayStatus: '预付冲应付',
          makingTime: '2022-04-04',
          orderNo: 'FQ202207061423001',
          staffName:"王丽丽",
          orgName:"沈河家天下店",
          sumAccount:2000,
          collectStatus:'totalWriteOffOrder',
          backgroundColor: '#95A8CB',
          collectStatusAmount:1,
        },
        {
          supplierName: '张曼曼',
          displayStatus: '应收转应收',
          makingTime: '2022-04-04',
          orderNo: 'FQ202207061423001',
          cName:'李磊',
          staffName1:"王丽丽",
          staffName2:"王丽丽",
          sumAccount:2000,
          collectStatus:'totalWriteOffOrder',
          backgroundColor: '#95A8CB',
          collectStatusAmount:1,
        },
        {
          supplierName: '恒洁卫浴厂家',
          supplierName1: '箭牌厂家',
          displayStatus: '应付转应付',
          makingTime: '2022-04-04',
          orderNo: 'FQ202207061423001',
          sumAccount:2000,
          collectStatus:'totalWriteOffOrder',
          backgroundColor: '#95A8CB',
          collectStatusAmount:1,
        }
      ]
    })
  },
  //抽屉打开
  openSearchPop() {
    this.setData({
      show: true,
    })
  },
  onclik(e) {
    this.setData({
      showShare: true,
    })
  },

  onCloseShare() {
    this.setData({
      showShare: false,
    })
  },
  /**
 * @desc : 抽屉离焦关闭
 * @author : 于继渤
 * @date : 2022/5/27 12:16
 */
  onClose() {
    this.setData({
      show: false
    })
    this.selectComponent("#pick").toggle(false) //取消选中样式
  },

  toAdd() {
    wx.navigateTo({
      url: './add/add',
    })
  },
  toDetail() {
    wx.navigateTo({
      url: './detail/detail',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

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

  },

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

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})