Просмотр исходного кода

修改 29 销售退货-新建-修改包装数量没有事实读取

王英杰 1 год назад
Родитель
Сommit
b078ee4e2c

+ 31 - 7
components/dkbase/dk-form-bill/dk-form-bill.js

@@ -469,7 +469,7 @@ Component({
         return;
       }
       let ds = e.currentTarget.dataset;
-      if (this.data.billType == Constants.billType.sale || this.data.billType == Constants.billType.pur || this.data.billType == Constants.billType.out || this.data.type == Constants.billType.purInto ||this.data.type == Constants.billType.saleOutReturn) { //采购订单的时候 打开商品的pup 就要计算箱片
+      if (this.data.billType == Constants.billType.sale || this.data.billType == Constants.billType.pur || this.data.billType == Constants.billType.out || this.data.type == Constants.billType.purInto ) { //采购订单的时候 打开商品的pup 就要计算箱片
         ds.item['box'] = parseInt(ds.item.itemQty / ds.item.packBox)
         ds.item['piece'] = Number(ds.item.itemQty % ds.item.packBox)
         ds.item.packageBox = ds.item['box'] + ds.item.subUnitName + ds.item['piece'] + ds.item.unitName
@@ -477,8 +477,13 @@ Component({
         ds.item['outingBox'] = parseInt(ds.item.itemQty / ds.item.packBox)
         ds.item['outingPiece'] = Number(ds.item.itemQty % ds.item.packBox)
         ds.item.packageBox = ds.item['outingBox'] + ds.item.subUnitName + ds.item['outingPiece'] + ds.item.unitName
-      }
-
+      }else if(this.data.type == Constants.billType.saleOutReturn){ //销售退货的时候 打开商品的pup 就要计算箱片
+        // 使用 Math.abs() 函数获取 outingQty 的绝对值
+       let   outingQty = Math.abs(ds.item.outingQty);
+        ds.item['box'] = parseInt(outingQty / ds.item.packBox)
+        ds.item['piece'] = Number(outingQty % ds.item.packBox)
+        ds.item.packageBox = ds.item['box'] + ds.item.subUnitName + ds.item['piece'] + ds.item.unitName
+      } 
       this.setInitPopData()
       this.setData({
         dataIndex: ds.index,
@@ -565,8 +570,25 @@ Component({
         dataItem.packageBox = dataItem['outingBox'] + dataItem.subUnitName + dataItem['outingPiece'] + dataItem.unitName
       }
       else if (this.data.type == Constants.billType.saleOutReturn) {
+
+        let itemQty = ( dataItem['box'] * dataItem['packBox'] + dataItem['piece']) 
+        let  itemQty_min = dataItem.itemQty_min? Math.abs(dataItem.itemQty_min):''; //取绝对值 (因为是负值 即最小值的绝对值 为最大值)
+        //如果设有做大值 判断  箱片的反算数量 大于 数量最大值
+      if(itemQty_min && itemQty>itemQty_min){
+         //那就吧 把最大值的数量换算 箱片赋值箱片
+         let  outingQty =  Math.abs(dataItem.outingQty); //取绝对值
+         dataItem['box'] = parseInt(  outingQty  /  dataItem['packBox'] )
+         dataItem['piece'] = Number( outingQty % dataItem['packBox'])
+         dataItem.packageBox = dataItem['box'] + dataItem.subUnitName + dataItem['piece'] + dataItem.unitName
+         this.setData({
+          dataItem: JSON.stringify(dataItem)
+        })
+        util.showToast('超出最大数量');
+         return
+      }
+
         //数量等于 包乘以包装数 加上片数   
-        dataItem['outingQty'] = -1 * dataItem['outingBox'] * dataItem['packBox'] + dataItem['outingPiece']
+        dataItem['outingQty'] = -1 * (dataItem['box'] * dataItem['packBox'] + dataItem['piece'])
         dataItem.packageBox = dataItem['box'] + dataItem.subUnitName + dataItem['piece'] + dataItem.unitName
       }
       this.setData({
@@ -1755,9 +1777,11 @@ Component({
 
       }
       else if (this.data.type == Constants.billType.saleOutReturn) {
-          dataItem['outingQty'] = value*-1
-          dataItem['outingBox'] = parseInt(value / dataItem.packBox)
-          dataItem['outingPiece'] = Number(value % dataItem.packBox)
+          dataItem['outingQty'] = value
+          // 使用 Math.abs() 函数获取 outingQty 的绝对值  
+          let outingQty = Math.abs(dataItem.outingQty);
+          dataItem['box'] = parseInt(outingQty / dataItem.packBox)
+          dataItem['piece'] = Number(outingQty % dataItem.packBox)
       }
       this.setData({
         dataItem: JSON.stringify(dataItem)

+ 1 - 1
components/dkbase/dk-form-bill/dk-form-bill.wxml

@@ -284,4 +284,4 @@
 
 <dk-popup id="dkPopup" type="{{popType}}" routeObjName="{{routeObjName}}" priceCol="{{priceCol}}" titleTagCol="{{titleTagCol}}" titleCol="{{titleCol}}" subCol="{{subCol}}" descCol="{{descCol}}" iconCol="{{iconCol}}" priceCol="{{pupPriceCol}}" priceTitle="{{priceTitle}}" value="{{dataItem}}" show="{{showPop}}" contentObj="{{popContent}}" popupTopObj="{{popupTopObj}}" bind:changeStep="changeStep"  bind:changeCheckBox="changeCheckBox" readonly="{{readonly}}" bind:commit="editItems"bind:openPackageBox="openPackageBox"></dk-popup>
  <!-- 箱片 -->
-<dk-popup   type="basic"    titleCol="skuModel"  iconCol="imagesUrl"   value="{{dataItem}}" show="{{showPopBox}}" routeObjName="{{routeObjName}}"   contentObj="{{popContentBox}}" bind:changeStep="changeStep" bind:commit="editItemsBox" ></dk-popup>
+<dk-popup   type="basic"  title="修改包装数量"  titleCol="skuModel"  iconCol="imagesUrl"   value="{{dataItem}}" show="{{showPopBox}}" routeObjName="{{routeObjName}}"   contentObj="{{popContentBox}}" bind:changeStep="changeStep" bind:commit="editItemsBox" ></dk-popup>

+ 1 - 1
package-base-select/pages/select-goods/select-goods.wxml

@@ -417,7 +417,7 @@
 </dk-popup>
 
 <!-- 箱片 -->
-<dk-popup   type="basic"    titleCol="skuModel"  iconCol="imagesUrl"   value="{{dataItem}}" show="{{showPopBox}}" routeObjName="{{routeObjName}}"   contentObj="{{popContentBox}}" bind:changeStep="changeStep" bind:commit="editItemsBox"></dk-popup>
+<dk-popup   type="basic"  title="修改包装数量"    titleCol="skuModel"  iconCol="imagesUrl"   value="{{dataItem}}" show="{{showPopBox}}" routeObjName="{{routeObjName}}"   contentObj="{{popContentBox}}" bind:changeStep="changeStep" bind:commit="editItemsBox"></dk-popup>
 
 <dk-save-button cssType="sale" model:value="{{btnFormData}}" btnAutoWidthFlag="{{false}}" btnRightFlag="{{true}}" buttonList="{{buttonList}}" contentList="{{contentList}}" bind:open="submit"></dk-save-button>
 

+ 275 - 220
package-basic-data/pages/product-file/add/add.js

@@ -10,6 +10,7 @@ const mixins = require('@/mixins/index.js')
 const app = getApp()
 const util = require('@/utils/util.js')
 const Constants = require('@/utils/Constants')
+import Dialog from '@/dist/dialog/dialog.js';
 Page({
   mixins: [mixins],
   /**
@@ -79,7 +80,7 @@ Page({
           type: 'choose',
           urlKey: 'unit',
           required: true,
-
+          clear:false,
         }, { //辅助单位标识
           type: 'switch',
           title: mixins.$t("subUnitId"),
@@ -103,43 +104,14 @@ Page({
           code: 'calculationFormula',
           type: 'textarea',
           title: mixins.$t("calculationFormula"),
-          readonly:true,
+          readonly: true,
         }
       ],
       warehouse: [{ //期初库存标识
-          type: 'switch',
-          title: mixins.$t("openingInv"),
-          code: 'flgOpeningInv',
-        }, { //仓库名称
-          code: 'whId',
-          name: 'whName',
-          title: mixins.$t("whName"),
-          type: 'choose',
-          urlKey: 'openingInventory',
-          required: true,
-        },
-        { //库存批号
-          code: 'nonStdCode',
-          type: 'textarea',
-          title: mixins.$t("iinventoryBatchNumber"),
-          required: true,
-        },
-        { //期初数量
-          code: 'intoQty',
-          type: 'number',
-          sign: "",
-          digits: 0,
-          title: mixins.$t("openingInventoryQty"),
-          required: true,
-        },
-        { //期初成本价
-          code: 'priceInto',
-          type: 'textarea',
-          title: mixins.$t("iinitialCostPrice"),
-          required: true,
-        },
-
-      ],
+        type: 'switch',
+        title: mixins.$t("openingInv"),
+        code: 'flgOpeningInv',
+      }, ],
       price: [{ //期初库存标识
         type: 'switch',
         title: mixins.$t("flgPrice"),
@@ -185,22 +157,22 @@ Page({
     // 路由
     routeObjName: 'goodsSku',
   },
-    /**
+  /**
    * @desc : dk-form 里 dk-number-input 的输入回调
    * @date : 2024/2/1 15:49
    * @author : 王英杰
    */
-  changeNumberField(e){
-    console.log("changeNumberField",e);
+  changeNumberField(e) {
+    console.log("changeNumberField", e);
     let code = e.detail.code
     let formData = JSON.parse(this.data.formData)
-    if(code = "packBox"){//包装 
-      if(formData.packBox&&formData.unitName&&formData.subUnitName){ //选了辅助计量单位 正好 包装也有值 那么直接给出公式
-        formData.calculationFormula = formData.packBox+ formData.unitName + '= 1'+  formData.subUnitName
+    if (code = "packBox") { //包装 
+      if (formData.packBox && formData.unitName && formData.subUnitName) { //选了辅助计量单位 正好 包装也有值 那么直接给出公式
+        formData.calculationFormula = formData.packBox + formData.unitName + '= 1' + formData.subUnitName
       }
     }
     this.setData({
-      formData:JSON.stringify(formData)
+      formData: JSON.stringify(formData)
     })
   },
   /**
@@ -222,7 +194,7 @@ Page({
             type: 'choose',
             urlKey: 'unit',
             required: true,
-
+            clear:false,
           }, { //辅助单位标识
             type: 'switch',
             title: mixins.$t("subUnitId"),
@@ -247,7 +219,7 @@ Page({
             code: 'calculationFormula',
             type: 'textarea',
             title: mixins.$t("calculationFormula"),
-            readonly:true,
+            readonly: true,
           }
         ]
       } else {
@@ -258,7 +230,7 @@ Page({
           type: 'choose',
           urlKey: 'unit',
           required: true,
-
+          clear:false,
         }, { //辅助单位标识
           type: 'switch',
           title: mixins.$t("subUnitId"),
@@ -268,6 +240,16 @@ Page({
 
     } else if (code == "flgOpeningInv") { //期初库存标识
       if (checkFlag) {
+        let formData = JSON.parse(this.data.formData)
+        //打开期初库存的时候 要先判断 需要先选择基本单位
+        if (!formData.unitId) {
+          formData.flgOpeningInv = false
+          util.showToast('请先选择基本单位');
+          this.setData({
+            formData: JSON.stringify(formData)
+          })
+          return
+        }
         contentObj.warehouse = [{ //期初库存标识
             type: 'switch',
             title: mixins.$t("openingInv"),
@@ -285,18 +267,19 @@ Page({
             type: 'textarea',
             title: mixins.$t("iinventoryBatchNumber"),
             required: checkFlag,
+            tip: mixins.$t('tipPop'),
           },
           { //期初数量
             code: 'intoQty',
             type: 'number',
             sign: "",
-            digits: 0,
+            digits: formData.decimalPlaces,
             title: mixins.$t("openingInventoryQty"),
             required: checkFlag,
           },
           { //期初成本价
             code: 'priceInto',
-            type: 'textarea',
+            type: 'number',
             title: mixins.$t("iinitialCostPrice"),
             required: checkFlag,
           },
@@ -359,13 +342,40 @@ Page({
       contentObj: contentObj
     })
   },
+  onShow() {
+    console.log("onShow");
+    this.dialogShowChooseData();
+  },
+    /**
+   * @desc : 因为chooseData 的执行顺序要高于onshow 且 chooseData无法弹 dialog 所以在onshow执行
+   * @date : 2024/2/1 15:49
+   * @author : 王英杰
+   */
+  dialogShowChooseData(){
+    if(!this.data.handledata){
+      return
+    }
+    this.setData({
+      handledata:false
+    })
+    let formData = JSON.parse(this.data.formData)
+    let data = this.data.chooseUnitData
+    formData.intoQty = null
+    //提示
+    Dialog.confirm({
+      message: '期初数量已输入,更换基础单位需要清空期初数量',
+    }).then(() => {
+      this.handleChooseDataUnit(formData, data)
+    }).catch(() => {});
+  },
   /**
    * @desc : 选择页面跳转回调事件
    * @date : 2024/2/1 15:49
    * @author : 王英杰
    */
   chooseData(e) {
-    console.log("t", e, this.data.formData);
+
+    console.log("chooseData", e, this.data.formData);
     let formData = JSON.parse(this.data.formData)
     let code = e.detail.code
     let data = e.detail.data.data
@@ -378,17 +388,22 @@ Page({
       formData.catName = data.name
     }
     if (code == "unitId") { //计量单位
-      formData.unitId = data.id
-      formData.unitName = data.name
-      if(formData.packBox&&formData.unitName&&formData.subUnitName){ //选了辅助计量单位 正好 包装也有值 那么直接给出公式
-        formData.calculationFormula = formData.packBox+ formData.unitName + '= 1'+  formData.subUnitName
+      //当期初数量有值的时候 弹提示是否清除
+      if (formData.intoQty) { //在onshow执行 这里无法弹出dialog
+        this.setData({
+          chooseUnitData:data,
+          handledata:true
+        })
+      } else {
+        this.handleChooseDataUnit(formData, data)
       }
+
     }
     if (code == "subUnitId") { //辅助计量单位
       formData.subUnitId = data.id
       formData.subUnitName = data.name
-      if(formData.packBox&&formData.unitName&&formData.subUnitName){ //选了辅助计量单位 正好 包装也有值 那么直接给出公式
-        formData.calculationFormula = formData.packBox+ formData.unitName + '= 1'+  formData.subUnitName
+      if (formData.packBox && formData.unitName && formData.subUnitName) { //选了辅助计量单位 正好 包装也有值 那么直接给出公式
+        formData.calculationFormula = formData.packBox + formData.unitName + '= 1' + formData.subUnitName
       }
     }
     if (code == "seriesId") { //商品系列
@@ -404,34 +419,65 @@ Page({
     })
   },
   /**
+   * @desc : 处理 选择页面回来的 基本单位
+   * @date : 2024/2/1 15:49
+   * @author : 王英杰
+   */
+  handleChooseDataUnit(formData, data) {
+    formData.unitId = data.id
+    formData.unitName = data.name
+    formData.decimalPlaces = data.decimalPlaces
+    if (formData.packBox && formData.unitName && formData.subUnitName) { //选了辅助计量单位 正好 包装也有值 那么直接给出公式
+      formData.calculationFormula = formData.packBox + formData.unitName + '= 1' + formData.subUnitName
+    }
+    let contentObj = this.data.contentObj
+    if (contentObj.warehouse.length > 0) {
+      // 遍历 contentObj.warehouse 数组  
+      for (let i = 0; i < contentObj.warehouse.length; i++) {
+        // 检查当前对象的 code 是否为 'intoQty'  
+        if (contentObj.warehouse[i].code === 'intoQty') {
+          // 如果是,则修改其 digits 属性  
+          contentObj.warehouse[i].digits = formData.decimalPlaces;
+          // 找到后,可以跳出循环(如果确定只有一个匹配项)  
+          break;
+        }
+      }
+    }
+    this.setData({
+      contentObj: contentObj,
+      formData: JSON.stringify(formData)
+    })
+    return
+  },
+  /**
    * @desc : 保存数据服务--校验
    * @date : 2024/2/1 15:49
    * @author : 王英杰
    */
   validData() {
     let formData = JSON.parse(this.data.formData)
-    if(!formData.flgSubUnit){//辅助单位标识未勾选 不存包装单位 包装
-     delete formData.subUnitId
-     delete formData.subUnitName
-     delete formData.packBox
+    if (!formData.flgSubUnit) { //辅助单位标识未勾选 不存包装单位 包装
+      delete formData.subUnitId
+      delete formData.subUnitName
+      delete formData.packBox
     }
     //编辑的时候 就不用删除了  因为不允许修改
-    if((!formData.flgOpeningInv)&&this.data.formMode !== Constants.formMode.edit){//期初库存标识未勾选 不存仓库名称 色号 起初数量 期初成本价
+    if ((!formData.flgOpeningInv) && this.data.formMode !== Constants.formMode.edit) { //期初库存标识未勾选 不存仓库名称 色号 起初数量 期初成本价
       delete formData.whId
       delete formData.whName
       delete formData.nonStdCode
       delete formData.priceInto
-     }
-     if(!formData.flgPrice){//价格体系标识未勾选 不存采购价 零售价 批发价 销售限价 其他价
+    }
+    if (!formData.flgPrice) { //价格体系标识未勾选 不存采购价 零售价 批发价 销售限价 其他价
       delete formData.pricePurchase
       delete formData.priceStandard
       delete formData.priceWholesale
       delete formData.priceLimited
       delete formData.priceOther
-     }
-     this.setData({
-      formData:JSON.stringify(formData)
-     })
+    }
+    this.setData({
+      formData: JSON.stringify(formData)
+    })
     return true
   },
   // 设置保存参数
@@ -461,6 +507,9 @@ Page({
         // 增加包装;数字类型正整数,默认1
         let formData = {}
         formData.packBox = 1
+        formData.flgPrice = true
+        formData.flgOpeningInv = false
+        formData.flgSubUnit = true
         that.setData({
           formData: JSON.stringify(formData)
         })
@@ -494,6 +543,7 @@ Page({
    * @author : 王英杰
    */
   loadInit() {
+
     //标准版商品档案新建、编辑、详情不展示价格体系  
     if (this.data.gradeCode == Constants.gradeCode.STD) { //标准版
       this.setData({
@@ -513,7 +563,7 @@ Page({
       let formData = JSON.parse(this.data.formData)
       formData.packBox = 1
       formData.flgPrice = true
-      formData.flgOpeningInv = true
+      formData.flgOpeningInv = false
       formData.flgSubUnit = true
       this.setData({
         formData: JSON.stringify(formData)
@@ -532,181 +582,186 @@ Page({
     // data.serviceCategories = (data.serviceCategories && data.serviceCategories.length > 0) ? data.serviceCategories.join(',') : undefined
     data.annexPaths = data.skuImages
     data.onlyCode = data.skuCode
+    data.isflgOpeningInv = false //因为期初库存编辑的时候不让改 所以 即使数据库是true 那么也要置灰 取这个code
+    data.isflgOpeningInv = false //  库存量不为0不让更改 辅助单位取这个code
     let contentObj = this.data.contentObj
     // 我们要添加的新对象是  编码  新建的时候没有 编辑的时候添加 
     contentObj.main = [{ //唯一编码
-          code: 'onlyCode',
-          type: 'textarea',
-          title: mixins.$t("onlyCode"),
-          readonly: true
-        }, { //商品型号
-          code: 'skuModel',
-          type: 'textarea',
-          title: mixins.$t("skuModel"),
-          required: true,
-        }, { //商品名称
-          code: 'skuName',
-          type: 'textarea',
-          title: mixins.$t("skuName"),
-        }, {
-          code: 'skuImages',
-          name: mixins.$t("commodityPicture"), //商品图片
-          type: 'uploader',
-        },
+        code: 'onlyCode',
+        type: 'textarea',
+        title: mixins.$t("onlyCode"),
+        readonly: true
+      }, { //商品型号
+        code: 'skuModel',
+        type: 'textarea',
+        title: mixins.$t("skuModel"),
+        required: true,
+      }, { //商品名称
+        code: 'skuName',
+        type: 'textarea',
+        title: mixins.$t("skuName"),
+      }, {
+        code: 'skuImages',
+        name: mixins.$t("commodityPicture"), //商品图片
+        type: 'uploader',
+      },
 
-      ] 
-      if (data.flgSubUnit) {
-        contentObj.unit = [{ //基本单位
-            code: 'unitId',
-            name: 'unitName',
-            title: mixins.$t("unit"),
-            type: 'choose',
-            urlKey: 'unit',
-            required: true,
-           readonly: data.inventoryCount!==0 //要校验库存;  库存量不为0不让更改 
-          }, { //辅助单位标识
-            type: 'switch',
-            title: mixins.$t("subUnitId"),
-            code: 'flgSubUnit',
-            readonly: data.inventoryCount!==0 //要校验库存;  库存量不为0不让更改 
-          }, { //包装单位
-            code: 'subUnitId',
-            name: 'subUnitName',
-            title: mixins.$t("packageUnit"),
-            type: 'choose',
-            urlKey: 'unit',
-            required: true,
-            readonly: data.inventoryCount!==0 //要校验库存;  库存量不为0不让更改 
-          }, { //包装
-            code: 'packBox',
-            title: mixins.$t("package"),
-            type: 'number',
-            sign: "",
-            digits: 0,
-            required: true,
-          },
-          {
-            code: 'calculationFormula',
-            type: 'textarea',
-            title: mixins.$t("calculationFormula"),
-            readonly:true,
-          }
-        ]
-      } else {
-        contentObj.unit = [{ //基本单位
+    ]
+    if (data.flgSubUnit) {
+      contentObj.unit = [{ //基本单位
           code: 'unitId',
           name: 'unitName',
           title: mixins.$t("unit"),
           type: 'choose',
           urlKey: 'unit',
           required: true,
-
+          readonly: data.inventoryCount !== 0 //要校验库存;  库存量不为0不让更改 
         }, { //辅助单位标识
           type: 'switch',
           title: mixins.$t("subUnitId"),
-          code: 'flgSubUnit',
-        }, ]
-      }
-      if (data.flgOpeningInv) {
-        contentObj.warehouse = [{ //期初库存标识
-            type: 'switch',
-            title: mixins.$t("openingInv"),
-            code: 'flgOpeningInv',
-          }, { //仓库名称
-            code: 'whId',
-            name: 'whName',
-            title: mixins.$t("whName"),
-            type: 'choose',
-            urlKey: 'openingInventory',
-            required: true,
-            readonly:true,
-          },
-          { //库存批号
-            code: 'nonStdCode',
-            type: 'textarea',
-            title: mixins.$t("iinventoryBatchNumber"),
-            required: true,
-            readonly:true,
-          },
-          { //期初数量
-            code: 'intoQty',
-            type: 'number',
-            sign: "",
-            digits: 0,
-            title: mixins.$t("openingInventoryQty"),
-            required: true,
-            readonly:true,
-          },
-          { //期初成本价
-            code: 'priceInto',
-            type: 'textarea',
-            title: mixins.$t("iinitialCostPrice"),
-            required: true,
-            readonly:true,
-          },
-        ]
-      } else {
-        contentObj.warehouse = [{ //期初库存标识
-          type: 'switch',
-          title: mixins.$t("openingInv"),
-          code: 'flgOpeningInv',
-        }, ]
-      }
-      if (data.flgPrice) {
-        contentObj.price = [{ //期初库存标识
-          type: 'switch',
-          title: mixins.$t("flgPrice"),
-          code: 'flgPrice',
-        }, { //采购价
-          tip: mixins.$t("purchasePricetip"),
-          code: 'pricePurchase',
-          type: 'number',
-          title: mixins.$t("purchasePrice"),
+          code: (data.inventoryCount !== 0) ? 'isflgOpeningInv' : 'flgSubUnit',
+          readonly: data.inventoryCount !== 0 //要校验库存;  库存量不为0不让更改 
+        }, { //包装单位
+          code: 'subUnitId',
+          name: 'subUnitName',
+          title: mixins.$t("packageUnit"),
+          type: 'choose',
+          urlKey: 'unit',
           required: true,
-        }, { //零售价
-          tip: mixins.$t("retailPricetip"),
-          code: 'priceStandard',
+          readonly: data.inventoryCount !== 0 //要校验库存;  库存量不为0不让更改 
+        }, { //包装
+          code: 'packBox',
+          title: mixins.$t("package"),
           type: 'number',
-          title: mixins.$t("retailPrice"),
+          sign: "",
+          digits: 0,
           required: true,
-        }, { //批发价
-          tip: mixins.$t("wholesalePricetip"),
-          code: 'priceWholesale',
-          type: 'number',
-          title: mixins.$t("wholesalePrice"),
+        },
+        {
+          code: 'calculationFormula',
+          type: 'textarea',
+          title: mixins.$t("calculationFormula"),
+          readonly: true,
+        }
+      ]
+    } else {
+      contentObj.unit = [{ //基本单位
+        code: 'unitId',
+        name: 'unitName',
+        title: mixins.$t("unit"),
+        type: 'choose',
+        urlKey: 'unit',
+        required: true,
+
+      }, { //辅助单位标识
+        type: 'switch',
+        title: mixins.$t("subUnitId"),
+        code: 'flgSubUnit',
+      }, ]
+    }
+    if (data.flgOpeningInv) {
+      contentObj.warehouse = [{ //期初库存标识
+          type: 'switch',
+          title: mixins.$t("openingInv"),
+          code: 'isflgOpeningInv',
+          readonly: true,
+        }, { //仓库名称
+          code: 'whId',
+          name: 'whName',
+          title: mixins.$t("whName"),
+          type: 'choose',
+          urlKey: 'openingInventory',
           required: true,
-        }, { //销售限价
-          tip: mixins.$t("SaleSPriceLimittip"),
-          code: 'priceLimited',
+          readonly: true,
+        },
+        { //库存批号
+          code: 'nonStdCode',
+          type: 'textarea',
+          title: mixins.$t("iinventoryBatchNumber"),
+          required: true,
+          readonly: true,
+          tip: mixins.$t('tipPop'),
+        },
+        { //期初数量
+          code: 'intoQty',
           type: 'number',
-          title: mixins.$t("SaleSPriceLimit"),
+          sign: "",
+          digits: 0,
+          title: mixins.$t("openingInventoryQty"),
           required: true,
-        }, { //其他价
-          tip: mixins.$t("otherPriceLimittip"),
-          code: 'priceOther',
+          readonly: true,
+        },
+        { //期初成本价
+          code: 'priceInto',
           type: 'number',
-          title: mixins.$t("otherPriceLimit"),
+          title: mixins.$t("iinitialCostPrice"),
           required: true,
-        }, ]
-      } else {
-        contentObj.price = [{ //期初库存标识
-          type: 'switch',
-          title: mixins.$t("flgPrice"),
-          code: 'flgPrice',
-        }, ]
-      }
-      if(data.packBox&&data.unitName&&data.subUnitName){ //选了辅助计量单位 正好 包装也有值 那么直接给出公式
-        data.calculationFormula = data.packBox+ data.unitName + '= 1'+  data.subUnitName
-      }
-  
-      this.setData({
-        contentObj: contentObj,
-        formData: JSON.stringify(data),
-        buttonList: [{
-          name: 'merge',
-          title: mixins.$t("save"), //'保存'
-        }],
-      })
+          readonly: true,
+        },
+      ]
+    } else {
+      contentObj.warehouse = [{ //期初库存标识
+        type: 'switch',
+        title: mixins.$t("openingInv"),
+        code: 'isflgOpeningInv',
+        readonly: true,
+      }, ]
+    }
+    if (data.flgPrice) {
+      contentObj.price = [{ //期初库存标识
+        type: 'switch',
+        title: mixins.$t("flgPrice"),
+        code: 'flgPrice',
+      }, { //采购价
+        tip: mixins.$t("purchasePricetip"),
+        code: 'pricePurchase',
+        type: 'number',
+        title: mixins.$t("purchasePrice"),
+        required: true,
+      }, { //零售价
+        tip: mixins.$t("retailPricetip"),
+        code: 'priceStandard',
+        type: 'number',
+        title: mixins.$t("retailPrice"),
+        required: true,
+      }, { //批发价
+        tip: mixins.$t("wholesalePricetip"),
+        code: 'priceWholesale',
+        type: 'number',
+        title: mixins.$t("wholesalePrice"),
+        required: true,
+      }, { //销售限价
+        tip: mixins.$t("SaleSPriceLimittip"),
+        code: 'priceLimited',
+        type: 'number',
+        title: mixins.$t("SaleSPriceLimit"),
+        required: true,
+      }, { //其他价
+        tip: mixins.$t("otherPriceLimittip"),
+        code: 'priceOther',
+        type: 'number',
+        title: mixins.$t("otherPriceLimit"),
+        required: true,
+      }, ]
+    } else {
+      contentObj.price = [{ //期初库存标识
+        type: 'switch',
+        title: mixins.$t("flgPrice"),
+        code: 'flgPrice',
+      }, ]
+    }
+    if (data.packBox && data.unitName && data.subUnitName) { //选了辅助计量单位 正好 包装也有值 那么直接给出公式
+      data.calculationFormula = data.packBox + data.unitName + '= 1' + data.subUnitName
+    }
+
+    this.setData({
+      contentObj: contentObj,
+      formData: JSON.stringify(data),
+      buttonList: [{
+        name: 'merge',
+        title: mixins.$t("save"), //'保存'
+      }],
+    })
 
   },
 })

+ 1 - 1
package-basic-data/pages/product-file/add/add.wxml

@@ -1,6 +1,6 @@
 <!-- 前台导入wxmlUtil.wxs -->
 <wxs src='/utils/wxmlUtil.wxs' module="wxmlUtil"></wxs>
-
+<van-dialog id="van-dialog" />
 <loading wx:if="{{loading}}" ></loading>
  
 <dk-form id="{{formName}}" routeObjName="{{routeObjName}}"  cardList="{{cardList}}" contentObj="{{contentObj}}"  table="{{table}}" bind:onSwitchChange = "onSwitchChange" bind:changeNumberField = "changeNumberField"

+ 1 - 1
package-basic-data/pages/product-file/metering-unit/metering-unit.js

@@ -48,7 +48,7 @@ Page({
         tableData: tableData
       })
       const eventChannel = this.getOpenerEventChannel(); 
-      eventChannel.emit('bindData', { data: {id:item.unitId,name:item.unitName} })
+      eventChannel.emit('bindData', { data: {id:item.unitId,name:item.unitName,decimalPlaces:item.decimalPlaces} })
       wx.navigateBack({
         delta: 1
       }) 

+ 2 - 2
package-sales/pages/order-return/add/add.js

@@ -50,7 +50,7 @@ Page({
       ],
       other: [
         { code: 'contractNo', type: 'textarea', title: mixins.$t("contractNumber"), readonly: false },
-        { code: 'deliveryDate', type: 'date', required: false, title: mixins.$t("delivery_Time"), required: true },
+  
         { code: 'remarks', type: 'textarea', title: mixins.$t("remarks"), readonly: false },
         { code: 'file', type: 'uploader', title: mixins.$t("uploader") }
       ]
@@ -527,7 +527,7 @@ Page({
     }],
       contentObj.other = [
         { code: 'contractNo', type: 'str', readonly: true, required: false, title: mixins.$t('contractNumber') },
-        { code: 'deliveryDate', type: 'str', readonly: true, required: false, title: mixins.$t('delivery_Time') },
+ 
         { code: 'remarks', type: 'str', readonly: true, required: false, title: mixins.$t('remarks') },
         { code: 'file', type: 'uploader', title: mixins.$t("uploader") }
       ]