瀏覽代碼

修改bug

chenrui 9 月之前
父節點
當前提交
f8dfca9cbf

+ 12 - 0
src/api/shopProduct.js

@@ -129,3 +129,15 @@ export const queryProductSnList = (params) => {
     method: 'post'
   })
 }
+
+// 商城目录 列表  无分页
+export const queryExtList = (params) => {
+  return axios({
+    url: '/shopCategory/queryExtList',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('商城目录列表')
+    }
+  })
+}

+ 1 - 0
src/views/easyPassManagement/shoppingManagement/list.vue

@@ -64,6 +64,7 @@
             type="link"
             class="button-error"
             @click="handleDel(record)"
+            v-show="(record.type=='root'&&!record.enableFlag)"
             :id="'shoppingManagementList-del-btn'+record.id">删除</a-button>
         </template>
       </a-table>

+ 1 - 1
src/views/easyPassManagement/shoppingProducts/importGuideModal.vue

@@ -16,7 +16,7 @@
           </div>
           <ul>
             <li>1) “产品编码”必须是系统中已上线的产品</li>
-            <li>2) 产品类目必须是系统中已存在的最小类目</li>
+            <li>2) 商城类目必须是系统中已存在的商城类目</li>
             <li>3) 售价非必填,若填写,产品售价为导入的售价,售价类型为自定义,若不填写,产品售价为终端价</li>
           </ul>
           <a-button

+ 87 - 24
src/views/easyPassManagement/shoppingProducts/list.vue

@@ -25,6 +25,23 @@
                 <productType id="shoppingProductsList-productType" placeholder="请选择产品分类" @change="changeProductType" v-model="productType"></productType>
               </a-form-item>
             </a-col>
+            <a-col :md="6" :sm="24" v-if="!itemCategorySn">
+              <a-form-item label="商城类目">
+                <a-cascader
+                  id="shoppingProductsList-category"
+                  expandTrigger="hover"
+                  :fieldNames="fieldNames"
+                  :options="categoryOptions"
+                  placeholder="请选择商城类目"
+                  allowClear
+                  v-model="category"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="热销产品">
+                <v-select code="FLAG" id="shoppingProductsList-hotFlag" v-model="queryParam.hotFlag" allowClear placeholder="请选择是否是热销产品"></v-select>
+              </a-form-item>
+            </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="产品商城状态">
                 <v-select code="SHOP_PRODUCT_STATUS" id="shoppingProductsList-status" v-model="queryParam.status" allowClear placeholder="请选择产品商城状态"></v-select>
@@ -43,7 +60,7 @@
       <div class="table-operator">
         <a-button type="primary" id="shoppingProductsList-addProduct-btn" v-if="itemCategorySn" @click="handleChooseProduct">选择产品</a-button>
         <a-button type="primary" v-else id="shoppingProductsList-import-btn" @click="handleAddProduct">产品导入</a-button>
-        <span>
+        <span v-if="productNum&&productNum*1>0">
           <a-button type="primary" id="shoppingProductsList-grounding-btn" class="button-info" @click="changeStatus('1')">批量上架</a-button>
           <a-button @click="changeStatus('0')" id="shoppingProductsList-off-btn">批量下架</a-button>
           <a-button type="primary" class="button-error" id="shoppingProductsList-delProduct-btn" ghost @click="handleDel()">批量删除</a-button>
@@ -70,13 +87,28 @@
           <!-- 产品编码 -->
           <template slot="productCode" slot-scope="text, record">
             <span style="padding-right: 6px;">{{ record.productCode }}</span>
-            <a-badge v-if="record.hotFlag==='1'" count="热" :number-style="{ zoom:'80%' }"></a-badge>
+            <a-badge v-if="record.hotFlag=='1'" count="热" :number-style="{ zoom:'80%' }"></a-badge>
           </template>
           <!-- 产品分类 -->
           <template slot="productType" slot-scope="text, record">
             <span v-if="record.productTypeName2 || record.productTypeName3">{{ record.productTypeName2 }} {{ record.productTypeName3 ? '>' : '' }} {{ record.productTypeName3 }}</span>
             <span v-else>--</span>
           </template>
+          <!-- 商城类目 -->
+          <template slot="categoryName" slot-scope="text, record">
+            <span v-if="record.categoryName1 || record.categoryName2">{{ record.categoryName1 }} {{ record.categoryName2 ? '>' : '' }} {{ record.categoryName2 }}</span>
+            <span v-else>--</span>
+          </template>
+          <!-- 售价类型 -->
+          <template slot="priceType" slot-scope="text, record">
+            <span v-if="record.priceType">{{ record.priceType=='OCS_PRICE'?'终端价':'自定义终端价' }}</span>
+            <span v-else>--</span>
+          </template>
+          <!-- 是否是热销产品 -->
+          <template slot="hotFlag" slot-scope="text, record">
+            <span v-if="record.hotFlag">{{ record.hotFlag=='1'?'是':'否' }}</span>
+            <span v-else>--</span>
+          </template>
           <!-- 操作 -->
           <!-- v-if="$hasPermissions('B_chooseProductEdit_edit')" -->
           <template slot="action" slot-scope="text, record">
@@ -134,7 +166,7 @@ import productType from '@/views/common/productType.js'
 import productBrand from '@/views/common/productBrand.js'
 import chooseProduct from '@/views/easyPassManagement/shoppingManagement/chooseProductsModal'
 // 接口
-import { shopProductList, saveBatchProductExcel, shopProductDel, shopProductUpdateStatus, queryProductSnList, saveBatchProduct } from '@/api/shopProduct'
+import { shopProductList, saveBatchProductExcel, shopProductDel, shopProductUpdateStatus, queryProductSnList, saveBatchProduct, queryExtList } from '@/api/shopProduct'
 export default {
   name: 'ShoppingProductsList',
   mixins: [commonMixin],
@@ -146,7 +178,6 @@ export default {
   },
   components: { STable, VSelect, importGuideModal, editProductModal, productType, productBrand, chooseProduct },
   data () {
-    const _this = this
     return {
       spinning: false,
       disabled: false, //  查询、重置按钮是否可操作
@@ -167,25 +198,13 @@ export default {
         productTypeSn1: '', //  产品一级分类
         productTypeSn2: '', //  产品二级分类
         productTypeSn3: '', //  产品三级分类
-        status: undefined
+        hotFlag: undefined, // 是否是热销产品
+        status: undefined, // 状态
+        categorySn: undefined// 商城类目
       },
-      // 表头
-      columns: [
-        { title: '序号', dataIndex: 'no', align: 'center', width: '60px' },
-        { title: '产品编码', dataIndex: 'productCode', width: '12%', align: 'center', scopedSlots: { customRender: 'productCode' } },
-        { title: '产品名称', dataIndex: 'productName', width: '16%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '原厂编码', dataIndex: 'productOrigCode', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
-        { title: '品牌', dataIndex: 'productBrandName', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
-        { title: '产品分类', align: 'center', width: '15%', scopedSlots: { customRender: 'productType' } },
-        { title: '售价', dataIndex: 'price', width: '7%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
-        { title: '售价类型', dataIndex: 'priceTypeDictValue', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
-        { title: '终端价', dataIndex: 'terminalPrice', width: '7%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
-        { title: '车主价', dataIndex: 'carOwnersPrice', width: '7%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
-        { title: '优先级', dataIndex: 'hotSort', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
-        { title: '添加时间', dataIndex: 'createDate', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
-        { title: '产品商城状态', dataIndex: 'statusDictValue', align: 'center', width: '9%', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '15%', align: 'center' }
-      ],
+      productNum: null, // 列表数据总条数
+      categoryOptions: [], // 产品类目列表
+      category: [], // 类目val
       rowSelectionInfo: null, // 已选数据
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -193,6 +212,8 @@ export default {
         this.spinning = true
         if (this.itemCategorySn) {
           this.queryParam.categorySn = this.itemCategorySn
+        } else {
+          this.queryParam.categorySn = this.category ? this.category.length > 1 ? this.category[1] : this.category[0] : undefined
         }
         return shopProductList(Object.assign(parameter, this.queryParam)).then(res => {
           let data
@@ -203,6 +224,7 @@ export default {
               data.list[i].no = no + i + 1
             }
             this.disabled = false
+            this.productNum = data.count
           }
           this.spinning = false
           return data
@@ -213,6 +235,32 @@ export default {
       itemProductSn: null// 当前行商城产品sn
     }
   },
+  computed: {
+    columns () {
+      const _this = this
+      const arr = [
+        { title: '序号', dataIndex: 'no', align: 'center', width: '60px' },
+        { title: '产品编码', dataIndex: 'productCode', width: '12%', align: 'center', scopedSlots: { customRender: 'productCode' } },
+        { title: '产品名称', dataIndex: 'productName', width: '16%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '原厂编码', dataIndex: 'productOrigCode', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
+        { title: '品牌', dataIndex: 'productBrandName', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
+        { title: '产品分类', align: 'center', width: '15%', scopedSlots: { customRender: 'productType' } },
+        { title: '售价', dataIndex: 'price', width: '7%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
+        { title: '售价类型', dataIndex: 'priceType', scopedSlots: { customRender: 'priceType' }, align: 'center', width: '12%' },
+        { title: '终端价', dataIndex: 'terminalPrice', width: '7%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
+        { title: '车主价', dataIndex: 'carOwnersPrice', width: '7%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
+        { title: '热销产品', dataIndex: 'hotFlag', scopedSlots: { customRender: 'hotFlag' }, align: 'center', width: '7%' },
+        { title: '优先级', dataIndex: 'hotSort', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
+        { title: '添加时间', dataIndex: 'createDate', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
+        { title: '产品商城状态', dataIndex: 'statusDictValue', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '15%', align: 'center' }
+      ]
+      if (!_this.itemCategorySn) {
+        arr.splice(6, 0, { title: '商城类目', scopedSlots: { customRender: 'categoryName' }, width: '15%', align: 'center' })
+      }
+      return arr
+    }
+  },
   methods: {
     // 表格选中项
     rowSelectionFun (obj) {
@@ -242,6 +290,17 @@ export default {
       })
       _this.hanldeOk(newList, 'chooseProduct')
     },
+    // 获取产品类目列表
+    getCategoryList () {
+      const _this = this
+      _this.spinning = true
+      queryExtList({}).then(res => {
+        if (res.status == 200) {
+          this.categoryOptions = res.data || []
+        }
+        _this.spinning = false
+      })
+    },
     // 关闭选择弹窗
     closeProductModal () {
       this.showProModal = false
@@ -273,8 +332,11 @@ export default {
       this.queryParam.productTypeSn1 = ''
       this.queryParam.productTypeSn2 = ''
       this.queryParam.productTypeSn3 = ''
-      this.queryParam.status = ''
+      this.queryParam.hotFlag = undefined
+      this.queryParam.status = undefined
+      this.queryParam.categorySn = undefined
       this.productType = []
+      this.category = []
       this.$refs.table.refresh(true)
     },
     // 编辑
@@ -303,7 +365,7 @@ export default {
         shopProductSnList = _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys ? _this.rowSelectionInfo.selectedRowKeys : []
       }
       if (shopProductSnList && shopProductSnList.length == 0) {
-        this.$message.warning('请在列表中进行勾选!')
+        this.$message.warning('请在列表中勾选产品!')
         return
       }
       this.confirmDel(shopProductSnList)
@@ -365,6 +427,7 @@ export default {
     // 初始化
     pageInit () {
       const _this = this
+      this.getCategoryList()
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })