zhouhao há 2 anos atrás
pai
commit
88590db960

+ 1 - 1
src/views/sales_control/sales_management/components/customer_sales_details.vue

@@ -142,7 +142,7 @@ export default {
         {
           prop: 'notes',
           label: '备注',
-          
+
 
         }
       ],

+ 9 - 5
src/views/sales_control/sales_management/components/customer_sales_form.vue

@@ -104,6 +104,7 @@ export default {
     if (this.detailsId) {
       getFrontOrderDetail({ id: this.detailsId }).then(res => {
         this.dataList = res.data.orders
+        this.customerNumber = res.data.customerNumber
         this.$refs.header.screenForm = res.data
         this.$refs.header.screenForm.disabled = this.disabled = res.data.status !== 1 ? true : false
 
@@ -111,7 +112,7 @@ export default {
         this.$refs.header.screenForm.cityId = res.data.city
         this.$refs.header.screenForm.areaId = res.data.area
         this.$refs.header.screenForm.streetId = res.data.street
-        this.$refs.header.screenForm.stockType = res.data.stockType
+        this.$refs.header.screenForm.stockType = Number(res.data.stockType)
       })
     } else {
       Object.assign(this.$data, this.$options.data())
@@ -139,11 +140,14 @@ export default {
       return func(...p)
     },
     confirm(selected) {
-      console.log(selected)
       this.dataList = [...this.dataList,...selected]
-      this.$refs.header.screenForm.customerName = this.dataList[0].customerName
-      this.$refs.header.screenForm.customerNumber = this.dataList[0].customerNumber
-      this.$refs.header.screenForm.stockType = this.dataList[0].stockType
+      console.log(selected,this.dataList[0].stockType)
+        if (!this.detailsId){
+          this.$refs.header.screenForm.customerName = this.dataList[0].customerName
+          this.$refs.header.screenForm.customerNumber = this.dataList[0].customerNumber
+          this.$refs.header.screenForm.stockType = this.dataList[0].stockType
+        }
+
       this.customerNumber = this.dataList[0].customerNumber
       this.dialogVisible = false
       // this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.$refs.tableView.clearSelection()

+ 48 - 43
src/views/sales_control/sales_management/components/return_sales_form.vue

@@ -1,7 +1,8 @@
 <template>
   <div>
-    <el-page-header @back="$parent.pageType=0" :content="detailsId?'编辑':'新增'" style=" padding: 20px 20px 0 20px;"></el-page-header>
-    <return-sales-header ref="header" :details="details"/>
+    <el-page-header @back="$parent.pageType=0" :content="detailsId?'编辑':'新增'" style=" padding: 20px 20px 0 20px;"
+    ></el-page-header>
+    <return-sales-header ref="header" :details="details" />
     <sales-table :dataList="dataList" :column="column" isOperation isSelection @handleSelection="handleSelection">
       <template #bts>
         <div>
@@ -22,7 +23,7 @@
 
       </template>
       <template v-slot:custom="{item:{row,$index}}">
-          <div>{{diffQty(row)}}</div>
+        <div>{{ diffQty(row) }}</div>
       </template>
       <template v-slot:custom="{item:{row,$index}}">
         <el-radio label="1" v-model="row.flag">增加</el-radio>
@@ -38,7 +39,9 @@
         </el-popconfirm>
       </template>
     </sales-table>
-    <sales-dialog ref="dia" :dialogVisible="dialogVisible" :customerNumber="customerNumber" :func="getDialogList" @confirm="confirm" />
+    <sales-dialog ref="dia" :dialogVisible="dialogVisible" :customerNumber="customerNumber" :func="getDialogList"
+                  @confirm="confirm"
+    />
   </div>
 </template>
 
@@ -64,16 +67,16 @@ export default {
     SalesTable,
     SalesDialog
   },
-  props:['detailsId'],
+  props: ['detailsId'],
   data() {
     return {
       dialogVisible: false,
-      customerNumber:'',
+      customerNumber: '',
       dataList: [],
       selection: [],
-      flag:1,
-      dis:true,
-      details:{},
+      flag: 1,
+      dis: true,
+      details: {},
       column: [
         {
           prop: 'materialName',
@@ -92,13 +95,13 @@ export default {
         },
         {
           prop: 'qty',
-          align:'left',
+          align: 'left',
           label: '发货数量',
           width: '180'
         },
         {
           prop: 'refundQty',
-          align:'left',
+          align: 'left',
 
           label: '退货数量',
           width: '180',
@@ -106,9 +109,9 @@ export default {
         },
         {
           prop: 'diffQty',
-          align:'left',
+          align: 'left',
           label: '已退数量',
-          width: '180',
+          width: '180'
 
         },
         // {
@@ -126,29 +129,29 @@ export default {
           label: '备注',
           width: '180',
           isInput: true,
-          type:'text'
+          type: 'text'
         }
       ],
-      isFront:JSON.parse(localStorage.getItem('supply_user')).isFront,
-      salesId:""
+      isFront: JSON.parse(localStorage.getItem('supply_user')).isFront,
+      salesId: ''
     }
   },
-  computed:{
-    diffQty(){
-      return (row)=>{
+  computed: {
+    diffQty() {
+      return (row) => {
         return Number(row.qty) - Number(row.refundQty)
       }
     }
   },
   created() {
     if (this.detailsId) {
-      detailRefund({id:this.detailsId}).then(res=>{
+      detailRefund({ id: this.detailsId }).then(res => {
         this.dataList = res.data.orders
         this.details = res.data
         this.details.customerOrderNo = this.dataList[0].id
-        this.customerNumber=this.dataList[0].customerNumber
+        this.customerNumber = res.data.materialId
       })
-    }else{
+    } else {
       Object.assign(this.$data, this.$options.data())
     }
   },
@@ -166,14 +169,16 @@ export default {
     },
     confirm(selected) {
       // console.log(selected)
-      selected.forEach(k=>{
+      selected.forEach(k => {
         k.diffQty = Number(k.qty) - Number(k.refundQty)
       })
-      this.dataList = [...this.dataList,...selected]
-      this.details = this.dataList[0]
-      this.details.customerOrderNo = this.dataList[0].id
-      this.detailsId = this.detailsId
-      this.customerNumber=this.dataList[0].customerNumber
+      this.dataList = [...this.dataList, ...selected]
+      if (!this.detailsId) {
+        this.details = this.dataList[0]
+        this.details.customerOrderNo = this.dataList[0].id
+        this.detailsId = this.detailsId
+      }
+      this.customerNumber = this.dataList[0].customerNumber
       this.dialogVisible = false
       this.$refs.dia.$refs.pageRef.$refs.zjpage.$refs.tableEl.$refs.tableView.clearSelection()
 
@@ -192,9 +197,9 @@ export default {
       return arr1.filter(v => arr2.every(val => val.id != v.id))
     },
     delChange() {
-      if (this.dataList.length){
-        this.dataList =  this.resArr(this.dataList,this.selection)
-        if (!this.dataList.length){
+      if (this.dataList.length) {
+        this.dataList = this.resArr(this.dataList, this.selection)
+        if (!this.dataList.length) {
           this.customerNumber = ''
         }
       }
@@ -204,16 +209,16 @@ export default {
       this.selection = data
     },
 
-    handelSubmit(type,status=1) {
-      if (!this.dataList.length){
+    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
-        if (Number(this.dataList[i].refundQty)<0 || !this.dataList[i].refundQty){
-          this.$errorMsg(`第${i+1}产品退货数量有误`)
+        if (Number(this.dataList[i].refundQty) < 0 || !this.dataList[i].refundQty) {
+          this.$errorMsg(`第${i + 1}产品退货数量有误`)
           return
         }
       }
@@ -221,35 +226,35 @@ export default {
       const params = {
         ...this.$refs.header.details,
         orders: this.dataList,
-        customerOrderNo:this.details.customerOrderNo,
+        customerOrderNo: this.details.customerOrderNo,
         status
       }
-      if (type===1){
+      if (type === 1) {
         params.id = ''
         addRefund(params).then(res => {
           this.$successMsg('新增成功')
           this.salesId = res.data
 
           // this.$parent.pageType = 0
-          this.dis =false
+          this.dis = false
           this.$forceUpdate()
         })
 
-      }else {
-        updateRefund(params).then(res=>{
+      } else {
+        updateRefund(params).then(res => {
           this.$successMsg('编辑成功')
           this.$parent.pageType = 0
           this.$forceUpdate()
         })
       }
     },
-    handleInform(status=2){
-      sendRefund({id:this.salesId,status}).then(res=>{
+    handleInform(status = 2) {
+      sendRefund({ id: this.salesId, status }).then(res => {
         this.$successMsg('退货通知')
         this.$parent.pageType = 0
       })
     },
-    onReset(){
+    onReset() {
       Object.assign(this.$data, this.$options.data())
 
     }