Pārlūkot izejas kodu

Merge branch 'develop_yh31' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into pre-release

lilei 1 gadu atpakaļ
vecāks
revīzija
a27b5da273
45 mainītis faili ar 2575 papildinājumiem un 1923 dzēšanām
  1. BIN
      public/templ/促销规则导入特价产品(打折).xlsx
  2. BIN
      public/templ/促销规则导入特价产品(直降).xlsx
  3. BIN
      public/templ/费用明细模板.xlsx
  4. 10 8
      src/api/promotion.js
  5. 8 0
      src/api/salesDetailNew.js
  6. 5 2
      src/components/UploadFile/index.vue
  7. 2 0
      src/libs/tools.js
  8. 11 9
      src/views/common/chooseBrandModal.vue
  9. 1 1
      src/views/common/otherTransactions.js
  10. 2 2
      src/views/expenseManagement/expenseReimbursement/add.vue
  11. 7 1
      src/views/expenseManagement/expenseReimbursement/baseDataModal.vue
  12. 23 23
      src/views/expenseManagement/expenseReimbursement/detail.vue
  13. 8 1
      src/views/expenseManagement/expenseReimbursement/epenseCdfModal.vue
  14. 4 1
      src/views/expenseManagement/expenseReimbursement/epenseDetailModal.vue
  15. 1 1
      src/views/expenseManagement/expenseReimbursement/importGuideModal.vue
  16. 186 170
      src/views/expenseManagement/expenseReimbursement/list.vue
  17. 178 172
      src/views/expenseManagement/expenseReimbursementDetail/list.vue
  18. 73 6
      src/views/promotionRulesManagement/dealerPromotions/addModal.vue
  19. 29 12
      src/views/promotionRulesManagement/dealerPromotions/chooseImportModal.vue
  20. 50 37
      src/views/promotionRulesManagement/dealerPromotions/detail.vue
  21. 160 54
      src/views/promotionRulesManagement/dealerPromotions/detailModal.vue
  22. 7 3
      src/views/promotionRulesManagement/dealerPromotions/editActiveEndTime.vue
  23. 1 1
      src/views/promotionRulesManagement/dealerPromotions/importDealerModa.vue
  24. 22 8
      src/views/promotionRulesManagement/dealerPromotions/importGuideModal.vue
  25. 24 6
      src/views/promotionRulesManagement/dealerPromotions/list.vue
  26. 277 174
      src/views/promotionRulesManagement/dealerPromotions/sendAmountModal.vue
  27. 307 195
      src/views/promotionRulesManagement/dealerPromotions/sendProductsModal.vue
  28. 304 104
      src/views/promotionRulesManagement/dealerPromotions/specialOfferModal.vue
  29. 45 37
      src/views/promotionRulesManagement/dealerPromotions/tableType1.vue
  30. 0 611
      src/views/promotionRulesManagement/dealerPromotions/tableType2.vue
  31. 190 79
      src/views/promotionRulesManagement/dealerPromotions/tableType3.vue
  32. 3 4
      src/views/purchasingManagement/purchaseReturn/queryPart.vue
  33. 35 17
      src/views/reportData/promotionSalesRealTimeReport/index.vue
  34. 42 42
      src/views/reportData/promotionSalesRealTimeReport/list.vue
  35. 1 1
      src/views/reportData/tireSalesReport/list.vue
  36. 231 0
      src/views/reportData/tireSalesReport/subareaList.vue
  37. 13 7
      src/views/salesManagement/salesQueryNew/comps/activeQueryPart.vue
  38. 18 5
      src/views/salesManagement/salesQueryNew/comps/detailProductList.vue
  39. 27 36
      src/views/salesManagement/salesQueryNew/comps/productList.vue
  40. 21 4
      src/views/salesManagement/salesQueryNew/detail.vue
  41. 10 4
      src/views/salesManagement/salesQueryNew/edit.vue
  42. 100 72
      src/views/salesManagement/salesQueryNew/list.vue
  43. 21 1
      src/views/salesManagement/waitDispatchNew/edit.vue
  44. 117 11
      src/views/salesManagement/waitDispatchNew/queryPart.vue
  45. 1 1
      vue.config.js

BIN
public/templ/促销规则导入特价产品(打折).xlsx


BIN
public/templ/促销规则导入特价产品(直降).xlsx


BIN
public/templ/费用明细模板.xlsx


+ 10 - 8
src/api/promotion.js

@@ -64,7 +64,7 @@ export const getRuleQueryList = (params) => {
 // 新增一行
 export const getNewScopeSn = (params) => {
   return axios({
-    url: '/promotion/rule/getNewScopeSn',
+    url: '/promotion/getNewSn',
     data: params,
     method: 'get'
   })
@@ -129,28 +129,30 @@ export const promotionIsOver = (params) => {
 
 // 导出门槛产品错误项
 export const downNormalFail = (params) => {
-  const url = `/promotion/downNormalFail`
+  const paramsNew = params.unLoadData
   return axios.request({
-    url: url,
+    url: '/promotion/rule/downNormalFail',
     method: 'post',
-    data: params,
+    data: paramsNew,
     responseType: 'blob'
   })
 }
 // 导出促销产品错误项
 export const downSpecialFail = (params) => {
-  const url = `/promotion/downSpecialFail`
+  const url = `/promotion/rule/downSpecialFail/${params.discountType}`
+  delete params.discountType
+  const paramsNew = params.unLoadData
   return axios.request({
     url: url,
     method: 'post',
-    data: params,
+    data: paramsNew,
     responseType: 'blob'
   })
 }
 
-// 导入参与客户   导出错误项
+// 参与客户   导出错误项 (经销商)
 export const downDealerFail = (params) => {
-  const url = `/promotion/downDealerFail`
+  const url = `/promotion/dealer/downDealerFail`
   return axios.request({
     url: url,
     method: 'post',

+ 8 - 0
src/api/salesDetailNew.js

@@ -32,6 +32,14 @@ export const salesDetailBatchDel = (params) => {
     method: 'post'
   })
 }
+// 批量转采购额
+export const batchTransferOfPurchaseAmount = (params) => {
+  return axios({
+    url: `/sales/detail/batchTransferOfPurchaseAmount`,
+    data: params,
+    method: 'post'
+  })
+}
 // 仓库设置
 export const updateWarehouse = (params) => {
     return axios({

+ 5 - 2
src/components/UploadFile/index.vue

@@ -90,6 +90,9 @@ export default {
       if (a == undefined) {
         this.fileList = []
       }
+    },
+    uploadParams (val) {
+      this.params = val
     }
   },
   data () {
@@ -108,7 +111,7 @@ export default {
     const _this = this
     this.$nextTick(() => {
       const el = document.querySelector('.ant-upload-list-picture-card')
-      if(el){
+      if (el) {
         const sortable = Sortable.create(el, {
           onEnd: function (evt) {
             console.log(evt.oldIndex, evt.newIndex)
@@ -116,7 +119,7 @@ export default {
             console.log(a.split(','))
             const ret = moveElement(a.split(','), evt.oldIndex, evt.newIndex)
             console.log(ret)
-        
+
             _this.$emit('change', ret.join(','))
             _this.$emit('input', ret.join(','))
           }

+ 2 - 0
src/libs/tools.js

@@ -7,6 +7,7 @@ export const getOperationalPrecision = (num1, num2) => {
 export const boldAmounts = (text) => {
     let regex = /(\d+\.?\d*)元/g;
     let regex5 = /(\d+\.?\d*)件/g;
+    let regex6 = /(\d+\.?\d*)个/g;
     let regex1 = /再满(\d+\.?\d*)元,可享受优惠/g;
     let regex4 = /再满(\d+\.?\d*)件产品可享受优惠/g;
     let regex2 = /(\d+\.?\d*)(/g
@@ -15,6 +16,7 @@ export const boldAmounts = (text) => {
     rext = rext.replace(regex4, '<b>再满$1件产品可享受优惠</b>');
     rext = rext.replace(regex, '<span>$1</span>元');
     rext = rext.replace(regex5, '<span>$1</span>件');
+    rext = rext.replace(regex6, '<span>$1</span>个');
     rext = rext.replace(regex2, '<span>$1</span>(');
     rext = rext.replace(regex3, '选择<span>$1</span>个');
     return rext;

+ 11 - 9
src/views/common/chooseBrandModal.vue

@@ -229,13 +229,12 @@ export default {
       const _this = this
       productBrandQuery({}).then(res => {
         if (res.status == 200) {
-          _this.brandList = res.data
           if (_this.chooseData && _this.chooseData.length > 0) {
             const checkedList = []
             _this.chooseData.map(item => {
               checkedList.push(item.goodsSn)
             })
-            this.brandList.map(item => {
+            res.data.map(item => {
               if (checkedList.includes(item.brandSn)) {
                 item.checked = true
               } else {
@@ -243,6 +242,16 @@ export default {
               }
             })
           }
+          if (_this.disabledList && _this.disabledList.length > 0) {
+            res.data.map(item => {
+              if (_this.disabledList.includes(item.brandSn)) {
+                item.isDisabled = true
+              } else {
+                item.isDisabled = false
+              }
+            })
+          }
+          _this.brandList = res.data
         } else {
           this.brandList = []
         }
@@ -251,13 +260,6 @@ export default {
     // 禁用
     handleDisabled (list) {
       this.disabledList = list
-      this.brandList.map(item => {
-        if (list.includes(item.brandSn)) {
-          item.isDisabled = true
-        } else {
-          item.isDisabled = false
-        }
-      })
     }
   },
   watch: {

+ 1 - 1
src/views/common/otherTransactions.js

@@ -27,7 +27,7 @@ const Employee = {
     },
     placeholder: {
       type: String,
-      default: '请选择其它往来机构'
+      default: '请选择其他往来单位'
     },
     enableFlag: {
       type: String,

+ 2 - 2
src/views/expenseManagement/expenseReimbursement/add.vue

@@ -23,7 +23,7 @@
           <a-descriptions-item label="费用单号">{{ detailData&&detailData.expenseAccountNo || '--' }}</a-descriptions-item>
           <a-descriptions-item label="申请人">{{ detailData&&detailData.applyPersonName || '--' }}</a-descriptions-item>
           <a-descriptions-item label="申请部门">{{ detailData&&detailData.applyDepartmentName || '--' }}</a-descriptions-item>
-          <a-descriptions-item label="费用类型">{{ detailData&&detailData.expenseTypeName || '--' }}<span v-if="detailData&&detailData.expenseType2">/{{ detailData&&detailData.expenseTypeName2 || '--' }}</span></a-descriptions-item>
+          <a-descriptions-item label="费用类型">{{ detailData&&detailData.expenseTypeName || '--' }}<span v-if="detailData&&detailData.expenseType2">/{{ detailData&&detailData.expenseTypeName2 || '--' }}</span><span v-if="detailData&&detailData.expenseType3">/{{ detailData&&detailData.expenseTypeName3 || '--' }}</span></a-descriptions-item>
           <a-descriptions-item label="费用发生月份">{{ detailData&&detailData.expenseDate?detailData.expenseDate.substring(0, 7) : '--' }}</a-descriptions-item>
           <a-descriptions-item label="合计金额">{{ (detailData.applyExpenseTotal || detailData.applyExpenseTotal == 0) ? toThousands(detailData.applyExpenseTotal)+' 元' : '--' }}</a-descriptions-item>
           <a-descriptions-item label="状态">{{ detailData&&detailData.stateDictValue || '--' }}</a-descriptions-item>
@@ -162,7 +162,7 @@ import ImportGuideModal from './importGuideModal.vue'
 import chooseDepartUserModal from './chooseDepartUserModal.vue'
 import { expenseAccountDetail, expenseAcctDetailDelete, expenseAcctDetailFindList, expenseAccountSubmit, expenseInsertImport } from '@/api/expenseManagement.js'
 export default {
-  name: 'expenseReimbursementEdit',
+  name: 'ExpenseReimbursementEdit',
   mixins: [commonMixin],
   components: { VSelect, Upload, STable, epenseDetailModal, productInfoModal, baseDataModal, ImportGuideModal, chooseDepartUserModal },
   data () {

+ 7 - 1
src/views/expenseManagement/expenseReimbursement/baseDataModal.vue

@@ -134,8 +134,10 @@ export default {
         applyDepartmentSn: undefined, //  申请部门
         expenseType: undefined, //  费用类型1
         expenseType2: undefined, //  费用类型2
+        expenseType3: undefined, // 费用类型3
         expenseTypeName: undefined, //  费用类型1
         expenseTypeName2: undefined, //  费用类型2
+        expenseTypeName3: undefined, // 费用类型3
         expenseDate: moment().locale('zh-cn').format('YYYY-MM'), //  费用产生月
         title: '', // 主题
         content: '' // 费用说明
@@ -183,8 +185,10 @@ export default {
         applyDepartmentSn: undefined, //  申请部门
         expenseType: undefined, //  费用类型1
         expenseType2: undefined, //  费用类型2
+        expenseType3: undefined, // 费用类型3
         expenseTypeName: undefined, //  费用类型1
         expenseTypeName2: undefined, //  费用类型2
+        expenseTypeName3: undefined, // 费用类型3
         expenseDate: moment().locale('zh-cn').format('YYYY-MM'), //  费用产生月
         title: '', // 主题
         content: '' // 费用说明
@@ -220,9 +224,11 @@ export default {
       this.expenseTypes = val || []
       this.form.expenseType = val && val[0] ? val[0] : ''
       this.form.expenseType2 = val && val[1] ? val[1] : ''
+      this.form.expenseType3 = val && val[2] ? val[2] : ''
       // 名称
       this.form.expenseTypeName = opts && opts[0] ? opts[0].name : ''
       this.form.expenseTypeName2 = opts && opts[1] ? opts[1].name : ''
+      this.form.expenseTypeName3 = opts && opts[2] ? opts[2].name : ''
     },
     //  附件上传
     changeAttach (file) {
@@ -245,7 +251,7 @@ export default {
         this.$refs.attachList.setFileList(this.attachList)
       }
       setTimeout(()=>{
-        this.expenseTypes = data.expenseType ? [this.form.expenseType, this.form.expenseType2] : []
+        this.expenseTypes = data.expenseType ? [this.form.expenseType, this.form.expenseType2, this.form.expenseType3] : []
       }, 500)
     },
     //  详情

+ 23 - 23
src/views/expenseManagement/expenseReimbursement/detail.vue

@@ -34,28 +34,28 @@
       </a-page-header>
       <!-- 基础信息 -->
       <a-card size="small" :bordered="false" class="expenseManagementDetail-cont" v-show="showDetail">
-         <a-descriptions size="small" :column="{ xs: 2, sm: 3, md: 4}" v-if="detailData">
-           <a-descriptions-item label="费用单号">{{ detailData&&detailData.expenseAccountNo || '--' }}</a-descriptions-item>
-           <a-descriptions-item label="申请人">{{ detailData&&detailData.applyPersonName || '--' }}</a-descriptions-item>
-           <a-descriptions-item label="申请部门">{{ detailData&&detailData.applyDepartmentName || '--' }}</a-descriptions-item>
-           <a-descriptions-item label="费用类型">{{ detailData&&detailData.expenseTypeName || '--' }}<span v-if="detailData&&detailData.expenseType2">/{{ detailData&&detailData.expenseTypeName2 || '--' }}</span></a-descriptions-item>
-           <a-descriptions-item label="费用发生月份">{{ detailData&&detailData.expenseDate?detailData.expenseDate.substring(0, 7) : '--' }}</a-descriptions-item>
-           <a-descriptions-item label="合计金额">{{ (detailData.applyExpenseTotal || detailData.applyExpenseTotal == 0) ? toThousands(detailData.applyExpenseTotal)+' 元' : '--' }}</a-descriptions-item>
-           <a-descriptions-item label="状态">{{ detailData&&detailData.stateDictValue || '--' }}</a-descriptions-item>
-           <a-descriptions-item label="打印状态">{{ detailData&&detailData.printStatusDictValue || '--' }}</a-descriptions-item>
-           <a-descriptions-item label="创建时间">{{ detailData&&detailData.createDate || '--' }}</a-descriptions-item>
-           <a-descriptions-item label="审核时间">{{ detailData&&detailData.finishDate || '--' }}</a-descriptions-item>
-           <a-descriptions-item label="关联单号" v-if="detailData&&detailData.bizNo">{{ detailData&&detailData.bizNo || '--' }}</a-descriptions-item>
-           <a-descriptions-item label="主题" :span="3">{{ detailData&&detailData.title || '--' }}</a-descriptions-item>
-           <a-descriptions-item label="详细说明" :span="4">
-             {{ detailData.content.join(',')||'' }}
-           </a-descriptions-item>
-           <a-descriptions-item label="附件" :span="4">
-             <a target="_blank" style="color: #00aaff;text-decoration: underline;margin-right: 15px;" :href="item.filePath" v-for="item in detailData.expenseAccountFilesList" :key="item.id">
-               {{ item.fileName }}
-             </a>
-           </a-descriptions-item>
-         </a-descriptions>
+        <a-descriptions size="small" :column="{ xs: 2, sm: 3, md: 4}" v-if="detailData">
+          <a-descriptions-item label="费用单号">{{ detailData&&detailData.expenseAccountNo || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="申请人">{{ detailData&&detailData.applyPersonName || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="申请部门">{{ detailData&&detailData.applyDepartmentName || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="费用类型">{{ detailData&&detailData.expenseTypeName || '--' }}<span v-if="detailData&&detailData.expenseType2">/{{ detailData&&detailData.expenseTypeName2 || '--' }}</span><span v-if="detailData&&detailData.expenseType3">/{{ detailData&&detailData.expenseTypeName3 || '--' }}</span></a-descriptions-item>
+          <a-descriptions-item label="费用发生月份">{{ detailData&&detailData.expenseDate?detailData.expenseDate.substring(0, 7) : '--' }}</a-descriptions-item>
+          <a-descriptions-item label="合计金额">{{ (detailData.applyExpenseTotal || detailData.applyExpenseTotal == 0) ? toThousands(detailData.applyExpenseTotal)+' 元' : '--' }}</a-descriptions-item>
+          <a-descriptions-item label="状态">{{ detailData&&detailData.stateDictValue || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="打印状态">{{ detailData&&detailData.printStatusDictValue || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="创建时间">{{ detailData&&detailData.createDate || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="审核时间">{{ detailData&&detailData.finishDate || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="关联单号" v-if="detailData&&detailData.bizNo">{{ detailData&&detailData.bizNo || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="主题" :span="3">{{ detailData&&detailData.title || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="详细说明" :span="4">
+            {{ detailData.content.join(',')||'' }}
+          </a-descriptions-item>
+          <a-descriptions-item label="附件" :span="4">
+            <a target="_blank" style="color: #00aaff;text-decoration: underline;margin-right: 15px;" :href="item.filePath" v-for="item in detailData.expenseAccountFilesList" :key="item.id">
+              {{ item.fileName }}
+            </a>
+          </a-descriptions-item>
+        </a-descriptions>
       </a-card>
       <a-card size="small" :bordered="false" class="pages-wrap">
         <a-alert type="info" style="margin-bottom:10px">
@@ -136,7 +136,7 @@ export default {
       baseData: null,
       showTipModal: false,
       showDetail: false,
-      printType:'',
+      printType: '',
       count: 0,
       columns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },

+ 8 - 1
src/views/expenseManagement/expenseReimbursement/epenseCdfModal.vue

@@ -48,6 +48,12 @@
                 enableFlag="1"
                 v-model="record.splitObjSn"
                 placeholder="请选择(输入名称搜索)"></supplier>
+              <!-- 其它往来 -->
+              <otherTransactions 
+              style="width: 100%;"
+              v-show="record.splitObjType=='OTHER_ORG'" 
+              v-model="record.splitObjSn" 
+              placeholder="请选择(输入名称搜索)"></otherTransactions>
               <span v-if="!record.splitObjType">--</span>
             </template>
             <!-- 费用承担金额 -->
@@ -131,8 +137,9 @@ import department from './department.js'
 import employee from './employee.js'
 import custList from '@/views/common/custList.vue'
 import supplier from '@/views/common/supplier.js'
+import otherTransactions from '@/views/common/otherTransactions.js'
 export default {
-  components: { VSelect, department, employee, custList, supplier },
+  components: { VSelect, department, employee, custList, supplier, otherTransactions },
   name: 'EpenseCdfModal',
   props: {
     list: { //  弹框显示状态

+ 4 - 1
src/views/expenseManagement/expenseReimbursement/epenseDetailModal.vue

@@ -38,6 +38,8 @@
                   <custList v-show="form.accountType=='CUSTOMER'" cooperateFlag="1" ref="custList" @change="accountNameSnChange" placeholder="请选择记账名称(输入名称搜索)"></custList>
                   <!-- 供应商 -->
                   <supplier v-show="form.accountType=='OUT_ACCOUNT'" enableFlag="1" @change="accountNameSnChange" v-model="form.accountNameSn" placeholder="请选择记账名称(输入名称搜索)"></supplier>
+                  <!-- 其它往来 -->
+                  <otherTransactions v-show="form.accountType=='OTHER_ACCOUNT'" @change="accountNameSnChange" v-model="form.accountNameSn" placeholder="请选择记账名称(输入名称搜索)"></otherTransactions>
                   <span v-if="!form.accountType">
                     <a-select style="width: 100%" placeholder="请选择记账名称">
                       <a-select-option value="" :disabled="true">
@@ -118,11 +120,12 @@ import subarea from '@/views/common/subarea.js'
 import Area from '@/views/common/area.js'
 import custList from '@/views/common/custList.vue'
 import supplier from '@/views/common/supplier.js'
+import otherTransactions from '@/views/common/otherTransactions.js'
 import department from './department.js'
 import { expenseAcctDetailSave, expenseAcctDetailFindBySn } from '@/api/expenseManagement.js'
 export default {
   name: 'EpenseDetailModal',
-  components: { VSelect, subarea, Area, epenseCdfModal, custList, supplier, department },
+  components: { VSelect, subarea, Area, epenseCdfModal, custList, supplier, department, otherTransactions },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,

+ 1 - 1
src/views/expenseManagement/expenseReimbursement/importGuideModal.vue

@@ -90,7 +90,7 @@ export default {
         savePathType: 'local'
       },
       exportLoading: false,
-      filePath: location.protocol + '//' +location.host + '/templ/费用明细模板.xlsx'
+      filePath: location.protocol + '//' +location.host + '/templ/费用明细模板.xlsx' + '?a=' + new Date().getTime()
     }
   },
   methods: {

+ 186 - 170
src/views/expenseManagement/expenseReimbursement/list.vue

@@ -1,32 +1,32 @@
 <template>
   <div>
-  <a-card size="small" :bordered="false" class="searchBoxNormal">
-    <!-- 搜索条件 -->
-    <div ref="tableSearch" class="table-page-search-wrapper">
-      <a-form layout="inline">
-        <a-row :gutter="15">
-          <a-col :md="6" :sm="24">
-            <a-form-item label="费用单号" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-              <a-input id="salesManagementList-expenseAccountNo" v-model.trim="queryParam.expenseAccountNo" allowClear placeholder="请输入销售单号"/>
-            </a-form-item>
-          </a-col>
-          <a-col :md="4" :sm="24">
-            <a-form-item label="申请人" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-              <employee style="width: 100%;" id="salesManagementList-Employee" v-model="queryParam.applyPersonSn"></employee>
-            </a-form-item>
-          </a-col>
-          <a-col :md="4" :sm="24">
-            <a-form-item label="费用类型">
-              <expenseType
-                id="salesManagementList-expenseType"
-                :changeOnSelect="true"
-                v-model="expenseTypes"
-                @change="expenseChange"
-                placeholder="请选择费用类型"
-              ></expenseType>
-            </a-form-item>
-          </a-col>
-          <a-col :md="4" :sm="24">
+    <a-card size="small" :bordered="false" class="searchBoxNormal">
+      <!-- 搜索条件 -->
+      <div ref="tableSearch" class="table-page-search-wrapper">
+        <a-form layout="inline">
+          <a-row :gutter="15">
+            <a-col :md="6" :sm="24">
+              <a-form-item label="费用单号" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+                <a-input id="salesManagementList-expenseAccountNo" v-model.trim="queryParam.expenseAccountNo" allowClear placeholder="请输入销售单号"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="4" :sm="24">
+              <a-form-item label="申请人" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+                <employee style="width: 100%;" id="salesManagementList-Employee" v-model="queryParam.applyPersonSn"></employee>
+              </a-form-item>
+            </a-col>
+            <a-col :md="4" :sm="24">
+              <a-form-item label="费用类型">
+                <expenseType
+                  id="salesManagementList-expenseType"
+                  :changeOnSelect="true"
+                  v-model="expenseTypes"
+                  @change="expenseChange"
+                  placeholder="请选择费用类型"
+                ></expenseType>
+              </a-form-item>
+            </a-col>
+            <a-col :md="4" :sm="24">
               <a-form-item label="费用发生月份">
                 <a-month-picker
                   placeholder="请选择月份"
@@ -37,138 +37,149 @@
                   style="width: 100%;"/>
               </a-form-item>
             </a-col>
-          <template v-if="advanced">
+            <template v-if="advanced">
+              <a-col :md="6" :sm="24">
+                <a-form-item label="主题">
+                  <a-input id="salesManagementList-title" v-model.trim="queryParam.title" allowClear placeholder="请输入主题"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="4" :sm="24">
+                <a-form-item label="打印状态">
+                  <v-select
+                    v-model="queryParam.printStatus"
+                    ref="printStatus"
+                    id="pushOrder-printStatus"
+                    code="EXPENSE_ACCOUNT_PRINT_STATUS"
+                    placeholder="请选择打印状态"
+                    allowClear></v-select>
+                </a-form-item>
+              </a-col>
+              <a-col :md="4" :sm="24">
+                <a-form-item label="状态">
+                  <v-select
+                    v-model="queryParam.state"
+                    ref="state"
+                    id="salesManagementList-state"
+                    code="EXPENSE_STATE"
+                    placeholder="请选择状态"
+                    allowClear></v-select>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="销售单号">
+                  <a-input id="salesManagementList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
+                </a-form-item>
+              </a-col>
+            </template>
             <a-col :md="6" :sm="24">
-              <a-form-item label="主题">
-                <a-input id="salesManagementList-title" v-model.trim="queryParam.title" allowClear placeholder="请输入主题"/>
-              </a-form-item>
-            </a-col>
-            <a-col :md="4" :sm="24">
-              <a-form-item label="打印状态">
-                <v-select
-                  v-model="queryParam.printStatus"
-                  ref="printStatus"
-                  id="pushOrder-printStatus"
-                  code="EXPENSE_ACCOUNT_PRINT_STATUS"
-                  placeholder="请选择打印状态"
-                  allowClear></v-select>
-              </a-form-item>
-            </a-col>
-            <a-col :md="4" :sm="24">
-              <a-form-item label="状态">
-                <v-select
-                  v-model="queryParam.state"
-                  ref="state"
-                  id="salesManagementList-state"
-                  code="EXPENSE_STATE"
-                  placeholder="请选择状态"
-                  allowClear></v-select>
-              </a-form-item>
+              <span class="table-page-search-submitButtons">
+                <a-button type="primary" :disabled="disabled" @click="searchForm">查询</a-button>
+                <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
+                <a @click="advanced=!advanced" style="margin-left: 8px">
+                  {{ advanced ? '收起' : '展开' }}
+                  <a-icon :type="advanced ? 'up' : 'down'"/>
+                </a>
+              </span>
             </a-col>
-          </template>
-          <a-col :md="6" :sm="24">
-            <span class="table-page-search-submitButtons">
-              <a-button type="primary" :disabled="disabled" @click="searchForm">查询</a-button>
-              <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
-              <a @click="advanced=!advanced" style="margin-left: 8px">
-                {{ advanced ? '收起' : '展开' }}
-                <a-icon :type="advanced ? 'up' : 'down'"/>
-              </a>
-            </span>
-          </a-col>
-        </a-row>
-      </a-form>
-    </div>
-  </a-card>
-  <a-card size="small" :bordered="false" class="salesManagementList-wrap">
-    <a-spin :spinning="spinning" tip="Loading...">
-      <!-- 操作按钮 -->
-      <div class="table-operator">
-        <a-button type="primary" v-if="$hasPermissions('B_eRNew')" @click="handleEdit()">新增</a-button>
-        <a-button type="primary" :loading="spinning" @click="handlePlPrint()" ghost>批量打印</a-button>
-        <span style="margin-left: 8px">
-          <template v-if="rowSelectionInfo && rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
-        </span>
+          </a-row>
+        </a-form>
       </div>
-      <!-- 列表 -->
-      <s-table
-        class="sTable fixPagination"
-        ref="table"
-        :row-selection="$hasPermissions('B_eRPrint')?{ columnWidth: '4%', getCheckboxProps: record => ({ props: { disabled: false } })}:null"
-        @rowSelection="rowSelectionFun"
-        :style="{ height: tableHeight+70+'px' }"
-        size="small"
-        :rowKey="(record) => record.id"
-        :columns="columns"
-        :pageSize="30"
-        :data="loadData"
-        :scroll="{ y: tableHeight }"
-        :defaultLoadData="false"
-        bordered>
-        <!-- 单号 -->
-        <template slot="expenseAccountNo" slot-scope="text, record">
-          <span v-if="$hasPermissions('B_eRdetail')" class="link-bule" @click="handleDetail(record)">{{ record.expenseAccountNo }}</span>
-          <div v-else>{{ record.expenseAccountNo||'--' }}</div>
-        </template>
-        <!-- 总数量 -->
-        <template slot="totalQty" slot-scope="text, record">
-          {{ record.totalQty }}
-        </template>
-        <!-- 费用类型 -->
-        <template slot="expenseType" slot-scope="text, record">
-          <div>{{ record.expenseTypeName || '--' }}<span v-if="record.expenseType2">/{{ record.expenseTypeName2 || '--' }}</span></div>
-        </template>
-        <!-- 操作 -->
-        <template slot="action" slot-scope="text, record">
-          <a-button
-            v-if="record.state=='WAIT_SUBMIT'&&$hasPermissions('B_ERtEdit')"
-            size="small"
-            type="link"
-            class="button-info"
-            @click="handleEdit(record)"
-          >
-            编辑
-          </a-button>
-          <a-button
-            v-if="record.state=='WAIT_SUBMIT'&&$hasPermissions('B_ERDel')"
-            size="small"
-            type="link"
-            class="button-error"
-            @click="handleDel(record)"
-          >
-            删除
-          </a-button>
-          <a-button
-            v-if="record.state!='WAIT_SUBMIT'&&$hasPermissions('B_ERAudit')"
-            size="small"
-            type="link"
-            class="button-info"
-            @click="handleSH(record)"
-          >
-            审核进度
-          </a-button>
-          <a-button
-            v-if="record.state=='AUDIT_REJECT'"
-            size="small"
-            type="link"
-            class="button-info"
-            @click="againEdit(record)"
-          >
-            再次编辑
-          </a-button>
+    </a-card>
+    <a-card size="small" :bordered="false" class="salesManagementList-wrap">
+      <a-spin :spinning="spinning" tip="Loading...">
+        <!-- 操作按钮 -->
+        <div class="table-operator">
+          <a-button type="primary" v-if="$hasPermissions('B_eRNew')" @click="handleEdit()">新增</a-button>
+          <a-button type="primary" :loading="spinning" @click="handlePlPrint()" ghost>批量打印</a-button>
+          <span style="margin-left: 8px">
+            <template v-if="rowSelectionInfo && rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
+          </span>
+        </div>
+        <!-- 列表 -->
+        <s-table
+          class="sTable fixPagination"
+          ref="table"
+          :row-selection="$hasPermissions('B_eRPrint')?{ columnWidth: '4%', getCheckboxProps: record => ({ props: { disabled: false } })}:null"
+          @rowSelection="rowSelectionFun"
+          :style="{ height: tableHeight+70+'px' }"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :pageSize="30"
+          :data="loadData"
+          :scroll="{ y: tableHeight }"
+          :defaultLoadData="false"
+          bordered>
+          <!-- 单号 -->
+          <template slot="expenseAccountNo" slot-scope="text, record">
+            <span v-if="$hasPermissions('B_eRdetail')" class="link-bule" @click="handleDetail(record)">{{ record.expenseAccountNo }}</span>
+            <div v-else>{{ record.expenseAccountNo||'--' }}</div>
+          </template>
+          <!-- 总数量 -->
+          <template slot="totalQty" slot-scope="text, record">
+            {{ record.totalQty }}
+          </template>
+          <!-- 费用类型 -->
+          <template slot="expenseType" slot-scope="text, record">
+            <div>{{ record.expenseTypeName || '--' }}<span v-if="record.expenseType2">/{{ record.expenseTypeName2 || '--' }}</span><span v-if="record.expenseType3">/{{ record.expenseTypeName3 || '--' }}</span></div>
+          </template>
+          <!-- 操作 -->
+          <template slot="action" slot-scope="text, record">
+            <a-button
+              v-if="record.state=='WAIT_SUBMIT'&&$hasPermissions('B_ERtEdit')"
+              size="small"
+              type="link"
+              class="button-info"
+              @click="handleEdit(record)"
+            >
+              编辑
+            </a-button>
+            <a-button
+              v-if="record.state=='WAIT_SUBMIT'&&$hasPermissions('B_ERDel')"
+              size="small"
+              type="link"
+              class="button-error"
+              @click="handleDel(record)"
+            >
+              删除
+            </a-button>
+            <a-button
+              v-if="record.state!='WAIT_SUBMIT'&&$hasPermissions('B_ERAudit')"
+              size="small"
+              type="link"
+              class="button-info"
+              @click="handleSH(record)"
+            >
+              审核进度
+            </a-button>
+            <a-button
+              v-if="record.state=='AUDIT_REJECT'"
+              size="small"
+              type="link"
+              class="button-info"
+              @click="againEdit(record)"
+            >
+              再次编辑
+            </a-button>
           <!-- <span v-if="record.state=='AUDIT_REJECT' || record.state=='AUDIT_PASS'">--</span> -->
-        </template>
-      </s-table>
-    </a-spin>
-    <!-- 审核进度 -->
-    <verifyModal v-drag :openModal="openModal" :itemSn="itemSn" @close="openModal=false"></verifyModal>
-    <!-- 新增 -->
-    <baseDataModal :show="openBaseModal" @close="openBaseModal=false"></baseDataModal>
-    <!-- 打印预览 -->
-    <commonModal modalTit="费用报销单打印预览" width="700pt" okText="立即打印" :openModal="showTipModal" @cancel="showTipModal=false" @ok="$refs.printModal.prints()">
-      <previewModal v-if="showTipModal" ref="printModal" @printOk="printOk"></previewModal>
-    </commonModal>
-  </a-card>
+          </template>
+        </s-table>
+      </a-spin>
+      <!-- 审核进度 -->
+      <verifyModal v-drag :openModal="openModal" :itemSn="itemSn" @close="openModal=false"></verifyModal>
+      <!-- 新增 -->
+      <baseDataModal :show="openBaseModal" @close="openBaseModal=false"></baseDataModal>
+      <!-- 打印预览 -->
+      <commonModal
+        modalTit="费用报销单打印预览"
+        width="700pt"
+        okText="立即打印"
+        :openModal="showTipModal"
+        @cancel="showTipModal=false"
+        @ok="$refs.printModal.prints()">
+        <previewModal v-if="showTipModal" ref="printModal" @printOk="printOk"></previewModal>
+      </commonModal>
+    </a-card>
   </div>
 </template>
 
@@ -191,7 +202,7 @@ export default {
   mixins: [commonMixin],
   components: { STable, VSelect, subarea, verifyModal, baseDataModal, employee, expenseType, previewModal, commonModal },
   data () {
-    let _this=this
+    const _this = this
     return {
       locale,
       spinning: false,
@@ -210,8 +221,10 @@ export default {
         title: '', //  主题
         expenseType: undefined, // 费用类型
         expenseType2: undefined, // 费用类型2
+        expenseType3: undefined, // 费用类型3
         printStatus: undefined, // 打印状态
-        state: undefined // 状态
+        state: undefined, // 状态
+        salesBillNo: ''// 销售单号
       },
       columns: [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
@@ -261,25 +274,25 @@ export default {
     rowSelectionFun (obj) {
       this.rowSelectionInfo = obj || null
     },
-    printOk(data){
-      if(data&&data.status == 200){
+    printOk (data) {
+      if (data && data.status == 200) {
         const rows = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || []
         const ret = []
         rows.map(item => {
           ret.push({
             id: item.id,
-            printStatus:"PRINT"
+            printStatus: 'PRINT'
           })
         })
         expenseAccountUpdateBatch(ret).then(res => {
-          if(res.status == 200){
+          if (res.status == 200) {
             this.$refs.table.refresh()
             this.$refs.table.clearSelected()
           }
           this.spinning = false
           this.showTipModal = false
         })
-      }else{
+      } else {
         this.spinning = false
       }
     },
@@ -295,12 +308,12 @@ export default {
       this.spinning = true
       const pageData = []
       const businessSnList = []
-      
-      for(let i=0;i<rows.length;i++){
+
+      for (let i = 0; i < rows.length; i++) {
         // 费用明细
         const fyListData = await expenseAcctDetailFindList({ expenseAccountSn: rows[i].expenseAccountSn }).then(res => res.data)
         // 审核明细,待提交状态不获取
-        if(rows[i].state != 'WAIT_SUBMIT'){
+        if (rows[i].state != 'WAIT_SUBMIT') {
           businessSnList.push(rows[i].expenseAccountSn)
         }
         pageData.push({
@@ -312,7 +325,7 @@ export default {
       // 获取审核进度信息
       const spListData = await getBatchLastProcessInstance({ 'businessType': 'EXPENSES', 'businessSnList': businessSnList }).then(res => res.data)
       pageData.map(item => {
-        if(spListData){
+        if (spListData) {
           const sp = spListData[item.expenseInfo.expenseAccountSn]
           item.spListData = sp ? sp.taskVOList : []
         }
@@ -320,7 +333,7 @@ export default {
       console.log(pageData)
       // 打开预览弹框
       this.showTipModal = true
-      this.$nextTick(()=>{
+      this.$nextTick(() => {
         this.$refs.printModal.setData(pageData)
         this.spinning = false
       })
@@ -336,6 +349,7 @@ export default {
       this.expenseTypes = val || []
       this.queryParam.expenseType = val && val[0] ? val[0] : ''
       this.queryParam.expenseType2 = val && val[1] ? val[1] : ''
+      this.queryParam.expenseType3 = val && val[2] ? val[2] : ''
     },
     // 详情
     handleDetail (row) {
@@ -396,7 +410,7 @@ export default {
         }
       })
     },
-    searchForm(){
+    searchForm () {
       this.$refs.table.refresh(true)
       this.$refs.table.clearSelected()
     },
@@ -408,9 +422,11 @@ export default {
         title: '', //  主题
         expenseType: undefined, // 费用类型
         expenseType2: undefined, // 费用类型2
+        expenseType3: undefined, // 费用类型3
         state: undefined, // 状态
-        printStatus:undefined,
-        applyPersonSn: undefined
+        printStatus: undefined,
+        applyPersonSn: undefined,
+        salesBillNo: ''// 销售单号
       }
       this.expenseTypes = []
       this.searchForm()

+ 178 - 172
src/views/expenseManagement/expenseReimbursementDetail/list.vue

@@ -1,185 +1,187 @@
 <template>
   <div>
-  <a-card size="small" :bordered="false" class="searchBoxNormal">
-    <!-- 搜索条件 -->
-    <div ref="tableSearch" class="table-page-search-wrapper">
-      <a-form layout="inline" ref="ruleForm">
-        <a-row :gutter="15">
-          <a-col :md="6" :sm="24">
-            <a-form-item label="审核时间">
-              <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="费用单号" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-              <a-input id="expenseReimbursementDetailList-expenseAccountNo" v-model.trim="queryParam.expenseAccountNo" allowClear placeholder="请输入费用单号"/>
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="申请人" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-              <employee style="width: 100%;" id="expenseReimbursementDetailList-applyPersonSn" @change="employeeChange" v-model="queryParam.applyPersonSn"></employee>
-            </a-form-item>
-          </a-col>
-          <template v-if="advanced">
+    <a-card size="small" :bordered="false" class="searchBoxNormal">
+      <!-- 搜索条件 -->
+      <div ref="tableSearch" class="table-page-search-wrapper">
+        <a-form layout="inline" ref="ruleForm">
+          <a-row :gutter="15">
             <a-col :md="6" :sm="24">
-              <a-form-item label="申请部门" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-                <department style="width: 100%;" id="expenseReimbursementDetailList-applyDepartmentSn" @change="applyDepartmentChange" v-model="queryParam.applyDepartmentSn"></department>
+              <a-form-item label="审核时间">
+                <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-item label="费用类型">
-                <expenseType
-                  id="expenseReimbursementDetailList-expenseType"
-                  v-model="expenseTypes"
-                  :changeOnSelect="true"
-                  @change="expenseChange"
-                  placeholder="请选择费用类型"
-                ></expenseType>
+              <a-form-item label="费用单号" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+                <a-input id="expenseReimbursementDetailList-expenseAccountNo" v-model.trim="queryParam.expenseAccountNo" allowClear placeholder="请输入费用单号"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-item label="费用发生月份">
-                <a-month-picker
-                  placeholder="请选择月份"
-                  v-model="queryParam.expenseDate"
-                  @change="onChange"
-                  :disabled-date="disabledDate"
-                  style="width: 100%;"/>
+              <a-form-item label="申请人" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+                <employee style="width: 100%;" id="expenseReimbursementDetailList-applyPersonSn" @change="employeeChange" v-model="queryParam.applyPersonSn"></employee>
               </a-form-item>
             </a-col>
+            <template v-if="advanced">
+              <a-col :md="6" :sm="24">
+                <a-form-item label="申请部门" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+                  <department style="width: 100%;" id="expenseReimbursementDetailList-applyDepartmentSn" @change="applyDepartmentChange" v-model="queryParam.applyDepartmentSn"></department>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="费用类型">
+                  <expenseType
+                    id="expenseReimbursementDetailList-expenseType"
+                    v-model="expenseTypes"
+                    :changeOnSelect="true"
+                    @change="expenseChange"
+                    placeholder="请选择费用类型"
+                  ></expenseType>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="费用发生月份">
+                  <a-month-picker
+                    placeholder="请选择月份"
+                    v-model="queryParam.expenseDate"
+                    @change="onChange"
+                    :disabled-date="disabledDate"
+                    style="width: 100%;"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="记账类型">
+                  <v-select
+                    v-model="queryParam.accountType"
+                    ref="accountType"
+                    id="expenseReimbursementDetailList-accountType"
+                    code="EXPENSE_ACCOUNT_TYPE"
+                    placeholder="请选择记账类型"
+                    allowClear></v-select>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="记账名称">
+                  <!-- 部门 -->
+                  <department v-show="queryParam.accountType=='INNER_ACCOUNT'" @change="accountNameSnChange" v-model="queryParam.accountNameSn" placeholder="请选择记账名称(输入名称搜索)"></department>
+                  <!-- 经销商 -->
+                  <custList v-show="queryParam.accountType=='CUSTOMER'" ref="custList" @change="accountNameSnChange" placeholder="请选择记账名称(输入名称搜索)"></custList>
+                  <!-- 供应商 -->
+                  <supplier v-show="queryParam.accountType=='OUT_ACCOUNT'" @change="accountNameSnChange" v-model="queryParam.accountNameSn" placeholder="请选择记账名称(输入名称搜索)"></supplier>
+                  <!-- 其它往来 -->
+                  <otherTransactions v-show="queryParam.accountType=='OTHER_ACCOUNT'" v-model="queryParam.accountNameSn" placeholder="请选择记账名称(输入名称搜索)"></otherTransactions>
+                  <a-select style="width: 100%" v-if="!queryParam.accountType" placeholder="请选择记账名称">
+                    <a-select-option value="" :disabled="true">
+                      请先选择记账类型
+                    </a-select-option>
+                  </a-select>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="所属区域">
+                  <a-input id="expenseReimbursementDetailList-subarea" v-model.trim="queryParam.subareaArea.subareaName" allowClear placeholder="请输入所属区域"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="所属分区">
+                  <a-input id="expenseReimbursementDetailList-subareaArea" v-model.trim="queryParam.subareaArea.subareaAreaName" allowClear placeholder="请输入所属分区"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="所属省份">
+                  <Area id="expenseReimbursementDetailList-area" placeholder="请选择所属省份" v-model="queryParam.provinceSn"></Area>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="所属城市">
+                  <Area id="expenseReimbursementDetailList-area" placeholder="请选择所属城市" leve="city" :parentId="queryParam.provinceSn" v-model="queryParam.citySn"></Area>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="费用承担方类型" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+                  <v-select
+                    code="EXPENSE_ACCOUNT_DETAIL_SPLIT_OBJ_TYPE"
+                    allowClear
+                    style="width: 100%;"
+                    v-model="queryParam.splitObjType"
+                    @change="splitObjTypeChange"
+                    placeholder="请选择承担方类型"
+                  ></v-select>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="费用承担方" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+                  <!-- 部门 -->
+                  <department v-show="queryParam.splitObjType=='DEPARTMENT'" style="width: 100%;" placeholder="请选择承担方" v-model="queryParam.splitObjSn"></department>
+                  <!-- 经销商 -->
+                  <custList v-show="queryParam.splitObjType=='CUSTOMER'" ref="custList" @change="custChange" placeholder="请选择(输入名称搜索)"></custList>
+                  <a-select style="width: 100%" v-if="!queryParam.splitObjType" placeholder="请选择">
+                    <a-select-option value="" :disabled="true">
+                      请先选择承担方类型
+                    </a-select-option>
+                  </a-select>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24" v-show="queryParam.splitObjType=='DEPARTMENT'">
+                <a-form-item label="费用承担人" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+                  <employee style="width: 100%;" placeholder="请选择承担人员" v-model="queryParam.childSplitObjSn"></employee>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24" v-show="queryParam.splitObjType==undefined">
+                <a-form-item label="费用承担人" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+                  <a-select style="width: 100%" placeholder="请选择">
+                    <a-select-option value="" :disabled="true">
+                      请先选择承担方类型
+                    </a-select-option>
+                  </a-select>
+                </a-form-item>
+              </a-col>
+            </template>
             <a-col :md="6" :sm="24">
-              <a-form-item label="记账类型">
-                <v-select
-                  v-model="queryParam.accountType"
-                  ref="accountType"
-                  id="expenseReimbursementDetailList-accountType"
-                  code="EXPENSE_ACCOUNT_TYPE"
-                  placeholder="请选择状态"
-                  allowClear></v-select>
-              </a-form-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="记账名称">
-                <!-- 部门 -->
-                <department v-show="queryParam.accountType=='INNER_ACCOUNT'" @change="accountNameSnChange" v-model="queryParam.accountNameSn" placeholder="请选择记账名称(输入名称搜索)"></department>
-                <!-- 经销商 -->
-                <custList v-show="queryParam.accountType=='CUSTOMER'" ref="custList" @change="accountNameSnChange" placeholder="请选择记账名称(输入名称搜索)"></custList>
-                <!-- 供应商 -->
-                <supplier v-show="queryParam.accountType=='OUT_ACCOUNT'" @change="accountNameSnChange" v-model="queryParam.accountNameSn" placeholder="请选择记账名称(输入名称搜索)"></supplier>
-                <a-select style="width: 100%" v-if="!queryParam.accountType" placeholder="请选择">
-                  <a-select-option value="" :disabled="true">
-                    请先选择记账类型
-                  </a-select-option>
-                </a-select>
-              </a-form-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="所属区域">
-                <a-input id="expenseReimbursementDetailList-subarea" v-model.trim="queryParam.subareaArea.subareaName" allowClear placeholder="请输入所属区域"/>
-              </a-form-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="所属分区">
-                <a-input id="expenseReimbursementDetailList-subareaArea" v-model.trim="queryParam.subareaArea.subareaAreaName" allowClear placeholder="请输入所属分区"/>
-              </a-form-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-model-item label="所属省份">
-                <Area id="expenseReimbursementDetailList-area" placeholder="请选择所属省份" v-model="queryParam.provinceSn"></Area>
-              </a-form-model-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-model-item label="所属城市">
-                <Area id="expenseReimbursementDetailList-area" placeholder="请选择所属城市" leve="city" :parentId="queryParam.provinceSn" v-model="queryParam.citySn"></Area>
-              </a-form-model-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="费用承担方类型" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-                <v-select
-                  code="EXPENSE_ACCOUNT_DETAIL_SPLIT_OBJ_TYPE"
-                  allowClear
-                  style="width: 100%;"
-                  v-model="queryParam.splitObjType"
-                  @change="splitObjTypeChange"
-                  placeholder="请选择承担方类型"
-                ></v-select>
-              </a-form-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="费用承担方" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-                <!-- 部门 -->
-                <department v-show="queryParam.splitObjType=='DEPARTMENT'" style="width: 100%;" placeholder="请选择承担方" v-model="queryParam.splitObjSn"></department>
-                <!-- 经销商 -->
-                <custList v-show="queryParam.splitObjType=='CUSTOMER'" ref="custList" @change="custChange" placeholder="请选择(输入名称搜索)"></custList>
-                <a-select style="width: 100%" v-if="!queryParam.splitObjType" placeholder="请选择">
-                  <a-select-option value="" :disabled="true">
-                    请先选择承担方类型
-                  </a-select-option>
-                </a-select>
-              </a-form-item>
-            </a-col>
-            <a-col :md="6" :sm="24" v-show="queryParam.splitObjType=='DEPARTMENT'">
-              <a-form-item label="费用承担人" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-                <employee style="width: 100%;" placeholder="请选择承担人员" v-model="queryParam.childSplitObjSn"></employee>
-              </a-form-item>
-            </a-col>
-            <a-col :md="6" :sm="24" v-show="queryParam.splitObjType==undefined">
-              <a-form-item label="费用承担人" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-                <a-select style="width: 100%" placeholder="请选择">
-                  <a-select-option value="" :disabled="true">
-                    请先选择承担方类型
-                  </a-select-option>
-                </a-select>
-              </a-form-item>
+              <span class="table-page-search-submitButtons">
+                <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
+                <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
+                <a-button
+                  style="margin-left: 10px"
+                  type="primary"
+                  class="button-warning"
+                  @click="handleExport"
+                  :disabled="disabled"
+                  :loading="exportLoading"
+                  v-if="$hasPermissions('B_expenseAcctDetailReport')"
+                  id="expenseAcctDetail-export">导出</a-button>
+                <a @click="advanced=!advanced" style="margin-left: 8px">
+                  {{ advanced ? '收起' : '展开' }}
+                  <a-icon :type="advanced ? 'up' : 'down'"/>
+                </a>
+              </span>
             </a-col>
-          </template>
-          <a-col :md="6" :sm="24">
-            <span class="table-page-search-submitButtons">
-              <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
-              <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
-              <a-button
-                style="margin-left: 10px"
-                type="primary"
-                class="button-warning"
-                @click="handleExport"
-                :disabled="disabled"
-                :loading="exportLoading"
-                v-if="$hasPermissions('B_expenseAcctDetailReport')"
-                id="expenseAcctDetail-export">导出</a-button>
-              <a @click="advanced=!advanced" style="margin-left: 8px">
-                {{ advanced ? '收起' : '展开' }}
-                <a-icon :type="advanced ? 'up' : 'down'"/>
-              </a>
-            </span>
-          </a-col>
-        </a-row>
-      </a-form>
-    </div>
-  </a-card>
-  <a-card size="small" :bordered="false" class="expenseReimbursementDetailList-wrap">
-    <a-spin :spinning="spinning" tip="Loading...">
-      <!-- alert -->
-      <div>
-        总单数:<strong>{{ countData&&(countData.detailNum || countData.detailNum==0) ? countData.detailNum : '--' }}</strong>;
-        总费用金额:<strong>{{ countData&&(countData.expense || countData.expense==0) ? toThousands(countData.expense) : '--' }}</strong>;
+          </a-row>
+        </a-form>
       </div>
-      <!-- 列表 -->
-      <s-table
-        class="sTable fixPagination"
-        ref="table"
-        :style="{ height: tableHeight+80+'px' }"
-        size="small"
-        rowKeyName="no"
-        :rowKey="(record) => record.no"
-        :columns="columns"
-        :data="loadData"
-        :pageSize="30"
-        :scroll="{ y: tableHeight,x:2250 }"
-        :defaultLoadData="false"
-        bordered>
-      </s-table>
-    </a-spin>
-  </a-card>
+    </a-card>
+    <a-card size="small" :bordered="false" class="expenseReimbursementDetailList-wrap">
+      <a-spin :spinning="spinning" tip="Loading...">
+        <!-- alert -->
+        <div>
+          总单数:<strong>{{ countData&&(countData.detailNum || countData.detailNum==0) ? countData.detailNum : '--' }}</strong>;
+          总费用金额:<strong>{{ countData&&(countData.expense || countData.expense==0) ? toThousands(countData.expense) : '--' }}</strong>;
+        </div>
+        <!-- 列表 -->
+        <s-table
+          class="sTable fixPagination"
+          ref="table"
+          :style="{ height: tableHeight+80+'px' }"
+          size="small"
+          rowKeyName="no"
+          :rowKey="(record) => record.no"
+          :columns="columns"
+          :data="loadData"
+          :pageSize="30"
+          :scroll="{ y: tableHeight,x:2250 }"
+          :defaultLoadData="false"
+          bordered>
+        </s-table>
+      </a-spin>
+    </a-card>
   </div>
 </template>
 
@@ -198,12 +200,13 @@ import custList from '@/views/common/custList.vue'
 import supplier from '@/views/common/supplier.js'
 import expenseType from '@/views/common/expenseType.js'
 import { expenseAccountDetailList, expenseAcctDetailReport, expenseAccountDetailCount } from '@/api/expenseManagement'
+import otherTransactions from '@/views/common/otherTransactions.js'
 import { hdExportExcel } from '@/libs/exportExcel'
 moment.locale('zh-cn')
 export default {
   name: 'ExpenseReimbursementDetailList',
   mixins: [commonMixin],
-  components: { STable, VSelect, department, employee, subarea, rangeDate, Area, custList, supplier, expenseType },
+  components: { STable, VSelect, department, employee, subarea, rangeDate, Area, custList, supplier, expenseType, otherTransactions },
   data () {
     const _this = this
     return {
@@ -228,13 +231,14 @@ export default {
         applyPersonSn: undefined, // 申请人
         applyDepartmentSn: undefined, // 申请部门
         expenseType: undefined, //  费用类型
-        xpenseType2: undefined, //  费用类型
+        xpenseType2: undefined, //  费用类型1
+        xpenseType3: undefined, //  费用类型2
         accountType: undefined, // 记账类型
         accountNameSn: undefined, // 记账名称
         splitObjType: undefined, // 费用承担方类型
         splitObjSn: undefined, //  费用承担方
         childSplitObjSn: undefined, // 费用承担人
-        subareaArea:{
+        subareaArea: {
           subareaName: '',
           subareaAreaName: ''
         },
@@ -311,6 +315,7 @@ export default {
       this.expenseTypes = val || []
       this.queryParam.expenseType = val && val[0] ? val[0] : ''
       this.queryParam.expenseType2 = val && val[1] ? val[1] : ''
+      this.queryParam.expenseType3 = val && val[2] ? val[2] : ''
     },
     custChange (val) {
       this.queryParam.splitObjSn = val.key
@@ -369,12 +374,13 @@ export default {
         applyDepartmentSn: undefined, // 申请部门
         expenseType: undefined, //  费用类型
         expenseType2: undefined, //  费用类型2
+        expenseType3: undefined, //  费用类型3
         accountType: undefined, // 记账类型
         accountNameSn: undefined, // 记账名称
         splitObjType: undefined, // 费用承担方类型
         splitObjSn: undefined, //  费用承担方
         childSplitObjSn: undefined, // 费用承担人
-        subareaArea:{
+        subareaArea: {
           subareaName: '',
           subareaAreaName: ''
         },

+ 73 - 6
src/views/promotionRulesManagement/dealerPromotions/addModal.vue

@@ -62,6 +62,44 @@
             </a-col>
           </a-row>
         </a-form-model-item>
+        <a-form-model-item label="订单起订金额" prop="minOrderFlag">
+          <a-select default-value="0" v-model="form.minOrderFlag" style="width: 180px" placeholder="请选择">
+            <a-select-option value="0">
+              不限
+            </a-select-option>
+            <a-select-option value="1">
+              限制
+            </a-select-option>
+          </a-select>
+          <a-input-number
+            v-show="form.minOrderFlag && form.minOrderFlag=='1'"
+            style="margin-left:10px;width:300px;"
+            v-model="form.minOrderAmount"
+            :min="0"
+            :step="1"
+            :max="999999"
+            :precision="2"
+            placeholder="请输入金额"/>
+        </a-form-model-item>
+        <a-form-model-item label="活动经费上限" prop="upperLimitFlag">
+          <a-select default-value="0" v-model="form.upperLimitFlag" style="width: 180px" placeholder="请选择">
+            <a-select-option value="0">
+              不限
+            </a-select-option>
+            <a-select-option value="1">
+              限制
+            </a-select-option>
+          </a-select>
+          <a-input-number
+            v-show="form.upperLimitFlag&&form.upperLimitFlag=='1'"
+            style="margin-left:10px;width:300px;"
+            v-model="form.upperLimitAmount"
+            :min="0"
+            :step="1"
+            :max="999999"
+            :precision="2"
+            placeholder="请输入金额"/>
+        </a-form-model-item>
         <a-form-model-item label="促销描述" prop="content">
           <a-textarea
             id="promotionList-content"
@@ -88,7 +126,7 @@
       </a-form-model>
       <div class="btn-cont">
         <a-button id="promotionList-basicInfo-modal-back" @click="isShow = false">取消</a-button>
-        <a-button style="margin-left: 15px;" type="primary" id="promotionList-modal-save" @click="handleSave">确定</a-button>
+        <a-button style="margin-left: 15px;" type="primary" id="promotionList-modal-save" :loading="loadingSave" @click="handleSave">确定</a-button>
       </div>
     </a-spin>
     <!-- 选择参与客户 -->
@@ -149,7 +187,11 @@ export default {
         content: '', // 活动描述
         attachmentList: '', // 附件
         promotionDealerList: [], // 参与客户
-        dealerScope: 'SOME_DEALER' // 全部客户   部分客户
+        dealerScope: 'SOME_DEALER', // 全部客户   部分客户
+        minOrderFlag: '0', // 订单起订金额
+        minOrderAmount: undefined,
+        upperLimitFlag: '0', // 活动经费上限
+        upperLimitAmount: undefined
       },
       openDealerModal: false,
       chooseDealerList: [],
@@ -157,14 +199,17 @@ export default {
       dateFormat: 'YYYY-MM-DD',
       rules: {
         title: [{ required: true, message: '请输入促销名称', trigger: 'blur' }],
-        activeDate: [{ required: true, message: '请选择促销时间', trigger: 'change' } ],
+        activeDate: [{ required: true, message: '请选择促销时间', trigger: 'change' }],
         expenseDepartmentSn: [{ required: true, message: '请选择费用所属部门', trigger: 'change' }],
         dealerScope: [{ required: true, message: '请选择参与客户', trigger: 'change' }],
         description: [{ required: true, message: '请输入促销简称', trigger: 'blur' }],
+        minOrderFlag: [{ required: true, message: '请选择订单起订金额', trigger: 'change' }],
+        upperLimitFlag: [{ required: true, message: '请选择活动经费上限', trigger: 'change' }],
         content: [{ required: true, message: '请输入促销描述', trigger: 'blur' }]
       },
       attachAction: process.env.VUE_APP_API_BASE_URL + '/uploadGetFileInfo',
-      openGuideModal: false
+      openGuideModal: false,
+      loadingSave: false
     }
   },
   methods: {
@@ -233,13 +278,28 @@ export default {
         _this.form.promotionDealerList = [{ dealerScope: _this.form.dealerScope }]
         _this.form.dealerList = []
       }
-
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
           const form = JSON.parse(JSON.stringify(_this.form))
+          // 判断起订金额、活动经费上限
+          if (form.minOrderFlag == '1' && !form.minOrderAmount) {
+            _this.$message.error('请输入订单起订限制金额数!')
+            return
+          }
+          if (form.upperLimitFlag == '1' && !form.upperLimitAmount) {
+            _this.$message.warning('请输入活动经费上限金额!')
+            return
+          }
+          if (form.minOrderFlag == '0') {
+            form.minOrderAmount = undefined
+          }
+          if (form.upperLimitFlag == '0') {
+            form.upperLimitAmount = undefined
+          }
           form.attachmentList = _this.attachList
           delete form.activeDate
           _this.spinning = true
+          _this.loadingSave = true
           const ajaxName = _this.itemSn ? dealerPromotionEdit : dealerPromotionSave
           ajaxName(form).then(res => {
             if (res.status == 200) {
@@ -248,9 +308,11 @@ export default {
                 _this.isShow = false
                 _this.$emit('ok', res.data)
                 _this.spinning = false
+                _this.loadingSave = false
               }, 1000)
             } else {
               _this.spinning = false
+              _this.loadingSave = false
             }
           })
         } else {
@@ -258,6 +320,7 @@ export default {
         }
       })
     },
+    // 选择全部客户时,清空之前选择的客户列表
     changeDealerScope (val) {
       if (val === 'ALL_DEALER') {
         this.chooseDealerList = []
@@ -273,7 +336,11 @@ export default {
         content: '', // 活动描述
         attachmentList: '', // 附件
         promotionDealerList: [], // 参与客户
-        dealerScope: 'SOME_DEALER'
+        dealerScope: 'SOME_DEALER',
+        minOrderFlag: '0', // 订单起订金额
+        minOrderAmount: undefined,
+        upperLimitFlag: '0', // 活动经费上限
+        upperLimitAmount: undefined
       }
       this.attachList = []
       this.chooseDealerList = []

+ 29 - 12
src/views/promotionRulesManagement/dealerPromotions/chooseImportModal.vue

@@ -22,6 +22,9 @@
         :scroll="{ y: 200 }"
         :pagination="false"
         bordered>
+        <template slot="unitTypeShow" slot-scope="text,record">
+          {{ record.unitType==='SL'?'按数量设置':'按整箱设置' }}
+        </template>
       </a-table>
       <a-divider />
       <!-- 不可导入数据 -->
@@ -37,7 +40,10 @@
         :scroll="{ y: 200 }"
         :pagination="false"
         bordered>
-        <template slot="errorMsg" slot-scope="text,record">
+        <template slot="unitTypeShow" slot-scope="text,record">
+          {{ record.unitType==='SL'?'按数量设置':'按整箱设置' }}
+        </template>
+        <!-- <template slot="errorMsg" slot-scope="text,record">
           <a-popover placement="topRight">
             <template slot="content">
               <p v-for="d in record.importErrorMsgSet">{{ d }}</p>
@@ -46,7 +52,7 @@
               查看
             </a-button>
           </a-popover>
-        </template>
+        </template> -->
       </a-table>
       <!-- 按钮 -->
       <div class="btn-con">
@@ -100,7 +106,8 @@ export default {
       loadData: [],
       unLoadData: [],
       loading: false,
-      goodsFlag: ''
+      goodsFlag: '',
+      discountType: ''
     }
   },
   computed: {
@@ -109,9 +116,11 @@ export default {
       let columnsArr = [
         { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
         { title: '产品编码', dataIndex: 'productCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'product.name', width: '50%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '产品名称', dataIndex: 'product.name', width: '30%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '起订类型', scopedSlots: { customRender: 'unitTypeShow' }, dataIndex: 'unitType', width: '20%', align: 'center' },
+        { title: '起订数量', dataIndex: 'unitQty', width: '20%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } }
       ]
-      if (_this.goodsFlag == '0') {
+      if (_this.goodsFlag == '0' && _this.discountType == '0') {
         const arr = [
           { title: '省级特价', dataIndex: 'provinceDiscountPriceText', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
           { title: '市级特价', dataIndex: 'cityDiscountPriceText', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
@@ -124,12 +133,14 @@ export default {
     nowUnColumns () {
       const _this = this
       const unColumnsArr = [
-        { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'product.name', width: '50%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '错误说明', scopedSlots: { customRender: 'errorMsg' }, width: '20%', align: 'center' }
+        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'product.name', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '起订类型', scopedSlots: { customRender: 'unitTypeShow' }, dataIndex: 'unitType', width: '10%', align: 'center' },
+        { title: '起订数量', dataIndex: 'unitQty', width: '10%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
+        { title: '错误说明', dataIndex: 'remarks', width: '30%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
       ]
-      if (_this.goodsFlag == '0') {
+      if (_this.goodsFlag == '0' && _this.discountType == '0') {
         unColumnsArr.splice(3, 0, { title: '省级特价', dataIndex: 'provinceDiscountPriceText', width: '10%', align: 'right', customRender: function (text) { return text || '--' } },
           { title: '市级特价', dataIndex: 'cityDiscountPriceText', width: '10%', align: 'right', customRender: function (text) { return text || '--' } },
           { title: '特约特价', dataIndex: 'specialDiscountPriceText', width: '10%', align: 'right', customRender: function (text) { return text || '--' } })
@@ -139,7 +150,8 @@ export default {
   },
   methods: {
     setFlag (val) {
-      this.goodsFlag = val
+      this.goodsFlag = val.goodFlag
+      this.discountType = val.discountType
     },
     getData () {
       const paramsData = JSON.parse(JSON.stringify(this.paramsData))
@@ -172,7 +184,12 @@ export default {
       }
       _this.spinning = true
       const ajaxName = _this.goodsFlag == '0' ? downSpecialFail : downNormalFail
-      hdExportExcel(ajaxName, _this.unLoadData, '导出产品错误项', function () {
+      var ajaxData = {}
+      ajaxData.unLoadData = _this.unLoadData
+      if (_this.goodsFlag == '0') {
+        ajaxData.discountType = _this.discountType
+      }
+      hdExportExcel(ajaxName, ajaxData, '导出产品错误项', function () {
         _this.spinning = false
       })
     }

+ 50 - 37
src/views/promotionRulesManagement/dealerPromotions/detail.vue

@@ -12,7 +12,7 @@
       </a-page-header>
       <!-- 基础信息 -->
       <a-card size="small" title="基础信息" :bordered="false" v-show="!isShowBisiceInfo" class="salesDetail-cont">
-        <a-descriptions size="small" :column="2" v-if="detailData">
+        <a-descriptions size="small" v-if="detailData">
           <a-descriptions-item label="促销名称">{{ detailData.title || '--' }}</a-descriptions-item>
           <a-descriptions-item label="促销简称">{{ detailData.description || '--' }}</a-descriptions-item>
           <a-descriptions-item label="促销时间" v-if="detailData.promotionDateStart&& detailData.promotionDateEnd">{{ detailData.promotionDateStart }}-{{ detailData.promotionDateEnd }}</a-descriptions-item>
@@ -21,10 +21,12 @@
           <a-descriptions-item label="费用所属部门">{{ detailData.expenseDepartmentName || '--' }}</a-descriptions-item>
           <a-descriptions-item label="参与客户" v-if="detailData.dealerScope!='ALL_DEALER'"><div @click="handleSee">共<span class="link-bule">{{ detailData.dealerQty }}</span>个</div></a-descriptions-item>
           <a-descriptions-item label="参与客户" v-else>全部客户</a-descriptions-item>
-          <a-descriptions-item label="促销描述" :span="2">
+          <a-descriptions-item label="活动订单起订金额(元)">{{ detailData.minOrderFlag ==='0'?'不限':detailData.minOrderAmount?toThousands(detailData.minOrderAmount):'--' }}</a-descriptions-item>
+          <a-descriptions-item label="活动经费上限(元)" :span="2">{{ detailData.upperLimitFlag ==='0'?'不限':detailData.upperLimitAmount? toThousands(detailData.upperLimitAmount):'--' }}</a-descriptions-item>
+          <a-descriptions-item label="促销描述" :span="3">
             <div class="descItem">{{ detailData.content || '' }}</div>
           </a-descriptions-item>
-          <a-descriptions-item label="附件" :span="2">
+          <a-descriptions-item label="附件" :span="3">
             <div class="attachmentBox" v-if="detailData.attachmentList&&detailData.attachmentList.length>0">
               <a
                 class="link-bule"
@@ -60,26 +62,47 @@
           <template slot="cillProduct" slot-scope="text, record">
             <div v-if="record.gateFlag === '1'">
               <span v-if="record.gateType==='RATIO_AMOUNT'">
-                购买门槛产品金额{{ record.gateAmount*100 }}%作为配额
+                购买门槛产品金额{{ record.gateValue?(record.gateValue*100).toFixed(2) :'0.00' }}%作为配额
               </span>
               <span v-else-if="record.gateType==='MIN_AMOUNT'">
-                购买门槛产品满最低金额{{ record.gateAmount }}元,不限制配额
+                购买门槛产品满最低金额{{ record.gateValue }}元,不限制配额
+              </span>
+              <span v-else>
+                <span v-if="record.promotionRuleType!='PROMO_PROD'">购买满{{ record.gateValue }}元门槛产品,可使用 {{ record.quotaAmount }}元配额,采购规则中的正价商品</span>
+                <span v-else>购买每满{{ record.gateValue }}{{ record.gateUnit==='YUAN'?'元':'个' }}门槛产品,可采购{{ record.quotaAmount }}个特价产品</span>
               </span>
-              <span v-else>购买满{{ record.gateAmount }}元门槛产品,可使用 {{ record.quotaAmount }}元配额,采购规则中的{{ record.promotionRuleType!='PROMO_PROD'?'正价':'特价' }}商品</span>
             </div>
-            <span v-else>--</span>
+            <span v-else></span>
           </template>
           <!-- 规则 -->
           <template slot="ruleProduct" slot-scope="text, record">
             <div v-if="record.promotionRuleType == 'BUY_PROD_GIVE_PROD'">
-              {{ record.regularSameFlag==1?'同款':'不同款' }}产品,购买满{{ record.regularQty }}个正价产品,送{{ record.promotionQty }}个促销产品{{ (record.accrualFlag&&record.accrualFlag==1)?',数量叠加':',数量不叠加' }}
+              <div>{{ record.accrualFlag==='1'?'数量叠加;':'' }}{{ record.convertExpenseFlag==='1'?'可转费用报销单;':'' }}</div>
+              <div v-if="record.giveRuleList && record.giveRuleList.length>0">
+                <div v-for="item in record.giveRuleList" :key="item.scopeLevel">
+                  {{ record.giveRuleList.length>1?item.scopeLevel+'、' :'' }}{{ item.regularSameFlag==='1'?'同款':'不同款' }}产品,购买满{{ item.regularValue }}{{ item.regularUnit==='YUAN'?'元':'个' }}正价产品,送{{ item.promotionValue }}个促销产品;
+                </div>
+              </div>
+              <div v-if="record.restrictFlag==='1'">限制正价产品{{ record.restrictCategory }}款</div>
             </div>
             <div v-else-if="record.promotionRuleType == 'BUY_PROD_GIVE_MONEY'">
-              购买满{{ record.regularAmount }}元正价产品,送{{ record.giveAmount }}元促销品采购额{{ record.promotionRuleType ==='BUY_PROD_GIVE_MONEY'?(record.accrualFlag&&record.accrualFlag==1)?',金额叠加':',金额不叠加':'' }}
+              <div v-if="record.giveRuleList&&record.giveRuleList.length>0">
+                <div v-if="record.giveRuleType==='SUM_MONEY'">金额叠加;购买满{{ record.giveRuleList[0].regularValue }}{{ record.giveRuleList[0].regularUnit==='YUAN'?'元':'个' }}正价产品,送{{ record.giveRuleList[0].promotionValue }}元<span v-if="record.giveRuleList[0].regularUnit==='YUAN'">({{ record.giveRuleList[0].regularValue!=0?((record.giveRuleList[0].promotionValue/record.giveRuleList[0].regularValue).toFixed(2)*100).toFixed(2):'0.00' }}%促销品采购额)</span><span v-else>(促销品采购额)</span></div>
+                <div v-if="record.giveRuleType==='RATIO' &&record.giveRuleList && record.giveRuleList.length>0 ">
+                  <span>按比例;</span>
+                  <div v-for="item in record.giveRuleList" :key="item.scopeLevel">
+                    {{ record.giveRuleList.length>1?item.scopeLevel+'、' :'' }}产品购买满{{ item.regularValue }}{{ item.regularUnit==='YUAN'?'元':'个' }}正价产品,送正价产品总金额的{{ item.promotionValue.toFixed(2) }}%为促销品采购额
+                  </div>
+                </div>
+              </div>
+              <span v-else>--</span>
             </div>
-            <div v-else>
-              特价产品
+            <div v-else-if="record.promotionRuleType == 'PROMO_PROD'">
+              <span v-if="record.discountType ==='0'">手动输入特价</span>
+              <span v-else-if="record.discountType ==='1'">各级别价打折;省级折扣{{ record.provinceValue.toFixed(2) }}%,市级折扣{{ record.cityValue.toFixed(2) }}%,特约折扣{{ record.specialValue.toFixed(2) }}%</span>
+              <span v-else>各级别价直降;省级直降{{ record.provinceValue }},市级直降{{ record.cityValue }},特约直降{{ record.specialValue }}</span>
             </div>
+            <div v-else>--</div>
           </template>
           <!-- 操作 -->
           <template slot="action" slot-scope="text, record">
@@ -107,19 +130,17 @@
           </template>
         </s-table>
       </a-card>
-      <div class="footerBtn" v-if="$route.query.type=='rule'">
-        <a-card size="small" :bordered="false">
-          <a-button
-            type="primary"
-            class="button-info"
-            size="large"
-            style="padding:0 40px;"
-            @click="handleSubmit"
-            :disabled="disabled"
-            v-if="$hasPermissions('B_rulesSubmit')&&(mainContentList&&mainContentList.length>0)">提交</a-button>
-        </a-card>
-      </div>
     </a-spin>
+    <div class="affix-cont" v-if="$route.query.type=='rule'">
+      <a-button
+        type="primary"
+        class="button-info"
+        size="large"
+        style="padding:0 40px;"
+        @click="handleSubmit"
+        :disabled="disabled"
+        v-if="$hasPermissions('B_rulesSubmit')&&(mainContentList&&mainContentList.length>0)">提交</a-button>
+    </div>
     <!-- 查看参与客户 -->
     <lookUp-customers-modal ref="lookUpCustomers" :openModal="openCustomerModal" @close="openCustomerModal = false"></lookUp-customers-modal>
     <!-- 促销品费用归属品牌/促销品费用归属品类 -->
@@ -184,23 +205,15 @@ export default {
         })
       },
       detailSn: null,
-      mainContentList: []
-    }
-  },
-  computed: {
-    columns () {
-      const _this = this
-      const arr = [
+      mainContentList: [],
+      columns: [
         { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
         { title: '促销类型', dataIndex: 'promotionRuleTypeDictValue', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '规则简称', dataIndex: 'description', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '规则门槛', scopedSlots: { customRender: 'cillProduct' }, width: '20%', align: 'center' },
-        { title: '规则', scopedSlots: { customRender: 'ruleProduct' }, width: '20%', align: 'center' },
-        { title: '订单起订金额(元)', dataIndex: 'minOrderAmount', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '活动经费上限(元)', dataIndex: 'upperLimitAmount', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '20%', align: 'center' }
+        { title: '规则简称', dataIndex: 'description', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '规则门槛', scopedSlots: { customRender: 'cillProduct' }, width: '23%', align: 'center' },
+        { title: '规则', scopedSlots: { customRender: 'ruleProduct' }, width: '33%', align: 'left' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ]
-      return arr
     }
   },
   methods: {

+ 160 - 54
src/views/promotionRulesManagement/dealerPromotions/detailModal.vue

@@ -16,43 +16,63 @@
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
         <a-form-model-item label="规则简称" v-if="form.description">
-          {{form.description}}
+          {{ form.description }}
         </a-form-model-item>
         <a-form-model-item label="规则门槛" v-if="form.gateFlag">
-          {{form.gateFlag==='1'?'有':'无'}}
+          {{ form.gateFlag==='1'?'有':'无' }}
           <div v-if="form.gateFlag==='1'">
-            <span v-if="form.gateType==='RATIO_AMOUNT'">购买门槛产品金额 {{ form.gateAmount*100 }}% 作为配额 </span>
-            <span v-if="form.gateType==='MIN_AMOUNT'">购买门槛产品满最低金额 {{ form.gateAmount }} 元,不限制配额。</span>
-            <span v-if="form.gateType==='FIXED_AMOUNT'">购买满 {{ form.gateAmount }} 元门槛产品,可使用 {{ form.quotaAmount }} 元配额,采购规则中的 {{ form.promotionRuleType!='PROMO_PROD'?'正价':'特价' }} 商品(配额算销售额)</span>
+            <span v-if="form.gateType==='RATIO_AMOUNT'">购买门槛产品金额 {{ form.gateValue?(form.gateValue*100).toFixed(2):'0.00' }}% 作为配额 </span>
+            <span v-if="form.gateType==='MIN_AMOUNT'">购买门槛产品满最低金额 {{ form.gateValue }} 元,不限制配额。</span>
+            <span v-if="form.gateType==='FIXED_AMOUNT'&&form.promotionRuleType !='PROMO_PROD'">购买满 {{ form.gateValue }} 元门槛产品,可使用 {{ form.quotaAmount }} 元配额,采购规则中的正价商品(配额算销售额)</span>
+            <span v-if="form.gateType==='FIXED_AMOUNT'&&form.promotionRuleType ==='PROMO_PROD'">购买每满 {{ form.gateValue }} {{ form.gateUnit==='YUAN'?'元':'个' }}门槛产品,可采购 {{ form.quotaAmount }} 个特价产品(配额算销售额)</span>
           </div>
         </a-form-model-item>
         <!-- 买产品送产品 -->
         <a-form-model-item label="满赠规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_PROD'">
-          <span>{{ form.regularSameFlag==='1'?'同款':'不同款' }}产品购买满 {{ form.regularQty }} 个正价产品,送 {{ form.promotionQty }} 个促销产品</span>
-          <span v-if="form.restrictFlag&&form.restrictFlag==1">,限制正价产品款数 {{ form.restrictCategory }}</span>
+          <div v-if="form.giveRuleList&&form.giveRuleList.length>0">
+            <div v-for="item in form.giveRuleList" :key="item.scopeLevel">{{ form.giveRuleList.length>1?item.scopeLevel+'、' :'' }}{{ item.regularSameFlag==='1'?'同款':'不同款' }}产品购买满 {{ item.regularValue }} {{ item.regularUnit==='YUAN'?'元':'个' }}正价产品,送 {{ item.promotionValue }} 个促销产品</div>
+            <div v-if="form.restrictFlag&&form.restrictFlag==1">限制正价产品{{ form.restrictCategory }}款 </div>
+            <div v-if="form.convertExpenseFlag&&form.convertExpenseFlag==1">可转费用报销单</div>
+          </div>
+          <span v-else>--</span>
         </a-form-model-item>
+        <!-- 买产品送采购额 -->
         <a-form-model-item label="满赠规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_MONEY'">
-          购买满 {{ form.regularAmount }} 元正价产品,送 {{ form.giveAmount }} 元({{ perCentNum }}%促销品采购额)
-        </a-form-model-item>
-        <a-form-model-item label="数量叠加" prop="accrualFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_PROD'&&form.accrualFlag">
-          {{form.accrualFlag==='1'?'是':'否'}}
-        </a-form-model-item>
-        <a-form-model-item label="金额叠加" prop="accrualFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_MONEY'&&form.accrualFlag">
-          {{form.accrualFlag==='1'?'是':'否'}}
+          <div>{{ form.giveRuleType==='SUM_MONEY'?'金额叠加':'按比例' }}</div>
+          <div v-if="form.giveRuleList&&form.giveRuleList.length>0">
+            <div v-if="form.giveRuleType==='SUM_MONEY'">购买满{{ form.giveRuleList[0].regularValue }}{{ form.giveRuleList[0].regularUnit==='YUAN'?'元':'个' }}正价产品,送{{ form.giveRuleList[0].promotionValue }}元<span>({{ form.giveRuleList[0].regularUnit==='YUAN'?perCentNum+'%':'' }}促销品采购额)</span></div>
+            <div v-if="form.giveRuleType==='RATIO' &&form.giveRuleList && form.giveRuleList.length>0 ">
+              <div v-for="item in form.giveRuleList" :key="item.scopeLevel">
+                {{ form.giveRuleList.length>1?item.scopeLevel+'、' :'' }}产品购买满{{ item.regularValue }}{{ item.regularUnit==='YUAN'?'元':'个' }}正价产品,送正价产品总金额的{{ item.promotionValue?item.promotionValue.toFixed(2):'0.00' }}%为促销品采购额
+              </div>
+            </div>
+          </div>
         </a-form-model-item>
-        <a-form-model-item prop="minOrderFlag" label="订单起订金额">
-          {{form.minOrderFlag==='1'?'限制':'不限'}}
-          {{ form.minOrderAmount? (form.minOrderAmount + '元'):'' }}
+        <!-- 特价产品 -->
+        <a-form-model-item label="特价规则" prop="regularSameFlag" v-if="form.promotionRuleType ==='PROMO_PROD'">
+          {{ form.discountType==='0'?'手动输入特价':form.discountType==='1'?'各级别价打折':'各级别价直降' }}
+          <a-table
+            v-show="form.discountType!=0"
+            class="sTable"
+            ref="setTable"
+            size="small"
+            :rowKey="(record) => record.regularValue"
+            rowKeyName="regularValue"
+            :columns="setColumns"
+            :data-source="setTableData"
+            :pagination="false"
+            style="width:60%;"
+            bordered>
+          </a-table>
         </a-form-model-item>
-        <a-form-model-item prop="upperLimitFlag" label="活动经费上限">
-          {{form.upperLimitFlag==='1'?'限制':'不限'}}
-          {{ form.upperLimitAmount?(form.upperLimitAmount+'元'):'' }}
+        <a-form-model-item label="数量叠加" prop="accrualFlag" v-if="form.promotionRuleType ==='BUY_PROD_GIVE_PROD'&&form.accrualFlag">
+          {{ form.accrualFlag==='1'?'是':'否' }}
         </a-form-model-item>
         <a-form-model-item label="促销品是否与正品一致" v-if="form.regularPromotionSameFlag" prop="regularPromotionSameFlag">
-          {{form.regularPromotionSameFlag==='1'?'是':'否'}}
+          {{ form.regularPromotionSameFlag==='1'?'是':'否' }}
         </a-form-model-item>
         <a-form-model-item label="采购额适用范围" v-if="form.scopeFlag" prop="scopeFlag" >
-          {{form.scopeFlag==='1'?'全部产品':'部分产品'}}
+          {{ form.scopeFlag==='1'?'全部产品':'部分产品' }}
         </a-form-model-item>
       </a-form-model>
       <a-card size="small" :bordered="false" class="pages-wrap">
@@ -63,15 +83,18 @@
           <a-radio-button value="b" v-show="form.promotionRuleType!='PROMO_PROD'">
             正价产品
           </a-radio-button>
-          <a-radio-button value="c" v-show="form.regularPromotionSameFlag==='0'||form.scopeFlag==='0'">
+          <a-radio-button value="c" v-show="(form.regularPromotionSameFlag==='0'||form.scopeFlag==='0')&&form.promotionRuleType!='BUY_PROD_GIVE_PROD'">
             促销产品
           </a-radio-button>
+          <a-radio-button :value="'c'+i" v-for="(item,i) in form.giveRuleList" :key="i" v-show="(form.regularPromotionSameFlag==='0'||form.scopeFlag==='0')&&form.promotionRuleType=='BUY_PROD_GIVE_PROD'&&form.giveRuleList">
+            {{ form.giveRuleList.length>1? '促销产品'+'(阶梯'+(i*1+1) +')' :'促销产品' }}
+          </a-radio-button>
           <a-radio-button value="d" v-show="form.promotionRuleType=='PROMO_PROD'">
             特价产品
           </a-radio-button>
         </a-radio-group>
         <!-- 列表 -->
-        <div v-show="chooseVal!='d'">
+        <div v-show="chooseVal==='a'||chooseVal==='b'||chooseVal==='c'">
           <a-table
             class="sTable"
             style="margin-top:10px;max-height:340px;"
@@ -109,6 +132,47 @@
             </template>
           </a-table>
         </div>
+        <!-- 买产品送产品列表 -->
+        <div v-if="form.giftProductMap && form.giveRuleList&& form.giveRuleList.length>0">
+          <div v-for="(con,k) in form.giveRuleList" :key="k" v-show="chooseVal==('c'+k)">
+            <a-table
+              class="sTable"
+              style="margin-top:10px;max-height:340px;"
+              ref="table"
+              size="small"
+              :rowKey="(record) => record.id"
+              :columns="columns"
+              :data-source="form.giftProductMap['GIFT'+(k*1+1)]"
+              :scroll="{ y: 330 }"
+              :pagination="false"
+              bordered
+            >
+              <!-- 产品分类 -->
+              <template slot="productType" slot-scope="text, record">
+                <div class="tabBox" v-if="record.productTypeList && record.productTypeList.length>0">
+                  <a-tag style="margin-bottom:5px;" v-for="item in record.productTypeList" :key="item.id">{{ item.productTypeName3? item.productTypeName2+'/'+item.productTypeName3:(item.productTypeName2&&!item.productTypeName3)?item.productTypeName2:item.productTypeName1 }}</a-tag>
+                </div>
+              </template>
+              <!-- 品牌 -->
+              <template slot="productBrand" slot-scope="text, record">
+                <div class="tabBox" v-if="record.productBrandList && record.productBrandList.length>0">
+                  <a-tag style="margin-bottom:5px;" v-for="item in record.productBrandList" :key="item.id">{{ item.productBrandName }}</a-tag>
+                </div>
+              </template>
+              <!-- 产品 -->
+              <template slot="product" slot-scope="text, record">
+                <div class="tabBox" v-if="record.productThisList && record.productThisList.length>0">
+                  <a-tag style="margin-bottom:5px;" v-for="item in record.productThisList" :key="item.id">{{ item.productCode }}</a-tag>
+                </div>
+              </template>
+              <!-- 设置起订量 -->
+              <template slot="setNum" slot-scope="text, record">
+                <a-tag style="width:60%;margin-bottom:5px;margin-right:0;">{{ record.unitTypeDictValue }}</a-tag>
+                <a-tag style="width:60%;margin-right:0;">{{ record.unitQty }}</a-tag>
+              </template>
+            </a-table>
+          </div>
+        </div>
         <!-- 特价产品 -->
         <div v-show="chooseVal=='d'">
           <a-table
@@ -159,12 +223,10 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import { STable } from '@/components'
 import { getRuleDetail } from '@/api/promotion'
 export default {
   name: 'DetailModal',
   mixins: [commonMixin],
-  components: { STable },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -176,7 +238,6 @@ export default {
     }
   },
   data () {
-    const _this = this
     return {
       isShow: this.openModal, //  是否打开弹框
       spinning: false,
@@ -187,7 +248,7 @@ export default {
       form: {
         promotionRuleType: undefined,
         gateFlag: undefined, // 门槛
-        gateAmount: undefined,
+        gateValue: undefined,
         quotaAmount: undefined,
         regularSameFlag: undefined, // 满赠规则  不同款商品
         regularQty: undefined,
@@ -209,39 +270,64 @@ export default {
         productThisList: []
       },
       chooseVal: 'a',
-      specialColumns: [
-        { title: '产品分类', width: '11%', scopedSlots: { customRender: 'productType' }, align: 'center' },
-        { title: '品牌', width: '11%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
-        { title: '产品', scopedSlots: { customRender: 'product' }, width: '11%', align: 'center' },
-        { title: '省价原价', dataIndex: 'provincePrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '省价特价', dataIndex: 'provinceDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '省价折扣', dataIndex: 'provinceDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
-        { title: '市价原价', dataIndex: 'cityPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '市价特价', dataIndex: 'cityDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '市价折扣', dataIndex: 'cityDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
-        { title: '特约原价', dataIndex: 'specialPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '特约特价', dataIndex: 'specialDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '特约折扣', dataIndex: 'specialDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
-        { title: '设置起订量', width: '7%', scopedSlots: { customRender: 'setNum' }, align: 'center' }
+      columns: [
+        { title: '产品分类', width: '30%', scopedSlots: { customRender: 'productType' }, align: 'center' },
+        { title: '品牌', width: '35%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
+        { title: '产品', width: '35%', scopedSlots: { customRender: 'product' }, align: 'center' },
+        { title: '设置起订量', width: '20%', scopedSlots: { customRender: 'setNum' }, align: 'center' }
       ]
     }
   },
   computed: {
-    columns () {
+    perCentNum () {
+      const val = (this.form.giveRuleList[0].regularValue && this.form.giveRuleList[0].regularValue != 0) ? ((this.form.giveRuleList[0].promotionValue / this.form.giveRuleList[0].regularValue) * 100).toFixed(2) : '0.00'
+      return val
+    },
+    setColumns () {
+      const _this = this
+      var arr = []
+      if (_this.form.discountType === '1') {
+        arr = [
+          { title: '省价折扣', dataIndex: 'provinceValue', width: '33%', align: 'center', customRender: function (text) { return (text ? (text.toFixed(2) + '%') : '--') } },
+          { title: '市价折扣', dataIndex: 'cityValue', width: '33%', align: 'center', customRender: function (text) { return (text ? (text.toFixed(2) + '%') : '--') } },
+          { title: '特约折扣', dataIndex: 'specialValue', width: '33%', align: 'center', customRender: function (text) { return (text ? (text.toFixed(2) + '%') : '--') } }
+        ]
+      } else if (_this.form.discountType === '2') {
+        arr = [
+          { title: '省价直降', dataIndex: 'provinceValue', width: '33%', align: 'center', customRender: function (text) { return text || '--' } },
+          { title: '市价直降', dataIndex: 'cityValue', width: '33%', align: 'center', customRender: function (text) { return text || '--' } },
+          { title: '特约直降', dataIndex: 'specialValue', width: '33%', align: 'center', customRender: function (text) { return text || '--' } }
+        ]
+      }
+      return arr
+    },
+    specialColumns () {
       const _this = this
       const arr = [
-        { title: '产品分类', width: '30%', scopedSlots: { customRender: 'productType' }, align: 'center' },
-        { title: '品牌', width: '35%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
-        { title: '产品', width: '35%', scopedSlots: { customRender: 'product' }, align: 'center' },
-        { title: '设置起订量', width: '20%', scopedSlots: { customRender: 'setNum' }, align: 'center' }
+        { title: '产品分类', width: '11%', scopedSlots: { customRender: 'productType' }, align: 'center' },
+        { title: '品牌', width: '11%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
+        { title: '产品', scopedSlots: { customRender: 'product' }, width: '11%', align: 'center' },
+        { title: '省级原价', dataIndex: 'provincePrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '省级特价', dataIndex: 'provinceDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        // { title: '省级折扣', dataIndex: 'provinceDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
+        { title: '市级原价', dataIndex: 'cityPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '市级特价', dataIndex: 'cityDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        // { title: '市级折扣', dataIndex: 'cityDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
+        { title: '特约原价', dataIndex: 'specialPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '特约特价', dataIndex: 'specialDiscountPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        // { title: '特约折扣', dataIndex: 'specialDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text + '%') : '--') } },
+        { title: '设置起订量', width: '7%', scopedSlots: { customRender: 'setNum' }, align: 'center' }
       ]
-      if (_this.chooseVal == 'c') {
-        arr.pop()
+      if (_this.form.discountType == '0' || _this.form.discountType == '1') {
+        arr.splice(5, 0, { title: '省级折扣', dataIndex: 'provinceDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text.toFixed(2) + '%') : '--') } })
+        arr.splice(8, 0, { title: '市级折扣', dataIndex: 'cityDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text.toFixed(2) + '%') : '--') } })
+        arr.splice(11, 0, { title: '特约折扣', dataIndex: 'specialDiscountRate', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? (text.toFixed(2) + '%') : '--') } })
+      } else {
+        arr.splice(5, 0, { title: '省价直降金额', dataIndex: 'provinceSubtract', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? ('-' + text) : '--') } })
+        arr.splice(8, 0, { title: '市价直降金额', dataIndex: 'citySubtract', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? ('-' + text) : '--') } })
+        arr.splice(11, 0, { title: '特约直降金额', dataIndex: 'specialSubtract', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? ('-' + text) : '--') } })
       }
       return arr
-    },
-    perCentNum () {
-      return Math.floor(((this.form.giveAmount / this.form.regularAmount) * 100).toFixed(2))
     }
   },
   methods: {
@@ -250,7 +336,7 @@ export default {
       this.form = {
         promotionRuleType: undefined,
         gateFlag: undefined, // 门槛
-        gateAmount: undefined,
+        gateValue: undefined,
         quotaAmount: undefined,
         regularSameFlag: undefined, // 满赠规则  不同款商品
         regularQty: undefined,
@@ -272,8 +358,28 @@ export default {
       getRuleDetail({ sn: this.itemSn }).then(res => {
         if (res.status == 200) {
           const resultObj = res.data
-          this.chooseVal = resultObj.gateFlag == '1' ? 'a' : resultObj.promotionRuleType == 'PROMO_PROD' ? 'd' : 'b'
+          if (resultObj.gateFlag == '1') {
+            this.chooseVal = 'a'
+          } else {
+            if (resultObj.promotionRuleType == 'BUY_PROD_GIVE_PROD') {
+              this.chooseVal = 'b'
+            } else if (resultObj.promotionRuleType == 'BUY_PROD_GIVE_MONEY') {
+              this.chooseVal = 'b'
+            } else {
+              this.chooseVal = 'd'
+            }
+            // if (resultObj.giveRuleList && resultObj.giveRuleList.length > 0) {
+            //   this.chooseVal = 'c0'
+            // } else {
+            //   this.chooseVal = resultObj.promotionRuleType == 'PROMO_PROD' ? 'd' : 'b'
+            // }
+          }
           this.form = { ...this.form, ...resultObj }
+          this.setTableData = [{
+            provinceValue: this.form.provinceValue,
+            cityValue: this.form.cityValue,
+            specialValue: this.form.specialValue
+          }]
         }
       })
     }

+ 7 - 3
src/views/promotionRulesManagement/dealerPromotions/editActiveEndTime.vue

@@ -56,7 +56,7 @@ export default {
         name: '',
         timeStart: '',
         timeEnd: '',
-        newTimeEnd: ''
+        newTimeEnd: undefined
       },
       dateFormat: 'YYYY-MM-DD',
       rules: {
@@ -68,7 +68,11 @@ export default {
   },
   methods: {
     onChange (date, dateString) {
-      this.form.newTimeEnd = dateString + ' 23:59:59'
+      if (date) {
+        this.form.newTimeEnd = dateString + ' 23:59:59'
+      } else {
+        this.form.newTimeEnd = undefined
+      }
     },
     //  保存
     handleSave () {
@@ -114,7 +118,7 @@ export default {
           name: '',
           timeStart: '',
           timeEnd: '',
-          newTimeEnd: ''
+          newTimeEnd: undefined
         }
         this.$refs.ruleForm.resetFields()
       }

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

@@ -85,7 +85,7 @@ export default {
     return {
       isShow: this.openModal, //  是否打开弹框
       openImportModal: false, //  导入
-      attachAction: process.env.VUE_APP_API_BASE_URL + '/promotion/importDealer', // 导入门槛、正价、促销产品
+      attachAction: process.env.VUE_APP_API_BASE_URL + '/promotion/dealer/importDealer', // 导入门槛、正价、促销产品
       paramsData: null,
       filePath: ''
     }

+ 22 - 8
src/views/promotionRulesManagement/dealerPromotions/importGuideModal.vue

@@ -16,7 +16,8 @@
           </div>
           <ul>
             <li v-if="goodFlag==='1'">1) 导入的Excel文件中必须包含名为“产品编码”的列,“产品编码”必填</li>
-            <li v-else>1) 导入的Excel文件中必须包含名为“产品编码”、“省级特价”、“市级特价”和“特约特价”的列,都为必填,省级特价≤市级特价≤特约特价</li>
+            <li v-if="goodFlag==='0'&&rulesType!='0'">1) 导入的Excel文件中必须包含名为“产品编码”的列,“产品编码”必填</li>
+            <li v-if="goodFlag==='0'&&rulesType=='0'">1) 导入的Excel文件中必须包含名为“产品编码”、“省级特价”、“市级特价”和“特约特价”的列,都为必填,省级特价≤市级特价≤特约特价</li>
             <li>2) 如果导入的产品已经存在,则不会导入该行</li>
             <li>3)起订类型和起订数量非必填:起订类型为空则默认为“按数量设置”,起订数量为空则默认为“1”。</li>
             <li>
@@ -38,7 +39,8 @@
               :maxNums="1"
               fileType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
               uploadType="attach"
-              :action="goodFlag==='1'?attachAction:attachAction1"
+              :uploadParams="uploadData"
+              :action="goodFlag=='1'?attachAction:attachAction1"
               upText="选择导入文件"
               @remove="resetSearchForm"
               @change="changeImport"></Upload>
@@ -82,7 +84,11 @@ export default {
       type: Object,
       default: null
     },
-    goodFlag: {
+    goodFlag: {// 0  特价  1 买产品送产品  买产品送采购额
+      type: [String, Number],
+      default: '0'
+    },
+    rulesType: {// 0 手动 1折扣 2直降
       type: [String, Number],
       default: '0'
     }
@@ -91,10 +97,11 @@ export default {
     return {
       isShow: this.openModal, //  是否打开弹框
       openImportModal: false, //  导入
-      attachAction: process.env.VUE_APP_API_BASE_URL + '/promotion/importNormalProduct', // 导入门槛、正价、促销产品
-      attachAction1: process.env.VUE_APP_API_BASE_URL + '/promotion/importSpecialProduct', // 导入特价产品
+      attachAction: process.env.VUE_APP_API_BASE_URL + '/promotion/rule/importNormalProduct', // 导入门槛、正价、促销产品
+      attachAction1: process.env.VUE_APP_API_BASE_URL + '/promotion/rule/importSpecialProduct', // 导入特价产品
       paramsData: null,
-      filePath: ''
+      filePath: '',
+      uploadData: null
     }
   },
   methods: {
@@ -102,12 +109,13 @@ export default {
     resetSearchForm () {
       this.$refs.importUpload.setFileList() //  清空导入文件
       this.paramsData = null //  清空上传数据
+      this.uploadData = null
     },
     // 下一步
     handlerNextStep () {
       if (this.paramsData) {
         this.openImportModal = true
-        this.$refs.chooseImportBox.setFlag(this.goodFlag)
+        this.$refs.chooseImportBox.setFlag({ goodFlag: this.goodFlag, discountType: this.rulesType })
       } else {
         this.$message.warning('添加文件后再进行下一步操作!')
       }
@@ -144,7 +152,13 @@ export default {
         this.$emit('close')
         this.resetSearchForm()
       } else {
-        this.filePath = location.protocol + '//' + location.host + (this.goodFlag === '1' ? '/templ/促销规则导入产品.xlsx' : '/templ/促销规则导入特价产品.xlsx')
+        if (this.goodFlag != '0') {
+          this.filePath = location.protocol + '//' + location.host + '/templ/促销规则导入产品.xlsx'
+          this.uploadData = { savePathType: 'ali' }
+        } else {
+          this.uploadData = { discountType: this.rulesType, savePathType: 'ali' }
+          this.filePath = location.protocol + '//' + location.host + (this.rulesType == '0' ? '/templ/促销规则导入特价产品.xlsx' : this.rulesType == '1' ? '/templ/促销规则导入特价产品(打折).xlsx' : '/templ/促销规则导入特价产品(直降).xlsx')
+        }
       }
     }
   }

+ 24 - 6
src/views/promotionRulesManagement/dealerPromotions/list.vue

@@ -43,6 +43,11 @@
                 <creatorList ref="creatorList" id="promotionList-creatorId" @change="creatorChange" />
               </a-form-item>
             </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="经销商名称">
+                <custList ref="custList" id="promotionList-tenantSn" @change="custChange"></custList>
+              </a-form-item>
+            </a-col>
             <a-col :md="6" :sm="24">
               <span class="table-page-search-submitButtons">
                 <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="promotionList-refresh">查询</a-button>
@@ -95,9 +100,8 @@
           <!-- 参与客户 -->
           <template slot="joinCustomers" slot-scope="text, record">
             <span class="joinCustomer" v-if="record.dealerScope ==='ALL_DEALER'" @click="handleCustomers(record)">全部客户</span>
-            <span class="joinCustomer" v-else @click="handleCustomers(record)">共有<span style="color:#39f;vertical-align:top;">{{ record.dealerSnList?record.dealerSnList.length:0 }}</span>个客户</span>
+            <span class="joinCustomer" v-else @click="handleCustomers(record)">共有<span style="color:#39f;vertical-align:top;">{{ record.dealerQty ||0 }}</span>个客户</span>
             <a-badge count="审" v-show="record.dealerAuditFlag == 1 &&(record.state==='NOT_START'||record.state==='RUNNING') " :number-style="{ backgroundColor: '#F5222D', zoom:'80%' }" />
-            <!-- dealerAuditFlag  1 是 0否 -->
           </template>
           <!-- 发布状态 -->
           <template slot="releaseStatus" slot-scope="text, record">
@@ -203,6 +207,7 @@
             type="primary"
             id="auditModal-save"
             class="button-primary"
+            :loading="loadingAudit"
             @click="handleAuditModal"
           >审核通过</a-button>
         </div>
@@ -249,12 +254,15 @@ 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 custList from '@/views/common/custList.vue'
+import debounce from 'lodash/debounce'
 import { dealerPromotionList, dealerPromotionDel, modifyEnabledFlag, promotionAudit, promotionIsOver, handleCopyData, midwaySubmit, dealerMidwayAudit, updateDealerSnList } from '@/api/promotion'
 export default {
   name: 'PromotionManagementList',
   mixins: [commonMixin],
-  components: { STable, supplier, VSelect, rangeDate, warehouse, lookUpCustomersModal, addModal, editActiveEndTime, creatorList },
+  components: { STable, supplier, VSelect, rangeDate, warehouse, lookUpCustomersModal, addModal, editActiveEndTime, creatorList, custList },
   data () {
+    this.handleAuditModal = debounce(this.handleAuditModal, 800)
     return {
       spinning: false,
       disabled: false, //  查询、重置按钮是否可操作
@@ -271,7 +279,8 @@ export default {
         enabledFlag: undefined, // 发布状态
         state: undefined,
         creatorId: undefined,
-        dealerAuditFlag: undefined
+        dealerAuditFlag: undefined,
+        dealerSn: undefined
       },
       columns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
@@ -309,10 +318,15 @@ export default {
       openCopyModal: false, // 复制弹窗
       itemPromotionSn: '',
       itemStatusType: '',
-      chooseDealerArr: [] // 所选择经销商列表
+      chooseDealerArr: [], // 所选择经销商列表
+      loadingAudit: false
     }
   },
   methods: {
+    // 经销商列表查询
+    custChange (val) {
+      this.queryParam.dealerSn = val.key
+    },
     // 创建人
     creatorChange (val) {
       this.queryParam.creatorId = val.key
@@ -394,6 +408,7 @@ export default {
       _this.openAuditModal = true
     },
     handleAuditModal () {
+      this.loadingAudit = true
       this.handleAudit({ promotionSn: this.itemSn, auditFlag: 1 })
     },
     closeAuditModal () {
@@ -410,6 +425,7 @@ export default {
         _this.itemSn = null
         _this.openAuditModal = false
         _this.spinning = false
+        _this.loadingAudit = false
       })
     },
     // 复制
@@ -535,8 +551,10 @@ export default {
         enabledFlag: undefined, // 发布状态
         state: undefined,
         creatorId: creatorObj.userid,
-        dealerAuditFlag: undefined
+        dealerAuditFlag: undefined,
+        dealerSn: undefined
       }
+      this.$refs.custList.resetForm()
       this.$refs.rangeDate.resetDate()
       this.$refs.table.refresh(true)
     },

+ 277 - 174
src/views/promotionRulesManagement/dealerPromotions/sendAmountModal.vue

@@ -26,14 +26,16 @@
             :maxLength="20"></a-input>
         </a-form-model-item>
         <a-form-model-item label="规则门槛" prop="gateFlag">
-          <a-radio-group v-model="form.gateFlag" button-style="solid" size="small" @change="changeGateFlag">
-            <a-radio value="1">
-              有
-            </a-radio>
-            <a-radio value="0">
-              无
-            </a-radio>
-          </a-radio-group>
+          <div class="fixWidthBox">
+            <a-radio-group v-model="form.gateFlag" button-style="solid" size="small" @change="changeGateFlag">
+              <a-radio-button value="1">
+                有
+              </a-radio-button>
+              <a-radio-button value="0">
+                无
+              </a-radio-button>
+            </a-radio-group>
+          </div>
           <div v-if="form.gateFlag && form.gateFlag === '1'">
             <v-select
               size="small"
@@ -41,122 +43,130 @@
               v-model="form.gateType"
               id="promotionList-gateType"
               code="PROMOTION_GATE_TYPE"
-              placeholder="请选择"
+              placeholder="请选择门槛与配额设置要求"
               @change="changeGateTypeFlag"
               allowClear></v-select>
             <div v-if="form.gateType==='RATIO_AMOUNT'">
-              购买门槛产品金额 <a-input-number v-model="form.gateAmount" :min="0" :max="999999" :precision="2" size="small"/> %作为配额
+              购买门槛产品金额 <a-input-number v-model="form.gateValue" :min="0" :max="999999" :precision="2" size="small"/> %作为配额
               <a-tooltip title="如:填写100%,则购买10000元门槛产品,可享受10000配额购买正价产品,根据门槛金额动态调整配额">
                 <a-icon type="question-circle" theme="filled" :style="{ fontSize: '14px', color: 'gray' }"/>
               </a-tooltip>
             </div>
             <div v-if="form.gateType==='MIN_AMOUNT'">
-              购买门槛产品满最低金额 <a-input-number v-model="form.gateAmount" :max="999999" :min="0" :precision="2" size="small"/>元,不限制配额。
+              购买门槛产品满最低金额 <a-input-number v-model="form.gateValue" :max="999999" :min="0" :precision="2" size="small"/>元,不限制配额。
             </div>
             <div class="ruleDescList" v-if="form.gateType==='FIXED_AMOUNT'">
               购买满
-              <a-input-number v-model="form.gateAmount" :min="0" :max="999999" :precision="2" size="small"/>
+              <a-input-number v-model="form.gateValue" :min="0" :max="999999" :precision="2" size="small"/>
               元门槛产品,可使用
               <a-input-number v-model="form.quotaAmount" :min="0" :max="999999" :precision="2" size="small"/>
               元配额,采购规则中的正价商品(配额算销售额)
             </div>
           </div>
         </a-form-model-item>
-        <a-form-model-item label="满赠规则" prop="regularAmount">
-          <div class="ruleDescList">
-            <!-- <a-select default-value="1" v-model="form.regularSameFlag" style="width: 100px" size="small">
-              <a-select-option value="1">
-                同款
-              </a-select-option>
-              <a-select-option value="0">
-                不同款
-              </a-select-option>
-            </a-select> -->
+        <a-form-model-item label="满赠规则" prop="giveRuleType">
+          <a-select default-value="SUM_MONEY" v-model="form.giveRuleType" style="width: 160px" size="small" @change="handleRuleType">
+            <a-select-option value="SUM_MONEY">
+              金额叠加
+            </a-select-option>
+            <a-select-option value="RATIO">
+              按比例
+            </a-select-option>
+          </a-select>
+          <a-tooltip title="数量叠加:(如:满1000送200,金额叠加则:满2000送400,以此类推)" v-if="form.giveRuleType=='SUM_MONEY'">
+            <a-icon type="question-circle" theme="filled" :style="{ fontSize: '14px', color: 'gray' ,'margin-left':'5px'}"/>
+          </a-tooltip>
+          <a-tooltip title="按比例:(如满100元送2%,按比例则:满120送2.4元)" v-else>
+            <a-icon type="question-circle" theme="filled" :style="{ fontSize: '14px', color: 'gray' ,'margin-left':'5px'}"/>
+          </a-tooltip>
+          <div class="ruleDescList" v-if="form.giveRuleType==='SUM_MONEY'">
             购买满
             <a-input-number
-              v-model="form.regularAmount"
+              v-model="fullGiftRuleList[0].regularValue"
               @blur="calculatePrice"
               :max="999999"
               :step="1"
-              :precision="2"
+              :precision="form.regularUnit==='YUAN'?2:0"
               :min="0"
               size="small"/>
-            元正价产品,送
+            <a-select
+              default-value="YUAN"
+              v-model="form.regularUnit"
+              style="width: 50px;margin-left:5px;"
+              size="small"
+              @change="handleUnit">
+              <a-select-option value="YUAN">
+                元
+              </a-select-option>
+              <a-select-option value="GE">
+                个
+              </a-select-option>
+            </a-select>
+            正价产品,送
             <a-input-number
-              v-model="form.giveAmount"
+              v-model="fullGiftRuleList[0].promotionValue"
               @blur="calculatePrice"
               :min="0"
               :step="1"
               :max="999999"
               :precision="2"
               size="small"/>
-            元({{ scaleNum }}%促销品采购额)
+            元<span>({{ form.regularUnit==='YUAN'? scaleNum+'%':'' }}促销品采购额)</span>
+          </div>
+          <div class="fullGiftRuleBox" v-else>
+            <div class="ruleDescList" v-for="(con,i) in fullGiftRuleList" :key="i">
+              <span v-if="fullGiftRuleList.length>1">{{ i*1+1 }}、</span>
+              购买满
+              <a-input-number
+                v-model="con.regularValue"
+                :min="i!=0?fullGiftRuleList[i-1].regularValue:0"
+                :step="1"
+                :max="999999"
+                :precision="form.regularUnit==='YUAN'?2:0"
+                size="small"/>
+              <a-select
+                default-value="YUAN"
+                v-model="form.regularUnit"
+                @change="handleChangeUnit"
+                style="width: 50px;margin-left:5px;"
+                size="small"
+                :disabled="i!=0">
+                <a-select-option value="YUAN">
+                  元
+                </a-select-option>
+                <a-select-option value="GE">
+                  个
+                </a-select-option>
+              </a-select>
+              正价产品,送正价产品总金额的
+              <a-input-number
+                v-model="con.promotionValue"
+                :min="0"
+                :step="1"
+                :precision="2"
+                :max="999999"
+                size="small"/>
+              %为促销品采购额
+              <a-button type="link" v-if="i==0&&fullGiftRuleList&&fullGiftRuleList.length<5" class="button-info" @click="addFullGiftRule">+新增</a-button>
+              <a-button type="link" v-if="i!=0" class="button-error" @click="delFullGiftRule(i)">删除</a-button>
+            </div>
           </div>
-        </a-form-model-item>
-        <a-form-model-item label="金额叠加" prop="accrualFlag">
-          <a-radio-group v-model="form.accrualFlag" button-style="solid" size="small">
-            <a-radio value="1">
-              是
-            </a-radio>
-            <a-radio value="0">
-              否
-            </a-radio>
-          </a-radio-group>
-          <span style="color:gray;">(如:满1000送200,金额叠加则:满2000送400,以此类推)</span>
-        </a-form-model-item>
-        <a-form-model-item prop="minOrderFlag" label="订单起订金额">
-          <a-select default-value="1" v-model="form.minOrderFlag" style="width: 160px" size="small">
-            <a-select-option value="0">
-              不限
-            </a-select-option>
-            <a-select-option value="1">
-              限制
-            </a-select-option>
-          </a-select>
-          <a-input-number
-            v-show="form.minOrderFlag && form.minOrderFlag=='1'"
-            size="small"
-            style="margin-left:10px;width:300px;"
-            v-model="form.minOrderAmount"
-            :min="0"
-            :step="1"
-            :max="999999"
-            :precision="2"
-            placeholder="请输入金额"/>
-        </a-form-model-item>
-        <a-form-model-item prop="upperLimitFlag" label="活动经费上限">
-          <a-select default-value="1" v-model="form.upperLimitFlag" style="width: 160px" size="small">
-            <a-select-option value="0">
-              不限
-            </a-select-option>
-            <a-select-option value="1">
-              限制
-            </a-select-option>
-          </a-select>
-          <a-input-number
-            v-show="form.upperLimitFlag&&form.upperLimitFlag=='1'"
-            size="small"
-            style="margin-left:10px;width:300px;"
-            v-model="form.upperLimitAmount"
-            :min="0"
-            :step="1"
-            :max="999999"
-            :precision="2"
-            placeholder="请输入金额"/>
         </a-form-model-item>
         <a-form-model-item label="采购额适用范围" prop="scopeFlag">
-          <a-radio-group v-model="form.scopeFlag" button-style="solid" size="small">
-            <a-radio value="0">
-              部分产品
-            </a-radio>
-            <a-radio value="1">
-              全部产品
-            </a-radio>
-          </a-radio-group>
+          <div class="fixWidthBox">
+            <a-radio-group v-model="form.scopeFlag" button-style="solid" size="small">
+              <a-radio-button value="0">
+                部分产品
+              </a-radio-button>
+              <a-radio-button value="1">
+                全部产品
+              </a-radio-button>
+            </a-radio-group>
+          </div>
         </a-form-model-item>
       </a-form-model>
       <a-card size="small" :bordered="false" class="pages-wrap">
-        <div class="flex">
+        <div class="flex" style="margin-bottom:10px;">
           <a-radio-group v-model="chooseVal" button-style="solid">
             <a-radio-button value="a" v-show="form.gateFlag==='1'">
               门槛产品
@@ -175,9 +185,9 @@
             @click="openGuideModal=true"
             id="promotionList-edit-btn">+导入产品</a-button>
         </div>
-        <div v-show="chooseVal=='a'"><tableType1 ref="cillProduct"></tableType1></div>
-        <div v-show="chooseVal=='b'"><tableType1 ref="normalPriceProduct"></tableType1></div>
-        <div v-show="chooseVal=='c'"><tableType2 ref="offerProduct"></tableType2></div>
+        <div v-show="chooseVal=='a'"><tableType1 :unitTypeList="unitTypeDataList" ref="cillProduct"></tableType1></div>
+        <div v-show="chooseVal=='b'"><tableType1 :unitTypeList="unitTypeDataList" ref="normalPriceProduct"></tableType1></div>
+        <div v-show="chooseVal=='c'"><tableType1 :unitTypeList="unitTypeDataList" ref="offerProduct"></tableType1></div>
       </a-card>
       <div class="btn-cont">
         <a-button id="promotionList-basicInfo-modal-back" @click="isShow = false">取消</a-button>
@@ -193,13 +203,13 @@
 import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
 import tableType1 from './tableType1.vue'
-import tableType2 from './tableType2.vue'
 import { promotionSave, getRuleDetail } from '@/api/promotion'
 import ImportGuideModal from './importGuideModal.vue'
+import { getLookUpData } from '@/api/data'
 export default {
   name: 'PromotionListBasicInfoModal',
   mixins: [commonMixin],
-  components: { VSelect, tableType1, tableType2, ImportGuideModal },
+  components: { VSelect, tableType1, ImportGuideModal },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -224,37 +234,70 @@ export default {
       },
       form: {
         promotionRuleType: 'BUY_PROD_GIVE_MONEY', // 买产品送采购额
+        accrualFlag: 1,
         description: '',
         gateFlag: '0', // 门槛
         gateType: undefined,
-        gateAmount: undefined,
+        gateValue: undefined,
         quotaAmount: undefined,
-        regularSameFlag: '0', // 满赠规则  不同款商品
-        regularAmount: undefined,
-        giveAmount: undefined,
-        restrictCategory: '',
-        accrualFlag: '1', // 数量叠加
-        minOrderFlag: '0', // 起订金额
-        minOrderAmount: undefined,
-        upperLimitFlag: '0', // 活动经费上限
-        upperLimitAmount: undefined,
-        scopeFlag: '1'
+        giveRuleType: 'SUM_MONEY',
+        regularUnit: 'YUAN',
+        scopeFlag: '1',
+        gateInfo: undefined,
+        ruleInfo: undefined,
+        gateUnit: undefined,
+        quotaUnit: undefined
       },
       rules: {
         description: [ { required: true, message: '请输入规则简称', trigger: 'blur' } ],
         gateFlag: [ { required: true, message: '请选择规则门槛', trigger: 'change' } ],
-        regularAmount: [{ required: true, message: '请输入满赠规则', trigger: 'blur' }],
-        accrualFlag: [{ required: true, message: '请选择数量是否叠加', trigger: 'change' }],
-        minOrderFlag: [{ required: true, message: '请选择订单起订金额', trigger: 'change' }],
-        upperLimitFlag: [{ required: true, message: '请选择活动经费上限', trigger: 'change' }],
+        giveRuleType: [{ required: true, message: '请选择满赠规则', trigger: 'change' }],
         scopeFlag: [{ required: true, message: '请选择采购额适用范围', trigger: 'change' }]
       },
       chooseVal: 'a',
       scaleNum: 0,
-      openGuideModal: false
+      openGuideModal: false,
+      fullGiftRuleList: [{
+        regularValue: undefined,
+        promotionValue: undefined
+      }],
+      code: 'SCOPE_UNIT_TYPE', // 起订类型数据字典
+      unitTypeDataList: []
     }
   },
   methods: {
+    // 满赠规则叠加
+    handleRuleType (val) {
+      this.form.giveRuleType = val
+      this.fullGiftRuleList = [{
+        regularValue: undefined,
+        promotionValue: undefined
+      }]
+    },
+    // 单位切换时,满赠规则数据清空
+    handleUnit (val) {
+      this.form.regularUnit = val
+      this.fullGiftRuleList[0].regularValue = undefined
+    },
+    handleChangeUnit (e) {
+      this.form.regularUnit = e
+      this.fullGiftRuleList.forEach(item => {
+        item.regularValue = undefined
+      })
+    },
+    // 新增  满减规则  最多能添加五个
+    addFullGiftRule () {
+      const obj = {
+        regularSameFlag: '1',
+        regularQty: undefined,
+        promotionQty: undefined
+      }
+      this.fullGiftRuleList.push(obj)
+    },
+    // 删除满减规则
+    delFullGiftRule (pos) {
+      this.fullGiftRuleList.splice(pos, 1)
+    },
     // 导入
     closeGuideModel () {
       this.openGuideModal = false
@@ -266,28 +309,26 @@ export default {
     // 计算百分比
     calculatePrice () {
       const _this = this
-      if (_this.form.regularAmount && _this.form.giveAmount) {
-        _this.scaleNum = ((_this.form.giveAmount / _this.form.regularAmount) * 100).toFixed(2)
+      if (_this.form.giveRuleType == 'SUM_MONEY' && _this.form.regularUnit == 'YUAN' && _this.fullGiftRuleList[0].promotionValue && _this.fullGiftRuleList[0].regularValue) {
+        _this.scaleNum = ((_this.fullGiftRuleList[0].promotionValue / _this.fullGiftRuleList[0].regularValue) * 100).toFixed(2)
       } else {
         _this.scaleNum = 0
       }
     },
     // 门槛切换  tab 按钮默认显示问题
     changeGateFlag (e) {
-      if (this.chooseVal != 'c') {
-        if (e.target.value == '0') {
-          this.chooseVal = 'b'
-          this.form.gateType = undefined
-          this.form.gateAmount = undefined
-          this.form.quotaAmount = undefined
-        } else {
-          this.chooseVal = 'a'
-        }
+      if (e.target.value == '0') {
+        this.chooseVal = 'b'
+        this.form.gateType = undefined
+        this.form.gateValue = undefined
+        this.form.quotaAmount = undefined
+      } else {
+        this.chooseVal = 'a'
       }
     },
     changeGateTypeFlag (val) {
       this.form.gateType = val
-      this.form.gateAmount = undefined
+      this.form.gateValue = undefined
       this.form.quotaAmount = undefined
     },
     //  保存
@@ -301,7 +342,7 @@ export default {
               _this.$message.warning('请选择规则门槛设置类型!')
               return
             }
-            if (!_this.form.gateAmount) {
+            if (!_this.form.gateValue) {
               _this.$message.warning('规则门槛条件不能为空!')
               return
             }
@@ -309,37 +350,42 @@ export default {
               _this.$message.warning('规则门槛条件不能为空!')
               return
             }
+            if (_this.form.gateType == 'RATIO_AMOUNT') {
+              _this.form.gateUnit = 'RATIO'
+            } else if (_this.form.gateType == 'MIN_AMOUNT') {
+              _this.form.gateUnit = 'YUAN'
+            } else {
+              _this.form.gateUnit = 'YUAN'
+              _this.form.quotaUnit = 'YUAN'
+            }
           }
-          if (!_this.form.regularAmount || !_this.form.giveAmount) {
-            _this.$message.warning('满赠规则条件不能为空!')
-            return
-          }
-          if (_this.form.gateType === 'FIXED_AMOUNT' && _this.form.regularAmount) {
-            if (_this.form.quotaAmount * 1 < _this.form.regularAmount * 1) {
-              _this.$message.warning('可使用配额必须大于购买正价产品金额!')
+          if (_this.form.giveRuleType == 'SUM_MONEY') {
+            if (!_this.fullGiftRuleList[0].regularValue || _this.fullGiftRuleList[0].regularValue <= 0) {
+              _this.$message.warning('满赠规则条件不能为空!')
+              return
+            }
+            if (!_this.fullGiftRuleList[0].promotionValue || _this.fullGiftRuleList[0].promotionValue <= 0) {
+              _this.$message.warning('满赠规则条件不能为空!')
+              return
+            }
+          } else {
+            const hasNullVal = _this.fullGiftRuleList.some(itemVal => {
+              if (itemVal.regularValue && itemVal.promotionValue) {
+                return (itemVal.regularValue <= 0 || itemVal.promotionValue <= 0)
+              } else {
+                return true
+              }
+            })
+            if (hasNullVal) {
+              _this.$message.warning('满赠规则条件不能为空!')
               return
             }
-          }
-
-          if (_this.form.minOrderFlag == 1 && !_this.form.minOrderAmount) {
-            _this.$message.warning('请输入订单起订限制金额数!')
-            return
-          }
-          if (_this.form.minOrderFlag == 0) {
-            _this.form.minOrderAmount = undefined
-          }
-          if (_this.form.upperLimitFlag == 1 && !_this.form.upperLimitAmount) {
-            _this.$message.warning('请输入活动经费上限金额!')
-            return
-          }
-          if (_this.form.upperLimitFlag == 0) {
-            _this.form.upperLimitAmount = undefined
           }
           const form = JSON.parse(JSON.stringify(_this.form))
           let rowFlag1, rowFlag2, rowFlag3
           if (form.gateFlag == '1') {
-            form.gateProductList = this.$refs.cillProduct.getResultVal()
-            form.gateAmount = form.gateType === 'RATIO_AMOUNT' ? form.gateAmount / 100 : form.gateAmount
+            form.gateProductList = this.$refs.cillProduct.getResultVal() // 规则门槛
+            form.gateValue = form.gateType === 'RATIO_AMOUNT' ? form.gateValue / 100 : form.gateValue
             if (form.gateProductList.length == 0) {
               _this.$message.warning('请添加门槛产品!')
               return
@@ -353,13 +399,12 @@ export default {
             }
           } else {
             form.gateProductList = []
-            form.gateAmount = ''
+            form.gateValue = ''
             form.quotaAmount = ''
             form.gateType = undefined
           }
-
+          // 正价产品判断表格必填
           form.regularProductList = this.$refs.normalPriceProduct.getResultVal()
-          // 判断表格必填
           if (form.regularProductList.length == 0) {
             _this.$message.warning('请添加正价产品!')
             return
@@ -369,16 +414,16 @@ export default {
               _this.$message.warning('订单起订量设置不能为空!')
               return
             }
-            rowFlag3 = _this.isJudge(form.regularProductList)
+            rowFlag2 = _this.isJudge(form.regularProductList)
           }
-
+          // 促销产品
           if (form.scopeFlag == '0') {
             form.giftProductList = this.$refs.offerProduct.getResultVal()
             if (form.giftProductList.length == 0) {
               _this.$message.warning('请添加促销产品!')
               return
             }
-            rowFlag2 = _this.isJudge(form.giftProductList)
+            rowFlag3 = _this.isJudge(form.giftProductList)
           } else {
             form.giftProductList = []
           }
@@ -387,7 +432,37 @@ export default {
             _this.$message.warning('请选择产品分类、品牌或产品!')
             return
           }
+          // 组传给后台所需数据
+          _this.fullGiftRuleList.map((val, i) => {
+            val.scopeLevel = i * 1 + 1
+            val.regularUnit = form.regularUnit
+          })
           form.promotionSn = _this.promotionSn
+          form.giveRuleList = _this.fullGiftRuleList
+          if (form.gateFlag == '1') {
+            if (form.gateType === 'RATIO_AMOUNT') {
+              form.gateInfo = '购买门槛产品金额' + (form.gateValue * 100).toFixed(2) + '%作为配额'
+            } else if (form.gateType === 'MIN_AMOUNT') {
+              form.gateInfo = '购买门槛产品满最低金额' + form.gateValue + '不限制配额'
+            } else {
+              form.gateInfo = '购买满' + form.gateValue + '元门槛产品,可使用' + form.quotaAmount + '元配额,采购规则中的正价商品(配额算销售额)'
+            }
+          }
+          var newInfo = ''
+          if (form.giveRuleType == 'SUM_MONEY') {
+            newInfo = `<span>金额叠加;购买满${_this.fullGiftRuleList[0].regularValue}${form.regularUnit == 'YUAN' ? '元' : '个'}正价产品,送${_this.fullGiftRuleList[0].promotionValue}元</span>`
+            if (form.regularUnit == 'YUAN') {
+              newInfo += `<span>(${((_this.fullGiftRuleList[0].promotionValue / _this.fullGiftRuleList[0].regularValue) * 100).toFixed(2)} %促销品采购额)</span>`
+            } else {
+              newInfo += '(促销品采购额)'
+            }
+          } else {
+            newInfo = '按比例;'
+            _this.fullGiftRuleList.forEach((item, i) => {
+              newInfo += `<div>${_this.fullGiftRuleList.length > 1 ? (i * 1 + 1) + '、' : ''}购买满${item.regularValue}${form.regularUnit == 'YUAN' ? '元' : '个'}正价产品,送正价产品总金额的${item.promotionValue}%为促销品采购额</div>`
+            })
+          }
+          form.ruleInfo = newInfo
           _this.spinning = true
           promotionSave(form).then(res => {
             if (res.status == 200) {
@@ -437,29 +512,36 @@ export default {
         description: '',
         gateFlag: '0', // 门槛
         gateType: undefined,
-        gateAmount: undefined,
+        gateValue: undefined,
         quotaAmount: undefined,
-        regularSameFlag: '0', // 满赠规则  不同款商品
-        regularAmount: undefined,
-        giveAmount: undefined,
-        restrictCategory: '',
-        accrualFlag: '1', // 数量叠加
-        minOrderFlag: '1', // 起订金额
-        minOrderAmount: undefined,
-        upperLimitFlag: '1', // 活动经费上限
-        upperLimitAmount: undefined,
-        scopeFlag: undefined,
+        giveRuleType: 'SUM_MONEY',
+        regularUnit: 'YUAN',
+        scopeFlag: '1',
         gateProductList: undefined,
         giftProductList: undefined,
-        regularProductList: undefined
+        regularProductList: undefined,
+        gateInfo: undefined,
+        ruleInfo: undefined,
+        gateUnit: undefined,
+        quotaUnit: undefined
       }
       this.$nextTick(() => {
         this.$refs.ruleForm.resetFields()
         this.$refs.cillProduct.reSetTableData()
         this.$refs.normalPriceProduct.reSetTableData()
-        this.$refs.offerProduct.reSetTableData()
         this.scaleNum = 0
       })
+      if (this.form.giveRuleType === 'SUM_MONEY') {
+        this.$refs.offerProduct.reSetTableData()
+      } else {
+        this.fullGiftRuleList.forEach((val, i) => {
+          this.$refs['offerProduct' + i][0].reSetTableData()
+        })
+      }
+      this.fullGiftRuleList = [{
+        regularValue: undefined,
+        promotionValue: undefined
+      }]
     },
     // 获取编辑详情
     getDetail () {
@@ -469,22 +551,27 @@ export default {
           this.chooseVal = res.data.gateFlag == '0' ? 'b' : 'a'
           const resultObj = res.data
           if (resultObj.gateFlag === '1') {
-            resultObj.gateAmount = resultObj.gateType === 'RATIO_AMOUNT' ? resultObj.gateAmount * 100 : resultObj.gateAmount
+            resultObj.gateValue = resultObj.gateType === 'RATIO_AMOUNT' ? resultObj.gateValue * 100 : resultObj.gateValue
+          }
+          if (resultObj.giveRuleList && resultObj.giveRuleList.length > 0) {
+            _this.fullGiftRuleList = resultObj.giveRuleList
           }
           // 重新组成保存数据
           if (resultObj.gateProductList && resultObj.gateProductList.length > 0) {
             resultObj.gateProductList = _this.newData(resultObj.gateProductList)
-            this.$refs.cillProduct.setTabVal(resultObj.gateProductList)
+            _this.$refs.cillProduct.setTabVal(resultObj.gateProductList)
           }
           if (resultObj.regularProductList && resultObj.regularProductList.length > 0) {
             resultObj.regularProductList = _this.newData(resultObj.regularProductList)
-            this.$refs.normalPriceProduct.setTabVal(resultObj.regularProductList)
+            _this.$refs.normalPriceProduct.setTabVal(resultObj.regularProductList)
           }
           if (resultObj.giftProductList && resultObj.giftProductList.length > 0) {
             resultObj.giftProductList = _this.newData(resultObj.giftProductList)
-            this.$refs.offerProduct.setTabVal(resultObj.giftProductList)
+            _this.$refs.offerProduct.setTabVal(resultObj.giftProductList)
           }
-          this.form = { ...this.form, ...resultObj }
+          delete resultObj.giftProductMap
+          _this.form = { ..._this.form, ...resultObj }
+          _this.calculatePrice()
         }
       })
     },
@@ -544,6 +631,18 @@ export default {
         }
       })
       return list
+    },
+    getUnitTypeList () {
+      const _this = this
+      getLookUpData({
+        pageNo: 1,
+        pageSize: 1000,
+        lookupCode: _this.code
+      }).then(res => {
+        if (res.status == 200) {
+          _this.unitTypeDataList = res.data.list
+        }
+      })
     }
   },
   watch: {
@@ -557,6 +656,8 @@ export default {
         this.$emit('close')
         this.resetSearchForm()
       } else {
+        // 获取起订类型数据字典
+        this.getUnitTypeList()
         if (this.itemSn) {
           this.getDetail()
         } else {
@@ -575,10 +676,10 @@ export default {
       max-height: 745px !important;
       overflow-y: scroll !important;
     }
-    .ant-radio-button-wrapper{
-      width:80px;
-      text-align: center;
-    }
+   .fixWidthBox .ant-radio-button-wrapper{
+     width:80px;
+     text-align: center;
+   }
     .ant-form-item{
       margin-bottom:5px;
     }
@@ -595,5 +696,7 @@ export default {
       justify-content:space-between;
     }
   }
-
+  /deep/.ve-table{
+    border-radius:5px;
+  }
 </style>

+ 307 - 195
src/views/promotionRulesManagement/dealerPromotions/sendProductsModal.vue

@@ -26,14 +26,16 @@
             :maxLength="20"></a-input>
         </a-form-model-item>
         <a-form-model-item label="规则门槛" prop="gateFlag">
-          <a-radio-group v-model="form.gateFlag" button-style="solid" size="small" @change="changeGateFlag">
-            <a-radio value="1">
-              有
-            </a-radio>
-            <a-radio value="0">
-              无
-            </a-radio>
-          </a-radio-group>
+          <div class="fixWidthBox">
+            <a-radio-group v-model="form.gateFlag" button-style="solid" size="small" @change="changeGateFlag">
+              <a-radio-button value="1">
+                有
+              </a-radio-button>
+              <a-radio-button value="0">
+                无
+              </a-radio-button>
+            </a-radio-group>
+          </div>
           <div v-if="form.gateFlag && form.gateFlag === '1'">
             <v-select
               size="small"
@@ -41,21 +43,21 @@
               v-model="form.gateType"
               id="promotionList-gateType"
               code="PROMOTION_GATE_TYPE"
-              placeholder="请选择"
+              placeholder="请选择门槛与配额设置要求"
               @change="changeGateTypeFlag"
               allowClear></v-select>
             <div v-if="form.gateType==='RATIO_AMOUNT'">
-              购买门槛产品金额 <a-input-number v-model="form.gateAmount" :min="0" :max="999999" :precision="2" size="small"/> %作为配额
+              购买门槛产品金额 <a-input-number v-model="form.gateValue" :min="0" :max="999999" :precision="2" size="small"/> %作为配额
               <a-tooltip title="如:填写100%,则购买10000元门槛产品,可享受10000配额购买正价产品,根据门槛金额动态调整配额">
                 <a-icon type="question-circle" theme="filled" :style="{ fontSize: '14px', color: 'gray' }"/>
               </a-tooltip>
             </div>
             <div v-if="form.gateType==='MIN_AMOUNT'">
-              购买门槛产品满最低金额 <a-input-number v-model="form.gateAmount" :min="0" :max="999999" :precision="2" size="small"/>元,不限制配额。
+              购买门槛产品满最低金额 <a-input-number v-model="form.gateValue" :min="0" :max="999999" :precision="2" size="small"/>元,不限制配额。
             </div>
             <div class="ruleDescList" v-if="form.gateType==='FIXED_AMOUNT'">
               购买满
-              <a-input-number v-model="form.gateAmount" :min="0" :max="999999" :precision="2" size="small"/>
+              <a-input-number v-model="form.gateValue" :min="0" :max="999999" :precision="2" size="small"/>
               元门槛产品,可使用
               <a-input-number v-model="form.quotaAmount" :min="0" :max="999999" :precision="2" size="small"/>
               元配额,采购规则中的正价商品(配额算销售额)
@@ -63,32 +65,58 @@
           </div>
         </a-form-model-item>
         <a-form-model-item label="满赠规则" prop="regularSameFlag">
-          <div class="ruleDescList">
-            <a-select default-value="1" v-model="form.regularSameFlag" style="width: 100px" size="small" @change="handleFullGift">
-              <a-select-option value="1">
-                同款
-              </a-select-option>
-              <a-select-option value="0">
-                不同款
-              </a-select-option>
-            </a-select>
-            产品购买满
-            <a-input-number
-              v-model="form.regularQty"
-              :min="0"
-              :step="1"
-              :max="999999"
-              :precision="0"
-              size="small"/>
-            个正价产品,送
-            <a-input-number
-              v-model="form.promotionQty"
-              :min="0"
-              :step="1"
-              :precision="0"
-              :max="999999"
-              size="small"/>
-            个促销产品
+          <div class="fullGiftRuleBox">
+            <div class="ruleDescList" v-for="(con,i) in fullGiftRuleList" :key="i">
+              <span v-if="fullGiftRuleList.length>1">{{ i*1+1 }}、</span>
+              <a-select
+                default-value="1"
+                :disabled="i!=0"
+                v-model="form.regularSameFlag"
+                style="width: 100px"
+                size="small"
+                @change="handleFullGift"
+                allowClear>
+                <a-select-option value="1">
+                  同款
+                </a-select-option>
+                <a-select-option value="0">
+                  不同款
+                </a-select-option>
+              </a-select>
+              产品购买满
+              <a-input-number
+                v-model="con.regularValue"
+                :min="i!=0?fullGiftRuleList[i-1].regularValue:0"
+                :step="1"
+                :max="999999"
+                :precision="form.regularUnit==='YUAN'?2:0"
+                size="small"/>
+              <a-select
+                default-value="GE"
+                :disabled="i!=0"
+                v-model="form.regularUnit"
+                style="width: 50px;margin-left:5px;"
+                size="small"
+                @change="handleChangeUnit">
+                <a-select-option value="GE">
+                  个
+                </a-select-option>
+                <a-select-option value="YUAN">
+                  元
+                </a-select-option>
+              </a-select>
+              正价产品,送
+              <a-input-number
+                v-model="con.promotionValue"
+                :min="0"
+                :step="1"
+                :precision="0"
+                :max="999999"
+                size="small"/>
+              个促销产品
+              <a-button type="link" v-if="i==0&&fullGiftRuleList&&fullGiftRuleList.length<5" class="button-info" @click="addFullGiftRule">+新增</a-button>
+              <a-button type="link" v-if="i!=0" class="button-error" @click="delFullGiftRule(con.id)">删除</a-button>
+            </div>
           </div>
           <div class="ruleDescList">
             <a-checkbox :checked="form.restrictFlag === '1'" size="small" @change="onChange">
@@ -101,7 +129,11 @@
               :step="1"
               :max="999999"
               :precision="0"
-              size="small"/>
+              size="small"
+              style="margin-right:10px;"/>
+            <a-checkbox :checked="form.convertExpenseFlag==='1'" size="small" @change="onChangeConvert">
+              可转费用报销单
+            </a-checkbox>
           </div>
         </a-form-model-item>
         <a-form-model-item label="数量叠加" prop="accrualFlag">
@@ -115,80 +147,30 @@
           </a-radio-group>
           <span style="color:gray;">(如:满10送2,数量叠加则:满20送4,满30送6)</span>
         </a-form-model-item>
-        <a-form-model-item prop="minOrderFlag">
-          <span slot="label">
-            <!-- <a-tooltip title="What do you want others to call you?">
-              <a-icon type="info-circle" />
-            </a-tooltip> -->
-            订单起订金额
-          </span>
-          <a-select v-model="form.minOrderFlag" style="width: 160px" size="small">
-            <a-select-option value="0">
-              不限
-            </a-select-option>
-            <a-select-option value="1">
-              限制
-            </a-select-option>
-          </a-select>
-          <a-input-number
-            v-show="form.minOrderFlag && form.minOrderFlag=='1'"
-            size="small"
-            style="margin-left:10px;width:300px;"
-            v-model="form.minOrderAmount"
-            :min="0"
-            :max="999999"
-            :step="1"
-            :precision="2"
-            placeholder="请输入金额"/>
-        </a-form-model-item>
-        <a-form-model-item prop="upperLimitFlag">
-          <span slot="label">
-            <!-- <a-tooltip title="What do you want others to call you?">
-              <a-icon type="info-circle" />
-            </a-tooltip> -->
-            活动经费上限
-          </span>
-          <a-select v-model="form.upperLimitFlag" style="width: 160px" size="small">
-            <a-select-option value="0">
-              不限
-            </a-select-option>
-            <a-select-option value="1">
-              限制
-            </a-select-option>
-          </a-select>
-          <a-input-number
-            v-show="form.upperLimitFlag&&form.upperLimitFlag=='1'"
-            size="small"
-            style="margin-left:10px;width:300px;"
-            v-model="form.upperLimitAmount"
-            :min="0"
-            :step="1"
-            :max="999999"
-            :precision="2"
-            placeholder="请输入金额"/>
-        </a-form-model-item>
         <a-form-model-item label="促销品与正品一致" prop="regularPromotionSameFlag">
-          <a-radio-group v-model="form.regularPromotionSameFlag" button-style="solid" size="small" :disabled="form.regularSameFlag==0">
-            <a-radio value="1">
-              是
-            </a-radio>
-            <a-radio value="0">
-              否
-            </a-radio>
-          </a-radio-group>
+          <div class="fixWidthBox">
+            <a-radio-group v-model="form.regularPromotionSameFlag" button-style="solid" size="small" :disabled="form.regularSameFlag==0" @change="handleSameFlag">
+              <a-radio-button value="1">
+                是
+              </a-radio-button>
+              <a-radio-button value="0">
+                否
+              </a-radio-button>
+            </a-radio-group>
+          </div>
         </a-form-model-item>
       </a-form-model>
       <a-card size="small" :bordered="false" class="pages-wrap">
-        <div class="flex">
-          <a-radio-group v-model="chooseVal" button-style="solid">
+        <div class="flex" style="margin-bottom:10px;">
+          <a-radio-group v-model="chooseVal" button-style="solid" @change="onChooseVal">
             <a-radio-button value="a" v-show="form.gateFlag==='1'">
               门槛产品
             </a-radio-button>
             <a-radio-button value="b">
               正价产品
             </a-radio-button>
-            <a-radio-button value="c" v-show="form.regularPromotionSameFlag==='0'">
-              促销产品
+            <a-radio-button :value="'c'+item.id" v-for="(item,i) in fullGiftRuleList" :key="i" v-show="form.regularPromotionSameFlag==='0'">
+              {{ fullGiftRuleList.length>1?'促销产品('+'阶梯'+(i*1+1)+')':'促销产品' }}
             </a-radio-button>
           </a-radio-group>
           <a-button
@@ -198,13 +180,13 @@
             @click="openGuideModal=true"
             id="promotionList-edit-btn">+导入产品</a-button>
         </div>
-        <div v-show="chooseVal=='a'"><tableType1 ref="cillProduct"></tableType1></div>
-        <div v-show="chooseVal=='b'"><tableType1 ref="normalPriceProduct"></tableType1></div>
-        <div v-show="chooseVal=='c'"><tableType2 ref="offerProduct"></tableType2></div>
+        <div v-show="chooseVal=='a'"><tableType1 :unitTypeList="unitTypeDataList" ref="cillProduct"></tableType1></div>
+        <div v-show="chooseVal=='b'"><tableType1 :unitTypeList="unitTypeDataList" ref="normalPriceProduct"></tableType1></div>
+        <div v-show="chooseVal==('c'+item.id)" v-for="(item,i) in fullGiftRuleList" :key="item.id"><tableType1 :unitTypeList="unitTypeDataList" :ref="'offerProduct'+i"></tableType1></div>
       </a-card>
       <div class="btn-cont">
         <a-button id="promotionList-basicInfo-modal-back" @click="isShow = false">取消</a-button>
-        <a-button style="margin-left: 15px;" type="primary" id="promotionList-modal-save" @click="handleSave">确定</a-button>
+        <a-button style="margin-left: 15px;" type="primary" id="promotionList-modal-save" :loading="loadingSave" @click="handleSave">确定</a-button>
       </div>
     </a-spin>
     <!-- 导入产品 -->
@@ -216,13 +198,13 @@
 import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
 import tableType1 from './tableType1.vue'
-import tableType2 from './tableType2.vue'
-import { promotionSave, getRuleDetail } from '@/api/promotion'
+import { promotionSave, getRuleDetail, getNewScopeSn } from '@/api/promotion'
 import ImportGuideModal from './importGuideModal.vue'
+import { getLookUpData } from '@/api/data'
 export default {
   name: 'PromotionListBasicInfoModal',
   mixins: [commonMixin],
-  components: { VSelect, tableType1, tableType2, ImportGuideModal },
+  components: { VSelect, tableType1, ImportGuideModal },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -245,46 +227,88 @@ export default {
         labelCol: { span: 4 },
         wrapperCol: { span: 17 }
       },
+      fullGiftRuleList: [{
+        id: undefined,
+        scopeLevel: undefined,
+        regularValue: undefined,
+        promotionValue: undefined
+      }],
       form: {
+        giveRuleType: 'RATIO', // 满赠规则类型: SUM_MONEY[金额叠加] / RATIO[按比例]   满产品送产品写死为: 按比例
         promotionRuleType: 'BUY_PROD_GIVE_PROD', // 买产品送产品
         description: '', // 简称
         gateFlag: '0', // 门槛
         gateType: undefined,
-        gateAmount: undefined,
+        gateValue: undefined,
         quotaAmount: undefined,
-        regularSameFlag: '1', // 满赠规则  不同款商品
-        regularQty: undefined,
-        promotionQty: undefined,
+        regularSameFlag: '1', // 满赠规则  同款不同款商品
+        regularUnit: 'GE',
         restrictFlag: '0', // 限制正价产品款数
+        convertExpenseFlag: '0', // 转费用报销标记
         restrictCategory: '',
         accrualFlag: '1', // 数量叠加
-        minOrderFlag: '0', // 起订金额
-        minOrderAmount: undefined,
-        upperLimitFlag: '0', // 活动经费上限
-        upperLimitAmount: undefined,
-        regularPromotionSameFlag: '1'
+        regularPromotionSameFlag: '1',
+        giftProductMap: {},
+        gateInfo: undefined,
+        ruleInfo: undefined,
+        gateUnit: undefined,
+        quotaUnit: undefined
       },
       rules: {
         description: [ { required: true, message: '请输入规则简称', trigger: 'blur' } ],
         gateFlag: [ { required: true, message: '请选择规则门槛', trigger: 'change' } ],
         regularSameFlag: [{ required: true, message: '请选择满赠规则', trigger: 'change' }],
         accrualFlag: [{ required: true, message: '请选择数量是否叠加', trigger: 'change' }],
-        minOrderFlag: [{ required: true, message: '请选择订单起订金额', trigger: 'change' }],
-        upperLimitFlag: [{ required: true, message: '请选择活动经费上限', trigger: 'change' }],
         regularPromotionSameFlag: [{ required: true, message: '请选择促销品与正品是否一致', trigger: 'change' }]
       },
       chooseVal: 'a',
-      openGuideModal: false// 导入弹窗
+      openGuideModal: false, // 导入弹窗
+      id: null,
+      code: 'SCOPE_UNIT_TYPE', // 起订类型数据字典
+      unitTypeDataList: [],
+      loadingSave: false
     }
   },
   methods: {
+    // 单位切换时,满赠规则数据清空
+    handleChangeUnit (e) {
+      this.form.regularUnit = e
+      this.fullGiftRuleList.forEach(item => {
+        item.regularValue = undefined
+      })
+    },
+    onChooseVal (e) {
+      this.chooseVal = e.target.value
+    },
+    // 新增  满减规则  最多能添加五个
+    async addFullGiftRule () {
+      const result = await getNewScopeSn({})
+      const obj = {
+        id: result.data,
+        scopeLevel: undefined,
+        regularValue: undefined,
+        promotionValue: undefined
+      }
+      this.fullGiftRuleList.push(obj)
+    },
+    // 删除满减规则
+    delFullGiftRule (id) {
+      const pos = this.fullGiftRuleList.findIndex(con => { return con.id == id })
+      this.fullGiftRuleList.splice(pos, 1)
+      if (this.chooseVal == 'c' + id) {
+        this.chooseVal = this.form.gateFlag == '0' ? 'b' : 'a'
+      }
+    },
     // 满赠  同款    促销品与正品一致  默认是 可修改
     //     不同款                   默认否 不可修改
     handleFullGift (e) {
-      if (e === '0') {
+      if (e === '0') { // 不同款
         this.form.regularPromotionSameFlag = '0'
       } else {
         this.form.regularPromotionSameFlag = '1'
+        if (this.chooseVal.indexOf('c') != -1) {
+          this.chooseVal = this.form.gateFlag == '0' ? 'b' : 'a'
+        }
       }
     },
     // 导入
@@ -292,29 +316,43 @@ export default {
       this.openGuideModal = false
     },
     hanldeOk (arr) {
-      const name = this.chooseVal == 'a' ? 'cill' : this.chooseVal == 'b' ? 'normalPrice' : 'offer'
-      this.$refs[name + 'Product'].importRow(arr)
+      if (this.chooseVal == 'a') {
+        this.$refs['cillProduct'].importRow(arr)
+      } else if (this.chooseVal == 'b') {
+        this.$refs['normalPriceProduct'].importRow(arr)
+      } else {
+        const pos = this.fullGiftRuleList.findIndex(item => { return 'c' + item.id == this.chooseVal })
+        if (pos != -1) {
+          this.$refs['offerProduct' + pos][0].importRow(arr)
+        }
+      }
     },
     // 限制正价产品款数
     onChange (e) {
       this.form.restrictFlag = e.target.checked ? '1' : '0'
     },
+    onChangeConvert (e) {
+      this.form.convertExpenseFlag = e.target.checked ? '1' : '0'
+    },
     // 门槛切换  tab 按钮默认显示问题
     changeGateFlag (e) {
-      if (this.chooseVal != 'c') {
-        if (e.target.value == '0') {
-          this.chooseVal = 'b'
-          this.form.gateType = undefined
-          this.form.gateAmount = undefined
-          this.form.quotaAmount = undefined
-        } else {
-          this.chooseVal = 'a'
-        }
+      if (e.target.value == '0') {
+        this.chooseVal = 'b'
+        this.form.gateType = undefined
+        this.form.gateValue = undefined
+        this.form.quotaAmount = undefined
+      } else {
+        this.chooseVal = 'a'
+      }
+    },
+    handleSameFlag (e) {
+      if (e.target.value != '0') {
+        this.chooseVal = this.form.gateFlag == '1' ? 'a' : 'b'
       }
     },
     changeGateTypeFlag (val) {
       this.form.gateType = val
-      this.form.gateAmount = undefined
+      this.form.gateValue = undefined
       this.form.quotaAmount = undefined
     },
     //  保存
@@ -328,7 +366,7 @@ export default {
               _this.$message.warning('请选择规则门槛设置类型!')
               return
             }
-            if (!_this.form.gateAmount) {
+            if (!_this.form.gateValue) {
               _this.$message.warning('规则门槛条件不能为空!')
               return
             }
@@ -336,8 +374,23 @@ export default {
               _this.$message.warning('规则门槛条件不能为空!')
               return
             }
+            if (_this.form.gateType == 'RATIO_AMOUNT') {
+              _this.form.gateUnit = 'RATIO'
+            } else if (_this.form.gateType == 'MIN_AMOUNT') {
+              _this.form.gateUnit = 'YUAN'
+            } else {
+              _this.form.gateUnit = 'YUAN'
+              _this.form.quotaUnit = 'YUAN'
+            }
           }
-          if (!_this.form.regularQty || !_this.form.promotionQty) {
+          const hasNullVal = _this.fullGiftRuleList.some(itemVal => {
+            if (itemVal.regularValue && itemVal.promotionValue) {
+              return (itemVal.regularValue <= 0 || itemVal.promotionValue <= 0)
+            } else {
+              return true
+            }
+          })
+          if (hasNullVal) {
             _this.$message.warning('满赠规则条件不能为空!')
             return
           }
@@ -345,30 +398,11 @@ export default {
             _this.$message.warning('请输入限制正价产品款数个数!')
             return
           }
-
-          if (_this.form.minOrderFlag == 1 && !_this.form.minOrderAmount) {
-            _this.$message.warning('请输入订单起订限制金额数!')
-            return
-          }
-          if (_this.form.minOrderFlag == 0) {
-            _this.form.minOrderAmount = undefined
-          }
-
-          if (_this.form.upperLimitFlag == 1 && !_this.form.upperLimitAmount) {
-            _this.$message.warning('请输入活动经费上限金额!')
-            return
-          }
-          if (_this.form.upperLimitFlag == 0) {
-            _this.form.upperLimitAmount = undefined
-          }
-
-          const form = JSON.parse(JSON.stringify(_this.form))
-          let rowFlag1 = null
-          let rowFlag2 = null
-          let rowFlag3 = null
-          if (form.gateFlag == '1') {
+          var form = JSON.parse(JSON.stringify(_this.form))
+          let rowFlag1, rowFlag2, rowFlag3
+          if (form.gateFlag == '1') { // 门槛产品
             form.gateProductList = this.$refs.cillProduct.getResultVal()
-            form.gateAmount = form.gateType === 'RATIO_AMOUNT' ? form.gateAmount / 100 : form.gateAmount
+            form.gateValue = form.gateType === 'RATIO_AMOUNT' ? form.gateValue / 100 : form.gateValue
             if (form.gateProductList.length == 0) {
               _this.$message.warning('请添加门槛产品!')
               return
@@ -382,11 +416,9 @@ export default {
             }
           } else {
             form.gateProductList = []
-            form.gateAmount = ''
-            form.quotaAmount = ''
             form.gateType = undefined
           }
-
+          // 正价产品
           form.regularProductList = this.$refs.normalPriceProduct.getResultVal()
           // 判断表格必填
           if (form.regularProductList.length == 0) {
@@ -398,25 +430,72 @@ export default {
               _this.$message.warning('订单起订量设置不能为空!')
               return
             }
-            rowFlag3 = _this.isJudge(form.regularProductList)
+            rowFlag2 = _this.isJudge(form.regularProductList)
           }
-          if (form.regularPromotionSameFlag == '0') {
-            form.giftProductList = this.$refs.offerProduct.getResultVal()
-            if (form.giftProductList.length == 0) {
+          if (form.regularPromotionSameFlag === '0') { // 促销产品   阶梯促销产品
+            const allGiftObj = {}
+            _this.fullGiftRuleList.forEach((val, i) => {
+              allGiftObj['GIFT' + (i * 1 + 1)] = _this.$refs['offerProduct' + i][0].getResultVal()
+            })
+            var lengthFlag = null
+            for (const key in allGiftObj) {
+              if (allGiftObj[key].length === 0) {
+                lengthFlag = true
+              }
+            }
+            if (lengthFlag) {
               _this.$message.warning('请添加促销产品!')
               return
             }
-            rowFlag2 = _this.isJudge(form.giftProductList)
+            const arrFlag = []
+            for (const key in allGiftObj) {
+              if (allGiftObj[key] && allGiftObj[key].length > 0) {
+                arrFlag.push(_this.isJudge(allGiftObj[key]))
+              }
+            }
+            rowFlag3 = arrFlag.some(val => { return val })
+            // 组数据,添加数组标识
+            let keyPos = 0
+            for (const key in allGiftObj) {
+              keyPos += 1
+              allGiftObj[key].forEach((item, j) => {
+                item.scopeLevel = keyPos
+              })
+            }
+            form.giftProductMap = allGiftObj
           } else {
-            form.giftProductList = []
+            form.giftProductMap = {}
           }
 
           if (rowFlag1 || rowFlag2 || rowFlag3) {
             _this.$message.warning('请选择产品分类、品牌或产品!')
             return
           }
+          // 组传给后台所需数据
+          _this.fullGiftRuleList.map((val, i) => {
+            val.scopeLevel = i * 1 + 1
+            val.regularSameFlag = form.regularSameFlag
+            val.regularUnit = form.regularUnit
+          })
           form.promotionSn = _this.promotionSn
+          form.giveRuleList = _this.fullGiftRuleList
+          if (form.gateFlag == '1') {
+            if (form.gateType === 'RATIO_AMOUNT') {
+              form.gateInfo = '购买门槛产品金额' + (form.gateValue * 100).toFixed(2) + '%作为配额'
+            } else if (form.gateType === 'MIN_AMOUNT') {
+              form.gateInfo = '购买门槛产品满最低金额' + form.gateValue + '不限制配额'
+            } else {
+              form.gateInfo = '购买满' + form.gateValue + '元门槛产品,可使用' + form.quotaAmount + '元配额,采购规则中的正价商品(配额算销售额)'
+            }
+          }
+          var newInfo = `<div>${form.accrualFlag == '1' ? '数量叠加;' : ''}${form.convertExpenseFlag == '1' ? '可转费用报销单;' : ''}</div>`
+          _this.fullGiftRuleList.forEach((item, i) => {
+            newInfo += `<div>${_this.fullGiftRuleList.length > 1 ? (i * 1 + 1) + '、' : ''}${form.regularSameFlag == '1' ? '同款' : '不同款'}产品购买满${item.regularValue}${form.regularUnit == 'YUAN' ? '元' : '个'}正价产品,送${item.promotionValue}个促销产品</div>`
+          })
+          newInfo += form.restrictFlag == '1' ? `<div>限制正价产品${form.restrictCategory}款</div>` : ''
+          form.ruleInfo = newInfo
           _this.spinning = true
+          _this.loadingSave = true
           promotionSave(form).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
@@ -424,9 +503,11 @@ export default {
                 _this.isShow = false
                 _this.$emit('ok')
                 _this.spinning = false
+                _this.loadingSave = false
               }, 1000)
             } else {
               _this.spinning = false
+              _this.loadingSave = false
             }
           })
         } else {
@@ -459,60 +540,76 @@ export default {
       return flag
     },
     // 重置表格
-    resetSearchForm () {
+    async resetSearchForm () {
       this.form = {
+        giveRuleType: 'RATIO', // 满赠规则类型: SUM_MONEY[金额叠加] / RATIO[按比例]   满产品送产品写死为: 按比例
         promotionRuleType: 'BUY_PROD_GIVE_PROD', // 买产品送产品
         description: '', // 简称
         gateFlag: '0', // 门槛
         gateType: undefined,
-        gateAmount: undefined,
+        gateValue: undefined,
         quotaAmount: undefined,
-        regularSameFlag: '1', // 满赠规则  不同款商品
-        regularQty: undefined,
-        promotionQty: undefined,
+        regularSameFlag: '1', // 满赠规则  同款不同款商品
+        regularUnit: 'GE',
         restrictFlag: '0', // 限制正价产品款数
+        convertExpenseFlag: '0', // 转费用报销标记
         restrictCategory: '',
         accrualFlag: '1', // 数量叠加
-        minOrderFlag: '0', // 起订金额
-        minOrderAmount: undefined,
-        upperLimitFlag: '0', // 活动经费上限
-        upperLimitAmount: undefined,
         regularPromotionSameFlag: '1',
+        giftProductMap: {},
         gateProductList: undefined,
-        giftProductList: undefined,
-        regularProductList: undefined
+        regularProductList: undefined,
+        gateInfo: undefined,
+        ruleInfo: undefined,
+        gateUnit: undefined,
+        quotaUnit: undefined
       }
       this.$nextTick(() => {
         this.$refs.ruleForm.resetFields()
         this.$refs.cillProduct.reSetTableData()
         this.$refs.normalPriceProduct.reSetTableData()
-        this.$refs.offerProduct.reSetTableData()
       })
+      this.fullGiftRuleList.forEach((val, i) => {
+        this.$refs['offerProduct' + i][0].reSetTableData()
+      })
+      const result = await getNewScopeSn({})
+      this.fullGiftRuleList = [{
+        id: result.data,
+        regularValue: undefined,
+        promotionValue: undefined
+      }]
+      this.id = null
     },
     // 获取编辑详情
     getDetail () {
       const _this = this
-      getRuleDetail({ sn: this.itemSn }).then(res => {
+      getRuleDetail({ sn: _this.itemSn }).then(res => {
         if (res.status == 200) {
           const resultObj = res.data
           _this.chooseVal = resultObj.gateFlag == '0' ? 'b' : 'a'
-          if (resultObj.gateFlag === '1') {
-            resultObj.gateAmount = resultObj.gateType === 'RATIO_AMOUNT' ? resultObj.gateAmount * 100 : resultObj.gateAmount
+          if (resultObj.gateFlag == '1') {
+            resultObj.gateValue = resultObj.gateType === 'RATIO_AMOUNT' ? resultObj.gateValue * 100 : resultObj.gateValue
+          }
+          if (resultObj.giveRuleList && resultObj.giveRuleList.length > 0) {
+            _this.fullGiftRuleList = resultObj.giveRuleList
+            _this.$nextTick(() => {
+              resultObj.giveRuleList.forEach((item, i) => {
+                _this.$refs['offerProduct' + i][0].setTabVal(_this.newData(resultObj.giftProductMap['GIFT' + (i * 1 + 1)]))
+              })
+            })
           }
           // 重新组成保存数据
           if (resultObj.gateProductList && resultObj.gateProductList.length > 0) {
             resultObj.gateProductList = _this.newData(resultObj.gateProductList)
-            this.$refs.cillProduct.setTabVal(resultObj.gateProductList)
+            _this.$refs.cillProduct.setTabVal(resultObj.gateProductList)
           }
           if (resultObj.regularProductList && resultObj.regularProductList.length > 0) {
             resultObj.regularProductList = _this.newData(resultObj.regularProductList)
-            this.$refs.normalPriceProduct.setTabVal(resultObj.regularProductList)
+            _this.$refs.normalPriceProduct.setTabVal(resultObj.regularProductList)
           }
-          if (resultObj.giftProductList && resultObj.giftProductList.length > 0) {
-            resultObj.giftProductList = _this.newData(resultObj.giftProductList)
-            this.$refs.offerProduct.setTabVal(resultObj.giftProductList)
-          }
-          this.form = { ...this.form, ...resultObj }
+          const newDataObj = { ..._this.form, ...resultObj }
+          delete newDataObj.giftProductList
+          _this.form = newDataObj
         }
       })
     },
@@ -539,11 +636,9 @@ export default {
             const num = 3
             for (var i = 0; i < num; i++) {
               if (item['productTypeName' + (i + 1)]) {
-                // item.title += item['productTypeName' + (i + 1)] + (item['productTypeName' + (i + 1)] ? '/' : '')
                 typeObj['productTypeSn' + (i + 1)] = item['productTypeSn' + (i + 1)] ? item['productTypeSn' + (i + 1)] : ''
               }
             }
-            // item.title = item.title.slice(0, item.title.length - 1)
             if (item.productTypeName3) {
               item.title = item.productTypeName2 + '/' + item.productTypeName3
             } else if (!item.productTypeName3 && item.productTypeName2) {
@@ -571,6 +666,18 @@ export default {
         }
       })
       return list
+    },
+    getUnitTypeList () {
+      const _this = this
+      getLookUpData({
+        pageNo: 1,
+        pageSize: 1000,
+        lookupCode: _this.code
+      }).then(res => {
+        if (res.status == 200) {
+          _this.unitTypeDataList = res.data.list
+        }
+      })
     }
   },
   watch: {
@@ -584,6 +691,8 @@ export default {
         this.$emit('close')
         this.resetSearchForm()
       } else {
+        // 获取起订类型数据字典
+        this.getUnitTypeList()
         if (this.itemSn) {
           this.getDetail()
         } else {
@@ -602,7 +711,7 @@ export default {
       max-height: 745px !important;
       overflow-y: scroll !important;
     }
-    .ant-radio-button-wrapper{
+    .fixWidthBox .ant-radio-button-wrapper{
       width:80px;
       text-align: center;
     }
@@ -625,5 +734,8 @@ export default {
       background-color: #ed1c24 !important;
     }
   }
+  /deep/.ve-table{
+    border-radius:5px;
+  }
 
-</style>
+</style>

+ 304 - 104
src/views/promotionRulesManagement/dealerPromotions/specialOfferModal.vue

@@ -27,12 +27,12 @@
         </a-form-model-item>
         <a-form-model-item label="规则门槛" prop="gateFlag">
           <a-radio-group v-model="form.gateFlag" button-style="solid" size="small" @change="handleChange">
-            <a-radio value="1">
+            <a-radio-button value="1">
-            </a-radio>
-            <a-radio value="0">
+            </a-radio-button>
+            <a-radio-button value="0">
-            </a-radio>
+            </a-radio-button>
           </a-radio-group>
           <div v-if="form.gateFlag && form.gateFlag === '1'">
             <v-select
@@ -41,70 +41,133 @@
               v-model="form.gateType"
               id="promotionList-gateType"
               code="PROMOTION_GATE_TYPE"
-              placeholder="请选择"
+              placeholder="请选择门槛与配额设置要求"
               @change="changeGateTypeFlag"
               allowClear></v-select>
             <div v-if="form.gateType==='RATIO_AMOUNT'">
-              购买门槛产品金额 <a-input-number v-model="form.gateAmount" :min="0" :max="999999" :precision="2" size="small"/> %作为配额
+              购买门槛产品金额 <a-input-number v-model="form.gateValue" :min="0" :max="999999" :precision="2" size="small"/> %作为配额
               <a-tooltip title="如:填写100%,则购买10000元门槛产品,可享受10000配额购买特价产品,根据门槛金额动态调整配额">
                 <a-icon type="question-circle" theme="filled" :style="{ fontSize: '14px', color: 'gray' }"/>
               </a-tooltip>
             </div>
             <div v-if="form.gateType==='MIN_AMOUNT'">
-              购买门槛产品满最低金额 <a-input-number v-model="form.gateAmount" :min="0" :max="999999" :precision="2" size="small"/>元,不限制配额。
+              购买门槛产品满最低金额 <a-input-number v-model="form.gateValue" :min="0" :max="999999" :precision="2" size="small"/>元,不限制配额。
             </div>
             <div class="ruleDescList" v-if="form.gateType==='FIXED_AMOUNT'">
-              购买满
-              <a-input-number v-model="form.gateAmount" :max="999999" :min="0" :precision="2" size="small"/>
-              元门槛产品,可使用
-              <a-input-number v-model="form.quotaAmount" :max="999999" :min="0" :precision="2" size="small"/>
-              元配额,采购规则中的特价商品(配额算销售额)
+              购买每满
+              <a-input-number v-model="form.gateValue" :max="999999" :min="0" :precision="form.gateUnit=='YUAN'?2:0" size="small"/>
+              <a-select default-value="GE" v-model="form.gateUnit" style="width: 50px;margin-left:5px;" size="small" @change="handleUnit">
+                <a-select-option value="GE">
+                  个
+                </a-select-option>
+                <a-select-option value="YUAN">
+                  元
+                </a-select-option>
+              </a-select>
+              门槛产品,可采购
+              <a-input-number v-model="form.quotaAmount" :max="999999" :min="0" :precision="0" size="small"/>
+              个特价产品(配额算销售额)
             </div>
           </div>
         </a-form-model-item>
-        <a-form-model-item prop="minOrderFlag" label="订单起订金额">
-          <a-select default-value="1" v-model="form.minOrderFlag" style="width: 160px" size="small">
-            <a-select-option value="0">
-              不限
-            </a-select-option>
-            <a-select-option value="1">
-              限制
-            </a-select-option>
-          </a-select>
-          <a-input-number
-            v-show="form.minOrderFlag && form.minOrderFlag=='1'"
+        <a-form-model-item label="特价规则" prop="discountType">
+          <a-select
+            default-value="0"
+            v-model="form.discountType"
+            placeholder="请选择"
+            style="width:60%;"
             size="small"
-            style="margin-left:10px;width:300px;"
-            v-model="form.minOrderAmount"
-            :min="0"
-            :step="1"
-            :max="999999"
-            :precision="2"
-            placeholder="请输入金额"/>
-        </a-form-model-item>
-        <a-form-model-item prop="upperLimitFlag" label="活动经费上限">
-          <a-select default-value="1" v-model="form.upperLimitFlag" style="width: 160px" size="small">
+            @change="handleDiscountType"
+            allowClear>
             <a-select-option value="0">
-              不限
+              手动输入特价
             </a-select-option>
             <a-select-option value="1">
-              限制
+              各级别价打折
+            </a-select-option>
+            <a-select-option value="2">
+              各级别价直降
             </a-select-option>
           </a-select>
-          <a-input-number
-            v-show="form.upperLimitFlag&&form.upperLimitFlag=='1'"
+          <a-table
+            v-show="form.discountType!=0"
+            class="sTable"
+            ref="setTable"
             size="small"
-            style="margin-left:10px;width:300px;"
-            v-model="form.upperLimitAmount"
-            :min="0"
-            :step="1"
-            :max="999999"
-            :precision="2"
-            placeholder="请输入金额"/>
+            :rowKey="(record) => record.id"
+            :columns="setColumns"
+            :dataSource="setTableData"
+            :pagination="false"
+            style="width:60%;"
+            bordered>
+            <template slot="provinceDiscount" slot-scope="text, record">
+              <a-input-number
+                size="small"
+                v-model="record.provinceValue"
+                :min="0"
+                :step="1"
+                :precision="2"
+                :max="999999"
+                placeholder="请输入"/>%
+            </template>
+            <template slot="cityDiscount" slot-scope="text, record">
+              <a-input-number
+                size="small"
+                v-model="record.cityValue"
+                :min="record.provinceValue||0"
+                :step="1"
+                :precision="2"
+                :max="999999"
+                placeholder="请输入"/>%
+            </template>
+            <template slot="specialDiscount" slot-scope="text, record">
+              <a-input-number
+                size="small"
+                v-model="record.specialValue"
+                :min="record.cityValue ||0"
+                :step="1"
+                :precision="2"
+                :max="999999"
+                placeholder="请输入"/>%
+            </template>
+            <template slot="provincePrice" slot-scope="text, record">
+              <a-input-number
+                size="small"
+                :value="record.provinceValue"
+                :min="0"
+                :step="1"
+                :precision="2"
+                :max="999999"
+                placeholder="请输入"
+                @blur="handleProvincePrice"/>
+            </template>
+            <template slot="cityPrice" slot-scope="text, record">
+              <a-input-number
+                size="small"
+                :value="record.cityValue"
+                :min="0"
+                :step="1"
+                :precision="2"
+                :max="999999"
+                placeholder="请输入"
+                @blur="handleCityPrice"/>
+            </template>
+            <template slot="specialPrice" slot-scope="text, record">
+              <a-input-number
+                size="small"
+                :value="record.specialValue"
+                :min="0"
+                :step="1"
+                :precision="2"
+                :max="999999"
+                placeholder="请输入"
+                @blur="handleSpecialPrice"/>
+            </template>
+          </a-table>
         </a-form-model-item>
       </a-form-model>
       <a-card size="small" :bordered="false" class="pages-wrap">
-        <div class="flex">
+        <div class="flex" style="margin-bottom:10px;">
           <a-radio-group v-model="chooseVal" button-style="solid">
             <a-radio-button value="a" v-show="form.gateFlag==='1'">
               门槛产品
@@ -131,8 +194,8 @@
               @click="addProducts">+新增产品</a-button>
           </div>
         </div>
-        <div v-show="chooseVal=='a'"><tableType1 ref="cillProduct"></tableType1></div>
-        <div v-show="chooseVal=='d'"><tableType3 ref="specialProduct"></tableType3></div>
+        <div v-show="chooseVal=='a'"><tableType1 :unitTypeList="unitTypeDataList" ref="cillProduct"></tableType1></div>
+        <div v-show="chooseVal=='d'"><tableType3 :setData="setTableData" :rulesType="form.discountType" :unitTypeList="unitTypeDataList" ref="specialProduct"></tableType3></div>
       </a-card>
       <div class="btn-cont">
         <a-button id="promotionList-basicInfo-modal-back" @click="isShow = false">取消</a-button>
@@ -148,7 +211,7 @@
       @close="openProductsModal=false"
       @ok="handleProductsAdd" />
     <!-- 导入产品 -->
-    <importGuideModal :goodFlag="chooseVal=='a'?'1':'0'" :openModal="openGuideModal" @close="closeGuideModel" @ok="hanldeOk" />
+    <importGuideModal :goodFlag="chooseVal=='a'?'1':'0'" :rulesType="form.discountType" :openModal="openGuideModal" @close="closeGuideModel" @ok="hanldeOk" />
   </a-modal>
 </template>
 
@@ -157,9 +220,10 @@ import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
 import tableType1 from './tableType1.vue'
 import tableType3 from './tableType3.vue'
-import { promotionSave, getRuleDetail, getNewScopeSn } from '@/api/promotion'
+import { promotionSave, getRuleDetail } from '@/api/promotion'
 import chooseProductsModal from './chooseProductsModal.vue'
 import ImportGuideModal from './importGuideModal.vue'
+import { getLookUpData } from '@/api/data'
 export default {
   name: 'PromotionListBasicInfoModal',
   mixins: [commonMixin],
@@ -188,29 +252,76 @@ export default {
       },
       form: {
         promotionRuleType: 'PROMO_PROD', // 特价产品
-        description: '',
+        description: '', // 规则简称
         gateFlag: '0', // 门槛
         gateType: undefined,
-        gateAmount: undefined,
+        gateValue: undefined,
+        gateUnit: 'GE',
+        quotaUnit: undefined,
         quotaAmount: undefined,
-        minOrderFlag: '0', // 起订金额
-        minOrderAmount: undefined,
-        upperLimitFlag: '0', // 活动经费上限
-        upperLimitAmount: undefined
+        discountType: '0', // 特价规则
+        gateInfo: undefined,
+        ruleInfo: undefined
       },
       rules: {
         description: [ { required: true, message: '请输入规则简称', trigger: 'blur' } ],
         gateFlag: [ { required: true, message: '请选择规则门槛', trigger: 'change' } ],
-        minOrderFlag: [{ required: true, message: '请选择订单起订金额', trigger: 'change' }],
-        upperLimitFlag: [{ required: true, message: '请选择活动经费上限', trigger: 'change' }]
+        discountType: [{ required: true, message: '请选择特价规则', trigger: 'change' }]
       },
+      setTableData: null,
       chooseVal: 'a',
       openProductsModal: false,
       chooseProducts: [],
-      openGuideModal: false// 导入弹窗
+      openGuideModal: false, // 导入弹窗
+      code: 'SCOPE_UNIT_TYPE', // 起订类型数据字典
+      unitTypeDataList: []
+    }
+  },
+  computed: {
+    setColumns () {
+      const _this = this
+      var arr = []
+      if (_this.form.discountType === '1') {
+        arr = [
+          { title: '省价折扣', scopedSlots: { customRender: 'provinceDiscount' }, width: '33%', align: 'center' },
+          { title: '市价折扣', scopedSlots: { customRender: 'cityDiscount' }, width: '33%', align: 'center' },
+          { title: '特约折扣', scopedSlots: { customRender: 'specialDiscount' }, width: '33%', align: 'center' }
+        ]
+      } else if (_this.form.discountType === '2') {
+        arr = [
+          { title: '省价直降', scopedSlots: { customRender: 'provincePrice' }, width: '33%', align: 'center' },
+          { title: '市价直降', scopedSlots: { customRender: 'cityPrice' }, width: '33%', align: 'center' },
+          { title: '特约直降', scopedSlots: { customRender: 'specialPrice' }, width: '33%', align: 'center' }
+        ]
+      }
+      return arr
     }
   },
   methods: {
+    // 单位切换时,满赠规则数据清空
+    handleUnit (val) {
+      this.form.gateUnit = val
+      this.form.gateValue = undefined
+    },
+    handleProvincePrice (e) {
+      this.setTableData[0].provinceValue = Number(e.target.value)
+    },
+    handleCityPrice (e) {
+      this.setTableData[0].cityValue = Number(e.target.value)
+    },
+    handleSpecialPrice (e) {
+      this.setTableData[0].specialValue = Number(e.target.value)
+    },
+    // 特价规则切换时清空数据
+    handleDiscountType (val) {
+      this.form.discountType = val
+      this.$refs.specialProduct.reSetTableData()
+      this.setTableData = [{
+        provinceValue: undefined,
+        cityValue: undefined,
+        specialValue: undefined
+      }]
+    },
     // 导入
     closeGuideModel () {
       this.openGuideModal = false
@@ -222,13 +333,13 @@ export default {
       } else {
         this.chooseVal = 'd'
         this.form.gateType = undefined
-        this.form.gateAmount = undefined
+        this.form.gateValue = undefined
         this.form.quotaAmount = undefined
       }
     },
     changeGateTypeFlag (val) {
       this.form.gateType = val
-      this.form.gateAmount = undefined
+      this.form.gateValue = undefined
       this.form.quotaAmount = undefined
     },
     //  保存
@@ -237,12 +348,12 @@ export default {
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
           // 验证必填
-          if (_this.form.gateFlag == '1') {
+          if (_this.form.gateFlag === '1') {
             if (!_this.form.gateType) {
               _this.$message.warning('请选择规则门槛设置类型!')
               return
             }
-            if (!_this.form.gateAmount) {
+            if (!_this.form.gateValue) {
               _this.$message.warning('规则门槛条件不能为空!')
               return
             }
@@ -251,24 +362,17 @@ export default {
               return
             }
           }
-          if (_this.form.minOrderFlag == 1 && !_this.form.minOrderAmount) {
-            _this.$message.warning('请输入订单起订限制金额数!')
-            return
-          }
-          if (_this.form.minOrderFlag == 0) {
-            _this.form.minOrderAmount = undefined
-          }
-          if (_this.form.upperLimitFlag == 1 && !_this.form.upperLimitAmount) {
-            _this.$message.warning('请输入活动经费上限金额!')
-            return
-          }
-          if (_this.form.upperLimitFlag == 0) {
-            _this.form.upperLimitAmount = undefined
+          // 判断特价规则必填
+          if (_this.form.discountType != '0' && _this.setTableData) {
+            if (_this.setTableData[0].provinceValue == undefined || _this.setTableData[0].cityValue == undefined || _this.setTableData[0].specialValue == undefined) {
+              _this.$message.warning('特价规则条件不能为空!')
+              return
+            }
           }
           const form = JSON.parse(JSON.stringify(_this.form))
-          if (form.gateFlag == '1') {
+          if (form.gateFlag === '1') {
             form.gateProductList = _this.$refs.cillProduct.getResultVal()
-            form.gateAmount = form.gateType === 'RATIO_AMOUNT' ? form.gateAmount / 100 : form.gateAmount
+            form.gateValue = form.gateType === 'RATIO_AMOUNT' ? form.gateValue / 100 : form.gateValue
             if (form.gateProductList.length == 0) {
               _this.$message.warning('请添加门槛产品!')
               return
@@ -284,11 +388,15 @@ export default {
                 return
               }
             }
+            form.gateUnit = form.gateType == 'RATIO_AMOUNT' ? 'RATIO' : form.gateType == 'MIN_AMOUNT' ? 'YUAN' : form.gateUnit
+            form.quotaUnit = 'GE'
           } else {
             form.gateProductList = []
-            form.gateAmount = ''
+            form.gateValue = ''
             form.quotaAmount = ''
             form.gateType = undefined
+            form.gateUnit = 'GE'
+            form.quotaUnit = undefined
           }
           form.specialProductList = _this.$refs.specialProduct.getResultVal()
           if (form.specialProductList.length == 0) {
@@ -306,8 +414,9 @@ export default {
               _this.$message.warning('订单起订量设置不能为空!')
               return
             }
+          }
+          if (form.discountType === '0') { // 手动输入
             const isCountEmpty = _this.isNumEmpty(form.specialProductList)
-            const isMoneyEmpty = _this.isNumEmpty(form.specialProductList)
             if (isCountEmpty.flag) {
               _this.$message.warning('折扣不能为空!')
               return
@@ -316,8 +425,35 @@ export default {
               _this.$message.warning('折扣金额不能为空!')
               return
             }
+          } else {
+            // if (form.discountType === '2') { // 直降价格为负判断
+            //   const hasNegativePrice = form.specialProductList.some((item) => (item.provinceDiscountPrice < 0 || item.cityDiscountPrice < 0 || item.specialDiscountPrice < 0))
+            //   if (hasNegativePrice) {
+            //     _this.$message.warning('直降后价格不能为负值!')
+            //     return
+            //   }
+            // }
+            form.provinceValue = _this.setTableData[0].provinceValue
+            form.cityValue = _this.setTableData[0].cityValue
+            form.specialValue = _this.setTableData[0].specialValue
           }
           form.promotionSn = _this.promotionSn
+          if (form.gateFlag == '1') {
+            if (form.gateType === 'RATIO_AMOUNT') {
+              form.gateInfo = '购买门槛产品金额' + (form.gateValue * 100).toFixed(2) + '%作为配额'
+            } else if (form.gateType === 'MIN_AMOUNT') {
+              form.gateInfo = '购买门槛产品满最低金额' + form.gateValue + '不限制配额'
+            } else {
+              form.gateInfo = '购买每满' + form.gateValue + form.gateUnit == 'YUAN' ? '元' : '个' + '门槛产品,可采购' + form.quotaAmount + '个特价产品(配额算销售额)'
+            }
+          }
+          if (form.discountType == '0') {
+            form.ruleInfo = '手动输入特价'
+          } else if (form.discountType == '1') {
+            form.ruleInfo = '各级别价打折;省级折扣' + form.provinceValue.toFixed(2) + '%,市级折扣' + form.cityValue.toFixed(2) + '%,特约折扣' + form.specialValue.toFixed(2) + '%'
+          } else {
+            form.ruleInfo = '各级别价直降;省级直降' + form.provinceValue + ',市级直降' + form.cityValue + ',特约直降' + form.specialValue
+          }
           _this.spinning = true
           promotionSave(form).then(res => {
             if (res.status == 200) {
@@ -379,23 +515,26 @@ export default {
     resetSearchForm () {
       this.form = {
         promotionRuleType: 'PROMO_PROD', // 特价产品
-        description: '',
+        description: '', // 规则简称
         gateFlag: '0', // 门槛
         gateType: undefined,
-        gateAmount: undefined,
+        gateValue: undefined,
+        gateUnit: 'GE',
         quotaAmount: undefined,
-        minOrderFlag: '1', // 起订金额
-        minOrderAmount: undefined,
-        upperLimitFlag: '1', // 活动经费上限
-        upperLimitAmount: undefined,
+        discountType: '0', // 特价规则
         gateProductList: undefined,
-        specialProductList: undefined
+        specialProductList: undefined,
+        quotaUnit: undefined
       }
       this.$nextTick(() => {
         this.$refs.ruleForm.resetFields()
         this.$refs.cillProduct.reSetTableData()
         this.$refs.specialProduct.reSetTableData()
       })
+      if (this.form.discountType != '0') {
+        this.$refs[0].setTable.clearTable()
+      }
+      this.setTableData = []
     },
     // 获取编辑详情
     getDetail () {
@@ -405,7 +544,14 @@ export default {
           this.chooseVal = res.data.gateFlag == '0' ? 'd' : 'a'
           const resultObj = res.data
           if (resultObj.gateFlag === '1') {
-            resultObj.gateAmount = resultObj.gateType === 'RATIO_AMOUNT' ? resultObj.gateAmount * 100 : resultObj.gateAmount
+            resultObj.gateValue = resultObj.gateType === 'RATIO_AMOUNT' ? resultObj.gateValue * 100 : resultObj.gateValue
+          }
+          if (resultObj.discountType != '0') {
+            _this.setTableData = [{
+              provinceValue: resultObj.provinceValue,
+              cityValue: resultObj.cityValue,
+              specialValue: resultObj.specialValue
+            }]
           }
           // 重新组成保存数据
           if (resultObj.gateProductList && resultObj.gateProductList.length > 0) {
@@ -444,11 +590,9 @@ export default {
             const num = 3
             for (var i = 0; i < num; i++) {
               if (item['productTypeName' + (i + 1)]) {
-                // item.title += item['productTypeName' + (i + 1)] + (item['productTypeName' + (i + 1)] ? '/' : '')
                 typeObj['productTypeSn' + (i + 1)] = item['productTypeSn' + (i + 1)] ? item['productTypeSn' + (i + 1)] : ''
               }
             }
-            // item.title = item.title.slice(0, item.title.length - 1)
             if (item.productTypeName3) {
               item.title = item.productTypeName2 + '/' + item.productTypeName3
             } else if (!item.productTypeName3 && item.productTypeName2) {
@@ -490,14 +634,39 @@ export default {
         arr.forEach(item => {
           item = { ...item, ...item.product }
           item.code = item.productCode
-          if (item.provincePrice) {
-            item.provinceDiscountRate = Math.floor(((item.provinceDiscountPriceText / item.provincePrice) * 100).toFixed(2))
-          }
-          if (item.cityPrice) {
-            item.cityDiscountRate = Math.floor(((item.cityDiscountPriceText / item.cityPrice) * 100).toFixed(2))
-          }
-          if (item.specialPrice) {
-            item.specialDiscountRate = Math.floor(((item.specialDiscountPriceText / item.specialPrice) * 100).toFixed(2))
+          if (this.form.discountType == '0') {
+            if (item.provincePrice) {
+              item.provinceDiscountRate = Math.floor(((item.provinceDiscountPriceText / item.provincePrice) * 100).toFixed(2))
+            }
+            if (item.cityPrice) {
+              item.cityDiscountRate = Math.floor(((item.cityDiscountPriceText / item.cityPrice) * 100).toFixed(2))
+            }
+            if (item.specialPrice) {
+              item.specialDiscountRate = Math.floor(((item.specialDiscountPriceText / item.specialPrice) * 100).toFixed(2))
+            }
+          } else if (this.form.discountType == '1') {
+            if (item.provincePrice) {
+              item.provinceDiscountRate = this.form.provinceValue
+              item.provinceDiscountPriceText = (item.provincePrice * this.form.provinceValue / 100).toFixed(2)
+            }
+            if (item.cityPrice) {
+              item.cityDiscountRate = this.form.cityValue
+              item.cityDiscountPriceText = (item.cityPrice * this.form.cityValue / 100).toFixed(2)
+            }
+            if (item.specialPrice) {
+              item.specialDiscountRate = this.form.specialValue
+              item.specialDiscountPriceText = (item.specialPrice * this.form.specialValue / 100).toFixed(2)
+            }
+          } else {
+            if (item.provincePrice) {
+              item.provinceSubtract = item.provincePrice - this.form.provinceValue
+            }
+            if (item.cityPrice) {
+              item.citySubtract = item.cityPrice - this.form.cityValue
+            }
+            if (item.specialPrice) {
+              item.specialSubtract = item.specialPrice - this.form.specialValue
+            }
           }
           const flag = dataList.includes(item.productSn)
           if (!flag) {
@@ -561,15 +730,26 @@ export default {
         _this.handleProductsOk(newConArr)
       }
     },
+    // 生成随机数
+    generateUniqueRandomNumber () {
+      const timestamp = new Date().getTime()
+      const randomNumber = Math.floor(Math.random() * 1e5).toString().padStart(5, '0')
+      const uniqueRandomNumber = timestamp + randomNumber
+      return uniqueRandomNumber
+    },
     // +新增产品
     handleProductsOk (con) {
       const _this = this
+      _this.spinning = true
+      setTimeout(() => {
+        _this.spinning = false
+      }, 1500)
       con.forEach(async (item) => {
         const chooseProductsList = []
-        const getSn = await getNewScopeSn({})
-        if (getSn.status == 200) {
+        const getSn = this.generateUniqueRandomNumber()
+        if (getSn) {
           const newData = {
-            productScopeSn: getSn.data,
+            productScopeSn: getSn,
             dataSourceOrigin: '1',
             productTypeArr: [],
             productTypeList: [],
@@ -585,8 +765,8 @@ export default {
             provinceDiscountPrice: item.provinceDiscountPriceText,
             cityDiscountPrice: item.cityDiscountPriceText,
             specialDiscountPrice: item.specialDiscountPriceText,
-            unitType: item.unitType,
-            unitQty: item.unitQty,
+            unitType: item.unitType || 'SL',
+            unitQty: item.unitQty || '1',
             provinceDiscountRate: item.provinceDiscountRate ? item.provinceDiscountRate : undefined,
             cityDiscountRate: item.cityDiscountRate ? item.cityDiscountRate : undefined,
             specialDiscountRate: item.specialDiscountRate ? item.specialDiscountRate : undefined
@@ -618,6 +798,18 @@ export default {
         }
         _this.$refs.specialProduct.setSourceData(chooseProductsList)
       })
+    },
+    getUnitTypeList () {
+      const _this = this
+      getLookUpData({
+        pageNo: 1,
+        pageSize: 1000,
+        lookupCode: _this.code
+      }).then(res => {
+        if (res.status == 200) {
+          _this.unitTypeDataList = res.data.list
+        }
+      })
     }
   },
   watch: {
@@ -631,6 +823,8 @@ export default {
         this.$emit('close')
         this.resetSearchForm()
       } else {
+        // 获取起订类型数据字典
+        this.getUnitTypeList()
         if (this.itemSn) {
           this.getDetail()
         } else {
@@ -641,8 +835,11 @@ export default {
   }
 }
 </script>
-
 <style lang="less" scoped>
+  // .ant-modal-confirm-body{
+  //   max-height: 500px;
+  //   overflow-y:scroll;
+  // }
   .promotionList-basicInfo-modal{
     /deep/.ant-modal-body {
       padding: 20px 30px;
@@ -661,7 +858,7 @@ export default {
     }
     .btn-cont {
       text-align: center;
-      margin: 35px 0 10px;
+      margin: 20px 0 10px;
     }
     .flex{
       display:flex;
@@ -669,5 +866,8 @@ export default {
       justify-content:space-between;
     }
   }
+  /deep/.ve-table{
+    border-radius:5px;
+  }
 
 </style>

+ 45 - 37
src/views/promotionRulesManagement/dealerPromotions/tableType1.vue

@@ -107,14 +107,17 @@
       </template>
       <!-- 设置起订量 -->
       <template slot="setNum" slot-scope="text, record">
-        <v-select
+        <a-select
+          default-value="SL"
           v-model="record.unitType"
           size="small"
-          ref="returnReason"
-          code="SCOPE_UNIT_TYPE"
-          placeholder="请选择"
           style="width:100%;"
-          allowClear></v-select>
+          placeholder="请选择"
+          allowClear>
+          <a-select-option :value="con.code" v-for="con in unitTypeList" :key="con.id">
+            {{ con.dispName }}
+          </a-select-option>
+        </a-select>
         <a-input-number
           size="small"
           style="margin-top:8px;width:100%;"
@@ -172,12 +175,17 @@ import { VSelect } from '@/components'
 import ChooseBrandModal from '@/views/common/chooseBrandModal.vue'
 import ChooseTypeModal from '@/views/common/chooseTypeModal.vue'
 import chooseProductsModal from './chooseProductsModal.vue'
-import { getNewScopeSn } from '@/api/promotion'
 import { forEach } from 'core-js/library/es6/array'
 export default {
   name: 'TableType1',
   mixins: [commonMixin],
   components: { VSelect, ChooseBrandModal, ChooseTypeModal, chooseProductsModal },
+  props: {
+    unitTypeList: { // 起订类型数据
+      type: Array,
+      default: () => []
+    }
+  },
   data () {
     return {
       spinning: false,
@@ -205,27 +213,30 @@ export default {
       this.chooseProducts = []
       this.openProductsModal = false
     },
+    // 生成随机数
+    generateUniqueRandomNumber () {
+      const timestamp = new Date().getTime()
+      const randomNumber = Math.floor(Math.random() * 1e5).toString().padStart(5, '0')
+      const uniqueRandomNumber = timestamp + randomNumber
+      return uniqueRandomNumber
+    },
     // 新增一行
     handleAddRow () {
       const _this = this
-      _this.spinning = false
-      getNewScopeSn({}).then(res => {
-        if (res.status == 200) {
-          const newData = {
-            productScopeSn: res.data,
-            productTypeArr: [],
-            productTypeList: [],
-            productBrandArr: [],
-            productBrandList: [],
-            productThisList: [],
-            unitType: 'SL',
-            unitQty: 1
-          }
-          _this.dataSource.push(newData)
-        } else {
-          _this.spinning = false
+      const newSn = _this.generateUniqueRandomNumber()
+      if (newSn) {
+        const newData = {
+          productScopeSn: newSn,
+          productTypeArr: [],
+          productTypeList: [],
+          productBrandArr: [],
+          productBrandList: [],
+          productThisList: [],
+          unitType: 'SL',
+          unitQty: 1
         }
-      })
+        _this.dataSource.push(newData)
+      }
     },
     // 导入新增一行
     importRow (list) {
@@ -237,20 +248,17 @@ export default {
       })
       if (list.length > 0) {
         list.forEach(con => {
-          getNewScopeSn({}).then(res => {
-            if (res.status == 200) {
-              const newData = {
-                productScopeSn: res.data,
-                productThisList: [{
-                  productCode: con.productCode,
-                  productSn: con.product.productSn
-                }],
-                unitType: con.unitType,
-                unitQty: con.unitQty
-              }
-              _this.dataSource.push(newData)
-            }
-          })
+          const newSn = _this.generateUniqueRandomNumber()
+          const newData = {
+            productScopeSn: newSn,
+            productThisList: [{
+              productCode: con.productCode,
+              productSn: con.product.productSn
+            }],
+            unitType: con.unitType,
+            unitQty: con.unitQty
+          }
+          _this.dataSource.push(newData)
         })
       } else {
         _this.$message.warning('请勿导入重复数据!')

+ 0 - 611
src/views/promotionRulesManagement/dealerPromotions/tableType2.vue

@@ -1,611 +0,0 @@
-<template>
-  <div class="pages-wrap">
-    <!-- 列表 -->
-    <a-table
-      class="sTable"
-      style="margin-top:10px;"
-      ref="table"
-      size="small"
-      :pagination="false"
-      :rowKey="(record) => record.productScopeSn"
-      :columns="columns"
-      :data-source="dataSource"
-      bordered>
-      <!-- 产品分类 -->
-      <template slot="productType" slot-scope="text, record,index">
-        <div style="max-height:126px;width:100%;overflow-y:scroll;" v-if="!record.productThisList || record.productThisList.length==0">
-          <a-row v-if="record.productTypeArr && record.productTypeArr.length>0">
-            <a-col :span="18">
-              <div v-for="con in record.productTypeArr" :key="con.id">
-                <a-tooltip v-if="con.title&&con.title.length > 12" :title="con.title">
-                  <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,con,'typeList')">
-                    {{ `${con.title.slice(0, 12)}...` }}
-                  </a-tag>
-                </a-tooltip>
-                <a-tag v-else style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,con,'typeList')">
-                  {{ con.title }}
-                </a-tag>
-              </div>
-            </a-col>
-            <a-col :span="6" style="text-align:right;">
-              <a-tag style="background: #fff; borderStyle: dashed;" @click="addClassifyTag(index, record)" color="blue">
-                <a-icon type="plus" />
-              </a-tag>
-            </a-col>
-          </a-row>
-          <a-row v-else>
-            <a-col :span="24">
-              <a-tag style="background: #fff; borderStyle: dashed;" @click="addClassifyTag(index, record)" color="blue">
-                <a-icon type="plus" />
-              </a-tag>
-            </a-col>
-          </a-row>
-        </div>
-        <div v-else>
-          <a-tag style="background: #fff; borderStyle: dashed;" :style="{color:'grey',cursor:'not-allowed'}">
-            <a-icon type="plus" />
-          </a-tag>
-        </div>
-      </template>
-      <!-- 品牌 -->
-      <template slot="productBrand" slot-scope="text, record,index">
-        <div style="max-height:126px;overflow-y:scroll;" v-if="!record.productThisList || record.productThisList.length==0">
-          <a-row v-if="record.productBrandArr && record.productBrandArr.length>0">
-            <a-col :span="18">
-              <a-tag v-for="item in record.productBrandArr" :key="item.brandSn" style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')">
-                {{ item.brandName }}
-              </a-tag>
-            </a-col>
-            <a-col :span="6" style="text-align:right;">
-              <a-tag style="background: #fff; borderStyle: dashed;" @click="addBrandTag(index, record)" color="blue">
-                <a-icon type="plus" />
-              </a-tag>
-            </a-col>
-          </a-row>
-          <a-row v-else>
-            <a-col :span="24">
-              <a-tag style="background: #fff; borderStyle: dashed;" @click="addBrandTag(index, record)" color="blue">
-                <a-icon type="plus" />
-              </a-tag>
-            </a-col>
-          </a-row>
-        </div>
-        <div v-else>
-          <a-tag style="background: #fff; borderStyle: dashed;" :style="{color:'grey',cursor:'not-allowed'}">
-            <a-icon type="plus" />
-          </a-tag>
-        </div>
-      </template>
-      <!-- 产品 -->
-      <template slot="product" slot-scope="text, record,index">
-        <div v-if="(record.productBrandArr && record.productBrandArr.length>0)||(record.productTypeArr && record.productTypeArr.length>0)">
-          <a-tag style="background: #fff; borderStyle: dashed;" :style="{color:'grey',cursor:'not-allowed'}">
-            <a-icon type="plus" />
-          </a-tag>
-        </div>
-        <div style="max-height:126px;overflow-y:scroll;" v-else>
-          <a-row v-if="record.productThisList && record.productThisList.length>0">
-            <a-col :span="18">
-              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'productList')" v-for="item in record.productThisList" :key="item.productSn">
-                {{ item.productCode }}
-              </a-tag>
-            </a-col>
-            <a-col :span="6" style="text-align:right;">
-              <a-tag style="background: #fff; borderStyle: dashed;" @click="addProductTag(index, record)" color="blue">
-                <a-icon type="plus" />
-              </a-tag>
-            </a-col>
-          </a-row>
-          <a-row v-else>
-            <a-col :span="24">
-              <a-tag style="background: #fff; borderStyle: dashed;" @click="addProductTag(index, record)" color="blue">
-                <a-icon type="plus" />
-              </a-tag>
-            </a-col>
-          </a-row>
-        </div>
-      </template>
-      <!-- 操作 -->
-      <span slot="action" slot-scope="text,record">
-        <a-button
-          size="small"
-          type="link"
-          class="button-error"
-          @click="handleDel(record)"
-        >
-          删除
-        </a-button>
-      </span>
-    </a-table>
-    <div class="btn-cont">
-      <a-button id="tableType1-add" type="primary" class="button-gray" @click="handleAddRow">+新增一行</a-button>
-    </div>
-    <!-- 选择产品品牌 -->
-    <chooseBrandModal
-      pageType="1"
-      ref="brandBox"
-      :openModal="openBrandModal"
-      :chooseData="chooseBrand"
-      @close="openBrandModal=false"
-      @ok="handleBrandOk" />
-    <!-- 选择产品分类 -->
-    <chooseTypeModal
-      ref="typeBox"
-      :openModal="openTypeModal"
-      :linkageStatus="false"
-      :chooseData="chooseType"
-      @close="openTypeModal=false"
-      @ok="handleTypeOk" />
-    <!-- 选择产品 -->
-    <chooseProductsModal
-      ref="productBox"
-      type="dealership"
-      :openModal="openProductsModal"
-      :chooseData="chooseProducts"
-      @close="openProductsModal=false"
-      @ok="handleProductsOk" />
-  </div>
-</template>
-
-<script>
-import { commonMixin } from '@/utils/mixin'
-import { VSelect } from '@/components'
-import ChooseBrandModal from '@/views/common/chooseBrandModal.vue'
-import ChooseTypeModal from '@/views/common/chooseTypeModal.vue'
-import chooseProductsModal from './chooseProductsModal.vue'
-import { getNewScopeSn } from '@/api/promotion'
-export default {
-  name: 'TableType1',
-  mixins: [commonMixin],
-  components: { VSelect, ChooseBrandModal, ChooseTypeModal, chooseProductsModal },
-  data () {
-    return {
-      spinning: false,
-      columns: [
-        { title: '产品分类', width: '30%', scopedSlots: { customRender: 'productType' }, align: 'center' },
-        { title: '品牌', width: '30%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
-        { title: '产品', width: '30%', scopedSlots: { customRender: 'product' }, align: 'center' },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
-      ],
-      dataSource: [],
-      openBrandModal: false,
-      openTypeModal: false,
-      openProductsModal: false,
-      chooseBrand: [],
-      chooseType: [],
-      brandTagIndex: null, // 所选品牌位置
-      classifyTagIndex: null, // 所选分类位置
-      productTagIndex: null, // 所选产品位置
-      chooseProducts: []
-    }
-  },
-  methods: {
-    // 新增一行
-    handleAddRow () {
-      const _this = this
-      _this.spinning = false
-      getNewScopeSn({}).then(res => {
-        if (res.status == 200) {
-          const newData = {
-            productScopeSn: res.data,
-            productTypeArr: [],
-            productTypeList: [],
-            productBrandArr: [],
-            productBrandList: [],
-            productThisList: []
-          }
-          _this.dataSource.push(newData)
-        } else {
-          _this.spinning = false
-        }
-      })
-    },
-    // 导入新增一行
-    importRow (list) {
-      const _this = this
-      const dataList = _this.setShowData('This')
-      dataList.forEach(item => {
-        const pos = list.indexOf(con => item.product.productSn == item.goodsSn)
-        list.splice(pos, 1)
-      })
-      if (list.length > 0) {
-        list.forEach(con => {
-          getNewScopeSn({}).then(res => {
-            if (res.status == 200) {
-              const newData = {
-                productScopeSn: res.data,
-                productThisList: [{
-                  productCode: con.productCode,
-                  productSn: con.product.productSn
-                }]
-              }
-              _this.dataSource.push(newData)
-            }
-          })
-        })
-      } else {
-        _this.$message.warning('请勿导入重复数据!')
-      }
-    },
-    // 删除一行
-    handleDel (row) {
-      const pos = this.dataSource.findIndex(con => con.productScopeSn == row.productScopeSn)
-      this.dataSource.splice(pos, 1)
-    },
-    // 添加产品分类
-    addClassifyTag (pos, row) {
-      this.classifyTagIndex = pos
-      this.openTypeModal = true
-      this.chooseType = this.handleRowData(row)
-      const getArr = this.setTypeShowData()
-      // 无品牌有分类的选择数据
-      const onlyTypeData = this.onlyType()
-      // 获取品牌重复数据
-      var flag = false
-      var c_typeArr = []
-      this.dataSource.forEach(item => {
-        if ((item.productTypeArr && item.productTypeArr.length > 0) && (item.productBrandList && item.productBrandList.length > 0)) {
-          item.productBrandList.forEach((con) => {
-            row.productBrandList.forEach(newCon => {
-              if (newCon.productBrandSn == con.productBrandSn) {
-                flag = true
-                c_typeArr = c_typeArr.concat(item.productTypeList)
-              }
-            })
-          })
-        }
-      })
-      const disTypeList = []
-      getArr.forEach(con => {
-        c_typeArr.forEach(item => {
-          for (const i in item) {
-            if (item[i] == con.goodsSn) {
-              disTypeList.push(con)
-            }
-          }
-        })
-      })
-      var uniqueArr = [...new Set(disTypeList)]
-
-      if (row.productBrandArr && row.productBrandArr.length == 0) {
-        this.$refs.typeBox.handleAllDisabled(onlyTypeData)
-      } else {
-        if (flag) {
-          this.$refs.typeBox.handleAllDisabled(uniqueArr)
-        } else {
-          this.chooseType = []
-          this.$refs.typeBox.handleAllDisabled([])
-        }
-      }
-    },
-    handleTypeOk (mainArr) {
-      const classifyArr = []
-      const newClassifyArr = []
-      mainArr.forEach(item => {
-        if (item.productTypeLevel == 1) {
-          if ((item.dataRef && !item.dataRef.children) || (!item.dataRef && !item.children)) {
-            const objType1 = {
-              productTypeSn1: item.snPaths
-            }
-            newClassifyArr.push(objType1)
-            const obj = JSON.parse(JSON.stringify(objType1))
-            obj.title = item.title
-            classifyArr.push(obj)
-          }
-        }
-        if (item.productTypeLevel == 2) {
-          if ((item.dataRef && !item.dataRef.children) || (!item.dataRef && !item.children)) {
-            const typeArr1 = item.snPaths ? item.snPaths.split(',') : []
-            const objType2 = {
-              productTypeSn1: typeArr1[0],
-              productTypeSn2: typeArr1[1]
-            }
-            newClassifyArr.push(objType2)
-            const obj = JSON.parse(JSON.stringify(objType2))
-            const newName = item.namePaths.split(',')
-            obj.title = newName[1]
-            classifyArr.push(obj)
-          }
-        }
-        if (item.productTypeLevel == 3) {
-          const typeArr2 = item.snPaths ? item.snPaths.split(',') : []
-          const objType3 = {
-            productTypeSn1: typeArr2[0],
-            productTypeSn2: typeArr2[1],
-            productTypeSn3: typeArr2[2]
-          }
-          newClassifyArr.push(objType3)
-          const obj = JSON.parse(JSON.stringify(objType3))
-          const newName = item.namePaths.split(',')
-          obj.title = newName[1] + '/' + newName[2]
-          obj.id = typeArr2[2]
-          classifyArr.push(obj)
-        }
-      })
-      this.dataSource[this.classifyTagIndex].productTypeList = newClassifyArr
-      this.dataSource[this.classifyTagIndex].productTypeArr = classifyArr
-    },
-    // 添加产品品牌
-    addBrandTag (pos, row) {
-      const _this = this
-      _this.brandTagIndex = pos
-      // 选中的所有品牌
-      const dataList = _this.setShowData('Brand')
-      _this.openBrandModal = true
-      // 回显当前行选中
-      const echoData = _this.handleEchoData('Brand', row.productBrandList)
-      _this.chooseBrand = echoData
-      // 只有品牌没有分类
-      const onlyBrandData = this.onlyBrand()
-      // 同行中分类是否与所选分类相同   已选分类
-      var flag = false
-      var c_brandArr = []
-      this.dataSource.forEach(item => {
-        if ((item.productTypeArr && item.productTypeArr.length > 0) && (item.productBrandList && item.productBrandList.length > 0)) {
-          item.productTypeArr.forEach((con) => {
-            row.productTypeArr.forEach(newCon => {
-              if (newCon.id == con.id) {
-                flag = true
-                c_brandArr = c_brandArr.concat(item.productBrandList)
-              }
-            })
-          })
-        }
-      })
-
-      const reBrandArr = c_brandArr.map(list => {
-        return list.productBrandSn
-      })
-      if (row.productTypeArr && row.productTypeArr.length == 0) {
-        _this.$refs.brandBox.handleDisabled(onlyBrandData)
-      } else {
-        if (flag) { // 当前行有重复分类
-          _this.$refs.brandBox.handleDisabled(reBrandArr)
-        } else {
-          _this.chooseBrand = []
-          _this.$refs.brandBox.handleDisabled([])
-        }
-      }
-    },
-    handleBrandOk (conList) {
-      const newConList = conList.map(con => {
-        return {
-          productBrandSn: con.brandSn
-        }
-      })
-      this.dataSource[this.brandTagIndex].productBrandArr = conList
-      this.dataSource[this.brandTagIndex].productBrandList = newConList
-    },
-    // 添加产品
-    addProductTag (pos, row) {
-      this.productTagIndex = pos
-      this.openProductsModal = true
-      const dataList = this.setShowData('This')
-      const echoData = this.handleEchoData('This', row.productThisList)
-      this.chooseProducts = echoData
-      this.$refs.productBox.handleDisabled(dataList)
-    },
-    handleProductsOk (arr) {
-      const newArr = []
-      arr.forEach(item => {
-        const obj = {
-          productCode: item.code,
-          productSn: item.productSn
-        }
-        newArr.push(obj)
-      })
-      this.dataSource[this.productTagIndex].productThisList = newArr
-    },
-    // 获取回显禁用数据
-    setShowData (name) {
-      const _this = this
-      const snArr = []
-      _this.dataSource.forEach(item => {
-        if (item['product' + name + 'List'] && item['product' + name + 'List'].length > 0) {
-          item['product' + name + 'List'].forEach(con => {
-            const newName = name === 'This' ? '' : name
-            snArr.push(con['product' + newName + 'Sn'])
-          })
-        }
-      })
-      return snArr
-    },
-    // 只有分类
-    onlyType (name, onlyName) {
-      const _this = this
-      const snArr = []
-      _this.dataSource.forEach(item => {
-        if (item.productTypeList && item.productTypeList.length > 0) {
-          if (!item.productBrandList || (item.productBrandList && item.productBrandList.length == 0)) {
-            item.productTypeList.forEach(con => {
-              for (const i in con) {
-                const newObj = {
-                  goodsSn: con[i]
-                }
-                if (i === 'productTypeSn1') {
-                  newObj.disabled = true
-                } else {
-                  newObj.disableCheckbox = true
-                }
-                snArr.push(newObj)
-              }
-            })
-          }
-        }
-      })
-      return snArr
-    },
-    // 只有品牌
-    onlyBrand () {
-      const _this = this
-      var snArr = []
-      _this.dataSource.forEach(item => {
-        if (item.productBrandList && item.productBrandList.length > 0) {
-          if (!item.productTypeArr || (item.productTypeArr && item.productTypeArr.length == 0)) {
-            item.productBrandList.forEach(con => {
-              snArr.push(con.productBrandSn)
-            })
-          }
-        }
-      })
-      return snArr
-    },
-    handleEchoData (name, conArr) {
-      if (conArr) {
-        conArr.map(item => {
-          if (name === 'This') {
-            item.code = item.productCode
-            item.goodsSn = item.productSn
-          } else {
-            item.goodsSn = item['product' + name + 'Sn']
-          }
-        })
-      } else {
-        conArr = []
-      }
-      return conArr
-    },
-    handleRowData (row) {
-      const echoData = []
-      row.productTypeList.forEach(item => {
-        for (const i in item) {
-          const newObj = {
-            goodsSn: item[i]
-          }
-          if (i === 'productTypeSn1') {
-            newObj.disabled = true
-          } else {
-            newObj.disableCheckbox = true
-          }
-          echoData.push(newObj)
-        }
-      })
-      return echoData
-    },
-    setTypeShowData () {
-      const _this = this
-      const snArr = []
-      _this.dataSource.forEach(item => {
-        if (item.productTypeList && item.productTypeList.length > 0) {
-          item.productTypeList.forEach(con => {
-            for (const i in con) {
-              const newObj = {
-                goodsSn: con[i]
-              }
-              if (i === 'productTypeSn1') {
-                newObj.disabled = true
-              } else {
-                newObj.disableCheckbox = true
-              }
-              snArr.push(newObj)
-            }
-          })
-        }
-      })
-      return snArr
-    },
-    // 获取表格数据
-    getResultVal () {
-      const resultObj = JSON.parse(JSON.stringify(this.dataSource))
-      resultObj.map(item => {
-        delete item.productTypeArr
-        delete item.productBrandArr
-        return item
-      })
-      return resultObj
-    },
-    setTabVal (formData) {
-      this.dataSource = formData
-    },
-    // 关闭时清空表格数据
-    reSetTableData () {
-      this.dataSource = []
-    },
-    // 删除标签
-    delLabel (sn, row, type) {
-      const pos = this.dataSource.findIndex(con => con.productScopeSn == sn)
-      if (type === 'typeList') {
-      // 判断品牌是否有重复 重复值有无分类
-        const isRepeatBrandFlag = this.isRepeatBrand(this.dataSource[pos])
-        const uniqueArr1 = this.dataSource[pos].productTypeList && this.dataSource[pos].productTypeList.length > 0 ? this.dataSource[pos].productTypeList : []
-        if (isRepeatBrandFlag.flag && isRepeatBrandFlag.noTypeFlag && uniqueArr1.length == 1) {
-          this.dataSource.splice(pos, 1)
-        } else {
-          const i = this.dataSource[pos].productTypeArr.findIndex(con => con.id == row.id)
-          this.dataSource[pos].productTypeArr.splice(i, 1)
-          this.dataSource[pos].productTypeList.splice(i, 1)
-        }
-      } else if (type === 'brandList') {
-        const isRepeatTypeFlag = this.isRepeatType(this.dataSource[pos])
-        const uniqueArr = this.dataSource[pos].productBrandList && this.dataSource[pos].productBrandList.length > 0 ? this.dataSource[pos].productBrandList : []
-        if (isRepeatTypeFlag.flag && isRepeatTypeFlag.noTypeFlag && uniqueArr.length == 1) {
-          this.dataSource.splice(pos, 1)
-        } else {
-          const j = this.dataSource[pos].productBrandArr.findIndex(con => con.brandSn == row.brandSn)
-          this.dataSource[pos].productBrandArr.splice(j, 1)
-          this.dataSource[pos].productBrandList.splice(j, 1)
-        }
-      } else {
-        const k = this.dataSource[pos].productThisList.findIndex(con => con.productSn == row.productSn)
-        this.dataSource[pos].productThisList.splice(k, 1)
-      }
-      this.$forceUpdate()
-    },
-    // 判断当前行是否有重复品牌
-    isRepeatBrand (row) {
-      var flag = false
-      var noTypeFlag = false
-      var c_typeArr = []
-      this.dataSource.forEach(item => {
-        if (item.productBrandList && item.productBrandList.length > 0) {
-          item.productBrandList.forEach((con) => {
-            row.productBrandList.forEach(newCon => {
-              if (newCon.productBrandSn == con.productBrandSn) {
-                flag = true
-                if (item.productTypeList && item.productTypeList.length == 0) {
-                  noTypeFlag = true
-                } else {
-                  c_typeArr = c_typeArr.concat(item.productTypeList)
-                }
-              }
-            })
-          })
-        }
-      })
-      return { list: c_typeArr, flag: flag, noTypeFlag: noTypeFlag }
-    },
-    isRepeatType (row) {
-      var flag = false
-      var noTypeFlag = false
-      var c_brandArr = []
-      this.dataSource.forEach(item => {
-        if (item.productTypeArr && item.productTypeArr.length > 0) {
-          item.productTypeArr.forEach((con) => {
-            row.productTypeArr.forEach(newCon => {
-              if (newCon.id == con.id) {
-                flag = true
-                if (item.productBrandList && item.productBrandList.length == 0) {
-                  noTypeFlag = true
-                } else {
-                  c_brandArr = c_brandArr.concat(item.productBrandList)
-                }
-              }
-            })
-          })
-        }
-      })
-      return { list: c_brandArr, flag: flag, noTypeFlag: noTypeFlag }
-    }
-  }
-}
-</script>
-
-<style lang="less" scoped>
-  .pages-wrap{
-    .btn-cont {
-      text-align: center;
-      margin: 10px 0;
-    }
-  }
-
-</style>

+ 190 - 79
src/views/promotionRulesManagement/dealerPromotions/tableType3.vue

@@ -83,23 +83,33 @@
       </template>
       <!-- 省价特价 -->
       <template slot="provincePrice" slot-scope="text, record">
-        <div v-if="record.dataSourceOrigin=='1'">
-          <a-input-number
-            size="small"
-            style="width:90%;"
-            v-model="record.provinceDiscountPrice"
-            :min="0"
-            :step="1"
-            :precision="2"
-            placeholder="请输入"
-            :max="999999"
-            @blur="e=>calculatePrice(e.target.value,record.productScopeSn,'province')"/>
+        <div v-if="rulesType==='0'">
+          <div v-if="record.dataSourceOrigin=='1'">
+            <a-input-number
+              size="small"
+              style="width:90%;"
+              v-model="record.provinceDiscountPrice"
+              :min="0"
+              :step="1"
+              :precision="2"
+              placeholder="请输入"
+              :max="999999"
+              @blur="e=>calculatePrice(e.target.value,record.productScopeSn,'province')"/>
+          </div>
+          <span v-else>--</span>
+        </div>
+        <div v-else >
+          <div v-if="record.provincePrice" style="width:90%;background:#ccc;border-radius: 3px;text-align:center;">
+            <span v-if="rulesType=='1'">{{ (setData[0].provinceValue||setData[0].provinceValue==0)?(record.provincePrice*setData[0].provinceValue/100).toFixed(2):'--' }}</span>
+            <span v-else>{{ (setData[0].provinceValue||setData[0].provinceValue==0)?(record.provincePrice - setData[0].provinceValue).toFixed(2):'--' }}</span>
+          </div>
+          <span v-else>--</span>
         </div>
-        <span v-else>--</span>
       </template>
       <!-- 省价折扣 -->
       <template slot="provinceDiscount" slot-scope="text, record">
-        <div v-if="record.dataSourceOrigin=='0'">
+        <div v-if="rulesType=='0'">
+          <div v-if="record.dataSourceOrigin=='0'">
             <a-input-number
               size="small"
               style="width:80%;"
@@ -109,28 +119,44 @@
               :precision="2"
               placeholder="请输入"
               :max="999999"/>%
+          </div>
+          <span v-else>{{ (record.provinceDiscountRate||record.provinceDiscountRate==0)?record.provinceDiscountRate+'%':'--' }}</span>
+        </div>
+        <div v-else>
+          <span v-if="rulesType=='1'">{{ (setData[0].provinceValue||setData[0].provinceValue==0)?setData[0].provinceValue.toFixed(2)+'%':'--' }}</span>
+          <span v-else>{{ setData[0].provinceValue?'-'+(setData[0].provinceValue).toFixed(2):setData[0].provinceValue==0?'0.00':'--' }}</span>
         </div>
-        <span v-else>{{ (record.provinceDiscountRate||record.provinceDiscountRate==0)?record.provinceDiscountRate+'%':'--' }}</span>
       </template>
       <!-- 市价特价 -->
       <template slot="cityPrice" slot-scope="text, record">
-        <div v-if="record.dataSourceOrigin=='1'">
-          <a-input-number
-            size="small"
-            style="width:90%;"
-            v-model="record.cityDiscountPrice"
-            :min="record.provinceDiscountPrice || 0"
-            :step="1"
-            :precision="2"
-            placeholder="请输入"
-            :max="999999"
-            @blur="e=>calculatePrice(e.target.value,record.productScopeSn,'city')"/>
+        <div v-if="rulesType==='0'">
+          <div v-if="record.dataSourceOrigin=='1'">
+            <a-input-number
+              size="small"
+              style="width:90%;"
+              v-model="record.cityDiscountPrice"
+              :min="record.provinceDiscountPrice || 0"
+              :step="1"
+              :precision="2"
+              placeholder="请输入"
+              :max="999999"
+              :disabled="rulesType!='0'"
+              @blur="e=>calculatePrice(e.target.value,record.productScopeSn,'city')"/>
+          </div>
+          <span v-else>--</span>
+        </div>
+        <div v-else >
+          <div v-if="record.cityPrice" style="width:90%;background:#ccc;border-radius: 3px;text-align:center;">
+            <span v-if="rulesType=='1'">{{ (setData[0].cityValue||setData[0].cityValue==0)?(record.cityPrice*setData[0].cityValue/100).toFixed(2):'--' }}</span>
+            <span v-else>{{ (setData[0].cityValue||setData[0].cityValue==0)?(record.cityPrice - setData[0].cityValue).toFixed(2):'--' }}</span>
+          </div>
+          <span v-else>--</span>
         </div>
-        <span v-else>--</span>
       </template>
       <!-- 市价折扣 -->
       <template slot="cityDiscount" slot-scope="text, record">
-        <div v-if="record.dataSourceOrigin=='0'">
+        <div v-if="rulesType=='0'">
+          <div v-if="record.dataSourceOrigin=='0'">
             <a-input-number
               size="small"
               style="width:80%;"
@@ -140,28 +166,44 @@
               :precision="2"
               placeholder="请输入"
               :max="999999"/>%
+          </div>
+          <span v-else>{{ (record.cityDiscountRate||record.cityDiscountRate==0)?record.cityDiscountRate+'%':'--' }}</span>
+        </div>
+        <div v-else>
+          <span v-if="rulesType=='1'">{{ (setData[0].cityValue||setData[0].cityValue==0)?setData[0].cityValue.toFixed(2)+'%':'--' }}</span>
+          <span v-else>{{ setData[0].cityValue?'-'+(setData[0].cityValue).toFixed(2):setData[0].cityValue==0?'0.00':'--' }}</span>
         </div>
-        <span v-else>{{ (record.cityDiscountRate||record.cityDiscountRate==0)?record.cityDiscountRate+'%':'--' }}</span>
       </template>
       <!-- 特约特价 -->
       <template slot="specialPrice" slot-scope="text, record">
-        <div v-if="record.dataSourceOrigin=='1'">
-          <a-input-number
-            size="small"
-            style="width:90%;"
-            v-model="record.specialDiscountPrice"
-            :min="record.cityDiscountPrice ||0"
-            :step="1"
-            :precision="2"
-            placeholder="请输入"
-            :max="999999"
-            @blur="e=>calculatePrice(e.target.value,record.productScopeSn,'special')"/>
+        <div v-if="rulesType==='0'">
+          <div v-if="record.dataSourceOrigin=='1'">
+            <a-input-number
+              size="small"
+              style="width:90%;"
+              v-model="record.specialDiscountPrice"
+              :min="record.cityDiscountPrice ||0"
+              :step="1"
+              :precision="2"
+              placeholder="请输入"
+              :max="999999"
+              :disabled="rulesType!='0'"
+              @blur="e=>calculatePrice(e.target.value,record.productScopeSn,'special')"/>
+          </div>
+          <span v-else>--</span>
+        </div>
+        <div v-else>
+          <div v-if="record.specialPrice" style="width:90%;background:#ccc;border-radius: 3px;text-align:center;">
+            <span v-if="rulesType=='1'">{{ (setData[0].specialValue||setData[0].specialValue==0)?(record.specialPrice*setData[0].specialValue/100).toFixed(2):'--' }}</span>
+            <span v-else>{{ (setData[0].specialValue||setData[0].specialValue==0)?(record.specialPrice - setData[0].specialValue).toFixed(2):'--' }}</span>
+          </div>
+          <span v-else>--</span>
         </div>
-        <span v-else>--</span>
       </template>
       <!-- 特约折扣 -->
       <template slot="specialDiscount" slot-scope="text, record">
-        <div v-if="record.dataSourceOrigin=='0'">
+        <div v-if="rulesType=='0'">
+          <div v-if="record.dataSourceOrigin=='0'">
             <a-input-number
               size="small"
               style="width:80%;"
@@ -171,19 +213,27 @@
               :precision="2"
               placeholder="请输入"
               :max="999999"/>%
+          </div>
+          <span v-else>{{ (record.specialDiscountRate||record.specialDiscountRate==0) ? record.specialDiscountRate+'%':'--' }}</span>
+        </div>
+        <div v-else>
+          <span v-if="rulesType=='1'">{{ (setData[0].specialValue||setData[0].specialValue==0)?setData[0].specialValue.toFixed(2)+'%':'--' }}</span>
+          <span v-else>{{ setData[0].specialValue?'-'+(setData[0].specialValue).toFixed(2):setData[0].specialValue==0?'0.00':'--' }}</span>
         </div>
-        <span v-else>{{ (record.specialDiscountRate||record.specialDiscountRate==0) ? record.specialDiscountRate+'%':'--' }}</span>
       </template>
       <!-- 设置起订量 -->
       <template slot="setNum" slot-scope="text, record">
-        <v-select
+        <a-select
+          default-value="SL"
           v-model="record.unitType"
           size="small"
-          ref="returnReason"
-          code="SCOPE_UNIT_TYPE"
           style="width:100%;"
           placeholder="请选择"
-          allowClear></v-select>
+          allowClear>
+          <a-select-option :value="con.code" v-for="con in unitTypeList" :key="con.id">
+            {{ con.dispName }}
+          </a-select-option>
+        </a-select>
         <a-input-number
           size="small"
           style="margin-top:8px;width:100%;"
@@ -232,7 +282,6 @@ import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
 import ChooseBrandModal from '@/views/common/chooseBrandModal.vue'
 import ChooseTypeModal from '@/views/common/chooseTypeModal.vue'
-import { getNewScopeSn } from '@/api/promotion'
 export default {
   name: 'TableType3',
   mixins: [commonMixin],
@@ -241,37 +290,67 @@ export default {
     itemSn: {
       type: [Number, String],
       default: ''
+    },
+    rulesType: {// 特价规则类型  0 手动 1折扣 2直降
+      type: [Number, String],
+      default: ''
+    },
+    setData: {
+      type: Array,
+      default: () => []
+    },
+    unitTypeList: {
+      type: Array,
+      default: () => []
     }
   },
   data () {
-    const _this = this
     return {
       spinning: false,
-      columns: [
+      dataSource: [],
+      openBrandModal: false,
+      openTypeModal: false,
+      chooseBrand: [],
+      chooseType: [],
+      val: '',
+      brandTagIndex: null, // 所选品牌位置
+      classifyTagIndex: null, // 所选分类位置
+      dataSourceOrigin: 0 // 数据来源  1  选择产品  0 新增一行品类
+    }
+  },
+  computed: {
+    columns () {
+      const _this = this
+      var arr = [
         { title: '产品分类', width: '16%', scopedSlots: { customRender: 'productType' }, align: 'center' },
         { title: '品牌', width: '16%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
         { title: '产品', scopedSlots: { customRender: 'product' }, width: '10%', align: 'center' },
         { title: '省级原价', dataIndex: 'provincePrice', width: '5%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '省级特价', scopedSlots: { customRender: 'provincePrice' }, width: '5%', align: 'center' },
-        { title: '省级折扣', scopedSlots: { customRender: 'provinceDiscount' }, width: '5%', align: 'center' },
+        // { title: '省级折扣', scopedSlots: { customRender: 'provinceDiscount' }, width: '5%', align: 'center' },
         { title: '市级原价', dataIndex: 'cityPrice', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '市级特价', scopedSlots: { customRender: 'cityPrice' }, width: '5%', align: 'center' },
-        { title: '市级折扣', scopedSlots: { customRender: 'cityDiscount' }, width: '5%', align: 'center' },
+        // { title: '市级折扣', scopedSlots: { customRender: 'cityDiscount' }, width: '5%', align: 'center' },
         { title: '特约原价', dataIndex: 'specialPrice', width: '5%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '特约特价', scopedSlots: { customRender: 'specialPrice' }, width: '5%', align: 'center' },
-        { title: '特约折扣', scopedSlots: { customRender: 'specialDiscount' }, width: '5%', align: 'center' },
+        // { title: '特约折扣', scopedSlots: { customRender: 'specialDiscount' }, width: '5%', align: 'center' },
         { title: '设置起订量', width: '7%', scopedSlots: { customRender: 'setNum' }, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
-      ],
-      dataSource: [],
-      openBrandModal: false,
-      openTypeModal: false,
-      chooseBrand: [],
-      chooseType: [],
-      val: '',
-      brandTagIndex: null, // 所选品牌位置
-      classifyTagIndex: null, // 所选分类位置
-      dataSourceOrigin: 0 // 数据来源  1  选择产品  0 新增一行品类
+      ]
+      if (_this.rulesType === '0') {
+        arr.splice(5, 0, { title: '省级折扣', scopedSlots: { customRender: 'provinceDiscount' }, width: '5%', align: 'center' })
+        arr.splice(8, 0, { title: '市级折扣', scopedSlots: { customRender: 'cityDiscount' }, width: '5%', align: 'center' })
+        arr.splice(11, 0, { title: '特约折扣', scopedSlots: { customRender: 'specialDiscount' }, width: '5%', align: 'center' })
+      } else if (_this.rulesType === '1') {
+        arr.splice(5, 0, { title: '省级折扣', scopedSlots: { customRender: 'provinceDiscount' }, width: '5%', align: 'center' })
+        arr.splice(8, 0, { title: '市级折扣', scopedSlots: { customRender: 'cityDiscount' }, width: '5%', align: 'center' })
+        arr.splice(11, 0, { title: '特约折扣', scopedSlots: { customRender: 'specialDiscount' }, width: '5%', align: 'center' })
+      } else {
+        arr.splice(5, 0, { title: '省价直降金额', scopedSlots: { customRender: 'provinceDiscount' }, width: '5%', align: 'center' })
+        arr.splice(8, 0, { title: '市价直降金额', scopedSlots: { customRender: 'cityDiscount' }, width: '5%', align: 'center' })
+        arr.splice(11, 0, { title: '特约直降金额', scopedSlots: { customRender: 'specialDiscount' }, width: '5%', align: 'center' })
+      }
+      return arr
     }
   },
   methods: {
@@ -289,27 +368,30 @@ export default {
     setSourceData (list) {
       this.dataSource = this.dataSource.concat(list)
     },
+    // 生成随机数
+    generateUniqueRandomNumber () {
+      const timestamp = new Date().getTime()
+      const randomNumber = Math.floor(Math.random() * 1e5).toString().padStart(5, '0')
+      const uniqueRandomNumber = timestamp + randomNumber
+      return uniqueRandomNumber
+    },
     // 新增一行
     handleAddRow () {
       const _this = this
-      _this.spinning = false
-      getNewScopeSn({}).then(res => {
-        if (res.status == 200) {
-          const newData = {
-            productScopeSn: res.data,
-            dataSourceOrigin: '0',
-            productTypeArr: [],
-            productTypeList: [],
-            productBrandArr: [],
-            productBrandList: [],
-            unitType: 'SL',
-            unitQty: 1
-          }
-          _this.dataSource.push(newData)
-        } else {
-          _this.spinning = false
+      const newSn = _this.generateUniqueRandomNumber()
+      if (newSn) {
+        const newData = {
+          productScopeSn: newSn,
+          dataSourceOrigin: '0',
+          productTypeArr: [],
+          productTypeList: [],
+          productBrandArr: [],
+          productBrandList: [],
+          unitType: 'SL',
+          unitQty: 1
         }
-      })
+        _this.dataSource.push(newData)
+      }
     },
     // 删除一行
     handleDel (row) {
@@ -575,6 +657,35 @@ export default {
     },
     // 获取最后结果
     getResultVal () {
+      const _this = this
+      if (_this.dataSource) {
+        if (_this.rulesType === '1') { // 折扣
+          _this.dataSource.forEach(con => {
+            con.provinceDiscountRate = _this.setData[0].provinceValue
+            con.cityDiscountRate = _this.setData[0].cityValue
+            con.specialDiscountRate = _this.setData[0].specialValue
+            if (con.dataSourceOrigin === '1') {
+              con.provinceDiscountPrice = (_this.setData[0].provinceValue * con.provincePrice / 100).toFixed(2)
+              con.cityDiscountPrice = (_this.setData[0].cityValue * con.cityPrice / 100).toFixed(2)
+              con.specialDiscountPrice = (_this.setData[0].specialValue * con.specialPrice / 100).toFixed(2)
+            }
+          })
+        } else if (_this.rulesType === '2') { // 直降
+          _this.dataSource.forEach(con => {
+            con.provinceSubtract = _this.setData[0].provinceValue
+            con.citySubtract = _this.setData[0].cityValue
+            con.specialSubtract = _this.setData[0].specialValue
+            if (con.dataSourceOrigin === '1') {
+              con.provinceDiscountPrice = con.provincePrice - _this.setData[0].provinceValue
+              con.cityDiscountPrice = con.cityPrice - _this.setData[0].cityValue
+              con.specialDiscountPrice = con.specialPrice - _this.setData[0].specialValue
+            }
+          })
+        }
+      } else {
+        _this.$message.warning('请添加特价产品!')
+        return
+      }
       const resultObj = JSON.parse(JSON.stringify(this.dataSource))
       resultObj.map(item => {
         delete item.productTypeArr

+ 3 - 4
src/views/purchasingManagement/purchaseReturn/queryPart.vue

@@ -47,8 +47,7 @@
       class="sTable"
       ref="chooseTable"
       size="small"
-      :rowKey="(record,i) => record.sparePartsDetailSn"
-      rowKeyName="sparePartsDetailSn"
+      :rowKey="(record,i) => i"
       :row-selection="{ columnWidth: 40,getCheckboxProps: record => ({ props: { disabled: record.currentStockQty == 0 || record.isCheckedFlag} }) }"
       @rowSelection="rowSelectionFun"
       :columns="columns"
@@ -225,8 +224,8 @@ export default {
     // 批量添加
     handleBatchAdd () {
       console.log(this.rowSelectionInfo)
-      const row = this.rowSelectionInfo&&this.rowSelectionInfo.selectedRowKeys
-      if (!row || row.length==0) {
+      const row = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys
+      if (!row || row.length == 0) {
         this.$message.warning('请先选择要添加的产品!')
         return
       }

+ 35 - 17
src/views/reportData/promotionSalesRealTimeReport/index.vue

@@ -80,6 +80,17 @@
                         <AreaList id="promotionSalesRealTimeReport-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
                       </a-form-model-item>
                     </a-col>
+                    <a-col :md="6" :sm="24">
+                      <a-form-model-item label="采购额">
+                        <v-select
+                          v-model="queryParam.giveMoney"
+                          ref="giveMoney"
+                          id="promotionSalesRealTimeReport-giveMoney"
+                          code="GIVE_MONEY"
+                          placeholder="请选择采购额"
+                          allowClear></v-select>
+                      </a-form-model-item>
+                    </a-col>
                   </template>
                   <a-col :md="6" :sm="24">
                     <span class="table-page-search-submitButtons">
@@ -121,17 +132,18 @@
               bordered>
               <!-- 促销时间 -->
               <template slot="promotionTime" slot-scope="text, record">
-                <span>{{ record.promotion.promotionDateStart }}-{{ record.promotion.promotionDateEnd }}</span>
+                <span v-if="record.promotion && record.promotion.promotionDateStart">{{ record.promotion.promotionDateStart }}-{{ record.promotion.promotionDateEnd }}</span>
+                <span v-else>--</span>
               </template>
               <!-- 规则 -->
-              <!-- <template slot="promotionDesc" slot-scope="text, record">
-              <span v-if="record.promotionRule.promotionRuleType=='PROMO_PROD'">{{ record.promotionRule.promotionRuleTypeDictValue }}</span>
-              <span v-else-if="record.promotionRule.promotionRuleType=='RATIO_AMOUNT'">{{ record.promotionRule.regularSameFlag==1?'同款':'不同款' }}产品购买满{{ record.promotionRule.regularQty }}个正价产品,送{{ record.promotionQty }}个促销产品</span>
-              <span v-else>购买满{{ record.promotionRule.regularAmount }}元正价产品,送{{ record.promotionRule.giveAmount }}元促销品采购额{{ record.promotionRule.accrualFlag&&record.promotionRule.accrualFlag==1?'(金额叠加)':'(金额不叠加)' }}</span>
-            </template> -->
+              <template slot="promotionDesc" slot-scope="text, record">
+                <div v-if="record.ruleInfo" v-html="record.ruleInfo"></div>
+                <span v-else>--</span>
+              </template>
               <!-- 地区 -->
               <template slot="addressInfo" slot-scope="text, record">
-                <span>{{ record.provinceName }}{{ record.cityName?'/'+record.cityName:'' }}{{ record.districtName?'/'+record.districtName :'' }}</span>
+                <span v-if="record.provinceName">{{ record.provinceName }}{{ record.cityName?'/'+record.cityName:'' }}{{ record.districtName?'/'+record.districtName :'' }}</span>
+                <span v-else>--</span>
               </template>
               <template slot="footer">
                 <a-row>
@@ -146,6 +158,8 @@
                       <a-col span="4">损失费用:{{ (totalData && (totalData.lossAmount || totalData.lossAmount==0)) ? toThousands(totalData.lossAmount) : '--' }}</a-col>
                       <a-col span="4">采购额结余:{{ (totalData && (totalData.surplusPromoGiftsAmount || totalData.surplusPromoGiftsAmount==0)) ? toThousands(totalData.surplusPromoGiftsAmount) : '--' }}</a-col>
                       <a-col span="4">采购额超出:{{ (totalData && (totalData.outPromoGiftsAmount || totalData.outPromoGiftsAmount==0)) ? toThousands(totalData.outPromoGiftsAmount) : '--' }}</a-col>
+                      <a-col span="4">转采购额数量:{{ (totalData && (totalData.convertPromoGiftsQty || totalData.convertPromoGiftsQty==0)) ? totalData.convertPromoGiftsQty : '--' }}</a-col>
+                      <a-col span="4">转采购额金额:{{ (totalData && (totalData.convertPromoGiftsAmount || totalData.convertPromoGiftsAmount==0)) ? toThousands(totalData.convertPromoGiftsAmount) : '--' }}</a-col>
                     </a-row>
                   </a-col>
                 </a-row>
@@ -208,7 +222,8 @@ export default {
         },
         dealerProvinceSn: undefined, // 省份编码
         dealerCitySn: undefined, // 城市编码
-        dealerDistrictSn: undefined // 区域编码
+        dealerDistrictSn: undefined, // 区域编码
+        giveMoney: undefined
       },
       rules: {
         salesDate: [{ required: true, message: '请选择销售审核时间', trigger: 'change' }]
@@ -225,7 +240,7 @@ export default {
         { title: '促销时间', scopedSlots: { customRender: 'promotionTime' }, width: '130px', align: 'center', fixed: 'left' },
         { title: '费用所属部门', dataIndex: 'departmentName', width: '160px', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true, fixed: 'left' },
         { title: '促销类型', dataIndex: 'promotionRule.promotionRuleTypeDictValue', width: '100px', align: 'center', customRender: function (text) { return text || '--' }, fixed: 'left' },
-        { title: '规则', dataIndex: 'promotionRule.ruleInfo', width: '180px', align: 'left', customRender: function (text) { return text || '--' }, fixed: 'left' },
+        { title: '规则', dataIndex: 'promotionRule.ruleInfo', width: '180px', align: 'left', scopedSlots: { customRender: 'promotionDesc' }, fixed: 'left' },
         { title: '销售单号', dataIndex: 'salesBillNo', width: '120px', align: 'center', customRender: function (text) { return text || '--' }, fixed: 'left' },
         { title: '区域', dataIndex: 'subareaArea.subareaName', width: '80px', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '80px', align: 'center', customRender: function (text) { return text || '--' } },
@@ -235,13 +250,15 @@ export default {
         { title: '销售审核时间', dataIndex: 'auditDate', width: '120px', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '数量(非促)', dataIndex: 'notGiftQty', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '数量(促)', dataIndex: 'giftQty', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '实售金额', dataIndex: 'totalRealAmount', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '开单金额', dataIndex: 'totalAmount', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '成本金额', dataIndex: 'totalRealCost', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '损失成本', dataIndex: 'lossCost', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '损失费用', dataIndex: 'lossAmount', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '采购额结余', dataIndex: 'surplusPromoGiftsAmount', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '采购额超出', dataIndex: 'outPromoGiftsAmount', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '实售金额', dataIndex: 'totalRealAmount', width: '100px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '开单金额', dataIndex: 'totalAmount', width: '100px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '成本金额', dataIndex: 'totalRealCost', width: '100px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '损失成本', dataIndex: 'lossCost', width: '100px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '损失费用', dataIndex: 'lossAmount', width: '100px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: <a-tooltip placement='top' title='即在下推时促销产品已转采购额的数量'>转采购额数量&nbsp;<a-icon type="question-circle" /></a-tooltip>, dataIndex: 'convertPromoGiftsQty', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: <a-tooltip placement='top' title='即促销产品转采购额金额,促销产品转采购额数量*销售价'>转采购额金额&nbsp;<a-icon type="question-circle" /></a-tooltip>, dataIndex: 'convertPromoGiftsAmount', width: '100px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '采购额结余', dataIndex: 'surplusPromoGiftsAmount', width: '100px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '采购额超出', dataIndex: 'outPromoGiftsAmount', width: '100px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '促销品费用归属品牌', dataIndex: 'promoProductBrandName', width: '120px', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '促销品费用归属分类', dataIndex: 'promoProductTypeName', width: '120px', align: 'center', customRender: function (text) { return text || '--' } }
       ],
@@ -384,7 +401,8 @@ export default {
         },
         dealerProvinceSn: undefined, // 省份编码
         dealerCitySn: undefined, // 城市编码
-        dealerDistrictSn: undefined // 区域编码
+        dealerDistrictSn: undefined, // 区域编码
+        giveMoney: undefined
       }
       this.time = undefined
       this.$refs.subarea.clearData()

+ 42 - 42
src/views/reportData/promotionSalesRealTimeReport/list.vue

@@ -3,34 +3,34 @@
     <div class="productInfoList-wrap">
       <a-card size="small" :bordered="false" class="searchBoxNormal">
         <div ref="tableSearch" class="table-page-search-wrapper newTableSearchName">
-        <a-form-model layout="inline" ref="ruleForm" :rules="rules" :model="newQueryParam">
-          <a-row :gutter="15">
-            <a-col :md="6" :sm="24">
-              <a-form-model-item label="下推时间" prop="salesDate">
-                <rangeDate ref="rangeDate" :value="newQueryParam.salesDate" @change="salesDateChange" />
-              </a-form-model-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-              <!-- :disabledDate="disabledDate" -->
-              <a-form-model-item label="促销开始时间">
-                <a-range-picker
-                  style="width:100%"
-                  v-model="time"
-                  :format="dateFormat"
-                  :placeholder="['开始时间', '结束时间']"
-                  @change="dateChange"></a-range-picker>
-              </a-form-model-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-model-item label="促销名称">
-                <a-input
-                  id="promotionSalesRealTimeReport-title"
-                  v-model.trim="newQueryParam.promoRuleReport.title"
-                  allowClear
-                  placeholder="请输入促销名称" />
-              </a-form-model-item>
-            </a-col>
-            <template v-if="advanced">
+          <a-form-model layout="inline" ref="ruleForm" :rules="rules" :model="newQueryParam">
+            <a-row :gutter="15">
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="下推时间" prop="salesDate">
+                  <rangeDate ref="rangeDate" :value="newQueryParam.salesDate" @change="salesDateChange" />
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <!-- :disabledDate="disabledDate" -->
+                <a-form-model-item label="促销开始时间">
+                  <a-range-picker
+                    style="width:100%"
+                    v-model="time"
+                    :format="dateFormat"
+                    :placeholder="['开始时间', '结束时间']"
+                    @change="dateChange"></a-range-picker>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="促销名称">
+                  <a-input
+                    id="promotionSalesRealTimeReport-title"
+                    v-model.trim="newQueryParam.promoRuleReport.title"
+                    allowClear
+                    placeholder="请输入促销名称" />
+                </a-form-model-item>
+              </a-col>
+              <template v-if="advanced">
                 <a-col :md="6" :sm="24">
                   <a-form-model-item label="促销类型">
                     <v-select
@@ -130,17 +130,18 @@
           bordered>
           <!-- 促销时间 -->
           <template slot="promotionTime" slot-scope="text, record">
-            <span>{{ record.promotion.promotionDateStart }}-{{ record.promotion.promotionDateEnd }}</span>
+            <span v-if="record.promotion && record.promotion.promotionDateStart">{{ record.promotion.promotionDateStart }}-{{ record.promotion.promotionDateEnd }}</span>
+            <span v-else>--</span>
           </template>
           <!-- 规则 -->
-          <!-- <template slot="promotionDesc" slot-scope="text, record">
-          <span v-if="record.promotionRule.promotionRuleType=='PROMO_PROD'">{{ record.promotionRule.promotionRuleTypeDictValue }}</span>
-          <span v-else-if="record.promotionRule.promotionRuleType=='RATIO_AMOUNT'">{{ record.promotionRule.regularSameFlag==1?'同款':'不同款' }}产品购买满{{ record.promotionRule.regularQty }}个正价产品,送{{ record.promotionQty }}个促销产品</span>
-          <span v-else>购买满{{ record.promotionRule.regularAmount }}元正价产品,送{{ record.promotionRule.giveAmount }}元促销品采购额{{ record.promotionRule.accrualFlag&&record.promotionRule.accrualFlag==1?'(金额叠加)':'(金额不叠加)' }}</span>
-        </template> -->
+          <template slot="promotionDesc" slot-scope="text, record">
+            <div v-if="record.promotionRule.ruleInfo" v-html="record.promotionRule.ruleInfo"></div>
+            <span v-else>--</span>
+          </template>
           <!-- 地区 -->
           <template slot="addressInfo" slot-scope="text, record">
-            <span>{{ record.provinceName }}{{ record.cityName?'/'+record.cityName:'' }}{{ record.districtName?'/'+record.districtName :'' }}</span>
+            <span v-if="record.provinceName">{{ record.provinceName }}{{ record.cityName?'/'+record.cityName:'' }}{{ record.districtName?'/'+record.districtName :'' }}</span>
+            <span v-else>--</span>
           </template>
           <template slot="footer">
             <a-row>
@@ -288,8 +289,7 @@ export default {
           return text || '--'
         },
         fixed: 'left'
-      },
-      { title: '规则', dataIndex: 'promotionRule.ruleInfo', width: '180px', align: 'left', customRender: function (text) { return text || '--' }, fixed: 'left' },
+      }, { title: '规则', dataIndex: 'promotionRule.ruleInfo', width: '180px', align: 'left', scopedSlots: { customRender: 'promotionDesc' }, fixed: 'left' },
       {
         title: '销售单号',
         dataIndex: 'salesBillNo',
@@ -375,7 +375,7 @@ export default {
         title: '实时实售金额',
         dataIndex: 'totalRealAmount',
         width: '100px',
-        align: 'center',
+        align: 'right',
         customRender: function (text) {
           return ((text || text == 0) ? _this.toThousands(text) : '--')
         }
@@ -384,7 +384,7 @@ export default {
         title: '实时开单金额',
         dataIndex: 'totalAmount',
         width: '100px',
-        align: 'center',
+        align: 'right',
         customRender: function (text) {
           return ((text || text == 0) ? _this.toThousands(text) : '--')
         }
@@ -393,7 +393,7 @@ export default {
         title: '实时成本金额',
         dataIndex: 'totalRealCost',
         width: '100px',
-        align: 'center',
+        align: 'right',
         customRender: function (text) {
           return ((text || text == 0) ? _this.toThousands(text) : '--')
         }
@@ -402,7 +402,7 @@ export default {
         title: '实时损失成本',
         dataIndex: 'lossCost',
         width: '100px',
-        align: 'center',
+        align: 'right',
         customRender: function (text) {
           return ((text || text == 0) ? _this.toThousands(text) : '--')
         }
@@ -411,7 +411,7 @@ export default {
         title: '实时损失费用',
         dataIndex: 'lossAmount',
         width: '100px',
-        align: 'center',
+        align: 'right',
         customRender: function (text) {
           return ((text || text == 0) ? _this.toThousands(text) : '--')
         }

+ 1 - 1
src/views/reportData/tireSalesReport/list.vue

@@ -327,4 +327,4 @@ export default {
     next(vm => {})
   }
 }
-</script>
+</script>

+ 231 - 0
src/views/reportData/tireSalesReport/subareaList.vue

@@ -0,0 +1,231 @@
+<template>
+  <div>
+    <a-card size="small" :bordered="false" class="tireSalesReportList-wrap searchBoxNormal">
+      <!-- 搜索条件 -->
+      <div class="table-page-search-wrapper" ref="tableSearch">
+        <a-form-model
+          id="tireSalesReportList-form"
+          ref="ruleForm"
+          class="form-model-con"
+          layout="inline"
+          :model="queryParam"
+          @keyup.enter.native="handleSearch">
+          <a-row :gutter="15">
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="下推时间" prop="time">
+                <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="区域/分区">
+                <subarea id="allocateBillList-subarea" ref="subarea" @change="subareaChange"></subarea>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="区域负责人">
+                <BizUser v-model="queryParam.bizUserSn"></BizUser>
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-button
+                style="margin-left: 5px"
+                type="primary"
+                @click="handleSearch"
+                :disabled="disabled"
+                id="salesOrderTotalList-refresh">查询</a-button>
+              <a-button
+                style="margin-left: 8px"
+                @click="resetSearchForm"
+                :disabled="disabled"
+                id="salesOrderTotalList-reset">重置</a-button>
+              <a-button
+                style="margin-left: 10px"
+                type="primary"
+                class="button-warning"
+                @click="handleExport"
+                :disabled="disabled"
+                :loading="exportLoading"
+                v-if="$hasPermissions('B_tireSalesAreaReportExport')"
+                id="salesOrderTotalList-export">导出</a-button>
+            </a-col>
+          </a-row>
+        </a-form-model>
+      </div>
+    </a-card>
+    <a-card size="small" :bordered="false">
+      <a-spin :spinning="spinning" tip="Loading...">
+        <!-- 列表 -->
+        <s-table
+          class="sTable fixPagination"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.salesBillNo"
+          :style="{ height: tableHeight+70+'px' }"
+          rowKeyName="salesBillNo"
+          :columns="columns"
+          :data="loadData"
+          :scroll="{ y: tableHeight-30 }"
+          :pageSize="30"
+          :defaultLoadData="false"
+          bordered>
+          <template slot="footer">
+            <a-row :gutter="15">
+              <a-col :md="4" :sm="24">采购数量:{{ (totalData && (totalData.totalbuyAmount || totalData.totalbuyAmount==0)) ? totalData.totalbuyAmount : '--' }}</a-col>
+              <a-col :md="4" :sm="24">库存数量:{{ (totalData && (totalData.totalstoreAmount || totalData.totalsellAmount==0)) ? totalData.totalsellAmount: '--' }}</a-col>
+              <a-col :md="4" :sm="24">售出数量:{{ (totalData && (totalData.totalsellAmount || totalData.totalsellAmount==0)) ?totalData.totalsellAmount: '--' }}</a-col>
+              <a-col :md="4" :sm="24">已绑质保单数量:{{ (totalData && (totalData.totalwarrantyAmount || totalData.totalwarrantyAmount==0)) ?totalData.totalwarrantyAmount: '--' }}</a-col>
+            </a-row>
+          </template>
+        </s-table>
+      </a-spin>
+    </a-card>
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import getDate from '@/libs/getDate.js'
+import { STable } from '@/components'
+import rangeDate from '@/views/common/rangeDate.vue'
+import subarea from '@/views/common/subarea.js'
+import BizUser from '@/views/common/bizUser.js'
+import { hdExportExcel } from '@/libs/exportExcel'
+import { querySaleAreaCount, excelSaleAreaOnlineExport, querySaleAreaPage } from '@/api/reportData'
+export default {
+  name: 'TireSalesSubareaList',
+  mixins: [commonMixin],
+  components: { STable, rangeDate, subarea, BizUser },
+  data () {
+    return {
+      spinning: false,
+      tableHeight: 0,
+      time: [
+        getDate.getThreeMonthDays().starttime,
+        getDate.getCurrMonthDays().endtime
+      ],
+      queryParam: { //  查询条件
+        beginDate: getDate.getThreeMonthDays().starttime,
+        endDate: getDate.getCurrMonthDays().endtime,
+        subareaSn: undefined,
+        subareaAreaSn: undefined,
+        bizUserSn: undefined
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      exportLoading: false,
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        const params = Object.assign(parameter, this.queryParam)
+        return querySaleAreaPage(params).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            this.getCount(params)
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      },
+      totalData: null,
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '区域', dataIndex: 'subareaName', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '分区', dataIndex: 'subareaAreaName', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '区域负责人', dataIndex: 'userNameQyfzrs', width: '16%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '采购数量', dataIndex: 'buyAmount', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '库存数量', dataIndex: 'storeAmount', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '售出数量', dataIndex: 'sellAmount', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '已绑质保单数量', dataIndex: 'warrantyAmount', width: '12%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+      ]
+    }
+  },
+  methods: {
+    // 统计
+    getCount (params) {
+      querySaleAreaCount(params).then(res => {
+        if (res.status == 200 && res.data) {
+          this.totalData = res.data
+        } else {
+          this.totalData = null
+        }
+      })
+    },
+    handleSearch () {
+      this.$refs.table.refresh(true)
+    },
+    //  下推时间  change
+    dateChange (date) {
+      if (date[0] && date[1]) {
+        this.time = date
+      } else {
+        this.time = []
+      }
+      this.queryParam.beginDate = date[0] || ''
+      this.queryParam.endDate = date[1] || ''
+    },
+    subareaChange (val) {
+      this.queryParam.subareaSn = val[0] ? val[0] : undefined
+      this.queryParam.subareaAreaSn = val[1] ? val[1] : undefined
+    },
+    //  重置
+    resetSearchForm () {
+      this.time = [
+        getDate.getThreeMonthDays().starttime,
+        getDate.getCurrMonthDays().endtime
+      ]
+      this.$refs.rangeDate.resetDate(this.time)
+      this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
+      this.queryParam.endDate = getDate.getCurrMonthDays().endtime
+      this.queryParam.subareaSn = undefined
+      this.queryParam.subareaAreaSn = undefined
+      this.queryParam.bizUserSn = undefined
+      this.totalData = null
+      this.$refs.subarea.clearData()
+      this.$refs.table.clearTable()
+    },
+    //  导出
+    handleExport () {
+      const _this = this
+      const params = _this.queryParam
+      _this.exportLoading = true
+      _this.spinning = true
+      hdExportExcel(excelSaleAreaOnlineExport, params, '轮胎销售报表(区域/分区)', function () {
+        _this.exportLoading = false
+        _this.spinning = false
+      })
+    },
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 245
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+      this.resetSearchForm()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+      this.resetSearchForm()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>

+ 13 - 7
src/views/salesManagement/salesQueryNew/comps/activeQueryPart.vue

@@ -197,10 +197,7 @@ export default {
         arr.splice(idx, 0, { title: '售价', dataIndex: 'productPrice', width: '100px', align: 'right', scopedSlots: { customRender: 'productPrice' } })
         idx = idx + 1
       }
-      // 促销品没有起订量
-      if(this.promoProductClz != 'GIFT'){
-        arr.splice(idx+1, 0,{ title: '起订量', dataIndex: 'unitQtyV', width: '60px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-      }
+      arr.splice(idx+1, 0,{ title: '起订量', dataIndex: 'unitQtyV', width: '60px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
       return arr
     }
   },
@@ -259,6 +256,13 @@ export default {
       this.promoRuleData = promo.promotionRule
       this.queryParam.dealerLevel = data.buyerLevel
       this.queryParam.promoRuleSn = promo.promoRuleSn
+      this.queryParam.salesPromoSn = promo.salesPromoSn
+      
+      // 是否是买产品送产品
+      const isMcpScp = this.promoRuleData&&this.promoRuleData.convertExpenseFlag==1&&this.promoRuleData.promotionRuleType=='BUY_PROD_GIVE_PROD'
+      // 是否卖产品送采购额
+      const isMcpScge = this.promoRuleData.promotionRuleType=='BUY_PROD_GIVE_MONEY'&&this.promoRuleData.scopeFlag==='1'
+      
       const tabList = []
       if(this.promoRuleData){ 
         if(this.promoRuleData.gateFlag==='1'){
@@ -267,8 +271,9 @@ export default {
         if(this.promoRuleData.promotionRuleType!='PROMO_PROD'){
           tabList.push({text:'正价产品',val:'REGULAR'})
         }
-        if(this.promoRuleData.regularPromotionSameFlag==='0'||this.promoRuleData.scopeFlag==='0'||(this.promoRuleData.promotionRuleType=='BUY_PROD_GIVE_MONEY'&&this.promoRuleData.scopeFlag==='1')){
-          tabList.push({text:'促销产品',val:'GIFT'})
+        if(this.promoRuleData.regularPromotionSameFlag==='0'||this.promoRuleData.scopeFlag==='0'||isMcpScge){
+          const levelText = promo.countData.scopeLevelFlag && isMcpScp ? '(阶梯'+promo.countData.scopeLevel+')' : ''
+          tabList.push({text:'促销产品'+ levelText ,val:'GIFT'})
         }
         if(this.promoRuleData.promotionRuleType=='PROMO_PROD'){
           tabList.push({text:'特价产品',val:'DISCOUNT'})
@@ -277,7 +282,8 @@ export default {
       this.tabList = tabList
       this.promoProductClz = tabList[0].val
       this.tableHeight = window.innerHeight - 330
-
+      
+      this.queryParam.scopeLevel = promo.countData.scopeLevel
       this.resetSearchForm()
     },
     // 刷新当前页面

+ 18 - 5
src/views/salesManagement/salesQueryNew/comps/detailProductList.vue

@@ -106,7 +106,7 @@
           showTableHead: true,
           colspanNums: 13,
           hasOutStockOfActive: false,
-          simpleImage: Empty.PRESENTED_IMAGE_SIMPLE
+          simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
         }
       },
       computed: {
@@ -134,12 +134,14 @@
                     <div>
                         <span style="padding-right: 15px;">{data}</span>
                         {ftext?(<a-badge count={ftext} number-style={{ backgroundColor: fcolor, zoom:'80%' }}></a-badge>):''}
+                        {record.convertPromoGiftsQty?(<a-badge count="转" number-style={{ backgroundColor: '#ffaa00', zoom:'80%' }}></a-badge>):''}
                         {(Number(record.stockQty||0) < Number(record.unpushedQty||0)) && _this.showStock?(<a-badge count="缺" number-style={{ zoom:'80%' }}></a-badge>):''}
                     </div>
                 )
           }
           // 编号,并且格式化活动分类行
           const noFormat = function(record,data,h){
+            const isBuyPSendP = record.promo && record.promo.promotionRule.convertExpenseFlag==1&&record.promo.promotionRule.promotionRuleType=='BUY_PROD_GIVE_PROD'
             return (
               <div>
                 {record.id.indexOf('promo-')>=0 ? (
@@ -158,8 +160,9 @@
                         数量:<strong>{record.total&&record.total.totalQty||'--'}</strong>;
                         {_this.$hasPermissions('B_salesEdit_salesPrice') ? (<span>总金额:<strong>{record.total&&record.total.totalAmount||'--'}</strong>;</span>):('')}
                         {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.lossAmount ? (<span>优惠金额:<strong>{record.total.lossAmount}</strong>;</span>):('')}
-                        {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.cgejyAmount>0 ? (<span>采购额结余:<strong>{_this.toThousands(record.total.cgejyAmount)}</strong>;</span>):('')}
-                        {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.cgejyAmount<0 ? (<span>采购额超出:<strong>{_this.toThousands(record.total.cgeccAmount)}</strong>;</span>):('')}
+                        {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.cgejyAmount>0&&!isBuyPSendP ? (<span>采购额结余:<strong>{_this.toThousands(record.total.cgejyAmount)}</strong>;</span>):('')}
+                        {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.cgejyAmount<0&&!isBuyPSendP ? (<span>采购额超出:<strong>{_this.toThousands(record.total.cgeccAmount)}</strong>;</span>):('')}
+                        {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.totalPromoGiftsAmount&&isBuyPSendP ? (<span>促销产品转采购额金额:<strong>{_this.toThousands(record.total.totalPromoGiftsAmount)}</strong>;</span>):('')}
                         {record.total&&record.total.expenseAccountFlag!='WAIT' ? (<span style="color:red;">{record.total.expenseAccountFlagDictValue}</span>) : ''}
                     </div>
                   </div>
@@ -186,7 +189,7 @@
                 { title: '原厂编码', field: 'productOrigCode',key: "d", width: 150, align: 'left',operationColumn: false,ellipsis: { showTitle: true },renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'} },
                 { title: '出库仓库', field: 'warehouseName',key: "e", width: 100, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}}
             ]
-            this.colspanNums = 5
+            this.colspanNums = this.showConvertPromoGifts ? 6 : 5
             if (this.$hasPermissions(this.authCode + '_costPrice')) { //  成本价权限
               this.colspanNums = this.colspanNums + 1
               arr.push({ title: '成本价', field: 'showCost', width: 80,key: "f", align: 'right',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
@@ -224,10 +227,20 @@
             arr = arr.concat([
                 { title: '待下推数', field: 'unpushedQty', width: 80,key: "o", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
                 { title: '已下推数', field: 'pushedQty', width: 80,key: "p", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
-                { title: '已取消数', field: 'cancelQty', width: 80,key: "q", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} }
             ])
+            
+            if(this.showConvertPromoGifts){
+              arr.push({ title: '转采购额数量', field: 'convertPromoGiftsQty', width: 100,key: "z", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row.convertPromoGiftsFlag ? numsFormat(row[column.field]) : '--'} })
+            }
+            arr.push({ title: '已取消数', field: 'cancelQty', width: 80,key: "q", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} })
           return arr
         },
+        hasConvertPromoGifts(){
+          return this.detailData && this.detailData.totalConvertPromoGiftsQty
+        },
+        showConvertPromoGifts(){
+          return this.activeList&&this.activeList.filter(item=>item.enabledFlag == 1).find(item => item.promotionRule&&item.promotionRule.convertExpenseFlag==1&&item.promotionRule.promotionRuleType=='BUY_PROD_GIVE_PROD')
+        },
         showStock(){
             return this.detailData && (this.detailData.billStatus == 'WAIT_AUDIT' || this.detailData.billStatus == 'HQ_CHANGE') && this.$hasPermissions('B_salesAudit')
         }

+ 27 - 36
src/views/salesManagement/salesQueryNew/comps/productList.vue

@@ -7,39 +7,24 @@
           {{ descDetail.promotionRuleTypeDictValue||'--' }}
         </a-col>
         <a-col span="18" style="padding: 6px;">
-          <div style="display: flex;">
-            <span>促销门槛:</span>
-            <div v-if="descDetail.gateFlag === '1'">
-              <span v-if="descDetail.gateType==='RATIO_AMOUNT'">
-                购买门槛产品金额{{ descDetail.gateAmount*100 }}%作为配额
-              </span>
-              <span v-else-if="descDetail.gateType==='MIN_AMOUNT'">
-                购买门槛产品满最低金额{{ descDetail.gateAmount }}不限制配额。
-              </span>
-              <span v-else>购买满{{ descDetail.gateAmount }}元门槛产品,可使用 {{ descDetail.quotaAmount }}元配额,采购规则中的{{ descDetail.promotionRuleType == 'PROMO_PROD'?'特价':'正价' }}商品</span>
-            </div>
-            <span v-else>无</span>
-          </div>
-        </a-col>
-        <a-col span="24" style="padding: 6px;">
           <div style="display: flex;">
             <div style="display: flex;">
-              <span>促销规则:</span>
-              <span v-if="descDetail.promotionRuleType == 'BUY_PROD_GIVE_PROD'">
-                {{ descDetail.regularSameFlag==='1'?'同款产品,':'不同款产品,' }}
-                购买满{{ descDetail.regularQty }}个正价产品,送{{ descDetail.promotionQty }}个促销产品
-                {{ descDetail.accrualFlag == 1 ? ',数量叠加':',数量不叠加' }}
-              </span>
-              <span v-else-if="descDetail.promotionRuleType == 'BUY_PROD_GIVE_MONEY'">
-                <!-- {{ descDetail.regularSameFlag==='1'?'同款产品,':'不同款产品,' }} -->
-                购买满{{ descDetail.regularAmount }}元正价产品,送{{ descDetail.giveAmount }}元促销品采购额
-                {{ descDetail.accrualFlag == 1 ? ',金额叠加':',金额不叠加' }}
-              </span>
-              <span v-else>
-                特价产品
-              </span>
+              <span>促销门槛:</span>
+              <div v-if="descDetail.gateFlag === '1'">
+                <span v-if="descDetail.gateType==='RATIO_AMOUNT'">
+                  购买门槛产品金额{{ (descDetail.gateValue*100).toFixed(2) }}%作为配额
+                </span>
+                <span v-else-if="descDetail.gateType==='MIN_AMOUNT'">
+                  购买门槛产品满最低金额{{ descDetail.gateValue }}元,不限制配额
+                </span>
+                <span v-else>
+                  <span v-if="descDetail.promotionRuleType!='PROMO_PROD'">购买满{{ descDetail.gateValue }}元门槛产品,可使用 {{ descDetail.quotaAmount }}元配额,采购规则中的正价商品</span>
+                  <span v-else>购买每满{{ descDetail.gateValue }}{{ descDetail.gateUnit==='YUAN'?'元':'个' }}门槛产品,可采购{{ descDetail.quotaAmount }}个特价产品</span>
+                </span>
+              </div>
+              <span v-else>无</span>
             </div>
-            <div style="display: flex;flex-grow: 1;">
+            <div style="display: flex;">
               <div v-if="descDetail.promotionRuleType!='PROMO_PROD'&&descDetail.promotionRuleType!='BUY_PROD_GIVE_MONEY'">
                 <span style="margin-left: 50px;">限制正价产品款数:</span>{{ descDetail.restrictCategory||'无' }}
               </div>
@@ -50,6 +35,12 @@
             </div>
           </div>
         </a-col>
+        <a-col span="24" style="padding: 6px;">
+          <div style="display: flex;">
+            <span>促销规则:</span>
+            <div class="ruleInfo" v-html="descDetail.ruleInfo"></div>
+          </div>
+        </a-col>
       </a-row>
     </div>
     <!-- 筛选条件 -->
@@ -190,10 +181,8 @@
       </template>
       <!-- 折扣 -->
       <template slot="discountPrice" slot-scope="text, record">
-        <div v-if="record.promotionFlag=='DISCOUNT'&&detailData">
-          <span v-if="detailData.buyerLevel=='PROVINCE'">{{ record.provinceDiscount*100 }}%</span>
-          <span v-if="detailData.buyerLevel=='CITY'">{{ record.cityDiscount*100 }}%</span>
-          <span v-if="detailData.buyerLevel=='SPECIAL'">{{ record.specialDiscount*100 }}%</span>
+        <div v-if="record.promotionFlag=='DISCOUNT'">
+          <span>{{ ((record.price/record.origPrice)*100).toFixed(2) }}%</span>
         </div>
         <div v-else>--</div>
       </template>
@@ -376,7 +365,7 @@ export default {
               data.list[i].qtyBackups = data.list[i].qty
               data.list[i].productUnit = data.list[i].productEntity && data.list[i].productEntity.unit
               // 按数量设置
-              if (data.list[i].unitType == 'SL') {
+              if (data.list[i].unitType && data.list[i].unitType == 'SL') {
                 data.list[i].unitQtyV = data.list[i].unitQty ? (data.list[i].unitQty + data.list[i].productUnit) : '--'
                 data.list[i].unitQtyR = data.list[i].unitQty
               } else {
@@ -467,10 +456,12 @@ export default {
     showDesc (descDetail) {
       this.showDescBox = !this.showDescBox
       this.descDetail = descDetail
+      this.descDetail.gateValue = Number(this.descDetail.gateValue).toFixed(2)
+      this.descDetail.quotaAmount = Number(this.descDetail.quotaAmount).toFixed(2)
       this.$emit('showDesc', this.showDescBox)
     },
     openCpModal () {
-      this.$emit('openCpModal', 1, this.id)
+      this.$emit('openCpModal', 1, this.id, this.countData)
     },
     // 表格选中项
     rowSelectionFun (obj) {

+ 21 - 4
src/views/salesManagement/salesQueryNew/detail.vue

@@ -86,6 +86,7 @@
               <span v-if="$hasPermissions(authCode + '_salesPrice')">待发货金额:<strong>{{ detailData&&(detailData.totalUndispatchAmount || detailData.totalUndispatchAmount==0) ? toThousands(detailData.totalUndispatchAmount) : '--' }}</strong>;</span>
               <span v-if="isCityPrice">市级总售价:<strong>{{ detailData&&(detailData.totalCityAmount || detailData.totalCityAmount==0) ? toThousands(detailData.totalCityAmount) : '--' }}</strong>;</span>
               <span v-if="$hasPermissions(authCode + '_salesPrice')&&detailData&&detailData.totalDiscountAmount" style="color: red;">优惠金额:<strong>{{ Number(detailData.totalDiscountAmount).toFixed(2) }}</strong>;</span>
+              <span v-if="$hasPermissions(authCode + '_salesPrice')&&detailData&&detailData.totalConvertPromoGiftsAmount" style="color: red;">促销产品转采购额金额:<strong>{{ Number(detailData.totalConvertPromoGiftsAmount).toFixed(2) }}</strong>;</span>
             </div>
           </div>
         </a-alert>
@@ -115,6 +116,9 @@
                         <a-select-option value="GIFT">
                           促销产品
                         </a-select-option>
+                        <a-select-option value="GIFT1" v-if="showConvertPromoGifts">
+                          促销产品(转采购额)
+                        </a-select-option>
                         <a-select-option value="GATE">
                           门槛产品
                         </a-select-option>
@@ -284,12 +288,15 @@ export default {
         return shippingAddrProvinceName + shippingAddrCityName + shippingAddrCountyName + shippingAddr
       }
     },
-    hideFooter (){
+    hideFooter () {
       const detailData = this.detailData
-      return detailData&&(detailData.billStatus == 'HQ_CHANGE'|| (detailData.salesBillSource != 'SALES'&&detailData.billStatus == 'AUDIT_REJECT') ||detailData.billStatus == 'FINISH'||detailData.billStatus == 'OUTING_WAREHOUSE')
+      return detailData && (detailData.billStatus == 'HQ_CHANGE' || (detailData.salesBillSource != 'SALES' && detailData.billStatus == 'AUDIT_REJECT') || detailData.billStatus == 'FINISH' || detailData.billStatus == 'OUTING_WAREHOUSE')
+    },
+    hasPrompActive () {
+      return this.detailData && this.detailData.promoFlag == 1
     },
-    hasPrompActive(){
-      return this.detailData&&this.detailData.promoFlag==1
+    showConvertPromoGifts () {
+      return this.$refs.productList && this.$refs.productList.showConvertPromoGifts
     },
     pageHeight () {
       return window.innerHeight - 305 + (this.hideFooter ? 45 : 0)
@@ -354,6 +361,16 @@ export default {
           })
           return
         }
+
+        if (this.$refs.productList.showConvertPromoGifts) {
+          this.$info({
+            title: '提示',
+            content: '该活动规则中,促销产品可转费用报销单,不可一键审核!',
+            centered: true
+          })
+          return
+        }
+
         this.showDsModal = true
         this.$refs.dsModal.setDetail(this.detailData)
       } else {

+ 10 - 4
src/views/salesManagement/salesQueryNew/edit.vue

@@ -291,7 +291,8 @@ export default {
     // 获取销售单参与的活动列表
     async getActiveList () {
       // 已参与活动列表
-      this.activeList = await salesPromoQueryList({ salesBillSn: this.$route.params.sn }).then(res => res.data || [])
+      const list = await salesPromoQueryList({ salesBillSn: this.$route.params.sn }).then(res => res.data || [])
+      this.activeList = list.filter(item => item.promotion && item.promotionRule)
       this.activeList.map(item => {
         item.isActive = item.enabledFlag == 1
         item.showDesc = false
@@ -323,9 +324,12 @@ export default {
       // this.insterActiveOk(['normal','promo'][type])
     },
     // 打开选择产品弹框
-    openProductModal (type, refId) {
-      console.log(type, refId)
+    openProductModal (type, refId, countData) {
+      console.log(type, refId, countData)
       const promo = this.activeList.find(item => item.promoRuleSn == refId)
+      if(promo){
+        promo.countData = countData
+      }
       this.$refs.chooseProduct.pageInit(this.detailData, promo, type)
       this.cpCurRefId = 'productList-' + refId
       this.showCpModal = true
@@ -499,6 +503,8 @@ export default {
     showDesc (e, item) {
       e.stopPropagation()
       const row = this.$refs['productList-' + item.promoRuleSn][0]
+      item.promotionRule.minOrderAmount = item.promotion.minOrderAmount ? Number(item.promotion.minOrderAmount).toFixed(2) : ''
+      item.promotionRule.upperLimitAmount = item.promotion.upperLimitAmount ? Number(item.promotion.upperLimitAmount).toFixed(2) : ''
       row && row.showDesc(item.promotionRule)
     },
     showDescOk (v, item) {
@@ -570,7 +576,7 @@ export default {
         return
       }
       // 如果没有活动产品,直接禁用无需弹框提示
-      if (table.countData && !table.countData.totalQty) {
+      if (!table.countData || table.countData && !table.countData.totalQty) {
         _this.disabledActiveOption = 'DELETE'
         _this.disabledActive(e, item)
         return

+ 100 - 72
src/views/salesManagement/salesQueryNew/list.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <a-card size="small" :bordered="false" class="searchBox">
+    <a-card size="small" :bordered="false" class="searchBoxNormal">
       <!-- 搜索条件 -->
       <div ref="tableSearch" class="table-page-search-wrapper">
         <a-form layout="inline">
@@ -25,29 +25,29 @@
                 <a-input id="salesManagementList-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" allowClear placeholder="请输入采购单号"/>
               </a-form-item>
             </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="备货打印状态">
+                <v-select
+                  v-model="queryParam.printStatus"
+                  ref="printStatus"
+                  id="salesManagementList-printStatus"
+                  code="PRINT_STATUS"
+                  placeholder="请选择打印状态"
+                  allowClear></v-select>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="业务状态">
+                <v-select
+                  v-model="queryParam.billStatus"
+                  ref="billStatus"
+                  id="salesManagementList-billStatus"
+                  code="SALES_BILL_STATUS"
+                  placeholder="请选择业务状态"
+                  allowClear></v-select>
+              </a-form-item>
+            </a-col>
             <template v-if="advanced">
-              <a-col :md="6" :sm="24">
-                <a-form-item label="备货打印状态">
-                  <v-select
-                    v-model="queryParam.printStatus"
-                    ref="printStatus"
-                    id="salesManagementList-printStatus"
-                    code="PRINT_STATUS"
-                    placeholder="请选择打印状态"
-                    allowClear></v-select>
-                </a-form-item>
-              </a-col>
-              <a-col :md="6" :sm="24">
-                <a-form-item label="业务状态">
-                  <v-select
-                    v-model="queryParam.billStatus"
-                    ref="billStatus"
-                    id="salesManagementList-billStatus"
-                    code="SALES_BILL_STATUS"
-                    placeholder="请选择业务状态"
-                    allowClear></v-select>
-                </a-form-item>
-              </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-item label="财务状态">
                   <v-select
@@ -95,8 +95,17 @@
                     allowClear></v-select>
                 </a-form-item>
               </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="转费用报销单">
+                  <a-select v-model="queryParam.expenseClainFlag" placeholder="请选择转费用报销单状态" allowClear>
+                    <a-select-option value="N">待转</a-select-option>
+                    <a-select-option value="Y">已转</a-select-option>
+                    <a-select-option value="ALL">全部</a-select-option>
+                  </a-select>
+                </a-form-item>
+              </a-col>
             </template>
-            <a-col :md="24" :sm="24" style="text-align: center;">
+            <a-col :md="8" :sm="24">
               <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
               <a-button style="margin-left: 10px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
               <a-button
@@ -246,7 +255,7 @@
                 size="small"
                 type="link"
                 class="button-warning"
-                v-if="record.billStatus=='FINISH' && record.expenseClainFlag == 'N'"
+                v-if="record.billStatus=='FINISH' &&(record.expenseClainFlag == 'N' ||record.expenseClainFlag == 'M' )"
                 @click="handleExpense(record)"
               >转费用报销单</a-button>
             </div>
@@ -336,7 +345,8 @@ export default {
         },
         shippingAddrProvinceSn: undefined,
         warehouseSn: undefined,
-        promoFlag: undefined
+        promoFlag: undefined,
+        expenseClainFlag: undefined
       },
       totalData: {
         totalAmount: 0,
@@ -358,9 +368,9 @@ export default {
         this.spinning = true
         delete parameter.tableId
         delete parameter.index
-        if(parameter.sortOrder){
-          parameter["sortAlias"] = "sales_bill"
-        }else{
+        if (parameter.sortOrder) {
+          parameter['sortAlias'] = 'sales_bill'
+        } else {
           delete parameter.sortField
         }
         // 查询总计
@@ -521,50 +531,70 @@ export default {
     async handleExpense (row) {
       const _this = this
       const hasExpense = await queryCreateBySalesBillSn({ salesBillSn: row.salesBillSn }).then(res => res.data || [])
-      console.log(hasExpense)
-      // 有2个以上采购额时
-      if (hasExpense && hasExpense.exceed && hasExpense.balance) {
-        _this.$confirm({
-          title: '转费用报销单?',
-          centered: true,
-          class: 'confirm-center',
-          content: <div>
-            <div style="padding:10px 0;text-align:center;">请选择费用报销单类型</div>
-            <div style="padding:0 0 10px 0;text-align:center;">
-              <aRadioGroup onChange={_this.changeDaOpt}>
-                <aRadio style="height: '30px';lineHeight: '30px';padding:5px 0;" value="balance">
-                  采购额结余
-                </aRadio>
-                <aRadio style="height: '30px';lineHeight: '30px';padding:5px 0;" value="exceed">
-                  采购额超出
-                </aRadio>
-              </aRadioGroup>
-            </div>
-          </div>,
-          onOk () {
-            if (_this.expenseOption) {
-              _this.expenseSave(hasExpense, _this.expenseOption)
-            } else {
-              _this.$message.info('请选择费用报销单类型!')
-              return true
-            }
-          },
-          onCancel () {
-            _this.expenseOption = null
-          }
-        })
-      } else {
+      const showModalFlag = []
+      const optionsKey = [
+        {
+          id: 'balance',
+          name: '采购额结余'
+        },
+        {
+          id: 'exceed',
+          name: '采购额超出'
+        },
+        {
+          id: 'giftConvertAmount',
+          name: '促销产品转采购额'
+        }
+      ]
+      optionsKey.map(key => {
+        if (hasExpense[key.id]) {
+          showModalFlag.push(key)
+        }
+      })
+
+      if (showModalFlag.length) {
         // 直接转费用单
-        _this.expenseSave(hasExpense, null)
+        if (showModalFlag.length == 1) {
+          _this.expenseSave(hasExpense[showModalFlag[0].id])
+        }
+        // 有2个以上采购额时
+        if (showModalFlag.length > 1) {
+          _this.$confirm({
+            title: '转费用报销单?',
+            centered: true,
+            class: 'confirm-center',
+            content: <div>
+              <div style="padding:10px 0;text-align:center;">请选择费用报销单类型</div>
+              <div style="padding:0 0 10px 0;text-align:center;">
+                <aRadioGroup onChange={_this.changeDaOpt}>
+                  {showModalFlag.map(item => <aRadio key={item.id} style="height: '30px';lineHeight: '30px';padding:5px 0;" value={item.id}>{item.name}</aRadio>)}
+                </aRadioGroup>
+              </div>
+            </div>,
+            onOk () {
+              if (_this.expenseOption) {
+                _this.expenseSave(hasExpense[_this.expenseOption])
+              } else {
+                _this.$message.info('请选择费用报销单类型!')
+                return true
+              }
+            },
+            onCancel () {
+              _this.expenseOption = null
+            }
+          })
+        }
       }
     },
+    changeDaOpt (e) {
+      this.expenseOption = e.target.value
+    },
     // 转费用单
-    expenseSave (data, type) {
-      console.log(data, type)
-      const params = type ? data[type] : (data.balance || data.exceed)
-      if (params) {
+    expenseSave (data) {
+      console.log(data)
+      if (data) {
         this.openBaseModal = true
-        this.$refs.expenseModal.setDetail(params, 'sales')
+        this.$refs.expenseModal.setDetail(data, 'sales')
       }
     },
     expenseSaveOk (params) {
@@ -578,9 +608,6 @@ export default {
         }
       })
     },
-    changeDaOpt (e) {
-      this.expenseOption = e.target.value
-    },
     // 允许备货打印
     handlePrint (row) {
       // 获取关联的下推单
@@ -648,6 +675,7 @@ export default {
       this.queryParam.shippingAddrProvinceSn = undefined
       this.queryParam.warehouseSn = undefined
       this.queryParam.promoFlag = undefined
+      this.queryParam.expenseClainFlag = undefined
       if (this.advanced) {
         this.$refs.subarea.clearData()
       }
@@ -661,7 +689,7 @@ export default {
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 270
+      this.tableHeight = window.innerHeight - tableSearchH - 260
     }
   },
   watch: {

+ 21 - 1
src/views/salesManagement/waitDispatchNew/edit.vue

@@ -15,6 +15,7 @@
           :newLoading="isInster"
           @cancelProduct="cancelProduct"
           @cancelAll = "cancelAll"
+          @convertPromoGifts = "convertPromoGifts"
           @addProduct="insterProduct"></queryPart>
       </a-card>
       <a-card size="small" :bordered="false" class="waitDispatch-cont">
@@ -56,7 +57,7 @@ import queryPart from './queryPart.vue'
 import detailProductList from './detailProductList.vue'
 import dsModal from './dsModal.vue'
 import { salesDetailBySn } from '@/api/salesNew'
-import { insertBatchOfWaitDispatch, salesDetailUpdateCancelQty, salesDetailCancleOfAll } from '@/api/salesDetailNew'
+import { insertBatchOfWaitDispatch, salesDetailUpdateCancelQty, salesDetailCancleOfAll, batchTransferOfPurchaseAmount } from '@/api/salesDetailNew'
 import { pushDown } from '@/api/waitDispatchDetail'
 import { findBySalesBillSn } from '@/api/dispatch'
 
@@ -139,6 +140,25 @@ export default {
         }
       })
     },
+    // 批量转采购额
+    convertPromoGifts(list){
+      this.$message.loading('正在批量转采购额...', 1)
+      this.isInster = true
+      this.spinning = true
+      batchTransferOfPurchaseAmount({
+        salesBillDetailList: list,
+        salesBillSn: this.salesBillSn
+      }).then(res => {
+        if (res.status == 200) {
+          this.getOrderDetail()
+          this.$message.success(res.message, 2.5)
+          this.spinning = false
+        } else {
+          this.spinning = false
+        }
+        this.isInster = false
+      })
+    },
     // 批量取消产品
     cancelProduct (list) {
       // 防止多次添加产品

+ 117 - 11
src/views/salesManagement/waitDispatchNew/queryPart.vue

@@ -29,6 +29,9 @@
                 <a-select-option value="GIFT">
                   促销产品
                 </a-select-option>
+                <a-select-option value="GIFT1" v-if="showConvertPromoGifts">
+                  促销产品(转采购额)
+                </a-select-option>
                 <a-select-option value="GATE">
                   门槛产品
                 </a-select-option>
@@ -70,6 +73,7 @@
     <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="primary" :disabled="newLoading" class="button-info" v-if="showConvertPromoGifts" @click="handlePlPurchase">批量转采购额</a-button>
         <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&&hasNoPushedActive" ghost style="margin-left:6px;" :disabled="newLoading" @click="handleAllCancel">整单取消</a-button>
         <a-tooltip placement="top" v-if="hasPrompActive&&hasNoPushedActive" style="margin-left:6px;">
@@ -91,6 +95,7 @@
         <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">已取消金额:<strong>{{ detailData&&(detailData.totalCancelAmount || detailData.totalCancelAmount==0) ? toThousands(detailData.totalCancelAmount) : '--' }}</strong>;</span>
         <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">已下推金额:<strong>{{ detailData&&(detailData.totalPushedAmount || detailData.totalPushedAmount==0) ? toThousands(detailData.totalPushedAmount) :'--' }}</strong>;</span>
         <span v-if="$hasPermissions('B_salesDispatch_salesPrice')">待下推金额:<strong>{{ detailData&&(detailData.totalUnpushedAmount || detailData.totalUnpushedAmount==0) ? toThousands(detailData.totalUnpushedAmount) : '--' }}</strong>;</span>
+        <span v-if="$hasPermissions('B_salesDispatch_salesPrice')&&detailData&&detailData.totalConvertPromoGiftsAmount" style="color:red;">促销产品转采购额金额:<strong>{{ toThousands(detailData.totalConvertPromoGiftsAmount) }}</strong>;</span>
       </div>
     </div>
     
@@ -165,7 +170,8 @@ export default {
         productTypeSn2: '', //  产品二级分类
         productTypeSn3: '', //  产品三级分类
         salesBillSn: '',
-        warehouseSn: undefined
+        warehouseSn: undefined,
+        convertPromoGiftsFlag: undefined
       },
       disabled: false, //  查询、重置按钮是否可操作
       activeList: [], // 活动列表
@@ -193,7 +199,7 @@ export default {
       disableSelectedRowKeys: [],
       selectedRowKeys: [],
       colspanNums: 16,
-      hasNormalProduct: false
+      hasNormalProduct: false,
     }
   },
   computed: {
@@ -206,6 +212,12 @@ export default {
     hasNoPushedActive(){
       return this.detailData&&this.detailData.totalPushedQty==0||!this.detailData.totalPushedQty
     },
+    hasConvertPromoGifts(){
+      return this.detailData&&this.detailData.totalConvertPromoGiftsAmount > 0
+    },
+    showConvertPromoGifts(){
+      return this.activeList&&this.activeList.find(item => item.promotionRule&&item.promotionRule.convertExpenseFlag==1&&item.promotionRule.promotionRuleType=='BUY_PROD_GIVE_PROD')
+    },
     checkboxOption () {
       return {
           disableSelectedRowKeys: this.disableSelectedRowKeys,
@@ -251,11 +263,12 @@ export default {
                     <div>
                         <span style="padding-right: 15px;">{data}</span>
                         {ftext?(<a-badge count={ftext} number-style={{ backgroundColor: fcolor, zoom:'80%' }}></a-badge>):''}
+                        {record.bakConvertPromoGiftsQty?(<a-badge count="转" number-style={{ backgroundColor: '#ffaa00', zoom:'80%' }}></a-badge>):''}
                         {Number(record.stockQty||0) < Number(record.unpushedQty||0)?(<a-badge count="缺" number-style={{ zoom:'80%' }}></a-badge>):''}
                     </div>
                 )
           }
-      // 输入框
+      // 取消数量输入框
       const inputFormat = function(record,data,h) {
         if(record.unpushedQty>0){
           return (
@@ -274,6 +287,30 @@ export default {
         }
         return '--'
       }
+      // 转采购额数量输入框
+      const inputFormat1 = function(record,data,h) {
+        if(record.unpushedQty>=0 && record.convertPromoGiftsFlag){
+          // 已选
+          if(_this.selectedRowKeys.includes(record.id)){
+            return (
+              <div>
+                <a-input-number
+                  size="small"
+                  value={record.convertPromoGiftsQty}
+                  onChange={e => _this.convertPromoGiftsChange(e,record)}
+                  precision={0}
+                  min={0}
+                  max={record.maxConvertNums}
+                  style="width: 100%;"
+                  placeholder="请输入" />
+              </div>
+            )
+          }else{
+            return record.convertPromoGiftsQty || 0
+          }
+        }
+        return '--'
+      }
       // 操作按钮
       const actionFormat = function(record,data,h) {
         if(record.unpushedQty>0){
@@ -292,6 +329,7 @@ export default {
       }
       // 编号,并且格式化活动分类行
       const noFormat = function(record,data,h){
+        const isBuyPSendP = record.promo && record.promo.promotionRule.convertExpenseFlag==1&&record.promo.promotionRule.promotionRuleType=='BUY_PROD_GIVE_PROD'
         return (
           <div>
             {record.id.indexOf('promo-')>=0 ? (
@@ -310,8 +348,9 @@ export default {
                   数量:<strong>{record.total&&record.total.totalQty||'--'}</strong>;
                   {_this.$hasPermissions('B_salesEdit_salesPrice') ? (<span>总金额:<strong>{record.total&&record.total.totalAmount||'--'}</strong>;</span>):('')}
                   {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.lossAmount ? (<span>优惠金额:<strong>{record.total.lossAmount}</strong>;</span>):('')}
-                  {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.cgejyAmount>0 ? (<span>采购额结余:<strong>{_this.toThousands(record.total.cgejyAmount)}</strong>;</span>):('')}
-                  {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.cgejyAmount<0 ? (<span>采购额超出:<strong>{_this.toThousands(record.total.cgeccAmount)}</strong>;</span>):('')}
+                  {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.cgejyAmount>0&&!isBuyPSendP ? (<span>采购额结余:<strong>{_this.toThousands(record.total.cgejyAmount)}</strong>;</span>):('')}
+                  {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.cgejyAmount<0&&!isBuyPSendP ? (<span>采购额超出:<strong>{_this.toThousands(record.total.cgeccAmount)}</strong>;</span>):('')}
+                  {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total&&record.total.totalPromoGiftsAmount&&isBuyPSendP ? (<span>促销产品转采购额金额:<strong>{_this.toThousands(record.total&&record.total.totalPromoGiftsAmount)||'--'}</strong>;</span>):('')}
                   {record.expenseAccountFlag!='WAIT' ? record.expenseAccountFlagDictValue : ''}
                 </div>
               </div>
@@ -328,7 +367,7 @@ export default {
             { title: '原厂编码', field: 'productOrigCode',key: "d", width: 150, align: 'left',operationColumn: false,ellipsis: { showTitle: true },renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'} },
             { title: '出库仓库', field: 'warehouseName',key: "e", width: 100, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}}
         ]
-      this.colspanNums = 6
+      this.colspanNums = this.showConvertPromoGifts ? 7 : 6
       if (this.$hasPermissions('B_salesDispatch_salesPrice')) { //  售价权限
         this.colspanNums = this.colspanNums + 1
         arr.push({ title: '销售价', field: 'price', width: 80,key: "f", align: 'right',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row,row[column.field],h)} })
@@ -346,8 +385,13 @@ export default {
           { title: '已下推', field: 'pushedQty', width: 80,key: "p", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
           { title: '待下推', field: 'unpushedQty', width: 80,key: "q", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return numsFormat(row[column.field])} },
           { title: '取消数量', field: 'cancelNums', width: 80,key: "r", align: 'center',fixed: 'right',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return inputFormat(row,row[column.field],h)} },
-          { title: '操作', field: 'action', width: 80,key: "s", align: 'center',fixed: 'right',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return actionFormat(row,row[column.field],h)} },
         ])
+      if(this.showConvertPromoGifts){
+        arr.push({ title: '转采购额数量', field: 'convertPromoGiftsQty', width: 80,key: "z", align: 'center',fixed: 'right',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { 
+          return inputFormat1(row,row[column.field],h)
+        } })
+      }
+      arr.push({ title: '操作', field: 'action', width: 80,key: "s", align: 'center',fixed: 'right',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return actionFormat(row,row[column.field],h)} })
       
       return arr
     }
@@ -383,15 +427,27 @@ export default {
       record.cancelNums = v
       this.dataSource.splice()
     },
+    convertPromoGiftsChange(v,record){
+      record.convertPromoGiftsQty = v
+      this.dataSource.splice()
+    },
     // 选择单元格
     selectedRowChange({ row, isSelected, selectedRowKeys }){
       // console.log(row, isSelected, selectedRowKeys);
       this.selectedRowKeys = selectedRowKeys;
+      if(!isSelected){
+        row.convertPromoGiftsQty = row.bakConvertPromoGiftsQty
+      }
     },
     // 全选行
     selectedAllChange({ isSelected, selectedRowKeys }){
-      // console.log(isSelected, selectedRowKeys);
       this.selectedRowKeys = selectedRowKeys;
+      // 取消全选后,重置数量
+      if(!isSelected && this.showConvertPromoGifts){
+        this.dataSource.filter(item=>item.convertPromoGiftsQty).map(item => {
+          item.convertPromoGiftsQty = item.bakConvertPromoGiftsQty
+        })
+      }
     },
     // 获取销售单参与的活动列表
     getActiveList(){
@@ -413,6 +469,7 @@ export default {
         this.queryParam.salesBillSn = this.salesBillSn
         this.queryParam.showStock = true
         const params = this.queryParam
+        console.log(params)
         const active = this.activeList
         // 正常产品
         const hasSearchNormal = !params.promotionFlag || params.promotionFlag == 0
@@ -437,7 +494,6 @@ export default {
               ...params
             }
             
-            
             // 获取活动产品统计
             const acTotal = await salesPromoDetailCount(activeParams).then(res => res.data)
             if(acTotal){
@@ -475,7 +531,8 @@ export default {
         // 格式化数据
         let f = 0
         this.dataSource.map((item,i) => {
-          if(item.id.indexOf('promo-')>=0){f = f - 1}
+          const isTjRow = item.id.indexOf('promo-')>=0
+          if(isTjRow){f = f - 1}
           item.no = i + 1 + f
           const productCode = (item.productEntity && item.productEntity.code) || (item.dealerProductEntity && item.dealerProductEntity.code)
           const productName = (item.productEntity && item.productEntity.name) || (item.dealerProductEntity && item.dealerProductEntity.name)
@@ -486,8 +543,17 @@ export default {
           item.productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
           item.productOrigUnit = productOrigUnit || '--'
           item.cancelNums = item.unpushedQty
+          
+          if(item.convertPromoGiftsFlag == 1){
+            item.maxConvertNums = item.unpushedQty + item.convertPromoGiftsQty
+          }else{
+            item.maxConvertNums = 0
+          }
+          
+          item.bakConvertPromoGiftsQty = item.convertPromoGiftsQty
+          
           // 库存为0或待下推数为0,不可添加
-          if(!item.unpushedQty || item.unpushedQty<0){
+          if(!item.convertPromoGiftsQty && (!item.unpushedQty || item.unpushedQty<0) || isTjRow){
             this.disableSelectedRowKeys.push(item.id)
           }
         })
@@ -507,6 +573,7 @@ export default {
       this.queryParam.productTypeSn2 = ''
       this.queryParam.productTypeSn3 = ''
       this.queryParam.warehouseSn = undefined
+      this.queryParam.convertPromoGiftsFlag = undefined
       this.productType = []
       this.dataSource = []
       this.clearSelectTable()
@@ -534,6 +601,44 @@ export default {
         this.$message.warning('库存为0,不可添加!')
       }
     },
+    // 批量转采购额
+    handlePlPurchase(){
+      const _this = this
+      const chooseList = this.selectedRowKeys
+      if (chooseList.length == 0) {
+        _this.$message.warning('请先选择产品!')
+        return
+      }
+      const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.convertPromoGiftsFlag==1)
+      const noChooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && !item.convertPromoGiftsFlag)
+      const obj = []
+      const noObj = []
+      noChooseRow && noChooseRow.map(item => {
+        noObj.push(item.productCode)
+      })
+      chooseRow && chooseRow.map(item => {
+        obj.push({
+          'convertPromoGiftsQty': item.convertPromoGiftsQty,
+          'salesBillDetailSn': item.salesBillDetailSn
+        })
+      })
+      
+      if(obj.length){
+        this.$confirm({
+          title: '提示',
+          content: <div><div style="text-align:center;padding:10px 0;font-weight:bold;">确定将选中的促销产品转成采购额吗?</div>{noObj.length?<div style="text-align:center;"><div>总共选择了 {chooseList.length} 个产品,其中 {obj.length} 个产品可转采购额。</div><div style="color:red;"> 产品 ({noObj.toString()}) 不可转采购额!</div></div>:''}<div style="font-size:12px;color:#999;padding:10px 0;text-align:center;">
+当该销售单完结后,可将采购额转成费用报销单。</div></div>,
+          centered: true,
+          closable: true,
+          class: 'confirm-center',
+          onOk () {
+            _this.$emit('convertPromoGifts', obj)
+          }
+        })
+      }else{
+        _this.$message.warning('所选产品都不可转采购额!')
+      }
+    },
     // 批量添加
     handlePlAdd () {
       const _this = this
@@ -544,6 +649,7 @@ export default {
       }
       const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.stockQty > 0)
       const noStockRow = this.dataSource.filter(item => chooseList.includes(item.id) && !item.stockQty)
+      console.log(noStockRow)
       const obj = []
       const noObj = []
       chooseRow && chooseRow.map(item => {

+ 1 - 1
vue.config.js

@@ -108,7 +108,7 @@ const vueConfig = {
     // If you want to turn on the proxy, please remosve the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        // target: 'http://192.168.2.103:8602/ocs-admin',
+        // target: 'http://192.168.2.113:8660/ocs-admin',
         // target: 'https://t.ocs.360arrow.com/ocs-admin', //  练习
         target: 'https://p.ocs.360arrow.com/ocs-admin', //  预发布
         ws: false,