chenrui 9 ماه پیش
والد
کامیت
ce27c2f09b
2فایلهای تغییر یافته به همراه154 افزوده شده و 107 حذف شده
  1. 39 0
      src/api/shopProduct.js
  2. 115 107
      src/views/numsGoodsShelves/easyPassShopping/index.vue

+ 39 - 0
src/api/shopProduct.js

@@ -0,0 +1,39 @@
+import { axios } from '@/utils/request'
+
+//  仓库列表  有分页
+export const shopProductList = (params) => {
+  const url = `/shopProduct/queryProductPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('列表查询')
+    }
+  })
+}
+
+// 获取商城状态
+export const findMallParam = (params) => {
+  return axios({
+    url: '/dealerBizParam/findMallParam ',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('获取商城状态')
+    }
+  })
+}
+// 修改商城状态
+export const updateMallParam = (params) => {
+  return axios({
+    url: '/dealerBizParam/updateMallParam',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('修改商城状态')
+    }
+  })
+}

+ 115 - 107
src/views/numsGoodsShelves/easyPassShopping/index.vue

@@ -3,41 +3,61 @@
     <a-spin :spinning="spinning" tip="Loading...">
       <!-- 操作按钮 -->
       <div class="table-operator">
-        <a-button type="primary" icon="unlock" :loading="iconLoading" @click="enterIconLoading">
+        <a-button
+          type="primary"
+          class="button-info"
+          v-if="shoppingMallStatus=='0'"
+          icon="unlock"
+          id="easyPassShopping-open-btn"
+          :loading="iconLoading"
+          @click="editShoppingStatus('1')">
           打开商城
         </a-button>
-        <a-button type="primary" class="button-info" icon="poweroff" :loading="iconLoading" @click="enterIconLoading">
+        <a-button
+          type="primary"
+          v-else
+          icon="poweroff"
+          id="easyPassShopping-close-btn"
+          :loading="iconLoading"
+          @click="editShoppingStatus('0')">
           关闭商城
         </a-button>
+        <div style="margin:10px 0;color:gray;">开启商城后,易码通会显示商城</div>
       </div>
       <!-- 搜索条件 -->
       <div ref="tableSearch" class="table-page-search-wrapper">
-        <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+        <a-form layout="inline" id="easyPassShopping-form" @keyup.enter.native="$refs.table.refresh(true)">
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
-              <a-form-item label="产品名称"><a-input id="productInfoList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称" /></a-form-item>
+              <a-form-item label="产品名称"><a-input id="easyPassShopping-name" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称" /></a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-item label="产品编码/原厂编码"><a-input id="productInfoList-code" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码" /></a-form-item>
+              <a-form-item label="产品编码/原厂编码"><a-input id="easyPassShopping-code" v-model.trim="queryParam.queryWord" allowClear placeholder="请输入产品编码/原厂编码" /></a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-item label="产品牌">
-                <productBrand id="productInfoList-productBrandSn" placeholder="请选择产品品牌" v-model="queryParam.productBrandSn"></productBrand>
+              <a-form-item label="产品牌">
+                <productBrand id="easyPassShopping-productBrandSn" placeholder="请选择产品品牌" v-model="queryParam.productBrandSn"></productBrand>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="产品分类">
-                <productType id="productInfoList-productType" placeholder="请选择产品分类" :isDealer="true" @change="changeProductType" v-model="productType"></productType>
+                <productType id="easyPassShopping-productType" placeholder="请选择产品分类" :isDealer="true" @change="changeProductType" v-model="productType"></productType>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="商城类目">
-                <v-select code="ENABLE_FLAG" id="productInfoList-enabledFlag" v-model="queryParam.enabledFlag" allowClear placeholder="请选择商城类目"></v-select>
+                <v-select
+                  code="ENABLE_FLAG"
+                  id="easyPassShopping-category"
+                  v-model="category"
+                  @change="changeCategory"
+                  allowClear
+                  placeholder="请选择商城类目"></v-select>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="产品商城状态">
-                <v-select code="ENABLE_FLAG" id="productInfoList-enabledFlag" v-model="queryParam.enabledFlag" allowClear placeholder="请选择产品商城状态"></v-select>
+                <v-select code="SHOP_PRODUCT_STATUS" id="easyPassShopping-status" v-model="queryParam.status" allowClear placeholder="请选择产品商城状态"></v-select>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24" style="margin-bottom: 10px">
@@ -59,86 +79,84 @@
         :scroll="{ y: tableHeight }"
         :defaultLoadData="false"
         bordered>
-        <!-- 模板名称 -->
-        <template slot="templateName" slot-scope="text, record">
-          <span class="table-td-link" id="easyPassShopping-links" @click="handleDetail(record)">{{ record.templateName }}</span>
+        <!-- 产品分类 -->
+        <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="action" slot-scope="text, record">
-          <div>
-            <a-button
-              id="easyPassShopping-edit"
-              size="small"
-              v-if="record.sysFlag==0"
-              type="link"
-              class="button-primary"
-              @click="addTemp(record)">更改名称</a-button>
-            <a-button
-              v-if="orgData.length<20"
-              id="easyPassShopping-copy"
-              size="small"
-              type="link"
-              class="button-primary"
-              @click="handleCopy(record)">复制</a-button>
-            <a-button
-              id="easyPassShopping-del"
-              size="small"
-              v-if="record.sysFlag==0"
-              type="link"
-              class="button-error"
-              @click="handleCancel(record)">删除</a-button>
-          </div>
+        <!-- 商城类目 -->
+        <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">
+          {{ record.priceType&&record.priceType==='OCS_PRICE'?'终端价':'自定义终端价' }}
         </template>
       </s-table>
     </a-spin>
-    <!-- 基础设置弹框 -->
-    <basic-info-modal :openModal="openModal" :nowData="nowData" @ok="saveOk" @close="openModal=false" />
   </a-card>
 </template>
 
 <script>
 import { commonMixin } from '@/utils/mixin'
+// 组件
 import { STable, VSelect } from '@/components'
-import commonModal from '@/views/common/commonModal.vue'
 import productType from '@/views/common/productType.js'
 import productBrand from '@/views/common/productBrand.js'
-import { shelfTemplateList, shelfTemplateCopy, shelfTemplateDel } from '@/api/shelfTemplate'
+// 接口
+import { shopProductList, findMallParam, updateMallParam } from '@/api/shopProduct'
 export default {
   name: 'ShelfProductTemplList',
-  components: { STable, VSelect, commonModal, productType, productBrand },
+  components: { STable, VSelect, productType, productBrand },
   mixins: [commonMixin],
   data () {
+    const _this = this
     return {
       spinning: false,
-      tableHeight: 0,
+      iconLoading: false, // 打开关闭商城按钮状态
+      tableHeight: 0, // 表格高度
       disabled: false, //  查询、重置按钮是否可操作
+      //  查询条件
       queryParam: {
-        templateName: '', // 模板名称
-        sysFlag: undefined // 模板类型
+        productName: '', //  产品名称
+        queryWord: '', //  产品编码/原厂编码
+        productBrandSn: undefined, //  产品品牌
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '', //  产品三级分类
+        status: undefined, //  状态
+        categorysn1: undefined, // 产品一级类目
+        categorysn2: undefined// 产品二级类目
       },
+      productType: [], // 产品分类
+      category: [], // 产品类目
+      shoppingMallStatus: '0', // 商城状态1:开启   0 关闭
+      // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '产品编码', dataIndex: 'code', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'name', width: '13%', align: 'left', ellipsis: true, customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '13%', align: 'left', ellipsis: true, customRender: function (text) { return text || '--' } },
         { title: '原厂编码', dataIndex: 'origCode', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品品牌', dataIndex: 'productBrandName', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '9%', align: 'center' },
-        { title: '商城类目', dataIndex: 'productBrandName', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '商城类目', scopedSlots: { customRender: 'categoryName' }, width: '9%', align: 'center' },
         { title: '自定义终端价', dataIndex: 'terminalPrice', width: '10%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
-        { title: '商城价', dataIndex: 'carOwnersPrice', width: '6%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
+        { title: '商城价', dataIndex: 'ocsPrice', width: '6%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
         { title: '车主价', dataIndex: 'carOwnersPrice', width: '6%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
-        { title: '售价', dataIndex: 'carOwnersPrice', width: '6%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
-        { title: '售价类型', dataIndex: 'createDate', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品商城状态', dataIndex: 'status', width: '7%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '售价', dataIndex: 'price', width: '6%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
+        { title: '售价类型', scopedSlots: { customRender: 'priceType' }, width: '7%', align: 'center' },
+        { title: '产品商城状态', dataIndex: 'statusDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        return shelfTemplateList(Object.assign(parameter, this.queryParam)).then(res => {
+        return shopProductList(Object.assign(parameter, this.queryParam)).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
@@ -146,88 +164,78 @@ export default {
             this.disabled = false
           }
           this.spinning = false
-          this.orgData = data.list
           return data
         })
-      },
-      orgData: [], // 原始列表数据
-      openModal: false, // 打开新增编辑弹框
-      nowData: null // 当前操作数据
+      }
     }
   },
   methods: {
-    // 新增/修改模板
-    addTemp (row) {
-      this.nowData = row || {}
-      this.openModal = true
+    //  产品分类  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] : ''
+    },
+    // 产品类目 change
+    changeCategory (val) {
+      this.queryParam.categorysn1 = val[0] ? val[0] : ''
+      this.queryParam.categorysn2 = val[1] ? val[1] : ''
     },
-    // 模板详情设置
-    handleDetail (data) {
-      this.$router.push({ name: 'shelfProductTemplSetting', params: { sn: data.templateSn } })
+    // 重置
+    resetSearchForm () {
+      this.queryParam.productName = ''
+      this.queryParam.queryWord = ''
+      this.queryParam.productBrandSn = undefined
+      this.queryParam.productTypeSn1 = undefined
+      this.queryParam.productTypeSn2 = undefined
+      this.queryParam.productTypeSn3 = undefined
+      this.queryParam.status = undefined
+      this.queryParam.categorysn1 = undefined
+      this.queryParam.categorysn2 = undefined
+      this.$refs.table.refresh(true)
     },
-    // 复制模板 确认开启吗,开启后修理厂可在易码通查看商城
-    handleCopy (record) {
+    // 获取初始商城打开、关闭状态
+    getShoppingStatus () {
       const _this = this
-      this.$confirm({
-        title: '关闭商城',
-        content: '确认关闭吗,关闭后修理厂在易码通无法查看商城',
-        centered: true,
-        closable: true,
-        onOk () {
-          _this.spinning = true
-          shelfTemplateCopy({
-            templateSn: record.templateSn
-          }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.resetSearchForm()
-            }
-            _this.spinning = false
-          })
+      _this.spinning = true
+      findMallParam({}).then(res => {
+        if (res.status == 200) {
+          this.shoppingMallStatus = res.data.paramValue || '0'
         }
+        _this.spinning = false
       })
     },
-    // 删除模板
-    handleCancel (record) {
+    // 修改商城状态
+    editShoppingStatus (typeVal) {
       const _this = this
       this.$confirm({
-        title: '提示',
-        content: '删除模板后,模板信息将全部清除,是否确认删除?',
+        title: (typeVal == '0' ? '关闭' : '开启') + '商城',
+        content: '确认' + (typeVal == '0' ? '关闭' : '开启') + '吗,' + (typeVal == '0' ? '关闭' : '开启') + '后修理厂' + (typeVal == '0' ? '不可' : '可') + '在易码通查看商城',
         centered: true,
-        closable: true,
+        okText: (typeVal == '0' ? '关闭商城' : '开启商城'),
         onOk () {
-          _this.spinning = true
-          shelfTemplateDel({
-            templateSn: record.templateSn
-          }).then(res => {
+          _this.iconLoading = true
+          updateMallParam({ paramValue: typeVal }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
-              _this.$refs.table.refresh()
+              _this.shoppingMallStatus = typeVal
+              _this.iconLoading = false
+            } else {
+              _this.iconLoading = false
             }
-            _this.spinning = false
           })
         }
       })
     },
-    // 保存成功
-    saveOk () {
-      this.$refs.table.refresh(true)
-      this.openModal = false
-    },
-    // 重置
-    resetSearchForm () {
-      this.queryParam.templateName = ''
-      this.queryParam.sysFlag = undefined
-      this.$refs.table.refresh(true)
-    },
     // 表格高度
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 240
+      this.tableHeight = window.innerHeight - tableSearchH - 280
     },
     // 初始化页面
     pageInit () {
       const _this = this
+      this.getShoppingStatus()
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })