Browse Source

修改bug

chenrui 2 years ago
parent
commit
5aa179080b
1 changed files with 49 additions and 65 deletions
  1. 49 65
      src/views/productManagement/productInfoJg/list.vue

+ 49 - 65
src/views/productManagement/productInfoJg/list.vue

@@ -63,10 +63,10 @@
         </a-col>
         </a-col>
         <a-col class="gutter-row" :span="12">
         <a-col class="gutter-row" :span="12">
           <div class="setTableList">
           <div class="setTableList">
-            <a-checkbox v-model="isTerminalPrice" @change="changeTerminalPrice">
+            <a-checkbox v-model="isTerminalPrice">
               自定义终端价
               自定义终端价
             </a-checkbox>
             </a-checkbox>
-            <a-checkbox v-model="isCarOwnersPrice" @change="changeCarOwnersPrice">
+            <a-checkbox v-model="isCarOwnersPrice">
               自定义车主价
               自定义车主价
             </a-checkbox>
             </a-checkbox>
           </div>
           </div>
@@ -201,7 +201,6 @@ export default {
       disabled: false, //  查询、重置按钮是否可操作
       disabled: false, //  查询、重置按钮是否可操作
       exportLoading: false, // 导出loading
       exportLoading: false, // 导出loading
       dateFormat: 'YYYY-MM-DD',
       dateFormat: 'YYYY-MM-DD',
-      columns: [],
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
       loadData: parameter => {
         this.disabled = true
         this.disabled = true
@@ -223,7 +222,8 @@ export default {
       openModal: false, //  查看客户详情  弹框
       openModal: false, //  查看客户详情  弹框
       itemId: '', //  当前产品id
       itemId: '', //  当前产品id
       productTypeList: [], //  分类下拉数据
       productTypeList: [], //  分类下拉数据
-      rowSelectionInfo: null
+      rowSelectionInfo: null,
+      currentDealerInfo:{}
     }
     }
   },
   },
   computed: {
   computed: {
@@ -235,6 +235,46 @@ export default {
           }
           }
         })
         })
       }
       }
+    },
+    columns(){
+      const _this = this
+     let arr = [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '产品编码', dataIndex: 'code', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'name', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '原厂编码', dataIndex: 'origCode', width: '12%', align: 'center', customRender: function (text) { return (!text || text == ' ') ? '--' : text } }
+      ]
+      const cArr = [
+        { title: '终端价', dataIndex: 'terminalPrice', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '车主价', dataIndex: 'carOwnersPrice', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        // { title: '自定义终端价', dataIndex: 'price1', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        // { title: '自定义车主价', dataIndex: 'price2', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '状态', scopedSlots: { customRender: 'enabledFlag' }, width: '7%', align: 'center' },
+        { title: '产品图片', scopedSlots: { customRender: 'imageUrl' }, width: '6%', align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '12%', align: 'center' }
+      ]
+      if (_this.currentDealerInfo.dealerLevel && _this.currentDealerInfo.dealerLevel == 'PROVINCE') { //  省级
+       arr.push(
+          { title: '省级价', dataIndex: 'provincePrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+          { title: '市级价', dataIndex: 'cityPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+        )
+      } else if (_this.currentDealerInfo.dealerLevel && _this.currentDealerInfo.dealerLevel == 'CITY') { //  市级
+        arr.push(
+          { title: '市级价', dataIndex: 'cityPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+        )
+      }
+      if (_this.currentDealerInfo.isShowSpecialPrice && _this.currentDealerInfo.isShowSpecialPrice == '1') { //  是否展示特约价
+        arr.push({ title: '特约价', dataIndex: 'specialPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      }
+      if (_this.isTerminalPrice) {
+        cArr.splice(1, 0, { title: '自定义终端价', dataIndex: 'dealerProductPrice.terminalPrice', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      }
+      if (_this.isCarOwnersPrice) {
+        const pos = _this.isTerminalPrice ? 3 : 2
+        cArr.splice(pos, 0, { title: '自定义车主价', dataIndex: 'dealerProductPrice.carOwnersPrice', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      }
+      arr = [...arr, ...cArr]
+      return arr
     }
     }
   },
   },
   methods: {
   methods: {
@@ -274,71 +314,14 @@ export default {
       this.rowSelectionInfo = null
       this.rowSelectionInfo = null
       this.$refs.table.clearSelected()
       this.$refs.table.clearSelected()
     },
     },
-    // 设置表头
-    getColumns () {
-      const _this = this
-      this.columns = [
-        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '产品编码', dataIndex: 'code', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'name', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '原厂编码', dataIndex: 'origCode', width: '12%', align: 'center', customRender: function (text) { return (!text || text == ' ') ? '--' : text } }
-      ]
-      const cArr = [
-        { title: '终端价', dataIndex: 'terminalPrice', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '车主价', dataIndex: 'carOwnersPrice', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        // { title: '自定义终端价', dataIndex: 'price1', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        // { title: '自定义车主价', dataIndex: 'price2', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '状态', scopedSlots: { customRender: 'enabledFlag' }, width: '7%', align: 'center' },
-        { title: '产品图片', scopedSlots: { customRender: 'imageUrl' }, width: '6%', align: 'center' },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '12%', align: 'center' }
-      ]
+    //获取省级经销商、市级经销商和特约经销商信息
+    getCurrentDealerInfo(){
       getCurrentDealer().then(res => {
       getCurrentDealer().then(res => {
         if (res.status == 200) {
         if (res.status == 200) {
-          if (res.data.dealerLevel && res.data.dealerLevel == 'PROVINCE') { //  省级
-            this.columns.push(
-              { title: '省级价', dataIndex: 'provincePrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-              { title: '市级价', dataIndex: 'cityPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
-            )
-          } else if (res.data.dealerLevel && res.data.dealerLevel == 'CITY') { //  市级
-            this.columns.push(
-              { title: '市级价', dataIndex: 'cityPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
-            )
-          }
-          if (res.data.isShowSpecialPrice && res.data.isShowSpecialPrice == '1') { //  是否展示特约价
-            this.columns.push({ title: '特约价', dataIndex: 'specialPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-          }
-          if (_this.isTerminalPrice) {
-            cArr.splice(1, 0, { title: '自定义终端价', dataIndex: 'dealerProductPrice.terminalPrice', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-          }
-          if (_this.isCarOwnersPrice) {
-            const pos = _this.terminalPrice ? 3 : 2
-            cArr.splice(pos, 0, { title: '自定义车主价', dataIndex: 'dealerProductPrice.carOwnersPrice', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-          }
-          this.columns = [...this.columns, ...cArr]
+         this.currentDealerInfo=res.data
         }
         }
       })
       })
     },
     },
-    // 显示自定义终端价
-    changeTerminalPrice (e) {
-      this.terminalPrice = e.target.checked
-      const _this=this;
-      const pos= _this.columns.findIndex(item=>{return item.title == '终端价'})
-      if(e.target.checked){
-        _this.columns.splice(pos+1, 0, { title: '自定义终端价', dataIndex: 'dealerProductPrice.terminalPrice', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-      }else{
-        _this.columns.splice(pos+1,1)
-      }
-    },
-    changeCarOwnersPrice (e) {
-      this.isCarOwnersPrice = e.target.checked
-      const _this=this;
-      const pos = _this.columns.findIndex(item=>{return item.title == '车主价'})
-     if(e.target.checked){
-       _this.columns.splice(pos+1, 0, { title: '自定义车主价', dataIndex: 'dealerProductPrice.carOwnersPrice', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
-     }else{
-        _this.columns.splice(pos+1,1)
-     }
-    },
     filterOption (input, option) {
     filterOption (input, option) {
       return (
       return (
         option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
         option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
@@ -409,7 +392,7 @@ export default {
       this.$nextTick(() => { // 页面渲染完成后的回调
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
         _this.setTableH()
       })
       })
-      this.getColumns()
+       this.getCurrentDealerInfo()
     },
     },
     setTableH () {
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
       const tableSearchH = this.$refs.tableSearch.offsetHeight
@@ -440,6 +423,7 @@ export default {
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
       this.pageInit()
       this.pageInit()
       this.resetSearchForm()
       this.resetSearchForm()
+     
     }
     }
   },
   },
   activated () {
   activated () {