|
|
@@ -154,10 +154,79 @@ Page({
|
|
|
title: mixins.$t("remarks"),
|
|
|
}]
|
|
|
},
|
|
|
+ popContentBox: [],
|
|
|
// 路由
|
|
|
routeObjName: 'goodsSku',
|
|
|
},
|
|
|
/**
|
|
|
+ * @desc : 数量改变事件
|
|
|
+ * @date : 2024/2/1 15:49
|
|
|
+ * @author : 王英杰
|
|
|
+ */
|
|
|
+ changeStep(e) {
|
|
|
+ let key = e.detail.key
|
|
|
+ let value = e.detail.value
|
|
|
+ let dataItem = JSON.parse(this.data.dataItem)
|
|
|
+ dataItem[key] = value
|
|
|
+ this.setData({
|
|
|
+ dataItem: JSON.stringify(dataItem)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : dk-form 里 str的点击回调 的输入回调
|
|
|
+ * @date : 2024/2/1 15:49
|
|
|
+ * @author : 王英杰
|
|
|
+ */
|
|
|
+ openStr(e) {
|
|
|
+ console.log("openStr", e);
|
|
|
+ let code = e.detail.code
|
|
|
+ if (code == "packageBox") { //点击包装数量
|
|
|
+ let formData = JSON.parse(this.data.formData)
|
|
|
+ if (formData.unitId && formData.subUnitId && formData.packBox) {
|
|
|
+ let dataItem = this.data.dataItem ? JSON.parse(this.data.dataItem) : {}
|
|
|
+ dataItem['box'] = formData.box || 0
|
|
|
+ dataItem['piece'] = formData.piece || 0
|
|
|
+ dataItem.packageBox = formData.packageBox
|
|
|
+ let popContentBox = [{
|
|
|
+ code: 'box',
|
|
|
+ type: 'step',
|
|
|
+ title: formData.subUnitName,
|
|
|
+ required: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: 'piece',
|
|
|
+ type: 'step',
|
|
|
+ title: formData.unitName,
|
|
|
+ required: true
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ this.setData({
|
|
|
+ showPopBox: true,
|
|
|
+ dataItem: JSON.stringify(dataItem),
|
|
|
+ popContentBox: popContentBox
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ util.showToast('请先输入基本单位、包装单位、包装');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 商品确认事件--箱片的确认
|
|
|
+ * @date : 2024/2/1 15:49
|
|
|
+ * @author : 王英杰
|
|
|
+ */
|
|
|
+ editItemsBox(e) {
|
|
|
+ let dataItem = JSON.parse(this.data.dataItem)
|
|
|
+ let formData = JSON.parse(this.data.formData)
|
|
|
+ formData['box'] = dataItem['box']
|
|
|
+ formData['piece'] = dataItem['piece']
|
|
|
+ formData['intoQty'] = Number(dataItem['box']) * Number(formData['packBox']) + Number(dataItem['piece'])
|
|
|
+ formData.packageBox = dataItem['box'] + formData.subUnitName + dataItem['piece'] + formData.unitName
|
|
|
+ this.setData({
|
|
|
+ formData: JSON.stringify(formData)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
* @desc : dk-form 里 dk-number-input 的输入回调
|
|
|
* @date : 2024/2/1 15:49
|
|
|
* @author : 王英杰
|
|
|
@@ -166,10 +235,49 @@ Page({
|
|
|
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.intoQty || formData.packageBox) {
|
|
|
+ //提示
|
|
|
+ Dialog.confirm({
|
|
|
+ message: '修改包装将清空期初数量、包装数量',
|
|
|
+ }).then(() => {
|
|
|
+ formData.intoQty = null
|
|
|
+ formData.packageBox = null
|
|
|
+ formData.box = null
|
|
|
+ formData.piece = null
|
|
|
+ formData["packBox_"] = formData["packBox"]
|
|
|
+ if (formData.packBox && formData.unitName && formData.subUnitName) { //选了辅助计量单位 正好 包装也有值 那么直接给出公式
|
|
|
+ formData.calculationFormula = formData.packBox + formData.unitName + '= 1' + formData.subUnitName
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ formData: JSON.stringify(formData)
|
|
|
+ })
|
|
|
+
|
|
|
+ }).catch(() => {
|
|
|
+ formData["packBox"] = formData["packBox_"]
|
|
|
+ this.setData({
|
|
|
+ formData: JSON.stringify(formData)
|
|
|
+ })
|
|
|
+ });
|
|
|
+
|
|
|
+ } else {
|
|
|
+ if (formData.packBox && formData.unitName && formData.subUnitName) { //选了辅助计量单位 正好 包装也有值 那么直接给出公式
|
|
|
+ formData.calculationFormula = formData.packBox + formData.unitName + '= 1' + formData.subUnitName
|
|
|
+ }
|
|
|
+ formData["packBox_"] = formData["packBox"]
|
|
|
}
|
|
|
+
|
|
|
+ }
|
|
|
+ if (code == "intoQty" && formData.flgSubUnit) { //期初数量
|
|
|
+ if (formData.unitId && formData.subUnitId && formData.packBox) {
|
|
|
+ formData['box'] = parseInt(formData['intoQty'] / formData['packBox'])
|
|
|
+ formData['piece'] = parseFloat(Number(formData['intoQty'] % formData['packBox']).toFixed(formData.decimalPlaces));
|
|
|
+ formData.packageBox = formData['box'] + formData.subUnitName + formData['piece'] + formData.unitName
|
|
|
+ } else {
|
|
|
+ formData['intoQty'] = undefined
|
|
|
+ util.showToast('请先输入基本单位、包装单位、包装');
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
this.setData({
|
|
|
formData: JSON.stringify(formData)
|
|
|
@@ -185,6 +293,7 @@ Page({
|
|
|
let code = e.detail.code
|
|
|
let checkFlag = !e.detail.checkFlag
|
|
|
let contentObj = this.data.contentObj
|
|
|
+ let formData = JSON.stringify(this.data.formData)
|
|
|
if (code == "flgSubUnit") { //辅助单位
|
|
|
if (checkFlag) {
|
|
|
let formData = JSON.parse(this.data.formData)
|
|
|
@@ -232,6 +341,47 @@ Page({
|
|
|
readonly: true,
|
|
|
}
|
|
|
]
|
|
|
+ contentObj.warehouse = [{ //期初库存标识
|
|
|
+ type: 'switch',
|
|
|
+ title: mixins.$t("openingInv"),
|
|
|
+ code: 'flgOpeningInv',
|
|
|
+ }, { //仓库名称
|
|
|
+ code: 'whId',
|
|
|
+ name: 'whName',
|
|
|
+ title: mixins.$t("whName"),
|
|
|
+ type: 'choose',
|
|
|
+ urlKey: 'openingInventory',
|
|
|
+ required: checkFlag,
|
|
|
+ },
|
|
|
+ { //库存批号
|
|
|
+ code: 'nonStdCode',
|
|
|
+ type: 'textarea',
|
|
|
+ title: mixins.$t("iinventoryBatchNumber"),
|
|
|
+ required: checkFlag,
|
|
|
+ tip: mixins.$t('tipPop'),
|
|
|
+ },
|
|
|
+ { //期初数量
|
|
|
+ code: 'intoQty',
|
|
|
+ type: 'number',
|
|
|
+ sign: "",
|
|
|
+ digits: formData.decimalPlaces,
|
|
|
+ title: mixins.$t("openingInventoryQty"),
|
|
|
+ required: checkFlag,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: 'packageBox',
|
|
|
+ type: 'str',
|
|
|
+ title: mixins.$t("packageBox"),
|
|
|
+ required: checkFlag,
|
|
|
+ readonly: true,
|
|
|
+ },
|
|
|
+ { //期初成本价
|
|
|
+ code: 'priceInto',
|
|
|
+ type: 'number',
|
|
|
+ title: mixins.$t("iinitialCostPrice"),
|
|
|
+ required: checkFlag,
|
|
|
+ },
|
|
|
+ ]
|
|
|
} else {
|
|
|
contentObj.unit = [{ //基本单位
|
|
|
code: 'unitId',
|
|
|
@@ -246,20 +396,6 @@ Page({
|
|
|
title: mixins.$t("subUnitId"),
|
|
|
code: 'flgSubUnit',
|
|
|
}, ]
|
|
|
- }
|
|
|
-
|
|
|
- } 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"),
|
|
|
@@ -294,6 +430,99 @@ Page({
|
|
|
required: checkFlag,
|
|
|
},
|
|
|
]
|
|
|
+ }
|
|
|
+
|
|
|
+ } 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
|
|
|
+ }
|
|
|
+ if (formData.flgSubUnit) { //开了辅助单位
|
|
|
+ contentObj.warehouse = [{ //期初库存标识
|
|
|
+ type: 'switch',
|
|
|
+ title: mixins.$t("openingInv"),
|
|
|
+ code: 'flgOpeningInv',
|
|
|
+ }, { //仓库名称
|
|
|
+ code: 'whId',
|
|
|
+ name: 'whName',
|
|
|
+ title: mixins.$t("whName"),
|
|
|
+ type: 'choose',
|
|
|
+ urlKey: 'openingInventory',
|
|
|
+ required: checkFlag,
|
|
|
+ },
|
|
|
+ { //库存批号
|
|
|
+ code: 'nonStdCode',
|
|
|
+ type: 'textarea',
|
|
|
+ title: mixins.$t("iinventoryBatchNumber"),
|
|
|
+ required: checkFlag,
|
|
|
+ tip: mixins.$t('tipPop'),
|
|
|
+ },
|
|
|
+ { //期初数量
|
|
|
+ code: 'intoQty',
|
|
|
+ type: 'number',
|
|
|
+ sign: "",
|
|
|
+ digits: formData.decimalPlaces,
|
|
|
+ title: mixins.$t("openingInventoryQty"),
|
|
|
+ required: checkFlag,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: 'packageBox',
|
|
|
+ type: 'str',
|
|
|
+ title: mixins.$t("packageBox"),
|
|
|
+ required: checkFlag,
|
|
|
+ readonly: true,
|
|
|
+ },
|
|
|
+ { //期初成本价
|
|
|
+ code: 'priceInto',
|
|
|
+ type: 'number',
|
|
|
+ title: mixins.$t("iinitialCostPrice"),
|
|
|
+ required: checkFlag,
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ } else { //没开辅助单位
|
|
|
+ contentObj.warehouse = [{ //期初库存标识
|
|
|
+ type: 'switch',
|
|
|
+ title: mixins.$t("openingInv"),
|
|
|
+ code: 'flgOpeningInv',
|
|
|
+ }, { //仓库名称
|
|
|
+ code: 'whId',
|
|
|
+ name: 'whName',
|
|
|
+ title: mixins.$t("whName"),
|
|
|
+ type: 'choose',
|
|
|
+ urlKey: 'openingInventory',
|
|
|
+ required: checkFlag,
|
|
|
+ },
|
|
|
+ { //库存批号
|
|
|
+ code: 'nonStdCode',
|
|
|
+ type: 'textarea',
|
|
|
+ title: mixins.$t("iinventoryBatchNumber"),
|
|
|
+ required: checkFlag,
|
|
|
+ tip: mixins.$t('tipPop'),
|
|
|
+ },
|
|
|
+ { //期初数量
|
|
|
+ code: 'intoQty',
|
|
|
+ type: 'number',
|
|
|
+ sign: "",
|
|
|
+ digits: formData.decimalPlaces,
|
|
|
+ title: mixins.$t("openingInventoryQty"),
|
|
|
+ required: checkFlag,
|
|
|
+ },
|
|
|
+ { //期初成本价
|
|
|
+ code: 'priceInto',
|
|
|
+ type: 'number',
|
|
|
+ title: mixins.$t("iinitialCostPrice"),
|
|
|
+ required: checkFlag,
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
contentObj.warehouse = [{ //期初库存标识
|
|
|
type: 'switch',
|
|
|
@@ -370,18 +599,34 @@ Page({
|
|
|
handledata: false
|
|
|
})
|
|
|
let formData = JSON.parse(this.data.formData)
|
|
|
- let data = this.data.chooseUnitData
|
|
|
- formData.intoQty = null
|
|
|
- formData.packBox = null
|
|
|
- formData.subUnitId = null
|
|
|
- formData.subUnitName = null
|
|
|
- // 当重新选择基本单位后清空公式 刘尧 2024.5.30
|
|
|
- formData.calculationFormula = null
|
|
|
+ let data = this.data.chooseUnitData
|
|
|
+ let Dialog_message = null
|
|
|
+ let code = this.data.chooseDataCode
|
|
|
+ if (code == "unitId") { //计量单位
|
|
|
+ formData.intoQty = null
|
|
|
+ formData.packBox = null
|
|
|
+ formData.subUnitId = null
|
|
|
+ formData.subUnitName = null
|
|
|
+ formData.packageBox = null
|
|
|
+ formData.box = null
|
|
|
+ formData.piece = null
|
|
|
+ // 当重新选择基本单位后清空公式 刘尧 2024.5.30
|
|
|
+ formData.calculationFormula = null
|
|
|
+ Dialog_message = '更换基础单位将清空包装单位、期初数量、包装、包装数量'
|
|
|
+ }
|
|
|
+ if (code == "subUnitId") { //包装单位
|
|
|
+ formData.intoQty = null
|
|
|
+ formData.packageBox = null
|
|
|
+ formData.box = null
|
|
|
+ formData.piece = null
|
|
|
+ Dialog_message = '更换包装单位将清空期初数量、包装数量'
|
|
|
+ }
|
|
|
+
|
|
|
//提示
|
|
|
Dialog.confirm({
|
|
|
- message: '更换基础单位将清空包装单位,期初数量,包装数量',
|
|
|
+ message: Dialog_message,
|
|
|
}).then(() => {
|
|
|
- this.handleChooseDataUnit(formData, data)
|
|
|
+ this.handleChooseDataUnit(formData, data, code)
|
|
|
}).catch(() => {});
|
|
|
},
|
|
|
/**
|
|
|
@@ -404,27 +649,34 @@ Page({
|
|
|
formData.catName = data.name
|
|
|
}
|
|
|
if (code == "unitId") { //计量单位
|
|
|
- //当期初数量有值的时候 弹提示是否清除
|
|
|
-
|
|
|
- if (formData.intoQty || formData.packBox || formData.subUnitId) { //在onshow执行 这里无法弹出dialog
|
|
|
+ //当期初数量有值的时候 弹提示是否清除
|
|
|
+ if (formData.intoQty || formData.packBox || formData.subUnitId || formData.packageBox) { //在onshow执行 这里无法弹出dialog
|
|
|
this.setData({
|
|
|
chooseUnitData: data,
|
|
|
- handledata: true
|
|
|
+ handledata: true,
|
|
|
+ chooseDataCode: code
|
|
|
})
|
|
|
} else {
|
|
|
- this.handleChooseDataUnit(formData, data)
|
|
|
+ this.handleChooseDataUnit(formData, data, code)
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (code == "subUnitId") { //辅助计量单位
|
|
|
- if (data.id == formData.unitId) {
|
|
|
+ if (data.id == formData.unitId) {
|
|
|
setTimeout(() => {
|
|
|
util.showToast('包装单位不能等于基本单位');
|
|
|
}, 1000)
|
|
|
return
|
|
|
}
|
|
|
- formData.subUnitId = data.id
|
|
|
- formData.subUnitName = data.name
|
|
|
+ if (formData.intoQty || formData.packageBox) { //在onshow执行 这里无法弹出dialog
|
|
|
+ this.setData({
|
|
|
+ chooseUnitData: data,
|
|
|
+ handledata: true,
|
|
|
+ chooseDataCode: code
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.handleChooseDataUnit(formData, data, code)
|
|
|
+ }
|
|
|
if (formData.packBox && formData.unitName && formData.subUnitName) { //选了辅助计量单位 正好 包装也有值 那么直接给出公式
|
|
|
formData.calculationFormula = formData.packBox + formData.unitName + '= 1' + formData.subUnitName
|
|
|
}
|
|
|
@@ -446,47 +698,60 @@ Page({
|
|
|
* @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;
|
|
|
- contentObj.warehouse[i].readonly = false;
|
|
|
- // 找到后,可以跳出循环(如果确定只有一个匹配项)
|
|
|
- break;
|
|
|
- }
|
|
|
+ handleChooseDataUnit(formData, data, code) {
|
|
|
+ if (code == "unitId") {
|
|
|
+ formData.unitId = data.id
|
|
|
+ formData.unitName = data.name
|
|
|
+ formData.decimalPlaces = data.decimalPlaces
|
|
|
+ let dataItem = this.data.dataItem ? JSON.parse(this.data.dataItem) : {}
|
|
|
+ dataItem.decimalPlaces = data.decimalPlaces
|
|
|
+ if (formData.packBox && formData.unitName && formData.subUnitName) { //选了辅助计量单位 正好 包装也有值 那么直接给出公式
|
|
|
+ formData.calculationFormula = formData.packBox + formData.unitName + '= 1' + formData.subUnitName
|
|
|
}
|
|
|
- }
|
|
|
- if (contentObj.unit.length > 0) {
|
|
|
- // 遍历 contentObj.unit 数组
|
|
|
- for (let i = 0; i < contentObj.unit.length; i++) {
|
|
|
- // 检查当前对象的 code 是否为 'packBox'
|
|
|
- if (contentObj.unit[i].code === 'packBox') { //包装
|
|
|
- // 如果是,则修改其 digits 属性
|
|
|
- contentObj.unit[i].digits = formData.decimalPlaces;
|
|
|
- contentObj.unit[i].readonly = false;
|
|
|
- continue
|
|
|
+ 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;
|
|
|
+ contentObj.warehouse[i].readonly = false;
|
|
|
+ // 找到后,可以跳出循环(如果确定只有一个匹配项)
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- if (contentObj.unit[i].code === 'subUnitId') { //包装单位
|
|
|
- contentObj.unit[i].readonly = false;
|
|
|
- continue
|
|
|
+ }
|
|
|
+ if (contentObj.unit.length > 0) {
|
|
|
+ // 遍历 contentObj.unit 数组
|
|
|
+ for (let i = 0; i < contentObj.unit.length; i++) {
|
|
|
+ // 检查当前对象的 code 是否为 'packBox'
|
|
|
+ if (contentObj.unit[i].code === 'packBox') { //包装
|
|
|
+ // 如果是,则修改其 digits 属性
|
|
|
+ contentObj.unit[i].digits = formData.decimalPlaces;
|
|
|
+ contentObj.unit[i].readonly = false;
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if (contentObj.unit[i].code === 'subUnitId') { //包装单位
|
|
|
+ contentObj.unit[i].readonly = false;
|
|
|
+ continue
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ this.setData({
|
|
|
+ contentObj: contentObj,
|
|
|
+ formData: JSON.stringify(formData),
|
|
|
+ dataItem: JSON.stringify(dataItem)
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ if (code == "subUnitId") {
|
|
|
+ formData.subUnitId = data.id
|
|
|
+ formData.subUnitName = data.name
|
|
|
+ this.setData({
|
|
|
+ formData: JSON.stringify(formData),
|
|
|
+ })
|
|
|
}
|
|
|
- this.setData({
|
|
|
- contentObj: contentObj,
|
|
|
- formData: JSON.stringify(formData)
|
|
|
- })
|
|
|
return
|
|
|
},
|
|
|
/**
|
|
|
@@ -784,7 +1049,7 @@ Page({
|
|
|
// data.serviceCategories = (data.serviceCategories && data.serviceCategories.length > 0) ? data.serviceCategories.join(',') : undefined
|
|
|
data.annexPaths = data.skuImages
|
|
|
data.onlyCode = data.skuCode
|
|
|
-
|
|
|
+
|
|
|
let contentObj = this.data.contentObj
|
|
|
// 我们要添加的新对象是 编码 新建的时候没有 编辑的时候添加
|
|
|
contentObj.main = [{ //唯一编码
|
|
|
@@ -809,89 +1074,89 @@ Page({
|
|
|
|
|
|
]
|
|
|
if (data.flgSubUnit) {
|
|
|
- if(data.inventoryCount !== 0){
|
|
|
+ if (data.inventoryCount !== 0) {
|
|
|
contentObj.unit = [{
|
|
|
- text: '本商品有库存,不可更改单位模块;需全部出库后才可更改',
|
|
|
- type: 'text',
|
|
|
- },{ //基本单位
|
|
|
- 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',
|
|
|
- disabled:(data.inventoryCount !== 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,
|
|
|
- readonly: data.inventoryCount !== 0
|
|
|
- },
|
|
|
- {
|
|
|
- code: 'calculationFormula',
|
|
|
- type: 'textarea',
|
|
|
- title: mixins.$t("calculationFormula"),
|
|
|
- readonly: true,
|
|
|
- }
|
|
|
- ]
|
|
|
- }else{ //没库存
|
|
|
+ text: '本商品有库存,不可更改单位模块;需全部出库后才可更改',
|
|
|
+ type: 'text',
|
|
|
+ }, { //基本单位
|
|
|
+ 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',
|
|
|
+ disabled: (data.inventoryCount !== 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,
|
|
|
+ readonly: data.inventoryCount !== 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ 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,
|
|
|
- readonly: data.inventoryCount !== 0 //要校验库存; 库存量不为0不让更改
|
|
|
- }, { //辅助单位标识
|
|
|
- type: 'switch',
|
|
|
- title: mixins.$t("subUnitId"),
|
|
|
- code: 'flgSubUnit',
|
|
|
- disabled:(data.inventoryCount !== 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,
|
|
|
- readonly: data.inventoryCount !== 0
|
|
|
- },
|
|
|
- {
|
|
|
- code: 'calculationFormula',
|
|
|
- type: 'textarea',
|
|
|
- title: mixins.$t("calculationFormula"),
|
|
|
- readonly: true,
|
|
|
- }
|
|
|
- ]
|
|
|
+ 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',
|
|
|
+ disabled: (data.inventoryCount !== 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,
|
|
|
+ readonly: data.inventoryCount !== 0
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: 'calculationFormula',
|
|
|
+ type: 'textarea',
|
|
|
+ title: mixins.$t("calculationFormula"),
|
|
|
+ readonly: true,
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
} else {
|
|
|
contentObj.unit = [{ //基本单位
|
|
|
code: 'unitId',
|
|
|
@@ -908,51 +1173,103 @@ Page({
|
|
|
}, ]
|
|
|
}
|
|
|
if (data.flgOpeningInv) {
|
|
|
- contentObj.warehouse = [{ //期初库存标识
|
|
|
- type: 'switch',
|
|
|
- title: mixins.$t("openingInv"),
|
|
|
- code: 'flgOpeningInv',
|
|
|
- disabled: true,
|
|
|
-
|
|
|
- }, { //仓库名称
|
|
|
- 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,
|
|
|
- tip: mixins.$t('tipPop'),
|
|
|
- },
|
|
|
- { //期初数量
|
|
|
- code: 'intoQty',
|
|
|
- type: 'number',
|
|
|
- sign: "",
|
|
|
- digits: 0,
|
|
|
- title: mixins.$t("openingInventoryQty"),
|
|
|
- required: true,
|
|
|
- readonly: true,
|
|
|
- },
|
|
|
- { //期初成本价
|
|
|
- code: 'priceInto',
|
|
|
- type: 'number',
|
|
|
- title: mixins.$t("iinitialCostPrice"),
|
|
|
- required: true,
|
|
|
- readonly: true,
|
|
|
- },
|
|
|
- ]
|
|
|
+ if (data.flgSubUnit) { //开了辅助单位
|
|
|
+ data.packageBox = data['box'] + data.subUnitName + data['piece'] + data.unitName
|
|
|
+ contentObj.warehouse = [{ //期初库存标识
|
|
|
+ type: 'switch',
|
|
|
+ title: mixins.$t("openingInv"),
|
|
|
+ code: 'flgOpeningInv',
|
|
|
+ disabled: true,
|
|
|
+
|
|
|
+ }, { //仓库名称
|
|
|
+ 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,
|
|
|
+ tip: mixins.$t('tipPop'),
|
|
|
+ },
|
|
|
+ { //期初数量
|
|
|
+ code: 'intoQty',
|
|
|
+ type: 'number',
|
|
|
+ sign: "",
|
|
|
+ digits: 0,
|
|
|
+ title: mixins.$t("openingInventoryQty"),
|
|
|
+ required: true,
|
|
|
+ readonly: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: 'packageBox',
|
|
|
+ type: 'str',
|
|
|
+ title: mixins.$t("packageBox"),
|
|
|
+ required: true,
|
|
|
+ readonly: true,
|
|
|
+ },
|
|
|
+ { //期初成本价
|
|
|
+ code: 'priceInto',
|
|
|
+ type: 'number',
|
|
|
+ title: mixins.$t("iinitialCostPrice"),
|
|
|
+ required: true,
|
|
|
+ readonly: true,
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ } else {
|
|
|
+ contentObj.warehouse = [{ //期初库存标识
|
|
|
+ type: 'switch',
|
|
|
+ title: mixins.$t("openingInv"),
|
|
|
+ code: 'flgOpeningInv',
|
|
|
+ disabled: true,
|
|
|
+
|
|
|
+ }, { //仓库名称
|
|
|
+ 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,
|
|
|
+ tip: mixins.$t('tipPop'),
|
|
|
+ },
|
|
|
+ { //期初数量
|
|
|
+ code: 'intoQty',
|
|
|
+ type: 'number',
|
|
|
+ sign: "",
|
|
|
+ digits: 0,
|
|
|
+ title: mixins.$t("openingInventoryQty"),
|
|
|
+ required: true,
|
|
|
+ readonly: true,
|
|
|
+ },
|
|
|
+ { //期初成本价
|
|
|
+ code: 'priceInto',
|
|
|
+ type: 'number',
|
|
|
+ title: mixins.$t("iinitialCostPrice"),
|
|
|
+ required: true,
|
|
|
+ readonly: true,
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
contentObj.warehouse = [{ //期初库存标识
|
|
|
type: 'switch',
|
|
|
title: mixins.$t("openingInv"),
|
|
|
- code: 'flgOpeningInv',
|
|
|
+ code: 'flgOpeningInv',
|
|
|
disabled: true,
|
|
|
}, ]
|
|
|
}
|