浏览代码

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

lilei 1 年之前
父节点
当前提交
2252ffe21a

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

@@ -147,14 +147,16 @@
           bordered>
           <!-- 售价 -->
           <template slot="productPriceInfo" slot-scope="text, record">
-            <span v-if="!record.priceLevel">{{ (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>
+            <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.priceValue ||record.priceValue==0">{{ record.priceLevelDictValue }}</span>
+              <span v-if="record.powerFlag!=0">{{ record.priceLevelDictValue }}</span>
               <v-select
                 v-else
                 style="width:90%;"
@@ -411,7 +413,6 @@ export default {
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
             data.list[i].qty = 1
-            data.list[i].priceLevel = undefined
             data.list[i].priceValue = data.list[i].productPrice
           }
           this.loadDataSource = data.list || []
@@ -614,7 +615,7 @@ export default {
         productTypeSn1: row.productTypeSn1,
         productTypeSn2: row.productTypeSn2,
         productTypeSn3: row.productTypeSn3,
-        priceLevel: row.priceLevel ? row.priceLevel : undefined
+        priceLevel: row.priceLevel
       }
       if (isEdit) { // 编辑
         // 清空数量时,值应保持未清空前的值,因数量不可为空

+ 9 - 1
src/views/dealerManagement/merchantInfoManagement/chooseTypeList.vue

@@ -178,11 +178,19 @@ export default {
 }
 </script>
 
-<style lang="less">
+<style lang="less" scoped>
   .empty-data{
         color: #999;
         text-align: center;
         padding: 20px;
         border:1px solid #eee;
     }
+    /* 修改表格多选框颜色 */
+  /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>

+ 83 - 16
src/views/dealerManagement/merchantInfoManagement/chooseTypeModal.vue

@@ -7,7 +7,7 @@
     title="选择品类"
     v-model="isShow"
     @cancel="isShow=false"
-    width="70%">
+    width="50%">
     <a-spin :spinning="spinning" tip="Loading...">
       <!-- 表单 -->
       <a-form-model
@@ -21,18 +21,45 @@
           <v-select
             code="PRICE_LEVEL"
             :notIn="notArr"
-            style="width: 50%;"
+            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="productScopeList"></a-form-model-item>
+        <a-form-model-item label="添加品类" prop="typeVal">
+          <a-radio-group v-model="form.typeVal" @change="onChangeType">
+            <a-radio :value="1">
+              全选
+            </a-radio>
+            <a-radio :value="2">
+              自主品牌
+            </a-radio>
+            <a-radio :value="3">
+              代理品牌
+            </a-radio>
+            <a-radio :value="4">
+              <a-tooltip placement="rightTop">
+                <template slot="title">
+                  <span>选择全品类后,未来新加入的品类也将自动默认为已选择状态,无需再次手动操作。</span>
+                </template>
+                <span>全品类</span>
+                <a-icon type="question-circle" style="margin-left:5px;" />
+              </a-tooltip>
+            </a-radio>
+          </a-radio-group>
+        </a-form-model-item>
         <div class="typeListBox">
-          <chooseTypeList ref="chooseTypeInfo" :maxHeight="500"></chooseTypeList>
+          <a-tree
+            v-model="checkedList"
+            checkable
+            :auto-expand-parent="autoExpandParent"
+            :tree-data="treeData"
+            :replaceFields="replaceObj"
+            @check="onCheck"
+          />
         </div>
-
       </a-form-model>
       <div class="btn-cont">
         <a-button id="chooseType-modal-back" @click="isShow = false" >取消</a-button>
@@ -43,7 +70,7 @@
 </template>
 
 <script>
-import { dealerScopeCreate } from '@/api/dealerScope'
+import { dealerScopeCreate, queryWaitingData } from '@/api/dealerScope'
 import chooseTypeList from './chooseTypeList.vue'
 import { VSelect } from '@/components'
 export default {
@@ -60,29 +87,40 @@ export default {
       isShow: this.openModal, //  是否打开弹框
       spinning: false,
       formItemLayout: {
-        labelCol: { span: 2 },
-        wrapperCol: { span: 18 }
+        labelCol: { span: 3 },
+        wrapperCol: { span: 20 }
       },
       form: {
         priceLevel: undefined, // 价格级别
-        productScopeList: []// 产品分类
+        typeVal: ''
       },
       rules: {
         priceLevel: [
           { required: true, message: '请选择价格等级', trigger: 'change' }
         ],
-        productScopeList: [
-          { required: true, message: '请选择产品品类', trigger: 'blur' }
+        typeVal: [
+          { required: true, message: '请选择产品品类', trigger: 'change' }
         ]
       },
-      notArr: [],
-      notArrFlag: false
+      notArr: [], // 特约经销商  禁用选择
+      notArrFlag: false,
+      treeData: [], // 品牌分类数据
+      checkedList: [],
+      autoExpandParent: false, // 是否自动展开父节点
+      replaceObj: {
+        children: 'sonList', title: 'name', key: 'sn'
+      }
     }
   },
   methods: {
+    onChangeType () {
+
+    },
     //  保存
     handleSave () {
       const _this = this
+      const checkedArr = _this.changeCheckedList()
+      debugger
       const getTableList = _this.$refs.chooseTypeInfo.chooseDataList
       _this.form.productScopeList = getTableList
       _this.$refs.ruleForm.validate(valid => {
@@ -104,6 +142,34 @@ export default {
           return false
         }
       })
+    },
+    getDataList () {
+      const _this = this
+      queryWaitingData({}).then(res => {
+        if (res.status == 200) {
+          _this.treeData = res.data
+          _this.spinning = false
+        } else {
+          _this.spinning = false
+        }
+      })
+    },
+    onCheck (checkedKeys) {
+      console.log('onCheck', checkedKeys)
+      this.checkedList = checkedKeys
+    },
+    changeCheckedList () {
+      const arr = this.checkedList.map(item => {
+        const newArr = item.split('_')
+        const obj = {
+          productBrandSn: newArr[2],
+          productTypeSn1: newArr[4] ? newArr[4] : undefined,
+          productTypeSn2: newArr[6] ? newArr[6] : undefined,
+          productTypeSn3: newArr[8] ? newArr[8] : undefined
+        }
+        return obj
+      })
+      return arr
     }
   },
   watch: {
@@ -115,7 +181,6 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$refs.ruleForm.resetFields()
-        this.$refs.chooseTypeInfo.clearSelectTable()
         this.$emit('close')
       } else {
         if (this.$route.params.dealerLevel === 'special') {
@@ -125,7 +190,7 @@ export default {
           this.notArr = ['SPECIAL']
         }
         this.$nextTick(() => {
-          this.$refs.chooseTypeInfo.getTableData()
+          this.getDataList()
         })
       }
     }
@@ -136,7 +201,9 @@ export default {
 <style lang="less" scoped>
   .chooseType-modal{
     .typeListBox{
-      line-height: 23px !important;
+      padding:0 30px;
+      max-height: 500px;
+      overflow-y:scroll;
     }
     .ant-modal-body {
       padding: 40px 40px 24px;

+ 104 - 58
src/views/dealerManagement/merchantInfoManagement/permissionSettingNew.vue

@@ -16,8 +16,7 @@
             ref="ruleForm"
             class="form-model-con"
             layout="inline"
-            :model="queryParam"
-            @keyup.enter.native="$refs.table.refresh()">
+            :model="queryParam">
             <a-row :gutter="15">
               <a-col :md="6" :sm="24">
                 <a-form-model-item label="品牌" prop="productBrandSn">
@@ -35,7 +34,7 @@
                 </a-form-model-item>
               </a-col>
               <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
-                <a-button type="primary" @click="$refs.table.refresh()" :disabled="disabled" id="permissionSetting-refresh">查询</a-button>
+                <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>
@@ -46,24 +45,23 @@
           <a-button id="permissionSetting-brand" type="primary" class="button-error" @click="chooseTModal">选择品类</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"
-          :showPagination="false"
-          bordered>
-          <!-- 操作 -->
-          <template slot="action" slot-scope="text, record">
-            <a-button v-if="$route.params.dealerLevel != 'special'" size="small" type="link" class="button-info" @click="handleEdit(record)">编辑</a-button>
-            <a-button size="small" type="link" class="button-error" @click="handleDel(record)">删除</a-button>
-          </template>
-        </s-table>
+        <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="no"
+            :checkbox-option="checkboxOption"
+          />
+          <div v-show="showEmpty" class="empty-data"><a-empty description="暂无产品" :image="simpleImage"/></div>
+        </div>
       </a-card>
     </a-spin>
     <!-- 选择产品分类 -->
@@ -80,6 +78,7 @@ 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',
@@ -94,51 +93,88 @@ export default {
         productTypeSn1: '', //  产品一级分类
         productTypeSn2: '', //  产品二级分类
         productTypeSn3: '', //  产品三级分类
-        priceLevel: undefined,
-        goodsType: 'CATEGORY'
+        priceLevel: undefined
       },
       productType: [],
       disabled: false, //  查询、重置按钮是否可操作
       loading: false, //  表格加载中
-      columns: [
-        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
-        { title: '品牌', dataIndex: 'productBrandName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '一级分类', dataIndex: 'productTypeName1', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '二级分类', dataIndex: 'productTypeName2', align: 'center', width: '20%', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '三级分类', dataIndex: 'productTypeName3', align: 'center', width: '20%', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '价格级别', dataIndex: 'priceLevelDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '15%', align: 'center' }
-      ],
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        this.disabled = true
-        this.spinning = true
-        return dealerScopeQueryList(Object.assign(parameter, this.queryParam, { dealerSn: this.$route.params.sn })).then(res => {
-          let data
-          if (res.status == 200) {
-            data = res.data
-            for (var i = 0; i < data.length; i++) {
-              data[i].no = i + 1
-            }
-            this.disabled = false
-          }
-          this.spinning = false
-          return data
-        })
-      },
       openTypeModal: false, //  选择产品分类
       chooseType: [], //  所选分类
       openPriceLevelModal: false,
       itemSn: null,
-      itemPriceLevel: ''
+      itemPriceLevel: '',
+      simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
+      dataSource: [],
+      showEmpty: false,
+      showTableHead: true, // 显示表头
+      checkboxOption: {
+        // 行选择改变事件
+        selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
+          console.log(row, isSelected, selectedRowKeys)
+        },
+        // 全选改变事件
+        selectedAllChange: ({ isSelected, selectedRowKeys }) => {
+          console.log(isSelected, selectedRowKeys)
+        }
+      }
+    }
+  },
+  computed: {
+    columns () {
+      const _this = this
+      // 操作按钮
+      const actionFormat = function (record, data, h) {
+        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-info" 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: 'action', width: 100, key: 'e', align: 'center', fixed: 'right', operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return actionFormat(row, row[column.field], h) } }
+      ]
+      return arr
     }
   },
   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 () {
       this.openTypeModal = true
     },
-    // 编辑价格等级
+    // 打开编辑弹窗
     handleEdit (row) {
       this.itemSn = row.dealerScopeSn
       this.itemPriceLevel = row.priceLevel
@@ -146,12 +182,12 @@ export default {
         this.openPriceLevelModal = true
       })
     },
+    // 编辑价格等级
     handlePriceLevelOk (val) {
       const _this = this
       dealerScopeModifyPriceLevel({ dealerScopeSn: this.itemSn, priceLevel: val }).then(res => {
         if (res.status == 200) {
           _this.$message.success(res.message)
-          _this.$refs.table.refresh()
           _this.spinning = false
         } else {
           _this.spinning = false
@@ -171,7 +207,7 @@ export default {
     },
     // 选择品类完成
     handleTypeOk (obj) {
-      this.$refs.table.refresh(true)
+      // this.$refs.table.refresh(true)
     },
     // 删除
     handleDel (row) {
@@ -185,7 +221,7 @@ export default {
           dealerScopeDelete({ dealerScopeSn: row.dealerScopeSn }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
-              _this.$refs.table.refresh()
+              // _this.$refs.table.refresh()
               _this.spinning = false
             } else {
               _this.spinning = false
@@ -202,7 +238,7 @@ export default {
       this.queryParam.productTypeSn3 = ''
       this.queryParam.priceLevel = undefined
       this.productType = []
-      this.$refs.table.refresh(true)
+      this.getData()
     },
     // 返回
     handleBack () {
@@ -216,7 +252,7 @@ export default {
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 292
+      this.tableHeight = window.innerHeight - tableSearchH - 205
     }
   },
   watch: {
@@ -226,15 +262,15 @@ export default {
   },
   mounted () {
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
-      this.$refs.table.refresh(true)
       this.pageInit()
+      this.resetSearchForm()
     }
   },
   activated () {
     // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
     if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
-      this.$refs.table.refresh(true)
       this.pageInit()
+      this.resetSearchForm()
     }
   },
   beforeRouteEnter (to, from, next) {
@@ -248,5 +284,15 @@ export default {
     .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>