优化商品条码查询接口,支持选择多商品

This commit is contained in:
季圣华
2021-08-06 01:24:28 +08:00
parent c6a5689f44
commit 5f6ab65681
16 changed files with 81 additions and 40 deletions

View File

@@ -185,32 +185,73 @@ export const BillModalMixin = {
mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性 mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性
prefixNo: this.prefixNo prefixNo: this.prefixNo
} }
getMaterialByBarCode(param).then((res) => { if(value.indexOf(',')>-1) {
if (res && res.code === 200) { //多个条码
target.setValues([{ getMaterialByBarCode(param).then((res) => {
rowKey: row.id, if (res && res.code === 200) {
values: { let mList = res.data
barCode: res.data.mBarCode, let mArr = []
name: res.data.name, for (let i = 0; i < mList.length; i++) {
standard: res.data.standard, let mInfo = mList[i]
model: res.data.model, let mObj = {
materialOther: res.data.materialOther, depotId: mInfo.depotId,
unit: res.data.commodityUnit, barCode: mInfo.mBarCode,
sku: res.data.sku, name: mInfo.name,
operNumber: 1, standard: mInfo.standard,
unitPrice: res.data.billPrice, model: mInfo.model,
taxUnitPrice: res.data.billPrice, materialOther: mInfo.materialOther,
allPrice: res.data.billPrice, stock: mInfo.stock,
taxRate: 0, unit: mInfo.commodityUnit,
taxMoney: 0, sku: mInfo.sku,
taxLastMoney: res.data.billPrice, operNumber: 1,
unitPrice: mInfo.billPrice,
taxUnitPrice: mInfo.billPrice,
allPrice: mInfo.billPrice,
taxRate: 0,
taxMoney: 0,
taxLastMoney: mInfo.billPrice
}
mArr.push(mObj)
}
this.materialTable.dataSource = mArr
} }
}]); });
that.getStockByDepotBarCode(row, target) } else {
target.recalcAllStatisticsColumns() //单个条码
that.autoChangePrice(target) getMaterialByBarCode(param).then((res) => {
} if (res && res.code === 200) {
}); let mList = res.data
let mArr = []
for (let i = 0; i < mList.length; i++) {
let mInfo = mList[i]
let mObj = {
rowKey: row.id,
values: {
barCode: mInfo.mBarCode,
name: mInfo.name,
standard: mInfo.standard,
model: mInfo.model,
materialOther: mInfo.materialOther,
unit: mInfo.commodityUnit,
sku: mInfo.sku,
operNumber: 1,
unitPrice: mInfo.billPrice,
taxUnitPrice: mInfo.billPrice,
allPrice: mInfo.billPrice,
taxRate: 0,
taxMoney: 0,
taxLastMoney: mInfo.billPrice
}
}
mArr.push(mObj)
}
target.setValues(mArr);
that.getStockByDepotBarCode(row, target)
target.recalcAllStatisticsColumns()
that.autoChangePrice(target)
}
});
}
break; break;
case "operNumber": case "operNumber":
operNumber = value-0 operNumber = value-0

View File

@@ -103,7 +103,7 @@
{ title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [], { title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }] allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: false, { title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: true,
validateRules: [{ required: true, message: '${title}不能为空' }] validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true }, { title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true },

View File

@@ -105,7 +105,7 @@
{ title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [], { title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }] allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: false, { title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: true,
validateRules: [{ required: true, message: '${title}不能为空' }] validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true }, { title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true },

View File

@@ -105,7 +105,7 @@
{ title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [], { title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }] allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: false, { title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: true,
validateRules: [{ required: true, message: '${title}不能为空' }] validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true }, { title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true },

View File

@@ -112,7 +112,7 @@
{ title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [], { title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }] allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: false, { title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: true,
validateRules: [{ required: true, message: '${title}不能为空' }] validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true }, { title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true },

View File

@@ -112,7 +112,7 @@
{ title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [], { title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }] allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: false, { title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: true,
validateRules: [{ required: true, message: '${title}不能为空' }] validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true }, { title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true },

View File

@@ -174,7 +174,7 @@
{ title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [], { title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }] allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: false, { title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: true,
validateRules: [{ required: true, message: '${title}不能为空' }] validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true }, { title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true },

View File

@@ -175,7 +175,7 @@
{ title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [], { title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }] allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: false, { title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: true,
validateRules: [{ required: true, message: '${title}不能为空' }] validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true }, { title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true },

View File

@@ -115,7 +115,7 @@
{ title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [], { title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }] allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: false, { title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: true,
validateRules: [{ required: true, message: '${title}不能为空' }] validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true }, { title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true },

View File

@@ -156,7 +156,7 @@
{ title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [], { title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }] allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '条码', key: 'barCode', width: '12%', type: FormTypes.popupJsh, multi: false, { title: '条码', key: 'barCode', width: '12%', type: FormTypes.popupJsh, multi: true,
validateRules: [{ required: true, message: '${title}不能为空' }] validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '名称', key: 'name', width: '8%', type: FormTypes.input, readonly: true }, { title: '名称', key: 'name', width: '8%', type: FormTypes.input, readonly: true },

View File

@@ -156,7 +156,7 @@
{ title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [], { title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }] allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '条码', key: 'barCode', width: '12%', type: FormTypes.popupJsh, multi: false, { title: '条码', key: 'barCode', width: '12%', type: FormTypes.popupJsh, multi: true,
validateRules: [{ required: true, message: '${title}不能为空' }] validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '名称', key: 'name', width: '8%', type: FormTypes.input, readonly: true }, { title: '名称', key: 'name', width: '8%', type: FormTypes.input, readonly: true },

View File

@@ -179,7 +179,7 @@
{ title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [], { title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }] allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: false, { title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: true,
validateRules: [{ required: true, message: '${title}不能为空' }] validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true }, { title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true },

View File

@@ -118,7 +118,7 @@
{ title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [], { title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }] allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: false, { title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: true,
validateRules: [{ required: true, message: '${title}不能为空' }] validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true }, { title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true },

View File

@@ -179,7 +179,7 @@
{ title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [], { title: '仓库名称', key: 'depotId', width: '7%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }] allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: false, { title: '条码', key: 'barCode', width: '8%', type: FormTypes.popupJsh, multi: true,
validateRules: [{ required: true, message: '${title}不能为空' }] validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true }, { title: '名称', key: 'name', width: '6%', type: FormTypes.input, readonly: true },

View File

@@ -124,7 +124,7 @@
} }
getMaterialByBarCode(param).then((res) => { getMaterialByBarCode(param).then((res) => {
if (res && res.code === 200) { if (res && res.code === 200) {
this.form.setFieldsValue({'materialName': res.data.name}) this.form.setFieldsValue({'materialName': res.data[0].name})
} }
}) })
} }

View File

@@ -144,7 +144,7 @@
} }
getMaterialByBarCode(param).then((res) => { getMaterialByBarCode(param).then((res) => {
if (res && res.code === 200) { if (res && res.code === 200) {
this.form.setFieldsValue({'materialName': res.data.name}) this.form.setFieldsValue({'materialName': res.data[0].name})
} }
}) })
} }