|
|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<ele-modal
|
|
|
:visible.sync="visible"
|
|
|
- title="创建订单"
|
|
|
+ :title="title"
|
|
|
width="80vw"
|
|
|
append-to-body
|
|
|
>
|
|
|
@@ -64,7 +64,7 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-table
|
|
|
- :data="form.productInfoAddPos"
|
|
|
+ :data="form.productInfoList"
|
|
|
border
|
|
|
>
|
|
|
<el-table-column label="序号" align="center" width="60">
|
|
|
@@ -88,7 +88,7 @@
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
label-width="0px"
|
|
|
- :prop="'productInfoAddPos.'+ scope.$index + '.contractNum'"
|
|
|
+ :prop="'productInfoList.'+ scope.$index + '.contractNum'"
|
|
|
:rules="{
|
|
|
required: true,
|
|
|
message: '请输入交付数量',
|
|
|
@@ -133,14 +133,14 @@
|
|
|
</template>
|
|
|
|
|
|
<!-- 选择产品 -->
|
|
|
- <EquipmentDialog ref="equipmentRefs" @choose="confirmChoose" :selectList="form.productInfoAddPos"> </EquipmentDialog>
|
|
|
+ <EquipmentDialog ref="equipmentRefs" @choose="confirmChoose" :selectList="form.productInfoList"> </EquipmentDialog>
|
|
|
</ele-modal>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { getCode } from '@/api/codeManagement';
|
|
|
import EquipmentDialog from '../components/EquipmentDialog.vue';
|
|
|
- import { createOrUpdate } from '@/api/saleOrder';
|
|
|
+ import { createOrUpdate , getOrderDetail } from '@/api/saleOrder';
|
|
|
export default {
|
|
|
components: {
|
|
|
EquipmentDialog
|
|
|
@@ -150,7 +150,7 @@
|
|
|
visible: false,
|
|
|
loading:false,
|
|
|
form:{
|
|
|
- productInfoAddPos:[]
|
|
|
+ productInfoList:[]
|
|
|
},
|
|
|
// 表单验证规则
|
|
|
rules: {
|
|
|
@@ -160,7 +160,8 @@
|
|
|
{id:1,label:'内销订单'},
|
|
|
{id:2,label:'外销订单'},
|
|
|
{id:3,label:'预制订单'}
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ title:'创建订单'
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -172,20 +173,32 @@
|
|
|
created(){
|
|
|
},
|
|
|
methods: {
|
|
|
- open () {
|
|
|
+ open (row) {
|
|
|
this.visible = true;
|
|
|
- this.getSaleCode()
|
|
|
+ if(row){
|
|
|
+ this.title = '修改订单'
|
|
|
+ this.getDetail(row.code)
|
|
|
+ }else{
|
|
|
+ this.title = '创建订单'
|
|
|
+ this.getSaleCode()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getDetail(code){
|
|
|
+ getOrderDetail(code).then(res=>{
|
|
|
+ console.log('返回',res)
|
|
|
+ this.form = res
|
|
|
+ })
|
|
|
},
|
|
|
cancel () {
|
|
|
this.form = {
|
|
|
- productInfoAddPos:[]
|
|
|
+ productInfoList:[]
|
|
|
}
|
|
|
this.$refs.form.clearValidate();
|
|
|
this.visible = false;
|
|
|
},
|
|
|
// 删除产品
|
|
|
handleDeleteItem (index) {
|
|
|
- this.form.productInfoAddPos.splice(index, 1)
|
|
|
+ this.form.productInfoList.splice(index, 1)
|
|
|
this.changeLineNumber()
|
|
|
},
|
|
|
addEquipment(){
|
|
|
@@ -197,7 +210,7 @@
|
|
|
if (!valid) {
|
|
|
return false;
|
|
|
}
|
|
|
- if(!this.form.productInfoAddPos.length){
|
|
|
+ if(!this.form.productInfoList.length){
|
|
|
return this.$message.warning('产品列表不能为空!')
|
|
|
}
|
|
|
this.loading = true;
|
|
|
@@ -236,31 +249,31 @@
|
|
|
);
|
|
|
// 取出在弹窗中选中并且不在表格中的数据
|
|
|
const result = list.filter(
|
|
|
- i => this.form.productInfoAddPos.findIndex(p => p.productCode === i.productCode) === -1
|
|
|
+ i => this.form.productInfoList.findIndex(p => p.productCode === i.productCode) === -1
|
|
|
)
|
|
|
// 取出在表格中并且不在弹窗中选中的数据 即取消选中的数据
|
|
|
- const del = this.form.productInfoAddPos.filter(
|
|
|
+ const del = this.form.productInfoList.filter(
|
|
|
i => list.findIndex(p => p.productCode === i.productCode) === -1
|
|
|
)
|
|
|
- for(let i= this.form.productInfoAddPos.length-1;i>=0;i--){
|
|
|
+ for(let i= this.form.productInfoList.length-1;i>=0;i--){
|
|
|
for(let j in del){
|
|
|
- if(this.form.productInfoAddPos[i].productCode === del[j].productCode){
|
|
|
- this.form.productInfoAddPos.splice(i,1);
|
|
|
+ if(this.form.productInfoList[i].productCode === del[j].productCode){
|
|
|
+ this.form.productInfoList.splice(i,1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- this.form.productInfoAddPos = this.form.productInfoAddPos.concat(result)
|
|
|
+ this.form.productInfoList = this.form.productInfoList.concat(result)
|
|
|
this.changeLineNumber()
|
|
|
},
|
|
|
|
|
|
changeLineNumber(){
|
|
|
- this.form.productInfoAddPos.map((item,index)=>{
|
|
|
+ this.form.productInfoList.map((item,index)=>{
|
|
|
item.lineNumber = 10*(index+1)
|
|
|
})
|
|
|
},
|
|
|
|
|
|
inputNumber(row,index){
|
|
|
- const pos = this.form.productInfoAddPos
|
|
|
+ const pos = this.form.productInfoList
|
|
|
if(pos[index].productUnitWeight){
|
|
|
this.$set(pos[index],'deliveryWeight', row.contractNum * row.productUnitWeight)
|
|
|
}
|