Browse Source

销售一键下推

lilei 3 years ago
parent
commit
8d62e797b1

+ 3 - 2
src/api/waitDispatchDetail.js

@@ -12,8 +12,9 @@ export const deleteBatch = (params) => {
 // 下推
 export const pushDown = (params) => {
   return axios({
-    url: `/dispatch/pushDown/${params.dispatchBillSn}`,
-    method: 'get'
+    url: `/dispatch/pushDown`,
+	data:params,
+    method: 'post'
   })
 }
 

+ 1 - 1
src/views/allocationManagement/transferOut/edit.vue

@@ -484,7 +484,7 @@ export default {
           this.handleSubmit()
         }
       } else {
-        this.$message.info('请选择产品')
+        this.$message.warning('请选择产品')
       }
     },
     handleSubmit (params) {

+ 2 - 2
src/views/salesManagement/pushOrderManagement/detail.vue

@@ -38,8 +38,8 @@
               <a-descriptions-item label="客户名称">{{ detailData&&detailData.buyerName || '--' }}</a-descriptions-item>
               <a-descriptions-item label="销售单号">{{ detailData&&detailData.salesBillNo || '--' }}</a-descriptions-item>
               <a-descriptions-item label="备货单号">{{ detailData&&detailData.dispatchBillNo || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="收货客户名称">{{ detailData&&detailData.buyerName || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="发货编号">{{ detailData&&detailData.dispatchBillNo || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="收货客户名称">{{ detailData&&detailData.receiverName || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="发货编号">{{ detailData&&detailData.sendNo || '--' }}</a-descriptions-item>
               <a-descriptions-item label="收款方式">{{ detailData&&detailData.settleStyleSnDictValue || '--' }}</a-descriptions-item>
               <a-descriptions-item label="收货人" v-if="detailData&&detailData.salesBillExtEntity">{{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.consigneeName || '--' }}</a-descriptions-item>
               <a-descriptions-item label="收货电话" v-if="detailData&&detailData.salesBillExtEntity">{{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.consigneeTel || '--' }}</a-descriptions-item>

+ 31 - 20
src/views/salesManagement/salesQuery/detail.vue

@@ -183,8 +183,8 @@
       @close="visibleAudit=false"
       @ok="auditOrder('AUDIT_PASS')"
       @fail="auditOrder('AUDIT_REJECT')" />
-    <!-- 打印 -->
-    <div id="print"></div>
+    <!-- 审核加下推 -->
+    <dsModal ref="dsModal" :openModal="showDsModal" @close="showDsModal=false" @ok="handleOnceAudit" />
   </div>
 </template>
 
@@ -195,17 +195,19 @@ import moment from 'moment'
 import { STable, VSelect } from '@/components'
 import printModal from './printModal.vue'
 import auditModal from '@/views/common/auditModal.vue'
+import dsModal from '@/views/salesManagement/waitDispatch/dsModal.vue'
 import { findBySalesBillSn } from '@/api/dispatch'
 import { salesDetailBySn, salesDetailPrint, salesDetailExcel, salesDetailTypeExcel, salesWriteAudit, salesWriteAuditPush } from '@/api/sales'
 import { salesDetailAllList, salesDetailAllStockList } from '@/api/salesDetail'
 export default {
   name: 'SalesDetail',
   mixins: [commonMixin],
-  components: { STable, VSelect, printModal, auditModal },
+  components: { STable, VSelect, printModal, auditModal, dsModal },
   data () {
     return {
       spinning: false,
       disabled: false,
+      showDsModal: false,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
@@ -336,23 +338,37 @@ export default {
         }
       })
     },
-    // 审核/批量审核
+    // 打开审核/一键审核弹框
     handleAudit (isBatch) {
-      if (isBatch) {
-        this.auditText = this.outStockStr + '是否审核通过?'
+      if (isBatch) { // 一键审核
+        this.showDsModal = true
+        this.$refs.dsModal.setDetail(this.detailData)
       } else {
         this.auditText = null
+        this.visibleAudit = true
       }
-      this.visibleAudit = true
+    },
+    // 一键审核
+    handleOnceAudit (data) {
+      const params = {
+        salesBillSn: this.$route.params.sn,
+        billStatus: 'AUDIT_PASS',
+        dispatchBill: data
+      }
+      this.spinningAudit = true
+      salesWriteAuditPush(params).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.spinningAudit = false
+          //  关闭详情跳列表
+          this.handleBack()
+        }
+      })
     },
     // 审核
     auditOrder (billStatus) {
       this.spinningAudit = true
-      let url = salesWriteAudit
-      if (this.auditText) { //  批量
-        url = salesWriteAuditPush
-      }
-      url({
+      salesWriteAudit({
         salesBillSn: this.$route.params.sn,
         billStatus: billStatus
       }).then(res => {
@@ -360,20 +376,15 @@ export default {
           this.visibleAudit = false
           this.$message.success(res.message)
           this.spinningAudit = false
-          if (billStatus == 'AUDIT_PASS' && !this.auditText) {
-            this.handleDispatch({ salesBillSn: this.$route.params.sn })
-          } else {
-            //  关闭详情跳列表
-            this.handleBack()
-          }
+          this.toDispatch({ salesBillSn: this.$route.params.sn })
         } else {
           this.visibleAudit = false
           this.spinningAudit = false
         }
       })
     },
-    // 下推
-    handleDispatch (row) {
+    // 跳转下推页面
+    toDispatch (row) {
       this.spinning = true
       findBySalesBillSn({ salesBillSn: row.salesBillSn }).then(res => {
         this.spinning = false

+ 26 - 45
src/views/salesManagement/waitDispatch/dsModal.vue

@@ -23,7 +23,7 @@
             <span>{{ detailData ? detailData.buyerName : '--' }}</span>
           </a-form-model-item>
           <a-form-model-item label="收货客户名称" extra="如果收货客户和下单客户相同,则不需要选择收货客户名称">
-            <dealerSubareaScopeList ref="dealerSubareaScopeList" defValKey="buyerSn" @change="custChange" v-model="form.buyerSn" />
+            <dealerSubareaScopeList ref="dealerSubareaScopeList" defValKey="buyerSn" @change="custChange" v-model="form.receiverSn" />
           </a-form-model-item>
           <a-form-model-item label="发货编号" prop="sendNo">
             <a-input
@@ -33,15 +33,15 @@
               placeholder="请输入发货编号"
               allowClear />
             <div style="height: 24px;line-height: normal;">
-              常用:<a-button size="small" v-for="i in 5" @click="form.sendNo=i" type="link">{{ i }}</a-button>
+              常用:<a-button size="small" v-for="i in 5" @click="setSendNo(i)" type="link">{{ i }}</a-button>
             </div>
           </a-form-model-item>
-          <a-form-model-item label="备货打印" prop="print">
-            <a-radio-group v-model="form.print">
-              <a-radio :value="1">
+          <a-form-model-item label="备货打印" prop="printStatus">
+            <a-radio-group v-model="form.printStatus">
+              <a-radio value="UNABLE_PRINT">
                 允许打印
               </a-radio>
-              <a-radio :value="2">
+              <a-radio value="NO_PRINT">
                 暂不打印
               </a-radio>
             </a-radio-group>
@@ -59,19 +59,14 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
-import { dealerUserSave } from '@/api/dealer'
 export default {
-  name: 'DealerAccountEditModal',
+  name: 'DsModal',
   mixins: [commonMixin],
   components: { dealerSubareaScopeList },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
       default: false
-    },
-    itemId: {
-      type: [Number, String],
-      default: ''
     }
   },
   data () {
@@ -84,21 +79,26 @@ export default {
       },
       form: {
         sendNo: '',
-        print: '',
+        printStatus: undefined,
         buyerName: '',
-        shbuyerName: ''
+        receiverSn: '',
+        receiverName: ''
       },
       rules: {
         sendNo: [{ required: true, message: '请输入发货编号', trigger: 'change' }],
-        print: [{ required: true, message: '请选择备货打印', trigger: 'blur' }]
+        printStatus: [{ required: true, message: '请选择备货打印', trigger: 'change' }]
       },
       detailData: null //  详情数据
     }
   },
   methods: {
+    setSendNo (i) {
+      this.form.sendNo = i
+      this.$refs.ruleForm.validateField('sendNo')
+    },
     custChange (val) {
-      this.form.shbuyerNameSn = val.key || ''
-      this.form.shbuyerName = val.row && val.row.buyerName || ''
+      this.form.receiverSn = val.key || ''
+      this.form.receiverName = val.name || ''
     },
     //  保存
     handleSave () {
@@ -106,21 +106,8 @@ export default {
       _this.$refs.ruleForm.validate(valid => {
         if (valid) {
           const formData = JSON.parse(JSON.stringify(_this.form))
-          formData.id = _this.itemId ? _this.itemId : undefined
-          if (!formData.password) {
-            delete formData.password
-          }
-          _this.spinning = true
-          dealerUserSave(formData).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.$emit('ok')
-              _this.isShow = false
-              _this.spinning = false
-            } else {
-              _this.spinning = false
-            }
-          })
+          _this.$emit('ok', formData)
+          _this.isShow = false
         } else {
           return false
         }
@@ -134,15 +121,14 @@ export default {
     resetForm () {
       this.detailData = null
       this.$refs.ruleForm.resetFields()
-      this.form.tenantSn = ''
-      this.form.name = ''
-      this.form.phone = ''
-      this.form.loginName = ''
-      this.form.password = ''
-      this.form.org.childUserMaxNum = ''
-      if (this.itemId == '') {
-        this.$refs.custList.resetForm()
+      this.form = {
+        sendNo: '',
+        printStatus: undefined,
+        buyerName: '',
+        receiverSn: '',
+        receiverName: ''
       }
+      this.$refs.dealerSubareaScopeList.resetForm()
     }
   },
   watch: {
@@ -156,11 +142,6 @@ export default {
         this.$emit('close')
         this.resetForm()
       }
-    },
-    itemId (newValue, oldValue) {
-      if (this.isShow && newValue) {
-        this.getDetail()
-      }
     }
   }
 }

+ 26 - 19
src/views/salesManagement/waitDispatch/edit.vue

@@ -16,8 +16,6 @@
           @oneDispatch="oneDispatch"
           @cancelProduct="cancelProduct"
           @addProduct="insterProduct"></queryPart>
-        <!-- 一键下推 -->
-        <dsModal ref="dsModal" :openModal="showDsModal" @close="showDsModal=false" />
       </a-card>
       <a-card size="small" :bordered="false" class="waitDispatch-cont">
         <div slot="title">
@@ -97,10 +95,12 @@
         :disabled="spinning"
         type="primary"
         class="button-primary"
-        @click="handleSubmit()"
+        @click="handleDispatch()"
         :loading="loading"
         id="productInfoList-handleSubmit">下推</a-button>
     </div>
+    <!-- 下推 -->
+    <dsModal ref="dsModal" :openModal="showDsModal" @close="showDsModal=false" @ok="handleSubmit" />
   </div>
 </template>
 
@@ -316,20 +316,18 @@ export default {
     },
     // 一键下推
     oneDispatch () {
-      this.showDsModal = true
-      this.$refs.dsModal.setDetail(this.detailData)
-      // this.isInster = true
-      // this.spinning = true
-      // salesDetailDispatchByOneKey({ salesBillSn: this.$route.params.salesBillSn }).then(res => {
-      //   if (res.status == 200) {
-      //     this.resetSearchForm()
-      //     this.$refs.partQuery.resetCurForm()
-      //     this.spinning = false
-      //   } else {
-      //     this.spinning = false
-      //   }
-      //   this.isInster = false
-      // })
+      this.isInster = true
+      this.spinning = true
+      salesDetailDispatchByOneKey({ salesBillSn: this.$route.params.salesBillSn }).then(res => {
+        if (res.status == 200) {
+          this.resetSearchForm()
+          this.$refs.partQuery.resetCurForm()
+          this.spinning = false
+        } else {
+          this.spinning = false
+        }
+        this.isInster = false
+      })
     },
     //  销售单详情
     getOrderDetail () {
@@ -341,12 +339,21 @@ export default {
       })
     },
     // 提交下推
-    handleSubmit () {
+    handleDispatch () {
+      if (this.dataSource.length) {
+        this.showDsModal = true
+        this.$refs.dsModal.setDetail(this.detailData)
+      } else {
+        this.$message.warning('请选择待下推产品')
+      }
+    },
+    handleSubmit (data) {
       this.delLoading = true
       this.isInster = true
       this.loading = true
       this.spinning = true
-      pushDown({ dispatchBillSn: this.$route.params.dispatchBillSn }).then(res => {
+      const params = Object.assign({ dispatchBillSn: this.$route.params.dispatchBillSn }, data)
+      pushDown(params).then(res => {
         if (res.status == 200) {
           this.handleBack()
           this.$message.success(res.message)