|
@@ -65,8 +65,8 @@
|
|
|
<el-tab-pane label="商品明细" name="sale_detail">
|
|
|
<avue-crud :option="optionContacts" ref="formContacts"
|
|
|
:data="form.planItemsList.filter(item => item.isDeleted != 1)" :key="key"
|
|
|
- @row-save="rowSave" @row-update="rowUpdate" @row-close="rowClose"
|
|
|
- :before-close="beforeClose" @selection-change="selectionContacts"
|
|
|
+ @row-update="rowUpdate" @row-close="rowClose" :before-close="beforeClose"
|
|
|
+ @selection-change="selectionContacts"
|
|
|
@resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)"
|
|
|
@saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)">
|
|
|
<template slot-scope="{scope,row}" slot="menuLeft">
|
|
@@ -83,17 +83,22 @@
|
|
|
一键删除
|
|
|
</el-button> -->
|
|
|
</template>
|
|
|
- <template slot="goodsId" slot-scope="{ row }">
|
|
|
- <span>{{ row.goodsName }}</span>
|
|
|
+ <template slot="regionNameForm" slot-scope="{ row }">
|
|
|
+ <dic-select v-if="row.$cellEdit" v-model="row.regionName" placeholder="库区" key="id"
|
|
|
+ label="regionName" :url="'/blade-sales-part/tire/center/warehouse/storage-region/getRegionSelected?storageId='+form.storageId"
|
|
|
+ :filterable="true" :remote="true" dataName="regionName"
|
|
|
+ @selectChange="rowDicChange('regionName', $event, row)"></dic-select>
|
|
|
+ <span v-else>{{ row.regionName }}</span>
|
|
|
</template>
|
|
|
- <template slot="goodsNum" slot-scope="{ row }">
|
|
|
+ <template slot="goodsNumForm" slot-scope="{ row }">
|
|
|
<el-input-number v-if="row.$cellEdit" size="small" v-model="row.goodsNum"
|
|
|
- :controls="false" :precision="numberDecimal" style="width: 100%"></el-input-number>
|
|
|
+ :controls="false" :precision="numberDecimal" style="width: 100%"
|
|
|
+ @change="moneyChange(row)"></el-input-number>
|
|
|
<span v-else>{{ row.goodsNum }}</span>
|
|
|
</template>
|
|
|
<template slot="price" slot-scope="{ row }">
|
|
|
- <el-input v-if="row.$cellEdit" size="small" v-model="row.price"
|
|
|
- style="width: 100%"></el-input>
|
|
|
+ <el-input v-if="row.$cellEdit" size="small" v-model="row.price" style="width: 100%"
|
|
|
+ @change="moneyChange(row)"></el-input>
|
|
|
<span v-else>{{ row.price }}</span>
|
|
|
</template>
|
|
|
<template slot="dot" slot-scope="{row}">
|
|
@@ -105,17 +110,14 @@
|
|
|
style="width: 100%"></el-input>
|
|
|
<span v-else>{{ row.rebatePrice }}</span>
|
|
|
</template>
|
|
|
- <template slot="subTotalMoney" slot-scope="{ row }">
|
|
|
- {{ (row.goodsNum * row.price).toFixed(2) }}
|
|
|
- </template>
|
|
|
<template slot="remarks" slot-scope="{ row }">
|
|
|
<el-input v-if="row.$cellEdit" size="small" v-model="row.remarks"
|
|
|
style="width: 100%"></el-input>
|
|
|
<span v-else>{{ row.remarks }}</span>
|
|
|
</template>
|
|
|
<template slot-scope="{type,size,row,index,disabled}" slot="menu">
|
|
|
- <el-button :size="size" :disabled="editButton || form.status == 2"
|
|
|
- :type="type" :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
|
|
|
+ <el-button :size="size" :disabled="editButton || form.status == 2" :type="type"
|
|
|
+ :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
|
|
|
@click="rowEdit(row, index)">{{ row.$cellEdit ? '保存' : '编辑' }}
|
|
|
</el-button>
|
|
|
<el-button icon="el-icon-delete" :size="size" :disabled="editButton || form.status == 2"
|
|
@@ -126,7 +128,7 @@
|
|
|
</el-tab-pane>
|
|
|
<el-tab-pane label="费用明细" name="outbound_records">
|
|
|
<avue-crud :option="optionOutboundRecords" ref="outbound_records"
|
|
|
- :data="form.centerShipCostList.filter(item => item.isDeleted != 1)" @row-save="rowSave" @row-update="rowUpdate"
|
|
|
+ :data="form.centerShipCostList.filter(item => item.isDeleted != 1)" @row-update="rowUpdate"
|
|
|
@resetColumn="resetColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 269.3)"
|
|
|
@saveColumn="saveColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 269.3)">
|
|
|
<template slot="indexHeader" slot-scope="{row,index}">
|
|
@@ -137,7 +139,7 @@
|
|
|
<template slot="index" slot-scope="{row,index}">
|
|
|
<span>{{ index + 1 }}</span>
|
|
|
</template>
|
|
|
- <template slot="costName" slot-scope="{ row }">
|
|
|
+ <template slot="costNameForm" slot-scope="{ row }">
|
|
|
<dic-select v-if="row.$cellEdit" v-model="row.costName" placeholder="费用名称" key="id"
|
|
|
res="records" label="cname"
|
|
|
url="/blade-sales-part/storageDesc/list?current=1&size=5" :filterable="true"
|
|
@@ -145,21 +147,21 @@
|
|
|
@selectChange="rowDicChange('costName', $event, row)"></dic-select>
|
|
|
<span v-else>{{ row.costName }}</span>
|
|
|
</template>
|
|
|
- <tempalte slot="costPrice" slot-scope="{ row }">
|
|
|
+ <tempalte slot="costPriceForm" slot-scope="{ row }">
|
|
|
<el-input-number v-if="row.$cellEdit" v-model="row.costPrice" @change="countChange(row)"
|
|
|
:controls="false" placeholder="请输入 单价" size="small"
|
|
|
style="width: 100%;"></el-input-number>
|
|
|
<span v-else>{{ row.costPrice }}</span>
|
|
|
</tempalte>
|
|
|
- <tempalte slot="goodsNum" slot-scope="{ row }">
|
|
|
+ <tempalte slot="goodsNumForm" slot-scope="{ row }">
|
|
|
<el-input-number v-if="row.$cellEdit" v-model="row.goodsNum" @change="countChange(row)"
|
|
|
:controls="false" placeholder="请输入 数量" size="small"
|
|
|
style="width: 100%;"></el-input-number>
|
|
|
<span v-else>{{ row.goodsNum }}</span>
|
|
|
</tempalte>
|
|
|
<template slot-scope="{type,size,row,index,disabled}" slot="menu">
|
|
|
- <el-button :size="size" :disabled="editButton || form.status == 2"
|
|
|
- :type="type" :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
|
|
|
+ <el-button :size="size" :disabled="editButton || form.status == 2" :type="type"
|
|
|
+ :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
|
|
|
@click="rowEdit(row, index)">{{ row.$cellEdit ? '保存' : '编辑' }}
|
|
|
</el-button>
|
|
|
<el-button icon="el-icon-delete" :size="size" :disabled="editButton || form.status == 2"
|
|
@@ -574,13 +576,14 @@ export default {
|
|
|
disabled: false,
|
|
|
remote: true,
|
|
|
overHidden: true,
|
|
|
- }, {
|
|
|
- label: '数量',
|
|
|
- prop: 'goodsNum',
|
|
|
- overHidden: true,
|
|
|
- disabled: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '库区',
|
|
|
+ prop: 'regionName',
|
|
|
cell: true,
|
|
|
- width: 100,
|
|
|
+ slot: true,
|
|
|
+ formslot: true,
|
|
|
+ overHidden: true,
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: " ",
|
|
@@ -588,12 +591,12 @@ export default {
|
|
|
}]
|
|
|
},
|
|
|
{
|
|
|
- label: '价格',
|
|
|
- prop: 'price',
|
|
|
- overHidden: true,
|
|
|
- width: 100,
|
|
|
- disabled: false,
|
|
|
+ label: '数量',
|
|
|
+ prop: 'goodsNum',
|
|
|
cell: true,
|
|
|
+ slot: true,
|
|
|
+ formslot: true,
|
|
|
+ overHidden: true,
|
|
|
rules: [{
|
|
|
required: true,
|
|
|
message: " ",
|
|
@@ -601,9 +604,14 @@ export default {
|
|
|
}]
|
|
|
},
|
|
|
{
|
|
|
+ label: '价格',
|
|
|
+ prop: 'price',
|
|
|
+ overHidden: true,
|
|
|
+ width: 100
|
|
|
+ },
|
|
|
+ {
|
|
|
label: '批次号',
|
|
|
prop: 'dot',
|
|
|
- cell: true,
|
|
|
width: 100,
|
|
|
overHidden: true,
|
|
|
}, {
|
|
@@ -728,16 +736,40 @@ export default {
|
|
|
label: '费用名称',
|
|
|
prop: 'costName',
|
|
|
headerslot: true,
|
|
|
+ cell: true,
|
|
|
+ slot: true,
|
|
|
+ formslot: true,
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: " ",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
},
|
|
|
{
|
|
|
label: '单价',
|
|
|
prop: 'costPrice',
|
|
|
headerslot: true,
|
|
|
+ cell: true,
|
|
|
+ slot: true,
|
|
|
+ formslot: true,
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: " ",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
},
|
|
|
{
|
|
|
label: '数量',
|
|
|
prop: 'goodsNum',
|
|
|
headerslot: true,
|
|
|
+ cell: true,
|
|
|
+ slot: true,
|
|
|
+ formslot: true,
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: " ",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
},
|
|
|
{
|
|
|
label: '金额',
|
|
@@ -785,7 +817,10 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
countChange(row) {
|
|
|
- row.costAmount = _.multiply(Number(row.costPrice ? row.costPrice : 0), Number(row.goodsNum ? row.goodsNum : 0))
|
|
|
+ row.costAmount = _.multiply(Number(row.costPrice ? row.costPrice : 0), Number(row.goodsNum ? row.goodsNum : 0)).toFixed(2)
|
|
|
+ },
|
|
|
+ moneyChange(row) {
|
|
|
+ row.subTotalMoney = _.multiply(Number(row.price ? row.price : 0), Number(row.goodsNum ? row.goodsNum : 0)).toFixed(2)
|
|
|
},
|
|
|
addRow() {
|
|
|
if (!this.form.id) {
|
|
@@ -811,6 +846,14 @@ export default {
|
|
|
el.costName = null
|
|
|
}
|
|
|
}
|
|
|
+ if(name=='regionName'){
|
|
|
+ if (row) {
|
|
|
+ el.regionId = row.id
|
|
|
+ } else {
|
|
|
+ el.regionId = null
|
|
|
+ el.regionName = null
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
dicChange(name, row) {
|
|
|
if (name == 'customerName') {
|
|
@@ -945,65 +988,44 @@ export default {
|
|
|
tableDataHandle() {
|
|
|
// 循环获取库存数量
|
|
|
for (let item of this.tableData) {
|
|
|
- console.log(item, '循环导入')
|
|
|
- let page = {}
|
|
|
- if (this.form.storageId) {
|
|
|
- page.storageId = this.form.storageId
|
|
|
- }
|
|
|
- page.goodsId = item.id
|
|
|
- dotList(page).then(res => {
|
|
|
- console.log(res.data, '获取到的数据')
|
|
|
- var obj = {}
|
|
|
- if (res.data.data.length > 0) {
|
|
|
- obj.inventory = res.data.data[0].balanceQuantity
|
|
|
- if (item.dot) {
|
|
|
- obj.dot = item.dot
|
|
|
- } else {
|
|
|
- obj.dot = ''
|
|
|
- }
|
|
|
- }
|
|
|
- this.form.planItemsList.push({
|
|
|
- ...obj,
|
|
|
- price: item.price,
|
|
|
- goodsId: item.id,
|
|
|
- goodsName: item.cname,
|
|
|
- dot: item.dot,
|
|
|
- brandName: item.brandName,
|
|
|
- brandId: item.brandId,
|
|
|
- goodsTypeId: item.goodsTypeId,
|
|
|
- goodsNo: item.code,
|
|
|
- // propertyName:item.typeno,
|
|
|
- // 规格型号
|
|
|
- propertyName: item.specificationAndModel,
|
|
|
- // 花纹
|
|
|
- pattern: item.brandItem,
|
|
|
- // 商品描述
|
|
|
- goodsDescription: item.goodsDescription,
|
|
|
+ this.form.planItemsList.push({
|
|
|
+ price: item.price,
|
|
|
+ goodsId: item.id,
|
|
|
+ goodsName: item.cname,
|
|
|
+ dot: item.dot,
|
|
|
+ brandName: item.brandName,
|
|
|
+ brandId: item.brandId,
|
|
|
+ goodsTypeId: item.goodsTypeId,
|
|
|
+ goodsNo: item.code,
|
|
|
+ // propertyName:item.typeno,
|
|
|
+ // 规格型号
|
|
|
+ propertyName: item.specificationAndModel,
|
|
|
+ // 花纹
|
|
|
+ pattern: item.brandItem,
|
|
|
+ // 商品描述
|
|
|
+ goodsDescription: item.goodsDescription,
|
|
|
|
|
|
- goodsNum: item.goodsNum,
|
|
|
- units: item.unit,
|
|
|
- inventory: item.inventory,
|
|
|
- // sendNum:res.data.data[0],
|
|
|
- // 小计
|
|
|
- subTotalMoney: item.goodsNum * item.price,
|
|
|
- //
|
|
|
- // inventory:item.balanceQuantity,
|
|
|
- // 备注
|
|
|
- remarks: item.remarks,
|
|
|
- rebatePrice: item.rebatePrice,
|
|
|
- // 批次号的状态
|
|
|
- dotedittype: false,
|
|
|
- // 价格数量
|
|
|
- goodsNumtype: false,
|
|
|
- // 价格
|
|
|
- pricetype: false,
|
|
|
- // 是否是编辑状态
|
|
|
- mingxibaocun: true
|
|
|
- })
|
|
|
- console.log(this.form.planItemsList)
|
|
|
+ goodsNum: item.goodsNum,
|
|
|
+ units: item.unit,
|
|
|
+ inventory: item.inventory,
|
|
|
+ // sendNum:res.data.data[0],
|
|
|
+ // 小计
|
|
|
+ subTotalMoney: item.goodsNum * item.price,
|
|
|
+ //
|
|
|
+ // inventory:item.balanceQuantity,
|
|
|
+ // 备注
|
|
|
+ remarks: item.remarks,
|
|
|
+ rebatePrice: item.rebatePrice,
|
|
|
+ // 批次号的状态
|
|
|
+ dotedittype: false,
|
|
|
+ // 价格数量
|
|
|
+ goodsNumtype: false,
|
|
|
+ // 价格
|
|
|
+ pricetype: false,
|
|
|
+ // 是否是编辑状态
|
|
|
+ $cellEdit: true
|
|
|
})
|
|
|
}
|
|
|
- this.mingxibaocun = false
|
|
|
this.dialogVisible = false
|
|
|
},
|
|
|
// 导入
|
|
@@ -1165,17 +1187,17 @@ export default {
|
|
|
editCustomer(type) {
|
|
|
this.$refs["form"].validate((valid, done) => {
|
|
|
done();
|
|
|
- let picihao = false
|
|
|
if (valid) {
|
|
|
- for (let i in this.form.planItemsList) {
|
|
|
- console.log(this.form.planItemsList[i], 1800)
|
|
|
- this.form.planItemsList[i].subTotalMoney = this.form.planItemsList[i].goodsNum * this.form.planItemsList[i].price
|
|
|
- if (this.form.planItemsList[i].goodsNum <= 0) {
|
|
|
- this.$message.warning(`采购明细序号${Number(i) + 1}的数量不能为零`);
|
|
|
- picihao = true
|
|
|
+ for (let row of this.form.planItemsList.filter(item => item.isDeleted != 1)) {
|
|
|
+ if (!row.regionName||!row.goodsNum) {
|
|
|
+ this.$refs.formContacts.rowCell(row, row.$index)
|
|
|
+ return this.$message.error("请完善商品明细信息");
|
|
|
}
|
|
|
- if (!this.form.planItemsList[i].sendNum) {
|
|
|
- this.form.planItemsList[i].sendNum = 0
|
|
|
+ }
|
|
|
+ for (let row of this.form.centerShipCostList.filter(item => item.isDeleted != 1)) {
|
|
|
+ if (!row.costName || !row.goodsNum || !row.costPrice) {
|
|
|
+ this.$refs.outbound_records.rowCell(row, row.$index)
|
|
|
+ return this.$message.error("请完善费用明细信息");
|
|
|
}
|
|
|
}
|
|
|
let obj = {
|
|
@@ -1189,10 +1211,8 @@ export default {
|
|
|
spinner: 'el-icon-loading',
|
|
|
background: 'rgba(255,255,255,0.7)'
|
|
|
});
|
|
|
-
|
|
|
submit(obj).then(res => {
|
|
|
this.$message.success("操作成功");
|
|
|
- this.mingxibaocun = true
|
|
|
this.getDetail(res.data.data)
|
|
|
}).finally(() => {
|
|
|
loading.close();
|
|
@@ -1303,16 +1323,6 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- rowSave(form, done, loading) {
|
|
|
- form.subTotalMoney = form.goodsNum * form.price
|
|
|
- form.goodsName = form.$goodsId
|
|
|
- if (this.isStatus) {
|
|
|
- console.log(form);
|
|
|
- done(form)
|
|
|
- } else {
|
|
|
- this.$message.error('请选择相同商户的商品')
|
|
|
- }
|
|
|
- },
|
|
|
rowUpdate(form, index, done, loading) {
|
|
|
this.$set(form, 'goodsName', form.$goodsId)
|
|
|
console.log(form);
|