浏览代码

下推 批量取消

lilei 1 年之前
父节点
当前提交
621cc4efe0

+ 1 - 1
src/api/waitDispatchDetail.js

@@ -13,7 +13,7 @@ export const deleteBatch = (params) => {
 export const pushDown = (params) => {
   return axios({
     url: `/dispatch/pushDown`,
-	data:params,
+    data:params,
     method: 'post'
   })
 }

+ 15 - 0
src/views/salesManagement/waitDispatchNew/edit.vue

@@ -209,6 +209,21 @@ export default {
         this.spinning = false
       })
     },
+    // 一键下推
+    oneDispatch () {
+      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
+      })
+    },
     pageInit () {
       this.$refs.partQuery.clearSelectTable()
       this.salesBillSn = this.$route.params.salesBillSn

+ 15 - 3
src/views/salesManagement/waitDispatchNew/queryPart.vue

@@ -60,9 +60,9 @@
     <div style="margin-bottom: 10px;display: flex;align-items: center;" v-if="detailData">
       <div style="display: flex;align-items: center;">
         <a-button type="primary" :disabled="newLoading" class="button-info" @click="handlePlAdd">批量添加</a-button>
-        <a-button type="danger" v-if="hasPrompActive" :disabled="newLoading" @click="handleAllCancel">整单取消</a-button>
-        <a-button type="danger" v-else :disabled="newLoading" @click="handlePlCancel">批量取消</a-button>
-        <a-tooltip placement="top" v-if="hasPrompActive" style="margin-left:6px;">
+        <a-button type="primary" v-if="hasNormalProduct" ghost style="margin-left:6px;" :disabled="newLoading" @click="handlePlCancel">批量取消</a-button>
+        <a-button type="primary" v-if="hasPrompActive&&hasPushedActive" ghost style="margin-left:6px;" :disabled="newLoading" @click="handleAllCancel">整单取消</a-button>
+        <a-tooltip placement="top" v-if="hasPrompActive&&hasPushedActive" style="margin-left:6px;">
           <template slot="title">
             <span>参加促销活动的销售单,不能单个取消产品,只能整单取消。</span>
           </template>
@@ -184,12 +184,17 @@ export default {
       disableSelectedRowKeys: [],
       selectedRowKeys: [],
       colspanNums: 16,
+      hasNormalProduct: false
     }
   },
   computed: {
     hasPrompActive(){
       return this.detailData&&this.detailData.promoFlag==1&&!this.detailData.totalCancelQty
     },
+    hasPushedActive(){
+      const a = this.dataSource.filter(item => item.promotionFlag != 0).filter(item => item.pushedQty>0)
+      return this.dataSource.length==0 ? false : !(a.length > 0)
+    },
     checkboxOption () {
       return {
           disableSelectedRowKeys: this.disableSelectedRowKeys,
@@ -408,6 +413,8 @@ export default {
         // 正常产品
         const proList = await salesDetailAllList(params).then(res => res.data)
         const norTotal = await salesDetaiCount(params).then(res => res.data)
+        // 是否有正常产品
+        this.hasNormalProduct = proList.length > 0
         //没有活动时不显示统计
         let listData = active.length ? (proList.length ? [{
             id: 'promo-normal',
@@ -575,6 +582,11 @@ export default {
         return
       }
       const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.id.indexOf('promo-')<0)
+      const hasActive = chooseRow && chooseRow.filter(item => item.promotionFlag != 0)
+      if(hasActive.length>0){
+        _this.$message.warning('参与促销的产品只可进行整单取消!')
+        return
+      }
       const obj = []
       chooseRow && chooseRow.map(item => {
         obj.push({