const mixins = require('@/mixins/index.js')
const Constants = require('@/utils/Constants.js');
const app = getApp()
Page({
  mixins: [mixins],
    /**
     * 页面的初始数据
     */
    data: {
    // 路由
    routeObjName: 'saleReport',
    saleList:[],
    saleReturnList:[],
    saleOutList:[],
    },
  /**
   * @desc : 查询
   * @date : 2024/2/1 15:49
   * @author : 于继渤
   */
  getData() {
    return this.excute(this.data.service, this.data.service.getSalesTrackingReportDetail+'/'+ this.data.item.orderId, {}).then(res=>{
      console.log(res)
      if(res.data.code == 200 ){
        let formData = JSON.parse(this.data.formData)
        if(res.data.data && res.data.data.length > 0){
          let saleList =  res.data.data.filter(item=>{
            return item.type== '销售订单'
          })
          let saleOutList =  res.data.data.filter(item=>{
            return item.type== '销售出库'
          })
          let saleReturnList =  res.data.data.filter(item=>{
            return item.type== '销售退货'
          })
          this.setData({
            saleList:saleList,
            saleOutList:saleOutList,
            saleReturnList:saleReturnList
          })
        }
  
      }
    })
  },
    /**
     * 生命周期函数--监听页面加载
     */
    loadInit() {
      console.log()
      this.getData()
    },

})