|
@@ -1,6 +1,7 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <el-page-header @back="$parent.pageType=0" :content="detailsId?'编辑':'新增'" style=" padding: 20px 20px 0 20px;"></el-page-header>
|
|
|
+ <el-page-header @back="$parent.pageType=0" :content="detailsId?'编辑':'新增'" style=" padding: 20px 20px 0 20px;"
|
|
|
+ ></el-page-header>
|
|
|
<sales-header ref="header" />
|
|
|
<sales-table :dataList="dataList" :column="column" isOperation isSelection @handleSelection="handleSelection">
|
|
|
<template #bts>
|
|
@@ -54,7 +55,7 @@ export default {
|
|
|
SalesTable,
|
|
|
SalesDialog
|
|
|
},
|
|
|
- props:['detailsId'],
|
|
|
+ props: ['detailsId'],
|
|
|
data() {
|
|
|
return {
|
|
|
dialogVisible: false,
|
|
@@ -62,7 +63,7 @@ export default {
|
|
|
dataList: [],
|
|
|
selection: [],
|
|
|
flag: 1,
|
|
|
- dis:true,
|
|
|
+ dis: true,
|
|
|
column: [
|
|
|
{
|
|
|
prop: 'materialName',
|
|
@@ -112,7 +113,7 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
if (this.$parent.pageType == 2 || this.detailsId) {
|
|
|
- getFrontOrderDetail({id:this.detailsId}).then(res=>{
|
|
|
+ getFrontOrderDetail({ id: this.detailsId }).then(res => {
|
|
|
this.dataList = res.data.orders
|
|
|
this.$refs.header.screenForm = res.data
|
|
|
this.$refs.header.screenForm.provinceId = res.data.province
|
|
@@ -140,9 +141,9 @@ export default {
|
|
|
},
|
|
|
handleDel(item, index) {
|
|
|
this.dataList.splice(index, 1)
|
|
|
- if (!this.dataList.length){
|
|
|
- this.$nextTick(()=>{
|
|
|
- this.$refs.header.screenForm = { }
|
|
|
+ if (!this.dataList.length) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.header.screenForm = {}
|
|
|
this.customerNumber = ''
|
|
|
})
|
|
|
|
|
@@ -157,9 +158,9 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
- if (!this.dataList.length){
|
|
|
- this.$nextTick(()=>{
|
|
|
- this.$refs.header.screenForm = { }
|
|
|
+ if (!this.dataList.length) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.header.screenForm = {}
|
|
|
this.customerNumber = ''
|
|
|
})
|
|
|
|
|
@@ -168,23 +169,34 @@ export default {
|
|
|
handleSelection(data) {
|
|
|
this.selection = data
|
|
|
},
|
|
|
- handleInform(status=2){
|
|
|
+ handleInform(status = 2) {
|
|
|
console.log(33)
|
|
|
- sbumitFrontOrder({id:this.$refs.header.screenForm.id,status}).then(res=>{
|
|
|
+ sbumitFrontOrder({ id: this.$refs.header.screenForm.id, status }).then(res => {
|
|
|
console.log(res)
|
|
|
})
|
|
|
-},
|
|
|
- handelSubmit(type,status=1) {
|
|
|
- this.dataList.forEach(k => {
|
|
|
- k.id = ''
|
|
|
- k.directFlag = k.flag
|
|
|
- })
|
|
|
+ },
|
|
|
+ handelSubmit(type, status = 1) {
|
|
|
+ if (!this.dataList.length) {
|
|
|
+ this.$errorMsg('请添加产品')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for (let i = 0; i < this.dataList.length; i++) {
|
|
|
+ this.dataList[i].id = ''
|
|
|
+ this.dataList[i].directFlag = this.dataList[i].flag
|
|
|
+ console.log(Number(this.dataList[i].qty))
|
|
|
+
|
|
|
+ if (Number(this.dataList[i].qty) < 0 || !this.dataList[i].qty) {
|
|
|
+ this.$errorMsg(`第${i+1}产品数量有误`)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
const params = {
|
|
|
...this.$refs.header.screenForm,
|
|
|
orders: this.dataList,
|
|
|
- status:status
|
|
|
+ status: status
|
|
|
}
|
|
|
- if (type==1){
|
|
|
+ if (type == 1) {
|
|
|
params.id = ''
|
|
|
addFrontOrder(params).then(res => {
|
|
|
this.$successMsg('新增成功')
|
|
@@ -193,8 +205,8 @@ export default {
|
|
|
this.$forceUpdate()
|
|
|
})
|
|
|
|
|
|
- }else {
|
|
|
- updateFrontOrder(params).then(res=>{
|
|
|
+ } else {
|
|
|
+ updateFrontOrder(params).then(res => {
|
|
|
this.$successMsg('编辑成功')
|
|
|
this.$parent.pageType = 0
|
|
|
this.$forceUpdate()
|