Browse Source

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

chenrui 1 year ago
parent
commit
5fa8dbf6ab
90 changed files with 5795 additions and 2250 deletions
  1. 1 1
      .env.practice
  2. BIN
      public/templ/促销规则导入产品.xlsx
  3. BIN
      public/templ/促销规则导入特价产品.xlsx
  4. BIN
      public/templ/促销规则导入特价产品(打折).xlsx
  5. BIN
      public/templ/促销规则导入特价产品(直降).xlsx
  6. BIN
      public/templ/唯一码导入模板.xlsx
  7. BIN
      public/templ/费用明细模板.xlsx
  8. 1 1
      public/version.json
  9. 7 0
      src/api/expenseManagement.js
  10. 92 8
      src/api/promotion.js
  11. 96 0
      src/api/reportData.js
  12. 8 0
      src/api/salesDetailNew.js
  13. 1 1
      src/api/waitDispatchDetail.js
  14. BIN
      src/assets/img/ongoing.png
  15. BIN
      src/assets/img/outOfDateImg.png
  16. 7 5
      src/bigScreenComponents/scale-screen/scale-screen.vue
  17. 5 2
      src/components/UploadFile/index.vue
  18. 108 0
      src/config/router.config.js
  19. 12 5
      src/layouts/BigScreen.vue
  20. 2 0
      src/libs/tools.js
  21. 31 6
      src/views/bigScreen/fPanalysisReport/index.vue
  22. 3 0
      src/views/bigScreen/fPanalysisReport/right-bottom.vue
  23. 5 1
      src/views/bigScreen/fPanalysisReport/right-top.vue
  24. 5 0
      src/views/bigScreen/realTimeSalesReport/center-bottom.vue
  25. 5 1
      src/views/bigScreen/realTimeSalesReport/center-map.vue
  26. 3 2
      src/views/bigScreen/realTimeSalesReport/center-top.vue
  27. 28 5
      src/views/bigScreen/realTimeSalesReport/index.vue
  28. 4 1
      src/views/bigScreen/realTimeSalesReport/left-bottom.vue
  29. 4 1
      src/views/bigScreen/realTimeSalesReport/left-top.vue
  30. 5 0
      src/views/bigScreen/realTimeSalesReport/right-top.vue
  31. 1 1
      src/views/bnSetting/menu/childModal.vue
  32. 1 1
      src/views/bnSetting/menu/storeMenus.vue
  33. 11 9
      src/views/common/chooseBrandModal.vue
  34. 0 1
      src/views/common/chooseTypeModal.vue
  35. 85 0
      src/views/common/creatorList.vue
  36. 83 0
      src/views/common/otherTransactions.js
  37. 0 2
      src/views/dealerManagement/businessOwnerSettings/chooseDealer.vue
  38. 0 1
      src/views/dealerManagement/businessOwnerSettings/chooseSupplier.vue
  39. 1 1
      src/views/dealerManagement/dealerZoneSearch/list.vue
  40. 2 2
      src/views/expenseManagement/expenseReimbursement/add.vue
  41. 7 1
      src/views/expenseManagement/expenseReimbursement/baseDataModal.vue
  42. 23 23
      src/views/expenseManagement/expenseReimbursement/detail.vue
  43. 8 1
      src/views/expenseManagement/expenseReimbursement/epenseCdfModal.vue
  44. 4 1
      src/views/expenseManagement/expenseReimbursement/epenseDetailModal.vue
  45. 1 1
      src/views/expenseManagement/expenseReimbursement/importGuideModal.vue
  46. 186 170
      src/views/expenseManagement/expenseReimbursement/list.vue
  47. 178 172
      src/views/expenseManagement/expenseReimbursementDetail/list.vue
  48. 230 0
      src/views/productManagement/productSourcePath/chooseImportModal.vue
  49. 197 0
      src/views/productManagement/productSourcePath/importGuideModal.vue
  50. 369 0
      src/views/productManagement/productSourcePath/list.vue
  51. 219 0
      src/views/productManagement/productSourcePath/warrantyInfoModal.vue
  52. 85 18
      src/views/promotionRulesManagement/dealerPromotions/addModal.vue
  53. 237 0
      src/views/promotionRulesManagement/dealerPromotions/chooseDealer.vue
  54. 29 12
      src/views/promotionRulesManagement/dealerPromotions/chooseImportModal.vue
  55. 50 37
      src/views/promotionRulesManagement/dealerPromotions/detail.vue
  56. 160 54
      src/views/promotionRulesManagement/dealerPromotions/detailModal.vue
  57. 8 4
      src/views/promotionRulesManagement/dealerPromotions/editActiveEndTime.vue
  58. 1 1
      src/views/promotionRulesManagement/dealerPromotions/importDealerModa.vue
  59. 23 8
      src/views/promotionRulesManagement/dealerPromotions/importGuideModal.vue
  60. 213 31
      src/views/promotionRulesManagement/dealerPromotions/list.vue
  61. 326 0
      src/views/promotionRulesManagement/dealerPromotions/lookUpCustomersModal.vue
  62. 278 183
      src/views/promotionRulesManagement/dealerPromotions/sendAmountModal.vue
  63. 305 201
      src/views/promotionRulesManagement/dealerPromotions/sendProductsModal.vue
  64. 312 117
      src/views/promotionRulesManagement/dealerPromotions/specialOfferModal.vue
  65. 47 36
      src/views/promotionRulesManagement/dealerPromotions/tableType1.vue
  66. 0 608
      src/views/promotionRulesManagement/dealerPromotions/tableType2.vue
  67. 190 79
      src/views/promotionRulesManagement/dealerPromotions/tableType3.vue
  68. 2 3
      src/views/promotionRulesManagement/promotionManagement/chooseDealer.vue
  69. 3 4
      src/views/purchasingManagement/purchaseReturn/queryPart.vue
  70. 35 17
      src/views/reportData/promotionSalesRealTimeReport/index.vue
  71. 42 42
      src/views/reportData/promotionSalesRealTimeReport/list.vue
  72. 3 3
      src/views/reportData/regionTypeSalesReport/list.vue
  73. 8 2
      src/views/reportData/salesReturnDetailReport/list.vue
  74. 330 0
      src/views/reportData/tireSalesReport/list.vue
  75. 231 0
      src/views/reportData/tireSalesReport/subareaList.vue
  76. 89 89
      src/views/salesManagement/outboundOrder/list.vue
  77. 7 7
      src/views/salesManagement/pushOrderManagement/detailForOut.vue
  78. 195 0
      src/views/salesManagement/pushOrderManagement/uniqueCodeModal.vue
  79. 22 10
      src/views/salesManagement/receiptPrint/list.vue
  80. 4 1
      src/views/salesManagement/receiptPrint/printModel.vue
  81. 6 1
      src/views/salesManagement/salesCollection/voucherModal.vue
  82. 13 7
      src/views/salesManagement/salesQueryNew/comps/activeQueryPart.vue
  83. 71 46
      src/views/salesManagement/salesQueryNew/comps/detailProductList.vue
  84. 20 37
      src/views/salesManagement/salesQueryNew/comps/productList.vue
  85. 50 6
      src/views/salesManagement/salesQueryNew/detail.vue
  86. 10 4
      src/views/salesManagement/salesQueryNew/edit.vue
  87. 100 72
      src/views/salesManagement/salesQueryNew/list.vue
  88. 36 1
      src/views/salesManagement/waitDispatchNew/edit.vue
  89. 209 82
      src/views/salesManagement/waitDispatchNew/queryPart.vue
  90. 6 0
      src/views/supplierManagement/supplierInfo/edit.vue

+ 1 - 1
.env.practice

@@ -1,6 +1,6 @@
 NODE_ENV=production
 VUE_APP_PREVIEW=false
-VUE_APP_API_BASE_URL=https://t.ocs.360arrow.com/ocs-admin
+VUE_APP_API_BASE_URL=http://192.168.2.100:89/ocs-admin
 VUE_APP_WX_BASE_URL=//t.ocs.360arrow.com/ocs-admin/websocket/
 VUE_APP_VERSION=V1.0.1
 VUE_APP_ENVTIPS=练习环境

BIN
public/templ/促销规则导入产品.xlsx


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


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


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


BIN
public/templ/唯一码导入模板.xlsx


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


+ 1 - 1
public/version.json

@@ -1,4 +1,4 @@
 {
-    "version": "2.2.28",
+    "version": "2.2.29",
     "message": "发现有新版本发布,确定更新系统?"
 }

+ 7 - 0
src/api/expenseManagement.js

@@ -16,6 +16,13 @@ export const employeeQueryList = (params) => {
     method: 'post'
   })
 }
+// 其它往来人员
+export const otherOrgQuery = (params) => {
+  return axios({
+    url: `/otherorg/queryAll`,
+    method: 'get'
+  })
+}
 
 // 费用报销单列表
 export const expenseAccountList = (params) => {

+ 92 - 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',
@@ -158,3 +160,85 @@ export const downDealerFail = (params) => {
     responseType: 'blob'
   })
 }
+
+// 创建人   列表查询
+export const queryCreatorList = (params) => {
+  return axios({
+    url: '/promotion/queryCreatorList',
+    data: params,
+    method: 'post'
+  })
+}
+
+// 复制  经销商促销列表
+export const handleCopyData = (params) => {
+  return axios({
+    url: '/promotion/copyData',
+    data: params,
+    method: 'post'
+  })
+}
+
+// 经销商促销  已选参与客户  列表查询  分页
+export const queryAuditPageList = (params) => {
+  const url = `/promotion/dealer/queryAuditPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 经销商列表查询  分页  已选择的排在最上边
+export const queryDealerPage = (params) => {
+  const url = `/promotion/dealer/queryDealerPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 参与客户 提交审核
+export const midwaySubmit = (params) => {
+  return axios({
+    url: '/promotion/dealer/midwaySubmit',
+    data: params,
+    method: 'post'
+  })
+}
+// 参与客户   更新列表
+export const dealerMidwayUpdate = (params) => {
+  return axios({
+    url: '/promotion/dealer/midwayUpdate',
+    data: params,
+    method: 'post'
+  })
+}
+// 参与客户 审核通过  审核不通过
+export const dealerMidwayAudit = (params) => {
+  return axios({
+    url: '/promotion/dealer/midwayAudit',
+    data: params,
+    method: 'post'
+  })
+}
+// 获取所有经销商sn   全部客户回显
+export const allDealerSnList = (params) => {
+  return axios({
+    url: '/promotion/dealer/allDealerSnList',
+    data: params,
+    method: 'post'
+  })
+}
+
+// 获取所选经销商sn
+export const updateDealerSnList = (params) => {
+  return axios({
+    url: '/promotion/dealer/updateDealerSnList',
+    data: params,
+    method: 'post'
+  })
+}

+ 96 - 0
src/api/reportData.js

@@ -941,3 +941,99 @@ export const exportSalesPromoRealReport = (params) => {
     responseType: 'blob'
   })
 }
+
+/*
+*   产品追溯列表
+*/
+
+// 导出错误项
+export const codeExportImportError = (params) => {
+  return axios({
+    url: '/report/tracecode/exportImportError',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}
+
+// 确定导入轮胎唯一码
+export const traceCodeInsertBatch = (params) => {
+  const url = `/report/tracecode/insertBatch`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 获取  产品追溯列表
+export const traceCodeList = (params) => {
+  const url = `/report/tracecode/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 产品追溯列表   统计
+export const traceCodeQueryCount = (params) => {
+  const url = '/report/tracecode/queryCount'
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 产品追溯列表 导出
+export const excelOnlineList = (params) => {
+  return axios({
+    url: '/report/tracecode/excelOnlineList',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}
+// 质保信息
+export const getWarrantyInfo = (params) => {
+  return axios({
+    url: `/report/warranty/queryById/${params.id}`,
+    method: 'post'
+  })
+}
+/*
+*   轮胎统计报表
+*/
+
+// 轮胎统计报表   列表
+export const queryTireList = (params) => {
+  const url = `/report/tire/queryTirePage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 轮胎统计报表  统计
+export const queryTireCount = (params) => {
+  return axios({
+    url: '/report/tire/queryTireCount',
+    data: params,
+    method: 'post'
+  })
+}
+// 轮胎统计报表  导出
+export const excelTireOnlineExport = (params) => {
+  return axios({
+    url: '/report/tire/excelTireOnlineList',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 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({

+ 1 - 1
src/api/waitDispatchDetail.js

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

BIN
src/assets/img/ongoing.png


BIN
src/assets/img/outOfDateImg.png


+ 7 - 5
src/bigScreenComponents/scale-screen/scale-screen.vue

@@ -74,6 +74,7 @@ export default {
       originalHeight: 0,
       onResize: null,
       observer: null,
+      isInnerPage: false
     };
   },
   watch: {
@@ -94,10 +95,11 @@ export default {
   },
   methods: {
     initSize() {
+      this.isInnerPage = this.$route.path.indexOf("bigStatistics")>=0
       return new Promise((resolve, reject) => {
         // console.log("初始化样式");
         //给父元素设置 overflow:hidden
-        this.screenWrapper.parentNode.style.overflow = "hidden";
+        this.screenWrapper.parentNode.style.overflow = !this.isInnerPage ? "hidden" : 'auto';
         this.screenWrapper.parentNode.scrollLeft = 0;
         this.screenWrapper.parentNode.scrollTop = 0;
 
@@ -135,8 +137,8 @@ export default {
       const screenWrapper = this.screenWrapper;
       const domWidth = screenWrapper.clientWidth;
       const domHeight = screenWrapper.clientHeight;
-      const currentWidth = document.body.clientWidth;
-      const currentHeight = document.body.clientHeight;
+      const currentWidth = !this.isInnerPage ? document.body.clientWidth : screenWrapper.parentNode.clientWidth;
+      const currentHeight = !this.isInnerPage ? document.body.clientHeight : screenWrapper.parentNode.clientHeight;
       screenWrapper.style.transform = `scale(${scale},${scale}) `;
       let mx = Math.max((currentWidth - domWidth * scale) / 2, 0);
       let my = Math.max((currentHeight - domHeight * scale) / 2, 0);
@@ -160,8 +162,8 @@ export default {
     updateScale() {
       const screenWrapper = this.screenWrapper;
       // 获取真实视口尺寸
-      const currentWidth = document.body.clientWidth;
-      const currentHeight = document.body.clientHeight;
+      const currentWidth = !this.isInnerPage ? document.body.clientWidth : screenWrapper.parentNode.clientWidth;
+      const currentHeight = !this.isInnerPage ? document.body.clientHeight : screenWrapper.parentNode.clientHeight;
       // 获取大屏最终的宽高onResize
       const realWidth = this.currentWidth || this.originalWidth;
       const realHeight = this.currentHeight || this.originalHeight;

+ 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(','))
           }

+ 108 - 0
src/config/router.config.js

@@ -1834,6 +1834,31 @@ export const asyncRouterMap = [
               }
             ]
           },
+          {
+            path: '/reportData/tireSalesReport',
+            redirect: '/reportData/tireSalesReport/list',
+            name: 'tireSalesReport',
+            component: BlankLayout,
+            meta: {
+              title: '轮胎统计报表',
+              icon: 'profile',
+              permission: 'M_tireSalesReportList'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'tireSalesReportIndex',
+                component: () => import(/* webpackChunkName: "reportData" */ '@/views/reportData/tireSalesReport/list.vue'),
+                meta: {
+                  title: '轮胎统计报表',
+                  icon: 'profile',
+                  hidden: true,
+                  permission: 'M_tireSalesReportList'
+                }
+              }
+            ]
+          },
           {
             path: '/reportData/allocationOrderTotal',
             redirect: '/reportData/allocationOrderTotal/list',
@@ -2451,6 +2476,7 @@ export const asyncRouterMap = [
               }
             ]
           }
+
           // {
           //   path: '/reportData/allCountryCostReport',
           //   redirect: '/reportData/allCountryCostReport/list',
@@ -2873,6 +2899,31 @@ export const asyncRouterMap = [
                 }
               }
             ]
+          },
+          {
+            path: '/productManagement/productSourcePath',
+            redirect: '/productManagement/productSourcePath/list',
+            name: 'productSourcePath',
+            component: BlankLayout,
+            meta: {
+              title: '唯一码追溯列表',
+              icon: 'radar-chart',
+              permission: 'M_productSourcePathList'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'productSourcePathList',
+                component: () => import(/* webpackChunkName: "productManagement" */ '@/views/productManagement/productSourcePath/list.vue'),
+                meta: {
+                  title: '唯一码追溯列表',
+                  icon: 'radar-chart',
+                  hidden: true,
+                  permission: 'M_productSourcePathList'
+                }
+              }
+            ]
           }
         ]
       },
@@ -3339,6 +3390,63 @@ export const asyncRouterMap = [
           }
         ]
       },
+      // 大屏数据
+      {
+        path: '/bigStatistics',
+        redirect: '/bigStatistics/realTimeSalesReport',
+        component: PageView,
+        meta: {
+          title: '数据统计',
+          icon: 'desktop',
+          permission: 'M_bigScreenStatistics'
+        },
+        children: [
+          {
+            path: '/bigStatistics/realTimeSalesReport',
+            redirect: '/bigStatistics/realTimeSalesReport/index',
+            name: 'bigRealTimeSalesReport',
+            component: BigScreen,
+            meta: {
+              title: '实时销售看板',
+              icon: 'deployment-unit',
+              permission: 'M_realTimeSalesReportIndex'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'index',
+                name: 'realTimeSalesReportIndex',
+                component: () => import(/* webpackChunkName: "bigScreen" */ '@/views/bigScreen/realTimeSalesReport/index'),
+                meta: {
+                  title: '实时销售看板'
+                }
+              },
+            ]
+          },
+          {
+            path: '/bigStatistics/fPanalysisReport',
+            redirect: '/bigStatistics/fPanalysisReport/index',
+            name: 'bigfPanalysisReport',
+            component: BigScreen,
+            meta: {
+              title: '加盟商/产品分析',
+              icon: 'interaction',
+              permission: 'M_fPanalysisReportIndex'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'index',
+                name: 'fPanalysisReportIndex',
+                component: () => import(/* webpackChunkName: "bigScreen" */ '@/views/bigScreen/fPanalysisReport/index'),
+                meta: {
+                  title: '加盟商/产品分析'
+                }
+              }
+            ]
+          }
+        ]
+      },
       // 基础设置
       {
         path: '/basicData',

+ 12 - 5
src/layouts/BigScreen.vue

@@ -57,7 +57,6 @@ export default {
   mounted () {
     this.timeFn()
     this.cancelLoading()
-    console.log(this.$route.meta.title)
   },
   beforeDestroy () {
     clearInterval(this.timing)
@@ -204,10 +203,18 @@ export default {
               margin-right: 20px;
               background: linear-gradient(to right, rgba(39, 180, 255, 0.5), rgba(76, 245, 255, 0.1));
   			cursor: pointer;
-  			&:hover,&:active{
-  				color: #f1f1f1;
-  				background: linear-gradient(to right, rgba(39, 180, 255, 0.7), rgba(76, 245, 255, 0.3));
-  			}
+            &:hover,&:active{
+              color: #f1f1f1;
+              background: linear-gradient(to right, rgba(39, 180, 255, 0.7), rgba(76, 245, 255, 0.3));
+            }
+            select{
+              border:0;
+              background:none;
+              font-size: 16px;
+              option{
+                color: #333
+              }
+            }
           }
   		.focus{
   			transform: scale(1.1);

+ 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;

+ 31 - 6
src/views/bigScreen/fPanalysisReport/index.vue

@@ -1,8 +1,19 @@
 <template>
   <div class="contents">
     <div class="contetn_left">
-      <div class="pagetab">
-        <div class="item" ref="myDiv" v-focusable @click="toPage">﹤实时销售看板</div>
+      <div class="pagetab" v-if="!isInnerPage">
+        <div class="item" ref="myDiv" v-focusable @click="toPage">
+          ﹤实时销售看板
+        </div>
+      </div>
+      <div class="pagetab" v-else>
+        <div class="item" style="width: 120px;margin-right:10px" v-focusable>
+          <select @click="changeYear">
+            <option v-for="item in yearArr" :key="item" :value="item" :selected="curYear==item" >
+              {{item}} 年
+            </option>
+          </select>
+        </div>
       </div>
       <ItemWrap class="contetn_left-top contetn_lr-aitem" title="加盟商分布">
         <LeftBottom />
@@ -75,7 +86,9 @@ export default {
       curTab: 1,
       jmsTotal: 0,
       cpTotal: 0,
-      curYear: ''
+      curYear: '',
+      isInnerPage: false,
+      yearArr: []
     }
   },
   filters: {
@@ -89,11 +102,23 @@ export default {
 	  })
     const year = location.href.split('?')[1]
     this.curYear = year ? year.split('=')[1] : new Date().getFullYear()
+    this.isInnerPage = this.$route.path.indexOf("bigStatistics")>=0
+  },
+  mounted () {
+    const toYeay = new Date().getFullYear()
+    this.yearArr = [toYeay-3,toYeay-2,toYeay-1,toYeay]
   },
-  mounted () {},
   methods: {
-    toPage () {
-      this.$router.push({ name: 'realTimeSalesReport', query: { year: this.curYear } })
+    changeYear(e){
+      this.toPage(e.target.value)
+    },
+    toPage (curYear) {
+      if(!this.isInnerPage){
+        this.$router.push({ name: 'realTimeSalesReport', query: { year: this.curYear } })
+      }else{
+        this.curYear = curYear
+        this.$router.replace({ name: 'bigfPanalysisReport', query: { year: curYear } })
+      }
     },
     setJmsTotal (val) {
       this.jmsTotal = val

+ 3 - 0
src/views/bigScreen/fPanalysisReport/right-bottom.vue

@@ -75,6 +75,9 @@ export default {
     })
   },
   watch: {
+    curYear (a,b){
+      this.getData()
+    },
   	curTab (newValue, oldValue) {
       this.queryType = newValue == 1 ? 'qty' : 'amount'
   		this.getData()

+ 5 - 1
src/views/bigScreen/fPanalysisReport/right-top.vue

@@ -65,7 +65,11 @@ export default {
   created () {
     this.getData()
   },
-  mounted () { },
+  watch:{
+    curYear (a,b){
+      this.getData()
+    }
+  },
   beforeDestroy () {
     this.clearData()
   },

+ 5 - 0
src/views/bigScreen/realTimeSalesReport/center-bottom.vue

@@ -30,6 +30,11 @@ export default {
   mounted () {
     this.getData()
   },
+  watch:{
+    curYear (a,b){
+      this.getData()
+    }
+  },
   beforeDestroy () {
     this.clearData()
   },

+ 5 - 1
src/views/bigScreen/realTimeSalesReport/center-map.vue

@@ -37,7 +37,11 @@ export default {
       loading: false
     }
   },
-  created () {},
+  watch:{
+    curYear (a,b){
+      this.getData('china')
+    }
+  },
   mounted () {
     this.getData('china')
   },

+ 3 - 2
src/views/bigScreen/realTimeSalesReport/center-top.vue

@@ -34,9 +34,10 @@ export default {
       config1: null
     }
   },
-  mounted () {
-  },
   watch: {
+    curYear (a,b){
+      this.getData()
+    },
     totalNums (newValue, oldValue) {
       console.log(newValue)
       this.config = {

+ 28 - 5
src/views/bigScreen/realTimeSalesReport/index.vue

@@ -1,11 +1,20 @@
 <template>
   <div class="contents">
     <div class="contetn_left">
-      <div class="pagetab">
+      <div class="pagetab" v-if="!isInnerPage">
         <div class="item" ref="myDiv" v-focusable @click="toPage">
           ﹤加盟商/产品分析
         </div>
       </div>
+      <div class="pagetab" v-else>
+        <div class="item" style="width: 120px;margin-right:10px" v-focusable>
+          <select @click="changeYear">
+            <option v-for="item in yearArr" :key="item" :value="item" :selected="curYear==item" >
+              {{item}} 年
+            </option>
+          </select>
+        </div>
+      </div>
       <ItemWrap class="contetn_left-top contetn_lr-item" :title="'区域销售金额占比'">
         <LeftTop :curYear="curYear" />
       </ItemWrap>
@@ -68,7 +77,9 @@ export default {
     return {
       yearTotalNums: 0,
       yearTotalAmount: 0,
-      curYear: ''
+      curYear: '',
+      isInnerPage: false,
+      yearArr: []
     }
   },
   filters: {
@@ -82,11 +93,23 @@ export default {
 	  })
     const year = location.href.split('?')[1]
     this.curYear = year ? year.split('=')[1] : new Date().getFullYear()
+    this.isInnerPage = this.$route.path.indexOf("bigStatistics")>=0
+  },
+  mounted () { 
+    const toYeay = new Date().getFullYear()
+    this.yearArr = [toYeay-3,toYeay-2,toYeay-1,toYeay]
   },
-  mounted () { },
   methods: {
-    toPage () {
-      this.$router.push({ name: 'fPanalysisReport', query: { year: this.curYear } })
+    changeYear(e){
+      this.toPage(e.target.value)
+    },
+    toPage (curYear) {
+      if(!this.isInnerPage){
+        this.$router.push({ name: 'fPanalysisReport', query: { year: this.curYear } })
+      }else{
+        this.curYear = curYear
+        this.$router.replace({ name: 'bigRealTimeSalesReport', query: { year: curYear } })
+      }
     },
     setYearData (data) {
       console.log(data)

+ 4 - 1
src/views/bigScreen/realTimeSalesReport/left-bottom.vue

@@ -30,7 +30,10 @@ export default {
   created () {
     this.getData()
   },
-  computed: {
+  watch:{
+    curYear (a,b){
+      this.getData()
+    }
   },
   mounted () { },
   beforeDestroy () {

+ 4 - 1
src/views/bigScreen/realTimeSalesReport/left-top.vue

@@ -29,7 +29,10 @@ export default {
   created () {
     this.getData()
   },
-  mounted () {
+  watch:{
+    curYear (a,b){
+      this.getData()
+    }
   },
   beforeDestroy () {
     this.clearData()

+ 5 - 0
src/views/bigScreen/realTimeSalesReport/right-top.vue

@@ -36,6 +36,11 @@ export default {
   mounted () {
     this.getData()
   },
+  watch:{
+    curYear (a,b){
+      this.getData()
+    }
+  },
   beforeDestroy () {
     this.clearData()
   },

+ 1 - 1
src/views/bnSetting/menu/childModal.vue

@@ -257,7 +257,7 @@ export default {
       const _this = this
       this.form.validateFields((err, values) => {
         if (!err) {
-          console.log(values.formData, ' formData.type222222222')
+          console.log(values.formData, ' formData.type')
           values.formData.permission = values.formData.permission.replace(/\//g, '_')
           const saveRequest = this.parentType == 'store' ? saveMdMenu : saveYyMenu
           saveRequest(Object.assign(this.formData, values.formData)).then(res => {

+ 1 - 1
src/views/bnSetting/menu/storeMenus.vue

@@ -351,7 +351,7 @@ export default {
     // 获取菜单树列表
     getMdMenuList () {
       getMdMenuList().then(res => {
-        console.log(res, 'res1111111')
+        console.log(res, 'res')
         if (res.status == 200) {
           this.treeData = res.data
           console.log(this.treeData, 'this.treeData')

+ 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: {

+ 0 - 1
src/views/common/chooseTypeModal.vue

@@ -140,7 +140,6 @@ export default {
       }
     },
     handleAllDisabled (list) {
-      console.log('111111111:', list)
       this.chooseList = list
     },
     // 禁用递归

+ 85 - 0
src/views/common/creatorList.vue

@@ -0,0 +1,85 @@
+<template>
+  <a-select
+    show-search
+    label-in-value
+    :size="size"
+    :value="creatorName"
+    :placeholder="placeholder"
+    style="width: 100%"
+    :filter-option="false"
+    :not-found-content="fetching ? undefined : null"
+    :dropdownMatchSelectWidth="false"
+    @search="fetchUser"
+    @change="handleChange"
+    allowClear
+    :disabled="disabled"
+  >
+    <a-spin v-if="fetching" slot="notFoundContent" size="small" />
+    <a-select-option v-for="item in data" :key="item.creatorId" :value="item.creatorId">
+      {{ item.creatorName }}
+    </a-select-option>
+  </a-select>
+</template>
+<script>
+import debounce from 'lodash/debounce'
+import { queryCreatorList } from '@/api/promotion'
+export default {
+  props: {
+    size: {
+      type: String,
+      default: 'default'
+    },
+    placeholder: {
+      type: String,
+      default: '请输入创建人名称搜索'
+    },
+    disabled: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    this.lastFetchId = 0
+    this.fetchUser = debounce(this.fetchUser, 800)
+    return {
+      data: [],
+      creatorName: [],
+      fetching: false
+    }
+  },
+  methods: {
+    fetchUser (likeCreatorName) {
+      if (likeCreatorName == '') return
+      this.lastFetchId += 1
+      const fetchId = this.lastFetchId
+      this.data = []
+      this.fetching = true
+      queryCreatorList({ creatorName: likeCreatorName.replace(/\s+/g, '') }).then(res => {
+        if (fetchId !== this.lastFetchId) {
+          return
+        }
+        this.data = res.data ? res.data : []
+        this.fetching = false
+      })
+    },
+    handleChange (value) {
+      if (value && value.key) {
+        const obj = this.data.find(item => item.creatorId == value.key)
+        value.name = obj.creatorName
+      }
+      Object.assign(this, {
+        creatorName: value,
+        data: [],
+        fetching: false
+      })
+      this.$emit('change', value || { key: undefined })
+    },
+    resetForm () {
+      this.creatorName = []
+    },
+    setDefaultVal (val) {
+      this.creatorName = val
+    }
+  }
+}
+</script>

+ 83 - 0
src/views/common/otherTransactions.js

@@ -0,0 +1,83 @@
+import { otherOrgQuery } from '@/api/expenseManagement.js'
+const Employee = {
+  template: `
+      <a-select
+        :placeholder="placeholder"
+        :id="id"
+        allowClear
+        :value="defaultVal"
+        :showSearch="true"
+        :disabled="disabledFlag"
+        @change="handleChange"
+        option-filter-prop="children"
+        :filter-option="filterOption">
+        <a-select-option v-for="item in list" :key="item.otherOrgSn" :value="item.otherOrgSn">
+        {{ item.otherOrgName }}
+        </a-select-option>
+      </a-select>
+    `,
+  props: {
+    value: {
+      type: String,
+      defatut: ''
+    },
+    id: {
+      type: String,
+      default: ''
+    },
+    placeholder: {
+      type: String,
+      default: '请选择其他往来单位'
+    },
+    enableFlag: {
+      type: String,
+      default: ''
+    },
+    disabledFlag: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      defaultVal: this.value,
+      list: []
+    }
+  },
+  mounted () {
+    this.getList()
+  },
+  watch: {
+    value (newValue, oldValue) {
+      this.defaultVal = newValue
+    }
+  },
+  methods: {
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    },
+    handleChange (value) {
+      this.defaultVal = value
+      const item = this.list.find(item => item.supplierSn == value)
+      this.$emit('input', value)
+      this.$emit('change', value, item)
+    },
+    getList () {
+      otherOrgQuery().then(res => {
+        if (res.status == 200) {
+          if (this.enableFlag != '') {
+            this.list = res.data.filter(item => item.enableFlag == this.enableFlag)
+          } else {
+            this.list = res.data
+          }
+        } else {
+          this.list = []
+        }
+      })
+    }
+  }
+}
+
+export default Employee

+ 0 - 2
src/views/dealerManagement/businessOwnerSettings/chooseDealer.vue

@@ -148,7 +148,6 @@ export default {
                 }
               }
             }
-            console.log('11111111111111:', chooseData)
             if (!this.pageFlag) {
               this.pageFlag = true
               _this.$refs.table.setTableSelected(_this.chooseInfo, chooseData) // 设置表格选中项
@@ -188,7 +187,6 @@ export default {
     // 表格选中项
     rowSelectionFun (obj) {
       this.rowSelectionInfo = obj || null
-      console.log('22222222222222222222:', obj)
     },
     areaChange (val) {
       this.queryParam.provinceSn = val[0] ? val[0] : ''

+ 0 - 1
src/views/dealerManagement/businessOwnerSettings/chooseSupplier.vue

@@ -88,7 +88,6 @@ export default {
               }
             }
             if (!_this.pageFlag) {
-              console.log('11111111111111111111111', _this.chooseInfo, chooseData)
               _this.$refs.table.setTableSelected(_this.chooseInfo, chooseData) // 设置表格选中项
               _this.pageFlag = true
             }

+ 1 - 1
src/views/dealerManagement/dealerZoneSearch/list.vue

@@ -168,7 +168,7 @@ export default {
     // 选择经销商
     dealerChange (val) {
       this.queryParam.dealer.dealerSn = val.key
-      this.queryParam.dealer.dealerName = (val.label.replace('\n', '')).trim()
+      this.queryParam.dealer.dealerName = val.key ? (val.label.replace('\n', '')).trim() : ''
     },
     pageInit () {
       const _this = this

+ 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: ''
         },

+ 230 - 0
src/views/productManagement/productSourcePath/chooseImportModal.vue

@@ -0,0 +1,230 @@
+<template>
+  <a-modal
+    centered
+    class="chooseImport-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="导入"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="900">
+    <div class="chooseImport-con">
+      <!-- 可导入数据 -->
+      <div class="chooseImport-head">
+        <p class="text-overflow">可导入数据{{ loadData.length }}条</p>
+        <p>
+          <a-tooltip placement="rightTop">
+            <template slot="title">
+              <div v-for="(con,i) in countData" :key="i"><strong>业务单号</strong>({{ con.bizCode }})<span v-for="(item,j) in con.info" :key="j">{{ item.productCode }}(<span class="red">{{ item.productNum }}</span>/{{ item.bizProductNum }});</span></div>
+            </template>
+            <div class="text-overflows2" v-if="countData && countData.length>0">
+              可导入产品数量与实际销售数量有差异:<span v-for="(con,i) in countData" :key="i"><strong>业务单号</strong>({{ con.bizCode }})<span v-for="(item,j) in con.info" :key="j">{{ item.productCode }}(<span class="red">{{ item.productNum }}</span>/{{ item.bizProductNum }});</span></span>
+            </div>
+          </a-tooltip>
+        </p>
+      </div>
+      <a-table
+        class="sTable"
+        ref="table"
+        size="small"
+        :rowKey="(record) => record.no"
+        rowKeyName="no"
+        :columns="nowColumns"
+        :dataSource="loadData"
+        :loading="loading"
+        :scroll="{ y: 200 }"
+        :pagination="false"
+        bordered>
+      </a-table>
+      <a-divider />
+      <!-- 不可导入数据 -->
+      <p class="red">不可导入数据{{ unLoadData.length }}条</p>
+      <a-table
+        class="unTable"
+        ref="unTable"
+        size="small"
+        :rowKey="(record) => record.no"
+        rowKeyName="no"
+        :columns="nowUnColumns"
+        :dataSource="unLoadData"
+        :loading="loading"
+        :scroll="{ y: 200 }"
+        :pagination="false"
+        bordered>
+      </a-table>
+      <!-- 按钮 -->
+      <div class="btn-con">
+        <a-button
+          type="primary"
+          id="chooseImport-submit"
+          size="large"
+          :class="loadData.length==0?'button-grey':'button-primary'"
+          @click="handleSubmit"
+          style="padding: 0 40px;">确认导入</a-button>
+        <a-button
+          id="chooseImport-cancel"
+          size="large"
+          class="button-cancel"
+          @click="isShow=false"
+          style="padding: 0 40px;margin-left: 15px;">取消</a-button>
+        <a-button
+          type="primary"
+          id="chooseImport-error"
+          size="large"
+          class="button-error"
+          @click="handleError"
+          style="padding: 0 40px;margin-left: 15px;">导出错误项</a-button>
+      </div>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { hdExportExcel } from '@/libs/exportExcel'
+import { codeExportImportError } from '@/api/reportData'
+export default {
+  name: 'ChooseImportModal',
+  mixins: [commonMixin],
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    paramsData: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      nowColumns: [
+        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: '21%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '唯一码', dataIndex: 'traceCode', width: '21%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '业务单号', dataIndex: 'bizCode', width: '21%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '工厂出库单号', dataIndex: 'factoryOutNo', width: '26%', align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      loadData: [],
+      nowUnColumns: [
+        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '唯一码', dataIndex: 'traceCode', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '业务单号', dataIndex: 'bizCode', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '工厂出库单号', dataIndex: 'factoryOutNo', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '备注', dataIndex: 'errorDesc', width: '27%', align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      unLoadData: [],
+      loading: false,
+      countData: []
+    }
+  },
+  methods: {
+    // 获取导入列表
+    getData () {
+      const _this = this
+      const paramsData = JSON.parse(JSON.stringify(_this.paramsData))
+      this.loadData = paramsData.rightList || []
+      this.unLoadData = paramsData.errorList || []
+      this.loadData.map((item, index) => {
+        item.no = index + 1
+      })
+      this.unLoadData.map((item, index) => {
+        item.no = index + 1
+      })
+      if (paramsData.billList && paramsData.billList.length > 0) {
+        const newCountData = paramsData.billList || []
+        newCountData.map(item => {
+          item.info = [{ productCode: item.productCode,
+            productNum: item.productNum,
+            bizProductNum: item.bizProductNum }]
+        })
+        const mergedObjects = newCountData.reduce((acc, obj) => {
+          const index = acc.findIndex(o => { return o.bizCode == obj.bizCode })
+          if (index != -1) {
+            acc[index].info.push({ productCode: obj.productCode,
+              productNum: obj.productNum,
+              bizProductNum: obj.bizProductNum })
+          } else {
+            acc.push(obj)
+          }
+          return acc
+        }, [])
+        this.countData = mergedObjects
+      }
+    },
+    compareObjects (obj1, obj2) {
+      return Object.keys(obj1).every(key => obj1[key] === obj2[key])
+    },
+    // 确认导入
+    handleSubmit () {
+      if (this.loadData.length == 0) {
+        this.$message.warning('无可导入数据!')
+      } else {
+        this.$emit('ok', this.loadData)
+        this.isShow = false
+      }
+    },
+    // 导出 错误项
+    handleError () {
+      const _this = this
+      if (_this.unLoadData.length < 1) {
+        _this.$message.info('暂无可导出的错误项~')
+        return
+      }
+      _this.spinning = true
+      hdExportExcel(codeExportImportError, _this.unLoadData, '唯一码错误项', function () {
+        _this.spinning = false
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.loadData = []
+        this.unLoadData = []
+        this.countData = []
+      } else {
+        this.getData()
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .chooseImport-modal{
+    .chooseImport-con{
+      .red{
+        color: #f30;
+      }
+      .btn-con{
+        text-align: center;
+        margin: 30px 0 20px;
+        .button-cancel,.button-error{
+          font-size: 12px;
+        }
+      }
+      .chooseImport-head{
+        display:flex;
+        align-items:center;
+        p:first-child{
+          max-width:12%;
+        }
+        p:last-child{
+          margin-left:10px;
+          max-width:88%;
+        }
+      }
+    }
+  }
+</style>

+ 197 - 0
src/views/productManagement/productSourcePath/importGuideModal.vue

@@ -0,0 +1,197 @@
+<template>
+  <a-modal
+    centered
+    class="importGuide-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="导入费用明细"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="800">
+    <div class="importGuide-con">
+      <div class="explain-con">
+        <div class="explain-item">
+          <div class="explain-tit">
+            <span>1</span>准备导入
+          </div>
+          <ul>
+            <li>1) 请先下载导入模板,模板中已标示出必填项</li>
+            <li>2) “产品编码”该业务单中存在的产品编码</li>
+            <li>3) “唯一码”具有唯一性,必填,需输入正确唯一码,不能为空,不可重复</li>
+            <li>4) 业务单号需是系统中已审核通过的销售单和调拨单</li>
+            <li>5) “工厂出库单号”非必填,可重复,可为空</li>
+            <li>
+              <a :href="filePath" style="margin: 5px 0 0;display: block;">
+                <a-icon type="download" style="padding-right: 5px;" />下载导入模板
+              </a>
+            </li>
+          </ul>
+        </div>
+        <div class="explain-item">
+          <div class="explain-tit">
+            <span>2</span>上传数据文件
+          </div>
+          <p>目前支持的文件类型*.xls,*.xlsx.</p>
+          <div style="overflow: hidden;padding-left: 23px;">
+            <Upload
+              id="importGuide-attachList"
+              ref="importUpload"
+              :maxNums="1"
+              fileType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
+              uploadType="attach"
+              :action="attachAction"
+              :uploadParams="uploadParams"
+              upText="选择导入文件"
+              @remove="resetSearchForm"
+              @change="changeImport"></Upload>
+          </div>
+        </div>
+      </div>
+      <!-- 按钮 -->
+      <div class="btn-con">
+        <a-button
+          type="primary"
+          id="importGuide-nextStep"
+          size="large"
+          class="button-primary"
+          @click="handlerNextStep"
+          style="padding: 0 60px;">下一步</a-button>
+        <a-button
+          id="importGuide-cancel"
+          size="large"
+          class="button-cancel"
+          @click="isShow=false"
+          style="padding: 0 60px;margin-left: 15px;">取消</a-button>
+      </div>
+    </div>
+    <!-- 导入 -->
+    <chooseImportModal :openModal="openImportModal" :paramsData="paramsData" @close="handleClose" @ok="hanldeOk" />
+  </a-modal>
+</template>
+
+<script>
+import ChooseImportModal from './chooseImportModal.vue'
+import { Upload } from '@/components'
+export default {
+  name: 'ImportGuideModal',
+  components: { Upload, ChooseImportModal },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    params: {
+      type: Object,
+      default: null
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      openImportModal: false, //  导入
+      attachAction: process.env.VUE_APP_API_BASE_URL + '/report/tracecode/importParse',
+      paramsData: null,
+      uploadParams: {
+        savePathType: 'local'
+      },
+      exportLoading: false,
+      filePath: location.protocol + '//' + location.host + '/templ/唯一码导入模板.xlsx'
+    }
+  },
+  methods: {
+    // 清空数据
+    resetSearchForm () {
+      this.$refs.importUpload.setFileList() //  清空导入文件
+      this.paramsData = null //  清空上传数据
+    },
+    // 下一步
+    handlerNextStep () {
+      if (this.paramsData) {
+        this.openImportModal = true
+      } else {
+        this.$message.warning('添加文件后再进行下一步操作!')
+      }
+    },
+    // 上传文件  change
+    changeImport (file) {
+      // console.log(file, JSON.parse(file))
+      if (file && JSON.parse(file).length > 0) {
+        this.paramsData = Object.assign({}, JSON.parse(file)[0] || null, this.params)
+      } else {
+        this.paramsData = null
+      }
+    },
+    // 导入
+    hanldeOk (obj) {
+      this.$emit('ok', obj)
+      this.isShow = false
+    },
+    // 关闭
+    handleClose () {
+      this.openImportModal = false
+      this.isShow = false
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.resetSearchForm()
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .importGuide-modal{
+    .importGuide-con{
+      .explain-con{
+        .explain-item{
+          margin-bottom: 10px;
+          .explain-tit{
+            font-weight: bold;
+            span{
+              display: inline-block;
+              width: 18px;
+              height: 18px;
+              line-height: 16px;
+              text-align: center;
+              margin-right: 5px;
+              border-radius: 50%;
+              border: 1px solid rgba(0, 0, 0, 0.3);
+            }
+          }
+          p{
+            margin: 8px 0;
+            padding-left: 23px;
+          }
+          ul{
+            list-style: none;
+            padding: 0;
+            padding-left: 23px;
+            margin: 0;
+            li{
+              line-height: 26px;
+            }
+          }
+        }
+        #importGuide-attachList{
+          width: 100%;
+        }
+      }
+      .btn-con{
+        margin: 10px 0 20px;
+        text-align: center;
+        .button-cancel{
+          font-size: 12px;
+        }
+      }
+    }
+  }
+</style>

+ 369 - 0
src/views/productManagement/productSourcePath/list.vue

@@ -0,0 +1,369 @@
+<template>
+  <div>
+    <a-card size="small" :bordered="false" class="tireSalesReportList-wrap searchBox">
+      <!-- 搜索条件 -->
+      <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="$refs.table.refresh(true)">
+          <a-row :gutter="15">
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="审核时间">
+                <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="业务单号">
+                <a-input
+                  id="productSourceList-bizCode"
+                  v-model.trim="queryParam.bizCode"
+                  allowClear
+                  placeholder="请输入业务单号" />
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="产品编码">
+                <a-input
+                  id="productSourceList-productCode"
+                  v-model.trim="queryParam.productCode"
+                  allowClear
+                  placeholder="请输入产品编码" />
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="唯一码">
+                <a-input
+                  id="productSourceList-traceCode"
+                  v-model.trim="queryParam.traceCode"
+                  allowClear
+                  placeholder="请输入唯一码" />
+              </a-form-item>
+            </a-col>
+            <template v-if="advanced">
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="单据类型">
+                  <a-select @change="handleBizStatus" v-model="queryParam.bizStatus" placeholder="请选择单据类型" allowClear>
+                    <a-select-option value="XS">
+                      销售单
+                    </a-select-option>
+                    <a-select-option value="DB">
+                      调拨单
+                    </a-select-option>
+                  </a-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="产品名称">
+                  <a-input
+                    id="productSourceList-productName"
+                    v-model.trim="queryParam.productName"
+                    allowClear
+                    placeholder="请输入产品名称" />
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="客户名称">
+                  <a-input
+                    id="productSourceList-buyerName"
+                    v-model.trim="queryParam.buyerName"
+                    allowClear
+                    placeholder="请输入客户名称" />
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="质保状态">
+                  <!-- <v-select
+                    v-model="queryParam.dealerLevel"
+                    ref="dealerLevel"
+                    id="productSourceList-dealerLevel"
+                    code="DEALER_LEVEL"
+                    placeholder="请选择质保状态"
+                    allowClear></v-select> -->
+                  <a-select v-model="queryParam.warrantyState" placeholder="请选择质保状态" allowClear>
+                    <a-select-option value="NOTSTART">
+                      未开始
+                    </a-select-option>
+                    <a-select-option value="RUN">
+                      进行中
+                    </a-select-option>
+                    <a-select-option value="END">
+                      已过期
+                    </a-select-option>
+                  </a-select>
+                </a-form-model-item>
+              </a-col>
+            </template>
+            <a-col :md="24" :sm="24" style="text-align: center;">
+              <a-button
+                style="margin-left: 5px"
+                type="primary"
+                @click="$refs.table.refresh(true)"
+                :disabled="disabled"
+                id="productSourceList-refresh">查询</a-button>
+              <a-button
+                style="margin-left: 8px"
+                @click="resetSearchForm"
+                :disabled="disabled"
+                id="productSourceList-reset">重置</a-button>
+              <a-button
+                style="margin-left: 10px"
+                type="primary"
+                class="button-warning"
+                @click="handleExport"
+                :disabled="disabled"
+                :loading="exportLoading"
+                v-if="$hasPermissions('B_productSourceExport')"
+                id="productSourceList-export">导出</a-button>
+              <a @click="advanced=!advanced" style="margin-left: 5px">
+                {{ advanced ? '收起' : '展开' }}
+                <a-icon :type="advanced ? 'up' : 'down'" />
+              </a>
+            </a-col>
+          </a-row>
+        </a-form-model>
+      </div>
+    </a-card>
+    <a-card size="small" :bordered="false">
+      <a-spin :spinning="spinning" tip="Loading...">
+        <!-- 统计 -->
+        <div style="display:flex;align-items:center;margin-bottom:10px;">
+          <a-button
+            type="primary"
+            id="outboundOrder-export"
+            :loading="loading"
+            v-if="$hasPermissions('B_productSourceImport')"
+            @click="openGuideModal = true">导入</a-button>
+          <div class="tongji-bar" style="margin-left:10px;">
+            产品总款数:<strong>{{ totalData&&(totalData.productTypeNum || totalData.productTypeNum==0) ? totalData.productTypeNum : '0' }}</strong>;
+            产品总数量:<strong>{{ totalData&&(totalData.productNum || totalData.productNum==0) ? totalData.productNum : '--' }}</strong>;
+          </div>
+        </div>
+        <!-- 列表 -->
+        <s-table
+          class="sTable fixPagination"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.id"
+          :style="{ height: tableHeight+70+'px' }"
+          :columns="columns"
+          :data="loadData"
+          :scroll="{ y: tableHeight-10 }"
+          :defaultLoadData="false"
+          bordered>
+          <!-- 质保时间 -->
+          <template slot="warrantyTime" slot-scope="text, record">
+            <span v-if="record.warrantyStartDate">
+              {{ record.warrantyStartDate }}{{ record.warrantyEndDate?'至'+record.warrantyEndDate:'' }}
+            </span>
+            <span v-else>--</span>
+          </template>
+          <!-- 操作 -->
+          <template slot="action" slot-scope="text, record">
+            <a-button v-if="$hasPermissions('B_productSourceSeeInfo')&&record.warrantyState!='NOTSTART'" size="small" type="link" class="button-warning" @click="handleInfoModal(record)">质保信息</a-button>
+            <span v-else>--</span>
+          </template>
+        </s-table>
+      </a-spin>
+      <!-- 质保信息-->
+      <warranty-info-modal v-drag :openModal="openInfoModal" :productCode="productCodeInfo" :itemSn="warrantyInfoId" @close="closeWarranty" />
+      <!-- 导入轮胎唯一码 -->
+      <importGuideModal :openModal="openGuideModal" @close="openGuideModal=false" @ok="handleGuideOk" />
+    </a-card>
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import getDate from '@/libs/getDate.js'
+import { STable, VSelect } from '@/components'
+import rangeDate from '@/views/common/rangeDate.vue'
+import warrantyInfoModal from './warrantyInfoModal.vue'
+import importGuideModal from './importGuideModal.vue'
+import { hdExportExcel } from '@/libs/exportExcel'
+import { traceCodeInsertBatch, traceCodeQueryCount, traceCodeList, excelOnlineList } from '@/api/reportData'
+export default {
+  name: 'ProductSourceList',
+  mixins: [commonMixin],
+  components: { STable, VSelect, rangeDate, warrantyInfoModal, importGuideModal },
+  data () {
+    return {
+      loading: false,
+      spinning: false,
+      advanced: true, // 高级搜索 展开/关闭
+      tableHeight: 0,
+      time: [
+        getDate.getThreeMonthDays().starttime,
+        getDate.getCurrMonthDays().endtime
+      ],
+      queryParam: { //  查询条件
+        beginDate: getDate.getThreeMonthDays().starttime,
+        endDate: getDate.getCurrMonthDays().endtime,
+        productCode: '',
+        productName: '',
+        bizCode: undefined,
+        traceCode: undefined,
+        buyerName: undefined,
+        bizStatus: undefined,
+        warrantyState: undefined
+      },
+      openInfoModal: false, // 质保信息弹窗
+      columns: [{ title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '业务单号', dataIndex: 'bizCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '审核时间', dataIndex: 'auditDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '导入时间', dataIndex: 'importDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '唯一码', dataIndex: 'traceCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'buyerName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '质保状态', dataIndex: 'warrantyStateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '质保时间', scopedSlots: { customRender: 'warrantyTime' }, width: '10%', align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '12%', align: 'center' }
+      ],
+      disabled: false, //  查询、重置按钮是否可操作
+      exportLoading: false,
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        const params = Object.assign(parameter, this.queryParam)
+        return traceCodeList(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,
+      openGuideModal: false, // 导入弹窗
+      warrantyInfoId: null,
+      productCodeInfo: null
+    }
+  },
+  watch: {
+    advanced (newValue, oldValue) {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  methods: {
+    // 单据类型操作
+    handleBizStatus (val) {
+      this.queryParam.bizStatus = val
+    },
+    // 导入成功
+    handleGuideOk (resData) {
+      traceCodeInsertBatch(resData).then(res => {
+        if (res.status == 200) {
+          this.resetSearchForm()
+        }
+      })
+    },
+    // 统计
+    getCount (params) {
+      traceCodeQueryCount(params).then(res => {
+        if (res.status == 200 && res.data) {
+          this.totalData = res.data
+        } else {
+          this.totalData = null
+        }
+      })
+    },
+    //  审核时间  change
+    dateChange (date) {
+      if (date[0] && date[1]) {
+        this.queryParam.time = date
+      } else {
+        this.queryParam.time = []
+      }
+      this.queryParam.beginDate = date[0] || ''
+      this.queryParam.endDate = date[1] || ''
+    },
+    // 质保信息
+    handleInfoModal (row) {
+      this.warrantyInfoId = row.warrantyid
+      this.productCodeInfo = row.productCode
+      this.openInfoModal = true
+    },
+    // 关闭质保信息弹窗
+    closeWarranty () {
+      this.warrantyInfoId = null
+      this.productCodeInfo = null
+      this.openInfoModal = false
+    },
+
+    //  重置
+    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.totalData = null
+      this.queryParam.productCode = ''
+      this.queryParam.productName = ''
+      this.queryParam.bizCode = undefined
+      this.queryParam.traceCode = undefined
+      this.queryParam.buyerName = undefined
+      this.queryParam.bizStatus = undefined
+      this.queryParam.warrantyState = undefined
+      this.$refs.table.refresh(true)
+    },
+    //  导出
+    handleExport () {
+      const _this = this
+      const params = _this.queryParam
+      _this.exportLoading = true
+      _this.spinning = true
+      hdExportExcel(excelOnlineList, 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 - 247
+    }
+  },
+  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>

+ 219 - 0
src/views/productManagement/productSourcePath/warrantyInfoModal.vue

@@ -0,0 +1,219 @@
+<template>
+  <a-modal
+    centered
+    class="warrantyInfo-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="质保信息"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="600">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div v-if="detailsData">
+        <div class="infoList">
+          <div class="infoTopList">
+            <div class="uniqueStyle">
+              <div>轮胎名称:</div>
+              <a-tooltip placement="topLeft">
+                <template slot="title">
+                  <span>{{ detailsData.productName || '--' }}</span>
+                </template>
+                <div class="text-overflow">{{ detailsData.productName || '--' }}</div>
+              </a-tooltip>
+            </div>
+            <a-descriptions :column="1">
+              <a-descriptions-item label="产品编码">
+                {{ productCode || '--' }}
+              </a-descriptions-item>
+              <a-descriptions-item label="轮胎唯一码">
+                {{ detailsData.traceCode || '--' }}
+              </a-descriptions-item>
+              <a-descriptions-item label="质保时间" v-if="detailsData.warrantyStartDate">
+                {{ detailsData.warrantyStartDate }}{{ detailsData.warrantyEndDate?'至'+detailsData.warrantyEndDate:'' }}
+              </a-descriptions-item>
+              <a-descriptions-item label="质保时间" v-else>
+                --
+              </a-descriptions-item>
+            </a-descriptions>
+          </div>
+          <div class="imgBox">
+            <img
+              v-if="detailsData.productMsg"
+              style="margin-bottom:6px;object-fit: cover;border:1px dashed #ccc;"
+              :src="detailsData.productMsg"
+              alt="图片走丢啦"
+              width="86"
+              height="55"
+              align="middle"
+              @click="viewLargeImg"/>
+            <div style="text-align:right;">
+              <img
+                v-if="detailsData.state ==='END'"
+                src="@/assets/img/outOfDateImg.png"
+                alt=""
+                width="50"
+                height="50" />
+              <img v-if="detailsData.state ==='RUN'" src="@/assets/img/ongoing.png" alt="" width="50" height="50" />
+            </div>
+          </div>
+        </div>
+        <div class="infoList">
+          <a-descriptions title="门店信息" :column="1">
+            <a-descriptions-item label="门店名称">
+              {{ detailsData.storeName|| '--' }}
+            </a-descriptions-item>
+            <a-descriptions-item label="姓名">
+              {{ detailsData.storeManager ||'--' }}
+            </a-descriptions-item>
+            <a-descriptions-item label="电话">
+              {{ detailsData.storeMobile ||'--' }}
+            </a-descriptions-item>
+            <a-descriptions-item label="汽配经销商">
+              {{ detailsData.dealerName ||'--' }}
+            </a-descriptions-item>
+          </a-descriptions>
+        </div>
+        <div class="infoList">
+          <a-descriptions title="车辆信息" :column="1">
+            <a-descriptions-item label="车辆品牌">
+              {{ detailsData.carBrand ||'--' }}
+            </a-descriptions-item>
+            <a-descriptions-item label="车型">
+              {{ detailsData.carModel ||'--' }}
+            </a-descriptions-item>
+            <a-descriptions-item label="里程数">
+              {{ detailsData.mileage ||'--' }}
+            </a-descriptions-item>
+            <a-descriptions-item label="车牌号">
+              {{ detailsData.vehicleNumber ||'--' }}
+            </a-descriptions-item>
+            <a-descriptions-item label="客户姓名">
+              {{ detailsData.customName ||'--' }}
+            </a-descriptions-item>
+            <a-descriptions-item label="手机号码">
+              {{ detailsData.customMobile ||'--' }}
+            </a-descriptions-item>
+          </a-descriptions>
+        </div>
+      </div>
+      <div class="btn-cont">
+        <a-button id="warrantyInfo-back" @click="isShow = false">关闭</a-button>
+      </div>
+    </a-spin>
+    <!-- 查看图片 -->
+    <a-modal v-model="openImgModal" :title="null" :footer="null" :width="600" centered>
+      <div class="viewImg">
+        <img
+          :src="detailsData.productMsg"
+          alt="图片走丢啦"
+          width="100%"
+          height="100%"
+          align="middle"/>
+      </div>
+    </a-modal>
+  </a-modal>
+</template>
+
+<script>
+import { getWarrantyInfo } from '@/api/reportData'
+export default {
+  name: 'ProductPricingAuditModal',
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    itemSn: {
+      type: String,
+      default: ''
+    },
+    productCode: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      spinning: false,
+      detailsData: null, //  详情数据
+      openImgModal: false
+    }
+  },
+  methods: {
+    //  获取详情
+    getDetail () {
+      getWarrantyInfo({ id: this.itemSn }).then(res => {
+        if (res.status == 200) {
+          this.detailsData = res.data
+        } else {
+          this.detailsData = null
+        }
+      })
+    },
+    // 查看图片
+    viewLargeImg () {
+      this.openImgModal = true
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      } else {
+        this.getDetail()
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .warrantyInfo-modal{
+    .ant-modal-body {
+      padding: 30px 40px 24px;
+    }
+    .infoList {
+      margin-bottom:26px;
+      .uniqueStyle{
+        display:flex;
+        algin-items:center;
+        margin-bottom:5px;
+        div:last-child{
+          width:78%;
+        }
+      }
+      .ant-descriptions-title{
+        margin-bottom:10px !important;
+      }
+      .ant-descriptions-row > th, .ant-descriptions-row > td{
+        padding-bottom: 5px !important;
+      }
+      .infoTopList{
+        max-width:70%;
+        position: relative;
+       .ant-descriptions-row{
+          font-weight: bold;
+        }
+        .ant-descriptions-row .ant-descriptions-item > span{
+          font-weight: bold;
+        }
+      }
+      .imgBox{
+        position:absolute;
+        top:0;
+        left:71%;
+      }
+    }
+
+    .btn-cont {
+      text-align: center;
+      margin: 35px 0 20px;
+    }
+  }
+</style>

+ 85 - 18
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>
     <!-- 选择参与客户 -->
@@ -102,7 +140,7 @@
       width="60%"
     >
       <div class="dealerModalCon">
-        <chooseDealer ref="dealerChoose" pageType="dealerPromotion" @plAdd="handleAddDealer"></chooseDealer>
+        <chooseDealer ref="dealerChoose" @plAdd="handleAddDealer"></chooseDealer>
       </div>
     </a-modal>
     <!-- 导入参与客户 -->
@@ -116,7 +154,7 @@ import { Upload } from '@/components'
 import department from '@/views/expenseManagement/expenseReimbursement/department.js'
 import warehouse from '@/views/common/chooseWarehouse.js'
 import moment from 'moment'
-import chooseDealer from '../promotionManagement/chooseDealer'
+import chooseDealer from './chooseDealer'
 import importDealerModa from './importDealerModa.vue'
 import { dealerPromotionSave, dealerPromotionInfo, dealerPromotionEdit } from '@/api/promotion'
 export default {
@@ -148,8 +186,12 @@ export default {
         description: '', // 活动简称
         content: '', // 活动描述
         attachmentList: '', // 附件
-        dealerSnList: [], // 参与客户
-        dealerScope: 'SOME_DEALER' // 全部客户   部分客户
+        promotionDealerList: [], // 参与客户
+        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: {
@@ -194,7 +239,7 @@ export default {
       this.openDealerModal = true
       const _this = this
       if (_this.chooseDealerList.length == 0) {
-        _this.form.dealerSnList = []
+        _this.form.promotionDealerList = []
       }
       const arr = _this.chooseDealerList.map(item => {
         return item.dealerSn
@@ -214,32 +259,47 @@ export default {
       this.chooseDealerList = list
       this.openDealerModal = false
       // 移除表单必填项
-      this.$refs.ruleForm.clearValidate('dealerSnList')
+      this.$refs.ruleForm.clearValidate('promotionDealerList')
     },
     //  新增/编辑
     handleSave () {
       const _this = this
       if (_this.form.dealerScope === 'SOME_DEALER') {
         if (_this.chooseDealerList && _this.chooseDealerList.length > 0) {
-          const newArr = this.chooseDealerList.map(item => {
-            return item.dealerSn
+          const newArr = _this.chooseDealerList.map(item => {
+            return { dealerSn: item.dealerSn, dealerScope: _this.form.dealerScope }
           })
-          _this.form.dealerSnList = newArr
+          _this.form.promotionDealerList = newArr
         } else {
           _this.$message.error('请选择参与客户')
           return
         }
       } else {
-        this.form.dealerList = []
-        this.form.dealerSnList = []
+        _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 = []
@@ -272,8 +335,12 @@ export default {
         description: '', // 活动简称
         content: '', // 活动描述
         attachmentList: '', // 附件
-        dealerSnList: [], // 参与客户
-        dealerScope: 'SOME_DEALER'
+        promotionDealerList: [], // 参与客户
+        dealerScope: 'SOME_DEALER',
+        minOrderFlag: '0', // 订单起订金额
+        minOrderAmount: undefined,
+        upperLimitFlag: '0', // 活动经费上限
+        upperLimitAmount: undefined
       }
       this.attachList = []
       this.chooseDealerList = []
@@ -288,7 +355,7 @@ export default {
         if (res.status == 200) {
           const data = res.data
           this.chooseDealerList = data.dealerList
-          data.dealerSnList = data.dealerSnList
+          data.promotionDealerList = data.promotionDealerList
           data.activeDate = [data.promotionDateStart, data.promotionDateEnd]
           if (data.attachmentList) {
             this.attachList = data.attachmentList

+ 237 - 0
src/views/promotionRulesManagement/dealerPromotions/chooseDealer.vue

@@ -0,0 +1,237 @@
+<template>
+  <a-spin :spinning="spinning" tip="Loading...">
+    <!-- 搜索条件 -->
+    <div ref="tableSearch" class="table-page-search-wrapper newTableSearchName">
+      <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+        <a-row :gutter="15">
+          <a-col :md="8" :sm="24">
+            <a-form-model-item label="地区">
+              <AreaList id="viewDealers-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
+            </a-form-model-item>
+          </a-col>
+          <a-col :md="8" :sm="24">
+            <a-form-item label="经销商名称/别名">
+              <a-input id="chooseDealer-nameLike" v-model.trim="queryParam.nameLike" allowClear placeholder="请输入经销商名称/别名"/>
+            </a-form-item>
+          </a-col>
+          <a-col :md="8" :sm="24">
+            <a-form-item label="商户类型">
+              <v-select code="DEALER_TYPE" id="chooseDealer-dealerType" v-model="queryParam.dealerType" allowClear placeholder="请选择商户类型"></v-select>
+            </a-form-item>
+          </a-col>
+          <a-col :md="8" :sm="24">
+            <a-form-model-item label="商户级别" prop="dealerLevel">
+              <v-select code="DEALER_LEVEL" id="ucModal-dealerLevel" v-model="queryParam.dealerLevel" allowClear placeholder="请选择商户级别"></v-select>
+            </a-form-model-item>
+          </a-col>
+          <a-col :md="8" :sm="24">
+            <a-form-item label="所在区域/分区">
+              <subarea id="chooseDealer-subarea" ref="subarea" @change="subareaChange"></subarea>
+            </a-form-item>
+          </a-col>
+          <a-col :md="8" :sm="24" style="margin-bottom: 10px;">
+            <a-button type="primary" @click="searchForm(true)" :disabled="disabled" id="chooseDealer-refresh">查询</a-button>
+            <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chooseDealer-reset">重置</a-button>
+          </a-col>
+        </a-row>
+      </a-form>
+      <!-- 列表 -->
+      <div style="margin-bottom: 10px">
+        <a-button type="primary" ghost :loading="loading" @click="handleBatchAudit">批量添加</a-button>
+        <span style="margin-left: 5px">
+          <template v-if="selectCount"> {{ `已选 ${selectCount} 项` }} </template>
+        </span>
+      </div>
+    </div>
+    <a-table
+      style="height: 320px;"
+      :scroll="{ y: 230 }"
+      :bordered="true"
+      :pagination="pagination"
+      :row-key="record => record.dealerSn"
+      :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+      :columns="columns"
+      :data-source="dealerList"
+      @change="handlePage"
+    >
+      <template slot="addressInfo" slot-scope="text, record">
+        {{ record.provinceName }}{{ '-'+ record.cityName }}{{ '-'+ record.districtName }}
+      </template>
+    </a-table>
+  </a-spin>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable, VSelect } from '@/components'
+import AreaList from '@/views/common/areaList.js'
+import subarea from '@/views/common/subarea.js'
+import { queryDealerPage } from '@/api/promotion'
+import { getDealerListInfo } from '@/api/dealer'
+export default {
+  name: 'ChooseDealer',
+  mixins: [commonMixin],
+  components: { STable, VSelect, subarea, AreaList },
+  props: {
+    parentData: {
+      type: Object,
+      default: function () {
+        return null
+      }
+    },
+    promotionSn: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      spinning: false,
+      queryParam: { //  查询条件
+        nameLike: '',
+        dealerType: null,
+        dealerLevel: null,
+        subareaArea: {
+          subareaSn: undefined, //  区域
+          subareaAreaSn: undefined // 分区
+        },
+        auditState: undefined,
+        provinceSn: undefined,
+        citySn: undefined,
+        districtSn: undefined
+      },
+      pagination: {
+        pageSize: 20,
+        showSizeChanger: true,
+        pageSizeOptions: ['20', '50', '100', '200', '500']
+      },
+      pageFlag: false,
+      chooseInfo: [],
+      selectedRowKeys: [],
+      dealerList: [],
+      tableHeight: 0,
+      disabled: false, //  查询、重置按钮是否可操作
+      loading: false, // 批量添加loading,
+      columns: [
+        { title: '地区', scopedSlots: { customRender: 'addressInfo' }, width: '30%', align: 'center', ellipsis: true },
+        { title: '经销商名称', dataIndex: 'dealerName', width: '30%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '商户别名', dataIndex: 'dealerAlias', align: 'left', width: '30%', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '商户类型', dataIndex: 'dealerTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '商户级别', dataIndex: 'dealerLevelDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '所在区域', dataIndex: 'subareaArea.subareaName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '所在分区', dataIndex: 'subareaArea.subareaAreaName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }
+      ]
+    }
+  },
+  computed: {
+    selectCount () {
+      return this.selectedRowKeys && this.selectedRowKeys.length
+    }
+  },
+  methods: {
+    onSelectChange (selectedRowKeys) {
+      this.selectedRowKeys = selectedRowKeys
+    },
+    handlePage (pagination, filters, sorter) {
+      const pager = { ...this.pagination }
+      pager.pageNo = pagination.pageSize != pager.pageSize ? 1 : pagination.current
+      pager.pageSize = pagination.pageSize
+      pager.current = pager.pageNo
+      this.pagination = pager
+      this.loadData()
+    },
+    loadData () {
+      this.spinning = true
+      const params = { pageSize: 20, pageNo: 1, ...this.pagination, promotionSn: this.promotionSn }
+
+      queryDealerPage(Object.assign(params, this.queryParam)).then(res => {
+        let data
+        if (res.status == 200) {
+          data = res.data
+          const pagination = { ...this.pagination }
+          pagination.total = Number(data.count)
+          const no = 0
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+          }
+          this.dealerList = data.list
+          this.pagination = pagination
+          if (this.chooseInfo.length > 0 && !this.pageFlag) {
+            this.pageFlag = true
+            this.selectedRowKeys = this.chooseInfo
+          }
+        }
+        this.spinning = false
+      })
+    },
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
+    areaChange (val) {
+      this.queryParam.provinceSn = val[0] ? val[0] : ''
+      this.queryParam.citySn = val[1] ? val[1] : ''
+      this.queryParam.districtSn = val[2] ? val[2] : ''
+    },
+    searchForm () {
+      this.loadData()
+      this.spinning = false
+    },
+    subareaChange (val) {
+      this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
+      this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam = {
+        nameLike: '',
+        dealerType: null,
+        dealerLevel: null,
+        subareaArea: {
+          subareaSn: undefined, //  区域
+          subareaAreaSn: undefined // 分区
+        },
+        auditState: undefined,
+        provinceSn: undefined,
+        citySn: undefined,
+        districtSn: undefined
+      }
+      this.$refs.subarea.clearData()
+      this.$refs.areaList.clearData()
+      this.pagination.pageNo = 1
+      this.pagination.current = 1
+      this.loadData()
+      this.pageFlag = false
+    },
+    // 批量添加
+    async handleBatchAudit () {
+      const _this = this
+      if (_this.selectedRowKeys && _this.selectedRowKeys.length < 1) {
+        _this.$message.warning('请在列表勾选后再进行批量操作!')
+        return
+      }
+      const dealerInfoList = await getDealerListInfo({ dealerSnList: _this.selectedRowKeys })
+      this.spinning = false
+      this.$emit('plAdd', dealerInfoList.data)
+    },
+    pageInit (data) {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+      this.selectedRowKeys = []
+      this.chooseInfo = data || []
+      this.resetSearchForm()
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 285
+    }
+  },
+  watch: {
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  }
+}
+</script>

+ 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 }}元,不限制配额
+                购买门槛产品满最低金额{{ toThousands(record.gateValue) }}元,不限制配额
+              </span>
+              <span v-else>
+                <span v-if="record.promotionRuleType!='PROMO_PROD'">购买满{{ toThousands(record.gateValue) }}元门槛产品,可使用 {{ toThousands(record.quotaAmount) }}元配额,采购规则中的正价商品</span>
+                <span v-else>购买每满{{ record.gateUnit==='YUAN'? toThousands(record.gateValue):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.regularUnit==='YUAN'?toThousands(item.regularValue):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].regularUnit==='YUAN'?toThousands(record.giveRuleList[0].regularValue):record.giveRuleList[0].regularValue }}{{ record.giveRuleList[0].regularUnit==='YUAN'?'元':'个' }}正价产品,送{{ toThousands(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.regularUnit==='YUAN'?toThousands(item.regularValue):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>各级别价直降;省级直降{{ toThousands(record.provinceValue) }},市级直降{{ toThousands(record.cityValue) }},特约直降{{ toThousands(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'">购买门槛产品满最低金额 {{ toThousands(form.gateValue) }} 元,不限制配额。</span>
+            <span v-if="form.gateType==='FIXED_AMOUNT'&&form.promotionRuleType !='PROMO_PROD'">购买满 {{ toThousands(form.gateValue) }} 元门槛产品,可使用 {{ toThousands(form.quotaAmount) }} 元配额,采购规则中的正价商品(配额算销售额)</span>
+            <span v-if="form.gateType==='FIXED_AMOUNT'&&form.promotionRuleType ==='PROMO_PROD'">购买每满 {{ form.gateUnit==='YUAN'?toThousands(form.gateValue):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.regularUnit==='YUAN'?toThousands(item.regularValue):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].regularUnit==='YUAN'?toThousands(form.giveRuleList[0].regularValue):form.giveRuleList[0].regularValue }}{{ form.giveRuleList[0].regularUnit==='YUAN'?'元':'个' }}正价产品,送{{ toThousands(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.regularUnit==='YUAN'?toThousands(item.regularValue):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 _this.toThousands(text) || '--' } },
+          { title: '市价直降', dataIndex: 'cityValue', width: '33%', align: 'center', customRender: function (text) { return _this.toThousands(text) || '--' } },
+          { title: '特约直降', dataIndex: 'specialValue', width: '33%', align: 'center', customRender: function (text) { return _this.toThousands(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) ? ('-' + _this.toThousands(text)) : '--') } })
+        arr.splice(8, 0, { title: '市价直降金额', dataIndex: 'citySubtract', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? ('-' + _this.toThousands(text)) : '--') } })
+        arr.splice(11, 0, { title: '特约直降金额', dataIndex: 'specialSubtract', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? ('-' + _this.toThousands(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
+          }]
         }
       })
     }

+ 8 - 4
src/views/promotionRulesManagement/dealerPromotions/editActiveEndTime.vue

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

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

@@ -16,8 +16,10 @@
           </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>
               <a :href="filePath" style="margin: 5px 0 0;display: block;">
                 <a-icon type="download" style="padding-right: 5px;" />下载导入模板
@@ -37,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>
@@ -81,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'
     }
@@ -90,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: {
@@ -101,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('添加文件后再进行下一步操作!')
       }
@@ -143,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')
+        }
       }
     }
   }

+ 213 - 31
src/views/promotionRulesManagement/dealerPromotions/list.vue

@@ -5,17 +5,17 @@
       <div ref="tableSearch" class="table-page-search-wrapper">
         <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
           <a-row :gutter="15">
-            <a-col :md="5" :sm="24">
+            <a-col :md="6" :sm="24">
               <a-form-item label="创建时间">
                 <rangeDate ref="rangeDate" @change="dateChange" />
               </a-form-item>
             </a-col>
-            <a-col :md="5" :sm="24">
+            <a-col :md="6" :sm="24">
               <a-form-item label="促销名称/简称">
                 <a-input id="promotionList-queryWord" v-model.trim="queryParam.queryWord" allowClear placeholder="请输入促销名称/简称"/>
               </a-form-item>
             </a-col>
-            <a-col :md="5" :sm="24">
+            <a-col :md="6" :sm="24">
               <a-form-item label="发布状态">
                 <v-select
                   v-model="queryParam.enabledFlag"
@@ -26,7 +26,7 @@
                   allowClear></v-select>
               </a-form-item>
             </a-col>
-            <a-col :md="5" :sm="24">
+            <a-col :md="6" :sm="24">
               <a-form-item label="活动状态">
                 <v-select
                   v-model="queryParam.state"
@@ -38,7 +38,17 @@
                 ></v-select>
               </a-form-item>
             </a-col>
-            <a-col :md="4" :sm="24">
+            <a-col :md="6" :sm="24">
+              <a-form-item label="创建人">
+                <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>
                 <a-button style="margin-left: 5px" @click="resetSearchForm()" :disabled="disabled" id="promotionList-reset">重置</a-button>
@@ -60,8 +70,11 @@
     <a-card size="small" :bordered="false">
       <a-spin :spinning="spinning" tip="Loading...">
         <!-- 操作按钮 -->
-        <div class="table-operator" v-if="$hasPermissions('B_dealerPromotionAdd')">
-          <a-button id="promotionList-add" type="primary" @click="handleAdd">新增</a-button>
+        <div class="table-operator tableBtnSet" >
+          <a-button v-if="$hasPermissions('B_dealerPromotionAdd')" id="promotionList-add" type="primary" @click="handleAdd">新增</a-button>
+          <a-checkbox @change="handleDealerAudit" v-if="$hasPermissions('B_dealerAudit')" :checked="queryParam.dealerAuditFlag &&queryParam.dealerAuditFlag==1">
+            待审核(修改参与客户)
+          </a-checkbox>
         </div>
         <!-- 列表 -->
         <s-table
@@ -86,8 +99,9 @@
           </template>
           <!-- 参与客户 -->
           <template slot="joinCustomers" slot-scope="text, record">
-            <div v-if="record.dealerScope ==='ALL_DEALER'">全部客户</div>
-            <div class="joinCustomer" v-else @click="handleCustomers(record)">共有<span style="color:#39f;vertical-align:top;">{{ record.dealerSnList?record.dealerSnList.length:0 }}</span>个客户</div>
+            <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.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%' }" />
           </template>
           <!-- 发布状态 -->
           <template slot="releaseStatus" slot-scope="text, record">
@@ -126,10 +140,10 @@
             <a-button
               size="small"
               type="link"
-              v-if="$hasPermissions('B_editTime')&&(record.state == 'NOT_START' || record.state=='RUNNING')"
+              v-if="$hasPermissions('B_editTime')&&(record.state == 'NOT_START' || record.state=='RUNNING' ||record.state == 'IS_OVER')"
               @click="handleTime(record)"
               class="button-info"
-              id="promotionList-edit-btn">促销时间变更</a-button>
+              id="promotionList-edit-btn">时间变更</a-button>
             <a-button
               size="small"
               type="link"
@@ -144,12 +158,26 @@
               @click="handleDel(record)"
               class="button-error"
               id="promotionList-del-btn">删除</a-button>
-            <div v-if="record.state == 'IS_OVER'">--</div>
+            <a-button
+              size="small"
+              type="link"
+              v-if="record.state != 'AUDIT_REJECT' &&$hasPermissions('B_dealerPromotionCopy')"
+              @click="handleCopyModal(record)"
+              class="button-info"
+              id="promotionList-edit-btn">复制</a-button>
           </template>
         </s-table>
       </a-spin>
       <!-- 参与客户 -->
-      <lookUp-customers-modal ref="lookUpCustomers" :openModal="openCustomerModal" @close="openCustomerModal = false"></lookUp-customers-modal>
+      <lookUp-customers-modal
+        :itemSn="itemPromotionSn"
+        :showType="itemStatusType"
+        ref="lookUpCustomers"
+        :openModal="openCustomerModal"
+        :chooseDealerList="chooseDealerArr"
+        @submitAudit="editCustomerOk"
+        @handleAudit="auditCustomerOk"
+        @close="closeCustomer"></lookUp-customers-modal>
       <!-- 新增/编辑弹窗-->
       <add-modal v-drag :itemSn="itemSn" :openModal="openModal" @ok="handleOk" @close="openModal=false" />
       <!-- 促销时间变更 -->
@@ -179,10 +207,39 @@
             type="primary"
             id="auditModal-save"
             class="button-primary"
+            :loading="loadingAudit"
             @click="handleAuditModal"
           >审核通过</a-button>
         </div>
       </a-modal>
+      <!-- 复制弹窗 -->
+      <a-modal
+        closable
+        v-model="openCopyModal"
+        :footer="null"
+        width="416px"
+        centered>
+        <div class="copyContent">
+          <p>提示:</p>
+          <p>复制选择的促销活动,将在列表生成一条相同的【待提交】的促销活动,可进行编辑!</p>
+          <p>是否确认生成?</p>
+          <p>附件无法复制,请重新上传</p>
+        </div>
+        <!-- 按钮 -->
+        <div class="copyBtn">
+          <a-button
+            id="copyModal-cancel"
+            class="button-cancel"
+            @click="closeCopyModal"
+            style="margin-right: 15px;">取消</a-button>
+          <a-button
+            type="primary"
+            id="copyModal-save"
+            class="button-primary"
+            @click="handleCopy"
+          >确定</a-button>
+        </div>
+      </a-modal>
     </a-card>
   </div>
 </template>
@@ -191,17 +248,21 @@
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import addModal from './addModal.vue'
-import lookUpCustomersModal from '../promotionManagement/lookUpCustomersModal'
+import lookUpCustomersModal from './lookUpCustomersModal'
 import rangeDate from '@/views/common/rangeDate.vue'
+import creatorList from '@/views/common/creatorList.vue'
 import editActiveEndTime from './editActiveEndTime.vue'
 import supplier from '@/views/common/supplier.js'
 import warehouse from '@/views/common/chooseWarehouse.js'
-import { dealerPromotionList, dealerPromotionDel, modifyEnabledFlag, promotionAudit, promotionIsOver } from '@/api/promotion'
+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 },
+  components: { STable, supplier, VSelect, rangeDate, warehouse, lookUpCustomersModal, addModal, editActiveEndTime, creatorList, custList },
   data () {
+    this.handleAuditModal = debounce(this.handleAuditModal, 800)
     return {
       spinning: false,
       disabled: false, //  查询、重置按钮是否可操作
@@ -216,18 +277,22 @@ export default {
         endDate: undefined,
         queryWord: '',
         enabledFlag: undefined, // 发布状态
-        state: undefined
+        state: undefined,
+        creatorId: undefined,
+        dealerAuditFlag: undefined,
+        dealerSn: undefined
       },
       columns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '促销名称', scopedSlots: { customRender: 'promotionName' }, width: '18%', align: 'left' },
-        { title: '促销简称', dataIndex: 'description', width: '14%', align: 'left', customRender: function (text) { return text || '--' } },
+        { title: '促销名称', scopedSlots: { customRender: 'promotionName' }, width: '16%', align: 'left' },
+        { title: '促销简称', dataIndex: 'description', width: '13%', align: 'left', customRender: function (text) { return text || '--' } },
         { title: '促销时间', scopedSlots: { customRender: 'promotionTime' }, width: '13%', align: 'center' },
-        { title: '参与客户', scopedSlots: { customRender: 'joinCustomers' }, width: '7%', align: 'center', ellipsis: true },
+        { title: '参与客户', scopedSlots: { customRender: 'joinCustomers' }, width: '11%', align: 'center', ellipsis: true },
         { title: '促销描述', dataIndex: 'content', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '活动状态', dataIndex: 'stateDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '发布状态', scopedSlots: { customRender: 'releaseStatus' }, width: '7%', align: 'center', ellipsis: true },
+        { title: '创建人', dataIndex: 'creatorName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '活动状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '发布状态', scopedSlots: { customRender: 'releaseStatus' }, width: '6%', align: 'center', ellipsis: true },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
@@ -249,10 +314,23 @@ export default {
         })
       },
       itemSn: null, // 经销商促销活动SN
-      openAuditModal: false // 审核弹窗
+      openAuditModal: false, // 审核弹窗,
+      openCopyModal: false, // 复制弹窗
+      itemPromotionSn: '',
+      itemStatusType: '',
+      chooseDealerArr: [], // 所选择经销商列表
+      loadingAudit: false
     }
   },
   methods: {
+    // 经销商列表查询
+    custChange (val) {
+      this.queryParam.dealerSn = val.key
+    },
+    // 创建人
+    creatorChange (val) {
+      this.queryParam.creatorId = val.key
+    },
     //  详情
     handleDetail (row) {
       this.$router.push({ name: 'dealerPromotionManagementDetail', query: { sn: row.promotionSn } })
@@ -269,10 +347,20 @@ export default {
     },
     // 参与客户
     handleCustomers (row) {
+      this.itemPromotionSn = row.promotionSn
+      if ((row.state === 'NOT_START' || row.state === 'RUNNING') && row.dealerAuditFlag && (row.dealerAuditFlag == 0 || row.dealerAuditFlag == 2)) {
+        this.itemStatusType = 'isEdit'
+      } else if ((row.state === 'NOT_START' || row.state === 'RUNNING') && row.dealerAuditFlag && row.dealerAuditFlag == 1) {
+        this.itemStatusType = 'isAudit'
+      } else {
+        this.itemStatusType = 'isClose'
+      }
+      this.getDealerSnList({ promotionSn: row.promotionSn })
+    },
+    async getDealerSnList (ajaxData) {
+      const dealerSnArr = await updateDealerSnList(ajaxData)
+      this.chooseDealerArr = dealerSnArr.data
       this.openCustomerModal = true
-      this.$nextTick(() => {
-        this.$refs.lookUpCustomers.pageInit({ dealerSnList: row.dealerSnList })
-      })
     },
     //  基本信息  保存
     handleOk () {
@@ -306,6 +394,13 @@ export default {
     handleSetRules (row) {
       this.$router.push({ name: 'dealerPromotionManagementRule', query: { type: 'rule', sn: row.promotionSn } })
     },
+    // 审核参与客户
+    handleDealerAudit (val) {
+      this.queryParam.dealerAuditFlag = val.target.checked ? '1' : undefined
+      this.$nextTick(() => {
+        this.$refs.table.refresh(true)
+      })
+    },
     // 审核
     handleCheck (row) {
       const _this = this
@@ -313,6 +408,7 @@ export default {
       _this.openAuditModal = true
     },
     handleAuditModal () {
+      this.loadingAudit = true
       this.handleAudit({ promotionSn: this.itemSn, auditFlag: 1 })
     },
     closeAuditModal () {
@@ -329,8 +425,33 @@ export default {
         _this.itemSn = null
         _this.openAuditModal = false
         _this.spinning = false
+        _this.loadingAudit = false
+      })
+    },
+    // 复制
+    handleCopyModal (row) {
+      this.itemSn = row.promotionSn
+      this.$nextTick(() => {
+        this.openCopyModal = true
+      })
+    },
+    handleCopy () {
+      const _this = this
+      _this.spinning = true
+      handleCopyData({ promotionSn: this.itemSn }).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.$refs.table.refresh()
+        }
+        _this.itemSn = null
+        _this.openCopyModal = false
+        _this.spinning = false
       })
     },
+    closeCopyModal () {
+      this.itemSn = null
+      this.openCopyModal = false
+    },
     // 促销时间变更
     handleTime (row) {
       this.editEndModal = true
@@ -389,18 +510,55 @@ export default {
         }
       })
     },
+    // 修改参与客户   参与客户提交审核
+    editCustomerOk () {
+      const _this = this
+      midwaySubmit({ promotionSn: _this.itemPromotionSn }).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.$refs.table.refresh()
+        }
+      })
+    },
+    auditCustomerOk (con) {
+      const _this = this
+      dealerMidwayAudit({ promotionSn: _this.itemPromotionSn, dealerAuditStatus: con }).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.$refs.table.refresh()
+        }
+      })
+    },
+    closeCustomer () {
+      this.openCustomerModal = false
+      this.itemPromotionSn = ''
+      this.chooseDealerArr = []
+    },
     //  重置
     resetSearchForm () {
+      // 获取创建人默认值
+      const creatorObj = this.$store.state.user.info
+      const newObj = {
+        key: creatorObj.userid,
+        name: creatorObj.userNameCN,
+        label: creatorObj.userNameCN
+      }
+      this.$refs.creatorList.setDefaultVal(newObj)
       this.queryParam = {
         beginDate: undefined,
         endDate: undefined,
         queryWord: '',
         enabledFlag: undefined, // 发布状态
-        state: undefined
+        state: undefined,
+        creatorId: creatorObj.userid,
+        dealerAuditFlag: undefined,
+        dealerSn: undefined
       }
+      this.$refs.custList.resetForm()
       this.$refs.rangeDate.resetDate()
       this.$refs.table.refresh(true)
     },
+
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调
@@ -409,12 +567,11 @@ export default {
       this.openModal = false
       this.openDetailModal = false
       this.itemSn = null
-      this.rowSelectionInfo = null
       this.$refs.table.clearTable()
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 240
+      this.tableHeight = window.innerHeight - tableSearchH - 235
     }
   },
   watch: {
@@ -450,8 +607,33 @@ export default {
     .nameBox{
      padding:0 5px;
     }
-    .joinCustomer{
-      cursor:pointer;
+  }
+  .joinCustomer{
+    cursor:pointer;
+  }
+  .copyContent{
+    margin:30px 10px 20px;
+    p{
+      margin-bottom:6px !important;
+      font-size:14px;
+    }
+    p:last-child{
+        font-size:12px;
+        color:#666;
+        text-align:right;
+    }
+  }
+  .copyBtn{
+    text-align:center;
+    button{
+      width: 45%;
+      height:40px;
+      line-height:40px;
     }
   }
+  .tableBtnSet{
+   display: flex;
+   align-items: center;
+   justify-content: space-between;
+  }
 </style>

+ 326 - 0
src/views/promotionRulesManagement/dealerPromotions/lookUpCustomersModal.vue

@@ -0,0 +1,326 @@
+<template>
+  <a-modal
+    centered
+    class="lookUpCustomers-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="参与客户"
+    v-model="isShow"
+    @cancel="isShow = false"
+    width="60%">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-card size="small" :bordered="false">
+        <!-- 筛选条件 -->
+        <div class="table-page-search-wrapper">
+          <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+            <a-row :gutter="15">
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="地区">
+                  <AreaList id="actualSalesReportList-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="区域/分区">
+                  <subarea ref="subarea" id="salesManagementList-subarea" @change="subareaChange"></subarea>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="经销商名称">
+                  <a-input id="salesManagementList-purchaseBillNo" v-model="queryParam.dealerName" placeholder="请输入经销商名称" allowClear/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+                <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="inventoryCheckMakeInventoryList-refresh">查询</a-button>
+                <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="inventoryCheckMakeInventoryList-reset">重置</a-button>
+                <a-button
+                  style="margin-left: 10px"
+                  type="primary"
+                  class="button-warning"
+                  @click="handleExport"
+                  :disabled="disabled"
+                  :loading="exportLoading"
+                >导出</a-button>
+              </a-col>
+            </a-row>
+          </a-form>
+        </div>
+        <!-- 列表 -->
+        <s-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.dealerSn"
+          rowKeyName="dealerSn"
+          :columns="columns"
+          :data="loadData"
+          :defaultLoadData="false"
+          :scroll="{ y: 450 }"
+          :rowClassName="(record, index) => record.dataActType ==='CREATE'? 'fontRed':record.dataActType ==='DELETE'?'fontGreen':''"
+          bordered>
+          <!-- 地区 -->
+          <template slot="address" slot-scope="text, record">
+            {{ record.provinceName }}/{{ record.cityName }}/{{ record.districtName }}
+          </template>
+        </s-table>
+      </a-card>
+      <div style="text-align:right;color:#666;" v-if="showType ==='isEdit' || showType === 'isAudit'"><span v-if="showType === 'isAudit'">待审核,</span>增加的客户显示红色,删除的客户显示绿色</div>
+      <div class="btn-cont" v-if="showType ==='isEdit'">
+        <a-button type="primary" class="button-warning" @click="editDealerModal">修改</a-button>
+        <a-button type="primary" style="margin-left: 15px;" :loading="spinning" id="promotion-modal-save" @click="submitAudit">提交审核</a-button>
+      </div>
+      <div class="btn-cont" v-if="showType === 'isAudit'&& $hasPermissions('B_dealerAudit')">
+        <a-button @click="handleAudit('AUDIT_REJECT')">审核不通过</a-button>
+        <a-button type="primary" style="margin-left: 15px;" :loading="spinning" id="promotion-modal-save" @click="handleAudit('AUDIT_PASS')">审核通过</a-button>
+      </div>
+      <div class="btn-cont" v-if="showType === 'isAudit' && !$hasPermissions('B_dealerAudit')">
+        <a-button id="lookUpCustomers-modal-back" @click="isShow = false">关闭</a-button>
+      </div>
+      <div class="btn-cont" v-if="showType === 'isClose'">
+        <a-button id="lookUpCustomers-modal-back" @click="isShow = false">关闭</a-button>
+      </div>
+    </a-spin>
+    <!-- 选择参与客户 -->
+    <a-modal
+      title="选择经销商"
+      :visible="openDealerModal"
+      :footer="null"
+      centered
+      class="lookUpCustomers-modal"
+      @cancel="openDealerModal = false"
+      width="60%"
+    >
+      <div class="dealerModalCon">
+        <chooseDealer ref="dealerChoose" :promotionSn="itemSn" @plAdd="handleAddDealer"></chooseDealer>
+      </div>
+    </a-modal>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable } from '@/components'
+import subarea from '@/views/common/subarea.js'
+import AreaList from '@/views/common/areaList.js'
+import { hdExportExcel } from '@/libs/exportExcel'
+import { dealerExport } from '@/api/promoTerminal'
+import { queryAuditPageList, dealerMidwayUpdate } from '@/api/promotion'
+import chooseDealer from './chooseDealer'
+
+export default {
+  name: 'LookUpCustomersModal',
+  components: { STable, subarea, AreaList, chooseDealer },
+  mixins: [commonMixin],
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    itemSn: {// 促销sn
+      type: String,
+      default: ''
+    },
+    showType: {
+      type: String,
+      default: ''
+    },
+    chooseDealerList: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    }
+  },
+  data () {
+    return {
+      spinning: false,
+      isShow: this.openModal, //  是否打开弹框
+      disabled: false,
+      exportLoading: false,
+      queryParam: {
+        subareaArea: {
+          subareaSn: undefined,
+          subareaAreaSn: undefined
+        },
+        provinceSn: undefined,
+        citySn: undefined,
+        districtSn: undefined,
+        dealerName: ''
+      },
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        this.queryParam.promotionSn = this.itemSn
+        const params = Object.assign(parameter, this.queryParam)
+        return queryAuditPageList(params).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            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
+        })
+      },
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '8%', align: 'center' },
+        { title: '地区', scopedSlots: { customRender: 'address' }, width: '20%', align: 'center', ellipsis: true },
+        { title: '区域', dataIndex: 'subareaArea.subareaName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '经销商名称', dataIndex: 'dealerName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '商户类型', dataIndex: 'dealerLevelDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '商户级别', dataIndex: 'dealerTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      openDealerModal: false, // 修改弹窗
+      updateFlag: false
+    }
+  },
+  methods: {
+    // 修改参与客户
+    editDealerModal () {
+      const _this = this
+      _this.openDealerModal = true
+      const arr = _this.chooseDealerList
+      // 选择参与客户回显
+      _this.$nextTick(() => {
+        _this.$refs.dealerChoose.pageInit(arr)
+      })
+    },
+    // 添加经销商
+    handleAddDealer (list) {
+      const newArr = []
+      const dealerSnArr = []
+      list.forEach(item => {
+        const obj = {
+          dealerScope: this.itemSn ? 'SOME_DEALER' : 'ALL_DEALER',
+          dealerSn: item.dealerSn
+        }
+        newArr.push(obj)
+        dealerSnArr.push(item.dealerSn)
+      })
+      this.openDealerModal = false
+      this.chooseDealerList = dealerSnArr
+      this.updateDataList(newArr)
+    },
+    // 更新列表显示状态
+    updateDataList (list) {
+      const ajaxData = {
+        promotionSn: this.itemSn ? this.itemSn : undefined,
+        promotionDealerList: list
+      }
+      dealerMidwayUpdate(ajaxData).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.$refs.table.refresh()
+        }
+      })
+    },
+    areaChange (val) {
+      this.queryParam.provinceSn = val[0] ? val[0] : ''
+      this.queryParam.citySn = val[1] ? val[1] : ''
+      this.queryParam.districtSn = val[2] ? val[2] : ''
+    },
+    subareaChange (val) {
+      this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
+      this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam = Object.assign({
+        provinceSn: undefined,
+        citySn: undefined,
+        districtSn: undefined,
+        subareaArea: {
+          subareaSn: undefined,
+          subareaAreaSn: undefined
+        },
+        dealerName: ''
+      }, this.snObj)
+      this.updateFlag = false
+      this.$refs.areaList.clearData()
+      this.$refs.subarea.clearData()
+      this.$refs.table.refresh(true)
+    },
+    //  导出
+    handleExport () {
+      const _this = this
+      _this.exportLoading = true
+      _this.spinning = true
+      _this.queryParam.dealerSnList = this.chooseDealerList
+      const paramsData = _this.queryParam
+      hdExportExcel(dealerExport, paramsData, '促销经销商列表导出', function () {
+        _this.exportLoading = false
+        _this.spinning = false
+        _this.showExport = true
+      })
+    },
+    // 提交审核
+    submitAudit () {
+      this.$emit('submitAudit')
+      this.isShow = false
+    },
+    handleAudit (statusInfo) {
+      this.$emit('handleAudit', statusInfo)
+      this.isShow = false
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      } else {
+        this.$nextTick(() => {
+          this.resetSearchForm()
+        })
+      }
+    }
+  }
+}
+</script>
+<style lang="less" scoped>
+  .lookUpCustomers-modal{
+    .ant-modal-body{
+      padding: 0 24px 24px;
+    }
+    .redBg-row{
+      background-color: #f5cdc8;
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 5px 0 10px;
+    }
+    .table-page-search-wrapper{
+      margin-bottom:6px;
+      /deep/.ant-select-selection{
+        border:0 !important;
+        box-shadow: none !important;
+      }
+      .ant-form.ant-form-inline .ant-form-item{
+        border:1px solid #dadada;
+        border-radius: 3px;
+        overflow: hidden;
+        margin-bottom: 10px!important;
+        /deep/.ant-form-item-label{
+          padding-left: 11px !important;
+          padding-right: 0!important;
+        }
+      }
+    }
+   /deep/.fontRed{
+     color:red;
+   }
+   /deep/.fontGreen{
+     color:green;
+   }
+  }
+
+</style>

+ 278 - 183
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,78 +234,101 @@ 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
     },
     hanldeOk (arr) {
-      const resultArr = []
-      arr.forEach(item => {
-        const obj = {
-          productCode: item.productCode,
-          productSn: item.product.productSn
-        }
-        resultArr.push(obj)
-      })
       const name = this.chooseVal == 'a' ? 'cill' : this.chooseVal == 'b' ? 'normalPrice' : 'offer'
-      this.$refs[name + 'Product'].importRow(resultArr)
+      this.$refs[name + 'Product'].importRow(arr)
     },
     // 计算百分比
     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
     },
     //  保存
@@ -309,7 +342,7 @@ export default {
               _this.$message.warning('请选择规则门槛设置类型!')
               return
             }
-            if (!_this.form.gateAmount) {
+            if (!_this.form.gateValue) {
               _this.$message.warning('规则门槛条件不能为空!')
               return
             }
@@ -317,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
@@ -361,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
@@ -377,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 = []
           }
@@ -395,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.toFixed(2) + '元,不限制配额'
+            } else {
+              form.gateInfo = '购买满' + form.gateValue.toFixed(2) + '元门槛产品,可使用' + form.quotaAmount.toFixed(2) + '元配额,采购规则中的正价商品(配额算销售额)'
+            }
+          }
+          var newInfo = ''
+          if (form.giveRuleType == 'SUM_MONEY') {
+            newInfo = `<span>金额叠加;购买满${form.regularUnit == 'YUAN' ? (_this.fullGiftRuleList[0].regularValue).toFixed(2) : _this.fullGiftRuleList[0].regularValue}${form.regularUnit == 'YUAN' ? '元' : '个'}正价产品,送${(_this.fullGiftRuleList[0].promotionValue).toFixed(2)}元</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) + '、' : ''}购买满${form.regularUnit == 'YUAN' ? item.regularValue.toFixed(2) : item.regularValue}${form.regularUnit == 'YUAN' ? '元' : '个'}正价产品,送正价产品总金额的${item.promotionValue.toFixed(2)}%为促销品采购额</div>`
+            })
+          }
+          form.ruleInfo = newInfo
           _this.spinning = true
           promotionSave(form).then(res => {
             if (res.status == 200) {
@@ -445,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 () {
@@ -477,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()
         }
       })
     },
@@ -552,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: {
@@ -565,6 +656,8 @@ export default {
         this.$emit('close')
         this.resetSearchForm()
       } else {
+        // 获取起订类型数据字典
+        this.getUnitTypeList()
         if (this.itemSn) {
           this.getDetail()
         } else {
@@ -583,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;
     }
@@ -603,5 +696,7 @@ export default {
       justify-content:space-between;
     }
   }
-
+  /deep/.ve-table{
+    border-radius:5px;
+  }
 </style>

+ 305 - 201
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,37 +316,43 @@ export default {
       this.openGuideModal = false
     },
     hanldeOk (arr) {
-      const resultArr = []
-      arr.forEach(item => {
-        const obj = {
-          productCode: item.productCode,
-          productSn: item.product.productSn
+      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)
         }
-        resultArr.push(obj)
-      })
-      const name = this.chooseVal == 'a' ? 'cill' : this.chooseVal == 'b' ? 'normalPrice' : 'offer'
-      this.$refs[name + 'Product'].importRow(resultArr)
+      }
     },
     // 限制正价产品款数
     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
     },
     //  保存
@@ -336,7 +366,7 @@ export default {
               _this.$message.warning('请选择规则门槛设置类型!')
               return
             }
-            if (!_this.form.gateAmount) {
+            if (!_this.form.gateValue) {
               _this.$message.warning('规则门槛条件不能为空!')
               return
             }
@@ -344,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
           }
@@ -353,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
@@ -390,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) {
@@ -406,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.toFixed(2) + '元,不限制配额'
+            } else {
+              form.gateInfo = '购买满' + form.gateValue.toFixed(2) + '元门槛产品,可使用' + form.quotaAmount.toFixed(2) + '元配额,采购规则中的正价商品(配额算销售额)'
+            }
+          }
+          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' ? '同款' : '不同款'}产品购买满${form.regularUnit == 'YUAN' ? item.regularValue.toFixed(2) : 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)
@@ -432,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 {
@@ -467,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
         }
       })
     },
@@ -547,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) {
@@ -579,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: {
@@ -592,6 +691,8 @@ export default {
         this.$emit('close')
         this.resetSearchForm()
       } else {
+        // 获取起订类型数据字典
+        this.getUnitTypeList()
         if (this.itemSn) {
           this.getDetail()
         } else {
@@ -610,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;
     }
@@ -633,5 +734,8 @@ export default {
       background-color: #ed1c24 !important;
     }
   }
+  /deep/.ve-table{
+    border-radius:5px;
+  }
 
 </style>

+ 312 - 117
src/views/promotionRulesManagement/dealerPromotions/specialOfferModal.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="handleChange">
-            <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="handleChange">
+              <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,70 +43,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 +196,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 +213,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 +222,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 +254,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 +335,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 +350,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 +364,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 +390,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 +416,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 +427,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).toFixed(2) + '元,不限制配额'
+            } else {
+              form.gateInfo = '购买每满' + (form.gateUnit == 'YUAN' ? (form.gateValue).toFixed(2) : 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.toFixed(2) + ',市级直降' + form.cityValue.toFixed(2) + ',特约直降' + form.specialValue.toFixed(2)
+          }
           _this.spinning = true
           promotionSave(form).then(res => {
             if (res.status == 200) {
@@ -379,23 +517,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 +546,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 +592,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) {
@@ -482,29 +628,47 @@ export default {
       // 门槛产品导入
       const resultArr = []
       if (this.chooseVal == 'a') {
-        arr.forEach(item => {
-          const obj = {
-            productCode: item.productCode,
-            productSn: item.product.productSn
-          }
-          resultArr.push(obj)
-        })
         const name = this.chooseVal == 'a' ? 'cill' : this.chooseVal == 'b' ? 'normalPrice' : 'offer'
-        this.$refs[name + 'Product'].importRow(resultArr)
+        this.$refs[name + 'Product'].importRow(arr)
       } else {
         // 特价产品导入
         const dataList = this.setShowData('This')
         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) {
@@ -568,15 +732,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: [],
@@ -592,8 +767,8 @@ export default {
             provinceDiscountPrice: item.provinceDiscountPriceText,
             cityDiscountPrice: item.cityDiscountPriceText,
             specialDiscountPrice: item.specialDiscountPriceText,
-            unitType: 'SL',
-            unitQty: 1,
+            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
@@ -625,6 +800,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: {
@@ -638,6 +825,8 @@ export default {
         this.$emit('close')
         this.resetSearchForm()
       } else {
+        // 获取起订类型数据字典
+        this.getUnitTypeList()
         if (this.itemSn) {
           this.getDetail()
         } else {
@@ -648,15 +837,18 @@ 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;
       max-height: 745px !important;
       overflow-y: scroll !important;
     }
-    .ant-radio-button-wrapper{
+   .fixWidthBox .ant-radio-button-wrapper{
       width:80px;
       text-align: center;
     }
@@ -668,7 +860,7 @@ export default {
     }
     .btn-cont {
       text-align: center;
-      margin: 35px 0 10px;
+      margin: 20px 0 10px;
     }
     .flex{
       display:flex;
@@ -676,5 +868,8 @@ export default {
       justify-content:space-between;
     }
   }
+  /deep/.ve-table{
+    border-radius:5px;
+  }
 
 </style>

+ 47 - 36
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,11 +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,
@@ -204,50 +213,52 @@ 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) {
       const _this = this
       const dataList = _this.setShowData('This')
       dataList.forEach(item => {
-        const pos = list.indexOf(con => con.productSn == item.goodsSn)
+        const pos = list.indexOf(con => item.product.productSn == item.goodsSn)
         list.splice(pos, 1)
       })
       if (list.length > 0) {
-        _this.spinning = true
-        getNewScopeSn({}).then(res => {
-          if (res.status == 200) {
-            const newData = {
-              productScopeSn: res.data,
-              productThisList: list,
-              unitType: 'SL',
-              unitQty: 1
-            }
-            _this.dataSource.push(newData)
-          } else {
-            _this.spinning = false
+        list.forEach(con => {
+          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 - 608
src/views/promotionRulesManagement/dealerPromotions/tableType2.vue

@@ -1,608 +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 => con.productSn == item.goodsSn)
-        list.splice(pos, 1)
-      })
-      if (list.length > 0) {
-        getNewScopeSn({}).then(res => {
-          if (res.status == 200) {
-            const newData = {
-              productScopeSn: res.data,
-              productThisList: list
-            }
-            _this.dataSource.push(newData)
-          } else {
-            _this.spinning = false
-          }
-        })
-      } 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

+ 2 - 3
src/views/promotionRulesManagement/promotionManagement/chooseDealer.vue

@@ -114,7 +114,7 @@ export default {
       pagination: {
         pageSize: 20,
         showSizeChanger: true,
-        pageSizeOptions: ['20','50','100','200','500']
+        pageSizeOptions: ['20', '50', '100', '200', '500']
       },
       pageFlag: false,
       chooseInfo: [],
@@ -158,7 +158,6 @@ export default {
     },
     loadData () {
       this.spinning = true
-      console.log(this.pagination)
       const params = { pageSize: 20, pageNo: 1, ...this.pagination }
       dealerQueryList(Object.assign(params, this.queryParam)).then(res => {
         let data
@@ -220,7 +219,7 @@ export default {
       } else {
         this.$refs.areaList.clearData()
       }
-      
+
       this.pagination.pageNo = 1
       this.pagination.current = 1
       this.loadData()

+ 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) : '--')
         }

+ 3 - 3
src/views/reportData/regionTypeSalesReport/list.vue

@@ -17,7 +17,7 @@
             @keyup.enter.native="handleSearch">
             <a-row :gutter="15">
               <a-col :md="6" :sm="24">
-                <a-form-model-item label="销售审核时间" prop="time">
+                <a-form-model-item label="时间" prop="time">
                   <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange"/>
                 </a-form-model-item>
               </a-col>
@@ -127,7 +127,7 @@ export default {
       exportLoading: false,
       tableHeight: 0,
       rules: {
-        'time': [{ required: true, message: '请选择销售审核时间', trigger: 'change' }],
+        'time': [{ required: true, message: '请选择时间', trigger: 'change' }],
         'salesStatusType': [{ required: true, message: '请选择销售状态', trigger: 'change' }]
       },
       // 加载数据方法 必须为 Promise 对象
@@ -177,7 +177,7 @@ export default {
         if (valid) {
           _this.$refs.table.refresh(true)
         } else {
-          _this.$message.error('请选择销售审核时间和销售状态')
+          _this.$message.error('请选择时间和销售状态')
           return false
         }
       })

+ 8 - 2
src/views/reportData/salesReturnDetailReport/list.vue

@@ -159,9 +159,9 @@
               <a-col :md="4" :sm="24">良品数量:{{ (totalData && (totalData.goodQty || totalData.goodQty==0)) ? totalData.goodQty : '--' }}</a-col>
               <a-col :md="4" :sm="24">返库数量:{{ (totalData && (totalData.totalBackStockQty || totalData.totalBackStockQty==0)) ? totalData.totalBackStockQty : '--' }}</a-col>
               <a-col :md="4" :sm="24">正常退货数量:{{ (totalData && (totalData.totalNormalQty || totalData.totalNormalQty==0)) ? totalData.totalNormalQty : '--' }}</a-col>
-              <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesReturnDetailReportList_salesPrice')">成本金额:{{ (totalData && (totalData.totalCost || totalData.totalCost==0)) ? toThousands(totalData.totalCost) : '--' }}</a-col>
+              <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesReturnDetailReportList_costPrice')">成本金额:{{ (totalData && (totalData.totalCost || totalData.totalCost==0)) ? toThousands(totalData.totalCost) : '--' }}</a-col>
               <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesReturnDetailReportList_salesPrice')">正常退货金额:{{ (totalData && (totalData.totalNormalPrice || totalData.totalNormalPrice==0)) ? toThousands(totalData.totalNormalPrice) : '--' }}</a-col>
-              <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesReturnDetailReportList_salesPrice')">正常再入库金额:{{ (totalData && (totalData.totalNormalCost || totalData.totalNormalCost==0)) ? toThousands(totalData.totalNormalCost) : '--' }}</a-col>
+              <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesReturnDetailReportList_costPrice')">正常再入库金额:{{ (totalData && (totalData.totalNormalCost || totalData.totalNormalCost==0)) ? toThousands(totalData.totalNormalCost) : '--' }}</a-col>
               <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesReturnDetailReportList_salesPrice')">正常退货入库差额:{{ (totalData && (totalData.totalNormalBalance || totalData.totalNormalBalance==0)) ? toThousands(totalData.totalNormalBalance) : '--' }}</a-col>
             </a-row>
           </template>
@@ -313,12 +313,18 @@ export default {
       if (this.$hasPermissions('M_salesReturnDetailReportList_salesPrice')) {
         arr.push({ title: '直接差价', dataIndex: 'directRebateAmount', width: 80, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
         arr.push({ title: '间接差价', dataIndex: 'indirectRebateAmount', width: 80, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      }
+      if (this.$hasPermissions('M_salesReturnDetailReportList_costPrice')) {
         arr.push({ title: '再入库单价', dataIndex: 'cost', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
       }
       arr.push({ title: '正常退货数量', dataIndex: 'normalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
       if (this.$hasPermissions('M_salesReturnDetailReportList_salesPrice')) { //  价权限
         arr.push({ title: '正常退货金额', dataIndex: 'totalNormalPrice', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      }
+      if (this.$hasPermissions('M_salesReturnDetailReportList_costPrice')) {
         arr.push({ title: '正常再入库金额', dataIndex: 'totalNormalCost', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      }
+      if (this.$hasPermissions('M_salesReturnDetailReportList_salesPrice')) { //  价权限
         arr.push({ title: '正常退货入库差额', dataIndex: 'totalNormalBalance', width: 110, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
       }
       return arr

+ 330 - 0
src/views/reportData/tireSalesReport/list.vue

@@ -0,0 +1,330 @@
+<template>
+  <div>
+    <a-card size="small" :bordered="false" class="tireSalesDealerList-wrap searchBoxNormal">
+      <!-- 搜索条件 -->
+      <div class="table-page-search-wrapper" ref="tableSearch">
+        <a-form-model
+          id="tireSalesDealerList-form"
+          ref="ruleForm"
+          class="form-model-con"
+          layout="inline"
+          :model="queryParam">
+          <a-row :gutter="15">
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="出库时间">
+                <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="地区">
+                <AreaList id="tireSalesDealerList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="区域/分区">
+                <subarea id="tireSalesDealerList-subarea" ref="subarea" @change="subareaChange"></subarea>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="客户名称">
+                <dealerSubareaScopeList ref="dealerSubareaScopeList" id="tireSalesDealerList-dealerName" @change="custChange" />
+              </a-form-model-item>
+            </a-col>
+            <template v-if="advanced">
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="客户级别">
+                  <v-select
+                    v-model="queryParam.dealerLevel"
+                    ref="dealerLevel"
+                    id="tireSalesDealerList-dealerLevel"
+                    code="DEALER_LEVEL"
+                    placeholder="请选择客户级别"
+                    allowClear></v-select>
+                </a-form-model-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-form-model-item label="产品编码/原厂编码">
+                  <a-input id="tireSalesDealerList-productWord" v-model.trim="queryParam.productWord" allowClear placeholder="请输入产品编码/原厂编码"/>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="产品名称">
+                  <a-input id="tireSalesDealerList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
+                </a-form-model-item>
+              </a-col>
+            </template>
+            <a-col :md="24" :sm="24" style="text-align:center;margin-bottom:10px;">
+              <a-button
+                style="margin-left: 5px"
+                type="primary"
+                @click="$refs.table.refresh(true)"
+                :disabled="disabled"
+                id="tireSalesDealerList-refresh">查询</a-button>
+              <a-button
+                style="margin-left: 8px"
+                @click="resetSearchForm"
+                :disabled="disabled"
+                id="tireSalesDealerList-reset">重置</a-button>
+              <a-button
+                style="margin-left: 10px"
+                type="primary"
+                class="button-warning"
+                @click="handleExport"
+                :disabled="disabled"
+                :loading="exportLoading"
+                v-if="$hasPermissions('B_tireSalesReportExport')"
+                id="tireSalesDealerList-export">导出</a-button>
+              <a @click="advanced=!advanced" style="margin-left: 5px">
+                {{ advanced ? '收起' : '展开' }}
+                <a-icon :type="advanced ? 'up' : 'down'" />
+              </a>
+            </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.no"
+          :style="{ height: tableHeight+70+'px' }"
+          rowKeyName="no"
+          :columns="columns"
+          :data="loadData"
+          :scroll="{ y: tableHeight-30 }"
+          :defaultLoadData="false"
+          bordered>
+          <template slot="addressInfo" slot-scope="text, record">
+            {{ record.provinceName }}{{ '/'+record.cityName }}{{ '/'+record.districtName }}
+          </template>
+          <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" v-if="$hasPermissions('M_tireSalesReportList_salesPrice')">订货金额:{{ (totalData && (totalData.totalbuyPriceAmount || totalData.totalbuyPriceAmount==0)) ? toThousands(totalData.totalbuyPriceAmount): '--' }}</a-col>
+              <a-col :md="4" :sm="24">客户现有库存数量:{{ (totalData && (totalData.totalstoreAmount || totalData.totalstoreAmount==0)) ?totalData.totalstoreAmount: '--' }}</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>
+    <!-- 导出提示框 -->
+    <reportModal :visible="showExport" @close="showExport=false"></reportModal>
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import getDate from '@/libs/getDate.js'
+import { STable, VSelect } from '@/components'
+import rangeDate from '@/views/common/rangeDate.vue'
+import subarea from '@/views/common/subarea.js'
+import AreaList from '@/views/common/areaList.js'
+import BizUser from '@/views/common/bizUser.js'
+import reportModal from '@/views/common/reportModal.vue'
+import { hdExportExcel } from '@/libs/exportExcel'
+import { queryTireList, queryTireCount, excelTireOnlineExport } from '@/api/reportData'
+import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
+export default {
+  name: 'TireSalesDealerList',
+  mixins: [commonMixin],
+  components: { STable, VSelect, rangeDate, subarea, AreaList, BizUser, dealerSubareaScopeList, reportModal },
+  data () {
+    return {
+      spinning: false,
+      advanced: true, // 高级搜索 展开/关闭
+      tableHeight: 0,
+      time: [
+        getDate.getThreeMonthDays().starttime,
+        getDate.getCurrMonthDays().endtime
+      ],
+      queryParam: { //  查询条件
+        beginDate: getDate.getThreeMonthDays().starttime,
+        endDate: getDate.getCurrMonthDays().endtime,
+        provinceSn: undefined,
+        citySn: undefined,
+        districtSn: undefined,
+        dealerName: '',
+        dealerSn: '',
+        subareaSn: undefined,
+        subareaAreaSn: undefined,
+        bizUserSn: undefined,
+        productWord: '', // 产品编码/原厂编码
+        productName: '', // 产品名称
+        dealerLevel: undefined
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      exportLoading: false,
+      showExport: false,
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        const params = Object.assign(parameter, this.queryParam)
+        return queryTireList(params).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            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.getCount(params)
+          }
+          this.spinning = false
+          return data
+        })
+      },
+      totalData: null
+    }
+  },
+  watch: {
+    advanced (newValue, oldValue) {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  computed: {
+    columns () {
+      const _this = this
+      const arr = [
+        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '地区', scopedSlots: { customRender: 'addressInfo' }, width: '12%', align: 'center' },
+        { title: '区域', dataIndex: 'subareaName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '分区', dataIndex: 'subareaAreaName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '区域负责人', dataIndex: 'userNameQyfzrs', width: '7%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '客户名称', dataIndex: 'dealerName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '客户级别', dataIndex: 'dealerLevelDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '原厂编码', dataIndex: 'productOrgiCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '订货数量', dataIndex: 'buyAmount', width: '80px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: <div>客户现有<div>库存数量</div></div>, dataIndex: 'storeAmount', width: '80px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: <div>已绑质保单<div>数量</div></div>, dataIndex: 'warrantyAmount', width: '80px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+      ]
+      if (this.$hasPermissions('M_tireSalesReportList_salesPrice')) {
+        arr.splice(11, 0, { title: '订货金额', dataIndex: 'buyPriceAmount', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      }
+      return arr
+    }
+  },
+  methods: {
+    custChange (val) {
+      this.queryParam.dealerName = val.name
+      this.queryParam.dealerSn = val.key
+    },
+    // 统计
+    getCount (params) {
+      queryTireCount(params).then(res => {
+        if (res.status == 200 && res.data) {
+          this.totalData = res.data
+        } else {
+          this.totalData = null
+        }
+      })
+    },
+    // 地区
+    areaChange (val) {
+      this.queryParam.provinceSn = val[0] ? val[0] : ''
+      this.queryParam.citySn = val[1] ? val[1] : ''
+      this.queryParam.districtSn = val[2] ? val[2] : ''
+    },
+    //  下推时间  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.provinceSn = undefined
+      this.queryParam.citySn = undefined
+      this.queryParam.districtSn = undefined
+      this.queryParam.dealerName = ''
+      this.queryParam.dealerSn = ''
+      this.queryParam.subareaSn = undefined
+      this.queryParam.subareaAreaSn = undefined
+      this.queryParam.bizUserSn = undefined
+      this.queryParam.productWord = undefined
+      this.queryParam.productName = undefined
+      this.queryParam.dealerLevel = undefined
+      this.totalData = null
+      this.$refs.areaList.clearData()
+      if (this.advanced) {
+        this.$refs.dealerSubareaScopeList.resetForm()
+        this.$refs.subarea.clearData()
+      }
+      this.$refs.table.clearTable()
+    },
+    //  导出
+    handleExport () {
+      const _this = this
+      const params = _this.queryParam
+      _this.exportLoading = true
+      _this.spinning = true
+      _this.showExport = true
+      _this.$store.state.app.curActionPermission = 'B_tireSalesReportExport'
+      hdExportExcel(excelTireOnlineExport, params, '轮胎统计报表', function () {
+        _this.exportLoading = false
+        _this.spinning = false
+        _this.$store.state.app.curActionPermission = ''
+      })
+    },
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+      this.resetSearchForm()
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 198
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</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>

+ 89 - 89
src/views/salesManagement/outboundOrder/list.vue

@@ -87,94 +87,94 @@
         </a-form>
       </div>
     </a-card>
-  
-  <a-card size="small" :bordered="false" class="outboundOrderList-wrap">
-    <a-spin :spinning="spinning" tip="Loading...">
-      <!-- 列表 -->
-      <div style="margin-bottom: 10px">
-        <a-button
-          type="primary"
-          v-if="$hasPermissions('B_stockOut')"
-          id="outboundOrder-export"
-          :loading="loading"
-          @click="handleOutbound()">批量出库</a-button>
-        <a-button
-          type="primary"
-          v-if="$hasPermissions('B_stockSend')"
-          class="button-info"
-          id="outboundOrder-send"
-          :loading="loading"
-          @click="handleSendGood()">批量发货</a-button>
-        <span style="margin-left: 5px">
-          <template v-if="rowSelectionInfo && rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
-        </span>
-      </div>
-      <s-table
-        class="sTable fixPagination"
-        ref="table"
-        :style="{ height: tableHeight+70+'px' }"
-        size="small"
-        :rowKey="(record) => record.stockOutSn"
-        rowKeyName="stockOutSn"
-        :row-selection="($hasPermissions('B_stockOut')||$hasPermissions('B_stockSend'))?{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.state == 'CANCEL' } }) }:null"
-        @rowSelection="rowSelectionFun"
-        :columns="columns"
-        :data="loadData"
-        :scroll="{ y: tableHeight }"
-        :defaultLoadData="false"
-        bordered>
-        <!-- 单号 -->
-        <template slot="stockOutNo" slot-scope="text, record">
-          <span v-if="record.stockOutNo && detailPermissions(record)" class="link-bule" @click="handleDetail(record)">{{ record.stockOutNo }}</span>
-          <span v-else-if="record.stockOutNo && !detailPermissions(record)">{{ record.stockOutNo }}</span>
-          <span v-else>--</span>
-        </template>
-        <!-- 操作 -->
-        <template slot="action" slot-scope="text, record">
+
+    <a-card size="small" :bordered="false" class="outboundOrderList-wrap">
+      <a-spin :spinning="spinning" tip="Loading...">
+        <!-- 列表 -->
+        <div style="margin-bottom: 10px">
           <a-button
-            size="small"
-            type="link"
-            v-if="record.state=='WAIT'&&$hasPermissions('B_stockOut')"
-            class="button-primary"
-            @click="handleOutbound(record)"
-            id="outboundOrderList-out-btn">出库</a-button>
+            type="primary"
+            v-if="$hasPermissions('B_stockOut')"
+            id="outboundOrder-export"
+            :loading="loading"
+            @click="handleOutbound()">批量出库</a-button>
           <a-button
-            size="small"
-            type="link"
-            class="button-primary"
-            v-if="record.sendFlag==0&&$hasPermissions('B_stockSend')"
-            @click="handleSendGood(record)"
-            id="outboundOrderList-sendBill">发货</a-button>
-          <span v-if="record.sendFlag==1&&record.state=='FINISH'">--</span>
-        </template>
-      </s-table>
-    </a-spin>
-    <!-- 详情 -->
-    <a-modal
-      centered
-      v-drag
-      class="outboundOrderDetail-modal"
-      :footer="null"
-      :maskClosable="false"
-      title="详情"
-      v-model="openModal"
-      v-if="openModal"
-      @cancel="cancleModal"
-      width="70%">
-      <div>
-        <pushOrderDetailModal v-if="outBizType=='SALES'" :outBizSubSn="orderSn" />
-        <allocationDetailModal v-if="outBizType=='ALLOCATE'" :outBizSn="orderSn" />
-      </div>
-    </a-modal>
-    <!-- 发货信息 -->
-    <sendGoodModal
-      v-drag
-      ref="detailModal"
-      modalTit="新增发货单"
-      :openModal="showDetailModal"
-      @ok="sendSuccess"
-      @cancel="showDetailModal=false"></sendGoodModal>
-  </a-card>
+            type="primary"
+            v-if="$hasPermissions('B_stockSend')"
+            class="button-info"
+            id="outboundOrder-send"
+            :loading="loading"
+            @click="handleSendGood()">批量发货</a-button>
+          <span style="margin-left: 5px">
+            <template v-if="rowSelectionInfo && rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
+          </span>
+        </div>
+        <s-table
+          class="sTable fixPagination"
+          ref="table"
+          :style="{ height: tableHeight+70+'px' }"
+          size="small"
+          :rowKey="(record) => record.stockOutSn"
+          rowKeyName="stockOutSn"
+          :row-selection="($hasPermissions('B_stockOut')||$hasPermissions('B_stockSend'))?{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.state == 'CANCEL' } }) }:null"
+          @rowSelection="rowSelectionFun"
+          :columns="columns"
+          :data="loadData"
+          :scroll="{ y: tableHeight }"
+          :defaultLoadData="false"
+          bordered>
+          <!-- 单号 -->
+          <template slot="stockOutNo" slot-scope="text, record">
+            <span v-if="record.stockOutNo && detailPermissions(record)" class="link-bule" @click="handleDetail(record)">{{ record.stockOutNo }}</span>
+            <span v-else-if="record.stockOutNo && !detailPermissions(record)">{{ record.stockOutNo }}</span>
+            <span v-else>--</span>
+          </template>
+          <!-- 操作 -->
+          <template slot="action" slot-scope="text, record">
+            <a-button
+              size="small"
+              type="link"
+              v-if="record.state=='WAIT'&&$hasPermissions('B_stockOut')"
+              class="button-primary"
+              @click="handleOutbound(record)"
+              id="outboundOrderList-out-btn">出库</a-button>
+            <a-button
+              size="small"
+              type="link"
+              class="button-primary"
+              v-if="record.sendFlag==0&&$hasPermissions('B_stockSend')"
+              @click="handleSendGood(record)"
+              id="outboundOrderList-sendBill">发货</a-button>
+            <span v-if="record.sendFlag==1&&record.state=='FINISH'">--</span>
+          </template>
+        </s-table>
+      </a-spin>
+      <!-- 详情 -->
+      <a-modal
+        centered
+        v-drag
+        class="outboundOrderDetail-modal"
+        :footer="null"
+        :maskClosable="false"
+        title="详情"
+        v-model="openModal"
+        v-if="openModal"
+        @cancel="cancleModal"
+        width="70%">
+        <div>
+          <pushOrderDetailModal v-if="outBizType=='SALES'" :outBizSubSn="orderSn" />
+          <allocationDetailModal v-if="outBizType=='ALLOCATE'" :outBizSn="orderSn" />
+        </div>
+      </a-modal>
+      <!-- 发货信息 -->
+      <sendGoodModal
+        v-drag
+        ref="detailModal"
+        modalTit="新增发货单"
+        :openModal="showDetailModal"
+        @ok="sendSuccess"
+        @cancel="showDetailModal=false"></sendGoodModal>
+    </a-card>
   </div>
 </template>
 
@@ -265,9 +265,9 @@ export default {
         { title: '发货状态', dataIndex: 'sendFlagDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
       ]
-	  if (this.isShowWarehouse) {
-	    arr.splice(6, 0, { title: '仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true })
-	  }
+      if (this.isShowWarehouse) {
+        arr.splice(6, 0, { title: '仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true })
+      }
       if (this.$hasPermissions('M_outboundOrderList_salesPrice')) { //  售价权限
         arr.splice(this.isShowWarehouse ? 8 : 7, 0, { title: '售价', dataIndex: 'productTotalPrice', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
       }

+ 7 - 7
src/views/salesManagement/pushOrderManagement/detailForOut.vue

@@ -97,7 +97,7 @@
             <a-badge count="促" v-if="record.promotionFlag=='GIFT'" :number-style="{ backgroundColor: '#52c41a', zoom:'80%' }"></a-badge>
             <a-badge count="特" v-if="record.promotionFlag=='DISCOUNT'" :number-style="{ backgroundColor: '#faad14', zoom:'80%' }"></a-badge>
           </template>
-           <!-- 销售价 -->
+          <!-- 销售价 -->
           <template slot="price" slot-scope="text, record">
             {{ toThousands(text) }}
             <span v-if="record.promotionFlag=='GIFT'||record.promotionFlag=='DISCOUNT'" title="原价">({{ toThousands(record.origPrice) }})</span>
@@ -128,7 +128,7 @@ import exportExcelModal from './exportExcelModal.vue'
 import { printBase64Fun, exportExcel } from '@/libs/JGPrint.js'
 import { dispatchDetaillListForOut, dispatchFindBySn, dispatchDetailPrint, dispatchDetailExcel } from '@/api/dispatch'
 export default {
-  name: 'detailForOut',
+  name: 'DetailForOut',
   mixins: [commonMixin],
   components: { STable, VSelect, sendTypeModal, exportExcelModal },
   props: {
@@ -184,7 +184,7 @@ export default {
       nowPrintType: '', //  当前打印类型
       openExcelModal: false,
       fromRouter: null,
-      nowType: 'print'
+      nowType: 'print',
     }
   },
   computed: {
@@ -205,7 +205,7 @@ export default {
         // { title: '本次下推金额', dataIndex: 'totalAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
       ]
       if (this.$hasPermissions('B_dispatchDetail_salesPrice')) { //  售价权限
-        arr.splice(5, 0, { title: '销售价格', dataIndex: 'price', width: '8%', align: 'right', scopedSlots: { customRender: 'price' }, })
+        arr.splice(5, 0, { title: '销售价格', dataIndex: 'price', width: '8%', align: 'right', scopedSlots: { customRender: 'price' } })
         arr.splice(9, 0, { title: '本次下推金额', dataIndex: 'totalAmount', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
       }
       if (this.$hasPermissions('B_dispatchDetail_cityPrice')) { //  市级权限
@@ -281,11 +281,11 @@ export default {
           params.type = params.type + '_STACK_PLACE'
         }
         // 原厂编码
-        if(obj.origCode == 1){
+        if (obj.origCode == 1) {
           params.type = params.type + '_ORIG_CODE'
         }
         // 装箱号
-        if(obj.packNo == 1){
+        if (obj.packNo == 1) {
           params.type = params.type + '_PACK_NUM'
         }
         printBase64Fun(
@@ -293,7 +293,7 @@ export default {
           Object.assign(params, obj || {}),
           type,
           taskName,
-          () => { 
+          () => {
             _this.spinning = false
             _this.$store.state.app.curActionPermission = ''
           },

+ 195 - 0
src/views/salesManagement/pushOrderManagement/uniqueCodeModal.vue

@@ -0,0 +1,195 @@
+<template>
+  <a-modal
+    centered
+    class="unique-code-modal"
+    :footer="null"
+    :maskClosable="false"
+    v-model="isShow"
+    :title="modalTit"
+    @cancel="isShow=false"
+    width="70%">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div class="common-main">
+        <!-- 搜索条件 -->
+        <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="产品编码">
+                  <a-input v-model.trim="queryParam.outBizSubNo" allowClear placeholder="请输入产品编码"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="唯一码">
+                  <a-input v-model.trim="queryParam.demanderName" allowClear placeholder="请输入唯一码"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="产品名称">
+                  <a-input v-model.trim="queryParam.demanderName" allowClear placeholder="请输入产品名称"/>
+                </a-form-item>
+              </a-col>
+              <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>
+                </span>
+              </a-col>
+            </a-row>
+          </a-form>
+        </div>
+        <a-alert type="info" style="margin-bottom: 10px;" v-if="detailData!=null">
+          <div slot="message">
+            <span v-if="$route.params.type!='stockOut'">
+              轮胎款数:<strong>{{ detailData&&(detailData.totalSalesQty || detailData.totalSalesQty==0) ? detailData.totalSalesQty : '--' }}</strong>;
+            </span>
+            轮胎总数量:<strong>{{ detailData&&(detailData.totalQty || detailData.totalQty==0) ? detailData.totalQty : '--' }}</strong>;
+          </div>
+        </a-alert>
+        <!-- 表格数据 -->
+        <s-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :data="loadData"
+          :scroll="{ y: 400 }"
+          :pageSize="10"
+          bordered>
+        </s-table>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable } from '@/components'
+import { stockOutList } from '@/api/stockOut'
+export default {
+  name: 'UniqueCodeModal',
+  mixins: [commonMixin],
+  components: { STable },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    modalTit: { // 弹框标题
+      type: String,
+      default: null
+    },
+    chooseData: {
+      type: Array,
+      default: function () {
+        return []
+      }
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      disabled: false,
+      spinning: false,
+      handlePlData: [],
+      queryParam: {
+        outBizSubNo: '',
+        demanderName: '',
+        receiverSn: undefined,
+        warehouseSn: undefined,
+        outBizTypeList: ['SALES', 'ALLOCATE']
+      },
+      orginData: [],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        return stockOutList(Object.assign(parameter, this.queryParam)).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+              const index = this.chooseData.findIndex(item => data.list[i].stockOutSn == item.stockOutSn)
+              data.list[i].checked = index >= 0
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          this.orginData = data.list
+          return data
+        })
+      },
+      snList: [],
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'stockOutNo', width: '25%', align: 'center' },
+        { title: '唯一码', dataIndex: 'outBizSubNo', width: '25%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'demanderName', width: '50%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true }
+      ],
+      detailData: null
+    }
+  },
+  methods: {
+    custChange (val) {
+      this.queryParam.receiverSn = val.key || ''
+    },
+    // 删除
+    handleDel (row) {
+      const i = this.chooseData.findIndex(item => row.stockOutSn == item.stockOutSn)
+      this.chooseData.splice(i, 1)
+      const oi = this.orginData.findIndex(item => row.stockOutSn == item.stockOutSn)
+      if (oi >= 0) {
+        this.orginData[oi].checked = false
+      }
+    },
+    // 选择
+    handleChoose (row) {
+      row.checked = true
+      this.chooseData.push(row)
+      this.$emit('choose')
+    },
+    // 取消
+    handleCommonCancel () {
+      this.$emit('cancel')
+    },
+    // 重置
+    resetSearchForm () {
+      this.queryParam = {
+        outBizSubNo: '',
+        demanderName: '',
+        receiverSn: undefined,
+        warehouseSn: undefined,
+        outBizTypeList: ['SALES', 'ALLOCATE']
+      }
+      this.orginData = []
+      this.$nextTick(() => {
+        this.$refs.dealerSubareaScopeList.resetForm()
+      })
+      if (this.$refs.table) {
+        this.$refs.table.refresh(true)
+      }
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.handleCommonCancel()
+      } else {
+        this.resetSearchForm()
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+
+</style>

+ 22 - 10
src/views/salesManagement/receiptPrint/list.vue

@@ -298,23 +298,33 @@ export default {
       const auditInfo = await getBatchLastProcessInstance({ 'businessType': 'FINANCE_BOOK', 'businessSnList': bookSns }).then(res => res.data)
       console.log(auditInfo)
       bookSns.map(item => {
-        // 授信明细
+        // 授信明细,还款明细
         const rs = rows.filter(a => a.bookSn == item)
         let detailItemUseStr = ''
+        let detailPayUseStr = ''
         rs.map(b => {
           if (b.detailItemUseList) {
-            b.detailItemUseList.map((k, i) => {
-              detailItemUseStr = detailItemUseStr + k.itemName + '(' + k.itemAmount + ')' + (i == b.detailItemUseList.length - 1 ? '。' : ';')
-            })
+            detailItemUseStr = this.getUseDetailInfo(b.detailItemUseList)
+          }
+          if(b.detailItemPayList){
+            detailPayUseStr = this.getUseDetailInfo(b.detailItemPayList)
           }
         })
         // 审核信息
         const auditStr = auditInfo ? this.getAuditInfo(auditInfo[item]) : ''
-        retArr.push({ audit: auditStr, detail: detailItemUseStr, subList: rs })
+        retArr.push({ audit: auditStr, detail: detailItemUseStr, payDetail:detailPayUseStr, subList: rs })
       })
       console.log(retArr, '------------')
       this.handlePrint(retArr, 1, rows, bookSns)
     },
+    // 获取授信西悉尼
+    getUseDetailInfo(list){
+      let ret = ''
+      list.map((k, i) => {
+        ret = ret + k.itemName + '(' + k.itemAmount + ')' + (i == list.length - 1 ? '。' : ';')
+      })
+      return ret
+    },
     // 获取审核信息
     getAuditInfo (auditList) {
       let auditStr = ''
@@ -353,16 +363,18 @@ export default {
       this.spinning = true
       this.showTipModal = true
       let detailItemUseStr = ''
-
+      let detailPayUseStr = ''
       this.$nextTick(() => {
+        // type == 0 单个打印时
         if (type == 0 && row.detailItemUseList) {
-          row.detailItemUseList.map(k => {
-            detailItemUseStr = detailItemUseStr + k.itemName + '(' + k.itemAmount + ');'
-          })
+          detailItemUseStr = this.getUseDetailInfo(row.detailItemUseList)
+        }
+        if (type == 0 && row.detailItemPayList) {
+          detailPayUseStr = this.getUseDetailInfo(row.detailItemPayList)
         }
         // 审核信息
         const auditStr = auditInfo ? this.getAuditInfo(auditInfo[list.bookSn]) : ''
-        this.$refs.printModel.getData(type ? row : [{ audit: auditStr, detail: detailItemUseStr, subList: [row] }], type ? list : [list])
+        this.$refs.printModel.getData(type ? row : [{ audit: auditStr, detail: detailItemUseStr, payDetail: detailPayUseStr, subList: [row] }], type ? list : [list])
       })
     },
     printOk (res) {

+ 4 - 1
src/views/salesManagement/receiptPrint/printModel.vue

@@ -62,7 +62,10 @@
                         <td style="padding:3pt 1pt;width: 54pt;word-break:break-all;">{{ item.explainInfo }}</td>
                       </tr>
                     </table>
-                    <div style="padding:5pt 0;border-bottom: 1px solid #333;">使用授信明细:{{ fcItem.detail||'暂无。' }}</div>
+                    <div style="padding:5pt 0;border-bottom: 1px solid #333;">
+                      <div style="width:48%;display:inline-block;">使用授信明细:{{ fcItem.detail||'暂无。' }}</div>
+                      <div style="width:48%;display:inline-block;marign-left:1%;">授信还款明细: {{ fcItem.payDetail||'暂无。' }}</div>
+                    </div>
                     <div style="padding:5pt 0;">
                       审批人员:{{ fcItem.audit||'暂无。' }}
                     </div>

+ 6 - 1
src/views/salesManagement/salesCollection/voucherModal.vue

@@ -232,7 +232,12 @@ export default {
         retArr.push({ audit: auditStr, detail: detailItemUseStr, subList: rs })
       })
       console.log(retArr, '------------')
-      this.handlePrint(retArr, rows)
+      if(retArr.length){
+        this.handlePrint(retArr, rows)
+      }else{
+        this.$message.info("此收款单明细为空或没有相关数据权限")
+        this.spinning = false
+      }
     },
     // 收款打印
     handlePrint (row, list) {

+ 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()
     },
     // 刷新当前页面

+ 71 - 46
src/views/salesManagement/salesQueryNew/comps/detailProductList.vue

@@ -51,6 +51,10 @@
           type: String,
           default: ''
         },
+        promoFlag: {
+          type: String,
+          default: ''
+        },
         salesBillSn: {
           type: String,
           default: ''
@@ -101,7 +105,8 @@
           showEmpty: false,
           showTableHead: true,
           colspanNums: 13,
-          simpleImage: Empty.PRESENTED_IMAGE_SIMPLE
+          hasOutStockOfActive: false,
+          simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
         }
       },
       computed: {
@@ -129,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 ? (
@@ -153,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>
@@ -181,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])} })
@@ -219,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')
         }
@@ -278,62 +296,66 @@
             const params = {
                 salesBillSn: this.salesBillSn,
                 showStock: this.showStock,
-                warehouseSn: this.warehouseSn
+                warehouseSn: this.warehouseSn,
+                promotionFlag: this.promoFlag == '' ? undefined : this.promoFlag
             }
             const active = this.activeList.filter(item => item.enabledFlag == 1)
 
             // 正常产品
-            const proList = await salesDetailAllList(params).then(res => res.data)
-            const norTotal = await salesDetaiCount(params).then(res => res.data)
+            const hasSearchNormal = !params.promotionFlag || params.promotionFlag == 0
+            const proList = hasSearchNormal ? await salesDetailAllList(params).then(res => res.data) : []
+            const norTotal = hasSearchNormal ? await salesDetaiCount(params).then(res => res.data) : null
             // 没有活动时,表格不显示统计数据
             let listData = active.length ? (proList.length ? [{
                 id: 'promo-normal',
                 total: norTotal
               },...proList] : []) : proList
             
-            // 循环获取活动产品
-            for(let i=0;i<active.length;i++){
-              const promo = active[i]
-              const activeParams = {
-                promoRuleSn: promo.promoRuleSn,
-                promoSn: promo.promoSn,
-                salesPromoSn: promo.salesPromoSn,
-                ...params
-              }
-              
-              // 获取活动产品统计
-              const acTotal = await salesPromoDetailCount(activeParams).then(res => res.data)
-              if(acTotal){
-                // 采购额结余
-                acTotal.cgejyAmount = Number(acTotal.totalPromoGiftsAmount||0) - Number(acTotal.totalUsePromoGiftsAmount||0)
-                // 采购额超出
-                acTotal.cgeccAmount = Number(acTotal.totalUsePromoGiftsAmount||0) - Number(acTotal.totalPromoGiftsAmount||0)
-              }
-              // 有数据时才调用接口,避免做无用的调用
-              if(acTotal&&acTotal.totalQty){
-                // 获取活动产品列表
-                const aclist = await salesDetailAllList(activeParams).then(res => res.data)
-                const retList = aclist.length ? [{
-                  id: 'promo-'+i,
-                  promo: promo,
-                  total: acTotal
-                },...aclist] : []
-                // 将活动产品数据拼接
-                listData = aclist&&aclist.length ? listData.concat(retList) : listData
+            if(params.promotionFlag != 0){  
+              // 循环获取活动产品
+              for(let i=0;i<active.length;i++){
+                const promo = active[i]
+                const activeParams = {
+                  promoRuleSn: promo.promoRuleSn,
+                  promoSn: promo.promoSn,
+                  salesPromoSn: promo.salesPromoSn,
+                  ...params
+                }
+                
+                // 获取活动产品统计
+                const acTotal = await salesPromoDetailCount(activeParams).then(res => res.data)
+                if(acTotal){
+                  // 采购额结余
+                  acTotal.cgejyAmount = (Number(acTotal.totalPromoGiftsAmount||0) - Number(acTotal.totalUsePromoGiftsAmount||0)).toFixed(2)
+                  // 采购额超出
+                  acTotal.cgeccAmount = (Number(acTotal.totalUsePromoGiftsAmount||0) - Number(acTotal.totalPromoGiftsAmount||0)).toFixed(2)
+                }
+                // 有数据时才调用接口,避免做无用的调用
+                if(acTotal&&acTotal.totalQty){
+                  // 获取活动产品列表
+                  const aclist = await salesDetailAllList(activeParams).then(res => res.data)
+                  
+                  const retList = aclist.length ? [{
+                    id: 'promo-'+i,
+                    promo: promo,
+                    total: acTotal
+                  },...aclist] : []
+                  // 将活动产品数据拼接
+                  listData = aclist&&aclist.length ? listData.concat(retList) : listData
+                }
               }
-            }
-            console.log(listData)
-            // 如果活动没有任何产品,不显示统计一行
-            if(active.length){
-              const hasAcp = listData.filter(item => item.id!='promo-normal').filter(item => item.id.indexOf("promo-")>=0)
-              if(hasAcp && hasAcp.length==0){
-                listData = listData.filter(item => item.id.indexOf("promo-")<0) || []
+              console.log(listData)
+              // 如果活动没有任何产品,不显示统计一行
+              if(active.length){
+                const hasAcp = listData.filter(item => item.id!='promo-normal').filter(item => item.id.indexOf("promo-")>=0)
+                if(hasAcp && hasAcp.length==0){
+                  listData = listData.filter(item => item.id.indexOf("promo-")<0) || []
+                }
               }
             }
-
             console.log(listData)
             this.dataSource = listData
-
+            
             // 格式化数据
             let f = 0
             this.outStockStr = ''
@@ -352,6 +374,9 @@
               item.epushedQty = Number(item.pushedQty) - Number(item.pushQty)
               if (item.unpushedQty && (Number(item.stockQty) < Number(item.unpushedQty))) {
                   str += item.productCode + '、'
+                  if(item.promotionFlag != 0){
+                    this.hasOutStockOfActive = true
+                  }
               }
             })
             if (str.length > 0) {

+ 20 - 37
src/views/salesManagement/salesQueryNew/comps/productList.vue

@@ -7,39 +7,15 @@
           {{ 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'">
+                 {{descDetail.gateInfo}}
+              </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 +26,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 +172,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 +356,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 {
@@ -413,7 +393,8 @@ export default {
       descDetail: null,
       promoProductClz: null, // 活动产品分类
       disablePromo: false,
-      countData: null
+      countData: null,
+      warehouseTit: ''
     }
   },
   computed: {
@@ -466,10 +447,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) {

+ 50 - 6
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>
@@ -95,11 +96,35 @@
             <div style="flex-grow: 1;width: 60%;">
               <a-form layout="inline" @keyup.enter.native="searchTable">
                 <a-row :gutter="15" type="flex">
-                  <a-col flex="350px">
+                  <a-col flex="300px">
                     <a-form-item label="出库仓库">
                       <chooseWarehouse ref="warehouse" v-model="warehouseSn"></chooseWarehouse>
                     </a-form-item>
                   </a-col>
+                  <a-col flex="300px" v-if="hasPrompActive">
+                    <a-form-item label="产品类型">
+                      <a-select v-model.trim="promoFlag" allowClear :dropdownMatchSelectWidth="false" placeholder="请选择产品类型">
+                        <a-select-option value="0">
+                          正常产品
+                        </a-select-option>
+                        <a-select-option value="REGULAR">
+                          正价产品(活动)
+                        </a-select-option>
+                        <a-select-option value="DISCOUNT">
+                          特价产品
+                        </a-select-option>
+                        <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>
+                      </a-select>
+                    </a-form-item>
+                  </a-col>
                   <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
                     <a-button type="primary" @click="searchTable" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
                     <a-button style="margin-left: 5px" @click="resetSearchForm" id="productInfoList-reset">重置</a-button>
@@ -119,6 +144,7 @@
             ref="productList"
             :detailData="detailData"
             :warehouseSn="warehouseSn"
+            :promoFlag="promoFlag"
             :salesBillSn="$route.params.sn || bizSn"
             :authCode="authCode"
             :maxHeight="pageHeight"
@@ -245,7 +271,8 @@ export default {
       spinningAudit: false,
       auditText: null,
       fromRouter: null,
-      warehouseSn: undefined
+      warehouseSn: undefined,
+      promoFlag: undefined
     }
   },
   computed: {
@@ -261,9 +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
+    },
+    showConvertPromoGifts () {
+      return this.$refs.productList && this.$refs.productList.showConvertPromoGifts
     },
     pageHeight () {
       return window.innerHeight - 305 + (this.hideFooter ? 45 : 0)
@@ -282,6 +315,7 @@ export default {
     //  重置
     resetSearchForm () {
       this.warehouseSn = undefined
+      this.promoFlag = undefined
       setTimeout(() => {
         this.searchTable()
       }, 100)
@@ -319,14 +353,24 @@ export default {
     // 打开审核/一键审核弹框
     handleAudit (isBatch) {
       if (isBatch) { // 一键审核
-        if (this.detailData && this.detailData.promoFlag == 1 && this.$refs.productList.outStockStr != '') {
+        if (this.$refs.productList.hasOutStockOfActive) {
+          this.$info({
+            title: '提示',
+            content: '参加促销活动的产品存在缺货,不可一键审核!',
+            centered: true
+          })
+          return
+        }
+
+        if (this.$refs.productList.showConvertPromoGifts) {
           this.$info({
             title: '提示',
-            content: '参加促销活动的销售单,有缺货产品,不可一键审核!',
+            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: {

+ 36 - 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) {
       // 防止多次添加产品
@@ -209,6 +229,21 @@ export default {
         this.spinning = false
       })
     },
+    // 一键下推
+    oneDispatch () {
+      this.isInster = true
+      this.spinning = true
+      salesDetailDispatchByOneKey({ salesBillSn: this.$route.params.salesBillSn }).then(res => {
+        if (res.status == 200) {
+          this.resetSearchForm()
+          this.$refs.partQuery.resetCurForm()
+          this.spinning = false
+        } else {
+          this.spinning = false
+        }
+        this.isInster = false
+      })
+    },
     pageInit () {
       this.$refs.partQuery.clearSelectTable()
       this.salesBillSn = this.$route.params.salesBillSn

+ 209 - 82
src/views/salesManagement/waitDispatchNew/queryPart.vue

@@ -14,20 +14,33 @@
               <a-input id="productInfoList-code" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
             </a-form-item>
           </a-col>
-          <a-col :md="4" :sm="24">
-            <a-form-item label="是否促销品">
-              <v-select
-                code="FLAG"
-                id="productInfoList-promoFlag"
-                v-model="queryParam.promoFlag"
-                allowClear
-                placeholder="请选择是否"
-              ></v-select>
+          <a-col :md="4" :sm="24" v-if="hasPrompActive">
+            <a-form-item label="产品类型">
+              <a-select allowClear v-model.trim="queryParam.promotionFlag" :dropdownMatchSelectWidth="false" placeholder="请选择产品类型">
+                <a-select-option value="0">
+                  正常产品
+                </a-select-option>
+                <a-select-option value="REGULAR">
+                  正价产品(活动)
+                </a-select-option>
+                <a-select-option value="DISCOUNT">
+                  特价产品
+                </a-select-option>
+                <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>
+              </a-select>
             </a-form-item>
           </a-col>
           <a-col :md="4" :sm="24">
-            <a-form-item label="类型">
-              <a-select v-model.trim="queryParam.pushProductType" :dropdownMatchSelectWidth="false" >
+            <a-form-item label="下推类型">
+              <a-select allowClear v-model.trim="queryParam.pushProductType" :dropdownMatchSelectWidth="false" placeholder="请选择下推类型">
                 <a-select-option value="">
                   全部产品
                 </a-select-option>
@@ -50,7 +63,7 @@
           </a-col>
           <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
             <a-button type="primary" @click="searchTable" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
-            <a-button style="margin-left: 5px" @click="resetSearchForm" id="productInfoList-reset">重置</a-button>
+            <a-button style="margin-left: 5px" @click="resetSearchForm(null)" id="productInfoList-reset">重置</a-button>
           </a-col>
         </a-row>
       </a-form>
@@ -60,11 +73,12 @@
     <div style="margin-bottom: 10px;display: flex;align-items: center;" v-if="detailData">
       <div style="display: flex;align-items: center;">
         <a-button type="primary" :disabled="newLoading" class="button-info" @click="handlePlAdd">批量添加</a-button>
-        <a-button type="danger" v-if="hasPrompActive" :disabled="newLoading" @click="handleAllCancel">整单取消</a-button>
-        <a-button type="danger" v-else :disabled="newLoading" @click="handlePlCancel">批量取消</a-button>
-        <a-tooltip placement="top" v-if="hasPrompActive" style="margin-left:6px;">
+        <a-button type="primary" :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;">
           <template slot="title">
-            <span>参加促销活动的销售单,不能单个取消产品,只能整单取消。</span>
+            <span>参加促销活动的产品,不能单独取消,只能整单取消。</span>
           </template>
           <a-icon style="font-size: 14px;" type="question-circle" />
         </a-tooltip>
@@ -81,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>
     
@@ -149,20 +164,20 @@ export default {
         pushProductType: '', // 类型
         productCode: '', //  产品编码
         productName: '', //  产品名称
-        promoFlag: undefined, //  是否促销品
+        promotionFlag: undefined, //  是否促销品
         brandSn: undefined, //  产品品牌
         productTypeSn1: '', //  产品一级分类
         productTypeSn2: '', //  产品二级分类
         productTypeSn3: '', //  产品三级分类
         salesBillSn: '',
-        warehouseSn: undefined
+        warehouseSn: undefined,
+        convertPromoGiftsFlag: undefined
       },
       disabled: false, //  查询、重置按钮是否可操作
       activeList: [], // 活动列表
       spinning: false,
       dataSource: [],
       tableData: [],
-      tableHeight: this.maxHeight,
       cellStyleOption: {
         bodyCellClass: ({ row, column, rowIndex }) => {
             if (row.id.indexOf('promo-')>=0 && column.field === "no") {
@@ -184,11 +199,24 @@ export default {
       disableSelectedRowKeys: [],
       selectedRowKeys: [],
       colspanNums: 16,
+      hasNormalProduct: false,
     }
   },
   computed: {
+    tableHeight(){
+      return (this.showEmpty ? 200 : this.maxHeight) + 'px'
+    },
     hasPrompActive(){
-      return this.detailData&&this.detailData.promoFlag==1&&!this.detailData.totalCancelQty
+      return this.detailData&&this.detailData.promoFlag==1
+    },
+    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 {
@@ -235,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 (
@@ -258,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){
@@ -276,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 ? (
@@ -294,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>
@@ -312,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)} })
@@ -330,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
     }
@@ -367,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(){
@@ -397,72 +469,70 @@ export default {
         this.queryParam.salesBillSn = this.salesBillSn
         this.queryParam.showStock = true
         const params = this.queryParam
-        if(params.promoFlag){
-          params.isGifg = params.promoFlag == 1 ? 'Y' : 'N'
-        }else{
-          params.isGifg = undefined
-        }
- 
+        console.log(params)
         const active = this.activeList
-
         // 正常产品
-        const proList = await salesDetailAllList(params).then(res => res.data)
-        const norTotal = await salesDetaiCount(params).then(res => res.data)
+        const hasSearchNormal = !params.promotionFlag || params.promotionFlag == 0
+        const proList = hasSearchNormal ? await salesDetailAllList(params).then(res => res.data) : []
+        const norTotal = hasSearchNormal ? await salesDetaiCount(params).then(res => res.data) : null
+        // 是否有正常产品
+        this.hasNormalProduct = proList.length > 0
         //没有活动时不显示统计
         let listData = active.length ? (proList.length ? [{
             id: 'promo-normal',
             total: norTotal
           },...proList] : []) : proList
-         
-        // 循环获取活动产品
-        for(let i=0;i<active.length;i++){
-          const promo = active[i]
-          const activeParams = {
-            promoRuleSn: promo.promoRuleSn,
-            promoSn: promo.promoSn,
-            salesPromoSn: promo.salesPromoSn,
-            ...params
-          }
-          
-          
-          // 获取活动产品统计
-          const acTotal = await salesPromoDetailCount(activeParams).then(res => res.data)
-          if(acTotal){
-            // 采购额结余
-            acTotal.cgejyAmount = Number(acTotal.totalPromoGiftsAmount||0) - Number(acTotal.totalUsePromoGiftsAmount||0)
-            // 采购额超出
-            acTotal.cgeccAmount = Number(acTotal.totalUsePromoGiftsAmount||0) - Number(acTotal.totalPromoGiftsAmount||0)
-          }
-           
-          // 有数据时才调用接口,避免做无用的调用
-          if(acTotal&&acTotal.totalQty){
-            // 获取活动产品列表
-            const aclist = await salesDetailAllList(activeParams).then(res => res.data)
-            const retList = aclist.length ? [{
-              id: 'promo-'+i,
-              promo: promo,
-              total: acTotal
-            },...aclist] : []
-            // 将活动产品数据拼接
-            listData = aclist&&aclist.length ? listData.concat(retList) : listData
+        
+        if(params.promotionFlag != 0){
+          // 循环获取活动产品
+          for(let i=0;i<active.length;i++){
+            const promo = active[i]
+            const activeParams = {
+              promoRuleSn: promo.promoRuleSn,
+              promoSn: promo.promoSn,
+              salesPromoSn: promo.salesPromoSn,
+              ...params
+            }
+            
+            // 获取活动产品统计
+            const acTotal = await salesPromoDetailCount(activeParams).then(res => res.data)
+            if(acTotal){
+              // 采购额结余
+              acTotal.cgejyAmount = (Number(acTotal.totalPromoGiftsAmount||0) - Number(acTotal.totalUsePromoGiftsAmount||0)).toFixed(2)
+              // 采购额超出
+              acTotal.cgeccAmount = (Number(acTotal.totalUsePromoGiftsAmount||0) - Number(acTotal.totalPromoGiftsAmount||0)).toFixed(2)
+            }
+             
+            // 有数据时才调用接口,避免做无用的调用
+            if(acTotal&&acTotal.totalQty){
+              // 获取活动产品列表
+              const aclist = await salesDetailAllList(activeParams).then(res => res.data)
+              const retList = aclist.length ? [{
+                id: 'promo-'+i,
+                promo: promo,
+                total: acTotal
+              },...aclist] : []
+              // 将活动产品数据拼接
+              listData = aclist&&aclist.length ? listData.concat(retList) : listData
+            }
           }
-        }
-  
-        // 如果活动没有任何产品
-        if(active.length){
-          const hasAcp = listData.filter(item => item.id!='promo-normal').filter(item => item.id.indexOf("promo-")>=0)
-          if(hasAcp && hasAcp.length==0){
-            listData = listData.filter(item => item.id.indexOf("promo-")<0) || []
+    
+          // 如果活动没有任何产品
+          if(active.length){
+            const hasAcp = listData.filter(item => item.id!='promo-normal').filter(item => item.id.indexOf("promo-")>=0)
+            if(hasAcp && hasAcp.length==0){
+              listData = listData.filter(item => item.id.indexOf("promo-")<0) || []
+            }
           }
         }
-        
         console.log(listData)
         this.dataSource = listData
 
         // 格式化数据
         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)
@@ -473,13 +543,21 @@ 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)
           }
         })
         this.showEmpty = this.dataSource.length <= 0
-        this.tableHeight = (this.showEmpty ? 200 : this.maxHeight) + 'px'
         this.tableData = this.dataSource
         this.spinning = false
         this.disabled = false
@@ -495,8 +573,7 @@ export default {
       this.queryParam.productTypeSn2 = ''
       this.queryParam.productTypeSn3 = ''
       this.queryParam.warehouseSn = undefined
-      this.queryParam.promoFlag = undefined
-      this.queryParam.isGifg = undefined
+      this.queryParam.convertPromoGiftsFlag = undefined
       this.productType = []
       this.dataSource = []
       this.clearSelectTable()
@@ -524,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
@@ -533,23 +648,30 @@ export default {
         return
       }
       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 => {
         obj.push(item.salesBillDetailSn)
       })
+      noStockRow && noStockRow.map(item => {
+        noObj.push(item.productCode)
+      })
 
       if(obj.length){
         this.$confirm({
           title: '提示',
-          content: '确认要批量添加到待下推列表吗?',
+          content: <div><div style="text-align:center;padding:10px 0;font-weight:bold;">确认要批量添加到待下推列表吗?</div>{noObj.length?<div><div>总共选择了 {chooseList.length} 个产品,其中 {obj.length} 个产品可添加。</div><div> 产品 ({noObj.toString()}) 因库存为0不可添加!</div></div>:''}</div>,
           centered: true,
           closable: true,
+          class: 'confirm-center',
           onOk () {
             _this.$emit('addProduct', obj)
           }
         })
       }else{
-        _this.$message.warning('库存为0,不可添加!')
+        _this.$message.warning('所选产品库存为0,不可添加!')
       }
       
     },
@@ -575,6 +697,11 @@ export default {
         return
       }
       const chooseRow = this.dataSource.filter(item => chooseList.includes(item.id) && item.id.indexOf('promo-')<0)
+      const hasActive = chooseRow && chooseRow.filter(item => item.promotionFlag != 0)
+      if(hasActive.length>0){
+        _this.$message.warning('参与促销的产品只可进行整单取消!')
+        return
+      }
       const obj = []
       chooseRow && chooseRow.map(item => {
         obj.push({

+ 6 - 0
src/views/supplierManagement/supplierInfo/edit.vue

@@ -134,6 +134,11 @@
                     </a-radio-group>
                   </a-form-model-item>
                 </a-col>
+                <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
+                  <a-form-model-item label="ERP编码">
+                    <a-input v-model.trim="form.kdSupplierCode" :maxLength="50" allowClear placeholder="请输入ERP编码" />
+                  </a-form-model-item>
+                </a-col>
               </a-row>
             </a-collapse-panel>
           </a-collapse>
@@ -286,6 +291,7 @@ export default {
         deliveryCycle: '',
         settleCycle: '',
         cooperateFlag: undefined,
+        kdSupplierCode:'',
         busniessMode: '',
         busniessScope: '',
         buildDate: '',