소스 검색

Merge branch 'develop_yh39' of jianguan-web/jg-ocs-html into pre-release

李磊 1 년 전
부모
커밋
4ef92bf4a3
60개의 변경된 파일3658개의 추가작업 그리고 1028개의 파일을 삭제
  1. 1 1
      public/version.json
  2. 38 23
      src/api/allocateBill.js
  3. 32 17
      src/api/allocateReturn.js
  4. 71 0
      src/api/dealer.js
  5. 51 6
      src/api/dealerScope.js
  6. 30 6
      src/api/reportData.js
  7. 1 1
      src/api/salesReturn.js
  8. 12 11
      src/api/stock.js
  9. 63 55
      src/config/router.config.js
  10. 2 1
      src/views/allocationManagement/transferOut/detail.vue
  11. 41 6
      src/views/allocationManagement/transferOut/edit.vue
  12. 146 145
      src/views/allocationManagement/transferReturn/edit.vue
  13. 1 1
      src/views/allocationManagement/transferReturn/list.vue
  14. 1 1
      src/views/allocationManagement/transfersPrint/list.vue
  15. 20 8
      src/views/common/chooseDealer.vue
  16. 15 1
      src/views/common/custList.vue
  17. 98 0
      src/views/common/dealerType.js
  18. 17 5
      src/views/dealerManagement/businessOwnerSettings/chooseDealer.vue
  19. 21 9
      src/views/dealerManagement/marketingDivisionSetNew/viewDealers.vue
  20. 329 0
      src/views/dealerManagement/merchantInfoManagement/chooseTypeModal.vue
  21. 1 1
      src/views/dealerManagement/merchantInfoManagement/detailModal.vue
  22. 19 10
      src/views/dealerManagement/merchantInfoManagement/edit.vue
  23. 33 15
      src/views/dealerManagement/merchantInfoManagement/list.vue
  24. 0 331
      src/views/dealerManagement/merchantInfoManagement/permissionSetting.vue
  25. 327 0
      src/views/dealerManagement/merchantInfoManagement/permissionSettingNew.vue
  26. 126 0
      src/views/dealerManagement/merchantInfoManagement/priceLevelModal.vue
  27. 1 13
      src/views/dealerManagement/merchantInfoManagement/updateDealerLevel.vue
  28. 18 6
      src/views/dealerManagement/provincialWarehouseManagement/chooseDealer.vue
  29. 17 5
      src/views/dealerManagement/provincialWarehouseManagement/relatedDealersList.vue
  30. 331 0
      src/views/dealerManagement/rebateBinding/categoryList.vue
  31. 224 0
      src/views/dealerManagement/rebateBinding/categoryTree.vue
  32. 235 0
      src/views/dealerManagement/rebateBinding/list.vue
  33. 467 0
      src/views/dealerManagement/rebateBinding/priceDiffModal.vue
  34. 78 74
      src/views/power/role/menuModal.vue
  35. 25 12
      src/views/promotionRulesManagement/dealerPromotions/chooseDealer.vue
  36. 19 7
      src/views/promotionRulesManagement/promotionManagement/chooseDealer.vue
  37. 19 18
      src/views/reportData/hPriceDifferenceDetailReport/list.vue
  38. 36 23
      src/views/reportData/priceDifferenceDetailReport/list.vue
  39. 336 0
      src/views/reportData/productRebateReport/dealerList.vue
  40. 55 48
      src/views/reportData/productRebateReport/detailList.vue
  41. 13 7
      src/views/reportData/productRebateReport/index.vue
  42. 81 73
      src/views/reportData/productRebateReport/list.vue
  43. 8 4
      src/views/reportData/salesDetails/list.vue
  44. 46 9
      src/views/reportData/salesOrderTotal/list.vue
  45. 8 6
      src/views/reportData/salesReturnDetailReport/list.vue
  46. 41 5
      src/views/reportData/salesReturnsReport/list.vue
  47. 27 26
      src/views/salesManagement/salesQueryNew/comps/activeQueryPart.vue
  48. 6 3
      src/views/salesManagement/salesQueryNew/comps/productList.vue
  49. 3 1
      src/views/salesManagement/salesQueryNew/comps/productNormalList.vue
  50. 4 3
      src/views/salesManagement/salesQueryNew/comps/queryPart.vue
  51. 13 3
      src/views/salesManagement/salesQueryNew/edit.vue
  52. 15 15
      src/views/salesManagement/salesQueryNew/list.vue
  53. 2 2
      src/views/salesManagement/salesQueryNew/setPriceModal.vue
  54. 24 6
      src/views/salesManagement/shortageStatisticsC/list.vue
  55. 2 2
      src/views/salesManagement/waitCostOrder/list.vue
  56. 3 1
      src/views/salesReturnManagement/custConfirm/setPriceModal.vue
  57. 1 0
      src/views/salesReturnManagement/receiveCheck/chooseProductsModal.vue
  58. 2 1
      src/views/salesReturnManagement/salesReturn/queryPart.vue
  59. 1 0
      src/views/salesReturnManagement/salesReturn/salesReturnEdit.vue
  60. 1 1
      vue.config.js

+ 1 - 1
public/version.json

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

+ 38 - 23
src/api/allocateBill.js

@@ -9,7 +9,7 @@ export const allocateBillList = (params) => {
     url: url,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('列表查询')
     }
   })
@@ -23,7 +23,7 @@ export const allocDetailQueryPageForReturn = (params) => {
     url: url,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('可选产品列表查询')
     }
   })
@@ -35,7 +35,7 @@ export const updateBatchDepartment = params => {
     url: '/allocateBill/detail/updateBatchDepartment',
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('批量设置费用归属部门')
     }
   })
@@ -46,7 +46,7 @@ export const allocateBillSave = params => {
     url: '/allocateBill/save',
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('新增')
     }
   })
@@ -57,7 +57,7 @@ export const allocateBillDel = params => {
     url: `/allocateBill/delete/${params.sn}`,
     data: {},
     method: 'get',
-    headers:{
+    headers: {
       'module': encodeURIComponent('删除')
     }
   })
@@ -68,7 +68,7 @@ export const allocateBillDetail = params => {
     url: `/allocateBill/findBySn/${params.sn}`,
     data: {},
     method: 'get',
-    headers:{
+    headers: {
       'module': encodeURIComponent('查看详情')
     }
   })
@@ -79,7 +79,7 @@ export const allocateBillAudit = params => {
     url: `/allocateBill/audit/${params.sn}/${params.state}`,
     data: {},
     method: 'get',
-    headers:{
+    headers: {
       'module': encodeURIComponent('审核')
     }
   })
@@ -90,7 +90,7 @@ export const allocateBillAblePrint = params => {
     url: `/allocateBill/ablePrint/${params.sn}`,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('允许打印')
     }
   })
@@ -101,7 +101,7 @@ export const allocateBillCheck = params => {
     url: `/allocateBill/check/${params.sn}`,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('对单通过')
     }
   })
@@ -112,7 +112,7 @@ export const allocateBillSubmit = params => {
     url: `/allocateBill/submit`,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('提交')
     }
   })
@@ -124,7 +124,7 @@ export const allocateBillExport = (params) => {
     data: params,
     method: 'post',
     responseType: 'blob',
-    headers:{
+    headers: {
       'module': encodeURIComponent('导出')
     }
   })
@@ -138,7 +138,7 @@ export const allocateBillDetailList = (params) => {
     url: url,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('明细列表查询')
     }
   })
@@ -157,7 +157,7 @@ export const allocateBillDetailDel = params => {
     url: `/allocateBill/detail/delete/${params.id}`,
     data: {},
     method: 'get',
-    headers:{
+    headers: {
       'module': encodeURIComponent('删除')
     }
   })
@@ -168,7 +168,7 @@ export const allocateBillDetailDelAll = params => {
     url: `/allocateBill/detail/deleteAll/${params.sn}`,
     data: {},
     method: 'get',
-    headers:{
+    headers: {
       'module': encodeURIComponent('整单删除')
     }
   })
@@ -179,7 +179,7 @@ export const allocateBillDetailSave = params => {
     url: '/allocateBill/detail/save',
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('修改数量或费用归属部门')
     }
   })
@@ -187,14 +187,14 @@ export const allocateBillDetailSave = params => {
 // 调拨管理 详情  打印
 export const allocateBillDetailPrint = params => {
   const url = `/allocateBill/print/${params.printType}`
-  const mid = params.printType.indexOf('_TYPE')>=0 ? '调拨分类打印' : '调拨打印'
+  const mid = params.printType.indexOf('_TYPE') >= 0 ? '调拨分类打印' : '调拨打印'
   delete params.printType
   delete params.isPreview
   return axios.request({
     url: url,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent(mid)
     }
   })
@@ -231,7 +231,7 @@ export const allocateBillBatchInsert = params => {
     url: '/allocateBill/detail/batchInsert',
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('导入产品')
     }
   })
@@ -243,7 +243,7 @@ export const allocateBillFailExcel = (params) => {
     data: params,
     method: 'post',
     responseType: 'blob',
-    headers:{
+    headers: {
       'module': encodeURIComponent('导出错误项')
     }
   })
@@ -255,8 +255,8 @@ export const allocateBillDetailExcel = (params) => {
     data: params,
     method: 'post',
     responseType: 'blob',
-    headers:{
-      'module': encodeURIComponent(params.printType.indexOf('_TYPE')>=0?'调拨分类导出':'导出Excel')
+    headers: {
+      'module': encodeURIComponent(params.printType.indexOf('_TYPE') >= 0 ? '调拨分类导出' : '导出Excel')
     }
   })
 }
@@ -266,7 +266,7 @@ export const updatePrintState = params => {
     url: '/allocateBill/updatePrintState',
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('更改打印状态')
     }
   })
@@ -281,7 +281,22 @@ export const queryOverviewPage = (params) => {
     url: url,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
+      'module': encodeURIComponent('列表查询')
+    }
+  })
+}
+
+// 调拨  分页查询产品列表
+export const queryStockProductPage = (params) => {
+  const url = `/allocateBill/queryStockProductPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
       'module': encodeURIComponent('列表查询')
     }
   })

+ 32 - 17
src/api/allocateReturn.js

@@ -5,7 +5,7 @@ export const allocateReturnAudit = params => {
     url: '/allocateReturn/audit',
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('审核')
     }
   })
@@ -16,7 +16,7 @@ export const allocateReturnDelete = params => {
     url: `/allocateReturn/delete/${params.allocateReturnSn}`,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('删除')
     }
   })
@@ -27,7 +27,7 @@ export const allocateReturnCheckSubmit = params => {
     url: '/allocateReturn/check',
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('提交')
     }
   })
@@ -38,7 +38,7 @@ export const allocateReturnFinanceAudit = params => {
     url: '/allocateReturn/financeAudit',
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('退货确认')
     }
   })
@@ -49,7 +49,7 @@ export const allocateReturnExcel = params => {
     url: `/allocateReturn/excel/${params.allocateReturnSn}`,
     method: 'get',
     responseType: 'blob',
-    headers:{
+    headers: {
       'module': encodeURIComponent('导出excel')
     }
   })
@@ -61,7 +61,7 @@ export const allocateReturnPrint = params => {
     method: 'post',
     data: params,
     responseType: 'blob',
-    headers:{
+    headers: {
       'module': encodeURIComponent('打印')
     }
   })
@@ -82,7 +82,7 @@ export const allocateReturnQueryPage = (params) => {
     url: url,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('列表查询')
     }
   })
@@ -96,7 +96,7 @@ export const allocateReturnQueryConfirmPage = (params) => {
     url: url,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('列表查询')
     }
   })
@@ -107,7 +107,7 @@ export const allocateReturnSave = params => {
     url: '/allocateReturn/save',
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('新增')
     }
   })
@@ -118,7 +118,7 @@ export const allocateReturnSubmit = params => {
     url: '/allocateReturn/submit',
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('提交')
     }
   })
@@ -130,8 +130,8 @@ export const allocateReturnCheck = params => {
     url: `/allocReturnDetail/check/${params.allocateReturnSn}/${params.allocateCheckType}`,
     data: params.list,
     method: 'post',
-    headers:{
-      'module': encodeURIComponent(params.allocateCheckType == 'CUSTOM' ? '修改返库数量':'批量返库')
+    headers: {
+      'module': encodeURIComponent(params.allocateCheckType == 'CUSTOM' ? '修改返库数量' : '批量返库')
     }
   })
 }
@@ -142,7 +142,7 @@ export const allocReturnDetailDelete = params => {
     url: '/allocReturnDetail/delete',
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('删除')
     }
   })
@@ -153,7 +153,7 @@ export const allocReturnDetailInsert = params => {
     url: '/allocReturnDetail/insert',
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('添加')
     }
   })
@@ -164,7 +164,7 @@ export const allocReturnDetailInsertBatch = params => {
     url: '/allocReturnDetail/insertBatch',
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('批量添加')
     }
   })
@@ -178,7 +178,7 @@ export const allocReturnDetailQueryPage = (params) => {
     url: url,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('明细列表查询')
     }
   })
@@ -189,8 +189,23 @@ export const allocReturnDetailUpdate = params => {
     url: '/allocReturnDetail/update',
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('修改明细')
     }
   })
 }
+
+// 调拨退货  不抓单  选择产品分页列表
+export const queryStockProductPage = (params) => {
+  const url = `/allocateReturn/queryStockProductPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('列表查询')
+    }
+  })
+}

+ 71 - 0
src/api/dealer.js

@@ -11,6 +11,17 @@ export const dealerDetailBySn = (params) => {
     }
   })
 }
+// 查询商户类型
+export const dealerTypeTreeList = (params) => {
+  return axios({
+    url: `/dealerType/queryTree`,
+    data: params,
+    method: 'post',
+    headers:{
+      'module': encodeURIComponent('查询商户类型')
+    }
+  })
+}
 // 根据sn查找修改过后的经销商信息
 export const dealerFindUpdateInfoBySn = (params) => {
   return axios({
@@ -207,3 +218,63 @@ export const getDealerListInfo = (params) => {
     }
   })
 }
+
+// 经销商差价分配列表
+export const dealerUpsList = (params) => {
+  const url = `/dealerUps/queryList`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers:{
+      'module': encodeURIComponent('经销商差价设置列表')
+    }
+  })
+}
+
+// 经销商差价列表删除
+export const dealerUpsDelete = (params) => {
+  const url = `/dealerUps/delete`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers:{
+      'module': encodeURIComponent('经销商差价设置删除')
+    }
+  })
+}
+// 差价品类列表 
+export const dealerUpsPlTree = (params) => {
+  return axios({
+    url: `/dealerUps/queryWaitingData`,
+    data: params,
+    method: 'post',
+    headers:{
+      'module': encodeURIComponent('经销商差价设置品类树数据')
+    }
+  })
+}
+
+// 差价设置保存
+export const dealerUpsCreate = (params) => {
+  return axios({
+    url: `/dealerUps/create`,
+    data: params,
+    method: 'post',
+    headers:{
+      'module': encodeURIComponent('经销商差价设置保存')
+    }
+  })
+}
+// 修改
+export const dealerUpsUpdate = (params) => {
+  return axios({
+    url: `/dealerUps/update`,
+    data: params,
+    method: 'post',
+    headers:{
+      'module': encodeURIComponent('经销商差价设置编辑')
+    }
+  })
+}

+ 51 - 6
src/api/dealerScope.js

@@ -9,19 +9,19 @@ export const dealerScopeList = (params) => {
     url: url,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('列表查询')
     }
   })
 }
 //  经销权 列表 无分页
 export const dealerScopeQueryList = (params) => {
-  const mid = {'PRODUCT':'选择产品','BRAND':'选择品牌','CATEGORY':'选择产品分类'}
+  const mid = { 'PRODUCT': '选择产品', 'BRAND': '选择品牌', 'CATEGORY': '选择产品分类' }
   return axios({
     url: '/dealerScope/queryList',
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent(mid[params.goodsType])
     }
   })
@@ -32,7 +32,7 @@ export const dealerScopeSave = (params) => {
     url: '/dealerScope/addDealerScope',
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('新增')
     }
   })
@@ -42,7 +42,7 @@ export const dealerScopeDel = (params) => {
   return axios({
     url: `/dealerScope/deleteBySn/${params.sn}`,
     method: 'get',
-    headers:{
+    headers: {
       'module': encodeURIComponent('删除')
     }
   })
@@ -53,8 +53,53 @@ export const dealerScopeValidProduct = (params) => {
     url: '/dealerScope/validProductIsIncloude',
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('校验产品是否在品牌分类中')
     }
   })
 }
+
+// 获取选择品类列表数据   (所有产品的品牌+分类)
+export const queryWaitingData = (params) => {
+  return axios({
+    url: '/dealerScope/queryWaitingData',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('选择品类列表查询')
+    }
+  })
+}
+//  经销权  添加品类
+export const dealerScopeCreate = (params) => {
+  return axios({
+    url: '/dealerScope/create',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('新增品类')
+    }
+  })
+}
+//  经销权  修改价格级别
+export const dealerScopeModifyPriceLevel = (params) => {
+  return axios({
+    url: '/dealerScope/modifyPriceLevelBatch',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('修改价格级别')
+    }
+  })
+}
+// 经销权  删除选择品类
+export const dealerScopeDelete = (params) => {
+  return axios({
+    url: '/dealerScope/deleteBatch',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('删除')
+    }
+  })
+}

+ 30 - 6
src/api/reportData.js

@@ -854,9 +854,9 @@ export const sparePartsReturnReportExportDetail = (params) => {
   })
 }
 
-// 返利报
+// 订单差价
 export const rebateQueryList = (params) => {
-  const url = `/rebate/queryPage/${params.pageNo}/${params.pageSize}`
+  const url = `/report/productRebate/queryPage/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
   delete params.pageSize
   return axios({
@@ -870,16 +870,40 @@ export const rebateQueryList = (params) => {
 }
 // 合计
 export const rebateQueryCount = (params) => {
-  const url = `/rebate/queryCount`
+  const url = `/report/productRebate/queryCount`
   return axios({
     url: url,
     data: params,
     method: 'post'
   })
 }
-// 返利明细报表
+// 订单经销商差价表
+export const productRebateParentList = (params) => {
+  const url = `/report/productRebateParent/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('列表查询')
+    }
+  })
+}
+// 订单经销商差价表 统计
+export const productRebateParentCount = (params) => {
+  const url = `/report/productRebateParent/queryCount`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 产品差价表
 export const rebateDetailQueryList = (params) => {
-  const url = `/rebate/detail/queryPage/${params.pageNo}/${params.pageSize}`
+  const url = `/report/productRebateDetail/queryPage/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
   delete params.pageSize
   return axios({
@@ -893,7 +917,7 @@ export const rebateDetailQueryList = (params) => {
 }
 // 返利明细报表统计
 export const rebateDetailQueryCount = (params) => {
-  const url = `/rebate/detail/queryCount`
+  const url = `/report/productRebateDetail/queryCount`
   return axios({
     url: url,
     data: params,

+ 1 - 1
src/api/salesReturn.js

@@ -210,7 +210,7 @@ export const salesQueryByReturn = (params) => {
 
 // 可选产品列表
 export const queryDealerProductPage = (params) => {
-  const url = `/product/queryDealerPage/${params.pageNo}/${params.pageSize}`
+  const url = `/product/querySalesReturnPage/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
   delete params.pageSize
   return axios({

+ 12 - 11
src/api/stock.js

@@ -9,7 +9,7 @@ export const stockList = (params) => {
     url: url,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('列表查询')
     }
   })
@@ -29,7 +29,7 @@ export const stockExport = (params) => {
     data: params,
     method: 'post',
     responseType: 'blob',
-    headers:{
+    headers: {
       'module': encodeURIComponent('导出')
     }
   })
@@ -43,7 +43,7 @@ export const stockDetailList = (params) => {
     url: url,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('明细列表查询')
     }
   })
@@ -66,11 +66,12 @@ export const queryStockProductPage = (params) => {
     url: url,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('列表查询')
     }
   })
 }
+
 // 非经销商产品库存列表
 export const queryStockProductForOtherPage = (params) => {
   const url = `/stock/queryStockProductForOtherPage/${params.pageNo}/${params.pageSize}`
@@ -80,7 +81,7 @@ export const queryStockProductForOtherPage = (params) => {
     url: url,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('列表查询')
     }
   })
@@ -94,7 +95,7 @@ export const queryPromoProductPage = (params) => {
     url: url,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('列表查询')
     }
   })
@@ -109,7 +110,7 @@ export const stockFlowList = (params) => {
     url: url,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('列表查询')
     }
   })
@@ -132,7 +133,7 @@ export const stockWarnList = (params) => {
     url: url,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('列表查询')
     }
   })
@@ -143,7 +144,7 @@ export const stockWarnSaveBatch = (params) => {
     url: '/stock/updateStateBatch',
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('保存')
     }
   })
@@ -156,7 +157,7 @@ export const stockByProductSn = (params) => {
     url: url,
     data: params,
     method: 'post',
-    headers:{
+    headers: {
       'module': encodeURIComponent('库存查询')
     }
   })
@@ -168,7 +169,7 @@ export const stockFlowExport = (params) => {
     data: params,
     method: 'post',
     responseType: 'blob',
-    headers:{
+    headers: {
       'module': encodeURIComponent('导出')
     }
   })

+ 63 - 55
src/config/router.config.js

@@ -3014,7 +3014,6 @@ export const asyncRouterMap = [
                   title: '新增经销商',
                   icon: 'file-text',
                   hidden: true
-                  // permission: 'B_goodsManage_edit'
                 }
               },
               {
@@ -3025,19 +3024,28 @@ export const asyncRouterMap = [
                   title: '编辑经销商',
                   icon: 'file-text',
                   hidden: true
-                  // permission: 'B_goodsManage_edit'
                 }
               },
               {
-                path: 'permissionSetting/:sn',
+                path: 'permissionSetting/:sn/:name/:dealerLevel',
                 name: 'merchantInfoManagementSet',
-                component: () => import(/* webpackChunkName: "dealerManagement" */ '@/views/dealerManagement/merchantInfoManagement/permissionSetting.vue'),
+                component: () => import(/* webpackChunkName: "dealerManagement" */ '@/views/dealerManagement/merchantInfoManagement/permissionSettingNew.vue'),
                 meta: {
                   title: '经销权设置',
                   icon: 'file-text',
                   replaceTab: true,
                   hidden: true
-                  // permission: 'B_goodsManage_edit'
+                }
+              },
+              {
+                path: 'rebateBinding/:sn',
+                name: 'rebateBinding',
+                component: () => import(/* webpackChunkName: "dealerManagement" */ '@/views/dealerManagement/rebateBinding/list.vue'),
+                meta: {
+                  title: '差价设置',
+                  icon: 'file-text',
+                  replaceTab: true,
+                  hidden: true
                 }
               }
             ]
@@ -3067,56 +3075,56 @@ export const asyncRouterMap = [
               }
             ]
           },
-          {
-            path: '/dealerManagement/dealerRelationshipBinding',
-            redirect: '/dealerManagement/dealerRelationshipBinding/list',
-            name: 'dealerRelationshipBinding',
-            component: BlankLayout,
-            meta: {
-              title: '经销商关系绑定',
-              icon: 'share-alt',
-              permission: 'M_dealerRelationshipBindingList'
-            },
-            hideChildrenInMenu: true,
-            children: [
-              {
-                path: 'list',
-                name: 'dealerRelationshipBindingList',
-                component: () => import(/* webpackChunkName: "dealerManagement" */ '@/views/dealerManagement/dealerRelationshipBinding/list.vue'),
-                meta: {
-                  title: '经销商关系绑定列表',
-                  icon: 'share-alt',
-                  hidden: true,
-                  permission: 'M_dealerRelationshipBindingList'
-                }
-              }
-            ]
-          },
-          {
-            path: '/dealerManagement/rebateSettings',
-            redirect: '/dealerManagement/rebateSettings/list',
-            name: 'rebateSettings',
-            component: BlankLayout,
-            meta: {
-              title: '差价归属设置',
-              icon: 'stock',
-              permission: 'M_rebateSettingsList'
-            },
-            hideChildrenInMenu: true,
-            children: [
-              {
-                path: 'list',
-                name: 'rebateSettingsList',
-                component: () => import(/* webpackChunkName: "dealerManagement" */ '@/views/dealerManagement/rebateSettings/list.vue'),
-                meta: {
-                  title: '差价归属设置列表',
-                  icon: 'stock',
-                  hidden: true,
-                  permission: 'M_rebateSettingsList'
-                }
-              }
-            ]
-          },
+          // {
+          //   path: '/dealerManagement/dealerRelationshipBinding',
+          //   redirect: '/dealerManagement/dealerRelationshipBinding/list',
+          //   name: 'dealerRelationshipBinding',
+          //   component: BlankLayout,
+          //   meta: {
+          //     title: '经销商关系绑定',
+          //     icon: 'share-alt',
+          //     permission: 'M_dealerRelationshipBindingList'
+          //   },
+          //   hideChildrenInMenu: true,
+          //   children: [
+          //     {
+          //       path: 'list',
+          //       name: 'dealerRelationshipBindingList',
+          //       component: () => import(/* webpackChunkName: "dealerManagement" */ '@/views/dealerManagement/dealerRelationshipBinding/list.vue'),
+          //       meta: {
+          //         title: '经销商关系绑定列表',
+          //         icon: 'share-alt',
+          //         hidden: true,
+          //         permission: 'M_dealerRelationshipBindingList'
+          //       }
+          //     }
+          //   ]
+          // },
+          // {
+          //   path: '/dealerManagement/rebateSettings',
+          //   redirect: '/dealerManagement/rebateSettings/list',
+          //   name: 'rebateSettings',
+          //   component: BlankLayout,
+          //   meta: {
+          //     title: '差价归属设置',
+          //     icon: 'stock',
+          //     permission: 'M_rebateSettingsList'
+          //   },
+          //   hideChildrenInMenu: true,
+          //   children: [
+          //     {
+          //       path: 'list',
+          //       name: 'rebateSettingsList',
+          //       component: () => import(/* webpackChunkName: "dealerManagement" */ '@/views/dealerManagement/rebateSettings/list.vue'),
+          //       meta: {
+          //         title: '差价归属设置列表',
+          //         icon: 'stock',
+          //         hidden: true,
+          //         permission: 'M_rebateSettingsList'
+          //       }
+          //     }
+          //   ]
+          // },
           {
             path: '/dealerManagement/provincialWarehouseManagement',
             redirect: '/dealerManagement/provincialWarehouseManagement/list',

+ 2 - 1
src/views/allocationManagement/transferOut/detail.vue

@@ -257,6 +257,7 @@ export default {
         { title: '产品名称', dataIndex: 'productEntity.name', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '原厂编码', dataIndex: 'productEntity.origCode', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '单位', dataIndex: 'productEntity.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '价格级别', dataIndex: 'priceLevelDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '调出数量', dataIndex: 'qty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
       ]
       if (this.$hasPermissions('M_transferOut_detail_costPrice') || this.$hasPermissions('M_tfoPrint_detail_salesPrice') || this.$hasPermissions('M_mso_detail_costPrice')) { // 成本价权限
@@ -266,7 +267,7 @@ export default {
       if (this.$hasPermissions('M_transferOut_detail_salesPrice') || this.$hasPermissions('M_tfoPrint_detail_salesPrice') || this.$hasPermissions('M_mso_detail_salesPrice')) { //  售价权限
         const ind = this.$hasPermissions('M_transferOut_detail_costPrice') || this.$hasPermissions('M_tfoPrint_detail_costPrice') ? 6 : 5
         arr.splice(ind, 0, { title: '售价', dataIndex: 'price', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-        arr.splice(ind + 3, 0, { title: '售价小计', dataIndex: 'totalPrice', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.splice(ind + 4, 0, { title: '售价小计', dataIndex: 'totalPrice', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
       }
       arr.push({ title: '费用归属部门', dataIndex: 'departmentName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } })
       return arr

+ 41 - 6
src/views/allocationManagement/transferOut/edit.vue

@@ -145,6 +145,29 @@
           :defaultLoadData="false"
           :scroll="{ y: 300 }"
           bordered>
+          <!-- 售价 -->
+          <template slot="productPriceInfo" slot-scope="text, record">
+            <span v-if="record.powerFlag!=0">{{ (record.priceValue || record.priceValue==0) ? toThousands(record.priceValue):'--' }}</span>
+            <span v-else>
+              {{ record.priceLevel=='PROVINCE'?record.provincePrice:record.priceLevel=='CITY'?record.cityPrice:record.specialPrice }}
+            </span>
+          </template>
+          <!-- 价格级别 -->
+          <template slot="priceLevel" slot-scope="text, record, index">
+            <span v-if="!$hasPermissions('M_transferOut_edit_salesPrice')">--</span>
+            <div v-else>
+              <span v-if="record.powerFlag!=0">{{ record.priceLevelDictValue }}</span>
+              <v-select
+                v-else
+                style="width:90%;"
+                size="small"
+                code="PRICE_LEVEL"
+                v-model="record.priceLevel"
+                allowClear
+                placeholder="请选择价格级别"
+                @change="e => handlePriceLevel(e,index)"></v-select>
+            </div>
+          </template>
           <!-- 调出数量 -->
           <template slot="qty" slot-scope="text, record">
             <a-input-number
@@ -347,10 +370,10 @@ import printModal from './printModal.vue'
 import dsModal from './dsModal.vue'
 import commonModal from '@/views/common/commonModal.vue'
 import { printBase64Fun, exportExcel } from '@/libs/JGPrint.js'
-import { queryStockProductPage, queryStockProductForOtherPage } from '@/api/stock'
+import { queryStockProductForOtherPage } from '@/api/stock'
 import { productPriceInfo } from '@/api/product'
 import { departmentQueryList } from '@/api/expenseManagement'
-import { allocateBillDetailList, allocateBillDetailCount, allocateBillDetail, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillDetailPrint, allocateBillBatchInsert, allocateBillDetailExcel, updateBatchDepartment } from '@/api/allocateBill'
+import { allocateBillDetailList, allocateBillDetailCount, allocateBillDetail, allocateBillDetailSave, allocateBillSubmit, allocateBillDetailDel, allocateBillDetailDelAll, allocateBillDetailPrint, allocateBillBatchInsert, allocateBillDetailExcel, updateBatchDepartment, queryStockProductPage } from '@/api/allocateBill'
 
 export default {
   name: 'TransferOutEdit',
@@ -383,12 +406,14 @@ export default {
         const dealerLevel = this.dealerLevel == 'OTHER' ? undefined : this.dealerLevel
         const warehouseSn = this.basicInfoData.warehouseSn
         const fun = this.dealerLevel == 'OTHER' ? queryStockProductForOtherPage : queryStockProductPage
-        return fun(Object.assign(parameter, this.queryParam, { zeroQtyFlag: '0', dealerLevel: dealerLevel, warehouseSn: warehouseSn })).then(res => {
+        const dealerSnInfo = this.dealerLevel != 'OTHER' ? this.basicInfoData.dealerInfo.dealerSn : undefined
+        return fun(Object.assign(parameter, this.queryParam, { zeroQtyFlag: '0', dealerLevel: dealerLevel, warehouseSn: warehouseSn, dealerSn: dealerSnInfo })).then(res => {
           const 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
             data.list[i].qty = 1
+            data.list[i].priceValue = data.list[i].productPrice
           }
           this.loadDataSource = data.list || []
           this.disabled = false
@@ -440,6 +465,7 @@ export default {
         { title: '原厂编码', dataIndex: 'productOrigCode', width: '24%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         // { title: '成本价', dataIndex: 'lastStockCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         // { title: '售价', dataIndex: 'productPrice', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '价格级别', dataIndex: 'priceLevelDictValue', width: '10%', align: 'center', scopedSlots: { customRender: 'priceLevel' } },
         { title: '库存数量', dataIndex: 'currentStockQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '调出数量', scopedSlots: { customRender: 'qty' }, width: '6%', align: 'center' },
         { title: '单位', dataIndex: 'productUnit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
@@ -450,7 +476,7 @@ export default {
       }
       if (this.$hasPermissions('M_transferOut_edit_salesPrice')) { //  售价权限
         const ind = this.$hasPermissions('M_transferOut_edit_costPrice') ? 5 : 4
-        arr.splice(ind, 0, { title: '售价', dataIndex: 'productPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.splice(ind, 0, { title: '售价', dataIndex: 'productPrice', width: '6%', align: 'right', scopedSlots: { customRender: 'productPriceInfo' } })
       }
       return arr
     },
@@ -583,8 +609,13 @@ export default {
         price: isEdit ? row.price : row.productPrice,
         qty: row.qty, //  添加时调出数量默认为1
         productSn: row.productSn,
+        productBrandSn: row.productBrandSn,
         departmentSn: row.departmentSn,
-        departmentName: row.departmentName
+        departmentName: row.departmentName,
+        productTypeSn1: row.productTypeSn1,
+        productTypeSn2: row.productTypeSn2,
+        productTypeSn3: row.productTypeSn3,
+        priceLevel: row.priceLevel
       }
       if (isEdit) { // 编辑
         // 清空数量时,值应保持未清空前的值,因数量不可为空
@@ -649,6 +680,10 @@ export default {
         }
       })
     },
+    // 价格等级
+    handlePriceLevel (val, pos) {
+      this.loadDataSource[pos].productPrice = val == 'PROVINCE' ? this.loadDataSource[pos].provincePrice : val == 'CITY' ? this.loadDataSource[pos].cityPrice : this.loadDataSource[pos].specialPrice
+    },
     //  提交
     handleOpen () {
       if (this.localDataSource.length) {
@@ -682,7 +717,7 @@ export default {
       allocateBillDetail({ sn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {
           this.basicInfoData = res.data
-          if(!flag){
+          if (!flag) {
             this.resetSearchForm(0)
           }
         } else {

+ 146 - 145
src/views/allocationManagement/transferReturn/edit.vue

@@ -13,7 +13,7 @@
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <template slot="extra">
-          <print :params="{allocateReturnSn: allocateReturnSn || outBizSn}" :basicInfoData="basicInfoData" :disabled="localDataSource.length==0" @loading="spinning=true" @unloading="spinning=false"></print>
+          <print :params="{allocateReturnSn: allocateReturnSn}" :basicInfoData="basicInfoData" :disabled="localDataSource.length==0" @loading="spinning=true" @unloading="spinning=false"></print>
         </template>
       </a-page-header>
       <a-card size="small" :bordered="false" v-if="basicInfoData" class="allocateBillEdit-cont" v-show="showDetail">
@@ -51,160 +51,160 @@
       </a-card>
       <!-- 选择产品 -->
       <a-card size="small" title="选择产品" :bordered="false" class="allocateBillEdit-cont">
-            <!-- 筛选条件 -->
+        <!-- 筛选条件 -->
+        <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-item label="产品编码" prop="productCode">
+                  <a-input id="allocateBillEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="产品名称" prop="productName">
+                  <a-input id="allocateBillEdit-productName" v-model.trim="queryParam.productName" 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="storeTransferOutList-refresh">查询</a-button>
+                <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="storeTransferOutList-reset">重置</a-button>
+              </a-col>
+            </a-row>
+          </a-form>
+        </div>
+        <!-- 列表 -->
+        <s-table
+          class="sTable"
+          ref="table"
+          size="small"
+          index="0"
+          tableId="table1"
+          :rowKey="(record) => record.stockSn"
+          :columns="columns"
+          :customRow="handleClickRow"
+          :data="loadData"
+          :scroll="{ y: 300 }"
+          :defaultLoadData="false"
+          bordered>
+          <!-- 退货单价 -->
+          <template slot="returnPrice" slot-scope="text, record">
+            <div @dblclick.stop>
+              <a-input-number
+                size="small"
+                v-model="record.productPrice"
+                :precision="2"
+                :min="0"
+                :max="99999999"
+                placeholder="请输入"
+                style="width: 100%;" />
+            </div>
+          </template>
+          <!-- 退货数量 -->
+          <template slot="returnQty" slot-scope="text, record">
+            <div @dblclick.stop>
+              <a-input-number
+                size="small"
+                v-model="record.qty"
+                :precision="0"
+                :min="1"
+                :max="99999999"
+                placeholder="请输入"
+                style="width: 100%;" />
+            </div>
+          </template>
+          <!-- 操作 -->
+          <template slot="action" slot-scope="text, record">
+            <a-button
+              size="small"
+              type="link"
+              v-if="record.lastStockCost"
+              class="button-primary"
+              @click="handleAdd(record)"
+              id="allocateBillEdit-add-btn">添加</a-button>
+            <span v-else>--</span>
+          </template>
+        </s-table>
+      </a-card>
+      <!-- 已选产品 -->
+      <a-card size="small" title="已选产品" :bordered="false" class="allocateBillEdit-cont">
+        <!-- 总计 -->
+        <a-alert type="info" style="margin-bottom:10px">
+          <div slot="message">
+            退货总数量:<strong>{{ (basicInfoData&&(basicInfoData.totalQty || basicInfoData.totalQty==0)) ? basicInfoData.totalQty : '--' }}</strong> ;
+            <span>退货总金额:<strong>{{ (basicInfoData&&(basicInfoData.totalPrice || basicInfoData.totalPrice==0)) ? toThousands(basicInfoData.totalPrice) : '--' }}</strong>;</span>
+          </div>
+        </a-alert>
+        <!-- 筛选条件 -->
+        <a-row :gutter="15">
+          <a-col :span="17">
             <div class="table-page-search-wrapper">
-              <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+              <a-form layout="inline" @keyup.enter.native="$refs.chooseTable.refresh(true)">
                 <a-row :gutter="15">
-                  <a-col :md="6" :sm="24">
+                  <a-col :md="9" :sm="24">
                     <a-form-item label="产品编码" prop="productCode">
-                      <a-input id="allocateBillEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
+                      <a-input id="editGrap-productCode" v-model.trim="chooseQueryParam.productCode" placeholder="请输入产品编码" allowClear />
                     </a-form-item>
                   </a-col>
-                  <a-col :md="6" :sm="24">
+                  <a-col :md="9" :sm="24">
                     <a-form-item label="产品名称" prop="productName">
-                      <a-input id="allocateBillEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
+                      <a-input id="editGrap-productName" v-model.trim="chooseQueryParam.productName" 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="storeTransferOutList-refresh">查询</a-button>
-                    <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="storeTransferOutList-reset">重置</a-button>
+                    <a-button type="primary" @click="$refs.chooseTable.refresh(true)" :disabled="chooseDisabled" id="storeTransferOutList-refresh">查询</a-button>
+                    <a-button style="margin-left: 8px" @click="chooseResetSearchForm" :disabled="chooseDisabled" id="storeTransferOutList-reset">重置</a-button>
                   </a-col>
                 </a-row>
               </a-form>
             </div>
-            <!-- 列表 -->
-            <s-table
-              class="sTable"
-              ref="table"
+          </a-col>
+          <a-col :span="7" style="text-align: right;">
+            <!-- <a-button size="small" id="editGrap-import-btn" @click="openGuideModal=true">导入产品</a-button> -->
+            <!-- <a-button size="small" type="danger" style="margin-left: 5px" @click.stop="handleDel('', 'all')" id="chainTransferOutEdit-del-all-btn">整单删除</a-button> -->
+          </a-col>
+        </a-row>
+        <!-- 列表 -->
+        <s-table
+          class="sTable"
+          ref="chooseTable"
+          size="small"
+          index="1"
+          tableId="table2"
+          :rowKey="(record) => record.id"
+          :columns="chooseColumns"
+          :data="chooseLoadData"
+          :scroll="{ y: 300 }"
+          :defaultLoadData="false"
+          bordered>
+          <!-- 退货单价 -->
+          <template slot="returnPrice" slot-scope="text, record">
+            <a-input-number
               size="small"
-              index="0"
-              tableId="table1"
-              :rowKey="(record) => record.stockSn"
-              :columns="columns"
-              :customRow="handleClickRow"
-              :data="loadData"
-              :scroll="{ y: 300 }"
-              :defaultLoadData="false"
-              bordered>
-              <!-- 退货单价 -->
-              <template slot="returnPrice" slot-scope="text, record">
-                <div @dblclick.stop>
-                  <a-input-number
-                    size="small"
-                    v-model="record.productPrice"
-                    :precision="2"
-                    :min="0"
-                    :max="99999999"
-                    placeholder="请输入"
-                    style="width: 100%;" />
-                </div>
-              </template>
-              <!-- 退货数量 -->
-              <template slot="returnQty" slot-scope="text, record">
-                <div @dblclick.stop>
-                  <a-input-number
-                    size="small"
-                    v-model="record.qty"
-                    :precision="0"
-                    :min="1"
-                    :max="99999999"
-                    placeholder="请输入"
-                    style="width: 100%;" />
-                </div>
-              </template>
-              <!-- 操作 -->
-              <template slot="action" slot-scope="text, record">
-                <a-button
-                  size="small"
-                  type="link"
-                  v-if="record.lastStockCost"
-                  class="button-primary"
-                  @click="handleAdd(record)"
-                  id="allocateBillEdit-add-btn">添加</a-button>
-                <span v-else>--</span>
-              </template>
-            </s-table>
-      </a-card>
-      <!-- 已选产品 -->
-      <a-card size="small" title="已选产品" :bordered="false" class="allocateBillEdit-cont">
-            <!-- 总计 -->
-            <a-alert type="info" style="margin-bottom:10px">
-              <div slot="message">
-                退货总数量:<strong>{{ (basicInfoData&&(basicInfoData.totalQty || basicInfoData.totalQty==0)) ? basicInfoData.totalQty : '--' }}</strong> ;
-                <span>退货总金额:<strong>{{ (basicInfoData&&(basicInfoData.totalPrice || basicInfoData.totalPrice==0)) ? toThousands(basicInfoData.totalPrice) : '--' }}</strong>;</span>
-              </div>
-            </a-alert>
-            <!-- 筛选条件 -->
-            <a-row :gutter="15">
-              <a-col :span="17">
-                <div class="table-page-search-wrapper">
-                  <a-form layout="inline" @keyup.enter.native="$refs.chooseTable.refresh(true)">
-                    <a-row :gutter="15">
-                      <a-col :md="9" :sm="24">
-                        <a-form-item label="产品编码" prop="productCode">
-                          <a-input id="editGrap-productCode" v-model.trim="chooseQueryParam.productCode" placeholder="请输入产品编码" allowClear />
-                        </a-form-item>
-                      </a-col>
-                      <a-col :md="9" :sm="24">
-                        <a-form-item label="产品名称" prop="productName">
-                          <a-input id="editGrap-productName" v-model.trim="chooseQueryParam.productName" placeholder="请输入产品名称" allowClear />
-                        </a-form-item>
-                      </a-col>
-                      <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
-                        <a-button type="primary" @click="$refs.chooseTable.refresh(true)" :disabled="chooseDisabled" id="storeTransferOutList-refresh">查询</a-button>
-                        <a-button style="margin-left: 8px" @click="chooseResetSearchForm" :disabled="chooseDisabled" id="storeTransferOutList-reset">重置</a-button>
-                      </a-col>
-                    </a-row>
-                  </a-form>
-                </div>
-              </a-col>
-              <a-col :span="7" style="text-align: right;">
-                <!-- <a-button size="small" id="editGrap-import-btn" @click="openGuideModal=true">导入产品</a-button> -->
-                <!-- <a-button size="small" type="danger" style="margin-left: 5px" @click.stop="handleDel('', 'all')" id="chainTransferOutEdit-del-all-btn">整单删除</a-button> -->
-              </a-col>
-            </a-row>
-            <!-- 列表 -->
-            <s-table
-              class="sTable"
-              ref="chooseTable"
+              v-model="record.price"
+              :precision="2"
+              :min="0"
+              :max="99999999"
+              @blur="e => priceChange(e.target.value, record)"
+              placeholder="请输入"
+              style="width: 100%;" />
+          </template>
+          <!-- 退货数量 -->
+          <template slot="returnQty" slot-scope="text, record">
+            <a-input-number
               size="small"
-              index="1"
-              tableId="table2"
-              :rowKey="(record) => record.id"
-              :columns="chooseColumns"
-              :data="chooseLoadData"
-              :scroll="{ y: 300 }"
-              :defaultLoadData="false"
-              bordered>
-              <!-- 退货单价 -->
-              <template slot="returnPrice" slot-scope="text, record">
-                <a-input-number
-                  size="small"
-                  v-model="record.price"
-                  :precision="2"
-                  :min="0"
-                  :max="99999999"
-                  @blur="e => priceChange(e.target.value, record)"
-                  placeholder="请输入"
-                  style="width: 100%;" />
-              </template>
-              <!-- 退货数量 -->
-              <template slot="returnQty" slot-scope="text, record">
-                <a-input-number
-                  size="small"
-                  v-model="record.returnQty"
-                  :precision="0"
-                  :min="1"
-                  :max="99999999"
-                  @blur="e => qtyBlur(e.target.value, record)"
-                  placeholder="请输入"
-                  style="width: 100%;" />
-              </template>
-              <!-- 操作 -->
-              <template slot="action" slot-scope="text, record">
-                <a-button size="small" type="link" class="button-error" @click="handleDel(record)" id="allocateBillEdit-del-btn">删除</a-button>
-              </template>
-            </s-table>
+              v-model="record.returnQty"
+              :precision="0"
+              :min="1"
+              :max="99999999"
+              @blur="e => qtyBlur(e.target.value, record)"
+              placeholder="请输入"
+              style="width: 100%;" />
+          </template>
+          <!-- 操作 -->
+          <template slot="action" slot-scope="text, record">
+            <a-button size="small" type="link" class="button-error" @click="handleDel(record)" id="allocateBillEdit-del-btn">删除</a-button>
+          </template>
+        </s-table>
       </a-card>
     <!-- </a-spin> -->
     </div>
@@ -251,7 +251,6 @@ import { STable, VSelect } from '@/components'
 // import ImportGuideModal from './importGuideModal.vue'
 import print from './print.vue'
 import warehouse from '@/views/common/chooseWarehouse.js'
-import { queryStockProductPage } from '@/api/stock'
 import AllocateType from '@/views/common/allocateType.js'
 import {
   allocateReturnSave,
@@ -260,8 +259,8 @@ import {
   allocReturnDetailInsert,
   allocReturnDetailUpdate,
   allocateReturnSubmit,
-  allocReturnDetailDelete
-  // allocateBillBatchInsert
+  allocReturnDetailDelete,
+  queryStockProductPage
 } from '@/api/allocateReturn'
 
 export default {
@@ -291,7 +290,8 @@ export default {
         this.disabled = true
         const dealerLevel = this.dealerLevel == 'OTHER' ? undefined : this.dealerLevel
         const warehouseSn = this.basicInfoData.warehouseSn
-        return queryStockProductPage(Object.assign(parameter, this.queryParam, { dealerLevel: dealerLevel == 0 ? '' : dealerLevel, warehouseSn: warehouseSn })).then(res => {
+        const dealerSnInfo = this.dealerLevel != 'OTHER' ? this.basicInfoData.dealerEntity.dealerSn : undefined
+        return queryStockProductPage(Object.assign(parameter, this.queryParam, { dealerLevel: dealerLevel == 0 ? '' : dealerLevel, warehouseSn: warehouseSn, dealerSn: dealerSnInfo })).then(res => {
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
@@ -338,7 +338,8 @@ export default {
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
         { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'left', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'productName', align: 'left', width: '29%', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '单位', dataIndex: 'productUnit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '单位', dataIndex: 'productUnit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '价格级别', dataIndex: 'priceLevelDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '退货单价', scopedSlots: { customRender: 'returnPrice' }, width: '10%', align: 'right' },
         { title: '退货数量', scopedSlots: { customRender: 'returnQty' }, width: '10%', align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }

+ 1 - 1
src/views/allocationManagement/transferReturn/list.vue

@@ -161,7 +161,7 @@ import { STable, VSelect } from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
 import rangeDate from '@/views/common/rangeDate.vue'
 import auditModal from '@/views/common/auditModal.vue'
-import { allocateReturnQueryPage, allocateReturnAudit, allocateReturnDelete, allocateReturnExport } from '@/api/allocateReturn'
+import { allocateReturnQueryPage, allocateReturnAudit, allocateReturnDelete } from '@/api/allocateReturn'
 import AllocateType from '@/views/common/allocateType.js'
 import warehouse from '@/views/common/chooseWarehouse.js'
 import customerService from '@/views/common/customerService'

+ 1 - 1
src/views/allocationManagement/transfersPrint/list.vue

@@ -135,7 +135,7 @@
           <div slot="costTitle">
             <a-tooltip placement="top">
               <template slot="title">
-                当调拨对象是经销商时,如果收货客户名称不为空,则按照收货客户的价格级别计算得到
+                当调拨对象是经销商时,如果收货客户名称不为空,则按照收货客户的开单金额(授权价+商户级别价),有经销权则使用授权价,没有经销权则使用商户级别价
               </template>
               <span style="margin-right: 5px;">实际总售价</span> <a-icon type="question-circle" />
             </a-tooltip>

+ 20 - 8
src/views/common/chooseDealer.vue

@@ -11,7 +11,7 @@
           </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>
+              <dealerType id="chooseDealer-dealerType" v-model="dealerType" changeOnSelect @change="getDealerType" allowClear></dealerType>
             </a-form-item>
           </a-col>
           <a-col :md="8" :sm="24">
@@ -88,10 +88,11 @@ import { STable, VSelect } from '@/components'
 import AreaList from '@/views/common/areaList.js'
 import { queryDealerPageList } from '@/api/dealer'
 import subarea from '@/views/common/subarea.js'
+import dealerType from '@/views/common/dealerType.js'
 export default {
   name: 'ChooseDealer',
   mixins: [commonMixin],
-  components: { STable, VSelect, subarea, AreaList },
+  components: { STable, VSelect, subarea, AreaList, dealerType },
   props: {
     pageType: {
       type: String,
@@ -107,9 +108,11 @@ export default {
   data () {
     return {
       spinning: false,
+      dealerType: [],
       queryParam: { //  查询条件
         nameLike: '',
-        dealerType: null,
+        dealerType1: undefined, //  商户类型
+        dealerType2: undefined, //  商户类型
         dealerLevel: null,
         auditState: undefined,
         provinceSn: undefined,
@@ -134,6 +137,9 @@ export default {
             const no = 0
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
+              if (data.list[i].dealerTypeName1) {
+                data.list[i].dealerTypeName = data.list[i].dealerTypeName1 + '>' + data.list[i].dealerTypeName2
+              }
             }
           }
           this.spinning = false
@@ -149,16 +155,16 @@ export default {
       const arr = [
         { 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: 'dealerTypeName', width: '25%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '商户级别', dataIndex: 'dealerLevelDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
       ]
       if (_this.pageType == 'viewDealers') {
         arr.splice(4, 0, { title: '审核状态', dataIndex: 'auditStateDictValue', width: '20%', align: 'center', customRender: function (text) { return text || '--' } })
-        arr.splice(5, 0, { title: '当前所属区域', scopedSlots: { customRender: 'areas' }, width: '30%', align: 'center' })
+        arr.splice(5, 0, { title: '当前所属区域', scopedSlots: { customRender: 'areas' }, width: '20%', align: 'center' })
         arr.splice(6, 0, { title: '操作', scopedSlots: { customRender: 'action' }, width: '20%', align: 'center' })
       } else {
-        arr.splice(4, 0, { title: '所在区域', dataIndex: 'subareaArea.subareaName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } })
-        arr.splice(5, 0, { title: '所在分区', dataIndex: 'subareaArea.subareaAreaName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } })
+        arr.splice(4, 0, { title: '所在区域', dataIndex: 'subareaArea.subareaName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } })
+        arr.splice(5, 0, { title: '所在分区', dataIndex: 'subareaArea.subareaAreaName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } })
       }
       return arr
     },
@@ -171,6 +177,10 @@ export default {
     rowSelectionFun (obj) {
       this.rowSelectionInfo = obj || null
     },
+    getDealerType (v, o) {
+      this.queryParam.dealerType1 = v[0]
+      this.queryParam.dealerType2 = v[1]
+    },
     areaChange (val) {
       this.queryParam.provinceSn = val[0] ? val[0] : ''
       this.queryParam.citySn = val[1] ? val[1] : ''
@@ -187,9 +197,11 @@ export default {
     },
     //  重置
     resetSearchForm () {
+      this.dealerType = []
       this.queryParam = {
         nameLike: '',
-        dealerType: null,
+        dealerType1: undefined, //  商户类型
+        dealerType2: undefined, //  商户类型
         dealerLevel: null,
         auditState: undefined,
         provinceSn: undefined,

+ 15 - 1
src/views/common/custList.vue

@@ -47,6 +47,16 @@ export default {
     dealerLevel: { // 商户级别
       type: String,
       default: undefined
+    },
+    // 过滤该类别1
+    notDealerType: {
+      type: Array,
+      default: function () { return [] }
+    },
+    // 过滤该sn
+    notDealerSn: {
+      type: Array,
+      default: function () { return [] }
     }
   },
   data () {
@@ -82,7 +92,11 @@ export default {
         if (fetchId !== this.lastFetchId) {
           return
         }
-        this.data = res.data && res.data.list ? res.data.list : []
+        const list = res.data && res.data.list ? res.data.list : []
+        const notSn = []
+        console.log(this.notDealerSn)
+        this.notDealerSn.filter(item => !!item).map(item => { notSn.push(item.parentDealerSn) })
+        this.data = list.filter(item => !notSn.includes(item.dealerSn)).filter(item => item.dealerLevel && !this.notDealerType.includes(item.dealerLevel))
         this.fetching = false
       })
     },

+ 98 - 0
src/views/common/dealerType.js

@@ -0,0 +1,98 @@
+import { dealerTypeTreeList } from '@/api/dealer.js'
+const AllocateType = {
+  template: `
+      <a-cascader
+        :value="defaultVal"
+        :allowClear="allowClear"
+        :change-on-select="changeOnSelect"
+        @change="handleChange"
+        :options="list"
+        expand-trigger="hover"
+        :placeholder="placeholder"
+        :id="id"
+        :fieldNames="{ label: 'name', value: 'code', children: 'childrenList' }"/>
+    `,
+  props: {
+    value: {
+      type: Array,
+      defatut: function(){
+        return []
+      }
+    },
+    id: {
+      type: String,
+      default: ''
+    },
+    placeholder:{
+      type: String,
+      default: '请选择商户类型'
+    },
+    changeOnSelect:{
+      type: Boolean,
+      default: false
+    },
+    allowClear:{
+      type: Boolean,
+      default: true
+    },
+    level:{
+      type: [String,Number],
+      default: ''
+    }
+  },
+  data() {
+    return {
+      defaultVal: this.value,
+      list: []
+    };
+  },
+  mounted() {
+    this.getTree()
+  },
+  watch: {
+    value(newValue, oldValue) {
+      this.defaultVal = newValue
+    }
+  },
+  methods: {
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    },
+    handleChange(value,opts) {
+      this.defaultVal = value;
+      this.$emit('input', value);
+      this.$emit('change', value,opts);
+    },
+    //  价格类型
+    getTree () {
+      dealerTypeTreeList({}).then(res => {
+        console.log(res)
+        if (res.status == 200) {
+          if(this.level){
+            this.list = this.getBylevel(res.data)
+          }else{
+            this.list = res.data
+          }
+        } else {
+          this.list = []
+        }
+      })
+    },
+    getBylevel(data){
+      const ret = []
+      // 显示一级分类
+      if(this.level == 1){
+        data.map(item => {
+          if(item.childrenList){
+            delete item.childrenList
+          }
+        })
+      }
+      return data
+    }
+  },
+};
+
+export default AllocateType

+ 17 - 5
src/views/dealerManagement/businessOwnerSettings/chooseDealer.vue

@@ -11,7 +11,7 @@
           </a-col>
           <a-col :md="8" :sm="24">
             <a-form-item label="商户类型">
-              <v-select code="DEALER_TYPE" id="chooseDealer-dealerType" v-model="queryParam.dealer.dealerType" allowClear placeholder="请选择商户类型"></v-select>
+              <dealerType id="chooseDealer-dealerType" changeOnSelect v-model="dealerType" @change="getDealerType" allowClear></dealertype>
             </a-form-item>
           </a-col>
           <a-col :md="8" :sm="24">
@@ -88,10 +88,11 @@ import { STable, VSelect } from '@/components'
 import AreaList from '@/views/common/areaList.js'
 import { bizuserScopeQueryDealer } from '@/api/bizuser'
 import subarea from '@/views/common/subarea.js'
+import dealerType from '@/views/common/dealerType.js'
 export default {
   name: 'ChooseDealer',
   mixins: [commonMixin],
-  components: { STable, VSelect, subarea, AreaList },
+  components: { STable, VSelect, subarea, AreaList, dealerType },
   props: {
     pageType: {
       type: String,
@@ -107,10 +108,12 @@ export default {
   data () {
     return {
       spinning: false,
+      dealerType: [],
       queryParam: { //  查询条件
         dealer: {
           nameLike: '',
-          dealerType: null,
+          dealerType1: undefined, //  商户类型
+          dealerType2: undefined, //  商户类型
           dealerLevel: null
         },
         auditState: undefined,
@@ -140,6 +143,9 @@ export default {
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
               data.list[i].dealerSn = data.list[i].dealer.dealerSn
+              if (data.list[i].dealer.dealerTypeName1) {
+                data.list[i].dealerTypeName = data.list[i].dealer.dealerTypeName1 + '>' + data.list[i].dealer.dealerTypeName2
+              }
               if (!_this.pageType && _this.chooseInfo && _this.chooseInfo.length > 0) {
                 // 回显选中数据
                 const flag = _this.chooseInfo.includes(data.list[i].dealer.dealerSn)
@@ -166,7 +172,7 @@ export default {
       const arr = [
         { title: '经销商名称', dataIndex: 'dealer.dealerName', width: '30%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '商户别名', dataIndex: 'dealer.dealerAlias', align: 'left', width: '30%', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '商户类型', dataIndex: 'dealer.dealerTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '商户类型', dataIndex: 'dealerTypeName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '商户级别', dataIndex: 'dealer.dealerLevelDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
       ]
       if (_this.pageType == 'viewDealers') {
@@ -188,6 +194,10 @@ export default {
     rowSelectionFun (obj) {
       this.rowSelectionInfo = obj || null
     },
+    getDealerType (v, o) {
+      this.queryParam.dealer.dealerType1 = v[0]
+      this.queryParam.dealer.dealerType2 = v[1]
+    },
     areaChange (val) {
       this.queryParam.provinceSn = val[0] ? val[0] : ''
       this.queryParam.citySn = val[1] ? val[1] : ''
@@ -203,10 +213,12 @@ export default {
     },
     //  重置
     resetSearchForm () {
+      this.dealerType = []
       this.queryParam = {
         dealer: {
           nameLike: '',
-          dealerType: null,
+          dealerType1: undefined, //  商户类型
+          dealerType2: undefined, //  商户类型
           dealerLevel: null
         },
         auditState: undefined,

+ 21 - 9
src/views/dealerManagement/marketingDivisionSetNew/viewDealers.vue

@@ -21,7 +21,7 @@
               </a-col>
               <a-col :md="8" :sm="24">
                 <a-form-item label="商户类型">
-                  <v-select code="DEALER_TYPE" id="viewDealers-dealerType" v-model="queryParam.dealer.dealerType" allowClear placeholder="请选择商户类型"></v-select>
+                  <dealerType id="viewDealers-dealerType" changeOnSelect v-model="dealerType" @change="getDealerType" allowClear></dealertype>
                 </a-form-item>
               </a-col>
               <a-col :md="8" :sm="24">
@@ -111,10 +111,11 @@ import { STable, VSelect } from '@/components'
 import chooseDealer from '@/views/common/chooseDealer.vue'
 import AreaList from '@/views/common/areaList.js'
 import { Empty } from 'ant-design-vue'
+import dealerType from '@/views/common/dealerType.js'
 import { queryPageAreaDealer, batchBindDealer, bindDealer, deleteBindDealer } from '@/api/subarea'
 export default {
   mixins: [commonMixin],
-  components: { STable, VSelect, chooseDealer, AreaList },
+  components: { STable, VSelect, chooseDealer, AreaList, dealerType },
   props: {
     showModal: {
       type: Boolean,
@@ -150,10 +151,12 @@ export default {
       visible: this.showModal,
       openAddDealer: false,
       flag: true,
+      dealerType: [],
       queryParam: { //  查询条件
         dealer: {
           nameLike: '',
-          dealerType: null,
+          dealerType1: undefined, //  商户类型
+          dealerType2: undefined, //  商户类型
           dealerLevel: null,
           auditState: undefined,
           provinceSn: undefined,
@@ -167,9 +170,9 @@ export default {
       disabled: false,
       tableHeight: 0,
       columns: [
-        { title: '经销商名称', dataIndex: 'dealer.dealerName', width: '30%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '商户别名', dataIndex: 'dealer.dealerAlias', width: '30%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '商户类型', dataIndex: 'dealer.dealerTypeDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '经销商名称', dataIndex: 'dealer.dealerName', width: '25%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '商户别名', dataIndex: 'dealer.dealerAlias', width: '25%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '商户类型', dataIndex: 'dealerTypeName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '商户级别', dataIndex: 'dealer.dealerLevelDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '审核状态', dataIndex: 'dealer.auditStateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
@@ -182,8 +185,11 @@ export default {
           if (res.status == 200) {
             data = res.data
             const no = 0
-            for (var i = 0; i < data.length; i++) {
-              data[i].no = no + i + 1
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+              if (data.list[i].dealer.dealerTypeName1) {
+                data.list[i].dealerTypeName = data.list[i].dealer.dealerTypeName1 + '>' + data.list[i].dealer.dealerTypeName2
+              }
             }
           }
           this.disabled = false
@@ -195,6 +201,10 @@ export default {
     }
   },
   methods: {
+    getDealerType (v, o) {
+      this.queryParam.dealer.dealerType1 = v[0]
+      this.queryParam.dealer.dealerType2 = v[1]
+    },
     // 绑定
     hanldAdd (row) {
       console.log(row)
@@ -243,10 +253,12 @@ export default {
       }
     },
     resetData () {
+      this.dealerType = []
       this.queryParam = {
         dealer: {
           nameLike: '',
-          dealerType: null,
+          dealerType1: undefined, //  商户类型
+          dealerType2: undefined, //  商户类型
           dealerLevel: null,
           auditState: undefined,
           provinceSn: undefined,

+ 329 - 0
src/views/dealerManagement/merchantInfoManagement/chooseTypeModal.vue

@@ -0,0 +1,329 @@
+<template>
+  <a-modal
+    centered
+    class="chooseType-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="选择品类"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="960">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 表单 -->
+      <a-form-model
+        ref="ruleForm"
+        :model="form"
+        :rules="rules"
+        :label-col="formItemLayout.labelCol"
+        :wrapper-col="formItemLayout.wrapperCol"
+      >
+        <a-form-model-item label="价格级别" prop="priceLevel">
+          <v-select
+            code="PRICE_LEVEL"
+            :notIn="notArr"
+            style="width: 70%;"
+            id="productPriceLevel-level"
+            v-model="form.priceLevel"
+            allowClear
+            :disabled="notArrFlag"
+            placeholder="请选择价格级别"></v-select>
+        </a-form-model-item>
+        <a-form-model-item label="添加品类" prop="typeVal">
+          <span v-for="(con,i) in filterList" :key="con.id" >
+            <a-checkbox :checked="con.checked" @change="e=>onChangeType(e.target.checked,i)" v-show="con.id!=4">
+              {{ con.name }}
+            </a-checkbox>
+            <a-checkbox :checked="con.checked" @change="e=>onChangeType(e.target.checked,i)" v-show="con.id==4&&disabledList.length==0">
+              <a-tooltip placement="rightTop">
+                <template slot="title">
+                  <span>选择全品类后,未来新加入的品类也将自动默认为已选择状态,无需再次手动操作。</span>
+                </template>
+                <span>{{ con.name }}</span>
+                <a-icon type="question-circle" style="margin-left:5px;" />
+              </a-tooltip>
+            </a-checkbox>
+          </span>
+        </a-form-model-item>
+        <div class="typeListBox" v-show="form.typeVal!=4">
+          <a-tree
+            v-model="checkedList"
+            checkable
+            :auto-expand-parent="autoExpandParent"
+            :tree-data="treeData"
+            :replaceFields="replaceObj"
+            :checkStrictly="true"
+            @check="onCheck"
+          />
+        </div>
+      </a-form-model>
+      <div class="btn-cont">
+        <a-button id="chooseType-modal-back" @click="isShow = false" >取消</a-button>
+        <a-button type="primary" style="margin-left: 15px;" id="chooseType-modal-save" @click="handleSave">保存</a-button>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { dealerScopeCreate, queryWaitingData, dealerScopeQueryList } from '@/api/dealerScope'
+// import chooseTypeList from './chooseTypeList.vue'
+import { VSelect } from '@/components'
+export default {
+  name: 'ChooseTypeModal',
+  components: { VSelect },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      spinning: false,
+      formItemLayout: {
+        labelCol: { span: 3 },
+        wrapperCol: { span: 20 }
+      },
+      form: {
+        priceLevel: undefined, // 价格级别
+        typeVal: '0'
+      },
+      rules: {
+        priceLevel: [
+          { required: true, message: '请选择价格级别', trigger: 'change' }
+        ],
+        typeVal: [
+          { required: true, message: '请选择产品品类', trigger: 'change' }
+        ]
+      },
+      notArr: [], // 特约经销商  禁用选择
+      notArrFlag: false,
+      treeData: [], // 品牌分类数据
+      checkedList: [],
+      autoExpandParent: false, // 是否自动展开父节点
+      replaceObj: {
+        children: 'sonList', title: 'name', key: 'sn'
+      },
+      disabledList: [], // 已选过禁用调的品类数据
+      filterList: [{ id: '1', name: '全选', checked: false }, { id: '2', name: '自主品牌', checked: false }, { id: '3', name: '代理品牌', checked: false }, { id: '4', name: '全品类', checked: false }],
+      allBarndSnList: [],
+      ownBarndSnList: [],
+      agentBarndSnList: []
+    }
+  },
+  methods: {
+    onChangeType (val, pos) {
+      this.filterList.map(item => item.checked = false)
+      this.filterList[pos].checked = val
+      // 选择全品类   隐藏选择品类数据
+      this.form.typeVal = '0'
+      if (pos === 3 && val) {
+        this.form.typeVal = this.filterList[pos].id
+      }
+      this.checkedList = []
+      // 全选
+      if (pos === 0 && val) {
+        this.checkedList = this.allBarndSnList
+      }
+      // 自主
+      if (pos === 1 && val) {
+        this.checkedList = this.ownBarndSnList
+      }
+      if (pos === 2 && val) {
+        this.checkedList = this.agentBarndSnList
+      }
+    },
+    // 获取品牌sn
+    getLevel1Data () {
+      // 全选
+      const allBarndSn = []; const ownBarndSn = []; const agentBarndSn = []
+      this.treeData.forEach(con => {
+        allBarndSn.push(con.sn)
+        if (con.productBrandType === '1') {
+          ownBarndSn.push(con.sn)
+        }
+        if (con.productBrandType === '2') {
+          agentBarndSn.push(con.sn)
+        }
+      })
+      // 全选
+      this.allBarndSnList = allBarndSn
+      // 自主品牌
+      this.ownBarndSnList = ownBarndSn
+      // 代理品牌
+      this.agentBarndSnList = agentBarndSn
+    },
+    //  保存
+    handleSave () {
+      const _this = this
+      _this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const formData = JSON.parse(JSON.stringify(_this.form))
+          if (formData.typeVal != '4') {
+            let checkedArr = _this.changeCheckedList()
+            if (checkedArr.length == 0) {
+              _this.$message.warning('请添加品类!')
+              return
+            }
+            if (_this.disabledList.length > 0) {
+              checkedArr = checkedArr.filter(items => {
+                if (!_this.disabledList.includes(items)) return items
+              })
+              if (checkedArr.length == 0) {
+                _this.$message.warning('勾选的品牌已存在,请重新勾选!!')
+                return
+              }
+            }
+            const arr = []
+            checkedArr.forEach(item => {
+              const newArr = item.split('_')
+              arr.push({
+                productBrandSn: newArr[2],
+                productTypeSn1: newArr[4] ? newArr[4] : undefined,
+                productTypeSn2: newArr[6] ? newArr[6] : undefined,
+                productTypeSn3: newArr[8] ? newArr[8] : undefined
+              })
+            })
+            formData.scopeList = arr
+          } else {
+            formData.scopeList = []
+          }
+          formData.dealerSn = _this.$route.params.sn
+          _this.spinning = true
+          delete formData.typeVal
+          dealerScopeCreate(formData).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$emit('ok')
+              _this.isShow = false
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
+        } else {
+          return false
+        }
+      })
+    },
+    getDataList () {
+      const _this = this
+      queryWaitingData({}).then(res => {
+        if (res.status == 200) {
+          if (_this.disabledList && _this.disabledList.length > 0) {
+            const newTreeData = _this.resetDisabledList(res.data, _this.disabledList)
+            _this.treeData = newTreeData
+          } else {
+            _this.treeData = res.data
+          }
+          _this.getLevel1Data()
+        }
+        _this.spinning = false
+      })
+    },
+    async getDisabledList () {
+      const res = await dealerScopeQueryList({ dealerSn: this.$route.params.sn })
+      // 重组数据
+      if (res.status === '200') {
+        const disabledList = res.data.map(item => {
+          return '-1_1_' + item.productBrandSn + (item.productTypeSn1 ? '_2_' + item.productTypeSn1 : '') + (item.productTypeSn2 ? '_3_' + item.productTypeSn2 : '') + (item.productTypeSn3 ? '_4_' + item.productTypeSn3 : '')
+        })
+        this.disabledList = disabledList
+        this.getDataList()
+      }
+    },
+    resetDisabledList (tree, arr) {
+      // 遍历树节点
+      function traverse (node) {
+        // 检查当前节点的 key 是否在 arr 中
+        if (arr.includes(node.sn)) {
+          // 如果在,则添加 disabled 属性
+          node.disabled = true
+        }
+        // 如果节点有子节点,则递归遍历子节点
+        if (node.sonList) {
+          node.sonList.forEach(child => traverse(child))
+        }
+      }
+      // 从树的根节点开始遍历
+      tree.forEach(node => traverse(node))
+      // 返回修改后的树
+      return tree
+    },
+    onCheck (checkedKeys) {
+      this.checkedList = checkedKeys.checked
+      this.filterList[0].checked = this.checkedList.length === this.allBarndSnList.length
+      this.filterList[1].checked = this.checkedList.length === this.ownBarndSnList.length
+      this.filterList[2].checked = this.checkedList.length === this.agentBarndSnList.length
+    },
+    changeCheckedList () {
+      const ret = []
+      this.checkedList.forEach((item, index) => {
+        var flag = true
+        this.checkedList.forEach(con => {
+          if (con.includes(item + '_')) {
+            flag = false
+          }
+        })
+        if (flag) {
+          ret.push(item)
+        }
+      })
+
+      return ret
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$refs.ruleForm.resetFields()
+        this.checkedList = []
+        this.filterList.map(item => item.checked = false)
+        this.$emit('close')
+      } else {
+        // 特约经销商   价格级别不能修改  省、市经销商时,不能选择特约价
+        if (this.$route.params.dealerLevel === 'SPECIAL') {
+          this.form.priceLevel = 'SPECIAL'
+          this.notArrFlag = true
+        } else {
+          this.notArr = ['SPECIAL']
+        }
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .chooseType-modal{
+    .typeListBox{
+      padding:0 30px;
+      max-height: 500px;
+      overflow-y:scroll;
+    }
+    .ant-modal-body {
+      padding: 40px 40px 24px;
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 35px 0 10px;
+    }
+  }
+  .has-error .ant-form-explain, .has-error .ant-form-split{
+    margin-top:9px;
+  }
+  .ant-tree{
+    display:flex;
+    justify-content: space-between;
+    flex-wrap: wrap;
+  }
+  /deep/.ant-tree li{
+    width: 33% !important;
+  }
+</style>

+ 1 - 1
src/views/dealerManagement/merchantInfoManagement/detailModal.vue

@@ -14,7 +14,7 @@
           <a-descriptions :column="2" bordered size="small">
             <a-descriptions-item label="经销商名称">{{ form&&form.dealerName ? form.dealerName : '--' }}</a-descriptions-item>
             <a-descriptions-item label="经销商别名">{{ form&&form.dealerAlias ? form.dealerAlias : '--' }}</a-descriptions-item>
-            <a-descriptions-item label="商户类型">{{ form&&form.dealerTypeDictValue ? form.dealerTypeDictValue : '--' }}</a-descriptions-item>
+            <a-descriptions-item label="商户类型">{{ form&&form.dealerTypeName1 ? form.dealerTypeName1+'>'+form.dealerTypeName2 : '--' }}</a-descriptions-item>
             <a-descriptions-item label="联系人1">{{ form&&form.contact ? form.contact : '--' }}</a-descriptions-item>
             <a-descriptions-item label="联系手机1">{{ form&&form.contactMobile ? form.contactMobile : '--' }}</a-descriptions-item>
             <a-descriptions-item label="联系角色1">{{ form&&form.contactRole ? form.contactRole : '--' }}</a-descriptions-item>

+ 19 - 10
src/views/dealerManagement/merchantInfoManagement/edit.vue

@@ -30,13 +30,12 @@
                   </a-form-model-item>
                 </a-col>
                 <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
-                  <a-form-model-item label="商户类型" prop="dealerType">
-                    <v-select
-                      code="DEALER_TYPE"
+                  <a-form-model-item label="商户类型" prop="dealerType1">
+                    <dealerType
                       id="merchantInfoManagementEdit-dealerType"
-                      v-model="form.dealerType"
-                      allowClear
-                      placeholder="请选择商户类型"></v-select>
+                      v-model="dealerType"
+                      @change="getDealerType"
+                      allowClear></dealertype>
                   </a-form-model-item>
                 </a-col>
                 <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
@@ -413,13 +412,14 @@
 import { commonMixin } from '@/utils/mixin'
 import { getArea } from '@/api/data'
 import { VSelect } from '@/components'
+import dealerType from '@/views/common/dealerType.js'
 import { dealerSave, dealerFindUpdateInfoBySn } from '@/api/dealer'
 import chooseWarehouse from '@/views/common/chooseWarehouse'
 import moment from 'moment'
 export default {
   name: 'MerchantInfoManagementEdit',
   mixins: [commonMixin],
-  components: { VSelect, chooseWarehouse },
+  components: { VSelect, chooseWarehouse, dealerType },
   data () {
     return {
       spinning: false,
@@ -431,10 +431,12 @@ export default {
           span: 16
         }
       },
+      dealerType: [],
       form: {
         dealerName: '',
         dealerAlias: '',
-        dealerType: undefined,
+        dealerType1: undefined,
+        dealerType2: undefined,
         contact: '',
         contactMobile: '',
         provinceSn: undefined,
@@ -481,7 +483,7 @@ export default {
         dealerAlias: [
           { required: true, message: '请输入经销商别名', trigger: 'change' }
         ],
-        dealerType: [
+        dealerType1: [
           { required: true, message: '请选择商户类型', trigger: 'change' }
         ],
         contact: [
@@ -544,13 +546,16 @@ export default {
   methods: {
     bankAccountChange (e) {
       const { value } = e.target
-      console.log(value, value.replace(/\s*/g, ''))
       this.form.tradeBankAccount = value.replace(/\s*/g, '')
     },
     // 不可选日期
     disabledDate (date, dateStrings) {
       return date && date.valueOf() > Date.now()
     },
+    getDealerType (v, o) {
+      this.form.dealerType1 = v[0]
+      this.form.dealerType2 = v[1]
+    },
     // 详情编辑
     getDetail () {
       this.spinning = true
@@ -558,7 +563,11 @@ export default {
         if (res.status == 200) {
           this.detailData = res.data
           this.form = Object.assign(this.form, res.data)
+          delete this.form.dealerType
           this.form.isShowSpecialPrice = Number(this.form.isShowSpecialPrice)
+          if (this.form.dealerType1) {
+            this.dealerType = [this.form.dealerType1, this.form.dealerType2]
+          }
           if (this.form.provinceSn) {
             this.getArea('city', this.form.provinceSn, 0)
           }

+ 33 - 15
src/views/dealerManagement/merchantInfoManagement/list.vue

@@ -17,7 +17,7 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="商户类型">
-                <v-select code="DEALER_TYPE" id="merchantInfoManagementList-dealerType" v-model="queryParam.dealerType" allowClear placeholder="请选择商户类型"></v-select>
+                <dealerType id="merchantInfoManagementList-dealerType" changeOnSelect v-model="dealerType" @change="getDealerType" allowClear></dealertype>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -78,16 +78,18 @@
           bordered>
           <!-- 经销商 -->
           <template slot="dealerName" slot-scope="text, record">
-            <span v-if="$hasPermissions('B_merchantInfo_detail')" class="link-bule" @click="handleDetail(record)">{{ record.dealerName }}</span>
-            <span v-else>{{ record.dealerName }}</span>
+            <span v-if="$hasPermissions('B_merchantInfo_detail')" :title="record.dealerName" class="link-bule" @click="handleDetail(record)">{{ record.dealerName }}</span>
+            <span v-else :title="record.dealerName">{{ record.dealerName }}</span>
           </template>
           <!-- 操作 -->
           <template slot="action" slot-scope="text, record">
             <a-button size="small" type="link" class="button-warning" v-if="record.auditState == 'WAIT' && $hasPermissions('B_merchantInfo_audit')" @click="handleAudit(record)" >审核</a-button>
             <a-button size="small" type="link" class="button-info" v-if="$hasPermissions('B_merchantInfo_cooperation')" @click="handleCooperation(record)" >合作设置</a-button>
             <a-button size="small" type="link" class="button-primary" v-if="$hasPermissions('B_merchantInfo_level')" @click="handleLevel(record)">级别设置</a-button>
-            <a-button size="small" type="link" class="button-error" v-if="record.auditState != 'WAIT' && $hasPermissions('B_merchantInfo_distribution')" @click="handleDistribution(record)">经销权</a-button>
             <a-button size="small" type="link" class="button-info" v-if="$hasPermissions('B_merchantInfo_edit')" @click="handleEdit(record)">编辑</a-button>
+            <br>
+            <a-button size="small" type="link" class="button-error" v-if="record.auditState != 'WAIT'&&record.dealerLevel && $hasPermissions('B_merchantInfo_priceSpread')" @click="handlePriceSpread(record)">差价</a-button>
+            <a-button size="small" type="link" class="button-error" v-if="record.auditState != 'WAIT'&&record.dealerLevel && $hasPermissions('B_merchantInfo_distribution')" @click="handleDistribution(record)">经销权</a-button>
             <span v-if="!(record.auditState == 'WAIT' && $hasPermissions('B_merchantInfo_audit')) && !$hasPermissions('B_merchantInfo_cooperation') && !(record.auditState != 'WAIT' && $hasPermissions('B_merchantInfo_distribution')) && !$hasPermissions('B_merchantInfo_level') && !$hasPermissions('B_merchantInfo_edit')">--</span>
           </template>
         </s-table>
@@ -117,18 +119,21 @@ import subarea from '@/views/common/subarea.js'
 import merchantInfoManagementDetailModal from './detailModal.vue'
 import UpdateCooperate from './updateCooperate.vue'
 import UpdateDealerLeve from './updateDealerLevel.vue'
+import dealerType from '@/views/common/dealerType.js'
 export default {
   name: 'MerchantInfoManagementList',
   mixins: [commonMixin],
-  components: { STable, VSelect, merchantInfoManagementDetailModal, subarea, UpdateCooperate, UpdateDealerLeve },
+  components: { STable, VSelect, merchantInfoManagementDetailModal, subarea, UpdateCooperate, UpdateDealerLeve, dealerType },
   data () {
     return {
       spinning: false,
       advanced: true, // 高级搜索 展开/关闭
       tableHeight: 0,
+      dealerType: [],
       queryParam: { //  查询条件
         nameLike: '', //  商户名称、别名
-        dealerType: undefined, //  商户类型
+        dealerType1: undefined, //  商户类型
+        dealerType2: undefined, //  商户类型
         dealerLevel: undefined, // 商户级别
         subareaArea: {
           subareaSn: undefined, //  区域
@@ -144,19 +149,19 @@ export default {
       columns: [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '区域', dataIndex: 'subareaArea.subareaName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '商户名称', scopedSlots: { customRender: 'dealerName' }, width: '10%', align: 'left', ellipsis: true },
-        { title: '商户别名', dataIndex: 'dealerAlias', width: '10%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '商户类型', dataIndex: 'dealerTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '区域', dataIndex: 'subareaArea.subareaName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '商户名称', scopedSlots: { customRender: 'dealerName' }, width: '12%', align: 'left' },
+        { title: '商户别名', dataIndex: 'dealerAlias', width: '12%', align: 'left', customRender: function (text) { return text || '--' } },
+        { title: '商户类型', dataIndex: 'dealerTypeName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '商户级别', dataIndex: 'dealerLevelDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '联系人', dataIndex: 'contact', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '联系人', dataIndex: 'contact', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '联系电话', dataIndex: 'dealerTelephone', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '绑定手机号码', dataIndex: 'managerMobile', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '审核状态', dataIndex: 'auditStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '合作状态', dataIndex: 'cooperateFlagDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '生效时间', dataIndex: 'cooperateEffectiveTime', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '16%', align: 'center' }
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '12%', align: 'center' }
       ],
       loading: false,
       // 加载数据方法 必须为 Promise 对象
@@ -171,6 +176,9 @@ export default {
             this.total = data.count || 0
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
+              if (data.list[i].dealerTypeName1) {
+                data.list[i].dealerTypeName = data.list[i].dealerTypeName1 + '>' + data.list[i].dealerTypeName2
+              }
             }
             this.disabled = false
           }
@@ -190,11 +198,17 @@ export default {
       this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
       this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
     },
+    getDealerType (v, o) {
+      this.queryParam.dealerType1 = v[0]
+      this.queryParam.dealerType2 = v[1]
+    },
     //  重置列表
     resetSearchForm () {
+      this.dealerType = []
       this.queryParam = {
         nameLike: '', //  商户名称、别名
-        dealerType: undefined, //  商户类型
+        dealerType1: undefined, //  商户类型
+        dealerType2: undefined, //  商户类型
         dealerLevel: undefined, // 商户级别
         subareaArea: {
           subareaSn: undefined,
@@ -234,7 +248,11 @@ export default {
     },
     // 经销权
     handleDistribution (row) {
-      this.$router.push({ name: `merchantInfoManagementSet`, params: { sn: row.dealerSn, name: row.dealerName } })
+      this.$router.push({ name: `merchantInfoManagementSet`, params: { sn: row.dealerSn, name: row.dealerName, dealerLevel: row.dealerLevel } })
+    },
+    // 差价
+    handlePriceSpread (row) {
+      this.$router.push({ name: `rebateBinding`, params: { sn: row.dealerSn, name: row.dealerName } })
     },
     // 审核
     handleAudit (row) {

+ 0 - 331
src/views/dealerManagement/merchantInfoManagement/permissionSetting.vue

@@ -1,331 +0,0 @@
-<template>
-  <div class="permissionSetting-wrap">
-    <a-spin :spinning="spinning" tip="Loading...">
-      <a-page-header :ghost="false" :backIcon="false" @back="handleBack" class="permissionSetting-cont">
-        <!-- 自定义的二级文字标题 -->
-        <template slot="subTitle">
-          <a id="permissionSetting-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
-          <span style="margin-left: 20px;color: #666;">经销商:{{ $route.params.name }}</span>
-        </template>
-      </a-page-header>
-      <a-card size="small" :bordered="false" class="permissionSetting-main">
-        <!-- 搜索条件 -->
-        <div ref="tableSearch" class="table-page-search-wrapper">
-          <a-form-model
-            id="permissionSetting-form"
-            ref="ruleForm"
-            class="form-model-con"
-            layout="inline"
-            :model="queryParam"
-            :rules="rules"
-            @keyup.enter.native="handleSearch">
-            <a-row :gutter="15">
-              <a-col :md="6" :sm="24">
-                <a-form-model-item label="类型" prop="goodsType">
-                  <v-select code="DEALER_GOODS_TYPE" id="permissionSetting-goodsType" v-model="queryParam.goodsType" allowClear placeholder="请选择类型"></v-select>
-                </a-form-model-item>
-              </a-col>
-              <a-col :md="6" :sm="24">
-                <a-form-model-item label="类型名称" prop="goodsName">
-                  <a-input id="permissionSetting-goodsName" v-model.trim="queryParam.goodsName" allowClear placeholder="请输入类型名称"/>
-                </a-form-model-item>
-              </a-col>
-              <a-col :md="6" :sm="24">
-                <a-form-model-item label="产品编码" prop="goodsCode">
-                  <a-input id="permissionSetting-goodsCode" v-model.trim="queryParam.goodsCode" allowClear placeholder="请输入产品编码"/>
-                </a-form-model-item>
-              </a-col>
-              <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
-                <a-button type="primary" @click="handleSearch" :disabled="disabled" id="permissionSetting-refresh">查询</a-button>
-                <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="permissionSetting-reset">重置</a-button>
-              </a-col>
-            </a-row>
-          </a-form-model>
-        </div>
-        <!-- 操作按钮 -->
-        <div class="table-operator">
-          <a-button id="permissionSetting-brand" type="primary" class="button-error" @click="choosePModal('BRAND')">选择产品品牌</a-button>
-          <a-button id="permissionSetting-type" type="primary" class="button-info" @click="choosePModal('CATEGORY')">选择产品分类</a-button>
-          <a-button id="permissionSetting-product" type="primary" class="button-success" @click="choosePModal('PRODUCT')">选择产品</a-button>
-        </div>
-        <!-- 列表 -->
-        <s-table
-          class="sTable fixPagination"
-          ref="table"
-          :style="{ height: tableHeight+84.5+'px' }"
-          size="small"
-          :rowKey="(record) => record.id"
-          :columns="columns"
-          :data="loadData"
-          :scroll="{ y: tableHeight }"
-          :defaultLoadData="false"
-          bordered>
-          <!-- 操作 -->
-          <template slot="action" slot-scope="text, record">
-            <a-button size="small" type="link" class="button-error" @click="handleDel(record)">删除</a-button>
-          </template>
-        </s-table>
-      </a-card>
-    </a-spin>
-    <!-- 选择产品品牌 -->
-    <chooseBrandModal :openModal="openBrandModal" :chooseData="chooseBrand" @close="openBrandModal=false" @ok="handleBrandOk" />
-    <!-- 选择产品分类 -->
-    <chooseTypeModal :openModal="openTypeModal" :chooseData="chooseType" @close="openTypeModal=false" @ok="handleTypeOk" />
-    <!-- 选择产品 -->
-    <chooseProductsModal
-      type="dealership"
-      :dealerSn="$route.params.sn"
-      :openModal="openProductsModal"
-      :chooseData="chooseProducts"
-      @close="openProductsModal=false"
-      @ok="handleProductsOk" />
-  </div>
-</template>
-
-<script>
-import { commonMixin } from '@/utils/mixin'
-import { STable, VSelect } from '@/components'
-import ChooseProductsModal from '@/views/common/chooseProductsModal.vue'
-import ChooseBrandModal from '@/views/common/chooseBrandModal.vue'
-import ChooseTypeModal from '@/views/common/chooseTypeModal.vue'
-import { dealerScopeList, dealerScopeSave, dealerScopeDel, dealerScopeQueryList } from '@/api/dealerScope'
-export default {
-  name: 'MerchantInfoManagementSet',
-  mixins: [commonMixin],
-  components: { STable, VSelect, ChooseProductsModal, ChooseBrandModal, ChooseTypeModal },
-  data () {
-    return {
-      spinning: false,
-      tableHeight: 0,
-      queryParam: { //  查询条件
-        goodsType: undefined,
-        goodsName: '',
-        goodsCode: ''
-      },
-      rules: {
-        // goodsType: [ { required: true, message: '请选择类型', trigger: 'change' } ]
-      },
-      disabled: false, //  查询、重置按钮是否可操作
-      loading: false, //  表格加载中
-      columns: [
-        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
-        { title: '添加时间', dataIndex: 'createDate', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '类型', dataIndex: 'type', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '类型名称', dataIndex: 'goodsName', align: 'left', width: '20%', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '产品名称', dataIndex: 'product.name', align: 'left', width: '30%', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '产品编码', dataIndex: 'product.code', width: '10%', align: 'left', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
-      ],
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        this.disabled = true
-        this.spinning = true
-        return dealerScopeList(Object.assign(parameter, this.queryParam, { dealerSn: this.$route.params.sn })).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 goodsType = data.list[i].goodsType
-              data.list[i].type = goodsType == 'PRODUCT' ? '产品' : goodsType == 'BRAND' ? '品牌' : goodsType == 'CATEGORY' ? '分类' : '--'
-            }
-            this.disabled = false
-          }
-          this.spinning = false
-          return data
-        })
-      },
-      openBrandModal: false, //  选择产品品牌
-      openTypeModal: false, //  选择产品分类
-      openProductsModal: false, //  选择产品
-      chooseBrand: [], //  所选品牌
-      chooseProducts: [], //  所选产品
-      chooseType: [] //  所选分类
-    }
-  },
-  methods: {
-    // 查询
-    handleSearch () {
-      const _this = this
-      this.$refs.ruleForm.validate(valid => {
-        if (valid) {
-          _this.$refs.table.refresh(true)
-        } else {
-          return false
-        }
-      })
-    },
-    // 选择产品
-    choosePModal (type) {
-      const productList = []
-      const brandList = []
-      const typeList = []
-      dealerScopeQueryList({ dealerSn: this.$route.params.sn, goodsType: type }).then(res => {
-        if (res.status == 200) {
-          const data = res.data
-          data.map(item => {
-            if (item.goodsType == 'PRODUCT') {
-              productList.push(item)
-            } else if (item.goodsType == 'BRAND') {
-              brandList.push(item)
-            } else if (item.goodsType == 'CATEGORY') {
-              typeList.push(item)
-            }
-          })
-          if (type == 'PRODUCT') { //  选择产品
-            // this.chooseProducts = productList  //  包含先前所选产品
-            this.chooseProducts = [] //  不包含先前所选产品
-            this.openProductsModal = true
-          } else if (type == 'BRAND') { //  选择品牌
-            this.chooseBrand = brandList
-            this.openBrandModal = true
-          } else if (type == 'CATEGORY') { //  选择分类
-            this.chooseType = typeList
-            this.openTypeModal = true
-          }
-        }
-      })
-    },
-    // 品牌
-    handleBrandOk (obj) {
-      this.chooseBrand = obj
-      this.changeData('BRAND')
-    },
-    // 产品
-    handleProductsOk (obj) {
-      this.chooseProducts = obj
-      this.changeData('PRODUCT')
-    },
-    // 分类
-    handleTypeOk (obj) {
-      this.chooseType = obj
-      this.changeData('CATEGORY')
-    },
-    changeData (type) {
-      const _this = this
-      if (type == 'PRODUCT') { //  选择产品
-        if (_this.chooseProducts.length > 0) {
-          const snList = []
-          _this.chooseProducts.map(item => {
-            const productSn = item.productSn ? item.productSn : item.product.productSn ? item.product.productSn : ''
-            snList.push(productSn)
-          })
-          this.setData(snList, type)
-        }
-      } else if (type == 'BRAND') { //  选择品牌
-        if (_this.chooseBrand.length > 0) {
-          const snList = []
-          _this.chooseBrand.map(item => {
-            snList.push(item.brandSn)
-          })
-          this.setData(snList, type)
-        }
-      } else if (type == 'CATEGORY') { //  选择分类
-        if (_this.chooseType.length > 0) {
-          const snList = []
-          _this.chooseType.map(item => {
-            snList.push(item.productTypeSn)
-          })
-          this.setData(snList, type)
-        }
-      }
-    },
-    // 添加经销权
-    setData (snList, type) {
-      const _this = this
-      const params = {
-        dealerSn: _this.$route.params.sn,
-        goodsType: type,
-        goodsSnList: snList
-      }
-      _this.spinning = true
-      dealerScopeSave(params).then(res => {
-        if (res.status == 200) {
-          _this.$message.success(res.message)
-          _this.$refs.table.refresh(true)
-          _this.spinning = false
-        } else {
-          _this.spinning = false
-        }
-      })
-    },
-    // 删除
-    handleDel (row) {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确认要删除吗?',
-        centered: true,
-        onOk () {
-          _this.spinning = true
-          dealerScopeDel({ sn: row.dealerScopeSn }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.$refs.table.refresh()
-              _this.spinning = false
-            } else {
-              _this.spinning = false
-            }
-          })
-        }
-      })
-    },
-    // 重置表单
-    resetSearchForm () {
-      this.queryParam.goodsType = undefined
-      this.queryParam.goodsName = ''
-      this.queryParam.goodsCode = ''
-      this.$refs.table.refresh(true)
-    },
-    // 返回
-    handleBack () {
-      this.$router.push({ path: '/dealerManagement/merchantInfoManagement/list', query: { closeLastOldTab: true } })
-    },
-    filterOption (input, option) {
-      return (
-        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-      )
-    },
-    pageInit () {
-      const _this = this
-      this.$nextTick(() => { // 页面渲染完成后的回调
-        _this.setTableH()
-      })
-    },
-    setTableH () {
-      const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 292
-    }
-  },
-  watch: {
-    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
-      this.setTableH()
-    }
-  },
-  mounted () {
-    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
-      this.$refs.table.refresh(true)
-      this.pageInit()
-    }
-  },
-  activated () {
-    // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
-    if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
-      this.$refs.table.refresh(true)
-      this.pageInit()
-    }
-  },
-  beforeRouteEnter (to, from, next) {
-    next(vm => {})
-  }
-}
-</script>
-
-<style lang="less" scoped>
-  .permissionSetting-wrap{
-    .permissionSetting-cont{
-      margin-bottom: 6px;
-    }
-  }
-</style>

+ 327 - 0
src/views/dealerManagement/merchantInfoManagement/permissionSettingNew.vue

@@ -0,0 +1,327 @@
+<template>
+  <div class="permissionSetting-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-page-header :ghost="false" :backIcon="false" @back="handleBack" class="permissionSetting-cont">
+        <!-- 自定义的二级文字标题 -->
+        <template slot="subTitle">
+          <a id="permissionSetting-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+          <span style="margin-left: 20px;color: #666;">经销商:{{ $route.params.name }}</span>
+        </template>
+      </a-page-header>
+      <a-card size="small" :bordered="false" class="permissionSetting-main">
+        <!-- 搜索条件 -->
+        <div ref="tableSearch" class="table-page-search-wrapper">
+          <a-form-model
+            id="permissionSetting-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="品牌" prop="productBrandSn">
+                  <ProductBrand id="chooseProducts-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="产品分类" prop="productType">
+                  <productTypeAll placeholder="请选择产品分类" @change="changeProductType" v-model="productType" id="chooseProducts-productType"></productTypeAll>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="价格级别" prop="priceLevel">
+                  <v-select code="PRICE_LEVEL" id="productLevelEdit-priceLevel" v-model="queryParam.priceLevel" allowClear placeholder="请选择价格级别"></v-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+                <a-button type="primary" @click="getData" :disabled="disabled" id="permissionSetting-refresh">查询</a-button>
+                <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="permissionSetting-reset">重置</a-button>
+              </a-col>
+            </a-row>
+          </a-form-model>
+        </div>
+        <!-- 操作按钮 -->
+        <div class="table-operator">
+          <a-button type="primary" class="button-error" @click="chooseTModal">选择品类</a-button>
+          <span v-if="!showEmpty">
+            <a-button type="primary" v-if="$route.params.dealerLevel != 'SPECIAL'" class="button-info" @click="handleEdit()">批量编辑</a-button>
+            <a-button type="primary" ghost class="button-error" @click="handleDel()">批量删除</a-button>
+          </span>
+        </div>
+        <!-- 列表 -->
+        <div :style="{height:tableHeight+'px'}">
+          <ve-table
+            border-y
+            v-show="!showEmpty"
+            :scroll-width="0"
+            :max-height="(tableHeight)"
+            :show-header="showTableHead"
+            :row-style-option="{clickHighlight: true}"
+            :cellSelectionOption="{enable: false}"
+            :virtual-scroll-option="{enable: true}"
+            :columns="columns"
+            :table-data="dataSource"
+            row-key-field-name="dealerScopeSn"
+            :checkbox-option="checkboxOption"
+          />
+          <div v-show="showEmpty" class="empty-data"><a-empty description="暂无产品" :image="simpleImage"/></div>
+        </div>
+      </a-card>
+    </a-spin>
+    <!-- 选择产品分类 -->
+    <chooseTypeModal ref="chooseType" :openModal="openTypeModal" @close="openTypeModal=false" @ok="getData" />
+    <!-- 修改价格等级 -->
+    <editPriceLevelModal :priceLevelVal="itemPriceLevel" :openModal="openPriceLevelModal" @close="closePriceLevelModal" @ok="handlePriceLevelOk" />
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable, VSelect } from '@/components'
+import ChooseTypeModal from './chooseTypeModal.vue'
+import editPriceLevelModal from './priceLevelModal.vue'
+import productTypeAll from '@/views/common/productTypeAll.js'
+import ProductBrand from '@/views/common/productBrand.js'
+import { Empty } from 'ant-design-vue'
+import { dealerScopeModifyPriceLevel, dealerScopeDelete, dealerScopeQueryList } from '@/api/dealerScope'
+export default {
+  name: 'MerchantInfoManagementSet',
+  mixins: [commonMixin],
+  components: { STable, VSelect, ChooseTypeModal, productTypeAll, ProductBrand, editPriceLevelModal },
+  data () {
+    return {
+      spinning: false,
+      tableHeight: 0,
+      queryParam: { //  查询条件
+        productBrandSn: undefined, //  产品品牌
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '', //  产品三级分类
+        priceLevel: undefined
+      },
+      productType: [],
+      disabled: false, //  查询、重置按钮是否可操作
+      openTypeModal: false, //  选择产品分类
+      openPriceLevelModal: false,
+      itemPriceLevel: '',
+      simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
+      dataSource: [],
+      showEmpty: false,
+      showTableHead: true, // 显示表头
+      selectedRowKeys: []
+    }
+  },
+  computed: {
+    columns () {
+      const _this = this
+      // 操作按钮
+      const actionFormat = function (record, data) {
+        if (_this.$route.params.dealerLevel != 'SPECIAL') {
+          return (
+            <div>
+              <a-button size="small" type="link" class="button-info" onClick={() => _this.handleEdit(record)}>编辑</a-button>
+              <a-button size="small" type="link" class="button-error" onClick={() => _this.handleDel(record)}>删除</a-button>
+            </div>
+          )
+        } else {
+          return (
+            <div>
+              <a-button
+                size="small"
+                type="link"
+                class="button-info"
+                onClick={() => _this.handleDel(record)}
+              >删除</a-button>
+            </div>
+          )
+        }
+      }
+      const arr = [
+        { title: '', field: '', key: 'acheck', width: 60, type: 'checkbox', align: 'center' },
+        { title: '品牌', field: 'productBrandName', key: 'a', align: 'center', width: 160, operationColumn: false, renderBodyCell: ({ row, column }) => { return row[column.field] || '全品类' } },
+        { title: '一级分类', field: 'productTypeName1', key: 'b', width: 160, align: 'center', operationColumn: false, renderBodyCell: ({ row, column }) => { return row[column.field] || '--' } },
+        { title: '二级分类', field: 'productTypeName2', key: 'c', width: 160, align: 'center', operationColumn: false, renderBodyCell: ({ row, column }) => { return row[column.field] || '--' } },
+        { title: '三级分类', field: 'productTypeName3', key: 'd', width: 160, align: 'center', operationColumn: false, renderBodyCell: ({ row, column }) => { return row[column.field] || '--' } },
+        { title: '价格级别', field: 'priceLevelDictValue', key: 'd', width: 160, align: 'center', operationColumn: false, renderBodyCell: ({ row, column }) => { return row[column.field] || '--' } },
+        { title: '操作', field: 'action', width: 100, key: 'e', align: 'center', fixed: 'right', operationColumn: false, renderBodyCell: ({ row, column }) => { return actionFormat(row, row[column.field]) } }
+      ]
+      return arr
+    },
+    checkboxOption () {
+      const _this = this
+      return {
+        selectedRowKeys: _this.selectedRowKeys,
+        // 行选择改变事件
+        selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
+          _this.selectedRowKeys = selectedRowKeys
+        },
+        // 全选改变事件
+        selectedAllChange: ({ isSelected, selectedRowKeys }) => {
+          _this.selectedRowKeys = selectedRowKeys
+        }
+      }
+    }
+  },
+  methods: {
+    getData () {
+      const _this = this
+      _this.disabled = true
+      _this.spinning = true
+      _this.queryParam.dealerSn = _this.$route.params.sn
+      dealerScopeQueryList(_this.queryParam).then(res => {
+        if (res.status == 200) {
+          _this.dataSource = res.data
+        }
+        _this.showEmpty = _this.dataSource.length <= 0
+        _this.disabled = false
+        _this.spinning = false
+      })
+    },
+    // 选择品类
+    chooseTModal () {
+      if (this.dataSource.length === 1 && this.dataSource[0] && !this.dataSource[0].productBrandSn) {
+        this.$message.warning('该经销商的经销权已是【全品类】,请删除后重新添加!')
+        return
+      }
+      this.selectedRowKeys = []
+      this.openTypeModal = true
+      this.$nextTick(() => {
+        this.$refs.chooseType.getDisabledList()
+      })
+    },
+    // 打开编辑弹窗
+    handleEdit (row) {
+      if (row) {
+        this.selectedRowKeys = []
+        this.selectedRowKeys.push(row.dealerScopeSn)
+        this.itemPriceLevel = row.priceLevel
+      } else {
+        this.itemPriceLevel = ''
+        if (this.selectedRowKeys && this.selectedRowKeys.length === 0) {
+          this.$message.warning('请选择一条数据')
+          return
+        }
+      }
+      this.$nextTick(() => {
+        this.openPriceLevelModal = true
+      })
+    },
+    // 编辑价格等级
+    handlePriceLevelOk (val) {
+      const _this = this
+      dealerScopeModifyPriceLevel({
+        snList: this.selectedRowKeys,
+        priceLevel: val
+      }).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.resetSearchForm()
+          _this.spinning = false
+        } else {
+          _this.spinning = false
+        }
+      })
+    },
+    closePriceLevelModal () {
+      this.itemPriceLevel = ''
+      this.openPriceLevelModal = false
+    },
+    //  选择分类  change
+    changeProductType (val, opt) {
+      this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
+      this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
+      this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
+    },
+    // 批量删除
+    handleDel (row) {
+      const _this = this
+      if (!row && this.selectedRowKeys && this.selectedRowKeys.length === 0) {
+        this.$message.warning('请选择一条数据')
+        return
+      }
+      const newSnList = row ? [row.dealerScopeSn] : _this.selectedRowKeys
+      this.$confirm({
+        title: '提示',
+        content: '经销权删除后,该商户的差价设置将同步解除,确定删除吗?',
+        centered: true,
+        onOk () {
+          _this.spinning = true
+          dealerScopeDelete({ snList: newSnList }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.resetSearchForm()
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
+        }
+      })
+    },
+    // 重置表单
+    resetSearchForm () {
+      this.queryParam.productBrandSn = undefined
+      this.queryParam.productTypeSn1 = ''
+      this.queryParam.productTypeSn2 = ''
+      this.queryParam.productTypeSn3 = ''
+      this.queryParam.priceLevel = undefined
+      this.productType = []
+      this.getData()
+    },
+    // 返回
+    handleBack () {
+      this.selectedRowKeys = []
+      this.$router.push({ path: '/dealerManagement/merchantInfoManagement/list', query: { closeLastOldTab: true } })
+    },
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 205
+    }
+  },
+  watch: {
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+      this.resetSearchForm()
+    }
+  },
+  activated () {
+    // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
+    if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
+      this.pageInit()
+      this.resetSearchForm()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .permissionSetting-wrap{
+    .permissionSetting-cont{
+      margin-bottom: 6px;
+    }
+    .empty-data{
+      padding-top:100px;
+    }
+  }
+  /deep/.ve-checkbox .ve-checkbox-checked .ve-checkbox-inner {
+      background-color: #ed1c24 !important;
+      border-color: #ed1c24 !important;
+    }
+  /deep/.ve-checkbox .ve-checkbox-indeterminate .ve-checkbox-inner::after{
+    background-color: #ed1c24 !important;
+  }
+</style>

+ 126 - 0
src/views/dealerManagement/merchantInfoManagement/priceLevelModal.vue

@@ -0,0 +1,126 @@
+<template>
+  <a-modal
+    centered
+    class="chooseType-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="选择品类"
+    v-model="isShow"
+    @cancel="isShow=false"
+    width="500px">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 表单 -->
+      <a-form-model
+        ref="ruleForm"
+        :model="form"
+        :rules="rules"
+        :label-col="formItemLayout.labelCol"
+        :wrapper-col="formItemLayout.wrapperCol"
+      >
+        <a-form-model-item label="价格级别" prop="priceLevel">
+          <v-select
+            code="PRICE_LEVEL"
+            :notIn="notArr"
+            id="productPriceLevel-level"
+            v-model="form.priceLevel"
+            allowClear
+            placeholder="请选择价格级别"></v-select>
+
+        </a-form-model-item>
+        <div class="fontRed">注意:价格变更后,该商户的差价设置将同步清空</div>
+      </a-form-model>
+      <div class="btn-cont">
+        <a-button id="chooseType-modal-back" @click="isShow = false" >取消</a-button>
+        <a-button type="primary" style="margin-left: 15px;" id="chooseType-modal-save" @click="handleSave">确定</a-button>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { VSelect } from '@/components'
+export default {
+  name: 'ChooseTypeModal',
+  components: { VSelect },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    priceLevelVal: { //  弹框显示状态
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      spinning: false,
+      formItemLayout: {
+        labelCol: { span: 4 },
+        wrapperCol: { span: 18 }
+      },
+      notArr: [],
+      form: {
+        priceLevel: undefined // 价格级别
+      },
+      rules: {
+        priceLevel: [
+          { required: true, message: '请选择价格等级', trigger: 'change' }
+        ]
+      }
+    }
+  },
+  methods: {
+    //  保存
+    handleSave () {
+      const _this = this
+      _this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.$emit('ok', this.form.priceLevel)
+          _this.isShow = false
+        } else {
+          return false
+        }
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$refs.ruleForm.resetFields()
+        this.$emit('close')
+      } else {
+        // 特约经销商   价格级别不能修改  省、市经销商时,不能选择特约价
+        if (this.$route.params.dealerLevel === 'SPECIAL') {
+          this.form.priceLevel = 'SPECIAL'
+        } else {
+          this.notArr = ['SPECIAL']
+        }
+        this.form.priceLevel = this.priceLevelVal ? this.priceLevelVal : undefined
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .chooseType-modal{
+    .fontRed{
+      margin:15px 0 0 4%;
+      color:#ed1c24;
+    }
+    .ant-modal-body {
+      padding: 40px 40px 24px;
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 35px 0 10px;
+    }
+  }
+</style>

+ 1 - 13
src/views/dealerManagement/merchantInfoManagement/updateDealerLevel.vue

@@ -80,19 +80,7 @@ export default {
       const _this = this
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
-          if (_this.dealerLevelBak && _this.form.dealerLevel != _this.dealerLevelBak) {
-            const tipInfo = _this.isProvincialCustomers === '1' ? '经销商上下级、差价归属和省仓客户' : '经销商上下级和差价归属'
-            this.$confirm({
-              title: '提示',
-              content: <div>商户价格级别变更后,该商户关联的<span style="color:red;">{tipInfo}</span>关系绑定将同步解除,确定变更该商户级别吗?</div>,
-              centered: true,
-              onOk () {
-                _this.submitForm()
-              }
-            })
-          } else {
-            _this.submitForm()
-          }
+          _this.submitForm()
         } else {
           return false
         }

+ 18 - 6
src/views/dealerManagement/provincialWarehouseManagement/chooseDealer.vue

@@ -16,7 +16,7 @@
           </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>
+              <dealerType id="chooseDealer-dealerType" changeOnSelect v-model="dealerType" @change="getDealerType" allowClear></dealertype>
             </a-form-item>
           </a-col>
           <a-col :md="8" :sm="24">
@@ -69,11 +69,12 @@ 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 dealerType from '@/views/common/dealerType.js'
 import { getDealerListInfo, dealerQueryList } from '@/api/dealer'
 export default {
   name: 'ChooseDealer',
   mixins: [commonMixin],
-  components: { STable, VSelect, subarea, AreaList },
+  components: { STable, VSelect, subarea, AreaList, dealerType },
   props: {
     pageType: {
       type: String,
@@ -88,9 +89,11 @@ export default {
     return {
       tableHeight: 0,
       spinning: false,
+      dealerType: [],
       queryParam: { //  查询条件
         nameLike: '',
-        dealerType: null,
+        dealerType1: undefined, //  商户类型
+        dealerType2: undefined, //  商户类型
         dealerLevel: null,
         subareaArea: {
           subareaSn: undefined, //  区域
@@ -107,7 +110,7 @@ export default {
       columns: [
         { 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: 'dealerTypeName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '商户级别', dataIndex: 'dealerLevelDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '地区', scopedSlots: { customRender: 'addressInfo' }, width: '30%', align: 'center', ellipsis: true },
         { title: '所在区域', dataIndex: 'subareaArea.subareaName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
@@ -126,6 +129,9 @@ export default {
             const no = (data.pageNo - 1) * data.pageSize
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
+              if (data.list[i].dealerTypeName1) {
+                data.list[i].dealerTypeName = data.list[i].dealerTypeName1 + '>' + data.list[i].dealerTypeName2
+              }
             }
             this.disabled = false
           }
@@ -145,6 +151,10 @@ export default {
     rowSelectionFun (obj) {
       this.rowSelectionInfo = obj || null
     },
+    getDealerType (v, o) {
+      this.queryParam.dealerType1 = v[0]
+      this.queryParam.dealerType2 = v[1]
+    },
     areaChange (val) {
       this.queryParam.provinceSn = val[0] ? val[0] : ''
       this.queryParam.citySn = val[1] ? val[1] : ''
@@ -159,9 +169,11 @@ export default {
     },
     //  重置
     resetSearchForm () {
+      this.dealerType = []
       this.queryParam = {
         nameLike: '',
-        dealerType: null,
+        dealerType1: undefined, //  商户类型
+        dealerType2: undefined, //  商户类型
         dealerLevel: null,
         subareaArea: {
           subareaSn: undefined, //  区域
@@ -190,7 +202,7 @@ export default {
     },
     pageInit (data) {
       this.setTableH()
-      this.$refs.table.refresh()
+      this.resetSearchForm()
     },
     setTableH () {
       const headHeight = this.$refs.tableSearch.offsetHeight

+ 17 - 5
src/views/dealerManagement/provincialWarehouseManagement/relatedDealersList.vue

@@ -34,7 +34,7 @@
                   </a-col>
                   <a-col :md="4" :sm="24">
                     <a-form-item label="商户类型">
-                      <v-select code="DEALER_TYPE" id="relatedDealersList-dealerType" v-model="queryParam.dealerType" allowClear placeholder="请选择商户类型"></v-select>
+                      <dealerType id="relatedDealersList-dealerType" changeOnSelect v-model="dealerType" @change="getDealerType" allowClear></dealertype>
                     </a-form-item>
                   </a-col>
                   <a-col :md="4" :sm="24">
@@ -119,17 +119,19 @@ import chooseDealer from './chooseDealer.vue'
 import subarea from '@/views/common/subarea.js'
 import AreaList from '@/views/common/areaList.js'
 import { hdExportExcel } from '@/libs/exportExcel'
+import dealerType from '@/views/common/dealerType.js'
 import { queryServiceCenterDealerPage, serviceCenterBinding, serviceCenterUnbinding, serviceCenterExport } from '@/api/serviceCenter'
 export default {
   name: 'LookUpCustomers',
   mixins: [commonMixin],
-  components: { STable, VSelect, chooseDealer, subarea, AreaList },
+  components: { STable, VSelect, chooseDealer, subarea, AreaList, dealerType },
   data () {
     return {
       spinning: false,
       isShow: this.openModal, //  是否打开弹框
       disabled: false,
       exportLoading: false,
+      dealerType: [],
       queryParam: {
         subareaSn: undefined,
         subareaAreaSn: undefined,
@@ -138,7 +140,8 @@ export default {
         districtSn: undefined,
         nameLike: '',
         relationType: 'purchase',
-        dealerType: undefined,
+        dealerType1: undefined, //  商户类型
+        dealerType2: undefined, //  商户类型
         dealerLevel: undefined
       },
       tableHeight: 0,
@@ -155,6 +158,9 @@ export default {
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
               data.list[i].loginFlag = Number(data.list[i].loginFlag)
+              if (data.list[i].dealerTypeName1) {
+                data.list[i].dealerTypeName = data.list[i].dealerTypeName1 + '>' + data.list[i].dealerTypeName2
+              }
             }
             this.disabled = false
           }
@@ -168,7 +174,7 @@ export default {
         { 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: 'dealerTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '商户类型', dataIndex: 'dealerTypeName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '商户级别', dataIndex: 'dealerLevelDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '添加时间', dataIndex: 'createDate', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '12%', align: 'center' }
@@ -189,6 +195,10 @@ export default {
       this.openDealerModal = false
       this.$refs.dealerChoose.clearSelect()
     },
+    getDealerType (v, o) {
+      this.queryParam.dealerType1 = v[0]
+      this.queryParam.dealerType2 = v[1]
+    },
     // 关联经销商
     handleAddDealer (list) {
       const newList = list.map(item => {
@@ -249,6 +259,7 @@ export default {
     },
     //  重置
     resetSearchForm () {
+      this.dealerType = []
       this.queryParam = {
         subareaSn: undefined,
         subareaAreaSn: undefined,
@@ -258,7 +269,8 @@ export default {
         nameLike: '',
         serviceCenterSn: this.$route.params.sn,
         relationType: 'purchase',
-        dealerType: undefined,
+        dealerType1: undefined, //  商户类型
+        dealerType2: undefined, //  商户类型
         dealerLevel: undefined
       }
       this.$refs.areaList.clearData()

+ 331 - 0
src/views/dealerManagement/rebateBinding/categoryList.vue

@@ -0,0 +1,331 @@
+<template>
+  <div class="categoryList-wrap" :style="{minHeight:maxHeight+'px'}">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <ve-table
+        border-y
+        v-show="!showEmpty"
+        :scroll-width="0"
+        :row-style-option="{clickHighlight: true}"
+        :cellSelectionOption="{enable: false}"
+        :virtual-scroll-option="{enable: false}"
+        :columns="columns"
+        :table-data="list"
+        row-key-field-name="id"
+        :expand-option="expandOption"
+      />
+      <div v-show="showEmpty" class="empty-data" :style="{height:maxHeight+'px'}"><a-empty description="暂无数据" :image="simpleImage"/></div>
+    </a-spin>
+
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { VSelect } from '@/components'
+import { dealerUpsList, dealerUpsDelete } from '@/api/dealer'
+import { Empty } from 'ant-design-vue'
+// 子表格
+const ChildTableComp = {
+  name: 'ChildTableComp',
+  template: `
+        <div class="child-table-comp">
+            <ve-table
+              v-if="row.childData.length>0"
+              :row-style-option="{clickHighlight: true, stripe: true}"
+              :cellSelectionOption="{enable: false}"
+              :scroll-width="0"
+              :max-height="row.childData.length*30>300?300:row.childData.length*30+31"
+              row-key-field-name="id"
+              :virtual-scroll-option="{enable: true}"
+              :columns="columns"
+              :table-data="row.childData"
+            />
+            <a-empty v-else description="暂无品类" :image="simpleImage"/>
+        </div>
+    `,
+  props: {
+    row: Object
+  },
+  data () {
+    return {
+      simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
+      columns: [
+        { title: '序号', field: 'no', key: 'a', width: 40, align: 'center', operationColumn: false },
+        { title: '品牌', field: 'productBrandName', key: 'b', width: 100, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
+        { title: '一级分类', field: 'productTypeName1', key: 'e', width: 180, align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
+        { title: '二级分类', field: 'productTypeName2', width: 180, key: 'i', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
+        { title: '三级分类', field: 'productTypeName3', width: 180, key: 'm', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } }
+      ]
+    }
+  }
+}
+export default {
+  name: 'DetailProductList',
+  mixins: [commonMixin],
+  components: { VSelect },
+  props: {
+    newLoading: {
+      type: Boolean,
+      default: false
+    },
+    maxHeight: {
+      type: [String, Number],
+      default: '300'
+    }
+  },
+  data () {
+    return {
+      disabled: false, //  查询、重置按钮是否可操作
+      spinning: false,
+      simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
+      dataSource: [],
+      list: [],
+      tableHeight: this.maxHeight,
+      columnWidthResizeOption: {
+        // default false
+        enable: true,
+        // column resize min width
+        minWidth: 50
+      },
+      expandOption: {
+        defaultExpandAllRows: false,
+        expandedRowKeys: [],
+        render: ({ row, column, rowIndex }, h) => {
+          return <ChildTableComp row={row} />
+        },
+        // 重新赋值处理
+        afterExpandRowChange: ({ afterExpandedRowKeys, row, rowIndex }) => {
+          this.changeExpandedRowKeys(afterExpandedRowKeys)
+        }
+      },
+      showEmpty: true,
+      checkedDealerSn: [],
+      isTeyue: false
+    }
+  },
+  computed: {
+    columns () {
+      const _this = this
+      // 差价归属
+      const jcgsFormat = function (record, data, h) {
+        const colors = { 'ASSIGN': '#00aaff', 'SUPERIORS': '#ff0000', 'HEAD': '#55aa7f' }
+        if (data) {
+          return (
+            data.map(item => {
+              return (
+                <a-tag style="margin:5px;" color={colors[item.rebateParentType]}>{item.parentDealer.dealerName}({Number(item.allotRate * 100).toFixed(2) + '%'})</a-tag>
+              )
+            })
+          )
+        }
+        return '--'
+      }
+      // 操作按钮
+      const actionFormat = function (record, data, h) {
+        if (_this.isTeyue) {
+          return (<div>
+            <a-button
+              size="small"
+              type="link"
+              class="button-error"
+              onClick={(e) => _this.handleDel(record, e)}
+            >删除</a-button>
+          </div>)
+        }
+        return (
+          <div>
+            <a-button
+              size="small"
+              type="link"
+              class="button-info"
+              onClick={(e) => _this.handleEdit(record, e)}
+            >编辑</a-button>
+            <a-button
+              size="small"
+              type="link"
+              class="button-error"
+              onClick={(e) => _this.handleDel(record, e)}
+            >删除</a-button>
+          </div>
+        )
+      }
+
+      const expendFormat = function (record, data, h) {
+        if (_this.isTeyue) {
+          return (<span>-</span>)
+        }
+        const hasExpend = _this.expandOption.expandedRowKeys.indexOf(record.id)
+        if (hasExpend >= 0) {
+          return (
+            <span style="cursor:pointer;">收起</span>
+          )
+        }
+        return (
+          <span style="cursor:pointer;">展开</span>
+        )
+      }
+
+      const arr = [
+        { field: '', key: 'x', type: (this.isTeyue ? '-' : 'expand'), title: '品类', width: '5%', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return expendFormat(row, row[column.field], h) } },
+        { title: '上级经销商', field: 'superDealerName', width: '20%', key: 'h', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
+        { title: '差价归属方', field: 'rebateDealerList', width: '65%', key: 'k', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return jcgsFormat(row, row[column.field], h) } },
+        { title: '操作', field: 'action', width: '10%', key: 's', align: 'center', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return actionFormat(row, row[column.field], h) } }
+      ]
+      return arr
+    }
+  },
+  methods: {
+    // 给可控属性重新赋值
+    changeExpandedRowKeys (keys) {
+      this.expandOption.expandedRowKeys = keys
+    },
+    // 展开全部
+    expandAll () {
+      this.expandOption.expandedRowKeys = this.list.map((x) => x.id)
+    },
+    // 折叠全部
+    foldAll () {
+      this.expandOption.expandedRowKeys = []
+    },
+    // 筛选数据
+    filterData (data, queryParam) {
+      return data.filter(s => {
+        let cs = true
+        let bs = true
+        const plen = Object.keys(queryParam).length
+        const xi = queryParam.productBrandSn ? 3 : 2
+        bs = queryParam.productBrandSn ? s.productBrandSn == queryParam.productBrandSn : true
+        if (plen == xi) {
+          cs = queryParam.productTypeSn1 == s.productTypeSn1
+        } else if (plen == xi + 1) {
+          cs = queryParam.productTypeSn1 == s.productTypeSn1 && queryParam.productTypeSn2 == s.productTypeSn2
+        } else if (plen == xi + 2) {
+          cs = queryParam.productTypeSn1 == s.productTypeSn1 && queryParam.productTypeSn2 == s.productTypeSn2 && queryParam.productTypeSn3 == s.productTypeSn3
+        }
+        console.log(queryParam, bs, cs, xi, plen)
+        return queryParam.productBrandSn ? bs && cs : cs
+      })
+    },
+    // 组装数据
+    formatData (listData, queryParam) {
+      // 格式化数据
+      const ret = []
+      const no = 0
+      for (let i = 0; i < listData.length; i++) {
+        const item = listData[i]
+        const rebateScopeList = item.rebateScopeList ? this.filterData(item.rebateScopeList, queryParam) : [{ productBrandName: null, productTypeName1: null, productTypeName2: null, productTypeName3: null }]
+        const supDealerList = item.rebateDealerList.find(b => b.rebateParentType == 'SUPERIORS')
+        const headDealerList = item.rebateDealerList.find(b => b.rebateParentType == 'HEAD')
+        const zdDealerList = item.rebateDealerList.filter(b => b.rebateParentType == 'ASSIGN')
+        // this.checkedDealerSn.push(rebateScopeList)
+        // 差价归属组合
+        const rebateDealerList = []
+        if (supDealerList) {
+          rebateDealerList.push(supDealerList)
+        }
+        zdDealerList && zdDealerList.map(zd => {
+          rebateDealerList.push(zd)
+        })
+        if (headDealerList) {
+          rebateDealerList.push(headDealerList)
+        }
+        for (let j = 0; j < rebateScopeList.length; j++) {
+          rebateScopeList[j].no = j + 1
+          rebateScopeList[j].dealerUpsSn = item.dealerUpsSn
+          rebateScopeList[j].dealerSn = item.dealerSn
+        }
+        ret.push({
+          no: i + 1,
+          id: item.id,
+          superDealerName: supDealerList.parentDealer.dealerName,
+          dealerUpsSn: item.dealerUpsSn,
+          dealerSn: item.dealerSn,
+          rebateDealerList: rebateDealerList,
+          childData: rebateScopeList
+        })
+      }
+
+      return ret.filter(item => item.childData.length > 0)
+    },
+    searchTable (queryParam) {
+      if (this.dataSource.length) {
+        this.$emit('loaded', this.dataSource)
+        this.list = this.formatData(this.dataSource, queryParam)
+        this.showEmpty = this.list.length <= 0
+      } else {
+        this.dataSource = []
+        this.list = []
+        this.disabled = true
+        this.spinning = true
+        // 品类列表
+        dealerUpsList(queryParam).then(res => {
+          this.$emit('loaded', res.data || [])
+          this.dataSource = res.data || []
+          // 处理数据
+          this.list = this.formatData(this.dataSource, queryParam)
+          this.showEmpty = this.list.length <= 0
+          this.tableHeight = (this.showEmpty ? 0 : this.maxHeight) + 'px'
+          this.spinning = false
+          this.disabled = false
+        })
+      }
+    },
+    handleEdit (record, e) {
+      console.log(e)
+      e.stopPropagation()
+      const row = this.dataSource.find(item => item.dealerUpsSn == record.dealerUpsSn && item.dealerSn == record.dealerSn)
+      this.$emit('edit', row)
+    },
+    handleDel (record, e) {
+      e.stopPropagation()
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '删除后,将解除该品类差价设置归属关系。确定删除吗?',
+        centered: true,
+        closable: true,
+        onOk () {
+          _this.spinning = true
+          dealerUpsDelete({ dealerUpsSn: record.dealerUpsSn }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              const rowIndex = _this.dataSource.findIndex(item => item.dealerUpsSn == record.dealerUpsSn && item.dealerSn == record.dealerSn)
+              _this.dataSource.splice(rowIndex, 1)
+              _this.$emit('del')
+            }
+            _this.spinning = false
+          })
+        }
+      })
+    },
+    pageInit (queryParam, isTeyue) {
+      this.isTeyue = isTeyue
+      // 获取列表
+      this.searchTable(queryParam)
+    }
+  }
+}
+</script>
+  <style lang="less">
+  .empty-data{
+        color: #999;
+        text-align: center;
+        padding: 20px;
+    }
+    .ve-table-body-td{
+      .active-title{
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+        padding: 10px;
+        background: #f3f8fa;
+      }
+    }
+    .ve-table .ve-table-container .ve-table-content-wrapper table.ve-table-content tbody.ve-table-body tr.ve-table-body-tr td.table-body-cell-no,
+    .ve-table .ve-table-container .ve-table-content-wrapper table.ve-table-content tbody.ve-table-body tr.ve-table-expand-tr td.table-body-cell-no{
+      padding: 0;
+    }
+    .child-table-comp{
+      padding: 10px;
+    }
+  </style>

+ 224 - 0
src/views/dealerManagement/rebateBinding/categoryTree.vue

@@ -0,0 +1,224 @@
+<template>
+  <div class="categoryTree-wrap">
+    <div style="padding-bottom:10px;">
+      <span style="color:red;">*</span> 添加品类:
+      <a-checkbox v-model="check1" @change="(e)=> onAllChange(e,0)" v-show="!showEmpty">
+        全选
+      </a-checkbox>
+      <a-checkbox v-model="check2" @change="(e)=> onAllChange(e,1)" v-show="!showEmpty">
+        自主品牌
+      </a-checkbox>
+      <a-checkbox v-model="check3" @change="(e)=> onAllChange(e,2)" v-show="!showEmpty">
+        代理品牌
+      </a-checkbox>
+    </div>
+
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div v-show="showEmpty" class="empty-data"><a-empty description="暂无品类" :image="simpleImage"/></div>
+      <div v-show="!showEmpty" style="height:350px;overflow: auto;">
+        <a-tree
+          checkable
+          :selectable="false"
+          v-model="checkedKeys"
+          :tree-data="dataSource"
+          :replaceFields="{children:'sonList', title:'name', key:'sn' }"
+          @check="onCheck"
+        >
+        </a-tree>
+      </div>
+    </a-spin>
+
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { VSelect } from '@/components'
+import { dealerUpsPlTree } from '@/api/dealer'
+import { Empty } from 'ant-design-vue'
+import ProductBrand from '@/views/common/productBrand.js'
+import ProductType from '@/views/common/productType.js'
+export default {
+  name: 'DetailProductList',
+  mixins: [commonMixin],
+  components: { VSelect, ProductType, ProductBrand },
+  props: {
+    newLoading: {
+      type: Boolean,
+      default: false
+    },
+    maxHeight: {
+      type: [String, Number],
+      default: '300'
+    },
+    showTable: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      spinning: false,
+      simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
+      dataSource: [],
+      showEmpty: true,
+      dealerSn: undefined,
+      parentDealerSn: undefined,
+      checkedKeys: [],
+      halfCheckedKeys: [],
+      allLeafKeys: [],
+      allBrands: [],
+      check1: false,
+      check2: false,
+      check3: false
+    }
+  },
+  computed: {
+
+  },
+  methods: {
+    onCheck (checkedKeys, info) {
+      // console.log('onCheck', checkedKeys, info)
+      this.checkedKeys = checkedKeys
+      this.halfCheckedKeys = info.halfCheckedKeys
+      if (this.check1) {
+        this.check1 = false
+      }
+      if (this.check2) {
+        this.check2 = false
+      }
+      if (this.check3) {
+        this.check3 = false
+      }
+    },
+    getResult () {
+      // 所有已选叶子节点
+      const ret = this.allLeafKeys.filter(item => this.checkedKeys.includes(item.sn))
+      console.log(ret)
+      const result = []
+      ret.map(item => {
+        const a = item.sn.replace('-1_1_', '')
+        const b = a.split('_2_')
+        const c = b[1].split('_3_')
+        const d = c[1].split('_4_')
+        result.push({
+          'productBrandSn': b[0],
+          'productTypeSn1': c[0],
+          'productTypeSn2': d[0],
+          'productTypeSn3': d[1]
+        })
+      })
+      return result
+    },
+    // 筛选并全选
+    onAllChange (e, type) {
+      console.log(e.target.checked, type)
+      if (type == 0) {
+        this.check2 = false
+        this.check3 = false
+        this.check1 = e.target.checked
+        this.allCheck(this.check1, type)
+      }
+      if (type == 1) {
+        this.check1 = false
+        this.check3 = false
+        this.check2 = e.target.checked
+        this.allCheck(this.check2, type)
+      }
+      if (type == 2) {
+        this.check1 = false
+        this.check2 = false
+        this.check3 = e.target.checked
+        this.allCheck(this.check3, type)
+      }
+    },
+    // 全选树
+    allCheck (checked, type) {
+      if (checked) {
+        this.checkedKeys = []
+        this.allLeafKeys.map(item => {
+          // 自主或代理
+          if (type) {
+            const psn = item.sn.split('_2_')[0]
+            const prow = this.dataSource.find(k => k.sn == psn)
+            if (prow && prow.productBrandType == type) {
+              this.checkedKeys.push(item.sn)
+            }
+          } else {
+            // 全品类
+            this.checkedKeys.push(item.sn)
+          }
+        })
+      } else {
+        this.checkedKeys = []
+      }
+    },
+    // 获取所有叶子结节
+    getLeafKeys (tree) {
+      const leafNodes = []
+      function traverse (nodes) {
+        nodes.forEach(node => {
+          if (node.sonList && node.sonList.length) {
+            traverse(node.sonList)
+          } else {
+            leafNodes.push(node)
+          }
+        })
+      }
+      traverse([tree]) // 假设tree是单个根节点
+      return leafNodes
+    },
+    // 查询品类列表
+    handleSearch () {
+      if (this.dealerSn) {
+        this.getTreeData()
+      } else {
+        this.$message.info('请选择上级经销商')
+      }
+    },
+    async getTreeData () {
+      this.dataSource = []
+      this.allLeafKeys = []
+      this.spinning = true
+      const params = { dealerSn: this.dealerSn, upsDealerSn: this.parentDealerSn }
+      // 品类列表
+      const listData = await dealerUpsPlTree(params).then(res => res.data)
+      if (listData) {
+        this.dataSource = listData.sort((a, b) => a.productBrandType - b.productBrandType)
+        // 获取所有叶子节点
+        this.dataSource.map(item => {
+          this.allLeafKeys = this.allLeafKeys.concat(this.getLeafKeys(item))
+          // 获取所有品牌sn
+          this.allBrands.push(item.sn)
+        })
+        this.showEmpty = this.dataSource.length <= 0
+      }
+      this.spinning = false
+    },
+    pageInit (detailData, parentDealerSn, dealerSn) {
+      this.detailData = detailData
+      this.parentDealerSn = parentDealerSn
+      this.dealerSn = dealerSn
+      // 获取列表
+      this.handleSearch()
+    }
+  }
+}
+</script>
+  <style lang="less">
+    .categoryTree-wrap{
+      .empty-data{
+            color: #999;
+            text-align: center;
+            padding: 20px;
+        }
+      .ant-tree{
+        display:flex;
+        justify-content: space-between;
+        flex-wrap: wrap;
+      }
+      .ant-tree > li{
+        width: 33%;
+      }
+    }
+  </style>

+ 235 - 0
src/views/dealerManagement/rebateBinding/list.vue

@@ -0,0 +1,235 @@
+<template>
+  <div class="rebateBinding-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-page-header :ghost="false" :backIcon="false" @back="handleBack" class="rebateBinding-cont">
+        <!-- 自定义的二级文字标题 -->
+        <template slot="subTitle">
+          <a id="rebateBinding-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+          <span style="margin-left: 20px;color: #666;" v-if="detail">经销商:{{ detail.dealerName }}</span>
+        </template>
+      </a-page-header>
+      <a-card size="small" :bordered="false" class="rebateBinding-main">
+        <!-- 搜索条件 -->
+        <div ref="tableSearch" class="table-page-search-wrapper">
+          <a-form-model
+            id="rebateBinding-form"
+            v-show="!isTeyue"
+            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="品牌">
+                  <ProductBrand v-model="queryParam.productBrandSn"></ProductBrand>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="产品分类">
+                  <ProductType placeholder="请选择产品分类" @change="changeProductType" v-model="productType"></ProductType>
+                </a-form-model-item>
+              </a-col>
+              <!-- <a-col :md="6" :sm="24" v-if="!isTeyue">
+                <a-form-model-item label="价格级别">
+                  <v-select code="PRICE_LEVEL" :notIn="['SPECIAL']" v-model="queryParam.priceLevel" allowClear placeholder="请选择价格级别"></v-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24" v-if="!isTeyue">
+                <a-form-model-item label="经销商">
+                  <a-input v-model.trim="queryParam.dealerName" allowClear placeholder="请输入经销商名称"/>
+                </a-form-model-item>
+              </a-col> -->
+              <a-col :md="6" :sm="24" v-show="false">
+                <a-form-model-item label="差价归属方">
+                  <v-select code="REBATE_PARENT_TYPE" ref="rpType" v-model="queryParam.rebateParentType" allowClear placeholder="请选择差价归属方"></v-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+                <a-button type="primary" @click="handleSearch" :disabled="disabled" id="rebateBinding-refresh">查询</a-button>
+                <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="rebateBinding-reset">重置</a-button>
+              </a-col>
+            </a-row>
+          </a-form-model>
+        </div>
+        <!-- 操作按钮 -->
+        <div class="table-operator" style="display: flex;align-items: center;justify-content: space-between;" v-if="showBtns">
+          <a-button id="rebateBinding-brand" type="primary" class="button-error" @click="openGlModal">差价设置</a-button>
+          <div v-if="!isTeyue && hasData">
+            <a-button type="default" @click="expandAllRow">{{ expandAll?'收起全部':'展开全部' }}</a-button>
+          </div>
+        </div>
+        <!-- 列表 -->
+        <categoryList ref="categoryList" @loaded="loadList" @del="delOk" @edit="handleEdit" :maxHeight="tableHeight"></categoryList>
+      </a-card>
+    </a-spin>
+
+    <!-- 差价设置 -->
+    <priceDiffModal ref="priceDiffModal" :openModal="openModal" @ok="resetGetData" @close="openModal=false"></pricediffmodal>
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable, VSelect } from '@/components'
+import { dealerDetailBySn } from '@/api/dealer'
+import ProductType from '@/views/common/productType.js'
+import ProductBrand from '@/views/common/productBrand.js'
+import priceDiffModal from './priceDiffModal.vue'
+import categoryList from './categoryList'
+export default {
+  name: 'RebateBinding',
+  mixins: [commonMixin],
+  components: { STable, VSelect, ProductType, ProductBrand, priceDiffModal, categoryList },
+  data () {
+    return {
+      spinning: false,
+      tableHeight: 0,
+      disabled: false, //  查询、重置按钮是否可操作
+      loading: false, //  表格加载中
+      openModal: false,
+      detail: null,
+      productType: [],
+      queryParam: { //  查询条件
+        rebateParentType: undefined,
+        priceLevel: undefined,
+        productBrandSn: undefined,
+        productTypeSn1: undefined,
+        productTypeSn2: undefined,
+        productTypeSn3: undefined,
+        dealerName: ''
+      },
+      showBtns: true,
+      expandAll: false,
+      hasData: false
+    }
+  },
+  computed: {
+    isTeyue () {
+      return this.detail && this.detail.dealerLevel == 'SPECIAL'
+    }
+  },
+  methods: {
+    // 返回
+    handleBack () {
+      this.$router.push({ name: 'merchantInfoManagementList', query: { closeLastOldTab: true } })
+    },
+    loadList (list) {
+      this.showBtns = this.isTeyue ? list.length == 0 : true
+      this.hasData = list.length > 0
+      this.$nextTick(() => {
+        if (!this.expandAll) {
+          this.expandAllRow()
+        }
+      })
+    },
+    // 查询
+    handleSearch () {
+      this.queryParam.dealerSn = this.$route.params.sn
+      const params = {}
+      for (const k in this.queryParam) {
+        if (this.queryParam[k]) {
+          params[k] = this.queryParam[k]
+        }
+      }
+      this.$refs.categoryList.pageInit(params, this.isTeyue)
+    },
+    //  产品分类  change
+    changeProductType (val, opt) {
+      this.queryParam.productTypeSn1 = val[0] ? val[0] : undefined
+      this.queryParam.productTypeSn2 = val[1] ? val[1] : undefined
+      this.queryParam.productTypeSn3 = val[2] ? val[2] : undefined
+    },
+    expandAllRow () {
+      if (this.expandAll) {
+        this.$refs.categoryList.foldAll()
+      } else {
+        this.$refs.categoryList.expandAll()
+      }
+      this.expandAll = !this.expandAll
+    },
+    resetGetData () {
+      this.expandAll = false
+      this.$refs.categoryList.dataSource = []
+      this.resetSearchForm()
+    },
+    // 重置表单
+    resetSearchForm () {
+      this.queryParam.dealerName = ''
+      this.queryParam.rebateParentType = undefined
+      this.queryParam.priceLevel = undefined
+      this.queryParam.productBrandSn = undefined
+      this.queryParam.productTypeSn1 = undefined
+      this.queryParam.productTypeSn2 = undefined
+      this.queryParam.productTypeSn3 = undefined
+      this.productType = []
+      this.handleSearch()
+      this.openModal = false
+    },
+    // 打开关联弹框
+    openGlModal () {
+      this.openModal = true
+      const checkedDealerSn = this.$refs.categoryList.checkedDealerSn
+      this.$refs.priceDiffModal.setData(this.$refs.rpType.getOptionDatas(), this.$route.params.sn, this.detail, checkedDealerSn)
+    },
+    // 编辑
+    handleEdit (row) {
+      this.openModal = true
+      this.$refs.priceDiffModal.editData(this.$refs.rpType.getOptionDatas(), this.$route.params.sn, this.detail, row)
+    },
+    // 删除成功
+    delOk () {
+      this.handleSearch()
+    },
+    // 详情
+    getDetail () {
+      this.spinning = true
+      dealerDetailBySn({ sn: this.$route.params.sn }).then(res => {
+        if (res.status == 200) {
+          this.detail = res.data
+          this.handleSearch()
+        }
+        this.spinning = false
+      })
+    },
+    pageInit () {
+      const _this = this
+      this.getDetail()
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - (!this.showBtns ? 50 : 205)
+    }
+  },
+  watch: {
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+    }
+  },
+  activated () {
+    // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
+    if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
+      this.pageInit()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .rebateBinding-wrap{
+    .rebateBinding-cont{
+      margin-bottom: 6px;
+    }
+  }
+</style>

+ 467 - 0
src/views/dealerManagement/rebateBinding/priceDiffModal.vue

@@ -0,0 +1,467 @@
+<template>
+  <a-modal
+    v-drag
+    centered
+    class="priceDifference-modal"
+    :footer="null"
+    :maskClosable="false"
+    :title="title"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="960">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div style="min-height:100px;">
+        <a-form-model
+          id="dealerAccountEdit-form"
+          ref="ruleForm"
+          :model="form"
+          :rules="rules"
+          :label-col="formItemLayout.labelCol"
+          :wrapper-col="formItemLayout.wrapperCol"
+        >
+          <a-form-model-item label="经销商名称">
+            {{ detailData&&detailData.dealerName }}
+          </a-form-model-item>
+          <a-form-model-item label="上级经销商" required>
+            <a-row :gutter="10">
+              <a-col :span="17">
+                <custList
+                  v-if="!form.dealerUpsSn || isSpecial"
+                  ref="custList"
+                  :notDealerSn="notDealer"
+                  :notDealerType="['SPECIAL']"
+                  @change="custSupChange"
+                  placeholder="请输入经销商名称搜索"></custList>
+                <a-input v-else :value="superDealerName" disabled />
+              </a-col>
+              <a-col :span="4" v-if="!isSpecial">
+                <a-input-number
+                  :precision="2"
+                  :min="0"
+                  :max="100"
+                  v-model="parentAllotRate"
+                  @change="rateSupChange"
+                  placeholder="请输入比例"/> %
+              </a-col>
+              <a-col :span="2" v-if="!isSpecial && zdDealearList.length<3">
+                <a-button
+                  type="primary"
+                  ghost
+                  @click="addItem()"
+                >添加指定</a-button>
+              </a-col>
+            </a-row>
+          </a-form-model-item>
+          <a-form-model-item label="指定经销商" v-if="zdDealearList.length">
+            <a-row :gutter="10" v-for="(item,index) in zdDealearList" :key="item.id">
+              <a-col :span="17">
+                <custList :ref="'custList-'+item.id" :notDealerSn="notZdDealer" @change="(v,r)=>custChange(v,r,index)" placeholder="请输入经销商名称搜索"></custList>
+              </a-col>
+              <a-col :span="4">
+                <a-input-number
+                  :precision="2"
+                  :min="0"
+                  :max="100"
+                  v-model="item.allotRate"
+                  @change="(v)=>rateChange(v,index)"
+                  placeholder="请输入比例"/> %
+              </a-col>
+              <a-col :span="2">
+                <!-- <a-button
+                  style="margin-right:5px;"
+                  v-if="index==zdDealearList.length-1 && zdDealearList.length<3"
+                  @click="addItem(item,index)"
+                  title="添加"
+                  size="small"
+                  shape="circle"
+                  icon="plus" /> -->
+                <a-button
+                  @click="delItem(item,index)"
+                  type="primary"
+                  title="删除"
+                  size="small"
+                  shape="circle"
+                  ghost
+                  icon="minus"/>
+              </a-col>
+            </a-row>
+          </a-form-model-item>
+          <a-form-model-item label="箭冠总公司" v-if="!isSpecial">
+            <a-row :gutter="10">
+              <a-col :span="17">
+                <a-input value="箭冠总公司" disabled />
+              </a-col>
+              <a-col :span="4">
+                <a-input-number
+                  :precision="2"
+                  :min="0"
+                  :max="100"
+                  v-model="hAllotRate"
+                  @change="rateHChange"
+                  placeholder="请输入比例"/> %
+              </a-col>
+            </a-row>
+          </a-form-model-item>
+        </a-form-model>
+      </div>
+      <div style="padding:10px 10px 10px 40px;">
+        <categoryTree v-if="showTable&&!isSpecial&&!form.dealerUpsSn" ref="categoryTree"></categoryTree>
+      </div>
+      <div class="btn-cont">
+        <a-button @click="isShow = false" style="font-size: 12px;">取消</a-button>
+        <a-button
+          type="primary"
+          style="margin-left: 20px;"
+          @click="handleSave"
+        >确定</a-button>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import custList from '@/views/common/custList.vue'
+import { VSelect } from '@/components'
+import { dealerUpsCreate, dealerUpsUpdate } from '@/api/dealer'
+import categoryTree from './categoryTree'
+export default {
+  name: 'PriceDiffModal',
+  mixins: [commonMixin],
+  components: { VSelect, custList, categoryTree },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      spinning: false,
+      isShow: this.openModal, //  是否打开弹框
+      title: '差价设置',
+      formItemLayout: {
+        labelCol: { span: 3 },
+        wrapperCol: { span: 20 }
+      },
+      form: {
+        dealerSn: undefined,
+        dealerUpsSn: undefined,
+        rebateParentType: [], // 差价归属
+        rebateDealerList: [], // 经销商列表
+        rebateScopeList: [] // 品类列表
+      },
+      parentAllotRate: '', // 上级经销商分配比例
+      hAllotRate: '', // 总部分配比例
+      rules: {
+        rebateParentType: [{ required: true, message: '请选择差价归属方', trigger: 'change' }]
+      },
+      cjgsfList: [],
+      zdDealearList: [],
+      detailData: null,
+      superDealerName: '',
+      checkedDealerSn: [],
+      showTable: false
+    }
+  },
+  computed: {
+    isSpecial () {
+      return this.detailData && this.detailData.dealerLevel == 'SPECIAL'
+    },
+    notDealer () {
+      return this.form.rebateDealerList.concat(this.zdDealearList).concat([{ 'parentDealerSn': this.form.dealerSn }])
+    },
+    notZdDealer () {
+      return this.form.rebateDealerList.concat(this.zdDealearList)
+    }
+  },
+  methods: {
+    // 新增
+    setData (list, dealerSn, detail, checkedDealerSn) {
+      this.detailData = detail
+      this.form.dealerSn = dealerSn
+      this.cjgsfList = list
+      this.checkedDealerSn = checkedDealerSn
+      // 如果当前经销商是特约经销商
+      if (this.detailData.dealerLevel == 'SPECIAL') {
+        // 默认只有上级经销商
+        this.cjgsgChange(['SUPERIORS'])
+      } else {
+        this.cjgsgChange(['SUPERIORS', 'HEAD'])
+      }
+    },
+    // 编辑
+    editData (list, dealerSn, detail, row) {
+      this.detailData = detail
+      this.form.dealerSn = dealerSn
+      this.form.dealerUpsSn = row.dealerUpsSn
+      this.cjgsfList = list
+      // 如果当前经销商是特约经销商
+      if (this.detailData.dealerLevel == 'SPECIAL') {
+        // 默认只有上级经销商
+        this.form.rebateParentType = ['SUPERIORS']
+      } else {
+        this.form.rebateParentType = ['SUPERIORS', 'HEAD']
+      }
+
+      console.log(row)
+      if (row) {
+        row.rebateDealerList.map(item => {
+          const row = {
+            'id': item.id,
+            'dealerSn': item.dealerSn,
+            'parentDealerSn': item.parentDealerSn,
+            'rebateParentType': item.rebateParentType,
+            'dealerRelationSn': item.dealerRelationSn,
+            'allotRate': Number(item.allotRate * 100).toFixed(2)
+          }
+          // 指定
+          if (item.rebateParentType == 'ASSIGN') {
+            this.zdDealearList.push(row)
+            this.$nextTick(() => {
+              this.$refs['custList-' + item.id][0].setDufaultVal(item.parentDealer.dealerName)
+            })
+          } else {
+            // 上级和总部
+            if (item.rebateParentType == 'SUPERIORS') {
+              this.form.rebateDealerList[0] = row
+              this.parentAllotRate = Number(item.allotRate * 100).toFixed(2)
+              // 特约可编辑上级
+              if (this.detailData.dealerLevel == 'SPECIAL') {
+                this.$nextTick(() => {
+                  this.$refs.custList.setDufaultVal(item.parentDealer.dealerName)
+                })
+              } else {
+                // 其它不可编辑
+                this.superDealerName = item.parentDealer.dealerName
+              }
+            } else {
+              this.form.rebateDealerList[1] = row
+              this.hAllotRate = Number(item.allotRate * 100).toFixed(2)
+            }
+          }
+        })
+      }
+    },
+    // 上级经销商修改
+    custSupChange (val, row) {
+      console.log(val, row)
+      this.form.rebateDealerList[0]['parentDealerSn'] = val.key
+      this.showTable = !!val.key
+      if (!this.isSpecial) {
+        this.$nextTick(() => {
+          this.getCategoryList()
+        })
+      }
+    },
+    rateSupChange (val) {
+      this.form.rebateDealerList[0]['allotRate'] = val
+    },
+    // 刷新品类列表
+    getCategoryList () {
+      const parentDealerSn = this.form.rebateDealerList[0]['parentDealerSn']
+      if (parentDealerSn) {
+        // 查询品类树
+        this.$refs.categoryTree.pageInit(this.detailData, parentDealerSn, this.form.dealerSn)
+      }
+    },
+    rateHChange (val) {
+      this.form.rebateDealerList[1]['allotRate'] = val
+    },
+    // 指定经销商变更
+    custChange (val, row, index) {
+      console.log(val, index)
+      this.zdDealearList[index]['parentDealerSn'] = val.key
+    },
+    rateChange (val, index) {
+      console.log(val, index)
+      this.zdDealearList[index]['allotRate'] = val
+    },
+    // 差价归属变更
+    cjgsgChange (val) {
+      console.log(val)
+      this.form.rebateParentType = val
+      // 指定经销商
+      if (val.indexOf('ASSIGN') >= 0) {
+        if (this.zdDealearList.length == 0) {
+          this.addItem()
+        }
+      } else {
+        this.zdDealearList = []
+      }
+      // 上级经销商
+      if (val.indexOf('SUPERIORS') >= 0) {
+        if (!this.form.rebateDealerList[0]) {
+          this.form.rebateDealerList[0] = {
+            'id': new Date().getTime(),
+            'dealerSn': this.form.dealerSn,
+            'parentDealerSn': undefined,
+            'rebateParentType': 'SUPERIORS',
+            'allotRate': 100
+          }
+          this.parentAllotRate = 100
+        }
+      } else {
+        this.form.rebateDealerList[0] = null
+        this.parentAllotRate = ''
+      }
+      // 总部经销商
+      if (val.indexOf('HEAD') >= 0) {
+        if (!this.form.rebateDealerList[1]) {
+          this.form.rebateDealerList[1] = {
+            'id': new Date().getTime() - 100,
+            'dealerSn': this.form.dealerSn,
+            'parentDealerSn': 1,
+            'rebateParentType': 'HEAD',
+            'allotRate': 0
+          }
+          this.hAllotRate = 0
+        }
+      } else {
+        this.form.rebateDealerList[1] = null
+        this.hAllotRate = ''
+      }
+    },
+    // 增加指定经销商
+    addItem (row, index) {
+      const sn = new Date().getTime()
+      this.zdDealearList.push({
+        'id': sn,
+        'dealerSn': this.form.dealerSn,
+        'parentDealerSn': undefined,
+        'rebateParentType': 'ASSIGN',
+        'allotRate': ''
+      })
+    },
+    // 删除指定经销商
+    delItem (row, index) {
+      const i = this.zdDealearList.findIndex(item => item.id == row.id)
+      if (i >= 0) {
+        this.zdDealearList.splice(i, 1)
+      }
+    },
+    // 重置表单
+    resetForm () {
+      if (this.isSpecial || !this.form.dealerUpsSn) {
+        this.$refs.custList.resetForm()
+      }
+      this.form.dealerSn = undefined
+      this.form.dealerUpsSn = undefined
+      this.form.rebateParentType = []
+      this.form.rebateDealerList = []
+      this.form.rebateScopeList = []
+      this.zdDealearList = []
+      this.hAllotRate = ''
+      this.parentAllotRate = 100
+      this.showTable = false
+    },
+    // 校验数据
+    validateFormData (data) {
+      let row
+      let msg = ''
+      for (let i = 0; i < data.length; i++) {
+        row = data[i]
+        if (row) {
+          const rebateParentType = this.cjgsfList.find(item => item.code == row.rebateParentType)
+          const type = rebateParentType ? rebateParentType.dispName : ''
+          if (!row.parentDealerSn) {
+            msg = '请选择' + type
+            break
+          }
+          if (!row.allotRate && row.rebateParentType == 'ASSIGN') {
+            msg = '请输入' + type + '的分配比例'
+            break
+          }
+        }
+      }
+      return msg
+    },
+    // 保存
+    handleSave () {
+      const _this = this
+      _this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const formData = JSON.parse(JSON.stringify(_this.form))
+          formData.rebateDealerList = formData.rebateDealerList.concat(JSON.parse(JSON.stringify(this.zdDealearList)))
+          console.log(formData)
+          // 校验数据
+          const errorMsg = this.validateFormData(formData.rebateDealerList)
+          console.log(errorMsg)
+          if (errorMsg) {
+            _this.$message.error(errorMsg)
+          } else {
+            // 处理数据并校验比例之和是否100
+            let pa = 0
+            formData.rebateDealerList = formData.rebateDealerList.filter(item => item)
+            formData.rebateDealerList.map(item => {
+              item.allotRate = item.allotRate ? (item.allotRate / 100) : 0
+              pa += item.allotRate
+              delete item.id
+            })
+            console.log(formData)
+            console.log(Number(pa).toFixed(2))
+            if (Number(pa).toFixed(2) != 1) {
+              _this.$message.error('差价比例之和必须是100%')
+              return
+            }
+
+            if (!this.isSpecial && !this.form.dealerUpsSn) {
+              formData.rebateScopeList = this.$refs.categoryTree.getResult()
+              if (formData.rebateScopeList.length == 0) {
+                _this.$message.error('请选择品类')
+                return
+              }
+            }
+
+            delete formData.rebateParentType
+
+            // 提交数据
+            _this.spinning = true
+            const fun = this.form.dealerUpsSn ? dealerUpsUpdate : dealerUpsCreate
+            fun(formData).then(res => {
+              if (res.status == 200) {
+                _this.$message.success(res.message)
+                _this.isShow = false
+                setTimeout(() => {
+                  _this.$emit('ok')
+                }, 100)
+              }
+              _this.spinning = false
+            })
+          }
+        } else {
+          return false
+        }
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.resetForm()
+        this.$emit('close')
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .priceDifference-modal{
+    .ant-modal-body {
+      padding: 24px!important;
+      .ant-input[disabled]{
+        color:#666;
+      }
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 15px 0 10px;
+    }
+  }
+</style>

+ 78 - 74
src/views/power/role/menuModal.vue

@@ -18,25 +18,25 @@
           :label-col="formItemLayout.labelCol"
           :wrapper-col="formItemLayout.wrapperCol"
         >
-         <div style="display:flex;justify-content: flex-end;align-items: center;" v-if="authType==0">
-           <div style="width:270px;text-align: right;flex:1;">快捷全选:</div>
-           <div style="padding:0 10px;">
-            <a-checkbox-group :value="authAllPrice" :options="priceOptions" @change="onPriceChange" />
-           </div>
-         </div>
-         <div style="height: 500px;overflow-y: auto;">
+          <div style="display:flex;justify-content: flex-end;align-items: center;" v-if="authType==0">
+            <div style="width:270px;text-align: right;flex:1;">快捷全选:</div>
+            <div style="padding:0 10px;">
+              <a-checkbox-group :value="authAllPrice" :options="priceOptions" @change="onPriceChange" />
+            </div>
+          </div>
+          <div style="height: 500px;overflow-y: auto;">
             <a-tree
-            checkable
-            :selectable="false"
-            @check="onCheck"
-            @expand="onExpand"
-            :expandedKeys="expandedKeys"
-            :autoExpandParent="autoExpandParent"
-            v-model="checkedKeys"
-            :treeData="treeData"
-          >
-          <a-icon v-if="authType == 0" slot="switcherIcon" type="file" />
-          </a-tree>
+              checkable
+              :selectable="false"
+              @check="onCheck"
+              @expand="onExpand"
+              :expandedKeys="expandedKeys"
+              :autoExpandParent="autoExpandParent"
+              v-model="checkedKeys"
+              :treeData="treeData"
+            >
+              <a-icon v-if="authType == 0" slot="switcherIcon" type="file" />
+            </a-tree>
           </div>
           <a-form-model-item :label-col="{span: 0}" :wrapper-col="{span: 24}" style="text-align: center;margin: 18px 0 0;">
             <a-button id="roleMenuEdit-cancel" :style="{ marginRight: '10px' }" @click="isshow=false">取消</a-button>
@@ -74,23 +74,23 @@ export default {
     return {
       spinning: false,
       treeData: [],
-      priceOptions:[],
+      priceOptions: [],
       titleText: '',
       expandedKeys: [],
       autoExpandParent: true,
       checkedKeys: [],
       halfCheckedKeys: [],
       checkedData: [],
-      authPriceData:[],
+      authPriceData: [],
       isshow: this.visible,
       formItemLayout: {
         labelCol: { span: 6 },
         wrapperCol: { span: 16 }
       },
       authAllPrice: [],
-      leafNode:[],
-      checkLeafNode:[],
-      priceCheckNode:[],
+      leafNode: [],
+      checkLeafNode: [],
+      priceCheckNode: [],
       form: {},
       rules: {},
       authType: '1',
@@ -111,52 +111,52 @@ export default {
       info.checkedNodes.map(item => {
         const node = item.data.props
         const a = node.code.split('_')
-        this.checkLeafNode.push({pr:a[a.length-1],id:node.id})
+        this.checkLeafNode.push({ pr: a[a.length - 1], id: node.id })
       })
       this.hasAllSelect()
     },
     // 判断某分类是否全选
-    hasAllSelect(){
+    hasAllSelect () {
       // console.log(this.leafNode)
       // console.log(this.checkLeafNode)
       this.authAllPrice = []
       this.priceOptions.map(item => {
         const a = this.leafNode.filter(n => n.pr == item.value)
         const b = this.checkLeafNode.filter(n => n.pr == item.value)
-        if(a&&b&&a.length == b.length && !this.authAllPrice.find(d => d==item.value)){
+        if (a && b && a.length == b.length && !this.authAllPrice.find(d => d == item.value)) {
           this.authAllPrice.push(item.value)
         }
       })
     },
     // 全选某分类价格
-    allSelect(data,authPrice,flag){
+    allSelect (data, authPrice, flag) {
       const _this = this
       for (let i = 0; i < data.length; i++) {
         const node = data[i]
         const a = node.code.split('_')
-        if(a[a.length-1] == authPrice){
+        if (a[a.length - 1] == authPrice) {
           // 全选
-          if(flag){
+          if (flag) {
             _this.checkedKeys.push(node.id)
-          }else{
+          } else {
             // 取消
             _this.checkedKeys = _this.checkedKeys.filter(item => item != node.id)
           }
-        } 
+        }
         if (node.children && node.children.length) {
           _this.allSelect(node.children, authPrice, flag)
         }
       }
     },
-    onPriceChange(val){
+    onPriceChange (val) {
       // 全选
-      if(this.authAllPrice.length < val.length){
-        let tempVal = val.filter(item=>!this.authAllPrice.includes(item))
+      if (this.authAllPrice.length < val.length) {
+        const tempVal = val.filter(item => !this.authAllPrice.includes(item))
         console.log(tempVal)
         this.allSelect(this.nowData.allMenuList, tempVal[0], true)
-      }else{
+      } else {
         // 取消
-        let tempVal = this.authAllPrice.filter(item=>!val.includes(item))
+        const tempVal = this.authAllPrice.filter(item => !val.includes(item))
         this.allSelect(this.nowData.allMenuList, tempVal[0], false)
       }
       this.authAllPrice = val
@@ -170,13 +170,13 @@ export default {
           const checkData = this.authType == 1 ? this.priceCheckNode : this.checkedData.filter(item => !this.priceCheckNode.includes(item))
           // 功能权限时,首次半选节点拿不到值(this.halfCheckedKeys为空时),
           // 此时通过从所有已选checkedData数据中过滤当前选择的功能菜单和已选的价格菜单,剩下的就是半选节点
-          let halfCheckedKeys = this.halfCheckedKeys.length ? this.halfCheckedKeys : this.checkedData.filter(item => ![...this.checkedKeys,...checkData].includes(item))
+          let halfCheckedKeys = this.halfCheckedKeys.length ? this.halfCheckedKeys : this.checkedData.filter(item => ![...this.checkedKeys, ...checkData].includes(item))
           // 功能权限没有选择任何菜单或价格权限时,halfCheckedKeys 半选节点为空
-          if(this.checkedKeys.length==0 || this.authType == 0){
+          if (this.checkedKeys.length == 0 || this.authType == 0) {
             halfCheckedKeys = []
           }
           // 最终保存的节点,包括当前已选的和半选的节点
-          const arr = [...this.checkedKeys, ...halfCheckedKeys, ...checkData].filter((x, index,self)=>self.indexOf(x)===index) 
+          const arr = [...this.checkedKeys, ...halfCheckedKeys, ...checkData].filter((x, index, self) => self.indexOf(x) === index)
           console.log(arr, '--444--')
           _this.spinning = true
           addMenuPower({ id: this.id, menuIds: arr.join(',') }).then(res => {
@@ -204,9 +204,9 @@ export default {
       this.checkedKeys = []
       this.expandedKeys = []
     },
-    isPriceNode(node){
+    isPriceNode (node) {
       const a = node.code.split('_')
-      const c = this.priceOptions.find(item => item.value == a[a.length-1])
+      const c = this.priceOptions.find(item => item.value == a[a.length - 1])
       return c
     },
     // 查找叶子节点
@@ -217,9 +217,9 @@ export default {
         if (node.children && node.children.length) {
           this.findLeaf(node.children, arr)
         } else {
-          if(_this.isPriceNode(node)){
-            data.splice(i,1)
-          }else{
+          if (_this.isPriceNode(node)) {
+            data.splice(i, 1)
+          } else {
             node.class = 'isLeaf'
             const hasNode = arr.find(item => item == node.id)
             const hasCheck = _this.checkedKeys.find(item => item == node.id)
@@ -232,33 +232,33 @@ export default {
       }
     },
     // 查找有价格权限的菜单
-    findPrice(data, arr){
+    findPrice (data, arr) {
       const _this = this
       for (let i = 0; i < data.length; i++) {
         const node = data[i]
         const a = node.code.split('_')
         // 已选节点勾选
         const hasNode = arr.find(item => item == node.id)
-        if(!_this.isPriceNode(node)){
+        if (!_this.isPriceNode(node)) {
           // 删除此节点
           node.checkable = false
-          node.title = node.title.replace('(必选)','')
-          if(!node.children||node.children.length==0){
-            data.splice(i,1)
+          node.title = node.title.replace('(必选)', '')
+          if (!node.children || node.children.length == 0) {
+            data.splice(i, 1)
           }
-        }else{
+        } else {
           node.class = 'leafNode'
           _this.expandedKeys.push(node.id)
           // 默认回显已选节点
           const hasCheck = _this.checkedKeys.find(item => item == node.id)
           if (hasNode && !hasCheck) {
             _this.checkedKeys.push(node.id)
-            _this.checkLeafNode.push({pr:a[a.length-1],id:node.id})
+            _this.checkLeafNode.push({ pr: a[a.length - 1], id: node.id })
           }
           // 统计价格节点
           const hasLeaf = _this.leafNode.find(item => item.id == node.id)
-          if(!hasLeaf){
-            _this.leafNode.push({pr:a[a.length-1],id:node.id})
+          if (!hasLeaf) {
+            _this.leafNode.push({ pr: a[a.length - 1], id: node.id })
           }
         }
 
@@ -268,12 +268,12 @@ export default {
       }
     },
     // 根据id查找是否价格菜单
-    getPriceTreeNode(data, arr){
+    getPriceTreeNode (data, arr) {
       const _this = this
       for (let i = 0; i < data.length; i++) {
         const node = data[i]
-        if(_this.isPriceNode(node)){
-           // 默认回显已选节点
+        if (_this.isPriceNode(node)) {
+          // 默认回显已选节点
           const hasCheck = _this.priceCheckNode.find(item => item == node.id)
           // 已选节点勾选
           const hasNode = arr.find(item => item == node.id)
@@ -286,9 +286,9 @@ export default {
         }
       }
     },
-    pageInit(){
+    pageInit () {
       this.id = this.nowData.role.id
-      this.titleText = (this.nowData.type == 1 ? '功能权限分配': '价格权限分配') + '(' + this.nowData.role.name + ')'
+      this.titleText = (this.nowData.type == 1 ? '功能权限分配' : '价格权限分配') + '(' + this.nowData.role.name + ')'
       // 已选节点
       const arr = this.nowData.role.menuIds
       // 权限类型, 1功能权限设置,0 价格权限设置
@@ -303,33 +303,32 @@ export default {
       this.getPriceTreeNode(treeData, this.checkedData)
 
       // 功能权限设置
-      if(this.authType == 1){
+      if (this.authType == 1) {
         this.findLeaf(treeData, this.checkedData)
       }
       // 价格权限设置
-      if(this.authType == 0){
+      if (this.authType == 0) {
         this.findPrice(treeData, this.checkedData)
         this.hasAllSelect()
       }
       // console.log(this.checkedKeys)
       // console.log(this.checkedData)
-      
+
       this.treeData = treeData
 
-      if(this.authType == 0){
+      if (this.authType == 0) {
         let leafNodes = []
-        setTimeout(()=>{
-          if(leafNodes.length == 0){
+        setTimeout(() => {
+          if (leafNodes.length == 0) {
             leafNodes = document.querySelectorAll('ul > li.leafNode:first-child')
-            for(let i=0;i<leafNodes.length;i++){
+            for (let i = 0; i < leafNodes.length; i++) {
               const cn = leafNodes[i].parentNode.className
-              leafNodes[i].parentNode.className += cn.indexOf('leafParent')<0 ? ' leafParent' : ''
+              leafNodes[i].parentNode.className += cn.indexOf('leafParent') < 0 ? ' leafParent' : ''
               leafNodes[i].parentNode.parentNode.style.padding = '6px 0'
             }
           }
-        },100)
+        }, 100)
       }
-      
     }
   },
   watch: {
@@ -348,7 +347,7 @@ export default {
         this.checkedKeys = []
         this.expandedKeys = []
         this.titleText = '新增角色'
-      }else{
+      } else {
         this.priceOptions = this.$store.state.app.priceAuthOptions
       }
     },
@@ -391,20 +390,25 @@ export default {
   .ant-tree li ul{
     white-space: pre-wrap;
   }
-
+  .ant-tree li{
+    border-left:1px solid #eee;
+  }
   .leafParent{
     display: inline-block;
     width: 80%;
     float: right;
   }
-  
-  .isLeaf{
+
+  .ant-tree li.isLeaf{
     display: inline-block;
     width: 25%;
+    border:0;
   }
-  .leafNode{
+
+  .ant-tree li.leafNode{
     display: inline-block;
     padding: 0;
+     border:0;
     &:first-child{
       padding: 0;
     }
@@ -413,5 +417,5 @@ export default {
     }
   }
 }
-  
+
 </style>

+ 25 - 12
src/views/promotionRulesManagement/dealerPromotions/chooseDealer.vue

@@ -16,7 +16,7 @@
           </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>
+              <dealerType id="chooseDealer-dealerType" changeOnSelect v-model="dealerType" @change="getDealerType" allowClear></dealertype>
             </a-form-item>
           </a-col>
           <a-col :md="8" :sm="24">
@@ -44,8 +44,8 @@
       </div>
     </div>
     <a-table
-      style="height: 320px;"
-      :scroll="{ y: 230 }"
+      style="height: 420px;"
+      :scroll="{ y: 330 }"
       :bordered="true"
       :pagination="pagination"
       :row-key="record => record.dealerSn"
@@ -53,6 +53,7 @@
       :columns="columns"
       :data-source="dealerList"
       @change="handlePage"
+      :loading="spinning"
     >
       <template slot="addressInfo" slot-scope="text, record">
         {{ record.provinceName }}{{ '-'+ record.cityName }}{{ '-'+ record.districtName }}
@@ -68,10 +69,11 @@ import AreaList from '@/views/common/areaList.js'
 import subarea from '@/views/common/subarea.js'
 import { queryDealerPage } from '@/api/promotion'
 import { getDealerListInfo } from '@/api/dealer'
+import dealerType from '@/views/common/dealerType.js'
 export default {
   name: 'ChooseDealer',
   mixins: [commonMixin],
-  components: { STable, VSelect, subarea, AreaList },
+  components: { STable, VSelect, subarea, AreaList, dealerType },
   props: {
     parentData: {
       type: Object,
@@ -87,9 +89,11 @@ export default {
   data () {
     return {
       spinning: false,
+      dealerType: [],
       queryParam: { //  查询条件
         nameLike: '',
-        dealerType: null,
+        dealerType1: undefined, //  商户类型
+        dealerType2: undefined, //  商户类型
         dealerLevel: null,
         subareaArea: {
           subareaSn: undefined, //  区域
@@ -113,13 +117,13 @@ export default {
       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: '地区', scopedSlots: { customRender: 'addressInfo' }, width: '30%', align: 'left', ellipsis: true },
+        { title: '经销商名称', dataIndex: 'dealerName', width: '30%', align: 'left', 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: 'dealerTypeName', width: '29%', 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 || '--' } }
+        { title: '所在区域', dataIndex: 'subareaArea.subareaName', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '所在分区', dataIndex: 'subareaArea.subareaAreaName', width: '13%', align: 'center', customRender: function (text) { return text || '--' } }
       ]
     }
   },
@@ -153,6 +157,9 @@ export default {
           const no = 0
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
+            if (data.list[i].dealerTypeName1) {
+              data.list[i].dealerTypeName = data.list[i].dealerTypeName1 + '>' + data.list[i].dealerTypeName2
+            }
           }
           this.dealerList = data.list
           this.pagination = pagination
@@ -168,6 +175,10 @@ export default {
     rowSelectionFun (obj) {
       this.rowSelectionInfo = obj || null
     },
+    getDealerType (v, o) {
+      this.queryParam.dealerType1 = v[0]
+      this.queryParam.dealerType2 = v[1]
+    },
     areaChange (val) {
       this.queryParam.provinceSn = val[0] ? val[0] : ''
       this.queryParam.citySn = val[1] ? val[1] : ''
@@ -175,7 +186,7 @@ export default {
     },
     searchForm () {
       this.loadData()
-      this.spinning = false
+      // this.spinning = false
     },
     subareaChange (val) {
       this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
@@ -183,9 +194,11 @@ export default {
     },
     //  重置
     resetSearchForm () {
+      this.dealerType = []
       this.queryParam = {
         nameLike: '',
-        dealerType: null,
+        dealerType1: undefined, //  商户类型
+        dealerType2: undefined, //  商户类型
         dealerLevel: null,
         subareaArea: {
           subareaSn: undefined, //  区域

+ 19 - 7
src/views/promotionRulesManagement/promotionManagement/chooseDealer.vue

@@ -16,7 +16,7 @@
           </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>
+              <dealerType id="chooseDealer-dealerType" changeOnSelect v-model="dealerType" @change="getDealerType" allowClear></dealertype>
             </a-form-item>
           </a-col>
           <a-col :md="8" :sm="24">
@@ -79,10 +79,11 @@ import { STable, VSelect } from '@/components'
 import AreaList from '@/views/common/areaList.js'
 import { dealerQueryList, getDealerListInfo } from '@/api/dealer'
 import subarea from '@/views/common/subarea.js'
+import dealerType from '@/views/common/dealerType.js'
 export default {
   name: 'ChooseDealer',
   mixins: [commonMixin],
-  components: { STable, VSelect, subarea, AreaList },
+  components: { STable, VSelect, subarea, AreaList, dealerType },
   props: {
     pageType: {
       type: String,
@@ -102,9 +103,11 @@ export default {
   data () {
     return {
       spinning: false,
+      dealerType: [],
       queryParam: { //  查询条件
         nameLike: '',
-        dealerType: null,
+        dealerType1: undefined, //  商户类型
+        dealerType2: undefined, //  商户类型
         dealerLevel: null,
         subareaArea: {
           subareaSn: undefined, //  区域
@@ -135,9 +138,9 @@ export default {
     },
     columns () {
       const arr = [
-        { 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: 'dealerName', width: '25%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '商户别名', dataIndex: 'dealerAlias', align: 'left', width: '25%', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '商户类型', dataIndex: 'dealerTypeName', width: '20%', 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 || '--' } }
@@ -173,6 +176,9 @@ export default {
           const no = 0
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
+            if (data.list[i].dealerTypeName1) {
+              data.list[i].dealerTypeName = data.list[i].dealerTypeName1 + '>' + data.list[i].dealerTypeName2
+            }
           }
           this.dealerList = data.list
           this.pagination = pagination
@@ -201,11 +207,17 @@ export default {
       this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
       this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
     },
+    getDealerType (v, o) {
+      this.queryParam.dealerType1 = v[0]
+      this.queryParam.dealerType2 = v[1]
+    },
     //  重置
     resetSearchForm () {
+      this.dealerType = []
       this.queryParam = {
         nameLike: '',
-        dealerType: null,
+        dealerType1: undefined, //  商户类型
+        dealerType2: undefined, //  商户类型
         dealerLevel: null,
         subareaArea: {
           subareaSn: undefined, //  区域

+ 19 - 18
src/views/reportData/hPriceDifferenceDetailReport/list.vue

@@ -76,21 +76,21 @@
                 </a-form-model-item>
               </a-col>
               <a-col :md="5" :sm="24">
-                <a-form-model-item label="省级区域">
-                  <Area id="hPriceDifferenceDetailList-provinceSn" v-model="queryParam.dealer.provinceSn" placeholder="请选择省"></Area>
+                <a-form-model-item label="省">
+                  <Area id="hPriceDifferenceDetailList-provinceSn" v-model="queryParam.dealer.provinceSn" placeholder="请选择省"></Area>
                 </a-form-model-item>
               </a-col>
               <a-col :md="6" :sm="24">
-                <a-form-model-item label="类型" prop="bizType">
-                  <a-select id="hPriceDifferenceDetailList-bizType" allowClear v-model="queryParam.bizType" placeholder="请选择类型">
+                <a-form-model-item label="单据类型" prop="bizType">
+                  <a-select id="hPriceDifferenceDetailList-bizType" allowClear v-model="queryParam.bizType" placeholder="请选择单据类型">
                     <a-select-option v-for="item in bizTypeList" :value="item.value" :key="item.value">{{ item.name }}</a-select-option>
                   </a-select>
                 </a-form-model-item>
               </a-col>
-              <a-col :md="6" :sm="24" v-show="isShowCustomerSearch">
-                <a-form-item label="客服">
+              <a-col :md="7" :sm="24" v-show="isShowCustomerSearch">
+                <a-form-model-item label="客服">
                   <customerService ref="customerName" v-model="queryParam.bizUserSn"></customerService>
-                </a-form-item>
+                </a-form-model-item>
               </a-col>
             </template>
             <a-col :md="isShowCustomerSearch?24:6" :sm="24" style="margin-bottom: 10px;" :style="{textAlign: isShowCustomerSearch?'center':''}">
@@ -139,8 +139,7 @@
               <a-col :md="6" :sm="24" >分公司金额:{{ (totalData && (totalData.wholesalePrice1 || totalData.wholesalePrice1==0)) ? toThousands(totalData.wholesalePrice1) : '--' }}</a-col>
               <a-col :md="6" :sm="24" >加盟商金额:{{ (totalData && (totalData.wholesalePrice2 || totalData.wholesalePrice2==0)) ? toThousands(totalData.wholesalePrice2) : '--' }}</a-col>
               <a-col :md="6" :sm="24" >特约加盟店金额:{{ (totalData && (totalData.wholesalePrice3 || totalData.wholesalePrice3==0)) ? toThousands(totalData.wholesalePrice3) : '--' }}</a-col>
-              <a-col :md="6" :sm="24" >直接差价金额:{{ (totalData && (totalData.directRebateAmount || totalData.directRebateAmount==0)) ? toThousands(totalData.directRebateAmount) : '--' }}</a-col>
-              <a-col :md="6" :sm="24" >间接差价金额:{{ (totalData && (totalData.indirectRebateAmount || totalData.indirectRebateAmount==0)) ? toThousands(totalData.indirectRebateAmount) : '--' }}</a-col>
+              <a-col :md="6" :sm="24" >差价金额:{{ (totalData && (totalData.rebateAmount || totalData.rebateAmount==0)) ? toThousands(totalData.rebateAmount) : '--' }}</a-col>
             </a-row>
           </template>
         </s-table>
@@ -228,6 +227,9 @@ export default {
               if (data.list[i].bizType) {
                 data.list[i].bizTypeValue = data.list[i].bizType == 'SALES' ? '采购差价' : data.list[i].bizType == 'SALES_RETURN' ? '退货差价' : ''
               }
+              if (data.list[i].rebateRate || data.list[i].rebateRate == 0) {
+                data.list[i].rebateRate = data.list[i].rebateRate * 100 + '%'
+              }
             }
             this.disabled = false
           }
@@ -252,10 +254,11 @@ export default {
         { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '区域负责人', dataIndex: 'subareaArea.bizUserName', width: 100, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '订单号', dataIndex: 'bizNo', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '日期', dataIndex: 'bizCreateDate', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '日期', dataIndex: 'bizDate', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '省份', dataIndex: 'provinceName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '直接绑定客户名称', dataIndex: 'directDealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '间接绑定客户名称', dataIndex: 'indirectDealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '差价归属方', dataIndex: 'parentDealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '百分比', dataIndex: 'rebateRate', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '差价归属类型', dataIndex: 'rebateParentTypeDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '客户名称', dataIndex: 'buyerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '客户级别', dataIndex: 'buyerLevelDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '品牌', dataIndex: 'productBrandName', width: 130, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
@@ -264,15 +267,13 @@ export default {
         // { title: '分公司金额', dataIndex: 'wholesalePrice1', width: 90, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         // { title: '加盟商金额', dataIndex: 'wholesalePrice2', width: 90, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         // { title: '特约加盟店金额', dataIndex: 'wholesalePrice3', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        // { title: '直接差价', dataIndex: 'directRebateAmount', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        // { title: '间接差价', dataIndex: 'indirectRebateAmount', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '类型', dataIndex: 'bizTypeValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } }
+        // { title: '差价金额', dataIndex: 'rebateAmount', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单据类型', dataIndex: 'bizTypeValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } }
       ]
       arr.splice(11, 0, { title: '分公司金额', dataIndex: 'wholesalePrice1', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
       arr.splice(12, 0, { title: '加盟商金额', dataIndex: 'wholesalePrice2', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
       arr.splice(13, 0, { title: '特约加盟店金额', dataIndex: 'wholesalePrice3', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-      arr.splice(14, 0, { title: '直接差价', dataIndex: 'directRebateAmount', width: 80, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-      arr.splice(15, 0, { title: '间接差价', dataIndex: 'indirectRebateAmount', width: 80, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      arr.splice(14, 0, { title: '差价金额', dataIndex: 'rebateAmount', width: 80, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
       return arr
     }
   },
@@ -372,7 +373,7 @@ export default {
       this.queryParam.subareaArea.bizUserSn = undefined
       this.queryParam.dealer.provinceSn = undefined
       this.queryParam.product.brandType = ''
-      this.queryParam.product.productBrandSn = ''
+      this.queryParam.product.productBrandSn = undefined
       this.queryParam.product.productTypeSn1 = ''
       this.queryParam.product.productTypeSn2 = ''
       this.queryParam.product.productTypeSn3 = ''

+ 36 - 23
src/views/reportData/priceDifferenceDetailReport/list.vue

@@ -35,7 +35,7 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-model-item label="客户名称">
-                <dealerSubareaScopeList id="priceDifferenceDetailList-custList" ref="custList" :itemSn="queryParam.dealerSn" @change="custChange"></dealerSubareaScopeList>
+                <dealerSubareaScopeList id="priceDifferenceDetailList-custList" ref="custList" :itemSn="queryParam.buyerSn" @change="custChange"></dealerSubareaScopeList>
               </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24" v-show="isShowCustomerSearch">
@@ -43,6 +43,18 @@
                 <customerService ref="customerName" v-model="queryParam.bizUserSn"></customerService>
               </a-form-item>
             </a-col>
+            <a-col :md="6" :sm="24" v-show="isShowCustomerSearch">
+              <a-form-item label="单据类型">
+                <v-select
+                  v-model="queryParam.bizType"
+                  ref="bizType"
+                  id="priceDifferenceDetailList-bizType"
+                  code="REBATE_BILL_BIZ_TYPE"
+                  placeholder="请选择单据类型"
+                  allowClear></v-select>
+              </a-form-item>
+            </a-col>
+
             <a-col :md="isShowCustomerSearch?6:24" :sm="24" style="margin-bottom: 10px;" :style="{textAlign: isShowCustomerSearch?'':'center'}">
               <a-button type="primary" @click="handleSearch" :disabled="disabled" id="priceDifferenceDetailList-refresh">查询</a-button>
               <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="priceDifferenceDetailList-reset">重置</a-button>
@@ -79,17 +91,17 @@
           <template slot="footer">
             <table>
               <tr>
-                <td width="51%" colspan="4"></td>
-                <td width="8%">
+                <td width="41%" colspan="4">总计:</td>
+                <td width="8%" align="right">
                   <div>实售金额:{{ (totalData && (totalData.totalRealAmount || totalData.totalRealAmount==0)) ? toThousands(totalData.totalRealAmount) : '--' }}</div>
                 </td>
-                <td width="8%">
+                <td width="8%" align="right">
                   <div>开单金额:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</div>
                 </td>
-                <td width="8%">
-                  <div>差价金额:{{ (totalData && (totalData.rebateAmount || totalData.rebateAmount==0)) ? toThousands(totalData.rebateAmount) : '--' }}</div>
+                <td width="8%" align="right">
+                  <div>差价金额:{{ (totalData && (totalData.directRebateAmount || totalData.directRebateAmount==0)) ? toThousands(totalData.directRebateAmount) : '--' }}</div>
                 </td>
-                <td width="25%" colspan="2"></td>
+                <td width="34%" colspan="3"></td>
               </tr>
             </table>
           </template>
@@ -121,15 +133,15 @@ export default {
   data () {
     return {
       spinning: false,
-      advanced: false, // 高级搜索 展开/关闭
       exportLoading: false,
       showExport: false,
       queryParam: { //  查询条件
         month: moment().format('YYYY-MM'),
         provinceSn: undefined,
-        rebateDealerSn: undefined,
-        dealerSn: undefined,
-        bizUserSn: undefined
+        parentDealerSn: undefined,
+        buyerSn: undefined,
+        bizUserSn: undefined,
+        bizType: undefined // 单据类型
       },
       rules: {
         'month': [{ required: true, message: '请选择月份', trigger: 'change' }],
@@ -168,16 +180,17 @@ export default {
     columns () {
       const _this = this
       const arr = [
-        { title: '月份', dataIndex: 'month', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '月份', dataIndex: 'bizDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '省份', dataIndex: 'provinceName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '记账门店', dataIndex: 'rebateDealerName', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '客户名称', dataIndex: 'dealerName', width: '16%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '记账门店', dataIndex: 'parentDealerName', width: '10%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '客户名称', dataIndex: 'buyerName', width: '12%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '产品品牌+二级分类', dataIndex: 'productBrandAndType2', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '类型', dataIndex: 'bizType', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '单据类型', dataIndex: 'bizTypeDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
       ]
       arr.splice(4, 0, { title: '实售金额', dataIndex: 'totalRealAmount', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
       arr.splice(5, 0, { title: '开单金额', dataIndex: 'totalAmount', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-      arr.splice(6, 0, { title: '差价金额', dataIndex: 'rebateAmount', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      arr.splice(6, 0, { title: '差价金额', dataIndex: 'directRebateAmount', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      arr.splice(7, 0, { title: '记账费用', dataIndex: 'rebateAmount', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
       return arr
     }
   },
@@ -211,23 +224,23 @@ export default {
       })
     },
     rebateDealerChange (val) {
-      this.queryParam.rebateDealerSn = val.key
+      this.queryParam.parentDealerSn = val.key
     },
     custChange (val) {
-      this.queryParam.dealerSn = val.key
+      this.queryParam.buyerSn = val.key
     },
     //  重置
     resetSearchForm () {
       this.queryParam.month = moment().format('YYYY-MM')
       this.queryParam.provinceSn = undefined
-      this.queryParam.rebateDealerSn = undefined
-      this.queryParam.dealerSn = undefined
+      this.queryParam.parentDealerSn = undefined
+      this.queryParam.buyerSn = undefined
       this.queryParam.bizUserSn = undefined
+      this.queryParam.bizType = undefined
+
       this.$refs.rebateDealerList.resetForm()
       this.totalData = null
-      if (this.advanced) {
-        this.$refs.custList.resetForm()
-      }
+      this.$refs.custList.resetForm()
       this.$refs.ruleForm.resetFields()
       this.$refs.table.clearTable()
     },

+ 336 - 0
src/views/reportData/productRebateReport/dealerList.vue

@@ -0,0 +1,336 @@
+<template>
+  <div>
+    <a-card size="small" :bordered="false" class="searchBoxNormal">
+      <!-- 搜索条件 -->
+      <div class="table-page-search-wrapper" ref="tableSearch2">
+        <a-form-model
+          id="rebateDetailReport-form"
+          ref="ruleForm"
+          class="form-model-con"
+          layout="inline"
+          :model="queryParam"
+          :rules="rules"
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          @keyup.enter.native="handleSearch" >
+          <a-row :gutter="15">
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="日期" prop="time">
+                <rangeDate ref="rangeDate" @change="dateChange" />
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="单号">
+                <a-input id="srebateReport-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入单号"/>
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="客户名称">
+                <dealerSearchList ref="dealer" id="srebateReport-buyerName" @change="dealerChange" />
+              </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.dealer.dealerLevel"
+                    id="srebateReport-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="所在区域">
+                  <subarea id="srebateReport-subareaSn" ref="subarea" @change="subareaChange"></subarea>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="区域负责人">
+                  <BizUser v-model="queryParam.subareaArea.bizUserSn"></BizUser>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="省份">
+                  <Area id="srebateReport-provinceSn" v-model="queryParam.dealer.provinceSn" placeholder="请选择省份"></Area>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="差价归属方">
+                  <dealerSearchList ref="parentDealer" id="srebateReport-parentDealer" @change="parentDealerChange" placeholder="请输入差价归属方"/>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="差价归属类型">
+                  <v-select code="RELATION_REBATE_PARENT_TYPE" v-model="queryParam.rebateParentType" allowClear placeholder="请选择差价归属类型"></v-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="单据类型" prop="bizType">
+                  <a-select id="srebateReport-bizType" allowClear v-model="queryParam.bizType" placeholder="请选择单据类型">
+                    <a-select-option v-for="item in bizTypeList" :value="item.value" :key="item.value">{{ item.name }}</a-select-option>
+                  </a-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="客服">
+                  <customerService ref="customerName" v-model="queryParam.bizUserSn"></customerService>
+                </a-form-model-item>
+              </a-col>
+            </template>
+            <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+              <a-button type="primary" @click="handleSearch" :disabled="disabled" id="rebateDetailReport-refresh">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="rebateDetailReport-reset">重置</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"
+          rowKeyName="no"
+          :columns="columns"
+          :data="loadData"
+          :pageSize="30"
+          :style="{ height: tableHeight-5+'px' }"
+          :scroll="{ x: 2200,y: tableHeight-120 }"
+          :defaultLoadData="false"
+          bordered>
+          <template slot="footer">
+            <a-row type="flex" justify="end" :gutter="10">
+              <a-col flex="10%">总开单金额:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
+              <a-col flex="10%">总实售金额:{{ (totalData && (totalData.totalRealAmount || totalData.totalRealAmount==0)) ? toThousands(totalData.totalRealAmount) : '--' }}</a-col>
+              <a-col flex="10%">总差价金额:{{ (totalData && (totalData.directRebateAmount || totalData.directRebateAmount==0)) ? toThousands(totalData.directRebateAmount) : '--' }}</a-col>
+            </a-row>
+          </template>
+        </s-table>
+      </a-spin>
+    </a-card>
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable, VSelect } from '@/components'
+import rangeDate from '@/views/common/rangeDate.vue'
+import dealerSearchList from '@/views/common/dealerSearchList.vue'
+import subarea from '@/views/common/subarea.js'
+import Area from '@/views/common/area.js'
+import BizUser from '@/views/common/bizUser.js'
+import customerService from '@/views/common/customerService'
+import { productRebateParentList, productRebateParentCount } from '@/api/reportData'
+export default {
+  components: { STable, VSelect, rangeDate, dealerSearchList, subarea, Area, BizUser, customerService },
+  mixins: [commonMixin],
+  data () {
+    return {
+      spinning: false,
+      labelCol: { span: 8 },
+      wrapperCol: { span: 16 },
+      advanced: true, // 高级搜索 展开/关闭
+      tableHeight: 0,
+      queryParam: { //  查询条件
+        time: [],
+        beginDate: '',
+        endDate: '',
+        bizNo: '', // 单号
+        buyerSn: undefined, // 客户sn
+        subareaArea: {
+          subareaSn: undefined,
+          subareaAreaSn: undefined,
+          bizUserSn: undefined // 区域负责人
+        },
+        dealer: {
+          dealerSn: undefined,
+          dealerLevel: undefined,
+          provinceSn: undefined
+        },
+        parentDealerSn: undefined, // 差价归属方
+        rebateParentType: undefined, // 差价归属类型
+        bizType: undefined, // 类型
+        bizUserSn: undefined // 客服类型
+      },
+      bizTypeList: [
+        { value: 'SALES', name: '采购差价' },
+        { value: 'SALES_RETURN', name: '退货差价' }
+      ],
+      rules: {
+        'time': [{ required: true, message: '请选择日期', trigger: 'change' }]
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        const params = Object.assign(parameter, this.queryParam)
+        this.spinning = true
+        delete params.time
+        // 总计
+        this.getCount(params)
+        return productRebateParentList(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
+              if (data.list[i].rebateParentTypeDictValue && data.list[i].rebateParentTypeDictValue != '直接上级') {
+                data.list[i].totalAmount = undefined
+                data.list[i].totalRealAmount = undefined
+                data.list[i].directRebateAmount = undefined
+              }
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      },
+      totalData: null //  合计
+    }
+  },
+  computed: {
+    columns () {
+      const _this = this
+      const arr = [
+        { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
+        { title: '区域', dataIndex: 'subareaArea.subareaName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '区域负责人', dataIndex: 'subareaArea.bizUserName', width: 100, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '订单号', dataIndex: 'bizNo', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '日期', dataIndex: 'bizDate', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '省份', dataIndex: 'provinceName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'buyerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '客户级别', dataIndex: 'buyerLevelDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '差价归属方', dataIndex: 'parentDealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '百分比', dataIndex: 'rebateRate', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text * 100 + '%' : '--') } },
+        { title: '差价归属类型', dataIndex: 'rebateParentTypeDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '总开单金额', dataIndex: 'totalAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '总实售金额', dataIndex: 'totalRealAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '总差价金额', dataIndex: 'directRebateAmount', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '差价金额', dataIndex: 'rebateAmount', width: 80, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '单据类型', dataIndex: 'bizTypeDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } }
+      ]
+      return arr
+    }
+  },
+  watch: {
+    advanced (newValue, oldValue) {
+      this.setTableH()
+    },
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  methods: {
+    // 合计
+    getCount (params) {
+      productRebateParentCount(params).then(res => {
+        if (res.status == 200) {
+          this.totalData = res.data
+        } else {
+          this.totalData = null
+        }
+      })
+    },
+    //  创建时间  change
+    dateChange (date) {
+      this.queryParam.time = date
+      this.queryParam.beginDate = date[0] || ''
+      this.queryParam.endDate = date[1] || ''
+    },
+    dealerChange (val) {
+      if (val.row) {
+        this.queryParam.buyerSn = val.row.dealerSn
+      } else {
+        this.queryParam.buyerSn = undefined
+      }
+    },
+    subareaChange (val) {
+      this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
+      this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
+    },
+    // 差价归属方
+    parentDealerChange (val) {
+      if (val.row) {
+        this.queryParam.parentDealerSn = val.row.dealerSn
+      } else {
+        this.queryParam.parentDealerSn = undefined
+      }
+    },
+    //  查询
+    handleSearch () {
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          this.$refs.table.refresh(true)
+        } else {
+          this.$message.error('请选择日期')
+          return false
+        }
+      })
+    },
+    //  重置
+    resetSearchForm () {
+      this.$refs.rangeDate.resetDate()
+      this.queryParam.time = []
+      this.queryParam.beginDate = ''
+      this.queryParam.endDate = ''
+      this.queryParam.bizNo = ''
+      this.queryParam.buyerSn = undefined// 客户sn
+      this.queryParam.subareaArea.subareaSn = undefined
+      this.queryParam.subareaArea.subareaAreaSn = undefined
+      this.queryParam.subareaArea.bizUserSn = undefined// 区域负责人
+      this.queryParam.dealer.dealerSn = undefined// 客户名称
+      this.queryParam.dealer.dealerLevel = undefined// 客户等级
+      this.queryParam.dealer.provinceSn = undefined// 省区域
+      this.queryParam.parentDealerSn = undefined// 差价归属方
+      this.queryParam.rebateParentType = undefined// 差价归属类型
+      this.queryParam.bizType = undefined// 类型
+      this.queryParam.bizUserSn = undefined// 客服类型
+
+      this.$refs.dealer.resetForm()
+      this.$refs.subarea.clearData()
+      this.$refs.parentDealer.resetForm()
+      this.$refs.ruleForm.resetFields()
+      this.totalData = null
+      this.$refs.table.clearTable()
+    },
+    pageInit () {
+      this.disabled = false
+      this.spinning = false
+      this.setTableH()
+    },
+    setTableH () {
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        const tableSearchH = this.$refs.tableSearch2.offsetHeight
+        this.tableHeight = window.innerHeight - tableSearchH - 300
+      })
+    }
+  },
+  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>

+ 55 - 48
src/views/reportData/productRebateReport/detailList.vue

@@ -20,8 +20,13 @@
               </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-model-item label="单号">
-                <a-input id="srebateReport-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入单号"/>
+              <a-form-model-item label="订单号">
+                <a-input id="srebateReport-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入订单号"/>
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="备货单号">
+                <a-input id="srebateReport-bizSubNo" v-model.trim="queryParam.bizSubNo" allowClear placeholder="请输入备货单号"/>
               </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -30,23 +35,23 @@
               </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-model-item label="直接绑定客户名称">
-                <dealerSearchList ref="directDealer" id="srebateReport-buyerName" @change="directDealerChange" />
+              <a-form-model-item label="差价归属方">
+                <dealerSearchList ref="parentDealer" id="srebateReport-parentDealer" @change="parentDealerChange" placeholder="请输入差价归属方"/>
               </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-model-item label="间接绑定客户名称">
-                <dealerSearchList ref="indirectDealer" id="srebateReport-buyerName" @change="indirectDealerChange" />
+              <a-form-model-item label="差价归属类型">
+                <v-select code="RELATION_REBATE_PARENT_TYPE" v-model="queryParam.rebateParentType" allowClear placeholder="请选择差价归属类型"></v-select>
               </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-model-item label="类型">
+              <a-form-model-item label="单据类型">
                 <v-select
                   v-model="queryParam.bizType"
                   ref="bizType"
                   id="srebateReport-bizType"
                   code="REBATE_BILL_BIZ_TYPE"
-                  placeholder="请选择类型"
+                  placeholder="请选择单据类型"
                   allowClear></v-select>
               </a-form-model-item>
             </a-col>
@@ -70,7 +75,7 @@
             <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
               <a-button type="primary" @click="handleSearch" :disabled="disabled" id="rebateDetailReport-refresh">查询</a-button>
               <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="rebateDetailReport-reset">重置</a-button>
-              <a-button
+              <!-- <a-button
                 type="primary"
                 style="margin-left: 5px"
                 @click="handleExport"
@@ -78,7 +83,7 @@
                 :loading="exportLoading"
                 v-if="$hasPermissions('M_salesReturnReportExport')"
                 class="button-warning"
-                id="rebateDetailReport-export-btn">导出</a-button>
+                id="rebateDetailReport-export-btn">导出</a-button> -->
               <a @click="advanced=!advanced" style="margin-left: 5px">
                 {{ advanced ? '收起' : '展开' }}
                 <a-icon :type="advanced ? 'up' : 'down'"/>
@@ -95,20 +100,20 @@
           class="sTable fixPagination"
           ref="table"
           size="small"
-          :rowKey="(record) => record.id"
+          :rowKey="(record) => record.no"
+          rowKeyName="no"
           :columns="columns"
           :data="loadData"
           :pageSize="30"
-          :style="{ height: tableHeight+110+'px' }"
-          :scroll="{ x: 2200,y: tableHeight+10 }"
+          :style="{ height: tableHeight+38+'px' }"
+          :scroll="{ x: 2200,y: tableHeight-80 }"
           :defaultLoadData="false"
           bordered>
           <template slot="footer">
             <a-row type="flex" justify="end" :gutter="10">
               <a-col flex="10%" >总开单金额:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
               <a-col flex="10%" >总实售金额:{{ (totalData && (totalData.totalRealAmount || totalData.totalRealAmount==0)) ? toThousands(totalData.totalRealAmount) : '--' }}</a-col>
-              <a-col flex="10%" >直接差价金额:{{ (totalData && (totalData.directRebateAmount || totalData.directRebateAmount==0)) ? toThousands(totalData.directRebateAmount) : '--' }}</a-col>
-              <a-col flex="10%" >间接差价金额:{{ (totalData && (totalData.indirectRebateAmount || totalData.indirectRebateAmount==0)) ? toThousands(totalData.indirectRebateAmount) : '--' }}</a-col>
+              <a-col flex="10%" >差价金额:{{ (totalData && (totalData.rebateAmount || totalData.rebateAmount==0)) ? toThousands(totalData.rebateAmount) : '--' }}</a-col>
             </a-row>
           </template>
         </s-table>
@@ -142,9 +147,10 @@ export default {
         endDate: '',
         buyerSn: undefined, // 客户sn
         bizNo: '', // 单号
+        bizSubNo: '',
         bizType: undefined,
-        directDealerSn: undefined, // 直接经销商SN
-        indirectDealerSn: undefined, // 间接经销商SN
+        parentDealerSn: undefined,
+        rebateParentType: undefined,
         productEntity: {
           productBrandSn: undefined, //  产品品牌
           productTypeSn1: '', //  产品一级分类
@@ -175,6 +181,9 @@ export default {
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
               data.list[i].inStockQty = data.list[i].qty
+              // if (data.list[i].parentDealerName) {
+              //   data.list[i].parentDealerName += '(' + data.list[i].rebateRate * 100 + '%)'
+              // }
             }
             this.disabled = false
           }
@@ -191,25 +200,26 @@ export default {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '60px', align: 'center' },
         { title: '订单号', dataIndex: 'bizNo', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '类型', dataIndex: 'rebateBill.bizTypeDictValue', width: '80px', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客户级别', dataIndex: 'rebateBill.buyerLevelDictValue', width: '90px', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客户名称', dataIndex: 'rebateBill.buyerName', width: '150px', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '直接绑定客户名称', dataIndex: 'rebateBill.directDealerName', width: '150px', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '间接绑定客户名称', dataIndex: 'rebateBill.indirectDealerName', width: '150px', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '备货单号', dataIndex: 'bizSubNo', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '单据类型', dataIndex: 'bizTypeDictValue', width: '80px', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户级别', dataIndex: 'buyerLevelDictValue', width: '90px', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'buyerName', width: '150px', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '差价归属方', dataIndex: 'parentDealerName', width: '130px', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '百分比', dataIndex: 'rebateRate', width: '80px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text * 100 + '%' : '--') } },
+        { title: '差价归属类型', dataIndex: 'rebateParentTypeDictValue', width: '120px', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '价格级别', dataIndex: 'directLevelDictValue', width: '80px', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '品牌', dataIndex: 'productEntity.productBrandName', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品分类', width: '160px', align: 'center', customRender: function (text, record) { return record.productEntity.productTypeName1 + (record.productEntity.productTypeName2 ? '>' : '') + (record.productEntity.productTypeName2 || '') } },
         { title: '产品编码', dataIndex: 'productEntity.code', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'productEntity.name', width: '150px', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '数量', dataIndex: 'qty', width: '60px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '省级价', dataIndex: 'provincePrice', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '市级价', dataIndex: 'cityPrice', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '特约价', dataIndex: 'specialPrice', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '总开单金额', dataIndex: 'totalAmount', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '总实售金额', dataIndex: 'totalRealAmount', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '直接差价', dataIndex: 'directRebatePrice', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '直接差价金额', dataIndex: 'directRebateAmount', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '间接差价', dataIndex: 'indirectRebatePrice', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '间接差价金额', dataIndex: 'indirectRebateAmount', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+        { title: '数量', dataIndex: 'qty', width: '60px', align: 'center', customRender: function (text, record) { return ((text || text == 0) && _this.getNormalVal(record.rebateParentTypeDictValue) ? text : '--') } },
+        { title: '省级价', dataIndex: 'provincePrice', width: '80px', align: 'right', customRender: function (text, record) { return ((text || text == 0) && _this.getNormalVal(record.rebateParentTypeDictValue) ? _this.toThousands(text) : '--') } },
+        { title: '市级价', dataIndex: 'cityPrice', width: '80px', align: 'right', customRender: function (text, record) { return ((text || text == 0) && _this.getNormalVal(record.rebateParentTypeDictValue) ? _this.toThousands(text) : '--') } },
+        { title: '特约价', dataIndex: 'specialPrice', width: '80px', align: 'right', customRender: function (text, record) { return ((text || text == 0) && _this.getNormalVal(record.rebateParentTypeDictValue) ? _this.toThousands(text) : '--') } },
+        { title: '总开单金额', dataIndex: 'totalAmount', width: '80px', align: 'right', customRender: function (text, record) { return ((text || text == 0) && _this.getNormalVal(record.rebateParentTypeDictValue) ? _this.toThousands(text) : '--') } },
+        { title: '总实售金额', dataIndex: 'totalRealAmount', width: '80px', align: 'right', customRender: function (text, record) { return ((text || text == 0) && _this.getNormalVal(record.rebateParentTypeDictValue) ? _this.toThousands(text) : '--') } },
+        { title: '总差价金额', dataIndex: 'totalRebateAmount', width: '80px', align: 'right', customRender: function (text, record) { return ((text || text == 0) && _this.getNormalVal(record.rebateParentTypeDictValue) ? _this.toThousands(text) : '--') } },
+        { title: '差价金额', dataIndex: 'rebateAmount', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
       ]
       return arr
     }
@@ -223,6 +233,10 @@ export default {
     }
   },
   methods: {
+    // 判断差价归属类型为-- 或者 直接上级时  数量/省级价/市级价/特约价/总开单金额/总实售金额/差价  正常显示
+    getNormalVal (val) {
+      return !val || val === '直接上级'
+    },
     // 合计
     getCount (params) {
       rebateDetailQueryCount(params).then(res => {
@@ -257,18 +271,11 @@ export default {
         this.queryParam.buyerSn = undefined
       }
     },
-    directDealerChange (val) {
-      if (val.row) {
-        this.queryParam.directDealerSn = val.row.dealerSn
-      } else {
-        this.queryParam.directDealerSn = undefined
-      }
-    },
-    indirectDealerChange (val) {
+    parentDealerChange (val) {
       if (val.row) {
-        this.queryParam.indirectDealerSn = val.row.dealerSn
+        this.queryParam.parentDealerSn = val.row.dealerSn
       } else {
-        this.queryParam.indirectDealerSn = undefined
+        this.queryParam.parentDealerSn = undefined
       }
     },
     //  重置
@@ -278,13 +285,13 @@ export default {
       this.queryParam.beginDate = ''
       this.queryParam.endDate = ''
       this.queryParam.bizNo = ''
+      this.queryParam.bizSubNo = ''
       this.queryParam.bizType = undefined
       this.queryParam.buyerSn = undefined
-      this.queryParam.indirectDealerSn = undefined
-      this.queryParam.directDealerSn = undefined
+      this.queryParam.parentDealerSn = undefined
+      this.queryParam.rebateParentType = undefined
       this.$refs.dealer.resetForm()
-      this.$refs.indirectDealer.resetForm()
-      this.$refs.directDealer.resetForm()
+      this.$refs.parentDealer.resetForm()
 
       this.queryParam.productEntity.productBrandSn = undefined
       this.queryParam.productEntity.productTypeSn1 = ''
@@ -313,9 +320,9 @@ export default {
       this.$nextTick(() => { // 页面渲染完成后的回调
         const tableSearchH = this.$refs.tableSearch1.offsetHeight
         console.log(tableSearchH)
-        this.tableHeight = window.innerHeight - tableSearchH - 280
+        this.tableHeight = window.innerHeight - tableSearchH - 300
       })
-    },
+    }
   },
   mounted () {
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用

+ 13 - 7
src/views/reportData/productRebateReport/index.vue

@@ -2,13 +2,15 @@
   <div class="tabsReportList-wrap">
     <div style="background-color: #fff;margin-bottom: 5px;">
       <a-tabs default-active-key="1" v-model="curTab" @change="changeTab">
-        <a-tab-pane key="1" tab="返利表"></a-tab-pane>
-        <a-tab-pane key="2" tab="返利明细报表" force-render></a-tab-pane>
+        <a-tab-pane key="1" tab="订单差价表"></a-tab-pane>
+        <a-tab-pane key="2" tab="订单经销商差价表"></a-tab-pane>
+        <a-tab-pane key="3" tab="产品差价表" force-render></a-tab-pane>
       </a-tabs>
     </div>
     <div>
       <report v-show="curTab==1"></report>
-      <detailReport ref="detailList" v-show="curTab==2"></detailReport>
+      <dealerReport ref="detailList" v-show="curTab==2"></dealerReport>
+      <detailReport ref="dealerList" v-show="curTab==3"></detailReport>
     </div>
   </div>
 </template>
@@ -16,20 +18,24 @@
 <script>
 import report from './list.vue'
 import detailReport from './detailList.vue'
+import dealerReport from './dealerList.vue'
 export default {
   name: 'ProductRebateReportIndex',
   components: {
     report,
-    detailReport
+    detailReport,
+    dealerReport
   },
   data () {
     return {
       curTab: '1'
     }
   },
-  methods:{
-    changeTab(v){
-      if(v==2){
+  methods: {
+    changeTab (v) {
+      if (v == 2) {
+        this.$refs.dealerList.setTableH()
+      } else if (v == 3) {
         this.$refs.detailList.setTableH()
       }
     }

+ 81 - 73
src/views/reportData/productRebateReport/list.vue

@@ -14,46 +14,36 @@
           :wrapperCol="wrapperCol"
           @keyup.enter.native="handleSearch" >
           <a-row :gutter="15">
-            <a-col :md="6" :sm="24">
+            <a-col :md="5" :sm="24">
               <a-form-model-item label="日期" prop="time">
                 <rangeDate ref="rangeDate" @change="dateChange" />
               </a-form-model-item>
             </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-model-item label="单号">
-                <a-input id="srebateReport-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入单号"/>
+            <a-col :md="5" :sm="24">
+              <a-form-model-item label="单号">
+                <a-input id="srebateReport-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入单号"/>
               </a-form-model-item>
             </a-col>
-            <a-col :md="6" :sm="24">
+            <a-col :md="5" :sm="24">
               <a-form-model-item label="客户名称">
                 <dealerSearchList ref="dealer" id="srebateReport-buyerName" @change="dealerChange" />
               </a-form-model-item>
             </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-model-item label="直接绑定客户名称">
-                <dealerSearchList ref="directDealer" id="srebateReport-buyerName" @change="directDealerChange" />
-              </a-form-model-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-model-item label="间接绑定客户名称">
-                <dealerSearchList ref="indirectDealer" id="srebateReport-buyerName" @change="indirectDealerChange" />
-              </a-form-model-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-model-item label="类型">
+            <a-col :md="5" :sm="24">
+              <a-form-model-item label="单据类型">
                 <v-select
                   v-model="queryParam.bizType"
                   ref="bizType"
                   id="srebateReport-bizType"
                   code="REBATE_BILL_BIZ_TYPE"
-                  placeholder="请选择类型"
+                  placeholder="请选择单据类型"
                   allowClear></v-select>
               </a-form-model-item>
             </a-col>
-            <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+            <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
               <a-button type="primary" @click="handleSearch" :disabled="disabled" id="srebateReport-refresh">查询</a-button>
               <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="srebateReport-reset">重置</a-button>
-              <a-button
+              <!-- <a-button
                 type="primary"
                 style="margin-left: 5px"
                 @click="handleExport"
@@ -61,7 +51,7 @@
                 :loading="exportLoading"
                 v-if="$hasPermissions('M_salesReturnReportExport')"
                 class="button-warning"
-                id="srebateReport-export-btn">导出</a-button>
+                id="srebateReport-export-btn">导出</a-button> -->
             </a-col>
           </a-row>
         </a-form-model>
@@ -69,14 +59,28 @@
     </a-card>
     <a-card size="small" :bordered="false">
       <a-spin :spinning="spinning" tip="Loading...">
+        <div style="margin-bottom:12px;text-align: right;">
+          <span>显示:</span>
+          <a-tree-select
+            size="small"
+            v-model="showCols"
+            style="min-width: 200px"
+            dropdownMatchSelectWidth
+            :maxTagCount="3"
+            :tree-data="colsArr"
+            tree-checkable
+            placeholder="请选择要显示的列(多选)"
+          />
+        </div>
         <!-- 列表 -->
         <s-table
           class="sTable fixPagination"
           ref="table"
           size="small"
-          :style="{ height: tableHeight+75+'px' }"
-          :scroll="{ y: tableHeight-20 }"
-          :rowKey="(record) => record.id"
+          :style="{ height: tableHeight+'px' }"
+          :scroll="{ y: tableHeight-120 }"
+          :rowKey="(record) => record.bizNo"
+          rowKeyName="bizNo"
           :columns="columns"
           :data="loadData"
           :pageSize="30"
@@ -100,7 +104,7 @@
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
-import { downloadExcel } from '@/libs/JGPrint.js'
+// import { downloadExcel } from '@/libs/JGPrint.js'
 import dealerSearchList from '@/views/common/dealerSearchList.vue'
 import { rebateQueryList, rebateQueryCount } from '@/api/reportData'
 export default {
@@ -119,9 +123,7 @@ export default {
         endDate: '',
         buyerSn: undefined, // 客户sn
         bizNo: '', // 单号
-        bizType: undefined,
-        directDealerSn: undefined, // 直接经销商SN
-        indirectDealerSn: undefined // 间接经销商SN
+        bizType: undefined
       },
       rules: {
         'time': [{ required: true, message: '请选择日期', trigger: 'change' }]
@@ -150,7 +152,22 @@ export default {
           return data
         })
       },
-      totalData: null //  合计
+      totalData: null, //  合计
+      colsArr: [
+        {
+          title: '直接差价金额(明细)',
+          value: 'directRebateAmountInfo',
+          key: 'directRebateAmountInfo',
+          disabled: !this.$hasPermissions('M_salesOrderTotalList_salesPrice')
+        },
+        {
+          title: '间接差价金额(明细)',
+          value: 'indirectRebateAmountInfo',
+          key: 'indirectRebateAmountInfo',
+          disabled: !this.$hasPermissions('M_salesOrderTotalList_salesPrice')
+        }
+      ],
+      showCols: []
     }
   },
   computed: {
@@ -158,17 +175,26 @@ export default {
       const _this = this
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '订单号', dataIndex: 'bizNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '类型', dataIndex: 'bizTypeDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客户级别', dataIndex: 'buyerLevelDictValue', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客户名称', dataIndex: 'buyerName', width: '12%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '直接绑定客户名称', dataIndex: 'directDealerName', width: '12%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '间接绑定客户名称', dataIndex: 'indirectDealerName', width: '12%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '订单号', dataIndex: 'bizNo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '单据类型', dataIndex: 'bizTypeDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户级别', dataIndex: 'buyerLevelDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'buyerName', width: '16%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '总开单金额', dataIndex: 'totalAmount', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '直接差价金额', dataIndex: 'directRebate', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '间接差价金额', dataIndex: 'indirectRebate', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '总实售价金额', dataIndex: 'totalRealAmount', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
       ]
+      if (this.showCols.includes('directRebateAmountInfo')) {
+        arr.splice(6, 0, { title: '直接上级差价', dataIndex: 'directSuperiorsAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.splice(7, 0, { title: '直接指定差价', dataIndex: 'directAssignAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.splice(8, 0, { title: '直接总部差价', dataIndex: 'directHeadAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      }
+      if (this.showCols.includes('indirectRebateAmountInfo')) {
+        const pos = this.showCols.includes('directRebateAmountInfo') ? 10 : 7
+        arr.splice(pos, 0, { title: '间接上级差价', dataIndex: 'indirectSuperiorsAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.splice(pos + 1, 0, { title: '间接指定差价', dataIndex: 'indirectAssignAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.splice(pos + 2, 0, { title: '间接总部差价', dataIndex: 'indirectHeadAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      }
       return arr
     }
   },
@@ -207,20 +233,6 @@ export default {
         this.queryParam.buyerSn = undefined
       }
     },
-    directDealerChange (val) {
-      if (val.row) {
-        this.queryParam.directDealerSn = val.row.dealerSn
-      } else {
-        this.queryParam.directDealerSn = undefined
-      }
-    },
-    indirectDealerChange (val) {
-      if (val.row) {
-        this.queryParam.indirectDealerSn = val.row.dealerSn
-      } else {
-        this.queryParam.indirectDealerSn = undefined
-      }
-    },
     //  重置
     resetSearchForm () {
       this.$refs.rangeDate.resetDate()
@@ -230,38 +242,34 @@ export default {
       this.queryParam.bizNo = ''
       this.queryParam.bizType = undefined
       this.queryParam.buyerSn = undefined
-      this.queryParam.indirectDealerSn = undefined
-      this.queryParam.directDealerSn = undefined
       this.$refs.dealer.resetForm()
-      this.$refs.indirectDealer.resetForm()
-      this.$refs.directDealer.resetForm()
       this.$refs.ruleForm.resetFields()
       this.totalData = null
       this.$refs.table.clearTable()
     },
     // 导出
-    handleExport () {
-      const _this = this
-      this.$refs.ruleForm.validate(valid => {
-        if (valid) {
-          const params = _this.queryParam
-          params.showCost = this.$hasPermissions('M_ShowAllCost') ? '1' : '0'
-          _this.exportLoading = true
-          _this.spinning = true
-          reportSalesReturnExport(params).then(res => {
-            downloadExcel(res, '销售退货报表')
-            _this.exportLoading = false
-            _this.spinning = false
-          })
-        } else {
-          console.log('error submit!!')
-          return false
-        }
-      })
-    },
+    // handleExport () {
+    //   const _this = this
+    //   this.$refs.ruleForm.validate(valid => {
+    //     if (valid) {
+    //       const params = _this.queryParam
+    //       params.showCost = this.$hasPermissions('M_ShowAllCost') ? '1' : '0'
+    //       _this.exportLoading = true
+    //       _this.spinning = true
+    //       reportSalesReturnExport(params).then(res => {
+    //         downloadExcel(res, '销售退货报表')
+    //         _this.exportLoading = false
+    //         _this.spinning = false
+    //       })
+    //     } else {
+    //       console.log('error submit!!')
+    //       return false
+    //     }
+    //   })
+    // },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 250
+      this.tableHeight = window.innerHeight - tableSearchH - 210
     }
   },
   watch: {

+ 8 - 4
src/views/reportData/salesDetails/list.vue

@@ -290,8 +290,8 @@ export default {
         { title: '省份', dataIndex: 'dealerProvinceName', width: 90, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '客户名称', dataIndex: 'dealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '客户级别', dataIndex: 'dealerLevelDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '直接绑定客户名称', dataIndex: 'directDealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '间接绑定客户名称', dataIndex: 'indirectDealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        // { title: '直接绑定客户名称', dataIndex: 'directDealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        // { title: '间接绑定客户名称', dataIndex: 'indirectDealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '创建时间', dataIndex: 'createDate', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '销售审核时间', dataIndex: 'auditDate', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '下推时间', dataIndex: 'pushedDate', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
@@ -321,8 +321,12 @@ export default {
         arr.push({ title: '市级金额', dataIndex: 'totalCityAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
       }
       if (this.$hasPermissions('M_salesDetailsList_salesPrice')) { //  售价权限
-        arr.push({ title: '直接差金额', dataIndex: 'directRebateAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-        arr.push({ title: '间接差金额', dataIndex: 'indirectRebateAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.push({ title: '直接差金额', dataIndex: 'reportRebateAmountInfo.directRebateAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.push({ title: '间接差金额', dataIndex: 'reportRebateAmountInfo.indirectRebateAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.push({ title: '直接上级差金额', dataIndex: 'reportRebateAmountInfo.directRebateUpAmount', width: 80, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.push({ title: '间接上级差金额', dataIndex: 'reportRebateAmountInfo.indirectRebateUpAmount', width: 80, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.push({ title: '指定差价金额', dataIndex: 'reportRebateAmountInfo.assignRebateAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.push({ title: '总部差价金额', dataIndex: 'reportRebateAmountInfo.headRebateAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
         arr.push({ title: '优惠金额', dataIndex: 'discountAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
         // arr.push({ title: '折后单价', dataIndex: 'discountedPrice', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
         // arr.push({ title: '折扣金额', dataIndex: 'discountAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })

+ 46 - 9
src/views/reportData/salesOrderTotal/list.vue

@@ -133,6 +133,19 @@
     </a-card>
     <a-card size="small" :bordered="false">
       <a-spin :spinning="spinning" tip="Loading...">
+        <div style="margin-bottom:12px;text-align: right;">
+          <span>显示:</span>
+          <a-tree-select
+            size="small"
+            v-model="showCols"
+            style="min-width: 200px"
+            dropdownMatchSelectWidth
+            :maxTagCount="3"
+            :tree-data="colsArr"
+            tree-checkable
+            placeholder="请选择要显示的列(多选)"
+          />
+        </div>
         <!-- 列表 -->
         <s-table
           class="sTable fixPagination"
@@ -154,7 +167,7 @@
               <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesOrderTotalList_salesPrice')">开单金额:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
               <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesOrderTotalList_costPrice')">成本金额:{{ (totalData && (totalData.totalCost || totalData.totalCost==0)) ? toThousands(totalData.totalCost) : '--' }}</a-col>
               <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesOrderTotalList_costPrice')&&$hasPermissions('M_salesOrderTotalList_salesPrice')">毛利:{{ (totalData && (totalData.grossProfit || totalData.grossProfit==0)) ? toThousands(totalData.grossProfit) : '--' }}</a-col>
-              <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesOrderTotalList_salesPrice')">返利:{{ (totalData && (totalData.rebateAmount || totalData.rebateAmount==0)) ? toThousands(totalData.rebateAmount) : '--' }}</a-col>
+              <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesOrderTotalList_salesPrice')">返利:{{ (totalData &&totalData.reportRebateAmountInfo&&(totalData.reportRebateAmountInfo.rebateAmount || totalData.reportRebateAmountInfo.rebateAmount==0)) ? toThousands(totalData.reportRebateAmountInfo.rebateAmount) : '--' }}</a-col>
               <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesOrderTotalList_salesPrice')">优惠金额:{{ (totalData && (totalData.discountAmount || totalData.discountAmount==0)) ? toThousands(totalData.discountAmount) : '--' }}</a-col>
             <!-- <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesOrderTotalList_salesPrice')">折扣金额:{{ (totalData && (totalData.totalDiscountAmount || totalData.totalDiscountAmount==0)) ? toThousands(totalData.totalDiscountAmount) : '--' }}</a-col>
             <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesOrderTotalList_salesPrice')">折后金额:{{ (totalData && (totalData.totalDiscountedAmount || totalData.totalDiscountedAmount==0)) ? toThousands(totalData.totalDiscountedAmount) : '--' }}</a-col> -->
@@ -262,8 +275,22 @@ export default {
       },
       totalData: null,
       operatorList: [], //  操作员下拉数据
-      addrProvinceList: [] //  省下拉
-
+      addrProvinceList: [], //  省下拉
+      colsArr: [
+        {
+          title: '直接差价金额(明细)',
+          value: 'directRebateAmountInfo',
+          key: 'directRebateAmountInfo',
+          disabled: !this.$hasPermissions('M_salesOrderTotalList_salesPrice')
+        },
+        {
+          title: '间接差价金额(明细)',
+          value: 'indirectRebateAmountInfo',
+          key: 'indirectRebateAmountInfo',
+          disabled: !this.$hasPermissions('M_salesOrderTotalList_salesPrice')
+        }
+      ],
+      showCols: []// 需要显示列
     }
   },
   computed: {
@@ -275,8 +302,8 @@ export default {
         { title: '销售审核时间', dataIndex: 'auditDate', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '客户名称', dataIndex: 'dealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '客户级别', dataIndex: 'dealerLevelDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '直接绑定客户名称', dataIndex: 'directDealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '间接绑定客户名称', dataIndex: 'indirectDealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        // { title: '直接绑定客户名称', dataIndex: 'directDealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        // { title: '间接绑定客户名称', dataIndex: 'indirectDealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '总下推数量', dataIndex: 'totalQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '下推数量(促)', dataIndex: 'giftQty', width: 90, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
         // { title: '实售价', dataIndex: 'totalRealAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
@@ -322,9 +349,19 @@ export default {
         arr.push({ title: '特约金额', dataIndex: 'totalSpecialAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
       }
       if (this.$hasPermissions('M_salesOrderTotalList_salesPrice')) {
-        arr.push({ title: '直接差价金额', dataIndex: 'directRebateAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-        arr.push({ title: '间接差价金额', dataIndex: 'indirectRebateAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-        arr.push({ title: '返利', dataIndex: 'rebateAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        if (this.showCols.includes('directRebateAmountInfo')) {
+          arr.push({ title: '直接上级差价', dataIndex: 'reportRebateAmountInfo.directRebateUpAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+          arr.push({ title: '直接指定差价', dataIndex: 'reportRebateAmountInfo.directRebateAssignAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+          arr.push({ title: '直接总部差价', dataIndex: 'reportRebateAmountInfo.directRebateHeadAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        }
+        arr.push({ title: '直接差价金额', dataIndex: 'reportRebateAmountInfo.directRebateAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        if (this.showCols.includes('indirectRebateAmountInfo')) {
+          arr.push({ title: '间接上级差价', dataIndex: 'reportRebateAmountInfo.indirectRebateUpAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+          arr.push({ title: '间接指定差价', dataIndex: 'reportRebateAmountInfo.indirectRebateAssignAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+          arr.push({ title: '间接总部差价', dataIndex: 'reportRebateAmountInfo.indirectRebateHeadAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        }
+        arr.push({ title: '间接差价金额', dataIndex: 'reportRebateAmountInfo.indirectRebateAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.push({ title: '返利', dataIndex: 'reportRebateAmountInfo.rebateAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
         arr.push({ title: '优惠金额', dataIndex: 'discountAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
         // arr.push({ title: '折扣金额', dataIndex: 'totalDiscountAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
         // arr.push({ title: '折后金额', dataIndex: 'totalDiscountedAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
@@ -464,7 +501,7 @@ export default {
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 216
+      this.tableHeight = window.innerHeight - tableSearchH - 252
     }
   },
   mounted () {

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

@@ -279,8 +279,6 @@ export default {
         { title: '省份', dataIndex: 'dealerProvinceName', width: 90, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '客户名称', dataIndex: 'dealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '客户级别', dataIndex: 'dealerLevelDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '直接绑定客户名称', dataIndex: 'directDealerName', width: 120, align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '间接绑定客户名称', dataIndex: 'indirectDealerName', width: 120, align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '退货类别', dataIndex: 'goodFlagDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '退货类型', dataIndex: 'salesReturnTypeDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '退货完成日期', dataIndex: 'salesReturnDate', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
@@ -291,8 +289,8 @@ export default {
 
         { title: '单位', dataIndex: 'productUnit', width: 50, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '退货原因', dataIndex: 'returnReason', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '申请退货数量', dataIndex: 'initialQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '仓库实收数量', dataIndex: 'receiveQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '申请退货数量', dataIndex: 'initialQty', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '仓库实收数量', dataIndex: 'receiveQty', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '坏件数量', dataIndex: 'badQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '良品数量', dataIndex: 'goodQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '返库数量', dataIndex: 'backStockQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
@@ -322,8 +320,12 @@ export default {
         arr.push({ title: '市级价金额', dataIndex: 'totalWholesalePrice2', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
       }
       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) : '--') } })
+        arr.push({ title: '直接差价', dataIndex: 'reportRebateAmountInfo.directRebateAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.push({ title: '间接差价', dataIndex: 'reportRebateAmountInfo.indirectRebateAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.push({ title: '直接上级差价金额', dataIndex: 'reportRebateAmountInfo.directRebateUpAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.push({ title: '间接上级差价金额', dataIndex: 'reportRebateAmountInfo.indirectRebateUpAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.push({ title: '指定差价金额', dataIndex: 'reportRebateAmountInfo.assignRebateAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.push({ title: '总部差价金额', dataIndex: 'reportRebateAmountInfo.headRebateAmount', width: 70, 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) : '--') } })

+ 41 - 5
src/views/reportData/salesReturnsReport/list.vue

@@ -111,6 +111,19 @@
     <!-- 列表 -->
     <a-card size="small" :bordered="false">
       <a-spin :spinning="spinning" tip="Loading...">
+        <div style="margin-bottom:12px;text-align: right;">
+          <span>显示:</span>
+          <a-tree-select
+            size="small"
+            v-model="showCols"
+            style="min-width: 200px"
+            dropdownMatchSelectWidth
+            :maxTagCount="3"
+            :tree-data="colsArr"
+            tree-checkable
+            placeholder="请选择要显示的列(多选)"
+          />
+        </div>
         <s-table
           class="sTable fixPagination"
           ref="table"
@@ -212,7 +225,22 @@ export default {
           return data
         })
       },
-      totalData: null
+      totalData: null,
+      colsArr: [
+        {
+          title: '直接差价金额(明细)',
+          value: 'directRebateAmountInfo',
+          key: 'directRebateAmountInfo',
+          disabled: !this.$hasPermissions('M_salesOrderTotalList_salesPrice')
+        },
+        {
+          title: '间接差价金额(明细)',
+          value: 'indirectRebateAmountInfo',
+          key: 'indirectRebateAmountInfo',
+          disabled: !this.$hasPermissions('M_salesOrderTotalList_salesPrice')
+        }
+      ],
+      showCols: []
     }
   },
   computed: {
@@ -225,8 +253,6 @@ export default {
         { title: '客户级别', dataIndex: 'dealerLevelDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '退货类别', dataIndex: 'goodFlagDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '退货类型', dataIndex: 'salesReturnTypeDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '直接绑定客户名称', dataIndex: 'directDealerName', width: 120, align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '间接绑定客户名称', dataIndex: 'indirectDealerName', width: 120, align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '退货数量', dataIndex: 'totalQty', width: 90, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '退货仓库', dataIndex: 'warehouseName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
         // { title: '开单退货金额', dataIndex: 'totalAmount', width: 90, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
@@ -251,8 +277,18 @@ export default {
       }
       if (this.$hasPermissions('M_salesReturnsReportList_salesPrice')) {
         arr.push({ title: '实售退货金额', dataIndex: 'totalRealAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-        arr.push({ title: '直接差价', dataIndex: 'totalDirectRebate', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-        arr.push({ title: '间接差价', dataIndex: 'totalIndirectRebate', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        if (this.showCols.includes('directRebateAmountInfo')) {
+          arr.push({ title: '直接上级差价', dataIndex: 'reportRebateAmountInfo.directRebateUpAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+          arr.push({ title: '直接指定差价', dataIndex: 'reportRebateAmountInfo.directRebateAssignAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+          arr.push({ title: '直接总部差价', dataIndex: 'reportRebateAmountInfo.directRebateHeadAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        }
+        arr.push({ title: '直接差价', dataIndex: 'reportRebateAmountInfo.directRebateAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        if (this.showCols.includes('indirectRebateAmountInfo')) {
+          arr.push({ title: '间接上级差价', dataIndex: 'reportRebateAmountInfo.indirectRebateUpAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+          arr.push({ title: '间接指定差价', dataIndex: 'reportRebateAmountInfo.indirectRebateAssignAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+          arr.push({ title: '间接总部差价', dataIndex: 'reportRebateAmountInfo.indirectRebateHeadAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        }
+        arr.push({ title: '间接差价', dataIndex: 'reportRebateAmountInfo.indirectRebateAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
       }
       arr = arr.concat([
         { title: '坏件数量', dataIndex: 'totalBadQty', width: 90, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },

+ 27 - 26
src/views/salesManagement/salesQueryNew/comps/activeQueryPart.vue

@@ -78,7 +78,7 @@
       </template>
       <!-- 价格 -->
       <template slot="productPrice" slot-scope="text, record">
-         {{ text||text==0 ? toThousands(text) : '--' }} <span title="原价" v-if="promoProductClz == 'GIFT' || promoProductClz == 'DISCOUNT'">({{ record.origPrice||record.origPrice==0 ? toThousands(record.origPrice) : '--' }})</span>
+        {{ text||text==0 ? toThousands(text) : '--' }} <span title="原价" v-if="promoProductClz == 'GIFT' || promoProductClz == 'DISCOUNT'">({{ record.origPrice||record.origPrice==0 ? toThousands(record.origPrice) : '--' }})</span>
       </template>
       <!-- 产品名称 -->
       <template slot="productName" slot-scope="text, record">
@@ -143,7 +143,7 @@ export default {
       disabled: false, //  查询、重置按钮是否可操作
       promoProductClz: 'GATE',
       promoRuleData: null,
-      tabList:[],
+      tabList: [],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
@@ -163,10 +163,10 @@ export default {
               const productUnit = data.list[i].productUnit || '--'
               const productPackQtyUnit = data.list[i].productPackQtyUnit || '--'
               data.list[i].packQtyV = productPackQty + productUnit + '/' + productPackQtyUnit
-              if(data.list[i].unitType=='SL'){
+              if (data.list[i].unitType == 'SL') {
                 data.list[i].unitQtyV = data.list[i].unitQty ? (data.list[i].unitQty + data.list[i].productUnit) : '--'
-              }else{
-                data.list[i].unitQtyV = data.list[i].productPackQty&&data.list[i].unitQty ? ((data.list[i].productPackQty*data.list[i].unitQty) + data.list[i].productUnit) : '--'
+              } else {
+                data.list[i].unitQtyV = data.list[i].productPackQty && data.list[i].unitQty ? ((data.list[i].productPackQty * data.list[i].unitQty) + data.list[i].productUnit) : '--'
               }
             }
             this.disabled = false
@@ -195,14 +195,15 @@ export default {
       let idx = 7
       if (this.$hasPermissions('B_salesEdit_salesPrice')) { // 售价权限
         arr.splice(idx, 0, { title: '售价', dataIndex: 'productPrice', width: '100px', align: 'right', scopedSlots: { customRender: 'productPrice' } })
-        idx = idx + 1
+        arr.splice(idx + 1, 0, { title: '价格级别', dataIndex: 'priceLevelDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } })
+        idx = idx + 2
       }
-      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
     }
   },
-  watch:{
-    advanced(a,b){
+  watch: {
+    advanced (a, b) {
       this.tableHeight = window.innerHeight - (a ? 375 : 330)
     }
   },
@@ -210,12 +211,12 @@ export default {
     loadWarehouse (sn) {
       this.defaultWarehouseSn = sn
       this.queryParam.warehouseSn = sn
-      if(this.buyerSn){
+      if (this.buyerSn) {
         this.resetSearchForm()
       }
     },
     // 切换tab
-    changeTab(e){ 
+    changeTab (e) {
       this.promoProductClz = e
       this.resetSearchForm()
     },
@@ -257,32 +258,32 @@ export default {
       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 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 isMcpScge = this.promoRuleData.promotionRuleType == 'BUY_PROD_GIVE_MONEY' && this.promoRuleData.scopeFlag === '1'
+
       const tabList = []
-      if(this.promoRuleData){ 
-        if(this.promoRuleData.gateFlag==='1'){
-          tabList.push({text:'门槛产品',val:'GATE'})
+      if (this.promoRuleData) {
+        if (this.promoRuleData.gateFlag === '1') {
+          tabList.push({ text: '门槛产品', val: 'GATE' })
         }
-        if(this.promoRuleData.promotionRuleType!='PROMO_PROD'){
-          tabList.push({text:'正价产品',val:'REGULAR'})
+        if (this.promoRuleData.promotionRuleType != 'PROMO_PROD') {
+          tabList.push({ text: '正价产品', val: 'REGULAR' })
         }
-        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.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'})
+        if (this.promoRuleData.promotionRuleType == 'PROMO_PROD') {
+          tabList.push({ text: '特价产品', val: 'DISCOUNT' })
         }
       }
       this.tabList = tabList
       this.promoProductClz = tabList[0].val
       this.tableHeight = window.innerHeight - 330
-      
+
       this.queryParam.scopeLevel = promo.countData.scopeLevel
       this.resetSearchForm()
     },

+ 6 - 3
src/views/salesManagement/salesQueryNew/comps/productList.vue

@@ -11,7 +11,7 @@
             <div style="display: flex;">
               <span>促销门槛:</span>
               <div v-if="descDetail.gateFlag === '1'">
-                 {{descDetail.gateInfo}}
+                {{ descDetail.gateInfo }}
               </div>
               <span v-else>无</span>
             </div>
@@ -416,11 +416,12 @@ export default {
       ]
       if (this.$hasPermissions('B_salesEdit_salesPrice')) { // 售价权限
         arr.splice(3, 0, { title: '售价', dataIndex: 'price', width: '6%', align: 'right', scopedSlots: { customRender: 'price' } })
+        arr.splice(4, 0, { title: '价格级别', dataIndex: 'priceLevelDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } })
         let idx = 0
         // 如果是特价活动
         if (this.promo.promotionRule.promotionRuleType == 'PROMO_PROD') {
           idx = idx + 1
-          arr.splice(4, 0, { title: '折扣', dataIndex: 'discountPrice', width: '6%', align: 'right', scopedSlots: { customRender: 'discountPrice' } })
+          arr.splice(5, 0, { title: '折扣', dataIndex: 'discountPrice', width: '6%', align: 'right', scopedSlots: { customRender: 'discountPrice' } })
         }
         arr.splice(8 + idx, 0, { title: '售价小计', dataIndex: 'totalAmount', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
       }
@@ -672,7 +673,8 @@ export default {
       const params = {
         salesBillDetailSn: editRow.salesBillDetailSn,
         salesBillSn: this.salesBillSn,
-        oldSalesPromoSn: this.promo.salesPromoSn
+        oldSalesPromoSn: this.promo.salesPromoSn,
+        priceLevel: editRow.priceLevel
       }
       // 更换活动
       this.$emit('upActive', this.promo, data, params)
@@ -712,6 +714,7 @@ export default {
         salesBillNo: this.detailData.salesBillNo,
         purchaseBillSn: this.detailData.purchaseBillSn,
         purchaseBillNo: this.detailData.purchaseBillNo,
+        priceLevel: row.priceLevel,
         stockSn: row.stockSn,
         promotableFlag: row.isJoinActivityProduct || 0, // 可促销标记 有活动的传1,没活动的传0
         promotionFlag: promotionFlag, // 促销标记 正品传0,促销品传1

+ 3 - 1
src/views/salesManagement/salesQueryNew/comps/productNormalList.vue

@@ -298,7 +298,8 @@ export default {
       ]
       if (this.$hasPermissions('B_salesEdit_salesPrice')) { // 售价权限
         arr.splice(3, 0, { title: '售价', dataIndex: 'price', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
-        arr.splice(7, 0, { title: '售价小计', dataIndex: 'totalAmount', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
+        arr.splice(4, 0, { title: '价格级别', dataIndex: 'priceLevelDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } })
+        arr.splice(8, 0, { title: '售价小计', dataIndex: 'totalAmount', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
       }
       return arr
     }
@@ -526,6 +527,7 @@ export default {
         salesBillNo: this.detailData.salesBillNo,
         purchaseBillSn: this.detailData.purchaseBillSn,
         purchaseBillNo: this.detailData.purchaseBillNo,
+        priceLevel: row.priceLevel,
         stockSn: row.stockSn,
         promotableFlag: row.isJoinActivityProduct || 0, // 可促销标记 有活动的传1,没活动的传0
         promotionFlag: promotionFlag, // 促销标记 正品传0,促销品传1

+ 4 - 3
src/views/salesManagement/salesQueryNew/comps/queryPart.vue

@@ -176,12 +176,13 @@ export default {
       ]
       if (this.$hasPermissions('B_salesEdit_salesPrice')) { // 售价权限
         arr.splice(6, 0, { title: '售价', dataIndex: 'productPrice', width: '80px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
+        arr.splice(7, 0, { title: '价格级别', dataIndex: 'priceLevelDictValue', width: '80px', align: 'center', customRender: function (text) { return text || '--' } })
       }
       return arr
     }
   },
-  watch:{
-    advanced(a,b){
+  watch: {
+    advanced (a, b) {
       this.tableHeight = window.innerHeight - (a ? 325 : 280)
     }
   },
@@ -189,7 +190,7 @@ export default {
     loadWarehouse (sn) {
       this.defaultWarehouseSn = sn
       this.queryParam.warehouseSn = sn
-      if(this.buyerSn){
+      if (this.buyerSn) {
         this.resetSearchForm()
       }
     },

+ 13 - 3
src/views/salesManagement/salesQueryNew/edit.vue

@@ -230,11 +230,14 @@ export default {
       }
     },
     //  销售单详情
-    getOrderDetail (flag) {
+    getOrderDetail (flag, callback) {
       salesDetailBySn({ salesBillSn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {
           this.detailData = res.data
           this.detailData.totalDiscountAmount = Number(this.detailData.totalOrigAmount || 0) - Number(this.detailData.totalAmount || 0)
+          if (callback) {
+            callback()
+          }
         }
         if (flag) {
           this.getActiveList()
@@ -327,7 +330,7 @@ export default {
     openProductModal (type, refId, countData) {
       console.log(type, refId, countData)
       const promo = this.activeList.find(item => item.promoRuleSn == refId)
-      if(promo){
+      if (promo) {
         promo.countData = countData
       }
       this.$refs.chooseProduct.pageInit(this.detailData, promo, type)
@@ -414,8 +417,13 @@ export default {
         this.submitResult(ajax_data)
       } else {
         updateBatch(this.updataData.detailList).then(res => {
+          this.priceUpdateModal = false
           if (res.status == 200) {
-            this.submitResult(ajax_data)
+            // 刷新详情统计
+            this.spinning = true
+            this.getOrderDetail(false, () => {
+              this.submitResult(ajax_data)
+            })
           }
         })
       }
@@ -465,6 +473,7 @@ export default {
             <div style="padding:10px 0;text-align:center"><strong>请按照以上提示修改后再提交</strong></div>
           </div>
         })
+        this.spinning = false
       } else {
         // 弹出确认提示信息,可跳过继续提交
         if (b.length) {
@@ -485,6 +494,7 @@ export default {
               _this.submitOrder(data)
             }
           })
+          this.spinning = false
         } else {
           _this.submitOrder(data)
         }

+ 15 - 15
src/views/salesManagement/salesQueryNew/list.vue

@@ -478,20 +478,20 @@ export default {
       const _this = this
       const arr = [
         { title: '创建时间', dataIndex: 'createDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
-        { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: '7%', align: 'center' },
+        { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: '8%', align: 'center' },
         { title: <a-tooltip placement='top' title='第一次提交时间'>提交时间&nbsp;<a-icon type="question-circle" /></a-tooltip>, dataIndex: 'firstSubmitDate', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') }, sorter: true },
         { title: '客户名称', dataIndex: 'buyerName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '出库仓库', scopedSlots: { customRender: 'warehouseBox' }, width: '8%', align: 'left', ellipsis: true },
+        { title: '出库仓库', scopedSlots: { customRender: 'warehouseBox' }, width: '7%', align: 'center', ellipsis: true },
         { title: '总数量', dataIndex: 'totalQty', scopedSlots: { customRender: 'totalQty' }, width: '4%', align: 'center' },
-        { title: '总售价', dataIndex: 'totalAmount', width: '4%', align: 'right',isShow:false,customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '总售价', dataIndex: 'totalAmount', width: '4%', align: 'right', isShow: false, customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '已下推数量', dataIndex: 'totalPushedQty', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '下推总金额', dataIndex: 'totalPushedAmount', width: '4%', align: 'right', isShow:false, customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '待下推数量', dataIndex: 'totalUnpushedQty', width: '4%', align: 'center', isShow:false, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '待下推金额', dataIndex: 'totalUnpushedAmount', width: '4%', align: 'right',isShow:false,  customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '下推总金额', dataIndex: 'totalPushedAmount', width: '4%', align: 'right', isShow: false, customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '待下推数量', dataIndex: 'totalUnpushedQty', width: '4%', align: 'center', isShow: false, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '待下推金额', dataIndex: 'totalUnpushedAmount', width: '4%', align: 'right', isShow: false, customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '已发货数量', dataIndex: 'totalDispatchQty', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '已取消数量', dataIndex: 'totalCancelQty', width: '4%', align: 'center',isShow:false,  customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '转采购额数量', dataIndex: 'totalConvertPromoGiftsQty', width: '4%', align: 'center',isShow:false,  customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '转采购额金额', dataIndex: 'totalConvertPromoGiftsAmount', width: '4%', align: 'right',isShow:false,  customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '已取消数量', dataIndex: 'totalCancelQty', width: '4%', align: 'center', isShow: false, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '转采购额数量', dataIndex: 'totalConvertPromoGiftsQty', width: '4%', align: 'center', isShow: false, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '转采购额金额', dataIndex: 'totalConvertPromoGiftsAmount', width: '4%', align: 'right', isShow: false, customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '收款方式', dataIndex: 'settleStyleSnDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '审核时间', dataIndex: 'auditDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
         { title: '最近备货时间', dataIndex: 'lastStockUpDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
@@ -500,17 +500,17 @@ export default {
         { title: '备货打印状态', dataIndex: 'printStatusDictValue', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
       ]
-      
+
       arr.map(item => {
-        if(this.$hasPermissions('M_salesQueryList_salesPrice')){
-          item.isShow = ['totalAmount','totalPushedAmount','totalUnpushedAmount','totalConvertPromoGiftsAmount'].includes(item.dataIndex)
+        if (this.$hasPermissions('M_salesQueryList_salesPrice')) {
+          item.isShow = ['totalAmount', 'totalPushedAmount', 'totalUnpushedAmount', 'totalConvertPromoGiftsAmount'].includes(item.dataIndex)
         }
-        if(this.colsArr.find(k=>k.value==item.dataIndex)){
+        if (this.colsArr.find(k => k.value == item.dataIndex)) {
           item.isShow = this.showCols.includes(item.dataIndex)
         }
       })
       console.log(arr)
-      return arr.filter(item => !this.colsArr.find(k=>k.value==item.dataIndex) || item.isShow)
+      return arr.filter(item => !this.colsArr.find(k => k.value == item.dataIndex) || item.isShow)
     }
   },
   methods: {
@@ -539,7 +539,7 @@ export default {
       this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
       this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
     },
-    toWaitCostOrder(){
+    toWaitCostOrder () {
       this.$router.push({ name: 'waitCostOrder' })
     },
     // 新增

+ 2 - 2
src/views/salesManagement/salesQueryNew/setPriceModal.vue

@@ -40,11 +40,11 @@ export default {
   props: {
     show: [Boolean],
     totalRealAmount: {
-      type: String,
+      type: [String, Number],
       default: ''
     },
     totalAmount: {
-      type: String,
+      type: [String, Number],
       default: ''
     }
   },

+ 24 - 6
src/views/salesManagement/shortageStatisticsC/list.vue

@@ -57,8 +57,14 @@
                 </a-form-item>
               </a-col>
               <a-col :md="6" :sm="24">
-                <a-form-item label="客户类型">
-                  <v-select code="DEALER_TYPE" id="shortageStatisticsCList-dealerType" v-model="queryParam.dealerType" allowClear placeholder="请选择客户类型"></v-select>
+                <a-form-item label="商户类型">
+                  <dealerType
+                    id="shortageStatisticsCList-dealerType"
+                    changeOnSelect
+                    v-model="dealerType"
+                    @change="getDealerType"
+                    allowClear
+                    placeholder="请选择商户类型"></dealertype>
                 </a-form-item>
               </a-col>
               <a-col :md="6" :sm="24">
@@ -159,16 +165,18 @@ import ProductType from '@/views/common/productType.js'
 import ProductBrand from '@/views/common/productBrand.js'
 import chooseWarehouse from '@/views/common/chooseWarehouse'
 import customerService from '@/views/common/customerService'
+import dealerType from '@/views/common/dealerType.js'
 import { oosBuyerList, oosBuyerDetailCount, oosBuyerDetailPageCount, oosDetailExport } from '@/api/oos'
 export default {
   name: 'ShortageStatisticsCList',
   mixins: [commonMixin],
-  components: { STable, VSelect, dealerSubareaScopeList, subarea, Area, rangeDate, ProductBrand, ProductType, chooseWarehouse, customerService },
+  components: { STable, VSelect, dealerSubareaScopeList, subarea, Area, rangeDate, ProductBrand, ProductType, chooseWarehouse, customerService, dealerType },
   data () {
     return {
       spinning: false,
       advanced: true, // 高级搜索 展开/关闭
       tableHeight: 0, // 表格高度
+      dealerType: [],
       queryParam: { //  查询条件
         beginDate: getDate.getCurrMonthDays().starttime,
         endDate: getDate.getCurrMonthDays().endtime,
@@ -184,7 +192,8 @@ export default {
         productTypeSn3: '', //  产品三级分类
         salesBillNo: '',
         provinceSn: undefined,
-        dealerType: undefined,
+        dealerType1: undefined, //  商户类型
+        dealerType2: undefined, //  商户类型
         brandType: undefined,
         productBrandSn: undefined,
         state: undefined,
@@ -210,6 +219,9 @@ export default {
             const no = (data.pageNo - 1) * data.pageSize
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
+              if (data.list[i].dealerEntity.dealerTypeName1) {
+                data.list[i].dealerTypeName = data.list[i].dealerEntity.dealerTypeName1 + '>' + data.list[i].dealerEntity.dealerTypeName2
+              }
             }
             this.disabled = false
             this.getCount(params)
@@ -233,7 +245,7 @@ export default {
         { title: '省份', dataIndex: 'dealerEntity.provinceName', width: 80, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '客户名称', dataIndex: 'dealerEntity.dealerName', width: 140, align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '仓库', dataIndex: 'warehouseName', width: 100, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '客户类型', dataIndex: 'dealerEntity.dealerTypeDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户类型', dataIndex: 'dealerTypeName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '创建时间', dataIndex: 'createDate', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '品牌', dataIndex: 'productEntity.productBrandName', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '二级分类', dataIndex: 'productEntity.productTypeName2', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
@@ -293,8 +305,13 @@ export default {
       this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
       this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
     },
+    getDealerType (v, o) {
+      this.queryParam.dealerType1 = v[0]
+      this.queryParam.dealerType2 = v[1]
+    },
     //  重置
     resetSearchForm () {
+      this.dealerType = []
       this.$refs.rangeDate.resetDate(this.time)
       this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
       this.queryParam.endDate = getDate.getCurrMonthDays().endtime
@@ -312,7 +329,8 @@ export default {
       this.queryParam.productTypeSn3 = ''
       this.queryParam.salesBillNo = ''
       this.queryParam.provinceSn = undefined
-      this.queryParam.dealerType = undefined
+      this.queryParam.dealerType1 = undefined
+      this.queryParam.dealerType2 = undefined
       this.queryParam.brandType = undefined
       this.queryParam.productBrandSn = undefined
       this.queryParam.state = undefined

+ 2 - 2
src/views/salesManagement/waitCostOrder/list.vue

@@ -180,8 +180,8 @@ export default {
         { title: '客户名称', dataIndex: 'buyerName', width: '16%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '费用类型', dataIndex: 'convertExpenseAccountTypeDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '待转金额', dataIndex: 'expense', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '促销名称', dataIndex: 'promotionTitle', width: '17%', align: 'left', customRender: function (text) { return text || '--' } },
-        { title: '促销简称', dataIndex: 'promotionDescription', width: '17%', align: 'left', customRender: function (text) { return text || '--' }, sorter: true },
+        { title: '促销名称', dataIndex: 'promotionTitle', width: '17%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '促销简称', dataIndex: 'promotionDescription', width: '17%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
         { title: '规则简称', dataIndex: 'promotionRuleDescription', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, sorter: true },
         { title: '促销类型', dataIndex: 'promotionRuleTypeDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }

+ 3 - 1
src/views/salesReturnManagement/custConfirm/setPriceModal.vue

@@ -44,7 +44,7 @@
           </div>
           <div v-else>
             销售单号:
-            <a-input placeholder="请输入销售单号" v-model.trim="form.salesBillNo" :maxLength="50" @change="fetchUser" @blur="handleBlur"/>
+            <a-input placeholder="请输入销售单号" v-model.trim="form.salesBillNo" :maxLength="50" @change="fetchUser"/>
             <span class="mleft">{{ buyerName }}</span>
             <a-button type="primary" :disabled="!salesBillFlag" @click="handleSave('salesBillNo')" class="button-error errorBtn">设置完成</a-button>
           </div>
@@ -186,6 +186,7 @@ export default {
   },
   methods: {
     fetchUser () {
+      this.salesBillFlag = false
       this.form.salesBillNo = this.form.salesBillNo.replace(/\s+/g, '')
       if (!this.form.salesBillNo) {
         this.form.salesBillNo = ''
@@ -196,6 +197,7 @@ export default {
       salesDetailByNo({ salesBillNo: this.form.salesBillNo }).then(res => {
         this.spinning = false
         this.buyerName = res.data ? res.data.buyerName : ''
+        this.handleBlur()
       })
     },
     // 打开抓单设置单价弹窗

+ 1 - 0
src/views/salesReturnManagement/receiveCheck/chooseProductsModal.vue

@@ -89,6 +89,7 @@ export default {
         'returnReason': rows ? rows.dispName : '',
         'returnReasonRemarks': row.returnReasonRemarks,
         'productSn': row.productSn,
+        'priceLevel': row.priceLevel,
         'initialQty': row.qty,
         'receiveQty': row.receiveQty
       }

+ 2 - 1
src/views/salesReturnManagement/salesReturn/queryPart.vue

@@ -192,7 +192,8 @@ export default {
       ]
       let i = 5
       if (this.$hasPermissions('B_salesReturnEdit_salesPrice') && this.isShowPrice) { //  售价权限
-        arr.splice(4, 0, { title: '当前售价', dataIndex: 'productPrice', width: '9%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
+        arr.splice(4, 0, { title: '当前售价', dataIndex: 'productPrice', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
+        arr.splice(5, 0, { title: '价格级别', dataIndex: 'priceLevelDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } })
         i = 6
       }
       // 实收数量是否显示

+ 1 - 0
src/views/salesReturnManagement/salesReturn/salesReturnEdit.vue

@@ -481,6 +481,7 @@ export default {
         'salesReturnBillSn': this.orderSn,
         'salesReturnBillNo': this.ordeDetail.salesReturnBillNo,
         'price': row.productPrice,
+        'priceLevel': row.priceLevel,
         'returnReasonCode': row.returnReasonCode,
         'returnReason': rows ? rows.dispName : '',
         'goodFlag': this.goodFlag,

+ 1 - 1
vue.config.js

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