|
@@ -33,7 +33,6 @@ export const BillModalMixin = {
|
|
|
options: [],
|
|
|
value: '',
|
|
|
},
|
|
|
- currentSelectDepotId: '',
|
|
|
depotList: [],
|
|
|
accountList: [],
|
|
|
accountIdList: [],
|
|
@@ -286,6 +285,13 @@ export const BillModalMixin = {
|
|
|
getAction('/depot/findDepotByCurrentUser').then((res) => {
|
|
|
if (res.code === 200) {
|
|
|
let arr = res.data
|
|
|
+ this.depotList = res.data.map(item => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ value: item.id,
|
|
|
+ label: item.depotName,
|
|
|
+ }
|
|
|
+ })
|
|
|
for (let item of that.materialTable.columns) {
|
|
|
if (item.key == 'depotId' || item.key == 'anotherDepotId') {
|
|
|
item.options = []
|
|
@@ -395,46 +401,47 @@ export const BillModalMixin = {
|
|
|
.then((allValues) => {
|
|
|
//获取单据明细列表信息
|
|
|
let detailArr = allValues.tablesValue[0].values
|
|
|
- let batchNumbers = ''
|
|
|
- for (let detail of detailArr) {
|
|
|
- batchNumbers += detail.batchNumber + ','
|
|
|
- }
|
|
|
- if (batchNumbers) {
|
|
|
- batchNumbers = batchNumbers.substring(0, batchNumbers.length - 1)
|
|
|
- }
|
|
|
- let param = {
|
|
|
- batchNumber: batchNumbers,
|
|
|
- organId: this.form.getFieldValue('organId'),
|
|
|
- depotId: depotId,
|
|
|
- mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性
|
|
|
- prefixNo: this.prefixNo,
|
|
|
- }
|
|
|
- getMaterialByBatchNumber(param).then((res) => {
|
|
|
- if (res && res.code === 200) {
|
|
|
- let mList = res.data
|
|
|
- //构造新的列表数组,用于存放单据明细信息
|
|
|
- let newDetailArr = []
|
|
|
- if (mList && mList.length) {
|
|
|
- for (let i = 0; i < detailArr.length; i++) {
|
|
|
- let item = detailArr[i]
|
|
|
- item.depotId = depotId
|
|
|
- for (let j = 0; j < mList.length; j++) {
|
|
|
- if (mList[j].batchNumber === item.batchNumber) {
|
|
|
- item.stock = mList[j].stock
|
|
|
- }
|
|
|
- }
|
|
|
- newDetailArr.push(item)
|
|
|
- }
|
|
|
- } else {
|
|
|
- for (let i = 0; i < detailArr.length; i++) {
|
|
|
- let item = detailArr[i]
|
|
|
- item.depotId = depotId
|
|
|
- newDetailArr.push(item)
|
|
|
- }
|
|
|
- }
|
|
|
- this.materialTable.dataSource = newDetailArr
|
|
|
- }
|
|
|
- })
|
|
|
+ console.log('detailArr=======',detailArr)
|
|
|
+ // let batchNumbers = ''
|
|
|
+ // for (let detail of detailArr) {
|
|
|
+ // batchNumbers += detail.batchNumber + ','
|
|
|
+ // }
|
|
|
+ // if (batchNumbers) {
|
|
|
+ // batchNumbers = batchNumbers.substring(0, batchNumbers.length - 1)
|
|
|
+ // }
|
|
|
+ // let param = {
|
|
|
+ // batchNumber: batchNumbers,
|
|
|
+ // organId: this.form.getFieldValue('organId'),
|
|
|
+ // depotId: depotId,
|
|
|
+ // mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性
|
|
|
+ // prefixNo: this.prefixNo,
|
|
|
+ // }
|
|
|
+ // getMaterialByBatchNumber(param).then((res) => {
|
|
|
+ // if (res && res.code === 200) {
|
|
|
+ // let mList = res.data
|
|
|
+ // //构造新的列表数组,用于存放单据明细信息
|
|
|
+ // let newDetailArr = []
|
|
|
+ // if (mList && mList.length) {
|
|
|
+ // for (let i = 0; i < detailArr.length; i++) {
|
|
|
+ // let item = detailArr[i]
|
|
|
+ // item.depotId = depotId
|
|
|
+ // for (let j = 0; j < mList.length; j++) {
|
|
|
+ // if (mList[j].batchNumber === item.batchNumber) {
|
|
|
+ // item.stock = mList[j].stock
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // newDetailArr.push(item)
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // for (let i = 0; i < detailArr.length; i++) {
|
|
|
+ // let item = detailArr[i]
|
|
|
+ // item.depotId = depotId
|
|
|
+ // newDetailArr.push(item)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // this.materialTable.dataSource = newDetailArr
|
|
|
+ // }
|
|
|
+ // })
|
|
|
})
|
|
|
},
|
|
|
depotModalFormOk() {
|
|
@@ -454,37 +461,93 @@ export const BillModalMixin = {
|
|
|
setTimeout(function () {
|
|
|
that.$refs.materialDataTable.resetScrollTop((target.rows.length + 1) * that.$refs.materialDataTable.rowHeight)
|
|
|
}, 1000)
|
|
|
- // if (this.currentSelectDepotId) {
|
|
|
- // //如果单据选择过仓库,则直接从当前选择的仓库加载
|
|
|
- // target.setValues([{ rowKey: row.id, values: { depotId: this.currentSelectDepotId } }])
|
|
|
- // } else {
|
|
|
- // getAction('/depot/findDepotByCurrentUser').then((res) => {
|
|
|
- // if (res.code === 200) {
|
|
|
- // let arr = res.data
|
|
|
- // if (arr.length === 1) {
|
|
|
- // target.setValues([{ rowKey: row.id, values: { depotId: arr[0].id + '' } }])
|
|
|
- // } else {
|
|
|
- // for (let i = 0; i < arr.length; i++) {
|
|
|
- // if (arr[i].isDefault) {
|
|
|
- // target.setValues([{ rowKey: row.id, values: { depotId: arr[i].id + '' } }])
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
},
|
|
|
//根据仓库名、商品条码带出对应的仓位货架、库存数量
|
|
|
- async setProPosition(barCode, depotId, event){
|
|
|
- const { row, column, value, target } = event
|
|
|
- findStockByDepotAndBarCode({ depotId: depotId, barCode: barCode }).then(res => {
|
|
|
- const {position='',stock} = res.data
|
|
|
- target.setValues([
|
|
|
- {
|
|
|
+ // async setProPosition(barCode, depotId, event){
|
|
|
+ // const { row, column, value, target } = event
|
|
|
+ // findStockByDepotAndBarCode({ depotId: depotId, barCode: barCode }).then(res => {
|
|
|
+ // const {position='',stock} = res.data
|
|
|
+ // target.setValues([
|
|
|
+ // {
|
|
|
+ // rowKey: row.id,
|
|
|
+ // values: { position:position,inventory: stock },
|
|
|
+ // },
|
|
|
+ // ])
|
|
|
+ // target.$forceUpdate()
|
|
|
+ // })
|
|
|
+ // },
|
|
|
+ // 选择供应商、客户带出税率
|
|
|
+ getTatRate(id){
|
|
|
+ getAction('/supplier/info', { id }).then((res) => {
|
|
|
+ if (res && res.code === 200) {
|
|
|
+ let info = res.data.info
|
|
|
+ const taxRate = info.taxRate?(info.taxRate - 0) : 0
|
|
|
+ this.form.setFieldsValue({
|
|
|
+ taxRate
|
|
|
+ })
|
|
|
+ const target = this.$refs[this.refKeys[0]]
|
|
|
+ if(target){
|
|
|
+ this.autoCalcPrice(target,taxRate)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 自动计算表格价格
|
|
|
+ autoCalcPrice(editTableVm,taxRate){
|
|
|
+ const that = this
|
|
|
+ editTableVm.getValues((error, values) => {
|
|
|
+ const updateRows = []
|
|
|
+ console.log('9999999------',values)
|
|
|
+ for(let row of values){
|
|
|
+ const allPrice = row.allPrice - 0
|
|
|
+ const taxMoney = (taxRate * 0.01 * allPrice).toFixed(2) - 0
|
|
|
+ const taxLastMoney = (allPrice + taxMoney).toFixed(2) - 0
|
|
|
+ updateRows.push({
|
|
|
rowKey: row.id,
|
|
|
- values: { position:position,inventory: stock,stock: stock },
|
|
|
- },
|
|
|
- ])
|
|
|
+ values: { taxRate, taxMoney: taxMoney, taxLastMoney: taxLastMoney },
|
|
|
+ })
|
|
|
+ }
|
|
|
+ editTableVm.setValues(updateRows)
|
|
|
+ editTableVm.recalcAllStatisticsColumns()
|
|
|
+ that.autoChangePrice(editTableVm)
|
|
|
+ editTableVm.$forceUpdate()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //默认采购价、销售价与当前采购价、销售价不一致
|
|
|
+ getDefaultWholesaleDecimal(index,key){
|
|
|
+ if(this.materialTable.dataSource[index]&&this.materialTable.dataSource[index][key]){
|
|
|
+ return this.materialTable.dataSource[index][key]
|
|
|
+ }
|
|
|
+ return undefined
|
|
|
+ },
|
|
|
+ onChangePrice(e,callback){
|
|
|
+ const { value } = e.target;
|
|
|
+ const reg = /^$|^(0|[1-9]\d*)(\.\d{1,2})?$/;
|
|
|
+ if ((!isNaN(value) && reg.test(value))) {
|
|
|
+ callback(value)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 仓库名移动到基础表单
|
|
|
+ async changeDepot(depotId,editTableRefName){
|
|
|
+ const target = this.$refs[`${editTableRefName}`]
|
|
|
+ if(!target){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ target.getValues(async (error, values) => {
|
|
|
+ const rows = values
|
|
|
+ const updateRows = []
|
|
|
+ for (let row of rows) {
|
|
|
+ const barCode = row.barCode
|
|
|
+ if(depotId&&barCode){
|
|
|
+ const res = await findStockByDepotAndBarCode({ depotId: depotId, barCode: barCode })
|
|
|
+ const {position='',stock=0} = res.data
|
|
|
+ updateRows.push({
|
|
|
+ rowKey: row.id,
|
|
|
+ values: { position:position,inventory: stock, stock,depotId },
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ target.setValues(updateRows)
|
|
|
target.$forceUpdate()
|
|
|
})
|
|
|
},
|
|
@@ -494,96 +557,13 @@ export const BillModalMixin = {
|
|
|
const { type, row, column, value, target } = event
|
|
|
let param, snList, batchNumber, operNumber, unitPrice, allPrice, taxRate, taxMoney, taxLastMoney
|
|
|
switch (column.key) {
|
|
|
- case 'depotId':
|
|
|
- that.currentSelectDepotId = row.depotId
|
|
|
- console.log('row========', row)
|
|
|
- // // 选择商品自动带出barCode、商品ID
|
|
|
- if(row.depotId&&row.barCode&&type=='select'){
|
|
|
- // // 根据仓库id自动带出仓位货架(若有)参数:商品id、仓库id
|
|
|
- this.setProPosition(row.barCode, row.depotId, event)
|
|
|
- }
|
|
|
- break
|
|
|
- // case 'batchNumber':
|
|
|
- // param = {
|
|
|
- // batchNumber: value,
|
|
|
- // organId: this.form.getFieldValue('organId'),
|
|
|
- // mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性
|
|
|
- // prefixNo: this.prefixNo,
|
|
|
+ // case 'depotId':
|
|
|
+ // console.log('row========', row)
|
|
|
+ // // // 选择商品自动带出barCode、商品ID
|
|
|
+ // if(row.depotId&&row.barCode&&type=='select'){
|
|
|
+ // // // 根据仓库id自动带出仓位货架(若有)参数:商品id、仓库id
|
|
|
+ // this.setProPosition(row.barCode, row.depotId, event)
|
|
|
// }
|
|
|
- // getMaterialByBatchNumber(param).then((res) => {
|
|
|
- // if (res && res.code === 200) {
|
|
|
- // let mList = res.data
|
|
|
-
|
|
|
- // if (value.indexOf(',') > -1) {
|
|
|
- // //多个条码
|
|
|
- // this.$refs.materialDataTable.getValues((error, values) => {
|
|
|
- // values.pop() //移除最后一行数据
|
|
|
- // let mArr = values
|
|
|
- // for (let i = 0; i < mList.length; i++) {
|
|
|
- // let mInfo = mList[i]
|
|
|
- // if (mInfo.unitId) {
|
|
|
- // mInfo.unitList = JSON.stringify(mInfo.unitList)
|
|
|
- // }
|
|
|
- // this.changeColumnShow(mInfo)
|
|
|
- // let mObj = this.parseInfoToObj(mInfo)
|
|
|
- // mObj.depotId = mInfo.depotId
|
|
|
- // mObj.stock = mInfo.stock
|
|
|
- // mObj.inventory = mInfo.inventory
|
|
|
- // mArr.push(mObj)
|
|
|
- // }
|
|
|
- // let allPriceTotal = 0
|
|
|
- // let taxLastMoneyTotal = 0
|
|
|
- // for (let j = 0; j < mArr.length; j++) {
|
|
|
- // allPriceTotal += mArr[j].allPrice - 0
|
|
|
- // taxLastMoneyTotal += mArr[j].taxLastMoney - 0
|
|
|
- // //组合和拆分单据给商品类型进行重新赋值
|
|
|
- // if (j === 0) {
|
|
|
- // mArr[0].mType = '组合件'
|
|
|
- // } else {
|
|
|
- // mArr[j].mType = '普通子件'
|
|
|
- // }
|
|
|
- // }
|
|
|
-
|
|
|
- // this.materialTable.dataSource = mArr
|
|
|
- // if (this.prefixNo === 'LSCK' || this.prefixNo === 'LSTH') {
|
|
|
- // target.statisticsColumns.allPrice = allPriceTotal
|
|
|
- // } else {
|
|
|
- // target.statisticsColumns.taxLastMoney = taxLastMoneyTotal
|
|
|
- // }
|
|
|
- // that.autoChangePrice(target)
|
|
|
- // //强制渲染
|
|
|
- // target.$forceUpdate()
|
|
|
- // })
|
|
|
- // } else {
|
|
|
- // //单个条码
|
|
|
- // let depotIdSelected = row.depotId || ''
|
|
|
- // // findStockByDepotAndBarCode({ depotId: depotIdSelected, barCode: row.batchNumber }).then((res) => {
|
|
|
- // // if (res && res.code === 200) {
|
|
|
- // // let mArr = []
|
|
|
- // // let mInfo = mList[0]
|
|
|
- // // if (mInfo.unitId) {
|
|
|
- // // mInfo.unitList = JSON.stringify(mInfo.unitList)
|
|
|
- // // }
|
|
|
- // // this.changeColumnShow(mInfo)
|
|
|
- // // let mInfoEx = this.parseInfoToObj(mInfo)
|
|
|
- // // mInfoEx.stock = res.data.stock
|
|
|
- // // mInfoEx.inventory = mInfo.inventory
|
|
|
- // // let mObj = {
|
|
|
- // // rowKey: row.id,
|
|
|
- // // values: mInfoEx,
|
|
|
- // // }
|
|
|
- // // mArr.push(mObj)
|
|
|
- // // target.setValues(mArr)
|
|
|
- // // target.recalcAllStatisticsColumns()
|
|
|
- // // that.autoChangePrice(target)
|
|
|
- // // target.autoSelectBySpecialKey('operNumber', row.orderNum)
|
|
|
- // // //强制渲染
|
|
|
- // // target.$forceUpdate()
|
|
|
- // // }
|
|
|
- // // })
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
// break
|
|
|
case 'barCode':
|
|
|
param = {
|
|
@@ -592,57 +572,47 @@ export const BillModalMixin = {
|
|
|
mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性
|
|
|
prefixNo: this.prefixNo,
|
|
|
}
|
|
|
+ const formDepotId = that.form.getFieldValue('depotId')
|
|
|
+ const formTaxRate = that.form.getFieldValue('taxRate')
|
|
|
getMaterialByBarCode(param).then((res) => {
|
|
|
if (res && res.code === 200) {
|
|
|
let mList = res.data
|
|
|
console.log('mList======',mList)
|
|
|
- target.getValues(async (error, values) => {
|
|
|
- const clickRowIndex = values.findIndex((item) => item.id === row.id) //获取当前行的索引
|
|
|
- // values.pop() //移除最后一行数据
|
|
|
- values.splice(clickRowIndex, 1) //移除当前行数据
|
|
|
- let mArr = values // 新加的行
|
|
|
- for (let i = 0; i < mList.length; i++) {
|
|
|
- let mInfo = mList[i]
|
|
|
- if (mInfo.unitId) {
|
|
|
- mInfo.unitList = JSON.stringify(mInfo.unitList)
|
|
|
- }
|
|
|
- this.changeColumnShow(mInfo)
|
|
|
- let mObj = this.parseInfoToObj(mInfo)
|
|
|
- mObj.depotId = mInfo.depotId
|
|
|
- const res = await findStockByDepotAndBarCode({ depotId: mInfo.depotId, barCode: mObj.barCode })
|
|
|
- const {position,stock} = res.data
|
|
|
- mObj.stock = stock
|
|
|
- console.log('stock===',stock)
|
|
|
- console.log('position===',position)
|
|
|
- mObj.position = position
|
|
|
- mObj.inventory = mInfo.inventory
|
|
|
- const unitPrice = (mObj.unitPrice||0)- 0
|
|
|
- mObj.allPrice = (unitPrice * mObj.operNumber).toFixed(2)
|
|
|
- // mObj.taxLastMoney = mInfo.taxLastMoney||0
|
|
|
- mArr.push(mObj)
|
|
|
- }
|
|
|
- let allPriceTotal = 0
|
|
|
- let taxLastMoneyTotal = 0
|
|
|
- for (let j = 0; j < mArr.length; j++) {
|
|
|
- allPriceTotal += mArr[j].allPrice - 0
|
|
|
- taxLastMoneyTotal += mArr[j].taxLastMoney- 0
|
|
|
- //组合和拆分单据给商品类型进行重新赋值
|
|
|
- if (j === 0) {
|
|
|
- mArr[0].mType = '组合件'
|
|
|
- } else {
|
|
|
- mArr[j].mType = '普通子件'
|
|
|
+ const needAddNum = mList.length
|
|
|
+ const clickRowIndex = target.getRowIndexByRowId(row.id)
|
|
|
+ const newRows = target.insert(clickRowIndex,needAddNum)
|
|
|
+ target.removeRows(row.id)
|
|
|
+ const updateRows = []
|
|
|
+ target.$nextTick(() => {
|
|
|
+ target.getValues(async (error,values) => {
|
|
|
+ for(let i = 0; i < values.length; i++){
|
|
|
+ const rawInfo = mList[i]
|
|
|
+ const item = values[i]
|
|
|
+ const mObj = that.parseInfoToObj(rawInfo)
|
|
|
+ mObj.allPrice = ((mObj.unitPrice - 0)* (mObj.operNumber))
|
|
|
+ mObj.taxRate = formTaxRate || 0
|
|
|
+ mObj.taxMoney = (mObj.taxRate * 0.01 * mObj.allPrice)
|
|
|
+ mObj.taxLastMoney = (mObj.allPrice + mObj.taxMoney)
|
|
|
+ mObj.depotId = formDepotId
|
|
|
+ mObj.position = ''
|
|
|
+ if(formDepotId){
|
|
|
+ const res = await findStockByDepotAndBarCode({ depotId: formDepotId, barCode: mObj.barCode })
|
|
|
+ const {position='',stock=0} = res.data
|
|
|
+ mObj.stock = stock
|
|
|
+ mObj.inventory = stock
|
|
|
+ mObj.position = position
|
|
|
+ }
|
|
|
+ updateRows.push({
|
|
|
+ rowKey: item.id,
|
|
|
+ values: mObj
|
|
|
+ })
|
|
|
}
|
|
|
- }
|
|
|
- console.log('mArr--------',mArr)
|
|
|
- this.materialTable.dataSource = mArr
|
|
|
- if (this.prefixNo === 'LSCK' || this.prefixNo === 'LSTH') {
|
|
|
- target.statisticsColumns.allPrice = allPriceTotal
|
|
|
- } else {
|
|
|
- target.statisticsColumns.taxLastMoney = taxLastMoneyTotal
|
|
|
- }
|
|
|
- that.autoChangePrice(target)
|
|
|
- //强制渲染
|
|
|
- target.$forceUpdate()
|
|
|
+ target.setValues(updateRows)
|
|
|
+ target.recalcAllStatisticsColumns()
|
|
|
+ target.$nextTick(() => {
|
|
|
+ that.autoChangePrice(target)
|
|
|
+ })
|
|
|
+ }, false,newRows.map(item => item.id))
|
|
|
})
|
|
|
}
|
|
|
})
|
|
@@ -668,51 +638,6 @@ export const BillModalMixin = {
|
|
|
that.autoChangePrice(target)
|
|
|
}
|
|
|
break
|
|
|
- // case 'batchNumber':
|
|
|
- // console.log('====================adasdas', column)
|
|
|
- // batchNumber = value
|
|
|
- // let depotItemId = ''
|
|
|
- // if (this.model.id) {
|
|
|
- // //只有在保存之后的编辑页面下才获取明细id
|
|
|
- // let rowId = row.id
|
|
|
- // if (rowId.length <= 19) {
|
|
|
- // depotItemId = rowId - 0
|
|
|
- // }
|
|
|
- // }
|
|
|
- // getBatchNumberList({
|
|
|
- // name: '',
|
|
|
- // depotItemId: depotItemId,
|
|
|
- // depotId: row.depotId,
|
|
|
- // barCode: row.barCode,
|
|
|
- // batchNumber: batchNumber,
|
|
|
- // }).then((res) => {
|
|
|
- // if (res && res.code === 200) {
|
|
|
- // if (res.data && res.data.rows) {
|
|
|
- // let info = res.data.rows[0]
|
|
|
- // operNumber = info.totalNum
|
|
|
- // taxRate = row.taxRate - 0 //税率
|
|
|
- // unitPrice = row.unitPrice - 0 //单价
|
|
|
- // allPrice = (unitPrice * operNumber).toFixed(2) - 0
|
|
|
- // taxMoney = (taxRate * 0.01 * allPrice).toFixed(2) - 0
|
|
|
- // taxLastMoney = (allPrice + taxMoney).toFixed(2) - 0
|
|
|
- // target.setValues([
|
|
|
- // {
|
|
|
- // rowKey: row.id,
|
|
|
- // values: {
|
|
|
- // expirationDate: info.expirationDateStr,
|
|
|
- // operNumber: operNumber,
|
|
|
- // allPrice: allPrice,
|
|
|
- // taxMoney: taxMoney,
|
|
|
- // taxLastMoney: taxLastMoney,
|
|
|
- // },
|
|
|
- // },
|
|
|
- // ])
|
|
|
- // target.recalcAllStatisticsColumns()
|
|
|
- // that.autoChangePrice(target)
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
- // break
|
|
|
case 'operNumber':
|
|
|
operNumber = value - 0
|
|
|
taxRate = row.taxRate - 0 //税率
|
|
@@ -752,37 +677,38 @@ export const BillModalMixin = {
|
|
|
target.recalcAllStatisticsColumns()
|
|
|
that.autoChangePrice(target)
|
|
|
break
|
|
|
- case 'taxRate':
|
|
|
- operNumber = row.operNumber - 0 //数量
|
|
|
- allPrice = row.allPrice - 0
|
|
|
- unitPrice = row.unitPrice - 0
|
|
|
- taxRate = value - 0 //税率
|
|
|
- taxMoney = (taxRate * 0.01 * allPrice).toFixed(2) - 0
|
|
|
- taxLastMoney = (allPrice + taxMoney).toFixed(2) - 0
|
|
|
- target.setValues([{ rowKey: row.id, values: { taxMoney: taxMoney, taxLastMoney: taxLastMoney } }])
|
|
|
- target.recalcAllStatisticsColumns()
|
|
|
- that.autoChangePrice(target)
|
|
|
- break
|
|
|
- case 'taxLastMoney':
|
|
|
- operNumber = row.operNumber - 0 //数量
|
|
|
- taxLastMoney = value - 0
|
|
|
- taxRate = row.taxRate - 0 //税率
|
|
|
- if (taxRate) {
|
|
|
- unitPrice = (taxLastMoney / operNumber / (1 + taxRate * 0.01)).toFixed(2) - 0
|
|
|
- allPrice = (unitPrice * operNumber).toFixed(2) - 0
|
|
|
- taxMoney = (taxLastMoney - allPrice).toFixed(2) - 0
|
|
|
- } else {
|
|
|
- //税率为0的情况,特殊处理
|
|
|
- allPrice = taxLastMoney
|
|
|
- unitPrice = (allPrice / operNumber).toFixed(2) - 0 //单价
|
|
|
- taxMoney = 0
|
|
|
- }
|
|
|
- target.setValues([
|
|
|
- { rowKey: row.id, values: { unitPrice: unitPrice, allPrice: allPrice, taxMoney: taxMoney } },
|
|
|
- ])
|
|
|
- target.recalcAllStatisticsColumns()
|
|
|
- that.autoChangePrice(target)
|
|
|
- break
|
|
|
+ // case 'taxRate':
|
|
|
+ // operNumber = row.operNumber - 0 //数量
|
|
|
+ // allPrice = row.allPrice - 0
|
|
|
+ // unitPrice = row.unitPrice - 0
|
|
|
+ // taxRate = value - 0 //税率
|
|
|
+ // taxMoney = (taxRate * 0.01 * allPrice).toFixed(2) - 0
|
|
|
+ // taxLastMoney = (allPrice + taxMoney).toFixed(2) - 0
|
|
|
+ // target.setValues([{ rowKey: row.id, values: { taxMoney: taxMoney, taxLastMoney: taxLastMoney } }])
|
|
|
+ // target.recalcAllStatisticsColumns()
|
|
|
+ // that.autoChangePrice(target)
|
|
|
+ // break
|
|
|
+ // case 'taxLastMoney':
|
|
|
+ // console.log('taxLastMoney---------')
|
|
|
+ // operNumber = row.operNumber - 0 //数量
|
|
|
+ // taxLastMoney = value - 0
|
|
|
+ // taxRate = row.taxRate - 0 //税率
|
|
|
+ // if (taxRate) {
|
|
|
+ // unitPrice = (taxLastMoney / operNumber / (1 + taxRate * 0.01)).toFixed(2) - 0
|
|
|
+ // allPrice = (unitPrice * operNumber).toFixed(2) - 0
|
|
|
+ // taxMoney = (taxLastMoney - allPrice).toFixed(2) - 0
|
|
|
+ // } else {
|
|
|
+ // //税率为0的情况,特殊处理
|
|
|
+ // allPrice = taxLastMoney
|
|
|
+ // unitPrice = (allPrice / operNumber).toFixed(2) - 0 //单价
|
|
|
+ // taxMoney = 0
|
|
|
+ // }
|
|
|
+ // target.setValues([
|
|
|
+ // { rowKey: row.id, values: { unitPrice: unitPrice, allPrice: allPrice, taxMoney: taxMoney } },
|
|
|
+ // ])
|
|
|
+ // target.recalcAllStatisticsColumns()
|
|
|
+ // that.autoChangePrice(target)
|
|
|
+ // break
|
|
|
case 'unit':
|
|
|
// row.actualQuantityInStorage=
|
|
|
if (row.unitId) {
|
|
@@ -804,22 +730,19 @@ export const BillModalMixin = {
|
|
|
parseInfoToObj(mInfo) {
|
|
|
return {
|
|
|
barCode: mInfo.barCode,
|
|
|
- batchNumber: mInfo.batchNumber,
|
|
|
name: mInfo.name,
|
|
|
standard: mInfo.standard,
|
|
|
model: mInfo.model,
|
|
|
color: mInfo.color,
|
|
|
brand: mInfo.brand,
|
|
|
- mfrs: mInfo.mfrs,
|
|
|
materialOther: mInfo.materialOther,
|
|
|
unit: mInfo.commodityUnit,
|
|
|
sku: mInfo.sku,
|
|
|
operNumber: 1,
|
|
|
- unitPrice: mInfo.billPrice,
|
|
|
- allPrice: mInfo.billPrice,
|
|
|
- taxRate: 0,
|
|
|
- taxMoney: 0,
|
|
|
- taxLastMoney: mInfo.billPrice,
|
|
|
+ unitPrice: mInfo.billPrice * (mInfo.ratio||1), //单价
|
|
|
+ wholesaleDecimal:mInfo.defaultWholesaleDecimal, //销售价
|
|
|
+ defaultWholesaleDecimal: mInfo.defaultWholesaleDecimal, //默认销售价 不展示
|
|
|
+ defaultPurchaseDecimal: mInfo.defaultPurchaseDecimal, //默认采购价 不展示
|
|
|
|
|
|
productionDate: mInfo.productionDate,
|
|
|
expiryNum: mInfo.expiryNum,
|
|
@@ -833,6 +756,7 @@ export const BillModalMixin = {
|
|
|
unitList: mInfo.unitList,
|
|
|
depotId: mInfo.depotId,
|
|
|
inventory: mInfo.inventory,
|
|
|
+ ratio: mInfo.ratio,
|
|
|
}
|
|
|
},
|
|
|
//使得型号、颜色、扩展信息、sku等为隐藏
|
|
@@ -898,10 +822,10 @@ export const BillModalMixin = {
|
|
|
},
|
|
|
//改变优惠、本次付款、欠款的值
|
|
|
autoChangePrice(target) {
|
|
|
- let allTaxLastMoney = target.statisticsColumns.taxLastMoney - 0
|
|
|
- let discount = this.form.getFieldValue('discount') - 0
|
|
|
+ let allTaxLastMoney = target.getStatisticsValue('taxLastMoney')||0
|
|
|
+ let discount = this.form.getFieldValue('discount') ? this.form.getFieldValue('discount') - 0 : 0
|
|
|
let otherMoney = this.form.getFieldValue('otherMoney') ? this.form.getFieldValue('otherMoney') - 0 : 0
|
|
|
- let deposit = this.form.getFieldValue('deposit')
|
|
|
+ let deposit = this.form.getFieldValue('deposit') ? this.form.getFieldValue('deposit') - 0 : 0
|
|
|
let discountMoney = (discount * 0.01 * allTaxLastMoney).toFixed(2) - 0
|
|
|
let discountLastMoney = (allTaxLastMoney - discountMoney).toFixed(2) - 0
|
|
|
let changeAmountNew = (discountLastMoney + otherMoney).toFixed(2) - 0
|
|
@@ -915,7 +839,7 @@ export const BillModalMixin = {
|
|
|
discountMoney: discountMoney,
|
|
|
discountLastMoney: discountLastMoney,
|
|
|
changeAmount: changeAmountNew,
|
|
|
- debt: 0,
|
|
|
+ debt: (discountLastMoney + (otherMoney || 0) - deposit - changeAmountNew).toFixed(2),
|
|
|
})
|
|
|
})
|
|
|
},
|
|
@@ -924,7 +848,7 @@ export const BillModalMixin = {
|
|
|
const value = e.target.value - 0
|
|
|
let otherMoney = this.form.getFieldValue('otherMoney') ? this.form.getFieldValue('otherMoney') - 0 : 0
|
|
|
let deposit = this.form.getFieldValue('deposit')
|
|
|
- let allTaxLastMoney = this.$refs.materialDataTable.statisticsColumns.taxLastMoney - 0
|
|
|
+ let allTaxLastMoney = this.$refs.materialDataTable.getStatisticsValue('taxLastMoney') - 0
|
|
|
let discountMoneyNew = (allTaxLastMoney * value * 0.01).toFixed(2) - 0
|
|
|
let discountLastMoneyNew = (allTaxLastMoney - discountMoneyNew).toFixed(2) - 0
|
|
|
let changeAmountNew = (discountLastMoneyNew + otherMoney).toFixed(2) - 0
|
|
@@ -946,7 +870,7 @@ export const BillModalMixin = {
|
|
|
const value = e.target.value - 0
|
|
|
let otherMoney = this.form.getFieldValue('otherMoney') ? this.form.getFieldValue('otherMoney') - 0 : 0
|
|
|
let deposit = this.form.getFieldValue('deposit')
|
|
|
- let allTaxLastMoney = this.$refs.materialDataTable.statisticsColumns.taxLastMoney - 0
|
|
|
+ let allTaxLastMoney = this.$refs.materialDataTable.getStatisticsValue('taxLastMoney') - 0
|
|
|
let discountNew = ((value / allTaxLastMoney) * 100).toFixed(2) - 0
|
|
|
let discountLastMoneyNew = (allTaxLastMoney - value).toFixed(2) - 0
|
|
|
let changeAmountNew = (discountLastMoneyNew + otherMoney).toFixed(2) - 0
|
|
@@ -1011,6 +935,7 @@ export const BillModalMixin = {
|
|
|
return getListData(this.form, tables)
|
|
|
})
|
|
|
.then((allValues) => {
|
|
|
+ console.log(1233444,allValues)
|
|
|
let detailArr = allValues.tablesValue[0].values
|
|
|
let batchNumberStr = ''
|
|
|
for (let detail of detailArr) {
|