Quellcode durchsuchen

首页轮播图

chenrui vor 9 Monaten
Ursprung
Commit
67a4341c3a

+ 24 - 2
src/api/shopBanner.js

@@ -17,15 +17,37 @@ export const shopBannerList = (params) => {
 
 //  首页轮播图  保存
 export const saveShopBanner = (params) => {
-  const url = '/shopBanner/saveShopBanner '
+  return axios({
+    url: '/shopBanner/saveShopBanner',
+    data: params,
+    method: 'post'
+  })
+}
+
+// 查看参与经销商
+export const shopBannerSeeDealer = (params) => {
+  const url = `/shopBanner/queryDealerPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
   return axios({
     url: url,
     data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('列表查询')
+    }
+  })
+}
+
+// 发布  关闭  删除
+export const updateShopBanner = (params) => {
+  return axios({
+    url: '/shopBanner/updateShopBannerState',
+    data: params,
     method: 'post'
   })
 }
 
-// 删除仓位
 export const warehouseLocDel = params => {
   return axios({
     url: `/warehouseLoc/delete/${params.sn}`,

+ 135 - 0
src/api/shopPromo.js

@@ -0,0 +1,135 @@
+import { axios } from '@/utils/request'
+
+// 促销活动  有分页
+export const shopPromoActiveList = (params) => {
+  const url = `/shopPromo/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('列表查询')
+    }
+  })
+}
+
+// 促销活动 详情
+export const shopPromoDetail = params => {
+  return axios({
+    url: `/shopPromo/findBySn/${params.sn}`,
+    data: {},
+    method: 'get',
+    headers: {
+      'module': encodeURIComponent('详情')
+    }
+  })
+}
+
+// 促销活动  删除
+export const shopPromoDel = (params) => {
+  return axios({
+    url: '/shopPromo/delete',
+    data: params,
+    method: 'post'
+  })
+}
+
+// 促销活动  发布
+export const shopPromoRelease = (params) => {
+  return axios({
+    url: '/shopPromo/release',
+    data: params,
+    method: 'post'
+  })
+}
+
+// 促销活动  废弃
+export const shopPromoDiscard = (params) => {
+  return axios({
+    url: '/shopPromo/discard',
+    data: params,
+    method: 'post'
+  })
+}
+
+// 促销活动 修改商城轮播图
+export const updateShopBanner = (params) => {
+  return axios({
+    url: '/shopPromo/updateShopBanner',
+    data: params,
+    method: 'post'
+  })
+}
+// shopPromo/updateShopBanner 修改商城轮播图
+// {
+//     "promoSn":"sn",
+//     "shopBannerFlag": "轮播图标记 0 否 1 是"
+// }
+
+//  促销活动  保存
+export const saveShopPromo = (params) => {
+  return axios({
+    url: '/shopPromo/save',
+    data: params,
+    method: 'post'
+  })
+}
+
+// 获取已选产品列表  有分页
+export const chooseProductList = (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('列表查询')
+    }
+  })
+}
+
+// 选择产品 获取选择产品列表 有分页
+export const shopPromoProductList = (params) => {
+  const url = `/shopPromoProduct/queryWaitSelectPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('列表查询')
+    }
+  })
+}
+
+// 选择产品 批量添加产品
+export const saveChooseProduct = (params) => {
+  return axios({
+    url: '/shopPromoProduct/createBatch',
+    data: params,
+    method: 'post'
+  })
+}
+
+// 选择产品  批量修改产品
+export const modifyChooseProduct = (params) => {
+  return axios({
+    url: '/shopPromoProduct/modifyBatch',
+    data: params,
+    method: 'post'
+  })
+}
+
+//  选择产品  删除
+export const delChooseProduct = (params) => {
+  return axios({
+    url: '/shopPromoProduct/modifyDelete',
+    data: params,
+    method: 'post'
+  })
+}

+ 13 - 1
src/config/router.config.js

@@ -3660,7 +3660,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'add',
+                path: 'add/:pageType',
                 name: 'promotionalAddActivity',
                 component: () => import(/* webpackChunkName: "easyPassManagement" */ '@/views/easyPassManagement/promotionalActivities/edit.vue'),
                 meta: {
@@ -3670,6 +3670,18 @@ export const asyncRouterMap = [
                   replaceTab: true
                   // permission: 'B_promotionalActivitiesAdd'
                 }
+              },
+              {
+                path: 'edit/:pageType/:sn',
+                name: 'promotionalEditActivity',
+                component: () => import(/* webpackChunkName: "easyPassManagement" */ '@/views/easyPassManagement/promotionalActivities/edit.vue'),
+                meta: {
+                  title: '编辑促销活动',
+                  icon: 'file-ppt',
+                  hidden: true,
+                  replaceTab: true
+                  // permission: 'B_promotionalActivitiesEdit'
+                }
               }
             ]
           },

+ 42 - 52
src/views/easyPassManagement/homepageCarouselImg/list.vue

@@ -12,16 +12,16 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="轮播图名称">
-                <a-input id="carouselImage-promotionName" v-model.trim="queryParam.name" allowClear placeholder="请输入轮播图名称"/>
+                <a-input id="carouselImage-bannerName" v-model.trim="queryParam.bannerName" allowClear placeholder="请输入轮播图名称"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="轮播图状态">
                 <v-select
-                  v-model="queryParam.publishState"
-                  ref="publishState"
-                  id="carouselImage-publishState"
-                  code="PROMO_STATE"
+                  v-model="queryParam.stateDictValue"
+                  ref="stateDictValue"
+                  id="carouselImage-stateDictValue"
+                  code="SHOP_BANNER_STATE"
                   placeholder="请选择轮播图状态"
                   allowClear></v-select>
               </a-form-item>
@@ -95,34 +95,34 @@
                 class="button-warning"
                 :id="'carouselImage-edit-btn-'+record.id"
                 @click="handleAddOrEdit(record)"
-                v-if="(record.publishState=='UNPUBLISH' || record.publishState=='CLOSE') && $hasPermissions('B_promotionManagementEdit')">编辑</a-button>
+                v-if="(record.state=='UNPUBLISH' || record.state=='CLOSE') && $hasPermissions('B_promotionManagementEdit')">编辑</a-button>
               <a-button
                 size="small"
                 type="link"
                 class="button-success"
                 @click="handleSee(record)"
-                v-if="(record.publishState=='PUBLISH' || record.publishState=='END')&&$hasPermissions('B_promotionManagementDetail')"
+                v-if="(record.state=='PUBLISH' || record.state=='END')&&$hasPermissions('B_promotionManagementDetail')"
                 :id="'carouselImage-seeDetail-btn-'+record.id">查看</a-button>
               <a-button
                 size="small"
                 type="link"
                 class="button-info"
-                @click="handleRelease(record)"
-                v-if="record.publishState=='UNPUBLISH'&&$hasPermissions('B_promotionManagementContent')"
+                @click="closeReleaseDel(record,'PUBLISH')"
+                v-if="record.state=='UNPUBLISH'&&$hasPermissions('B_promotionManagementContent')"
                 :id="'carouselImage-release-btn-'+record.id">发布</a-button>
               <a-button
                 size="small"
                 type="link"
                 class="button-info"
-                @click="handleClose(record)"
-                v-if="record.publishState=='UNPUBLISH'&&$hasPermissions('B_promotionManagementContent')"
+                @click="closeReleaseDel(record,'CLOSE')"
+                v-if="(record.state=='PUBLISH')&&$hasPermissions('B_promotionManagementContent')"
                 :id="'carouselImage-release-btn-'+record.id">关闭</a-button>
               <a-button
                 size="small"
                 type="link"
                 class="button-error"
-                v-if="record.publishState=='UNPUBLISH'&&$hasPermissions('B_promotionManagementDel')"
-                @click="handleDel(record)"
+                v-if="record.state=='UNPUBLISH'&&$hasPermissions('B_promotionManagementDel')"
+                @click="closeReleaseDel(record,'1')"
                 :id="'carouselImage-del-btn-'+record.id">删除</a-button>
             </div>
           </template>
@@ -148,7 +148,7 @@ import imgShowModal from '@/views/easyPassManagement/shoppingManagement/imgShowM
 import detailModal from './detailModal'
 // 接口
 import { promoActiveList, promoActiveDel } from '@/api/promoActive'
-import { shopBannerList } from '@/api/shopBanner'
+import { shopBannerList, updateShopBanner } from '@/api/shopBanner'
 export default {
   name: 'PromotionList',
   mixins: [commonMixin],
@@ -168,8 +168,8 @@ export default {
       queryParam: {
         beginDate: undefined, // 创建开始时间
         endDate: undefined, // 创建结束时间
-        name: '', // 轮播图名称
-        publishState: undefined// 轮播图状态
+        bannerName: '', // 轮播图名称
+        state: undefined// 轮播图状态
       },
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -198,7 +198,7 @@ export default {
         { title: '参与经销商', scopedSlots: { customRender: 'joinCustomers' }, width: '8%', align: 'center' },
         { title: '封面展示', scopedSlots: { customRender: 'salesShow' }, width: '6%', align: 'center' },
         // { slots: { title: 'arrowFalgTitle' }, scopedSlots: { customRender: 'arrowFalg' }, width: '6%', align: 'center' },
-        { title: '轮播图状态', scopedSlots: { customRender: 'stateVal' }, width: '6%', align: 'center' },
+        { title: '轮播图状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ]
     }
@@ -218,7 +218,7 @@ export default {
     handleCustomers (row) {
       this.openCustomerModal = true
       this.$nextTick(() => {
-        this.$refs.lookUpCustomers.pageInit({ dealerSnList: row.dealerSnList ? row.dealerSnList : undefined, promoActiveSn: row.promoActiveSn })
+        this.$refs.lookUpCustomers.pageInit({ bannerSn: row.bannerSn })
       })
     },
     // 封面图片
@@ -229,6 +229,15 @@ export default {
         _this.$refs.checkedImg.pageInit(record.imageUrl)
       })
     },
+    // 重置
+    resetSearchForm () {
+      this.$refs.rangeCreateDate.resetDate(this.createDate)
+      this.queryParam.beginDate = undefined
+      this.queryParam.endDate = undefined
+      this.queryParam.bannerName = ''
+      this.queryParam.state = undefined
+      this.$refs.table.refresh(true)
+    },
     // 删除
     handleDel (row) {
       const _this = this
@@ -250,46 +259,27 @@ export default {
         }
       })
     },
-    // 关闭
-    handleClose (row) {
+    // 发布  关闭  删除
+    closeReleaseDel (row, val) {
       const _this = this
+      let tipDetail = null
+      const ajaxData = { bannerSn: row.bannerSn }
+      if (val != '1') {
+        tipDetail = '确认要' + (val === 'CLOSE' ? '关闭' : '发布') + '吗?'
+        ajaxData.state = val
+        ajaxData.delFlag = undefined
+      } else {
+        tipDetail = '点击确定,该内容将会被删除,不可再恢复!'
+        ajaxData.state = undefined
+        ajaxData.delFlag = val
+      }
       this.$confirm({
         title: '提示',
-        content: '确定关闭吗?',
+        content: tipDetail,
         centered: true,
         onOk () {
           _this.spinning = true
-          promoActiveDel({ sn: row.promoActiveSn }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.$refs.table.refresh()
-              _this.spinning = false
-            } else {
-              _this.spinning = false
-            }
-          })
-        }
-      })
-    },
-    // 重置
-    resetSearchForm () {
-      this.$refs.rangeCreateDate.resetDate(this.createDate)
-      this.queryParam.beginDate = undefined
-      this.queryParam.endDate = undefined
-      this.queryParam.name = ''
-      this.queryParam.publishState = undefined
-      this.$refs.table.refresh(true)
-    },
-    // 发布
-    handleRelease (row) {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确认要发布吗?',
-        centered: true,
-        onOk () {
-          _this.spinning = true
-          promoActiveDel({ sn: row.promoActiveSn }).then(res => {
+          updateShopBanner(ajaxData).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()

+ 21 - 14
src/views/easyPassManagement/promotionalActivities/chooseProductsModal.vue

@@ -22,12 +22,17 @@
             <a-row :gutter="15">
               <a-col :md="8" :sm="24">
                 <a-form-model-item label="产品编码">
-                  <a-input id="chooseProducts-code" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码"/>
+                  <a-input id="chooseProducts-code" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="8" :sm="24">
+                <a-form-model-item label="原厂编码">
+                  <a-input id="chooseProducts-orignCode" v-model.trim="queryParam.productOrigCode" allowClear placeholder="请输入原厂编码"/>
                 </a-form-model-item>
               </a-col>
               <a-col :md="8" :sm="24">
                 <a-form-model-item label="产品名称">
-                  <a-input id="chooseProducts-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
+                  <a-input id="chooseProducts-name" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
                 </a-form-model-item>
               </a-col>
               <a-col :md="8" :sm="24">
@@ -95,7 +100,8 @@ import { STable } from '@/components'
 import ProductBrand from '@/views/common/productBrand.js'
 import productTypeAll from '@/views/common/productTypeAll.js'
 // 接口
-import { productList } from '@/api/product'
+import { shopPromoProductList } from '@/api/shopPromo'
+
 export default {
   name: 'ChooseProductsModal',
   components: { STable, ProductBrand, productTypeAll },
@@ -126,8 +132,9 @@ export default {
       },
       //  查询条件
       queryParam: {
-        name: '', // 产品名称
-        code: '', //  产品编码
+        productName: '', // 产品名称
+        productCode: '', //  产品编码
+        productOrigCode: '', //  原厂编码
         productBrandSn: undefined, //  产品品牌
         productType: [], // 产品分类
         productTypeSn1: '', //  产品一级分类
@@ -137,12 +144,11 @@ export default {
       chooseDataList: [], // 已选择被禁用的数据
       columns: [
         { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
-        { title: '产品编码', dataIndex: 'code', align: 'center' },
-        { title: '产品名称', dataIndex: 'name', align: 'center', width: '18%', ellipsis: true, customRender: function (text) { return text || '--' } },
-        { title: '原厂编码', dataIndex: 'origCode', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
-        { title: '省级价', dataIndex: 'provincePrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '市级价', dataIndex: 'cityPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '特约价', dataIndex: 'specialPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '产品编码', dataIndex: 'productCode', align: 'center' },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', width: '18%', ellipsis: true, customRender: function (text) { return text || '--' } },
+        { title: '原厂编码', dataIndex: 'productOrigCode', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
+        { title: '商城售价', dataIndex: 'shopProductPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '终端价', dataIndex: 'terminalPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '品牌', dataIndex: 'productBrandName', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
         { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '10%', align: 'center' },
         { title: '包装数', scopedSlots: { customRender: 'productQty' }, align: 'center' },
@@ -154,7 +160,7 @@ export default {
         this.spinning = true
         const params = Object.assign(parameter, this.queryParam)
         // 获取列表数据 有分页
-        return productList(params).then(res => {
+        return shopPromoProductList(params).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -185,8 +191,9 @@ export default {
     },
     // 重置数据
     resetData () {
-      this.queryParam.code = ''
-      this.queryParam.name = ''
+      this.queryParam.productCode = ''
+      this.queryParam.productName = ''
+      this.queryParam.productOrigCode = ''
       this.queryParam.productBrandSn = undefined
       this.queryParam.productTypeSn1 = ''
       this.queryParam.productTypeSn2 = ''

+ 157 - 195
src/views/easyPassManagement/promotionalActivities/edit.vue

@@ -20,13 +20,12 @@
         >
           <a-row>
             <a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
-              <a-form-model-item label="促销名称" prop="title" :label-col="{span:4}" :wrapper-col="{span:16}">
+              <a-form-model-item label="促销名称" prop="promoName" :label-col="{span:4}" :wrapper-col="{span:16}">
                 <a-input
-                  id="promotionEdit-title"
+                  id="promotionEdit-promoName"
                   :maxLength="20"
-                  v-model.trim="form.title"
+                  v-model.trim="form.promoName"
                   placeholder="请输入促销名称(最多20个字符)"
-                  :disabled="isDisabled"
                   allowClear/>
               </a-form-model-item>
             </a-col>
@@ -56,18 +55,19 @@
               </a-form-model-item>
             </a-col>
             <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
-              <a-form-model-item label="参与经销商" prop="contentType">
+              <a-form-model-item label="参与经销商" prop="allDealerFlag">
                 <a-row :gutter="15">
                   <a-col :md="10" :sm="24">
                     <a-select
                       style="width:98%;"
-                      id="promotionList-dealerScope"
-                      v-model="form.dealerScope"
+                      id="promotionList-allDealerFlag"
+                      v-model="form.allDealerFlag"
                       placeholder="请选择参与经销商"
                       @change="changeDealerScope"
+                      :disabled="true"
                       allowClear>
-                      <a-select-option id="promotionList-dealerScope-all" value="ALL_DEALER">全部经销商</a-select-option>
-                      <a-select-option id="promotionList-dealerScope-some" value="SOME_DEALER">部分经销商</a-select-option>
+                      <a-select-option id="promotionList-dealerScope-all" value="1">全部经销商</a-select-option>
+                      <a-select-option id="promotionList-dealerScope-some" value="0">部分经销商</a-select-option>
                     </a-select>
                   </a-col>
                   <a-col :md="3" :sm="24" v-show="form.dealerScope && form.dealerScope!='ALL_DEALER' ">
@@ -87,11 +87,11 @@
               </a-form-model-item>
             </a-col>
             <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
-              <a-form-model-item label="封面图片" prop="imageSet" class="promotionEdit-img">
+              <a-form-model-item label="封面图片" prop="imageUrl" class="promotionEdit-img">
                 <Upload
                   class="upload"
-                  id="promotionEdit-imageSet"
-                  v-model="form.imageSet"
+                  id="promotionEdit-imageUrl"
+                  v-model="form.imageUrl"
                   ref="imageSet"
                   :fileSize="10"
                   :maxNums="1"
@@ -101,30 +101,29 @@
               </a-form-model-item>
             </a-col>
             <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
-              <a-form-model-item label="促销描述" prop="promoRule.ruleExplain">
+              <a-form-model-item label="促销描述" prop="description">
                 <a-input
-                  v-model="form.promoRule.ruleExplain"
+                  v-model="form.description"
                   :disabled="isDisabled"
                   type="textarea"
-                  id="promotionEdit-ruleExplain"
+                  id="promotionEdit-description"
                   placeholder="请输入促销描述(最多500个字符)"
                   :maxLength="500" />
               </a-form-model-item>
             </a-col>
             <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
-              <a-form-model-item label="加盟商开关权限" prop="promoRule.dealerEditFlag">
+              <a-form-model-item label="加盟商开关权限" prop="dealerOpenFlag">
                 <v-select
-                  v-model="form.contentType"
-                  id="promotion-contentType"
+                  v-model="form.dealerOpenFlag"
+                  id="promotion-dealerOpenFlag"
                   code="FLAG"
                   showType="radio"
                   :disabled="true"
-                  @change="changeContentType"
                   allowClear></v-select>
               </a-form-model-item>
             </a-col>
             <!-- 买产品送代金券 -->
-            <div v-if="pageType=='coupon'">
+            <div v-if="pageType=='BUY_PROD_GIVE_VALID'">
               <a-col :xs="12" :sm="12" :md="12" :lg="12" :xl="12">
                 <a-form-model-item label="券名称" :label-col="{span:4}" :wrapper-col="{span:16}" prop="promoRule.ruleName">
                   <a-input
@@ -211,40 +210,37 @@
             </div>
             <div v-if="isShowNextStep">
               <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
-                <a-form-model-item :label="pageType=='product'?'满赠规则': pageType=='special'?'优惠方式':'返券产品'" prop="promoRule.range">
+                <a-form-model-item :label="pageType==='BUY_PROD_GIVE_PROD'?'满赠规则': pageType==='PROMO_PROD'?'优惠方式':'返券产品'">
                   <div class="productInfo flex-center">
                     <!-- 买产品送产品 -->
-                    <div v-if="pageType=='product'">
+                    <div v-if="pageType==='BUY_PROD_GIVE_PROD'">
                       同款产品买<a-input-number
-                        v-model="form.promoRule.ruleValue"
+                        v-model="conditionValue"
                         style="margin:0 5px;"
-                        :min="0"
+                        :min="1"
                         :step="1"
-                        :precision="2"
+                        :precision="0"
                         :max="99999999"
-                        id="promotionEdit-ruleValue"
-                        :disabled="isDisabled"
+                        id="promotionEdit-conditionValue"
                         size="small"/>赠
                       <a-input-number
-                        v-model="form.promoRule.ruleValue"
+                        v-model="resultValue"
                         style="margin:0 5px;"
                         :min="0"
                         :step="1"
-                        :precision="2"
+                        :precision="0"
                         :max="99999999"
-                        id="promotionEdit-ruleValue"
-                        :disabled="isDisabled"
+                        id="promotionEdit-resultValue"
                         size="small"/>个(数量叠加)
                       <a-button
                         type="primary"
                         id="promotionEdit-addSet-btn"
-                        :disabled="isDisabled"
                         class="button-primary"
                         size="small"
                         @click="handleBatchAdd">批量设置</a-button>
                     </div>
                     <!-- 特价产品 -->
-                    <div v-if="pageType==='special'" style="width:80%;">
+                    <div v-if="pageType==='PROMO_PROD'" style="width:80%;">
                       <a-select
                         id="promotionList-discountType"
                         default-value="0"
@@ -280,7 +276,7 @@
                         @click="handleBatchAdd">批量设置</a-button>
                     </div>
                     <!-- 买产品返代金券 -->
-                    <div v-if="pageType=='coupon'">
+                    <div v-if="pageType=='BUY_PROD_GIVE_VALID'">
                       返券金额
                       <a-input-number
                         v-model="form.promoRule.ruleValue"
@@ -306,7 +302,7 @@
               </a-col>
               <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
                 <div style="width: 83%;margin:0 auto 10px;">
-                  <productTable ref="chooseProductList" :promoActiveSn="$route.params.sn" :disabledVal="isDisabled"></productTable>
+                  <productTable ref="chooseProductList" :promoActiveSn="form.promoSn" :disabledVal="isDisabled"></productTable>
                 </div>
               </a-col>
             </div>
@@ -357,6 +353,7 @@ import chooseProduct from './chooseProductsModal.vue'
 // 接口
 import { productTypeQuery } from '@/api/productType'
 import { promoActivePublish, promoActiveDetail, saveBatchEntity, promoCreateBatch, deleteByProductType } from '@/api/promoActive'
+import { saveChooseProduct, saveShopPromo, shopPromoDetail } from '@/api/shopPromo'
 export default {
   name: 'ProductBrandEditModal',
   mixins: [commonMixin],
@@ -372,65 +369,61 @@ export default {
       productRangeList: [], // 产品范围列表
       dateFormat: 'YYYY-MM-DD', // 促销时间显示格式
       openDealerModal: false,
+
+      pageType: undefined, // 促销类型
       // 链接配置内容
       form: {
-        promoActiveSn: undefined, // 促销活动sn
-        title: '', // 标题
-        imageSet: '', // 图片
-        contentType: 'IMAGE_CONTENT', // 内容类型
-        content: '', // 内容
-        contentLink: '', // 链接内容
+        promoType: undefined, // 促销类型
+
+        promoName: '', // '促销名称'
+        time: [], // 促销时间
+        promoStartDate: undefined, // 促销时间-开始
+        promoEndDate: undefined, // 促销时间-结束
         sort: undefined, // 排序
-        publishFlag: '0', // 是否发布
-        linkType: '1',
-        dealerEditFlag: '0', // 加盟商编辑 1是 0否
-        promoRule: {
-          ruleType: 'ticket', // 基本规则类型
-          ruleName: '', // 券名称
-          ruleTitle: '', // 副标题
-          ruleBaseType: 'category', // 券生成方式
-          ruleExplain: '', // 使用说明
-          validType: undefined, // 券有效期类型
-          validStartDate: undefined, // 券生效时间
-          validEndDate: undefined, // 券失效时间
-          validDays: undefined, // 券有效期天数
-          dealerEditFlag: '0', // 加盟商编辑 1是 0否
-          publishFlag: '0', // 是否发布
-          range: '1'
-        },
-        promotionRuleType: 'other'
+        allDealerFlag: '1', // 全部经销商 1   部分经销商0'
+        imageUrl: undefined, // 促销封面图
+        description: '', // '促销描述'
+        dealerEditFlag: '0', // 加盟商编辑 0否 1是
+        dealerOpenFlag: '0', // 加盟商开关权限 0否 1是
+        rangeList: []// 选择产品列表
+        // 'discountType': '特价产品 - 优惠方式',
+        // 'validName': '券名称',
+        // 'validTitle': '券副标题',
+        // 'validBaseType': '券生成方式',
+        // 'validType': '券有效期类型',
+        // 'validStartDate': '券生效时间',
+        // 'validEndDate': '券失效时间',
+        // 'validDays': '券有效期天数',
+        // 'validScope': '券适用范围标记 1-全部 0-指定  死值 1'
+
       },
+      conditionValue: undefined, // 买产品送产品 买
+      resultValue: undefined, // 买产品送产品  赠
+
       chooseDealerList: [], // 所选经销商数据
       time: [], // 有效期
       promotionName: '', // 促销名称
-      pageType: undefined, // 页面类型
       showProModal: false, // 打开产品弹窗
-      isShowNextStep: true, // 是否显示下一步 并提交一半配置产品
+      isShowNextStep: false, // 是否显示下一步 并提交一半配置产品
       isDisabled: false, // 控制页面是否能编辑
       chooseTypeList: [], // 已选中产品范围
       imageSet: [], // 回显显示图片数据
       productTypeList: [], // 产品范围    列表数据
       // 表单验证规则
       rules: {
-        title: [{ required: true, message: '请输入标题名称', trigger: 'blur' }],
-        imageSet: [{ required: true, message: '请选择要上传的封面图片', trigger: 'change' }],
+        promoName: [{ required: true, message: '请输入促销名称', trigger: 'blur' }],
+        time: [{ required: true, message: '请选择促销时间', trigger: 'change' }],
         sort: [{ required: true, message: '请输入排序数字', trigger: 'blur' }],
-        contentType: [{ required: true, message: '请选择内容类型', trigger: 'change' }],
-        content: [{ required: true, message: '请输入对应内容', trigger: ['blur', 'change'] }],
-        contentLink: [{ required: true, message: '请输入对应内容', trigger: 'blur' }],
-        publishFlag: [{ required: true, message: '请选择是否发布', trigger: 'change' }],
-        'promoRule.ruleType': [{ required: true, message: '请选择基本规则', trigger: 'change' }],
-        'promoRule.ruleName': [{ required: true, message: '请输入券名称', trigger: ['change', 'blur'] }],
-        'promoRule.ruleBaseType': [{ required: true, message: '请选择生成方式', trigger: 'change' }],
-        'promoRule.validType': [{ required: true, message: '请选择券有效期类型', trigger: 'change' }],
-        'promoRule.publishFlag': [{ required: true, message: '请选择是否发布', trigger: 'change' }],
-        'promoRule.dealerEditFlag': [{ required: true, message: '请选择加盟商是否可编辑', trigger: 'change' }],
-        'promoRule.range': [{ required: true, message: '请选择', trigger: 'blur' }],
-        dealerEditFlag: [{ required: true, message: '请选择加盟商是否可编辑', trigger: 'change' }]
+        allDealerFlag: [{ required: true, message: '请选择参与经销商', trigger: 'change' }],
+        imageUrl: [{ required: true, message: '请选择要上传的封面图片', trigger: 'change' }],
+        description: [{ required: true, message: '请输入促销描述内容', trigger: 'blur' }],
+        dealerOpenFlag: [{ required: true, message: '请选择加盟商开关权限', trigger: 'change' }],
+        rangeList: [{ required: true, message: '请选择促销产品', trigger: 'change' }]
       }
     }
   },
   methods: {
+    changeDealerScope () {},
     addDealerOk () {},
     // 选择经销商
     handleDealerModal () {
@@ -444,12 +437,12 @@ export default {
     disabledDate (current) {
       return current && current < moment().startOf('day')
     },
-    // 日期  change
+    // 促销时间  change
     dateChange (date, dateStrings) {
       if (dateStrings && dateStrings[0]) {
         this.form.time = dateStrings
-        this.form.activeDateStart = date.length ? dateStrings[0] + ' 00:00:00' : ''
-        this.form.activeDateEnd = date.length ? dateStrings[1] + ' 23:59:59' : ''
+        this.form.promoStartDate = date.length ? dateStrings[0] + ' 00:00:00' : ''
+        this.form.promoEndDate = date.length ? dateStrings[1] + ' 23:59:59' : ''
       } else {
         this.form.time = []
       }
@@ -469,55 +462,27 @@ export default {
     handleBack () {
       this.$router.push({ name: 'promotionalActivities', query: { closeLastOldTab: true } })
     },
-    //  详情  挨个赋值原因:该接口和修理厂促销列表详情用的同一个接口,给后端传值过滤多余参数
-    getDetail () {
+    //  详情
+    async getDetail (ajaxData) {
       const _this = this
-      promoActiveDetail({ sn: this.$route.params.sn }).then(res => {
-        if (res.status == 200) {
-          // 编辑按钮时,publishState 已发布,只能编辑是否发布;publishState已关闭,都可以编辑
-          if (_this.pageType === 'edit') {
-            _this.isDisabled = res.data.publishState === 'PUBLISH'
-            _this.form.promoRule.publishFlag = res.data.publishFlag
-            _this.form.promoRule.dealerEditFlag = res.data.dealerEditFlag
-          }
-          _this.form.publishFlag = res.data.publishFlag
-          _this.form.dealerEditFlag = res.data.dealerEditFlag
-          _this.form.promoActiveSn = res.data.promoActiveSn
-          _this.form.title = res.data.title
-          _this.form.contentType = res.data.contentType
-          _this.form.sort = res.data.sort
-          _this.imageSet = res.data.imageSet
-          if (res.data.imageSet) {
-            const images = res.data.imageSet.join(',')
-            _this.form.imageSet = images
-            if (this.pageType === 'add' || (this.pageType === 'edit' && res.data.publishState != 'PUBLISH')) {
-              _this.$refs.imageSet.setFileList(images)
-            }
-          }
-          _this.form.content = res.data.content
-          _this.promotionName = res.data.name || ''
-          _this.form.dealerEditFlag = res.data.dealerEditFlag
-          if (res.data.contentType == 'IMAGE_CONTENT') {
-            _this.$refs.editor.setHtml(res.data.content)
-          } else if (res.data.contentType == 'VIDEO') {
-            if (res.data.publishState != 'PUBLISH') {
-              _this.$refs.videoSet.setFileList(res.data.content)
-            }
-          } else if (res.data.contentType == 'LINK') {
-            _this.form.contentLink = res.data.content
-            _this.form.linkType = res.data.content != '/pagesB/promoDetail' ? '2' : '1'
-            if (res.data.promoRule) {
-              _this.isShowNextStep = true
-              _this.form.promoRule.range = '1'
-              _this.time = [res.data.promoRule.validStartDate, res.data.promoRule.validEndDate]
-              if (res.data.promoRule.productRangeList && res.data.promoRule.productRangeList.length > 0) {
-                _this.productRangeList = res.data.promoRule.productRangeList.map(item => { return item.productTypeSn })
-              }
-            }
-            _this.form.promoRule = { ..._this.form.promoRule, ...res.data.promoRule }
-          }
+      const res = await shopPromoDetail(ajaxData)
+      if (res.status == 200) {
+        if (res.data.promoStartDate && res.data.promoEndDate) {
+          const startTime = res.data.promoStartDate.split(' ')[0]
+          const endTime = res.data.promoEndDate.split(' ')[0]
+          res.data.time = [startTime, endTime]
         }
-      })
+        if (res.data.imageUrl) {
+          _this.$refs.imageSet.setFileList(res.data.imageUrl)
+        }
+        _this.form = res.data
+        if (_this.$route.params.pageType === 'edit') {
+          _this.pageType = res.data.promoType
+          _this.promotionName = res.data.promoName
+        }
+
+        _this.isShowNextStep = true
+      }
     },
     // 券有效期 change
     handleValidType (con) {
@@ -533,12 +498,11 @@ export default {
     //  确定保存  验证必填
     handleSave (type) {
       const _this = this
-      if (_this.form.contentType === 'LINK') {
-        _this.form.content = _this.form.contentLink
-      }
+
       // 验证组件必填项
       _this.$refs.ruleForm.validate(valid => {
         if (valid) {
+          _this.$refs.ruleForm.clearValidate('rangeList')
           _this.savePartInfo(type)
         }
       })
@@ -546,47 +510,47 @@ export default {
     // 保存
     savePartInfo (type) {
       const _this = this
-      _this.form.promoActiveSn = this.$route.params.sn
+      _this.form.promoType = _this.pageType
       var formData = JSON.parse(JSON.stringify(_this.form))
-      formData.imageSet = formData.imageSet ? formData.imageSet.split(',') : []
-      // 跳转链接
-      if (formData.contentType == 'LINK') {
-        delete formData.contentLink
-        if (_this.productRangeList && _this.productRangeList.length > 0) {
-          formData.promoRule.productRangeList = _this.productRangeList.map(item => { return { productTypeSn: item } })
-        }
-        // 促销活动
-        if (_this.form.linkType === '1') {
-          if (_this.form.promoRule.validType === 'FIXED') {
-            if (!_this.form.promoRule.validStartDate || _this.form.promoRule.validStartDate.validEndDate) {
-              _this.$message.warning('请输入券有效期!')
-              return false
-            }
-          } else {
-            if (!_this.form.promoRule.validDays) {
-              _this.$message.warning('请输入券有效期!')
-              return false
-            }
-          }
-          formData.publishFlag = _this.form.promoRule.publishFlag
-          formData.dealerEditFlag = _this.form.promoRule.dealerEditFlag
-        } else {
-          formData.promoRule = undefined
-        }
-        if (_this.$refs.chooseProductList) {
-          const numInfo = _this.$refs.chooseProductList.getDataNum()
-          if (numInfo == 0) {
-            _this.$message.warning('请选择返券产品!')
-            return
-          }
-        }
-      } else {
-        formData.promoRule = undefined
-      }
+      delete formData.time
+      // // 跳转链接
+      // if (formData.contentType == 'LINK') {
+      //   delete formData.contentLink
+      //   if (_this.productRangeList && _this.productRangeList.length > 0) {
+      //     formData.promoRule.productRangeList = _this.productRangeList.map(item => { return { productTypeSn: item } })
+      //   }
+      //   // 促销活动
+      //   if (_this.form.linkType === '1') {
+      //     if (_this.form.promoRule.validType === 'FIXED') {
+      //       if (!_this.form.promoRule.validStartDate || _this.form.promoRule.validStartDate.validEndDate) {
+      //         _this.$message.warning('请输入券有效期!')
+      //         return false
+      //       }
+      //     } else {
+      //       if (!_this.form.promoRule.validDays) {
+      //         _this.$message.warning('请输入券有效期!')
+      //         return false
+      //       }
+      //     }
+      //     formData.publishFlag = _this.form.promoRule.publishFlag
+      //     formData.dealerEditFlag = _this.form.promoRule.dealerEditFlag
+      //   } else {
+      //     formData.promoRule = undefined
+      //   }
+      //   if (_this.$refs.chooseProductList) {
+      //     const numInfo = _this.$refs.chooseProductList.getDataNum()
+      //     if (numInfo == 0) {
+      //       _this.$message.warning('请选择返券产品!')
+      //       return
+      //     }
+      //   }
+      // } else {
+      //   formData.promoRule = undefined
+      // }
       _this.spinning = true
-
-      promoActivePublish(formData).then(res => {
+      saveShopPromo(formData).then(res => {
         if (res.status == 200) {
+          debugger
           _this.$message.success(res.message)
           if (type === 'all') {
             _this.$nextTick(() => {
@@ -595,7 +559,7 @@ export default {
             })
           } else {
             _this.isShowNextStep = true
-            _this.getDetail()
+            _this.getDetail({ sn: res.data.shopPromo.promoSn })
           }
           _this.spinning = false
         } else {
@@ -605,7 +569,7 @@ export default {
     },
     //  图片上传
     changeImage (file) {
-      this.form.imageSet = file
+      this.form.imageUrl = file
     },
     // 视频上传
     changeVideo (file) {
@@ -665,15 +629,15 @@ export default {
       }
     },
     // 获取产品范围数据
-    getTreeData () {
-      productTypeQuery({}).then(res => {
-        if (res.status == 200) {
-          this.productTypeList = res.data
-        } else {
-          this.productTypeList = []
-        }
-      })
-    },
+    // getTreeData () {
+    //   productTypeQuery({}).then(res => {
+    //     if (res.status == 200) {
+    //       this.productTypeList = res.data
+    //     } else {
+    //       this.productTypeList = []
+    //     }
+    //   })
+    // },
     // 选择内容类型
     changeContentType (e) {
       if (e === 'LINK') {
@@ -705,30 +669,28 @@ export default {
       this.chooseTypeList = this.productRangeList
       this.showProModal = true
     },
-    // 批量添加
+    // 批量设置
     handleBatchAdd () {
-      if (!this.form.promoRule.ruleValue) {
-        this.$message.warning('请输入返券金额(需大于0)!')
+      if (!this.conditionValue && !this.resultValue) {
+        this.$message.warning('请输入促销优惠规则!')
         return
       }
-      this.$refs.chooseProductList.editMorePrice(this.form.promoRule.ruleValue)
+      this.$refs.chooseProductList.editMorePrice({ conditionValue: this.conditionValue, resultValue: this.resultValue })
     },
     // 添加产品成功
     addProductSuccess (list) {
       const productArr = list.map(item => {
         return {
-          promoActiveSn: this.$route.params.sn,
-          promoRuleSn: this.form.promoRule.promoRuleSn,
-          productCode: item.code,
+          promoSn: this.form.promoSn,
+          shopProductSn: item.shopProductSn,
           productSn: item.productSn,
-          ruleValue: this.form.promoRule.ruleValue,
-          price: item.terminalPrice
+          productCode: item.productCode
         }
       })
-      promoCreateBatch(productArr).then(res => {
+      saveChooseProduct(productArr).then(res => {
         if (res.status == 200) {
           this.showProModal = false
-          // 获取产品列表 有分页
+          // // 获取产品列表 有分页
           this.$refs.chooseProductList.pageInit()
         }
       })
@@ -756,14 +718,14 @@ export default {
     },
     // 初始化
     pageInit () {
-      this.pageType = this.$route.params.pageType
-      if (this.pageType === 'edit') {
-        this.getDetail()
+      if (this.$route.params.pageType === 'edit') {
+        this.getDetail({ sn: this.$route.params.sn })
+      } else {
+        this.pageType = this.$route.params.pageType
       }
-      console.log('加载产品范围')
-      this.$nextTick(() => {
-        this.getTreeData()
-      })
+      // this.$nextTick(() => {
+      //   this.getTreeData()
+      // })
     }
   },
   mounted () {

+ 80 - 50
src/views/easyPassManagement/promotionalActivities/list.vue

@@ -12,7 +12,7 @@
             </a-col>
             <a-col :md="5" :sm="24">
               <a-form-item label="促销名称">
-                <a-input id="promotion-promotionName" v-model.trim="queryParam.name" allowClear placeholder="请输入促销名称"/>
+                <a-input id="promotion-promotionName" v-model.trim="queryParam.promoName" allowClear placeholder="请输入促销名称"/>
               </a-form-item>
             </a-col>
             <a-col :md="5" :sm="24">
@@ -52,9 +52,9 @@
       <a-spin :spinning="spinning" tip="Loading...">
         <!-- 操作按钮 -->
         <div class="table-operator" v-if="$hasPermissions('B_promotionManagementAdd')">
-          <a-button type="primary" class="button-info" id="promotion-add-btn" @click="handleEdit('product')">买产品送产品</a-button>
-          <a-button type="primary" class="button-info" id="promotion-add-btn" @click="handleEdit('special')">特价产品</a-button>
-          <a-button type="primary" class="button-info" id="promotion-add-btn" @click="handleEdit('coupon')">买产品返代金券</a-button>
+          <a-button type="primary" class="button-info" id="promotion-add-btn" @click="handleEdit('BUY_PROD_GIVE_PROD')">买产品送产品</a-button>
+          <a-button type="primary" class="button-info" id="promotion-add-btn" @click="handleEdit('PROMO_PROD')">特价产品</a-button>
+          <a-button type="primary" class="button-info" id="promotion-add-btn" @click="handleEdit('BUY_PROD_GIVE_VALID')">买产品返代金券</a-button>
         </div>
         <s-table
           class="sTable fixPagination"
@@ -70,21 +70,17 @@
           <!-- 促销名称 -->
           <!-- v-if="$hasPermissions('B_dealerPromotionDetail')" -->
           <template slot="promotionName" slot-scope="text, record">
-            <div :id="'promotion-info-'+record.id" class="link-bule nameBox text-overflows2" @click="handleDetail(record)">{{ record.title }}</div>
+            <div :id="'promotion-info-'+record.id" class="link-bule nameBox text-overflows2" @click="handleDetail(record)">{{ record.promoName }}</div>
             <!-- <div v-else class="nameBox text-overflows2">{{ record.title }}</div> -->
           </template>
-          <!-- 促销状态 -->
-          <template slot="stateVal" slot-scope="text, record">
-            <span>{{ record.publishState==='UNPUBLISH'?'未发布':record.publishState==='PUBLISH'?'已发布':record.publishState==='CLOSE'?'已关闭':'已结束' }}</span>
-          </template>
           <!-- 促销时间 -->
           <template slot="promotionTime" slot-scope="text, record">
-            <span>{{ record.activeDateStart }}至{{ record.activeDateEnd }}</span>
+            <span>{{ record.promoStartDate }}至{{ record.promoEndDate }}</span>
           </template>
           <!-- 参与经销商 -->
           <template slot="joinCustomers" slot-scope="text, record">
-            <span @click="handleCustomers(record)" :id="'promotion-seeDealerInfo-'+record.id" v-if="record.dealerSnList&&record.dealerSnList.length>0">共有<span class="link-bule">{{ record.dealerSnList.length }}</span>个客户</span>
-            <span v-else>共有0个客户</span>
+            <span @click="handleCustomers(record)" :id="'promotion-seeDealerInfo-'+record.id" v-if="record.allDealerFlag&&record.allDealerFlag!='1'">共有<span class="link-bule">{{ record.dealerSnList.length }}</span>个客户</span>
+            <span v-else>全部经销商</span>
           </template>
           <!-- 促销类型 -->
           <template slot="salesDesc" slot-scope="text, record">
@@ -98,7 +94,7 @@
             <div v-else @click="promotionDesc(record)" :id="'promotion-description-'+record.id" class="link-bule">{{ record.description }}</div>
           </template>
           <!-- 操作 -->
-          <!-- state状态 END已结束    CLOSE已关闭    PUBLISH  已发布    UNPUBLISH  未发布 -->
+          <!-- promoState状态 END已结束    HAVE_DISCARD已废弃    HAVE_RELEASE  已发布    NOT_RELEASE  未发布 -->
           <template slot="action" slot-scope="text, record">
             <div>
               <a-button
@@ -106,32 +102,34 @@
                 type="link"
                 class="button-warning"
                 :id="'promotion-edit-btn-'+record.id"
-                @click="handleEdit(record,'edit')"
-                v-if="(record.publishState=='UNPUBLISH' || record.publishState=='CLOSE') && $hasPermissions('B_promotionManagementEdit')">编辑</a-button>
+                @click="handleEdit('edit',record)"
+                v-if="(record.promoState=='NOT_RELEASE') && $hasPermissions('B_promotionManagementEdit')">编辑</a-button>
               <a-button
                 size="small"
                 type="link"
                 class="button-warning"
                 :id="'promotion-modify-btn-'+record.id"
-                @click="handleAbandon(record,'edit')">废弃</a-button>
+                v-if="(record.promoState=='HAVE_RELEASE') && $hasPermissions('B_promotionManagementEdit')"
+                @click="handleAbandon(record)">废弃</a-button>
               <a-button
                 size="small"
                 type="link"
                 class="button-warning"
                 :id="'promotion-modify-btn-'+record.id"
-                @click="handleSet(record,'edit')">轮播图</a-button>
+                v-if="(record.promoState=='HAVE_RELEASE') && $hasPermissions('B_promotionManagementEdit')"
+                @click="handleSet(record)">轮播图</a-button>
               <a-button
                 size="small"
                 type="link"
                 class="button-info"
-                @click="handleRelease(record,'add')"
-                v-if="record.publishState=='UNPUBLISH'&&$hasPermissions('B_promotionManagementContent')"
+                @click="handleRelease(record)"
+                v-if="record.promoState=='NOT_RELEASE'&&$hasPermissions('B_promotionManagementContent')"
                 :id="'promotion-release-btn-'+record.id">发布</a-button>
               <a-button
                 size="small"
                 type="link"
                 class="button-error"
-                v-if="record.publishState=='UNPUBLISH'&&$hasPermissions('B_promotionManagementDel')"
+                v-if="record.promoState=='NOT_RELEASE'&&$hasPermissions('B_promotionManagementDel')"
                 @click="handleDel(record)"
                 :id="'promotion-del-btn-'+record.id">删除</a-button>
             </div>
@@ -142,6 +140,35 @@
       <lookUp-customers-modal ref="lookUpCustomers" :openModal="openCustomerModal" @close="openCustomerModal = false"></lookUp-customers-modal>
       <!-- 详情 -->
       <detail-Modal :openModal="openDetailModal" :itemSn="itemId" @close="closeDetailModal" @ok="$refs.table.refresh()" />
+      <!-- 轮播图修改弹窗 -->
+      <a-modal
+        closable
+        v-model="openSetImgModal"
+        :footer="null"
+        width="416px"
+        centered>
+        <div style="display:flex;margin:30px 0 20px 20px;">
+          <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>
+          </div>
+        </div>
+        <!-- 按钮 -->
+        <div style="text-align: right;">
+          <a-button
+            id="auditModal-cancel"
+            type="primary"
+            @click="handleSetModal('0')"
+            style="margin-right: 15px;">取消</a-button>
+          <a-button
+            type="primary"
+            id="auditModal-save"
+            class="button-info"
+            @click="handleSetModal('1')"
+          >确定</a-button>
+        </div>
+      </a-modal>
     </a-card>
   </div>
 </template>
@@ -154,7 +181,8 @@ import rangeDate from '@/views/common/rangeDate.vue'
 import lookUpCustomersModal from './lookUpCustomersModal'
 import detailModal from './detailModal'
 // 接口
-import { promoActiveList, promoActiveDel } from '@/api/promoActive'
+import { shopPromoActiveList, shopPromoDel, shopPromoRelease, shopPromoDiscard, updateShopBanner } from '@/api/shopPromo'
+
 export default {
   name: 'PromotionalActivitiesList',
   mixins: [commonMixin],
@@ -170,6 +198,7 @@ export default {
       itemId: '', // 当前活动sn
       pageType: '', // 发布类型  add  促销发布  edit 发布修改
       dealerSn: [], // 经销商sn
+      openSetImgModal: false, // 设置首页轮播图
       // 查询参数
       queryParam: {
         beginDate: undefined, // 促销开始时间
@@ -178,12 +207,13 @@ export default {
         promotionType: '', // 促销类型
         publishState: undefined// 是否发布
       },
+      itemObj: null,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
         const params = Object.assign(parameter, this.queryParam)
-        return promoActiveList(params).then(res => {
+        return shopPromoActiveList(params).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -202,11 +232,11 @@ export default {
         { title: '创建时间', dataIndex: 'createDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '促销名称', scopedSlots: { customRender: 'promotionName' }, width: '15%', align: 'left' },
         { title: '促销时间', scopedSlots: { customRender: 'promotionTime' }, width: '15%', align: 'center' },
-        { title: '参与经销商', scopedSlots: { customRender: 'joinCustomers' }, width: '10%', align: 'center' },
-        { title: '促销类型', dataIndex: 'promotionRuleTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '加盟商编辑', dataIndex: 'name1', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '首页轮播图', dataIndex: 'name2', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '促销状态', scopedSlots: { customRender: 'stateVal' }, width: '6%', 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: '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: '15%', align: 'center' }
       ]
     }
@@ -226,11 +256,11 @@ export default {
     },
     // 编辑
     handleEdit (type, row) {
-      const params = { pageType: type }
       if (type === 'edit') {
-        params.sn = row.promoActiveSn
+        this.$router.push({ name: 'promotionalEditActivity', params: { pageType: type, sn: row.promoSn } })
+      } else {
+        this.$router.push({ name: 'promotionalAddActivity', params: { pageType: type } })
       }
-      this.$router.push({ name: 'promotionalAddActivity', params })
     },
     // 删除促销活动
     handleDel (row) {
@@ -241,7 +271,7 @@ export default {
         centered: true,
         onOk () {
           _this.spinning = true
-          promoActiveDel({ sn: row.promoActiveSn }).then(res => {
+          shopPromoDel({ promoSn: row.promoSn }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
@@ -254,7 +284,7 @@ export default {
       })
     },
     // 废弃
-    handleAbandon () {
+    handleAbandon (row) {
       const _this = this
       this.$confirm({
         title: '提示',
@@ -262,7 +292,7 @@ export default {
         centered: true,
         onOk () {
           _this.spinning = true
-          promoActiveDel({ sn: row.promoActiveSn }).then(res => {
+          shopPromoDiscard({ promoSn: row.promoSn }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
@@ -292,7 +322,7 @@ export default {
         centered: true,
         onOk () {
           _this.spinning = true
-          promoActiveDel({ sn: row.promoActiveSn }).then(res => {
+          shopPromoRelease({ promoSn: row.promoSn }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
@@ -304,24 +334,24 @@ export default {
         }
       })
     },
-    // 设置轮播图
+    // 打开 设置轮播图弹窗
     handleSet (row) {
+      this.itemObj = row
+      this.openSetImgModal = true
+    },
+    // 设置轮播图
+    handleSetModal (val) {
       const _this = this
-      this.$confirm({
-        title: '设置',
-        content: '确定设为首页轮播图吗?',
-        centered: true,
-        onOk () {
-          _this.spinning = true
-          promoActiveDel({ sn: row.promoActiveSn }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.$refs.table.refresh()
-              _this.spinning = false
-            } else {
-              _this.spinning = false
-            }
-          })
+      _this.spinning = true
+      updateShopBanner({ promoSn: _this.itemObj.promoSn, shopBannerFlag: val }).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.$refs.table.refresh()
+          _this.openSetImgModal = false
+          _this.itemObj = null
+          _this.spinning = false
+        } else {
+          _this.spinning = false
         }
       })
     },

+ 2 - 3
src/views/easyPassManagement/promotionalActivities/lookUpCustomersModal.vue

@@ -79,7 +79,7 @@ import subarea from '@/views/common/subarea.js'
 import AreaList from '@/views/common/areaList.js'
 // 接口
 import { dealerExport } from '@/api/promoTerminal'
-import { dealerQueryList } from '@/api/dealer'
+import { shopBannerSeeDealer } from '@/api/shopBanner'
 export default {
   name: 'LookUpCustomersModal',
   components: { STable, ProductType, subarea, AreaList },
@@ -115,7 +115,7 @@ export default {
         this.disabled = true
         this.spinning = true
         const params = Object.assign(parameter, this.queryParam)
-        return dealerQueryList(params).then(res => {
+        return shopBannerSeeDealer(params).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -173,7 +173,6 @@ export default {
       this.queryParam.dealerName = undefined
       this.$refs.areaList.clearData()
       this.$refs.subarea.clearData()
-      this.$refs.table.refresh(true)
     },
     //  导出
     handleExport () {

+ 39 - 35
src/views/easyPassManagement/promotionalActivities/productTable.vue

@@ -14,30 +14,32 @@
         :style="{ maxHeight: 300+'px' }"
         :scroll="{ y:230 }"
         bordered>
-        <template slot="price" slot-scope="text,record">
+        <!-- 买 -->
+        <template slot="conditionValue" slot-scope="text,record">
           <a-input-number
-            :min="0"
+            :min="1"
             :step="1"
-            :precision="2"
+            :precision="0"
             :max="99999999"
-            @blur="editAllPrice(record,'price')"
+            @blur="editProductVal(record,'conditionValue')"
             placeholder="请输入"
             :disabled="disabledVal"
-            v-model="record.price"
-            :id="'productTable-price'+record.id "
+            v-model="record.conditionValue"
+            :id="'productTable-conditionValue'+record.id "
             size="small"/>
         </template>
-        <template slot="ruleValue" slot-scope="text,record">
+        <!-- 赠 -->
+        <template slot="resultValue" slot-scope="text,record">
           <a-input-number
             :min="0"
             :step="1"
-            :precision="2"
+            :precision="0"
             :max="99999999"
             :disabled="disabledVal"
-            @blur="editAllPrice(record,'ruleValue')"
+            @blur="editProductVal(record,'resultValue')"
             placeholder="请输入"
-            v-model="record.ruleValue"
-            :id="'productTable-ruleValue'+record.id "
+            v-model="record.resultValue"
+            :id="'productTable-resultValue'+record.id "
             size="small"/>
         </template>
         <!-- 操作 -->
@@ -60,7 +62,7 @@ import { commonMixin } from '@/utils/mixin'
 // 组件
 import { STable } from '@/components'
 // 接口
-import { promoRuleProductList, deleteBatch, promoUpdateBatch } from '@/api/promoActive'
+import { chooseProductList, delChooseProduct, modifyChooseProduct } from '@/api/shopPromo'
 export default {
   name: 'ProductTable',
   mixins: [commonMixin],
@@ -83,12 +85,12 @@ export default {
       dataListQty: '0', // 表格数据总条数
       columns: [// 表头
         { title: '序号', dataIndex: 'no', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '原厂编码', dataIndex: 'origCode', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '买', scopedSlots: { customRender: 'price' }, width: '10%', align: 'right' },
-        { title: '赠', scopedSlots: { customRender: 'ruleValue' }, width: '10%', align: 'right' },
-        { title: '商城售价', dataIndex: 'terminalPrice', width: '10%', align: 'right', customRender: text => { return ((text || text == 0) ? this.toThousands(text) : '--') } },
+        { title: '产品编码', dataIndex: 'productCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '18%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '原厂编码', dataIndex: 'productOrigCode', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '买', scopedSlots: { customRender: 'conditionValue' }, width: '10%', align: 'center' },
+        { title: '赠', scopedSlots: { customRender: 'resultValue' }, width: '10%', align: 'center' },
+        { title: '商城售价', dataIndex: 'shopProductPrice', width: '10%', align: 'right', customRender: text => { return ((text || text == 0) ? this.toThousands(text) : '--') } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
@@ -97,22 +99,22 @@ export default {
         this.spinning = true
         const params = Object.assign(parameter, this.queryParam)
         params.promoActiveSn = this.promoActiveSn
-        return promoRuleProductList(params).then(res => {
+        return chooseProductList(params).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
-              // 活动价初始值,活动价=参考终端价
-              if (!data.list[i].price) {
-                data.list[i].price = data.list[i].terminalPrice
-              } else {
-                data.list[i].price = data.list[i].price
-              }
+              // // 活动价初始值,活动价=参考终端价
+              // if (!data.list[i].price) {
+              //   data.list[i].price = data.list[i].terminalPrice
+              // } else {
+              //   data.list[i].price = data.list[i].price
+              // }
             }
             this.disabled = false
-            this.dataListQty = res.data.count
+            // this.dataListQty = res.data.count
           }
           this.spinning = false
           return data
@@ -125,19 +127,21 @@ export default {
     rowSelectionFun (obj) {
       this.rowSelectionInfo = obj || null
     },
-    // 批量修改价格
-    editAllPrice (row, typeName) {
+    // 批量已选产品信息
+    editProductVal (row, typeName) {
       let ajaxData = []
       if (typeName != 'all') {
         ajaxData.push({
           id: row.id,
-          price: typeName === 'price' ? row.price : undefined,
-          ruleValue: typeName === 'ruleValue' ? row.ruleValue : undefined
+          promoSn: this.promoActiveSn,
+          productPrice: typeName === 'productPrice' ? row.productPrice : undefined,
+          conditionValue: typeName === 'conditionValue' ? row.conditionValue : undefined,
+          resultValue: typeName === 'resultValue' ? row.resultValue : undefined
         })
       } else {
         ajaxData = row || []
       }
-      promoUpdateBatch(ajaxData).then(res => {
+      modifyChooseProduct(ajaxData).then(res => {
         if (res.status == 200) {
           this.$refs.table.refresh(true)
           this.$refs.table.clearSelected() // 清空表格选中项
@@ -145,19 +149,19 @@ export default {
       })
     },
     // 修改产品活动价、返券金额
-    editMorePrice (numInfo) {
+    editMorePrice (objInfo) {
       if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRows && this.rowSelectionInfo.selectedRows.length === 0)) {
         this.$message.warning('请选择要修改的产品!')
         return
       }
-      const ajaxArr = this.rowSelectionInfo.selectedRows.map(item => { return { id: item.id, ruleValue: numInfo } })
-      this.editAllPrice(ajaxArr, 'all')
+      const ajaxArr = this.rowSelectionInfo.selectedRows.map(item => { return { id: item.id, promoSn: this.promoActiveSn, conditionValue: objInfo.conditionValue, resultValue: objInfo.resultValue } })
+      this.editProductVal(ajaxArr, 'all')
     },
     // 删除
     handleDel (row) {
       const _this = this
       _this.spinning = true
-      deleteBatch([row.id]).then(res => {
+      delChooseProduct([{ id: row.id, promoSn: _this.promoActiveSn }]).then(res => {
         if (res.status == 200) {
           _this.$message.success(res.message)
           _this.$refs.table.refresh()