chenrui 8 miesięcy temu
rodzic
commit
e5d78bd331

+ 9 - 0
src/api/shopBanner.js

@@ -69,3 +69,12 @@ export const shopBannerExport = params => {
     }
   })
 }
+
+// 促销活动  设置轮播图
+export const updateSetShopBanner = (params) => {
+  return axios({
+    url: '/shopBanner/queryByBizSn',
+    data: params,
+    method: 'post'
+  })
+}

+ 25 - 0
src/config/router.config.js

@@ -3685,6 +3685,31 @@ export const asyncRouterMap = [
               }
             ]
           },
+          {
+            path: '/easyPassManagement/promotionalProducts',
+            redirect: '/easyPassManagement/promotionalProducts/list',
+            name: 'promotionalProducts',
+            component: BlankLayout,
+            meta: {
+              title: '促销产品',
+              icon: 'file-ppt'
+              // permission: 'M_promotionalProducts'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'promoProductList',
+                component: () => import(/* webpackChunkName: "easyPassManagement" */ '@/views/easyPassManagement/promotionalProducts/list.vue'),
+                meta: {
+                  title: '促销产品列表',
+                  icon: 'file-ppt',
+                  hidden: true
+                  // permission: 'M_promoProductList'
+                }
+              }
+            ]
+          },
           {
             path: '/easyPassManagement/homepageCarouselImg',
             redirect: '/easyPassManagement/homepageCarouselImg/list',

+ 34 - 4
src/views/easyPassManagement/promotionalActivities/list.vue

@@ -150,12 +150,14 @@
           <a-icon type="question-circle" :style="{fontSize:'20px',color:'#faad14'}"/>
           <div style="margin-left:10px;margin-top:-3px;">
             <p style="font-size:16px;font-wight:bold;">设置</p>
-            <p>确定设为首页轮播图吗?</p>
+            <p v-if="itemFlag=='1'">确定设为首页轮播图吗?</p>
+            <p v-else>已有轮播图,不可再次生成</p>
           </div>
         </div>
         <!-- 按钮 -->
         <div style="text-align: right;">
           <a-button
+            v-if="itemFlag=='1'"
             id="auditModal-cancel"
             type="primary"
             @click="handleSetModal('0')"
@@ -165,7 +167,14 @@
             id="auditModal-save"
             class="button-info"
             @click="handleSetModal('1')"
+            v-if="itemFlag=='1'"
           >确定</a-button>
+          <a-button
+            v-else
+            type="primary"
+            id="auditModal-close"
+            @click="handleSetModal('0')"
+          >知道了</a-button>
         </div>
       </a-modal>
     </a-card>
@@ -181,6 +190,7 @@ import lookUpCustomersModal from './lookUpCustomersModal'
 import detailModal from './detailModal'
 // 接口
 import { shopPromoActiveList, shopPromoDel, shopPromoRelease, shopPromoDiscard, updateShopBanner } from '@/api/shopPromo'
+import { updateSetShopBanner } from '@/api/shopBanner'
 
 export default {
   name: 'PromotionalActivitiesList',
@@ -205,6 +215,7 @@ export default {
       },
       itemId: '', // 当前活动sn
       itemObj: null, // 促销活动当前行信息
+      itemFlag: null, // 设置轮播图显示弹窗按钮
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
@@ -233,7 +244,7 @@ export default {
         { title: '参与经销商', scopedSlots: { customRender: 'joinCustomers' }, width: '8%', align: 'center' },
         { title: '促销类型', dataIndex: 'promoTypeDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '加盟商编辑', dataIndex: 'dealerEditFlag', width: '6%', align: 'center', customRender: function (text) { return (text ? text == '1' ? '是' : '否' : '--') } },
-        { title: '首页轮播图', dataIndex: 'shopBannerFlag', width: '6%', align: 'center', customRender: function (text) { return (text ? text == '1' ? '是' : '否' : '--') } },
+        // { title: '首页轮播图', dataIndex: 'shopBannerFlag', width: '6%', align: 'center', customRender: function (text) { return (text ? text == '1' ? '是' : '否' : '--') } },
         { title: '促销状态', dataIndex: 'promoStateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '11%', align: 'center' }
       ]
@@ -337,13 +348,32 @@ export default {
     // 打开 设置轮播图弹窗
     handleSet (row) {
       this.itemObj = row
-      this.openSetImgModal = true
+      this.spinning = true
+      updateSetShopBanner({ bizSn: row.promoSn, stateList: ['UNPUBLISH', 'PUBLISH'] }).then(res => {
+        if (res.status == 200) {
+          this.itemFlag = res.data && Object.keys(res.data).length > 0 ? '0' : '1'
+          this.openSetImgModal = true
+          this.spinning = false
+        } else {
+          this.spinning = false
+        }
+      })
     },
     // 设置轮播图
     handleSetModal (val) {
+      const _this = this
+      _this.itemFlag = null
+      if (val === '1') {
+        _this.setImage()
+      } else {
+        _this.openSetImgModal = false
+      }
+    },
+    // 设置轮播图
+    setImage (val) {
       const _this = this
       _this.spinning = true
-      updateShopBanner({ promoSn: _this.itemObj.promoSn, shopBannerFlag: val }).then(res => {
+      updateShopBanner({ promoSn: _this.itemObj.promoSn, shopBannerFlag: 1 }).then(res => {
         if (res.status == 200) {
           _this.$message.success(res.message)
           _this.$refs.table.refresh()

+ 313 - 0
src/views/easyPassManagement/promotionalProducts/list.vue

@@ -0,0 +1,313 @@
+<template>
+  <div>
+    <a-card size="small" :bordered="false" class="promoProducts-wrap searchBoxNormal">
+      <!-- 搜索条件 -->
+      <div ref="tableSearch" class="table-page-search-wrapper">
+        <a-form layout="inline" id="promoProducts-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="promoProducts-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码/原厂编码"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="产品名称">
+                <a-input id="promoProducts-name" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="品牌">
+                <productBrand id="promoProducts-productBrandSn" v-model="queryParam.productBrandSn"></productBrand>
+              </a-form-item>
+            </a-col>
+            <template v-if="advanced">
+              <a-col :md="6" :sm="24">
+                <a-form-item label="产品分类">
+                  <productType id="promoProducts-productType" placeholder="请选择产品分类" @change="changeProductType" v-model="productType"></productType>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="促销名称">
+                  <a-input id="promoProducts-promoName" v-model.trim="queryParam.promoName" allowClear placeholder="请输入促销名称"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="促销类型">
+                  <v-select
+                    v-model="queryParam.promoType"
+                    ref="promotionType"
+                    id="promoProducts-promoType"
+                    code="SHOP_PROMO_PROMO_TYPE"
+                    placeholder="请选择促销类型"
+                    allowClear></v-select>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="促销状态">
+                  <v-select
+                    v-model="queryParam.promoState"
+                    ref="promoState"
+                    id="promoProducts-promoState"
+                    code="SHOP_PROMO_PROMO_STATE"
+                    placeholder="请选择促销状态"
+                    allowClear></v-select>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24" v-if="!itemCategorySn">
+                <a-form-item label="商城类目">
+                  <a-cascader
+                    id="promoProducts-category"
+                    expandTrigger="hover"
+                    :changeOnSelect="true"
+                    :fieldNames="fieldNames"
+                    :options="categoryOptions"
+                    placeholder="请选择商城类目"
+                    @change="changeProductsCategory"
+                    allowClear
+                    v-model="category"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="商城状态">
+                  <v-select code="SHOP_PRODUCT_STATUS" id="promoProducts-status" v-model="queryParam.status" allowClear placeholder="请选择商城状态"></v-select>
+                </a-form-item>
+              </a-col>
+            </template>
+            <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="promoProducts-refresh">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="promoProducts-reset">重置</a-button>
+              <a @click="advanced=!advanced" style="margin-left: 5px" id="merchantInfoManagementList-advanced">
+                {{ advanced ? '收起' : '展开' }}
+                <a-icon :type="advanced ? 'up' : 'down'"/>
+              </a>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+    </a-card>
+    <a-card size="small" :bordered="false">
+      <a-spin :spinning="spinning" tip="Loading...">
+        <!-- 列表 -->
+        <s-table
+          class="sTable fixPagination"
+          ref="table"
+          :style="{ height: tableHeight+70+'px' }"
+          size="small"
+          :rowKey="(record) => record.shopProductSn"
+          rowKeyName="shopProductSn"
+          :columns="columns"
+          :data="loadData"
+          :pageSize="20"
+          :scroll="{ y: tableHeight }"
+          :defaultLoadData="false"
+          bordered>
+          <!-- 产品编码 -->
+          <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>
+          </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.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=='TERMINAL_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>
+        </s-table>
+      </a-spin>
+    </a-card>
+  </div>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+// 组件
+import { STable, VSelect } from '@/components'
+import productType from '@/views/common/productType.js'
+import productBrand from '@/views/common/productBrand.js'
+import chooseProduct from '@/views/easyPassManagement/shoppingManagement/chooseProductsModal'
+// 接口
+import { shopProductList, queryExtList } from '@/api/shopProduct'
+export default {
+  name: 'PromoProductsList',
+  mixins: [commonMixin],
+  components: { STable, VSelect, productType, productBrand, chooseProduct },
+  data () {
+    return {
+      spinning: false,
+      advanced: true, // 高级搜索 展开/关闭
+      disabled: false, //  查询、重置按钮是否可操作
+      tableHeight: 0, // 表格高度
+      // form表单label布局
+      formItemLayout: {
+        labelCol: { span: 6 },
+        wrapperCol: { span: 16 }
+      },
+      showProModal: false, // 打开添加产品弹窗
+      productType: [], // 产品分类
+      chooseDataList: [], // 已选产品sn集合
+      // 查询条件
+      queryParam: {
+        productName: '', // 产品名称
+        productCode: '', // 产品编码/原厂编码
+        productBrandSn: undefined, //  产品品牌
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '', //  产品三级分类
+        hotFlag: undefined, // 是否是热销产品
+        status: undefined, // 状态
+        categorySn1: undefined, // 商城一级类目
+        categorySn2: undefined// 商城二级类目
+      },
+      productNum: null, // 列表数据总条数
+      categoryOptions: [], // 产品类目列表
+      fieldNames: { label: 'categoryName', value: 'categorySn', children: 'shopCategoryList' },
+      category: [], // 类目val
+      rowSelectionInfo: null, // 已选数据
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        if (this.itemCategorySn) {
+          this.queryParam.categorySn = this.itemCategorySn
+        }
+        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
+            }
+            this.disabled = false
+            this.productNum = data.count
+          }
+          this.spinning = false
+          return data
+        })
+      }
+    }
+  },
+  computed: {
+    columns () {
+      const _this = this
+      const arr = [
+        { title: '序号', dataIndex: 'no', align: 'center', width: '50px' },
+        { title: '产品编码', dataIndex: 'productCode', width: '12%', align: 'center', scopedSlots: { customRender: 'productCode' } },
+        { title: '产品名称', dataIndex: 'productName', width: '22%', 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: 'productName', width: '22%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '促销时间', dataIndex: 'createDate', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
+        { title: '促销类型', dataIndex: 'priceType', scopedSlots: { customRender: 'priceType' }, align: 'center', width: '10%' },
+        { title: '活动规则', dataIndex: 'hotSort', align: 'center', width: '7%', customRender: function (text) { return (text || text == 0) ? text : '--' } },
+        { title: '促销状态', dataIndex: 'createDate', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
+        { title: '促销售价', dataIndex: 'price', width: '7%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
+        { title: '商城类目', scopedSlots: { customRender: 'categoryName' }, width: '15%', align: 'center' },
+        { title: '商城状态', dataIndex: 'statusDictValue', align: 'center', width: '6%', customRender: function (text) { return text || '--' } }
+      ]
+      return arr
+    }
+  },
+  methods: {
+    // 获取产品类目列表
+    getCategoryList () {
+      const _this = this
+      _this.spinning = true
+      queryExtList({}).then(res => {
+        if (res.status == 200) {
+          this.categoryOptions = res.data || []
+        }
+        _this.spinning = false
+      })
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam.productName = ''
+      this.queryParam.productCode = ''
+      this.queryParam.productBrandSn = undefined
+      this.queryParam.productTypeSn1 = ''
+      this.queryParam.productTypeSn2 = ''
+      this.queryParam.productTypeSn3 = ''
+      this.queryParam.hotFlag = undefined
+      this.queryParam.status = undefined
+      this.queryParam.categorySn1 = undefined
+      this.queryParam.categorySn2 = undefined
+      this.productType = []
+      this.category = []
+      this.$refs.table.refresh(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] : ''
+    },
+    // 商城类目
+    changeProductsCategory (val) {
+      this.queryParam.categorySn1 = val[0] ? val[0] : undefined
+      this.queryParam.categorySn2 = val[1] ? val[1] : undefined
+    },
+    // 初始化
+    pageInit () {
+      const _this = this
+      if (!_this.itemCategorySn) {
+        _this.getCategoryList()
+      }
+      _this.closeProductModal()
+      _this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    // 计算表格高度
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 200
+    }
+  },
+  watch: {
+    // 展开关闭  监听表格高度变化
+    advanced (newValue, oldValue) {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+      this.resetSearchForm()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+      this.resetSearchForm()
+    }
+    // 仅刷新列表,不重置页面
+    if (this.$store.state.app.updateList) {
+      this.pageInit()
+      this.$refs.table.refresh(true)
+    }
+  }
+}
+</script>