/*******************************************************************************
 * Copyright(c) 2022 dongke All rights reserved. / Confidential
 * 类的信息：
 *		1.程序名称：库存查询-明细
 * 编辑履历：
 *		作者				日期					版本				修改内容
 *		姜永辉		 2024-1-23			1.00		    选品
 *******************************************************************************/
const mixins = require('@/mixins/index.js')
const Constants = require('@/utils/Constants.js');
const app = getApp()
Page({
  mixins: [mixins],
  /**
   * 页面的初始数据
   */
  data: {
    // 路由
    routeObjName: 'report',
    cardList: ['main'],
    contentObj: {
      main: [
        { code: 'whName', type: 'str', readonly: true, title: mixins.$t('reservoirArea') },
        { code: 'brandName', type: 'str', readonly: true, title: mixins.$t('brand') },
        { code: 'catName', title: '', type: 'str', readonly: true, title: mixins.$t('category') },
        { code: 'seriesName', type: 'str', readonly: true, title: mixins.$t('series') },
        { code: 'skuSpec', type: 'str', readonly: true, title: mixins.$t('goodSpec') },
        { code: 'nonStdCode', type: 'str', readonly: true, title: mixins.$t('colorNumber') },

      ]
    },
  },

  /**
   * 生命周期函数--监听页面加载
   */
  loadInit() {
    console.log(this.data.item, "loadInit");
    let item = this.data.item
    this.setData({
      formData: JSON.stringify(item)

    })
    // 可售包装 
    if (item.flgSubUnit) {
      item['freezeBox'] = parseInt(item.freezeQty / item.packBox)
      item['freezePiece'] = parseFloat(Number(item.freezeQty % item.packBox)).toFixed(item.decimalPlace)
      item.packageBoxFreeze = item['freezeBox'] + item.subUnitName + item['freezePiece'] + item.unitName

      item['usableBox'] = parseInt(item.usableQty / item.packBox)
      item['usablePiece'] = parseFloat(Number(item.usableQty % item.packBox)).toFixed(item.decimalPlace) 
      item.packageBoxUsable = item['usableBox'] + item.subUnitName + item['usablePiece'] + item.unitName
    }

  },

})