فهرست منبع

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

lilei 8 ماه پیش
والد
کامیت
9b435d7cf6

+ 16 - 0
src/api/shopPromoProduct.js

@@ -0,0 +1,16 @@
+import { axios } from '@/utils/request'
+
+// 促销活动  有分页
+export const shopPromoProductList = (params) => {
+  const url = `/shopPromoProduct/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('列表查询')
+    }
+  })
+}

+ 9 - 5
src/views/easyPassManagement/promotionalActivities/edit.vue

@@ -116,7 +116,6 @@
                   id="promotion-dealerOpenFlag"
                   code="FLAG"
                   showType="radio"
-                  :disabled="true"
                   allowClear></v-select>
               </a-form-model-item>
             </a-col>
@@ -457,13 +456,16 @@ export default {
     // 添加产品成功
     addProductSuccess (list) {
       const productArr = list.map(item => {
-        return {
+        const obj = {
           promoSn: this.form.promoSn,
           shopProductSn: item.shopProductSn,
           productSn: item.productSn,
-          productCode: item.productCode,
-          conditionValue: item.conditionValue ? item.conditionValue : item.shopProductPrice
+          productCode: item.productCode
         }
+        if (this.pageType === 'PROMO_PROD') {
+          obj.conditionValue = item.conditionValue ? item.conditionValue : item.shopProductPrice
+        }
+        return obj
       })
       saveChooseProduct(productArr).then(res => {
         if (res.status == 200) {
@@ -472,10 +474,12 @@ export default {
             // 获取产品列表 有分页
             this.$refs.chooseProductList.pageInit()
           } else {
+            const tipArr = res.data ? res.data.split(';') : []
+            const newTipArr = tipArr.filter(item => { return item != '' })
             const _this = this
             this.$confirm({
               title: '提示',
-              content: res.data,
+              content: newTipArr.map((item, i) => { return <p>{i * 1 + 1}、{item}</p> }),
               centered: true,
               okText: '知道了',
               cancelText: '取消', // 将cancelText设置为空字符串或去掉该属性可以隐藏取消按钮

+ 3 - 3
src/views/easyPassManagement/promotionalActivities/list.vue

@@ -243,7 +243,7 @@ export default {
         { title: '促销时间', scopedSlots: { customRender: 'promotionTime' }, width: '18%', align: 'center' },
         { 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: 'dealerOpenFlag', width: '8%', 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' }
@@ -322,6 +322,7 @@ export default {
       this.queryParam.promoName = ''
       this.queryParam.promoType = undefined
       this.queryParam.promoState = undefined
+      this.itemFlag = null
       this.$refs.table.refresh(true)
     },
     // 促销发布
@@ -349,7 +350,7 @@ export default {
     handleSet (row) {
       this.itemObj = row
       this.spinning = true
-      updateSetShopBanner({ bizSn: row.promoSn, stateList: ['UNPUBLISH', 'PUBLISH'] }).then(res => {
+      updateSetShopBanner({ bizSn: row.promoSn, stateList: ['UNPUBLISH', 'PUBLISH', 'CLOSE'] }).then(res => {
         if (res.status == 200) {
           this.itemFlag = res.data && Object.keys(res.data).length > 0 ? '0' : '1'
           this.openSetImgModal = true
@@ -362,7 +363,6 @@ export default {
     // 设置轮播图
     handleSetModal (val) {
       const _this = this
-      _this.itemFlag = null
       if (val === '1') {
         _this.setImage()
       } else {

+ 2 - 0
src/views/easyPassManagement/promotionalActivities/productTable.vue

@@ -21,6 +21,7 @@
             :step="1"
             :precision="0"
             :max="99999999"
+            style="width:90%;"
             @blur="editProductVal(record,'conditionValue')"
             placeholder="请输入"
             v-model="record.conditionValue"
@@ -129,6 +130,7 @@ export default {
             const no = (data.pageNo - 1) * data.pageSize
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
+              console.log('11111111:', this.activeType)
               if (this.activeType === 'PROMO_PROD') {
                 data.list[i].conditionValue = data.list[i].conditionValue ? data.list[i].conditionValue : data.list[i].shopProductPrice
               }

+ 64 - 64
src/views/easyPassManagement/promotionalProducts/list.vue

@@ -48,12 +48,13 @@
                     v-model="queryParam.promoState"
                     ref="promoState"
                     id="promoProducts-promoState"
+                    :notIn="['HAVE_DISCARD','IS_OVER']"
                     code="SHOP_PROMO_PROMO_STATE"
                     placeholder="请选择促销状态"
                     allowClear></v-select>
                 </a-form-item>
               </a-col>
-              <a-col :md="6" :sm="24" v-if="!itemCategorySn">
+              <a-col :md="6" :sm="24">
                 <a-form-item label="商城类目">
                   <a-cascader
                     id="promoProducts-category"
@@ -69,7 +70,7 @@
               </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>
+                  <v-select code="SHOP_PRODUCT_STATUS" id="promoProducts-status" v-model="queryParam.shopProductStatus" allowClear placeholder="请选择商城状态"></v-select>
                 </a-form-item>
               </a-col>
             </template>
@@ -93,37 +94,47 @@
           ref="table"
           :style="{ height: tableHeight+70+'px' }"
           size="small"
-          :rowKey="(record) => record.shopProductSn"
-          rowKeyName="shopProductSn"
+          :rowKey="(record) => record.id"
           :columns="columns"
           :data="loadData"
           :pageSize="20"
-          :scroll="{ y: tableHeight }"
+          :scroll="{ y: tableHeight - 20 }"
           :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>
+            {{ record.productCode }}
           </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>
+          <!-- 促销时间 -->
+          <template slot="promoTime" slot-scope="text, record">
+            <span v-if="record.promoStartDate">{{ record.promoStartDate }} 至 {{ record.promoEndDate }}</span>
             <span v-else>--</span>
           </template>
-          <!-- 售价类型 -->
-          <template slot="priceType" slot-scope="text, record">
-            <span v-if="record.priceType">{{ record.priceType=='TERMINAL_PRICE'?'终端价':'自定义' }}</span>
+          <!-- 活动规则 -->
+          <template slot="promoRules" slot-scope="text, record">
+            <span v-if="record.promoType==='BUY_PROD_GIVE_PROD'&&record.conditionValue&&record.resultValue">买{{ record.conditionValue }}赠{{ record.resultValue }}</span>
+            <div v-else-if="record.promoType==='PROMO_PROD'&&(record.shopProductPrice||record.shopProductPrice ==0)&&(record.conditionValue||record.conditionValue==0)">
+              <span v-if="record.shopProductPrice - record.conditionValue>0">优惠{{ (record.shopProductPrice - record.conditionValue).toFixed(2) }}元</span>
+              <span v-else style="color:#ED1C24;">优惠{{ (record.shopProductPrice - record.conditionValue).toFixed(2) }}元</span>
+            </div>
+            <span v-else-if="record.promoType==='BUY_PROD_GIVE_VALID'&&record.resultValue">返{{ record.resultValue ? record.resultValue.toFixed(2):'--' }}元</span>
             <span v-else>--</span>
           </template>
-          <!-- 是否是热销产品 -->
-          <template slot="hotFlag" slot-scope="text, record">
-            <span v-if="record.hotFlag">{{ record.hotFlag=='1'?'是':'否' }}</span>
+          <!-- 促销售价 -->
+          <template slot="promoPrice" slot-scope="text, record">
+            <span v-if="record.promoType==='BUY_PROD_GIVE_PROD'&&record.shopProductPrice">{{ record.shopProductPrice ?record.shopProductPrice.toFixed(2):'--' }}</span>
+            <span v-else-if="record.promoType==='PROMO_PROD'&&record.conditionValue">{{ record.conditionValue?record.conditionValue.toFixed(2):'--' }}</span>
+            <span v-else-if="record.promoType==='BUY_PROD_GIVE_VALID'&&record.shopProductPrice">{{ record.shopProductPrice?record.shopProductPrice.toFixed(2):'--' }}</span>
+            <span v-else>--</span>
+          </template>
+          <!-- 商城类目 -->
+          <template slot="categoryName" slot-scope="text, record">
+            <span v-if="record.indName || record.dirName">{{ record.indName }} {{ (record.indName&&record.dirName) ? '>' : '' }} {{ record.dirName }}</span>
             <span v-else>--</span>
           </template>
         </s-table>
@@ -138,13 +149,13 @@ 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'
+import { shopPromoProductList } from '@/api/shopPromoProduct'
+import { queryExtList } from '@/api/shopProduct'
 export default {
   name: 'PromoProductsList',
   mixins: [commonMixin],
-  components: { STable, VSelect, productType, productBrand, chooseProduct },
+  components: { STable, VSelect, productType, productBrand },
   data () {
     return {
       spinning: false,
@@ -156,9 +167,7 @@ export default {
         labelCol: { span: 6 },
         wrapperCol: { span: 16 }
       },
-      showProModal: false, // 打开添加产品弹窗
       productType: [], // 产品分类
-      chooseDataList: [], // 已选产品sn集合
       // 查询条件
       queryParam: {
         productName: '', // 产品名称
@@ -167,24 +176,39 @@ export default {
         productTypeSn1: '', //  产品一级分类
         productTypeSn2: '', //  产品二级分类
         productTypeSn3: '', //  产品三级分类
-        hotFlag: undefined, // 是否是热销产品
-        status: undefined, // 状态
-        categorySn1: undefined, // 商城一级类目
-        categorySn2: undefined// 商城二级类目
+        promoName: '', // 促销名称
+        promoType: undefined, // 促销状态
+        promoState: undefined, // 促销状态
+        categorySn: undefined, // 商城类目
+        shopProductStatus: undefined, // 商城状态
+        shopProductDelFlag: 0, // 促销产品标志
+        promoStateList: ['NOT_RELEASE', 'HAVE_RELEASE']// 促销列表只查询这两种状态
       },
-      productNum: null, // 列表数据总条数
       categoryOptions: [], // 产品类目列表
       fieldNames: { label: 'categoryName', value: 'categorySn', children: 'shopCategoryList' },
       category: [], // 类目val
-      rowSelectionInfo: null, // 已选数据
+      columns: [
+        { title: '序号', dataIndex: 'no', align: 'center', width: '50px' },
+        { title: '产品编码', dataIndex: 'productCode', width: '10%', 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: 'promoName', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '促销时间', dataIndex: 'promoStartDate', align: 'center', width: '16%', scopedSlots: { customRender: 'promoTime' } },
+        { title: '促销类型', dataIndex: 'promoTypeDictValue', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
+        { title: '活动规则', align: 'center', width: '10%', scopedSlots: { customRender: 'promoRules' } },
+        { title: '促销状态', dataIndex: 'promoStateDictValue', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
+        { title: '促销售价', width: '8%', align: 'right', scopedSlots: { customRender: 'promoPrice' } },
+        { title: '商城类目', scopedSlots: { customRender: 'categoryName' }, width: '15%', align: 'center' },
+        { title: '商城状态', dataIndex: 'shopProductStatusDictValue', align: 'center', width: '8%', customRender: function (text) { return text || '--' } }
+      ],
       // 加载数据方法 必须为 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 => {
+        const params = Object.assign(parameter, this.queryParam)
+        return shopPromoProductList(params).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -193,7 +217,6 @@ export default {
               data.list[i].no = no + i + 1
             }
             this.disabled = false
-            this.productNum = data.count
           }
           this.spinning = false
           return data
@@ -201,28 +224,6 @@ export default {
       }
     }
   },
-  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 () {
@@ -243,10 +244,13 @@ export default {
       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.queryParam.promoName = ''
+      this.queryParam.promoType = undefined
+      this.queryParam.promoState = undefined
+      this.queryParam.shopProductStatus = undefined
+      this.queryParam.categorySn = undefined
+      this.queryParam.shopProductDelFlag = 0
+      this.queryParam.promoStateList = ['NOT_RELEASE', 'HAVE_RELEASE']
       this.productType = []
       this.category = []
       this.$refs.table.refresh(true)
@@ -259,16 +263,12 @@ export default {
     },
     // 商城类目
     changeProductsCategory (val) {
-      this.queryParam.categorySn1 = val[0] ? val[0] : undefined
-      this.queryParam.categorySn2 = val[1] ? val[1] : undefined
+      this.queryParam.categorySn = (val[0] && val[1]) ? val[1] : (val[0] && !val[1]) ? val[0] : undefined
     },
     // 初始化
     pageInit () {
       const _this = this
-      if (!_this.itemCategorySn) {
-        _this.getCategoryList()
-      }
-      _this.closeProductModal()
+      _this.getCategoryList()
       _this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })