Jelajahi Sumber

经销商促销

chenrui 1 tahun lalu
induk
melakukan
0bee40df57

+ 12 - 5
src/api/promotion.js

@@ -177,7 +177,7 @@ export const handleCopyData = (params) => {
   })
 }
 
-//经销商促销  已选参与客户  列表查询  分页
+// 经销商促销  已选参与客户  列表查询  分页
 export const queryAuditPageList = (params) => {
   const url = `/promotion/dealer/queryAuditPage/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
@@ -189,15 +189,15 @@ export const queryAuditPageList = (params) => {
   })
 }
 
-//参与客户 提交审核
-export const dealerMidwayAudit = (params) => {
+// 参与客户 提交审核
+export const midwaySubmit = (params) => {
   return axios({
-    url: '/promotion/dealer/midwayAudit',
+    url: '/promotion/dealer/midwaySubmit',
     data: params,
     method: 'post'
   })
 }
-//参与客户   更新列表
+// 参与客户   更新列表
 export const dealerMidwayUpdate = (params) => {
   return axios({
     url: '/promotion/dealer/midwayUpdate',
@@ -205,3 +205,10 @@ export const dealerMidwayUpdate = (params) => {
     method: 'post'
   })
 }
+export const dealerMidwayAudit = (params) => {
+  return axios({
+    url: '/promotion/dealer/midwayAudit',
+    data: params,
+    method: 'post'
+  })
+}

+ 1 - 1
src/views/promotionRulesManagement/dealerPromotions/addModal.vue

@@ -102,7 +102,7 @@
       width="60%"
     >
       <div class="dealerModalCon">
-        <chooseDealer ref="dealerChoose" pageType="dealerPromotion" @plAdd="handleAddDealer"></chooseDealer>
+        <chooseDealer ref="dealerChoose" @plAdd="handleAddDealer"></chooseDealer>
       </div>
     </a-modal>
     <!-- 导入参与客户 -->

+ 1 - 1
src/views/promotionRulesManagement/dealerPromotions/chooseDealer.vue

@@ -144,7 +144,7 @@ export default {
         if (res.status == 200) {
           data = res.data
           const pagination = { ...this.pagination }
-          pagination.total = data.count
+          pagination.total = Number(data.count)
           const no = 0
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1

+ 1 - 1
src/views/promotionRulesManagement/dealerPromotions/editActiveEndTime.vue

@@ -4,7 +4,7 @@
     class="editActiveEndTime-basicInfo-modal"
     :footer="null"
     :maskClosable="false"
-    title="促销时间变更"
+    title="时间变更"
     v-model="isShow"
     @cancel="isShow=false"
     :width="500">

+ 47 - 18
src/views/promotionRulesManagement/dealerPromotions/list.vue

@@ -67,7 +67,7 @@
         <!-- 操作按钮 -->
         <div class="table-operator tableBtnSet" >
           <a-button v-if="$hasPermissions('B_dealerPromotionAdd')" id="promotionList-add" type="primary" @click="handleAdd">新增</a-button>
-          <a-checkbox @change="onChange">
+          <a-checkbox @change="handleDealerAudit" v-if="$hasPermissions('B_dealerAudit')">
             待审核(修改参与客户)
           </a-checkbox>
         </div>
@@ -110,7 +110,6 @@
             <span v-else>--</span>
           </template>
           <!-- 操作 -->
-          <!--  state 待提交:WAIT_SUBMIT 待审核:WAIT_AUDIT 未开始:NOT_START 进行中:RUNNING 审核不通过:AUDIT_REJECT 已结束:IS_OVER -->
           <template slot="action" slot-scope="text, record">
             <a-button
               size="small"
@@ -139,7 +138,7 @@
               v-if="$hasPermissions('B_editTime')&&(record.state == 'NOT_START' || record.state=='RUNNING' ||record.state == 'IS_OVER')"
               @click="handleTime(record)"
               class="button-info"
-              id="promotionList-edit-btn">促销时间变更</a-button>
+              id="promotionList-edit-btn">时间变更</a-button>
             <a-button
               size="small"
               type="link"
@@ -165,7 +164,14 @@
         </s-table>
       </a-spin>
       <!-- 参与客户 -->
-      <lookUp-customers-modal :itemSn="itemPromotionSn" ref="lookUpCustomers" :openModal="openCustomerModal" @ok="editCustomerOk" @close="openCustomerModal = false"></lookUp-customers-modal>
+      <lookUp-customers-modal
+        :itemSn="itemPromotionSn"
+        :showType="itemStatusType"
+        ref="lookUpCustomers"
+        :openModal="openCustomerModal"
+        @submitAudit="editCustomerOk"
+        @handleAudit="auditCustomerOk"
+        @close="closeCustomer"></lookUp-customers-modal>
       <!-- 新增/编辑弹窗-->
       <add-modal v-drag :itemSn="itemSn" :openModal="openModal" @ok="handleOk" @close="openModal=false" />
       <!-- 促销时间变更 -->
@@ -241,7 +247,7 @@ import creatorList from '@/views/common/creatorList.vue'
 import editActiveEndTime from './editActiveEndTime.vue'
 import supplier from '@/views/common/supplier.js'
 import warehouse from '@/views/common/chooseWarehouse.js'
-import { dealerPromotionList, dealerPromotionDel, modifyEnabledFlag, promotionAudit, promotionIsOver, handleCopyData, dealerMidwayAudit } from '@/api/promotion'
+import { dealerPromotionList, dealerPromotionDel, modifyEnabledFlag, promotionAudit, promotionIsOver, handleCopyData, midwaySubmit, dealerMidwayAudit } from '@/api/promotion'
 export default {
   name: 'PromotionManagementList',
   mixins: [commonMixin],
@@ -298,7 +304,8 @@ export default {
       itemSn: null, // 经销商促销活动SN
       openAuditModal: false, // 审核弹窗,
       openCopyModal: false, // 复制弹窗
-      itemPromotionSn: ''
+      itemPromotionSn: '',
+      itemStatusType: false
     }
   },
   methods: {
@@ -323,13 +330,18 @@ export default {
     // 参与客户
     handleCustomers (row) {
       this.openCustomerModal = true
-      this.$nextTick(() => {
-        if (row.dealerScope != 'ALL_DEALER') {
-          this.itemPromotionSn = row.promotionSn
-        } else {
-          this.itemPromotionSn = ''
-        }
-      })
+      if ((row.state === 'NOT_START' || row.state === 'RUNNING') && row.dealerAuditFlag && row.dealerAuditFlag == 0) {
+        this.itemStatusType = 'isEdit'
+      } else if ((row.state === 'NOT_START' || row.state === 'RUNNING') && row.dealerAuditFlag && row.dealerAuditFlag == 1) {
+        this.itemStatusType = 'isAudit'
+      } else {
+        this.itemStatusType = 'isClose'
+      }
+      if (row.dealerScope != 'ALL_DEALER') {
+        this.itemPromotionSn = row.promotionSn
+      } else {
+        this.itemPromotionSn = ''
+      }
     },
     //  基本信息  保存
     handleOk () {
@@ -363,6 +375,13 @@ export default {
     handleSetRules (row) {
       this.$router.push({ name: 'dealerPromotionManagementRule', query: { type: 'rule', sn: row.promotionSn } })
     },
+    // 审核参与客户
+    handleDealerAudit (val) {
+      this.queryParam.dealerAuditFlag = val.target.checked ? '1' : '0'
+      this.$nextTick(() => {
+        this.$refs.table.refresh(true)
+      })
+    },
     // 审核
     handleCheck (row) {
       const _this = this
@@ -471,18 +490,28 @@ export default {
       })
     },
     // 修改参与客户   参与客户提交审核
-    editCustomerOk (res) {
+    editCustomerOk () {
       const _this = this
-      dealerMidwayAudit({ promotionSn: row.promotionSn, dealerAuditStatus: '1' }).then(res => {
+      midwaySubmit({ promotionSn: _this.itemPromotionSn }).then(res => {
         if (res.status == 200) {
           _this.$message.success(res.message)
           _this.$refs.table.refresh()
-          _this.spinning = false
-        } else {
-          _this.spinning = false
         }
       })
     },
+    auditCustomerOk (con) {
+      const _this = this
+      dealerMidwayAudit({ promotionSn: _this.itemPromotionSn, dealerAuditStatus: con }).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.$refs.table.refresh()
+        }
+      })
+    },
+    closeCustomer () {
+      this.openCustomerModal = false
+      this.itemPromotionSn = ''
+    },
     //  重置
     resetSearchForm () {
       this.queryParam = {

+ 67 - 22
src/views/promotionRulesManagement/dealerPromotions/lookUpCustomersModal.vue

@@ -49,12 +49,13 @@
           class="sTable"
           ref="table"
           size="small"
-          :rowKey="(record) => record.id"
+          :rowKey="(record) => record.dealerSn"
+          rowKeyName="dealerSn"
           :columns="columns"
           :data="loadData"
           :defaultLoadData="false"
           :scroll="{ y: 450 }"
-          :rowClassName="(record, index) => record.checkProfitLossQty < 0 ? 'redBg-row':''"
+          :rowClassName="(record, index) => record.dataActType ==='CREATE'? 'fontRed':record.dataActType ==='DELETE'?'fontGreen':''"
           bordered>
           <!-- 地区 -->
           <template slot="address" slot-scope="text, record">
@@ -62,9 +63,19 @@
           </template>
         </s-table>
       </a-card>
-      <div class="btn-cont">
+      <div class="btn-cont" v-if="showType ==='isEdit'">
         <a-button type="primary" class="button-warning" @click="editDealerModal">修改</a-button>
-        <a-button type="primary" style="margin-left: 15px;" :loading="spinning" id="promotion-modal-save" @click="handleSaveAudit">提交审核</a-button>
+        <a-button type="primary" style="margin-left: 15px;" :loading="spinning" id="promotion-modal-save" @click="submitAudit">提交审核</a-button>
+      </div>
+      <div class="btn-cont" v-if="showType === 'isAudit'&& $hasPermissions('B_dealerAudit') ">
+        <a-button @click="handleAudit('AUDIT_REJECT')">审核不通过</a-button>
+        <a-button type="primary" style="margin-left: 15px;" :loading="spinning" id="promotion-modal-save" @click="handleAudit('AUDIT_PASS')">审核通过</a-button>
+      </div>
+      <div class="btn-cont" v-if="showType === 'isAudit' && !$hasPermissions('B_dealerAudit')">
+        <a-button id="lookUpCustomers-modal-back" @click="isShow = false">关闭</a-button>
+      </div>
+      <div class="btn-cont" v-if="showType === 'isClose'">
+        <a-button id="lookUpCustomers-modal-back" @click="isShow = false">关闭</a-button>
       </div>
     </a-spin>
     <!-- 选择参与客户 -->
@@ -78,7 +89,7 @@
       width="60%"
     >
       <div class="dealerModalCon">
-        <chooseDealer ref="dealerChoose" pageType="dealerPromotion" @plAdd="handleAddDealer"></chooseDealer>
+        <chooseDealer ref="dealerChoose" @plAdd="handleAddDealer"></chooseDealer>
       </div>
     </a-modal>
   </a-modal>
@@ -92,7 +103,7 @@ import AreaList from '@/views/common/areaList.js'
 import { hdExportExcel } from '@/libs/exportExcel'
 import { dealerExport } from '@/api/promoTerminal'
 import { queryAuditPageList, dealerMidwayUpdate } from '@/api/promotion'
-import chooseDealer from '../promotionManagement/chooseDealer'
+import chooseDealer from './chooseDealer'
 
 export default {
   name: 'LookUpCustomersModal',
@@ -106,6 +117,10 @@ export default {
     itemSn: {
       type: String,
       default: ''
+    },
+    showType: {
+      type: String,
+      default: ''
     }
   },
   data () {
@@ -130,8 +145,7 @@ export default {
         this.spinning = true
         this.queryParam.promotionSn = this.itemSn
         const params = Object.assign(parameter, this.queryParam)
-        const ajaxName = !this.updateFlag ? queryAuditPageList : dealerMidwayUpdate
-        return ajaxName(params).then(res => {
+        return queryAuditPageList(params).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -163,23 +177,39 @@ export default {
     editDealerModal () {
       const _this = this
       _this.openDealerModal = true
-
       // const arr = _this.chooseDealerList.map(item => {
       //   return item.dealerSn
       // })
       // // 选择参与客户回显
-      // _this.$nextTick(() => {
-      //   _this.$refs.dealerChoose.pageInit(arr)
-      // })
+      _this.$nextTick(() => {
+        _this.$refs.dealerChoose.pageInit()
+      })
     },
     // 添加经销商
     handleAddDealer (list) {
-      // this.chooseDealerList = list
-      // this.openDealerModal = false
-      debugger
-      this.updateFlag = true
-      this.$nextTick(() => {
-        this.$refs.table.refresh()
+      const newArr = []
+      list.forEach(item => {
+        const obj = {
+          dealerScope: this.itemSn ? 'SOME_DEALER' : 'ALL_DEALER',
+          promotionSn: this.itemSn ? this.itemSn : undefined,
+          dealerSn: item.dealerSn
+        }
+        newArr.push(obj)
+      })
+      this.openDealerModal = false
+      this.updateDataList(newArr)
+    },
+    // 更新列表显示状态
+    updateDataList (list) {
+      const ajaxData = {
+        promotionSn: this.itemSn ? this.itemSn : undefined,
+        promotionDealerList: list
+      }
+      dealerMidwayUpdate(ajaxData).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.$refs.table.refresh()
+        }
       })
     },
     areaChange (val) {
@@ -206,7 +236,7 @@ export default {
       this.updateFlag = false
       this.$refs.areaList.clearData()
       this.$refs.subarea.clearData()
-      this.$refs.table.refresh(true)
+      this.$refs.table.clearTable()
     },
     //  导出
     handleExport () {
@@ -220,8 +250,13 @@ export default {
       })
     },
     // 提交审核
-    handleSaveAudit () {
-
+    submitAudit () {
+      this.$emit('submitAudit')
+      this.isShow = false
+    },
+    handleAudit (statusInfo) {
+      this.$emit('handleAudit', statusInfo)
+      this.isShow = false
     }
   },
   watch: {
@@ -235,7 +270,10 @@ export default {
         this.$emit('close')
         this.resetSearchForm()
       } else {
-        this.$refs.table.refresh(true)
+        console.log('this.showType', this.showType)
+        this.$nextTick(() => {
+          this.$refs.table.refresh(true)
+        })
       }
     }
   }
@@ -270,5 +308,12 @@ export default {
         }
       }
     }
+   /deep/.fontRed{
+     color:red;
+   }
+   /deep/.fontGreen{
+     color:green;
+   }
   }
+
 </style>