ソースを参照

添加价格权限

chenrui 1 年間 前
コミット
6f8731d7c2
1 ファイル変更48 行追加23 行削除
  1. 48 23
      src/views/reportData/promotionSalesOrderReport/list.vue

+ 48 - 23
src/views/reportData/promotionSalesOrderReport/list.vue

@@ -213,29 +213,6 @@ export default {
       form: {
         monthInfo: [moment().format('YYYY-MM'), moment().format('YYYY-MM')]
       },
-      columns: [
-        { title: '区域', dataIndex: 'subareaArea.subareaName', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '区域负责人', dataIndex: 'bizUserName', width: '90px', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '省份', dataIndex: 'dealerInfo.provinceName', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客户名称', dataIndex: 'dealerInfo.dealerName', width: '130px', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '客户级别', dataIndex: 'dealerInfo.dealerLevelDictValue', width: '90px', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '品牌', dataIndex: 'brandName', width: '90px', align: 'center', scopedSlots: { customRender: 'brandName' } },
-        { title: '二级分类', dataIndex: 'brandtypeName', width: '90px', align: 'center', scopedSlots: { customRender: 'brandtypeName' } },
-        { title: '销售额', dataIndex: 'totalSaleAmount', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
-        { title: '促销成本费用', dataIndex: 'promoCostFee', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
-        { title: '促销成本费用比', dataIndex: 'promoCostFeeRate', width: '96px', align: 'center', customRender: text => (text ? (text * 100).toFixed(2) + '%' : '--') },
-        { title: '促销销售费用', dataIndex: 'promoSaleFee', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
-        { title: '促销销售费用比', dataIndex: 'promoSaleFeeRate', width: '96px', align: 'center', customRender: text => (text ? (text * 100).toFixed(2) + '%' : '--') },
-        { title: '参与活动销售额', dataIndex: 'promoSaleAmount', width: '96px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
-        { title: '未参与活动销售额', dataIndex: 'notpromotionSale', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
-        { title: '调拨物料成本费用', dataIndex: 'allocateCost', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
-        { title: '调拨物料销售费用', dataIndex: 'allocateSaleAmount', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
-        { title: '促销成本费用+物料成本费用合计', dataIndex: 'promoCostFeeAndAllocateCost', width: '100px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
-        { title: '成本合计占比', dataIndex: 'totalCostRate', width: '90px', align: 'center', customRender: text => (text ? (text * 100).toFixed(2) + '%' : '--') },
-        { title: '促销销售费用+物料销售费用合计', dataIndex: 'promoSaleFeeAndAllocateAmount', width: '100px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
-        { title: '销售合计占比', dataIndex: 'totalSaleRate', width: '90px', align: 'center', customRender: text => (text ? (text * 100).toFixed(2) + '%' : '--') }
-      ],
       rules: {
         monthInfo: [{ required: true, message: '请选择统计月份', trigger: 'change' }]
       },
@@ -272,6 +249,54 @@ export default {
       totalData: null
     }
   },
+  computed: {
+    columns () {
+      const _this = this
+      const arr = [
+        { title: '区域', dataIndex: 'subareaArea.subareaName', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '区域负责人', dataIndex: 'bizUserName', width: '90px', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '省份', dataIndex: 'dealerInfo.provinceName', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'dealerInfo.dealerName', width: '130px', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '客户级别', dataIndex: 'dealerInfo.dealerLevelDictValue', width: '90px', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '品牌', dataIndex: 'brandName', width: '90px', align: 'center', scopedSlots: { customRender: 'brandName' } },
+        { title: '二级分类', dataIndex: 'brandtypeName', width: '90px', align: 'center', scopedSlots: { customRender: 'brandtypeName' } }
+        // { title: '销售额', dataIndex: 'totalSaleAmount', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') },
+        // { title: '促销成本费用', dataIndex: 'promoCostFee', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
+        // { title: '促销成本费用比', dataIndex: 'promoCostFeeRate', width: '96px', align: 'center', customRender: text => (text ? (text * 100).toFixed(2) + '%' : '--') },
+        // { title: '促销销售费用', dataIndex: 'promoSaleFee', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') },
+        // { title: '促销销售费用比', dataIndex: 'promoSaleFeeRate', width: '96px', align: 'center', customRender: text => (text ? (text * 100).toFixed(2) + '%' : '--') },
+        // { title: '参与活动销售额', dataIndex: 'promoSaleAmount', width: '96px', align: 'right', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') },
+        // { title: '未参与活动销售额', dataIndex: 'notpromotionSale', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') },
+        // { title: '调拨物料成本费用', dataIndex: 'allocateCost', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') },
+        // { title: '调拨物料销售费用', dataIndex: 'allocateSaleAmount', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') },
+        // { title: '促销成本费用+物料成本费用合计', dataIndex: 'promoCostFeeAndAllocateCost', width: '100px', align: 'right', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') },
+        // { title: '成本合计占比', dataIndex: 'totalCostRate', width: '90px', align: 'center', customRender: text => (text ? (text * 100).toFixed(2) + '%' : '--') }
+        // { title: '促销销售费用+物料销售费用合计', dataIndex: 'promoSaleFeeAndAllocateAmount', width: '100px', align: 'right', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') },
+        // { title: '销售合计占比', dataIndex: 'totalSaleRate', width: '90px', align: 'center', customRender: text => (text ? (text * 100).toFixed(2) + '%' : '--') }
+      ]
+      if (this.$hasPermissions('M_promotionSalesOrderReportList_salesPrice')) { //  售价权限
+        const isCostFlag = this.$hasPermissions('M_promotionSalesOrderReportList_costPrice')
+        arr.splice(8, 0, { title: '销售额', dataIndex: 'totalSaleAmount', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') })
+        arr.splice(isCostFlag ? 11 : 9, 0, { title: '促销销售费用', dataIndex: 'promoSaleFee', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') })
+        arr.splice(isCostFlag ? 12 : 10, 0, { title: '促销销售费用比', dataIndex: 'promoSaleFeeRate', width: '96px', align: 'center', customRender: text => (text ? (text * 100).toFixed(2) + '%' : '--') })
+        arr.splice(isCostFlag ? 12 : 11, 0, { title: '参与活动销售额', dataIndex: 'promoSaleAmount', width: '96px', align: 'right', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') })
+        arr.splice(isCostFlag ? 13 : 12, 0, { title: '未参与活动销售额', dataIndex: 'notpromotionSale', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') })
+        arr.splice(isCostFlag ? 16 : 13, 0, { title: '调拨物料销售费用', dataIndex: 'allocateSaleAmount', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') })
+        arr.splice(isCostFlag ? 19 : 14, 0, { title: '促销销售费用+物料销售费用合计', dataIndex: 'promoSaleFeeAndAllocateAmount', width: '100px', align: 'right', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') })
+        arr.splice(isCostFlag ? 20 : 15, 0, { title: '销售合计占比', dataIndex: 'totalSaleRate', width: '90px', align: 'center', customRender: text => (text ? (text * 100).toFixed(2) + '%' : '--') })
+      }
+      if (this.$hasPermissions('M_promotionSalesOrderReportList_costPrice')) { //  成本
+        const isSellFlag = this.$hasPermissions('M_promotionSalesOrderReportList_salesPrice')
+        arr.splice(isSellFlag ? 9 : 8, 0, { title: '促销成本费用', dataIndex: 'promoCostFee', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') })
+        arr.splice(isSellFlag ? 10 : 9, 0, { title: '促销成本费用比', dataIndex: 'promoCostFeeRate', width: '96px', align: 'center', customRender: text => (text ? (text * 100).toFixed(2) + '%' : '--') })
+        arr.splice(isSellFlag ? 15 : 10, 0, { title: '调拨物料成本费用', dataIndex: 'allocateCost', width: '90px', align: 'right', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') })
+        arr.splice(isSellFlag ? 17 : 11, 0, { title: '促销成本费用+物料成本费用合计', dataIndex: 'promoCostFeeAndAllocateCost', width: '100px', align: 'right', customRender: text => ((text || text == 0) ? _this.toThousands(text) : '--') })
+        arr.splice(isSellFlag ? 18 : 12, 0, { title: '成本合计占比', dataIndex: 'totalCostRate', width: '90px', align: 'center', customRender: text => (text ? (text * 100).toFixed(2) + '%' : '--') })
+      }
+      return arr
+    }
+  },
   watch: {
     advanced (newValue, oldValue) {
       const _this = this