商家端优惠券活动联动
							parent
							
								
									70f0bafd21
								
							
						
					
					
						commit
						7de01626b8
					
				|  | @ -19,7 +19,7 @@ export const whetherStar = params => { | ||||||
| 
 | 
 | ||||||
| // 添加优惠券活动
 | // 添加优惠券活动
 | ||||||
| export const addCouponActivity = params => { | export const addCouponActivity = params => { | ||||||
|   return postRequest(`/promotion/couponActivity/addCouponActivity`,params); |   return postRequest(`/promotion/couponActivity/addCouponActivity`, params); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -103,6 +103,34 @@ export const deleteMemberReceiveCoupon = id => { | ||||||
|   return putRequest(`/promotion/coupon/member/cancellation/${id}`); |   return putRequest(`/promotion/coupon/member/cancellation/${id}`); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | // 保存平台优惠券
 | ||||||
|  | export const saveActivityCoupon = params => { | ||||||
|  |   return postRequest("/promotion/couponActivity", params, { | ||||||
|  |     "Content-type": "application/json" | ||||||
|  |   }); | ||||||
|  | }; | ||||||
|  | // 获取活动优惠券列表
 | ||||||
|  | export const getActivityCouponList = params => { | ||||||
|  |   return getRequest("/promotion/couponActivity/activityCoupons", params); | ||||||
|  | }; | ||||||
|  | // 获取平台优惠券活动
 | ||||||
|  | export const getCouponActivityList = params => { | ||||||
|  |   return getRequest("/promotion/couponActivity", params); | ||||||
|  | }; | ||||||
|  | //  作废优惠券
 | ||||||
|  | export const deleteCouponActivity = ids => { | ||||||
|  |   return deleteRequest(`/promotion/couponActivity/${ids}`); | ||||||
|  | }; | ||||||
|  | //  更新优惠券活动
 | ||||||
|  | export const updateCouponActivity = params => { | ||||||
|  |   return putRequest(`/promotion/couponActivity/status`, params); | ||||||
|  | }; | ||||||
|  | //  获取单个优惠券活动
 | ||||||
|  | export const getCouponActivity = id => { | ||||||
|  |   return getRequest(`/promotion/couponActivity/${id}`); | ||||||
|  | }; | ||||||
|  | 
 | ||||||
| // 获取限时抢购数据
 | // 获取限时抢购数据
 | ||||||
| export const getSeckillList = params => { | export const getSeckillList = params => { | ||||||
|   return getRequest("/promotion/seckill", params); |   return getRequest("/promotion/seckill", params); | ||||||
|  |  | ||||||
|  | @ -21,10 +21,10 @@ export default { | ||||||
|     // buyer: "https://buyer-api.pickmall.cn",
 |     // buyer: "https://buyer-api.pickmall.cn",
 | ||||||
|     // seller: "https://store-api.pickmall.cn",
 |     // seller: "https://store-api.pickmall.cn",
 | ||||||
|     // manager: "https://admin-api.pickmall.cn"
 |     // manager: "https://admin-api.pickmall.cn"
 | ||||||
|     common: 'http://192.168.0.109:8890', |     common: 'http://192.168.0.100:8890', | ||||||
|     buyer: 'http://192.168.0.109:8888', |     buyer: 'http://192.168.0.100:8888', | ||||||
|     seller: 'http://192.168.0.109:8889', |     seller: 'http://192.168.0.100:8889', | ||||||
|     manager: 'http://192.168.0.109:8887' |     manager: 'http://192.168.0.100:8887' | ||||||
|   }, |   }, | ||||||
|   api_prod: { |   api_prod: { | ||||||
|     common: "https://common-api.pickmall.cn", |     common: "https://common-api.pickmall.cn", | ||||||
|  |  | ||||||
|  | @ -224,12 +224,6 @@ export const otherRouter = { | ||||||
|       name: "add-platform-coupon", |       name: "add-platform-coupon", | ||||||
|       component: () => import("@/views/promotion/coupon/couponPublish.vue") |       component: () => import("@/views/promotion/coupon/couponPublish.vue") | ||||||
|     }, |     }, | ||||||
|     { |  | ||||||
|       path: "promotion/add-coupon-specify", |  | ||||||
|       title: "精准发劵", |  | ||||||
|       name: "add-coupon-specify", |  | ||||||
|       component: () => import("@/views/promotion/coupon/couponSpecify.vue") |  | ||||||
|     }, |  | ||||||
|     { |     { | ||||||
|       path: "promotion/edit-platform-coupon", |       path: "promotion/edit-platform-coupon", | ||||||
|       title: "编辑平台优惠券", |       title: "编辑平台优惠券", | ||||||
|  | @ -249,6 +243,37 @@ export const otherRouter = { | ||||||
|       name: "platform-coupon-info", |       name: "platform-coupon-info", | ||||||
|       component: () => import("@/views/promotion/coupon/couponInfo.vue") |       component: () => import("@/views/promotion/coupon/couponInfo.vue") | ||||||
|     }, |     }, | ||||||
|  |     { | ||||||
|  |       path: "coupon-activity/add", | ||||||
|  |       title: "添加优惠券活动", | ||||||
|  |       name: "add-coupon-activity", | ||||||
|  |       component: () => import("@/views/promotion/couponActivity/couponPublish.vue") | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       path: "coupon-activity/edit", | ||||||
|  |       title: "编辑平台优惠券", | ||||||
|  |       name: "edit-coupon-activity", | ||||||
|  |       component: () => import("@/views/promotion/couponActivity/couponPublish.vue") | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       path: "promotion/member-receive-coupon", | ||||||
|  |       title: "领取详情", | ||||||
|  |       name: "member-coupon-activity", | ||||||
|  |       component: () => | ||||||
|  |         import("@/views/promotion/coupon/memberReceiveCoupon.vue") | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       path: "promotion/platform-coupon-info", | ||||||
|  |       title: "详情", | ||||||
|  |       name: "platform-coupon-activity", | ||||||
|  |       component: () => import("@/views/promotion/coupon/couponInfo.vue") | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       path: "promotion/add-coupon-specify", | ||||||
|  |       title: "精准发劵", | ||||||
|  |       name: "add-coupon-specify", | ||||||
|  |       component: () => import("@/views/promotion/coupon/couponSpecify.vue") | ||||||
|  |     }, | ||||||
|     { |     { | ||||||
|       path: "promotion/manager-pintuan", |       path: "promotion/manager-pintuan", | ||||||
|       title: "平台拼团", |       title: "平台拼团", | ||||||
|  |  | ||||||
|  | @ -0,0 +1,246 @@ | ||||||
|  | <template> | ||||||
|  |   <div class="wrapper"> | ||||||
|  |     <div class="wap-content"> | ||||||
|  |       <div class="query-wrapper"> | ||||||
|  |         <div class="query-item"> | ||||||
|  |           <div>搜索范围</div> | ||||||
|  |           <Input placeholder="商品名称" @on-clear="goodsData=[]; goodsParams.goodsName=''; goodsParams.pageNumber = 1; getQueryGoodsList()" @on-enter="()=>{goodsData=[];goodsParams.pageNumber =1; getQueryGoodsList();}" icon="ios-search" clearable | ||||||
|  |             style="width: 150px" v-model="goodsParams.goodsName" /> | ||||||
|  |         </div> | ||||||
|  |         <div class="query-item"> | ||||||
|  |           <Cascader v-model="category" placeholder="请选择商品分类" style="width: 250px" :data="skuList"></Cascader> | ||||||
|  |         </div> | ||||||
|  |         <div class="query-item"> | ||||||
|  |           <Button type="primary" @click="goodsData=[]; getQueryGoodsList();" icon="ios-search">搜索</Button> | ||||||
|  |         </div> | ||||||
|  |       </div> | ||||||
|  |       <div style="positon:retavle;"> | ||||||
|  |         <Scroll class="wap-content-list" :on-reach-bottom="handleReachBottom" :distance-to-edge="[3,3]"> | ||||||
|  |           <div class="wap-content-item" :class="{ active: item.selected }" @click="checkedGoods(item, index)" v-for="(item, index) in goodsData" :key="index"> | ||||||
|  |             <div> | ||||||
|  |               <img :src="item.thumbnail" alt="" /> | ||||||
|  |             </div> | ||||||
|  |             <div class="wap-content-desc"> | ||||||
|  |               <div class="wap-content-desc-title">{{ item.goodsName }}</div> | ||||||
|  |               <div class="wap-sku">{{ item.goodsUnit }}</div> | ||||||
|  |               <div class="wap-content-desc-bottom"> | ||||||
|  |                 <div>¥{{ item.price | unitPrice }}</div> | ||||||
|  |               </div> | ||||||
|  |             </div> | ||||||
|  |           </div> | ||||||
|  |           <Spin size="large" fix v-if="loading"></Spin> | ||||||
|  | 
 | ||||||
|  |           <div v-if="empty" class="empty">暂无商品信息</div> | ||||||
|  |         </Scroll> | ||||||
|  | 
 | ||||||
|  |       </div> | ||||||
|  |     </div> | ||||||
|  |   </div> | ||||||
|  | </template> | ||||||
|  | <script> | ||||||
|  | import * as API_Goods from "@/api/goods"; | ||||||
|  | export default { | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       type: "multiple", //单选或者多选 single  multiple | ||||||
|  | 
 | ||||||
|  |       skuList: [], // 商品sku列表 | ||||||
|  |       total: "",  // 商品总数 | ||||||
|  |       goodsParams: { // 商品请求参数 | ||||||
|  |         pageNumber: 1, | ||||||
|  |         pageSize: 18, | ||||||
|  |         order: "desc", | ||||||
|  |         goodsName: "", | ||||||
|  |         sn: "", | ||||||
|  |         categoryPath: "", | ||||||
|  |         marketEnable: "UPPER", | ||||||
|  |         isAuth: "PASS", | ||||||
|  |       }, | ||||||
|  |       category: [], // 分类 | ||||||
|  |       goodsData: [], // 商品数据 | ||||||
|  |       empty: false, // 空数据 | ||||||
|  |       loading: false, // 加载状态 | ||||||
|  |     }; | ||||||
|  |   }, | ||||||
|  |   props: { | ||||||
|  |     selectedWay: { | ||||||
|  |       type: Array, | ||||||
|  |       default: new Array() | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |   watch: { | ||||||
|  |     category(val) { | ||||||
|  |       this.goodsParams.categoryPath = val[0]; | ||||||
|  |     }, | ||||||
|  |     selectedWay: { | ||||||
|  |       handler() { | ||||||
|  |         this.$emit("selected", this.selectedWay); | ||||||
|  |       }, | ||||||
|  |       deep: true, | ||||||
|  |       immediate: true | ||||||
|  |     }, | ||||||
|  | 
 | ||||||
|  |     "goodsParams.categoryPath": { | ||||||
|  |       handler: function () { | ||||||
|  |         this.goodsData = []; | ||||||
|  |         (this.goodsParams.pageNumber = 0), this.getQueryGoodsList(); | ||||||
|  |       }, | ||||||
|  |       deep: true, | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  |   mounted() { | ||||||
|  |     this.init(); | ||||||
|  |   }, | ||||||
|  |   methods: { | ||||||
|  |     handleReachBottom() { | ||||||
|  |       setTimeout(() => { | ||||||
|  |         if ( | ||||||
|  |           this.goodsParams.pageNumber * this.goodsParams.pageSize <= | ||||||
|  |           this.total | ||||||
|  |         ) { | ||||||
|  |           this.goodsParams.pageNumber++; | ||||||
|  |           this.getQueryGoodsList(); | ||||||
|  |         } | ||||||
|  |       }, 1500); | ||||||
|  |     }, | ||||||
|  |     getQueryGoodsList() { | ||||||
|  |       API_Goods.getGoodsSkuData(this.goodsParams).then((res) => { | ||||||
|  |         this.initGoods(res); | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  | 
 | ||||||
|  |     initGoods(res) { | ||||||
|  |       if (res.result.records.length !=0) { | ||||||
|  |         res.result.records.forEach((item) => { | ||||||
|  |           item.selected = false; | ||||||
|  |           item.___type = "goods"; //设置为goods让pc wap知道标识 | ||||||
|  |            | ||||||
|  |           this.selectedWay.forEach(e => { | ||||||
|  |             if (e.id === item.id) { | ||||||
|  |               item.selected = true  | ||||||
|  |             } | ||||||
|  |           }) | ||||||
|  |         }); | ||||||
|  |         /** | ||||||
|  |          * 解决数据请求中,滚动栏会一直上下跳动 | ||||||
|  |          */ | ||||||
|  |         this.total = res.result.total; | ||||||
|  |         this.goodsData.push(...res.result.records); | ||||||
|  | 
 | ||||||
|  |       } else { | ||||||
|  |         this.empty = true; | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     // 查询商品 | ||||||
|  |     init() { | ||||||
|  |       API_Goods.getGoodsSkuData(this.goodsParams).then((res) => { | ||||||
|  |         // 商品 | ||||||
|  |         this.initGoods(res); | ||||||
|  |       }); | ||||||
|  |       if (localStorage.getItem('category')) { | ||||||
|  |         this.deepGroup(JSON.parse(localStorage.getItem('category'))) | ||||||
|  |       } else { | ||||||
|  |         setTimeout(() => { | ||||||
|  |           this.deepGroup(JSON.parse(localStorage.getItem('category'))) | ||||||
|  |         },3000) | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  | 
 | ||||||
|  |     deepGroup(val) { | ||||||
|  |       val.forEach((item) => { | ||||||
|  |         let childWay = []; //第二级 | ||||||
|  |         // 第二层 | ||||||
|  |         if (item.children) { | ||||||
|  |           item.children.forEach((child) => { | ||||||
|  |             // // 第三层 | ||||||
|  |             if (child.children) { | ||||||
|  |               child.children.forEach((grandson, index, arr) => { | ||||||
|  |                 arr[index] = { | ||||||
|  |                   value: grandson.id, | ||||||
|  |                   label: grandson.name, | ||||||
|  |                   children: "", | ||||||
|  |                 }; | ||||||
|  |               }); | ||||||
|  |             } | ||||||
|  |             let children = { | ||||||
|  |               value: child.id, | ||||||
|  |               label: child.name, | ||||||
|  |               children: child.children, | ||||||
|  |             }; | ||||||
|  |             childWay.push(children); | ||||||
|  |           }); | ||||||
|  |         } | ||||||
|  |         // 第一层 | ||||||
|  |         let way = { | ||||||
|  |           value: item.id, | ||||||
|  |           label: item.name, | ||||||
|  |           children: childWay, | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         this.skuList.push(way); | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 点击商品 | ||||||
|  |      */ | ||||||
|  |     checkedGoods(val, index) { | ||||||
|  |       // 如果单选的话 | ||||||
|  |       if (this.type != "multiple") { | ||||||
|  |         this.goodsData.forEach((item) => { | ||||||
|  |           item.selected = false; | ||||||
|  |         }); | ||||||
|  |         this.selectedWay = []; | ||||||
|  |         val.selected = true; | ||||||
|  |         this.selectedWay.push(val); | ||||||
|  | 
 | ||||||
|  |         return false; | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       if (val.selected == false) { | ||||||
|  |         val.selected = true; | ||||||
|  |         this.selectedWay.push(val); | ||||||
|  |       } else { | ||||||
|  |         val.selected = false; | ||||||
|  |         for (let i = 0; i<this.selectedWay.length; i++ ) { | ||||||
|  |           if (this.selectedWay[i].id===val.id) { | ||||||
|  |             this.selectedWay.splice(i,1) | ||||||
|  |             break; | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  | }; | ||||||
|  | </script> | ||||||
|  | <style scoped lang="scss"> | ||||||
|  | @import "./style.scss"; | ||||||
|  | .wap-content { | ||||||
|  |   width: 100%; | ||||||
|  | } | ||||||
|  | .empty { | ||||||
|  |   text-align: center; | ||||||
|  |   padding: 8px 0; | ||||||
|  |   width: 100%; | ||||||
|  | } | ||||||
|  | .wap-content { | ||||||
|  |   flex: 1; | ||||||
|  |   padding: 0; | ||||||
|  | } | ||||||
|  | .wap-content-list { | ||||||
|  |   position: relative; | ||||||
|  | } | ||||||
|  | .wap-content-item { | ||||||
|  |   width: 210px; | ||||||
|  |   margin: 10px 7px; | ||||||
|  |   padding: 6px 0; | ||||||
|  | } | ||||||
|  | // .wap-content-item{ | ||||||
|  | 
 | ||||||
|  | // } | ||||||
|  | .active { | ||||||
|  |   background: url("../../assets/selected.png") no-repeat; | ||||||
|  |   background-position: right; | ||||||
|  |   background-size: 10%; | ||||||
|  | } | ||||||
|  | </style> | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| <template> | <template> | ||||||
|   <Modal :styles="{ top: '120px' }" width="1160" @on-cancel="clickClose" @on-ok="clickOK" v-model="flag" :mask-closable="false" scrollable> |   <Modal :styles="{ top: '120px' }" width="1160" @on-cancel="clickClose" @on-ok="clickOK" v-model="flag" :mask-closable="false" scrollable> | ||||||
|     <template v-if="flag"> |     <template v-if="flag"> | ||||||
|       <goodsDialog @selected="(val) => {goodsData = val;}"  |       <goodsDialog @selected="(val) => {goodsData = val;}" | ||||||
|         v-if="goodsFlag" ref="goodsDialog" :selectedWay='goodsData'/> |         v-if="goodsFlag" ref="goodsDialog" :selectedWay='goodsData'/> | ||||||
|       <linkDialog @selectedLink=" |       <linkDialog @selectedLink=" | ||||||
|           (val) => { |           (val) => { | ||||||
|  | @ -14,10 +14,12 @@ | ||||||
| <script> | <script> | ||||||
| import goodsDialog from "./goods-dialog"; | import goodsDialog from "./goods-dialog"; | ||||||
| import linkDialog from "./link-dialog"; | import linkDialog from "./link-dialog"; | ||||||
|  | import couponDialog from "./coupon-dialog"; | ||||||
| export default { | export default { | ||||||
|   components: { |   components: { | ||||||
|     goodsDialog, |     goodsDialog, | ||||||
|     linkDialog, |     linkDialog, | ||||||
|  |     couponDialog, | ||||||
|   }, |   }, | ||||||
|   data() { |   data() { | ||||||
|     return { |     return { | ||||||
|  | @ -60,7 +62,7 @@ export default { | ||||||
|       } else { |       } else { | ||||||
|         this.goodsFlag = false; |         this.goodsFlag = false; | ||||||
|       } |       } | ||||||
|        | 
 | ||||||
|     }, |     }, | ||||||
|     close() { |     close() { | ||||||
|       this.flag = false; |       this.flag = false; | ||||||
|  |  | ||||||
|  | @ -0,0 +1,346 @@ | ||||||
|  | <template> | ||||||
|  |   <div class="sku-choose"> | ||||||
|  |     <Button @click="showDrawer=true" :icon="icon">{{ text }}</Button> | ||||||
|  |     <span @click="clearSelectData" class="clear">清空已选</span> | ||||||
|  |     <Collapse simple class="collapse"> | ||||||
|  |       <Panel name="1"> | ||||||
|  |         已选择 | ||||||
|  |         <span class="select-count">{{ selectObj.length }}</span> 件 | ||||||
|  |         <p slot="content"> | ||||||
|  |           <Tag | ||||||
|  |             v-for="(item, i) in selectObj" | ||||||
|  |             :key="i" | ||||||
|  |             :name="item.id" | ||||||
|  |             color="default" | ||||||
|  |             closable | ||||||
|  |             @on-close="handleCancelObj" | ||||||
|  |           >{{ createName(item) }} | ||||||
|  |           </Tag> | ||||||
|  |         </p> | ||||||
|  |       </Panel> | ||||||
|  |     </Collapse> | ||||||
|  |     <Drawer title="选择活动优惠券" closable v-model="showDrawer" :width="width" draggable> | ||||||
|  |       <Table | ||||||
|  |         :loading="showLoading" | ||||||
|  |         border | ||||||
|  |         :columns="tableColumns" | ||||||
|  |         :data="tableData" | ||||||
|  |         :height="height" | ||||||
|  |         ref="tableData" | ||||||
|  |       ></Table> | ||||||
|  |       <Row type="flex" justify="end" style="margin: 10px 0;"> | ||||||
|  |         <Page | ||||||
|  |           :current="searchForm.pageNumber" | ||||||
|  |           :total="tableTotal" | ||||||
|  |           :page-size="searchForm.pageSize" | ||||||
|  |           @on-change="changeDataPage" | ||||||
|  |           @on-page-size-change="changeDataPageSize" | ||||||
|  |           :page-size-opts="[10,20,50]" | ||||||
|  |           size="small" | ||||||
|  |           show-total | ||||||
|  |           show-elevator | ||||||
|  |           show-sizer | ||||||
|  |         ></Page> | ||||||
|  |       </Row> | ||||||
|  |       <div class="my-drawer-footer"> | ||||||
|  |         已选择 | ||||||
|  |         <span class="select-count">{{ selectObj.length }}</span> 件 | ||||||
|  |         <Button @click="clearSelectData" style="margin-left:10px">清空已选</Button> | ||||||
|  |         <Button @click="showDrawer=false" type="primary" style="margin-left:10px">关闭</Button> | ||||||
|  |       </div> | ||||||
|  |     </Drawer> | ||||||
|  |   </div> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  | import { | ||||||
|  |   getPlatformCouponList | ||||||
|  | } from "@/api/promotion"; | ||||||
|  | 
 | ||||||
|  | export default { | ||||||
|  |   name: "userChoose", | ||||||
|  |   props: { | ||||||
|  |     text: { | ||||||
|  |       type: String, | ||||||
|  |       default: "选择SKU" | ||||||
|  |     }, | ||||||
|  |     icon: { | ||||||
|  |       type: String, | ||||||
|  |       default: "md-basket" | ||||||
|  |     }, | ||||||
|  |     initData: { | ||||||
|  |       type: Array, | ||||||
|  |       default: [] | ||||||
|  |     }, | ||||||
|  |     createName: { | ||||||
|  |       type: Function, | ||||||
|  |       default: function (item) { | ||||||
|  |         return item.goodsName | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |   mounted() { | ||||||
|  |     this.selectObj = this.initData | ||||||
|  |     console.log(JSON.stringify(this.initData)) | ||||||
|  |   }, | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       //默认值后续计算 | ||||||
|  |       height: 500, | ||||||
|  |       width: 500, | ||||||
|  |       //加载状态 | ||||||
|  |       showLoading: true, | ||||||
|  |       //展示抽屉 | ||||||
|  |       showDrawer: false, | ||||||
|  |       selectObj: [], // 选择数据 | ||||||
|  |       searchForm: { // 请求参数 | ||||||
|  |         getType: "ACTIVITY",// 活动优惠券 | ||||||
|  |         pageNumber: 1, // 当前页数 | ||||||
|  |         pageSize: 10, // 页面大小 | ||||||
|  |         sort: "createTime", // 默认排序字段 | ||||||
|  |         order: "desc", // 默认排序方式 | ||||||
|  | 
 | ||||||
|  |       }, | ||||||
|  |       tableColumns: [ // 表头 | ||||||
|  |         { | ||||||
|  |           type: "index", | ||||||
|  |           width: 60, | ||||||
|  |           align: "center" | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "商品名称", | ||||||
|  |           key: "goodsName", | ||||||
|  |           minWidth: 140 | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "规格", | ||||||
|  |           key: "specName", | ||||||
|  |           minWidth: 140, | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "图片", | ||||||
|  |           key: "thumbnail", | ||||||
|  |           width: 80, | ||||||
|  |           align: "center", | ||||||
|  |           render: (h, params) => { | ||||||
|  |             return h("Avatar", { | ||||||
|  |               props: { | ||||||
|  |                 src: params.row.face | ||||||
|  |               } | ||||||
|  |             }); | ||||||
|  |           } | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "状态", | ||||||
|  |           key: "status", | ||||||
|  |           align: "center", | ||||||
|  |           width: 120, | ||||||
|  |           render: (h, params) => { | ||||||
|  |             if (params.row.delFlag == 0) { | ||||||
|  |               return h("div", [ | ||||||
|  |                 h("Badge", { | ||||||
|  |                   props: { | ||||||
|  |                     status: "success", | ||||||
|  |                     text: "正常" | ||||||
|  |                   } | ||||||
|  |                 }) | ||||||
|  |               ]); | ||||||
|  |             } else if (params.row.delFlag == -1) { | ||||||
|  |               return h("div", [ | ||||||
|  |                 h("Badge", { | ||||||
|  |                   props: { | ||||||
|  |                     status: "error", | ||||||
|  |                     text: "禁用" | ||||||
|  |                   } | ||||||
|  |                 }) | ||||||
|  |               ]); | ||||||
|  |             } | ||||||
|  |           } | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "创建时间", | ||||||
|  |           key: "createTime", | ||||||
|  |           sortable: true, | ||||||
|  |           sortType: "desc", | ||||||
|  |           width: 170 | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "操作", | ||||||
|  |           key: "action", | ||||||
|  |           width: 130, | ||||||
|  |           align: "center", | ||||||
|  |           fixed: "right", | ||||||
|  |           render: (h, params) => { | ||||||
|  |             let select; | ||||||
|  |             this.selectObj.forEach(item => { | ||||||
|  |               if (item.id === params.row.id) { | ||||||
|  |                 select = params.row | ||||||
|  |               } | ||||||
|  |             }); | ||||||
|  | 
 | ||||||
|  |             if (select) { | ||||||
|  |               return h("div", [ | ||||||
|  |                 h( | ||||||
|  |                   "Button", | ||||||
|  |                   { | ||||||
|  |                     props: { | ||||||
|  |                       type: "info", | ||||||
|  |                       size: "small" | ||||||
|  |                     }, | ||||||
|  |                     on: { | ||||||
|  |                       click: () => { | ||||||
|  |                         this.chooseCancel(params.row); | ||||||
|  |                       } | ||||||
|  |                     } | ||||||
|  |                   }, | ||||||
|  |                   "取消选择" | ||||||
|  |                 ) | ||||||
|  |               ]); | ||||||
|  |             } else { | ||||||
|  |               return h("div", [ | ||||||
|  |                 h( | ||||||
|  |                   "Button", | ||||||
|  |                   { | ||||||
|  |                     props: { | ||||||
|  |                       type: "info", | ||||||
|  |                       size: "small" | ||||||
|  |                     }, | ||||||
|  |                     on: { | ||||||
|  |                       click: () => { | ||||||
|  |                         this.chooseObj(params.row); | ||||||
|  |                       } | ||||||
|  |                     } | ||||||
|  |                   }, | ||||||
|  |                   "选择" | ||||||
|  |                 ) | ||||||
|  |               ]); | ||||||
|  |             } | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       ], | ||||||
|  |       tableData: [], // 表格数据 | ||||||
|  |       tableTotal: 0 // 总数 | ||||||
|  |     }; | ||||||
|  |   }, | ||||||
|  |   methods: { | ||||||
|  |     changeDataPage(v) { | ||||||
|  |       this.searchForm.pageNumber = v; | ||||||
|  |       this.searchData(); | ||||||
|  |     }, | ||||||
|  |     changeDataPageSize(v) { | ||||||
|  |       this.searchForm.pageSize = v; | ||||||
|  |       this.searchData(); | ||||||
|  |     }, | ||||||
|  |     searchData() { | ||||||
|  |       this.showLoading = true; | ||||||
|  |       getPlatformCouponList(this.searchForm).then(res => { | ||||||
|  |         this.showLoading = false; | ||||||
|  |         if (res.success) { | ||||||
|  |           this.tableData = res.result.records; | ||||||
|  |           this.tableTotal = res.result.total; | ||||||
|  |         } | ||||||
|  |       }); | ||||||
|  | 
 | ||||||
|  |     }, | ||||||
|  |     handleSearchData() { | ||||||
|  |       this.searchForm.pageNumber = 1; | ||||||
|  |       this.searchForm.pageSize = 10; | ||||||
|  |       this.searchData(); | ||||||
|  |     }, | ||||||
|  |     handleResetObj() { | ||||||
|  |       this.$refs.searchForm.resetFields(); | ||||||
|  |       this.searchForm.pageNumber = 1; | ||||||
|  |       this.searchForm.pageSize = 9; | ||||||
|  |       this.searchForm.departmentId = ""; | ||||||
|  |       // 重新加载数据 | ||||||
|  |       this.searchData(); | ||||||
|  |     }, | ||||||
|  |     setData(v) { | ||||||
|  |       this.selectObj = v; | ||||||
|  |       this.$emit("on-change", this.selectObj); | ||||||
|  |     }, | ||||||
|  |     chooseCancel(v) { | ||||||
|  |       let _index; | ||||||
|  |       this.selectObj.forEach((e, index) => { | ||||||
|  |         if (v.id == e.id) { | ||||||
|  |           _index = index; | ||||||
|  |         } | ||||||
|  |       }); | ||||||
|  | 
 | ||||||
|  |       if (_index || _index == 0) { | ||||||
|  |         this.selectObj.splice(_index, 1); | ||||||
|  |         this.$emit("on-change", this.selectObj); | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     chooseObj(v) { | ||||||
|  |       // 去重 | ||||||
|  |       let that = this; | ||||||
|  |       let flag = true; | ||||||
|  |       this.selectObj.forEach(e => { | ||||||
|  |         if (v.id == e.id) { | ||||||
|  |           flag = false; | ||||||
|  |         } | ||||||
|  |       }); | ||||||
|  |       if (flag) { | ||||||
|  |         this.selectObj.push(v); | ||||||
|  |         this.$emit("on-change", this.selectObj); | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     clearSelectData() { | ||||||
|  |       this.selectObj = []; | ||||||
|  |       this.$emit("on-change", this.selectObj); | ||||||
|  |     }, | ||||||
|  |     handleCancelObj(e, id) { | ||||||
|  |       // 删除所选用户 | ||||||
|  |       let newArray = []; | ||||||
|  |       this.selectObj.forEach(e => { | ||||||
|  |         if (id != e.id) { | ||||||
|  |           newArray.push(e); | ||||||
|  |         } | ||||||
|  |       }); | ||||||
|  |       this.selectObj = newArray; | ||||||
|  |       this.$emit("on-change", this.selectObj); | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |   created() { | ||||||
|  |     // 计算高度 | ||||||
|  |     this.height = Number(document.documentElement.clientHeight - 230); | ||||||
|  |     this.width = Number(document.documentElement.clientWidth / 2) > 900 ? 900 : Number(document.documentElement.clientWidth / 2) | ||||||
|  |     this.searchData(); | ||||||
|  | 
 | ||||||
|  |   } | ||||||
|  | }; | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <style lang="scss" scoped> | ||||||
|  | .sku-choose { | ||||||
|  |   .clear { | ||||||
|  |     font-size: 12px; | ||||||
|  |     margin-left: 15px; | ||||||
|  |     color: #40a9ff; | ||||||
|  |     cursor: pointer; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   .collapse { | ||||||
|  |     font-size: 12px; | ||||||
|  |     margin-top: 15px; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   .select-count { | ||||||
|  |     font-weight: 600; | ||||||
|  |     color: #40a9ff; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .my-drawer-footer { | ||||||
|  |   z-index: 10; | ||||||
|  |   width: 100%; | ||||||
|  |   position: absolute; | ||||||
|  |   bottom: 0; | ||||||
|  |   left: 0; | ||||||
|  |   border-top: 1px solid #e8e8e8; | ||||||
|  |   padding: 10px 16px; | ||||||
|  |   text-align: right; | ||||||
|  |   background: #fff; | ||||||
|  | } | ||||||
|  | </style> | ||||||
|  | @ -4,7 +4,7 @@ | ||||||
|       <Row> |       <Row> | ||||||
|         <Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form"> |         <Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form"> | ||||||
|           <Form-item label="活动名称" prop="couponName"> |           <Form-item label="活动名称" prop="couponName"> | ||||||
|             <Input type="text" v-model="searchForm.couponName" placeholder="请输入活动名称" clearable style="width: 200px" /> |             <Input type="text" v-model="searchForm.couponName" placeholder="请输入活动名称" clearable style="width: 200px"/> | ||||||
|           </Form-item> |           </Form-item> | ||||||
|           <Form-item label="活动状态" prop="promotionStatus"> |           <Form-item label="活动状态" prop="promotionStatus"> | ||||||
|             <Select v-model="searchForm.promotionStatus" placeholder="请选择" clearable style="width: 200px"> |             <Select v-model="searchForm.promotionStatus" placeholder="请选择" clearable style="width: 200px"> | ||||||
|  | @ -15,30 +15,32 @@ | ||||||
|             </Select> |             </Select> | ||||||
|           </Form-item> |           </Form-item> | ||||||
|           <Form-item label="活动时间"> |           <Form-item label="活动时间"> | ||||||
|             <DatePicker v-model="selectDate" type="daterange" clearable placeholder="选择起始时间" style="width: 200px"></DatePicker> |             <DatePicker v-model="selectDate" type="daterange" clearable placeholder="选择起始时间" | ||||||
|  |                         style="width: 200px"></DatePicker> | ||||||
|           </Form-item> |           </Form-item> | ||||||
|           <Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button> |           <Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button> | ||||||
|         </Form> |         </Form> | ||||||
|       </Row> |       </Row> | ||||||
|       <Row class="operation padding-row"> |       <Row class="operation padding-row"> | ||||||
|         <Button @click="add" type="primary">添加优惠券</Button> |         <Button @click="add" type="primary">添加优惠券</Button> | ||||||
|         <Button @click="()=>{$router.push({path:'/promotion/add-coupon-specify'})}">精准发劵</Button> |  | ||||||
|         <Button @click="delAll">批量下架</Button> |         <Button @click="delAll">批量下架</Button> | ||||||
|         <!-- <Button @click="upAll" >批量上架</Button> --> |         <!-- <Button @click="upAll" >批量上架</Button> --> | ||||||
|       </Row> |       </Row> | ||||||
|       <Table :loading="loading" border :columns="columns" :data="data" ref="table" sortable="custom" @on-sort-change="changeSort" @on-selection-change="changeSelect"> |       <Table :loading="loading" border :columns="columns" :data="data" ref="table" sortable="custom" | ||||||
|  |              @on-sort-change="changeSort" @on-selection-change="changeSelect"> | ||||||
|         <template slot-scope="{ row,index }" slot="action"> |         <template slot-scope="{ row,index }" slot="action"> | ||||||
|           <Button v-if="!checked && row.promotionStatus === 'NEW' || row.promotionStatus === 'CLOSE'" type="primary" size="small" style="margin-right: 10px" @click="edit(row)">编辑 |           <Button v-if="!checked && row.promotionStatus === 'NEW' || row.promotionStatus === 'CLOSE'" type="primary" | ||||||
|  |                   size="small" style="margin-right: 10px" @click="edit(row)">编辑 | ||||||
|           </Button> |           </Button> | ||||||
|           <Button v-if="!checked && row.promotionStatus === 'START' || row.promotionStatus === 'NEW'" type="error" size="small" style="margin-right: 10px" @click="remove(row)">下架 |           <Button v-if="!checked && row.promotionStatus === 'START' || row.promotionStatus === 'NEW'" type="error" | ||||||
|           </Button> |                   size="small" style="margin-right: 10px" @click="remove(row)">下架 | ||||||
|           <Button v-if="checked" :type="row.___selected ?'primary': '' "   @click="check(row,index)">{{row.___selected ?'已':''}}选中 |  | ||||||
|           </Button> |           </Button> | ||||||
|         </template> |         </template> | ||||||
|       </Table> |       </Table> | ||||||
|       <Row type="flex" justify="end" class="page"> |       <Row type="flex" justify="end" class="page"> | ||||||
|         <Page :current="searchForm.pageNumber + 1" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" |         <Page :current="searchForm.pageNumber + 1" :total="total" :page-size="searchForm.pageSize" | ||||||
|           size="small" show-total show-elevator show-sizer></Page> |               @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" | ||||||
|  |               size="small" show-total show-elevator show-sizer></Page> | ||||||
|       </Row> |       </Row> | ||||||
|     </Card> |     </Card> | ||||||
|   </div> |   </div> | ||||||
|  | @ -53,6 +55,7 @@ import { | ||||||
| export default { | export default { | ||||||
|   name: "coupon", |   name: "coupon", | ||||||
|   components: {}, |   components: {}, | ||||||
|  | 
 | ||||||
|   data() { |   data() { | ||||||
|     return { |     return { | ||||||
|       loading: true, // 表单加载状态 |       loading: true, // 表单加载状态 | ||||||
|  | @ -65,6 +68,7 @@ export default { | ||||||
|         pageSize: 10, // 页面大小 |         pageSize: 10, // 页面大小 | ||||||
|         sort: "startTime", // 默认排序字段 |         sort: "startTime", // 默认排序字段 | ||||||
|         order: "desc", // 默认排序方式 |         order: "desc", // 默认排序方式 | ||||||
|  |         getType: '', // 默认排序方式 | ||||||
|       }, |       }, | ||||||
|       form: { |       form: { | ||||||
|         // 添加或编辑表单对象初始化数据 |         // 添加或编辑表单对象初始化数据 | ||||||
|  | @ -73,7 +77,7 @@ export default { | ||||||
|       // 表单验证规则 |       // 表单验证规则 | ||||||
|       formValidate: { |       formValidate: { | ||||||
|         promotionName: [ |         promotionName: [ | ||||||
|           { required: true, message: "不能为空", trigger: "blur" }, |           {required: true, message: "不能为空", trigger: "blur"}, | ||||||
|         ], |         ], | ||||||
|       }, |       }, | ||||||
|       submitLoading: false, // 添加或编辑提交状态 |       submitLoading: false, // 添加或编辑提交状态 | ||||||
|  | @ -162,11 +166,16 @@ export default { | ||||||
|           title: "活动时间", |           title: "活动时间", | ||||||
|           width: 120, |           width: 120, | ||||||
|           render: (h, params) => { |           render: (h, params) => { | ||||||
|             return h("div", { | 
 | ||||||
|               domProps: { |             if (params.row.getType === "ACTIVITY") { | ||||||
|                 innerHTML: params.row.startTime + "<br/>" + params.row.endTime, |               return h("div", "长期有效"); | ||||||
|               }, |             } else { | ||||||
|             }); |               return h("div", { | ||||||
|  |                 domProps: { | ||||||
|  |                   innerHTML: params.row.startTime + "<br/>" + params.row.endTime, | ||||||
|  |                 }, | ||||||
|  |               }); | ||||||
|  |             } | ||||||
|           }, |           }, | ||||||
|         }, |         }, | ||||||
|         { |         { | ||||||
|  | @ -221,6 +230,16 @@ export default { | ||||||
|       type: Boolean, |       type: Boolean, | ||||||
|       default: false, |       default: false, | ||||||
|     }, |     }, | ||||||
|  |     //优惠券类型 查询参数 | ||||||
|  |     getType: { | ||||||
|  |       type: String, | ||||||
|  |       default: '' | ||||||
|  |     }, | ||||||
|  |     //已选择优惠券 | ||||||
|  |     selectList: { | ||||||
|  |       type: Array, | ||||||
|  |       default: [] | ||||||
|  |     } | ||||||
|   }, |   }, | ||||||
|   watch: { |   watch: { | ||||||
|     $route(to, from) { |     $route(to, from) { | ||||||
|  | @ -231,24 +250,21 @@ export default { | ||||||
|   }, |   }, | ||||||
|   methods: { |   methods: { | ||||||
|     // 选中优惠券 父级传值 |     // 选中优惠券 父级传值 | ||||||
|     check(val,index) { |     check() { | ||||||
| 
 |       this.$emit("selected", this.selectList); | ||||||
|       this.data[index].___selected = !this.data[index].___selected |  | ||||||
| 
 |  | ||||||
|       this.$emit("selected", val); |  | ||||||
|     }, |     }, | ||||||
|     init() { |     init() { | ||||||
|       this.getDataList(); |       this.getDataList(); | ||||||
|     }, |     }, | ||||||
|     add() { |     add() { | ||||||
|       this.$router.push({ name: "add-platform-coupon" }); |       this.$router.push({name: "add-platform-coupon"}); | ||||||
|     }, |     }, | ||||||
|     /** 跳转至领取详情页面 */ |     /** 跳转至领取详情页面 */ | ||||||
|     receiveInfo(v) { |     receiveInfo(v) { | ||||||
|       this.$router.push({ name: "member-receive-coupon", query: { id: v.id } }); |       this.$router.push({name: "member-receive-coupon", query: {id: v.id}}); | ||||||
|     }, |     }, | ||||||
|     info(v) { |     info(v) { | ||||||
|       this.$router.push({ name: "platform-coupon-info", query: { id: v.id } }); |       this.$router.push({name: "platform-coupon-info", query: {id: v.id}}); | ||||||
|     }, |     }, | ||||||
|     changePage(v) { |     changePage(v) { | ||||||
|       this.searchForm.pageNumber = v - 1; |       this.searchForm.pageNumber = v - 1; | ||||||
|  | @ -278,6 +294,7 @@ export default { | ||||||
|     changeSelect(e) { |     changeSelect(e) { | ||||||
|       this.selectList = e; |       this.selectList = e; | ||||||
|       this.selectCount = e.length; |       this.selectCount = e.length; | ||||||
|  |       this.checked ? this.check() : ''; | ||||||
|     }, |     }, | ||||||
|     getDataList() { |     getDataList() { | ||||||
|       this.loading = true; |       this.loading = true; | ||||||
|  | @ -292,7 +309,7 @@ export default { | ||||||
|       getPlatformCouponList(this.searchForm).then((res) => { |       getPlatformCouponList(this.searchForm).then((res) => { | ||||||
|         this.loading = false; |         this.loading = false; | ||||||
|         if (res.success) { |         if (res.success) { | ||||||
|           res.result.records.forEach(item=>{ |           res.result.records.forEach(item => { | ||||||
|             item.___selected = false |             item.___selected = false | ||||||
|           }) |           }) | ||||||
|           this.data = res.result.records; |           this.data = res.result.records; | ||||||
|  | @ -336,7 +353,7 @@ export default { | ||||||
|       }); |       }); | ||||||
|     }, |     }, | ||||||
|     edit(v) { |     edit(v) { | ||||||
|       this.$router.push({ name: "edit-platform-coupon", query: { id: v.id } }); |       this.$router.push({name: "edit-platform-coupon", query: {id: v.id}}); | ||||||
|     }, |     }, | ||||||
|     remove(v) { |     remove(v) { | ||||||
|       this.$Modal.confirm({ |       this.$Modal.confirm({ | ||||||
|  | @ -425,6 +442,10 @@ export default { | ||||||
|     }, |     }, | ||||||
|   }, |   }, | ||||||
|   mounted() { |   mounted() { | ||||||
|  |     //如果作为组件方式,传入了类型值,则搜索参数附加类型 | ||||||
|  |     if (this.getType) { | ||||||
|  |       this.searchForm.getType = this.getType; | ||||||
|  |     } | ||||||
|     this.init(); |     this.init(); | ||||||
|   }, |   }, | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -6,10 +6,10 @@ | ||||||
|           <h4>基本信息</h4> |           <h4>基本信息</h4> | ||||||
|           <div class="form-item-view"> |           <div class="form-item-view"> | ||||||
|             <FormItem label="活动名称" prop="promotionName"> |             <FormItem label="活动名称" prop="promotionName"> | ||||||
|               <Input type="text" v-model="form.promotionName" placeholder="活动名称" clearable style="width: 260px" /> |               <Input type="text" v-model="form.promotionName" placeholder="活动名称" clearable style="width: 260px"/> | ||||||
|             </FormItem> |             </FormItem> | ||||||
|             <FormItem label="优惠券名称" prop="couponName"> |             <FormItem label="优惠券名称" prop="couponName"> | ||||||
|               <Input type="text" v-model="form.couponName" placeholder="优惠券名称" clearable style="width: 260px" /> |               <Input type="text" v-model="form.couponName" placeholder="优惠券名称" clearable style="width: 260px"/> | ||||||
|             </FormItem> |             </FormItem> | ||||||
|             <FormItem label="优惠券类型" prop="couponType"> |             <FormItem label="优惠券类型" prop="couponType"> | ||||||
|               <Select v-model="form.couponType" style="width: 260px"> |               <Select v-model="form.couponType" style="width: 260px"> | ||||||
|  | @ -18,11 +18,11 @@ | ||||||
|               </Select> |               </Select> | ||||||
|             </FormItem> |             </FormItem> | ||||||
|             <FormItem label="折扣" prop="couponDiscount" v-if="form.couponType == 'DISCOUNT'"> |             <FormItem label="折扣" prop="couponDiscount" v-if="form.couponType == 'DISCOUNT'"> | ||||||
|               <Input type="number" v-model="form.couponDiscount" placeholder="折扣" clearable style="width: 260px" /> |               <Input type="number" v-model="form.couponDiscount" placeholder="折扣" clearable style="width: 260px"/> | ||||||
|               <span class="describe">请输入0-10之间数字,可以输入一位小数</span> |               <span class="describe">请输入0-10之间数字,可以输入一位小数</span> | ||||||
|             </FormItem> |             </FormItem> | ||||||
|             <FormItem label="面额" prop="price" v-if="form.couponType == 'PRICE'"> |             <FormItem label="面额" prop="price" v-if="form.couponType == 'PRICE'"> | ||||||
|               <Input type="text" v-model="form.price" placeholder="面额" clearable style="width: 260px" /> |               <Input type="text" v-model="form.price" placeholder="面额" clearable style="width: 260px"/> | ||||||
|             </FormItem> |             </FormItem> | ||||||
|             <FormItem label="活动类型" prop="getType"> |             <FormItem label="活动类型" prop="getType"> | ||||||
|               <Select v-model="form.getType" style="width: 260px"> |               <Select v-model="form.getType" style="width: 260px"> | ||||||
|  | @ -33,21 +33,25 @@ | ||||||
| 
 | 
 | ||||||
|             <FormItem label="店铺承担比例" prop="storeCommission"> |             <FormItem label="店铺承担比例" prop="storeCommission"> | ||||||
|               <Input v-model="form.storeCommission" placeholder="店铺承担比例" style="width: 260px"> |               <Input v-model="form.storeCommission" placeholder="店铺承担比例" style="width: 260px"> | ||||||
|               <span slot="append">%</span> |                 <span slot="append">%</span> | ||||||
|               </Input> |               </Input> | ||||||
|               <span class="describe">店铺承担比例,输入0-100之间数值</span> |               <span class="describe">店铺承担比例,输入0-100之间数值</span> | ||||||
|             </FormItem> |             </FormItem> | ||||||
|             <FormItem label="发放数量" prop="publishNum"> |             <FormItem label="发放数量" prop="publishNum" v-if="form.getType==='FREE'"> | ||||||
|               <Input v-model="form.publishNum" placeholder="发放数量" style="width: 260px" /> |               <Input v-model="form.publishNum" placeholder="发放数量" style="width: 260px"/> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="领取数量限制" prop="couponLimitNum" v-if="form.getType==='FREE'"> | ||||||
|  |               <Input v-model="form.couponLimitNum" placeholder="领取限制" clearable style="width: 260px"/> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="范围描述" prop="description"> | ||||||
|  |               <Input v-model="form.description" type="textarea" :rows="4" maxlength="50" show-word-limit clearable | ||||||
|  |                      style="width: 260px"/> | ||||||
|             </FormItem> |             </FormItem> | ||||||
|           </div> |           </div> | ||||||
|           <h4>使用限制</h4> |           <h4>使用限制</h4> | ||||||
|           <div class="form-item-view"> |           <div class="form-item-view"> | ||||||
|             <FormItem label="消费门槛" prop="consumeThreshold"> |             <FormItem label="消费门槛" prop="consumeThreshold"> | ||||||
|               <Input type="text" v-model="form.consumeThreshold" placeholder="消费门槛" clearable style="width: 260px" /> |               <Input type="text" v-model="form.consumeThreshold" placeholder="消费门槛" clearable style="width: 260px"/> | ||||||
|             </FormItem> |  | ||||||
|             <FormItem label="领取限制" prop="couponLimitNum"> |  | ||||||
|               <Input v-model="form.couponLimitNum" placeholder="领取限制" clearable style="width: 260px" /> |  | ||||||
|             </FormItem> |             </FormItem> | ||||||
|             <FormItem label="有效期" prop="rangeTime"> |             <FormItem label="有效期" prop="rangeTime"> | ||||||
|               <div v-if="form.getType == 'ACTIVITY'"> |               <div v-if="form.getType == 'ACTIVITY'"> | ||||||
|  | @ -61,12 +65,13 @@ | ||||||
|                 </RadioGroup> |                 </RadioGroup> | ||||||
|               </div> |               </div> | ||||||
|               <div v-if="rangeTimeType == 1"> |               <div v-if="rangeTimeType == 1"> | ||||||
|                 <DatePicker type="datetimerange" v-model="form.rangeTime" format="yyyy-MM-dd HH:mm:ss" placeholder="请选择" :options="options" style="width: 260px"> |                 <DatePicker type="datetimerange" v-model="form.rangeTime" format="yyyy-MM-dd HH:mm:ss" placeholder="请选择" | ||||||
|  |                             :options="options" style="width: 260px"> | ||||||
|                 </DatePicker> |                 </DatePicker> | ||||||
|               </div> |               </div> | ||||||
|               <div class="effectiveDays" v-if="rangeTimeType == 0"> |               <div class="effectiveDays" v-if="rangeTimeType == 0"> | ||||||
|                 领取当天开始 |                 领取当天开始 | ||||||
|                 <InputNumber v-model="form.effectiveDays" :min="1" style="width:100px;" :max="365" /> |                 <InputNumber v-model="form.effectiveDays" :min="1" style="width:100px;" :max="365"/> | ||||||
|                 天内有效(1-365间的整数) |                 天内有效(1-365间的整数) | ||||||
|               </div> |               </div> | ||||||
|             </FormItem> |             </FormItem> | ||||||
|  | @ -86,20 +91,17 @@ | ||||||
|               </div> |               </div> | ||||||
|               <Table border :columns="columns" :data="form.promotionGoodsList" @on-selection-change="changeSelect"> |               <Table border :columns="columns" :data="form.promotionGoodsList" @on-selection-change="changeSelect"> | ||||||
|                 <template slot-scope="{ row }" slot="QRCode"> |                 <template slot-scope="{ row }" slot="QRCode"> | ||||||
|                   <img :src="row.QRCode || '../../../assets/lili.png'" width="50px" height="50px" alt="" /> |                   <img :src="row.QRCode || '../../../assets/lili.png'" width="50px" height="50px" alt=""/> | ||||||
|                 </template> |                 </template> | ||||||
|               </Table> |               </Table> | ||||||
|             </FormItem> |             </FormItem> | ||||||
| 
 | 
 | ||||||
|             <FormItem v-if="form.scopeType == 'PORTION_GOODS_CATEGORY'"> |             <FormItem v-if="form.scopeType == 'PORTION_GOODS_CATEGORY'"> | ||||||
| 
 | 
 | ||||||
|               <Cascader @on-change="getGoodsCategory" :data="goodsCategoryList" style="width:300px;" v-model="form.scopeIdGoods"></Cascader> |               <Cascader @on-change="getGoodsCategory" :data="goodsCategoryList" style="width:300px;" | ||||||
|  |                         v-model="form.scopeIdGoods"></Cascader> | ||||||
| 
 | 
 | ||||||
|             </FormItem> |             </FormItem> | ||||||
| 
 |  | ||||||
|             <FormItem label="范围描述" prop="description"> |  | ||||||
|               <Input v-model="form.description" type="textarea" :rows="4" maxlength="50" show-word-limit clearable style="width: 260px" /> |  | ||||||
|             </FormItem> |  | ||||||
|             <div> |             <div> | ||||||
|               <Button type="text" @click="closeCurrentPage">返回</Button> |               <Button type="text" @click="closeCurrentPage">返回</Button> | ||||||
|               <Button type="primary" :loading="submitLoading" @click="handleSubmit">提交</Button> |               <Button type="primary" :loading="submitLoading" @click="handleSubmit">提交</Button> | ||||||
|  | @ -118,8 +120,8 @@ import { | ||||||
|   getPlatformCoupon, |   getPlatformCoupon, | ||||||
|   editPlatformCoupon, |   editPlatformCoupon, | ||||||
| } from "@/api/promotion"; | } from "@/api/promotion"; | ||||||
| import { getCategoryTree } from "@/api/goods"; | import {getCategoryTree} from "@/api/goods"; | ||||||
| import { regular } from "@/utils"; | import {regular} from "@/utils"; | ||||||
| import skuSelect from "@/views/lili-dialog"; | import skuSelect from "@/views/lili-dialog"; | ||||||
| 
 | 
 | ||||||
| export default { | export default { | ||||||
|  | @ -167,7 +169,7 @@ export default { | ||||||
|         /** 店铺承担比例 */ |         /** 店铺承担比例 */ | ||||||
|         storeCommission: 0, |         storeCommission: 0, | ||||||
|         /** 发行数量 */ |         /** 发行数量 */ | ||||||
|         publishNum: 1, |         publishNum: 0, | ||||||
|         /** 运费承担者 */ |         /** 运费承担者 */ | ||||||
|         scopeType: "ALL", |         scopeType: "ALL", | ||||||
|         /** 限领数量 */ |         /** 限领数量 */ | ||||||
|  | @ -193,38 +195,37 @@ export default { | ||||||
|         value: "id", |         value: "id", | ||||||
|       }, // 级联选择器配置项 |       }, // 级联选择器配置项 | ||||||
|       formRule: { |       formRule: { | ||||||
|         promotionName: [{ required: true, message: "活动名称不能为空" }], |         promotionName: [{required: true, message: "活动名称不能为空"}], | ||||||
|         couponName: [{ required: true, message: "优惠券名称不能为空" }], |         couponName: [{required: true, message: "优惠券名称不能为空"}], | ||||||
|         couponLimitNum: [{ required: true, message: "领取限制不能为空" }], |  | ||||||
|         price: [ |         price: [ | ||||||
|           { required: true, message: "请输入面额" }, |           {required: true, message: "请输入面额"}, | ||||||
|           { validator: checkPrice }, |           {validator: checkPrice}, | ||||||
|         ], |         ], | ||||||
|         rangeTime: [{ required: true, message: "请选择优惠券有效期" }], |         rangeTime: [{required: true, message: "请选择优惠券有效期"}], | ||||||
|         consumeThreshold: [ |         consumeThreshold: [ | ||||||
|           { required: true, message: "请输入消费门槛" }, |           {required: true, message: "请输入消费门槛"}, | ||||||
|           { validator: checkWeight }, |           {validator: checkWeight}, | ||||||
|         ], |         ], | ||||||
|         couponDiscount: [ |         couponDiscount: [ | ||||||
|           { required: true, message: "请输入折扣" }, |           {required: true, message: "请输入折扣"}, | ||||||
|           { |           { | ||||||
|             pattern: regular.discount, |             pattern: regular.discount, | ||||||
|             message: "请输入0-10的数字,可有一位小数", |             message: "请输入0-10的数字,可有一位小数", | ||||||
|           }, |           }, | ||||||
|         ], |         ], | ||||||
|         storeCommission: [ |         storeCommission: [ | ||||||
|           { required: true, message: "请输入店铺承担比例" }, |           {required: true, message: "请输入店铺承担比例"}, | ||||||
|           { pattern: regular.rate, message: "请输入0-100的正整数" }, |           {pattern: regular.rate, message: "请输入0-100的正整数"}, | ||||||
|         ], |         ], | ||||||
|         publishNum: [ |         publishNum: [ | ||||||
|           { required: true, message: "请输入发放数量" }, |           {required: true, message: "请输入发放数量"}, | ||||||
|           { pattern: regular.integer, message: "请输入正整数" }, |           {pattern: regular.integer, message: "请输入正整数"}, | ||||||
|         ], |         ], | ||||||
|         couponLimitNum: [ |         couponLimitNum: [ | ||||||
|           { required: true, message: "请输入领取限制" }, |           {required: true, message: "领取限制不能为空"}, | ||||||
|           { pattern: regular.integer, message: "请输入正整数" }, |           {pattern: regular.integer, message: "请输入正整数"}, | ||||||
|         ], |         ], | ||||||
|         description: [{ required: true, message: "请输入范围描述" }], |         description: [{required: true, message: "请输入范围描述"}], | ||||||
|       }, |       }, | ||||||
|       columns: [ |       columns: [ | ||||||
|         { |         { | ||||||
|  | @ -301,6 +302,7 @@ export default { | ||||||
|         if (!data.promotionGoodsList) data.promotionGoodsList = []; |         if (!data.promotionGoodsList) data.promotionGoodsList = []; | ||||||
|         if (data.scopeType == "PORTION_GOODS_CATEGORY") { |         if (data.scopeType == "PORTION_GOODS_CATEGORY") { | ||||||
|           let prevCascader = data.scopeId.split(","); |           let prevCascader = data.scopeId.split(","); | ||||||
|  | 
 | ||||||
|           // console.log(prevCascader); |           // console.log(prevCascader); | ||||||
|           function next(params, prev) { |           function next(params, prev) { | ||||||
|             for (let i = 0; i < params.length; i++) { |             for (let i = 0; i < params.length; i++) { | ||||||
|  | @ -325,6 +327,7 @@ export default { | ||||||
|               } |               } | ||||||
|             } |             } | ||||||
|           } |           } | ||||||
|  | 
 | ||||||
|           next(this.goodsCategoryList, []); |           next(this.goodsCategoryList, []); | ||||||
|           data.scopeIdGoods = prevCascader; |           data.scopeIdGoods = prevCascader; | ||||||
|         } |         } | ||||||
|  | @ -338,7 +341,7 @@ export default { | ||||||
|       this.$refs.form.validate((valid) => { |       this.$refs.form.validate((valid) => { | ||||||
|         if (valid) { |         if (valid) { | ||||||
|           const params = JSON.parse(JSON.stringify(this.form)); |           const params = JSON.parse(JSON.stringify(this.form)); | ||||||
|            // 判断当前活动类型 |           // 判断当前活动类型 | ||||||
|           params.getType != "ACTIVITY" ? delete params.effectiveDays : ""; |           params.getType != "ACTIVITY" ? delete params.effectiveDays : ""; | ||||||
| 
 | 
 | ||||||
|           //判断当前时间类型 |           //判断当前时间类型 | ||||||
|  | @ -363,7 +366,7 @@ export default { | ||||||
|             (!params.promotionGoodsList || |             (!params.promotionGoodsList || | ||||||
|               params.promotionGoodsList.length == 0) |               params.promotionGoodsList.length == 0) | ||||||
|           ) { |           ) { | ||||||
|             this.$Modal.warning({ title: "提示", content: "请选择指定商品" }); |             this.$Modal.warning({title: "提示", content: "请选择指定商品"}); | ||||||
|             return; |             return; | ||||||
|           } |           } | ||||||
| 
 | 
 | ||||||
|  | @ -371,7 +374,7 @@ export default { | ||||||
|             params.scopeType == "PORTION_GOODS_CATEGORY" && |             params.scopeType == "PORTION_GOODS_CATEGORY" && | ||||||
|             (!params.scopeIdGoods || params.scopeIdGoods.length == 0) |             (!params.scopeIdGoods || params.scopeIdGoods.length == 0) | ||||||
|           ) { |           ) { | ||||||
|             this.$Modal.warning({ title: "提示", content: "请选择商品分类" }); |             this.$Modal.warning({title: "提示", content: "请选择商品分类"}); | ||||||
|             return; |             return; | ||||||
|           } |           } | ||||||
| 
 | 
 | ||||||
|  | @ -516,7 +519,7 @@ export default { | ||||||
|             } |             } | ||||||
|           }); |           }); | ||||||
|         } |         } | ||||||
|         return { value: item.id, label: item.name, children: item.children }; |         return {value: item.id, label: item.name, children: item.children}; | ||||||
|       }); |       }); | ||||||
|     }, |     }, | ||||||
|     filterCategory(list) { |     filterCategory(list) { | ||||||
|  | @ -558,14 +561,17 @@ h4 { | ||||||
|   line-height: 40px; |   line-height: 40px; | ||||||
|   text-align: left; |   text-align: left; | ||||||
| } | } | ||||||
|  | 
 | ||||||
| .describe { | .describe { | ||||||
|   font-size: 12px; |   font-size: 12px; | ||||||
|   margin-left: 10px; |   margin-left: 10px; | ||||||
|   color: #999; |   color: #999; | ||||||
| } | } | ||||||
|  | 
 | ||||||
| .effectiveDays { | .effectiveDays { | ||||||
|   font-size: 12px; |   font-size: 12px; | ||||||
|   color: #999; |   color: #999; | ||||||
|  | 
 | ||||||
|   > * { |   > * { | ||||||
|     margin: 0 4px; |     margin: 0 4px; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | @ -0,0 +1,360 @@ | ||||||
|  | <template> | ||||||
|  |   <div class="search"> | ||||||
|  |     <Card> | ||||||
|  |       <Row class="operation padding-row"> | ||||||
|  |         <Button @click="add" type="primary">添加活动</Button> | ||||||
|  |       </Row> | ||||||
|  |       <Table :loading="loading" border :columns="columns" :data="data" ref="table" sortable="custom" | ||||||
|  |              @on-sort-change="changeSort" @on-selection-change="changeSelect"> | ||||||
|  |       </Table> | ||||||
|  |       <Row type="flex" justify="end" class="page"> | ||||||
|  |         <Page :current="searchForm.pageNumber + 1" :total="total" :page-size="searchForm.pageSize" | ||||||
|  |               @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" | ||||||
|  |               size="small" show-total show-elevator show-sizer></Page> | ||||||
|  |       </Row> | ||||||
|  |     </Card> | ||||||
|  |   </div> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  | import { | ||||||
|  |   getCouponActivityList, | ||||||
|  |   updatePlatformCouponStatus, | ||||||
|  | } from "@/api/promotion"; | ||||||
|  | 
 | ||||||
|  | export default { | ||||||
|  |   name: "coupon", | ||||||
|  |   components: {}, | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       loading: true, // 表单加载状态 | ||||||
|  |       modalType: 0, // 添加或编辑标识 | ||||||
|  |       modalVisible: false, // 添加或编辑显示 | ||||||
|  |       modalTitle: "", // 添加或编辑标题 | ||||||
|  |       searchForm: { | ||||||
|  |         // 搜索框初始化对象 | ||||||
|  |         pageNumber: 0, // 当前页数 | ||||||
|  |         pageSize: 10, // 页面大小 | ||||||
|  |         sort: "startTime", // 默认排序字段 | ||||||
|  |         order: "desc", // 默认排序方式 | ||||||
|  |       }, | ||||||
|  |       form: { | ||||||
|  |         // 添加或编辑表单对象初始化数据 | ||||||
|  |         promotionName: "", | ||||||
|  |       }, | ||||||
|  |       // 表单验证规则 | ||||||
|  |       formValidate: { | ||||||
|  |         promotionName: [ | ||||||
|  |           {required: true, message: "不能为空", trigger: "blur"}, | ||||||
|  |         ], | ||||||
|  |       }, | ||||||
|  |       submitLoading: false, // 添加或编辑提交状态 | ||||||
|  |       selectList: [], // 多选数据 | ||||||
|  |       selectCount: 0, // 多选计数 | ||||||
|  |       columns: [ | ||||||
|  |         // 表头 | ||||||
|  |         { | ||||||
|  |           title: "活动名称", | ||||||
|  |           key: "promotionName", | ||||||
|  |           minWidth: 120, | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "活动类型", | ||||||
|  |           key: "couponActivityType", | ||||||
|  |           minWidth: 120, | ||||||
|  |           render: (h, params) => { | ||||||
|  |             if (params.row.couponActivityType === 'REGISTERED') { | ||||||
|  |               return h("div", ["注册赠券"]); | ||||||
|  |             } else { | ||||||
|  |               return h("div", ["精确发券"]); | ||||||
|  |             } | ||||||
|  |           }, | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "优惠券类型", | ||||||
|  |           key: "activityScope", | ||||||
|  |           minWidth: 120, | ||||||
|  |           render: (h, params) => { | ||||||
|  |             let text = "未知"; | ||||||
|  |             if (params.row.activityScope === "DESIGNATED") { | ||||||
|  |               text = "指定会员"; | ||||||
|  |             } else { | ||||||
|  |               text = "全部会员"; | ||||||
|  |             } | ||||||
|  |             return h("div", [text]); | ||||||
|  |           }, | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "活动时间", | ||||||
|  |           minWidth: 150, | ||||||
|  |           render: (h, params) => { | ||||||
|  |             return h("div", { | ||||||
|  |               domProps: { | ||||||
|  |                 innerHTML: params.row.startTime + "<br/>" + params.row.endTime, | ||||||
|  |               }, | ||||||
|  |             }); | ||||||
|  |           }, | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "状态", | ||||||
|  |           minWidth: 80, | ||||||
|  |           key: "promotionStatus", | ||||||
|  |           fixed: "right", | ||||||
|  |           render: (h, params) => { | ||||||
|  |             let text = "未知", | ||||||
|  |               color = "red"; | ||||||
|  |             if (params.row.promotionStatus == "NEW") { | ||||||
|  |               text = "未开始"; | ||||||
|  |               color = "default"; | ||||||
|  |             } else if (params.row.promotionStatus == "START") { | ||||||
|  |               text = "已开始"; | ||||||
|  |               color = "green"; | ||||||
|  |             } else if (params.row.promotionStatus == "END") { | ||||||
|  |               text = "已结束"; | ||||||
|  |               color = "red"; | ||||||
|  |             } else if (params.row.promotionStatus == "CLOSE") { | ||||||
|  |               text = "已关闭"; | ||||||
|  |               color = "red"; | ||||||
|  |             } | ||||||
|  |             return h("div", [ | ||||||
|  |               h( | ||||||
|  |                 "Tag", | ||||||
|  |                 { | ||||||
|  |                   props: { | ||||||
|  |                     color: color, | ||||||
|  |                   }, | ||||||
|  |                 }, | ||||||
|  |                 text | ||||||
|  |               ), | ||||||
|  |             ]); | ||||||
|  |           }, | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "操作", | ||||||
|  |           slot: "action", | ||||||
|  |           align: "center", | ||||||
|  |           fixed: "right", | ||||||
|  |           minWidth: 100, | ||||||
|  |         }, | ||||||
|  |       ], | ||||||
|  |       data: [], // 表单数据 | ||||||
|  |       total: 0, // 表单数据总数 | ||||||
|  |     }; | ||||||
|  |   }, | ||||||
|  |   props: { | ||||||
|  |     // 是否为选中模式 | ||||||
|  |     checked: { | ||||||
|  |       type: Boolean, | ||||||
|  |       default: false, | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  |   watch: { | ||||||
|  |     $route(to, from) { | ||||||
|  |       if (to.fullPath == "/promotion/manager-coupon") { | ||||||
|  |         this.init(); | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  |   methods: { | ||||||
|  |     // 选中优惠券 父级传值 | ||||||
|  |     check(val, index) { | ||||||
|  | 
 | ||||||
|  |       this.data[index].___selected = !this.data[index].___selected | ||||||
|  | 
 | ||||||
|  |       this.$emit("selected", val); | ||||||
|  |     }, | ||||||
|  |     init() { | ||||||
|  |       this.getDataList(); | ||||||
|  |     }, | ||||||
|  |     add() { | ||||||
|  |       this.$router.push({name: "add-coupon-activity"}); | ||||||
|  |     }, | ||||||
|  |     /** 跳转至领取详情页面 */ | ||||||
|  |     receiveInfo(v) { | ||||||
|  |       this.$router.push({name: "member-receive-coupon", query: {id: v.id}}); | ||||||
|  |     }, | ||||||
|  |     info(v) { | ||||||
|  |       this.$router.push({name: "platform-coupon-info", query: {id: v.id}}); | ||||||
|  |     }, | ||||||
|  |     changePage(v) { | ||||||
|  |       this.searchForm.pageNumber = v - 1; | ||||||
|  |       this.getDataList(); | ||||||
|  |       this.clearSelectAll(); | ||||||
|  |     }, | ||||||
|  |     changePageSize(v) { | ||||||
|  |       this.searchForm.pageSize = v; | ||||||
|  |       this.getDataList(); | ||||||
|  |     }, | ||||||
|  |     handleSearch() { | ||||||
|  |       this.searchForm.pageNumber = 0; | ||||||
|  |       this.searchForm.pageSize = 10; | ||||||
|  |       this.getDataList(); | ||||||
|  |     }, | ||||||
|  |     changeSort(e) { | ||||||
|  |       this.searchForm.sort = e.key; | ||||||
|  |       this.searchForm.order = e.order; | ||||||
|  |       if (e.order === "normal") { | ||||||
|  |         this.searchForm.order = ""; | ||||||
|  |       } | ||||||
|  |       this.getDataList(); | ||||||
|  |     }, | ||||||
|  |     clearSelectAll() { | ||||||
|  |       this.$refs.table.selectAll(false); | ||||||
|  |     }, | ||||||
|  |     changeSelect(e) { | ||||||
|  |       this.selectList = e; | ||||||
|  |       this.selectCount = e.length; | ||||||
|  |     }, | ||||||
|  |     getDataList() { | ||||||
|  |       this.loading = true; | ||||||
|  |       if (this.selectDate && this.selectDate[0] && this.selectDate[1]) { | ||||||
|  |         this.searchForm.startTime = this.selectDate[0].getTime(); | ||||||
|  |         this.searchForm.endTime = this.selectDate[1].getTime(); | ||||||
|  |       } else { | ||||||
|  |         this.searchForm.startTime = null; | ||||||
|  |         this.searchForm.endTime = null; | ||||||
|  |       } | ||||||
|  |       // 带多条件搜索参数获取表单数据 请自行修改接口 | ||||||
|  |       getCouponActivityList(this.searchForm).then((res) => { | ||||||
|  |         this.loading = false; | ||||||
|  |         if (res.success) { | ||||||
|  |           res.result.records.forEach(item => { | ||||||
|  |             item.___selected = false | ||||||
|  |           }) | ||||||
|  |           this.data = res.result.records; | ||||||
|  |           this.total = res.result.total; | ||||||
|  |         } | ||||||
|  |       }); | ||||||
|  |       this.total = this.data.length; | ||||||
|  |       this.loading = false; | ||||||
|  |     }, | ||||||
|  |     handleSubmit() { | ||||||
|  |       this.$refs.form.validate((valid) => { | ||||||
|  |         if (valid) { | ||||||
|  |           this.submitLoading = true; | ||||||
|  |           if (this.modalType === 0) { | ||||||
|  |             // 添加 避免编辑后传入id等数据 记得删除 | ||||||
|  |             delete this.form.id; | ||||||
|  |             this.postRequest("/coupon/insertOrUpdate", this.form).then( | ||||||
|  |               (res) => { | ||||||
|  |                 this.submitLoading = false; | ||||||
|  |                 if (res.success) { | ||||||
|  |                   this.$Message.success("操作成功"); | ||||||
|  |                   this.getDataList(); | ||||||
|  |                   this.modalVisible = false; | ||||||
|  |                 } | ||||||
|  |               } | ||||||
|  |             ); | ||||||
|  |           } else { | ||||||
|  |             // 编辑 | ||||||
|  |             this.postRequest("/coupon/insertOrUpdate", this.form).then( | ||||||
|  |               (res) => { | ||||||
|  |                 this.submitLoading = false; | ||||||
|  |                 if (res.success) { | ||||||
|  |                   this.$Message.success("操作成功"); | ||||||
|  |                   this.getDataList(); | ||||||
|  |                   this.modalVisible = false; | ||||||
|  |                 } | ||||||
|  |               } | ||||||
|  |             ); | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     edit(v) { | ||||||
|  |       this.$router.push({name: "edit-platform-coupon", query: {id: v.id}}); | ||||||
|  |     }, | ||||||
|  |     remove(v) { | ||||||
|  |       this.$Modal.confirm({ | ||||||
|  |         title: "确认下架", | ||||||
|  |         // 记得确认修改此处 | ||||||
|  |         content: "确认要下架此优惠券么?", | ||||||
|  |         loading: true, | ||||||
|  |         onOk: () => { | ||||||
|  |           // 删除 | ||||||
|  |           updatePlatformCouponStatus({ | ||||||
|  |             couponIds: v.id, | ||||||
|  |             promotionStatus: "CLOSE", | ||||||
|  |           }) | ||||||
|  |             .then((res) => { | ||||||
|  |               this.$Modal.remove(); | ||||||
|  |               if (res.success) { | ||||||
|  |                 this.$Message.success("优惠券已作废"); | ||||||
|  |                 this.getDataList(); | ||||||
|  |               } | ||||||
|  |             }) | ||||||
|  |             .catch(() => { | ||||||
|  |               this.$Modal; | ||||||
|  |             }); | ||||||
|  |         }, | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     delAll() { | ||||||
|  |       if (this.selectCount <= 0) { | ||||||
|  |         this.$Message.warning("您还未选择要下架的优惠券"); | ||||||
|  |         return; | ||||||
|  |       } | ||||||
|  |       this.$Modal.confirm({ | ||||||
|  |         title: "确认下架", | ||||||
|  |         content: "您确认要下架所选的 " + this.selectCount + " 条数据?", | ||||||
|  |         loading: true, | ||||||
|  |         onOk: () => { | ||||||
|  |           let ids = []; | ||||||
|  |           this.selectList.forEach(function (e) { | ||||||
|  |             ids.push(e.id); | ||||||
|  |           }); | ||||||
|  |           let params = { | ||||||
|  |             couponIds: ids.toString(), | ||||||
|  |             promotionStatus: "CLOSE", | ||||||
|  |           }; | ||||||
|  |           // 批量删除 | ||||||
|  |           updatePlatformCouponStatus(params).then((res) => { | ||||||
|  |             this.$Modal.remove(); | ||||||
|  |             if (res.success) { | ||||||
|  |               this.$Message.success("下架成功"); | ||||||
|  |               this.clearSelectAll(); | ||||||
|  |               this.getDataList(); | ||||||
|  |             } | ||||||
|  |           }); | ||||||
|  |         }, | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     upAll() { | ||||||
|  |       if (this.selectCount <= 0) { | ||||||
|  |         this.$Message.warning("请选择要上架的优惠券"); | ||||||
|  |         return; | ||||||
|  |       } | ||||||
|  |       this.$Modal.confirm({ | ||||||
|  |         title: "确认上架", | ||||||
|  |         content: "您确认要上架所选的 " + this.selectCount + " 条数据?", | ||||||
|  |         loading: true, | ||||||
|  |         onOk: () => { | ||||||
|  |           let ids = []; | ||||||
|  |           this.selectList.forEach(function (e) { | ||||||
|  |             ids.push(e.id); | ||||||
|  |           }); | ||||||
|  |           let params = { | ||||||
|  |             couponIds: ids.toString(), | ||||||
|  |             promotionStatus: "START", | ||||||
|  |           }; | ||||||
|  |           // 批量上架 | ||||||
|  |           updatePlatformCouponStatus(params).then((res) => { | ||||||
|  |             this.$Modal.remove(); | ||||||
|  |             if (res.success) { | ||||||
|  |               this.$Message.success("上架成功"); | ||||||
|  |               this.clearSelectAll(); | ||||||
|  |               this.getDataList(); | ||||||
|  |             } | ||||||
|  |           }); | ||||||
|  |         }, | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  |   mounted() { | ||||||
|  |     this.init(); | ||||||
|  |   }, | ||||||
|  | }; | ||||||
|  | </script> | ||||||
|  | <style lang="scss"> | ||||||
|  | @import "@/styles/table-common.scss"; | ||||||
|  | </style> | ||||||
|  | @ -0,0 +1,240 @@ | ||||||
|  | <template> | ||||||
|  |   <div> | ||||||
|  |     <div class="content-goods-publish"> | ||||||
|  |       <Form ref="form" :model="form" :label-width="130"> | ||||||
|  |         <div class="base-info-item"> | ||||||
|  |           <h4>平台券活动详情</h4> | ||||||
|  |           <div class="form-item-view"> | ||||||
|  |             <FormItem label="活动名称"> | ||||||
|  |               <span class="goods-category-name">{{ form.promotionName }}</span> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="活动类型"> | ||||||
|  |               <span class="goods-category-name">{{ | ||||||
|  |                 getCouponType(form.couponType) | ||||||
|  |               }}</span> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="面额"> | ||||||
|  |               <span class="goods-category-name"> ¥{{ form.price | unitPrice }}</span> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="活动说明"> | ||||||
|  |               <span class="goods-category-name">{{ form.description }}</span> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="发放总数"> | ||||||
|  |               <span class="goods-category-name">{{ form.publishNum }}</span> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="领取限制"> | ||||||
|  |               <span class="goods-category-name">{{ form.limitNum }}</span> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="活动开始时间"> | ||||||
|  |               <span class="goods-category-name">{{ form.startTime }}</span> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="消费限额"> | ||||||
|  |               <span class="goods-category-name">{{ | ||||||
|  |                 form.consumptionLimit | ||||||
|  |               }}</span> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="使用有效期"> | ||||||
|  |               <span class="goods-category-name">{{ form.startTime }} 至 {{ form.endTime }}</span> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="适用品类范围"> | ||||||
|  |               <span class="goods-category-name">{{ | ||||||
|  |                 getScopeType(form.scopeType) | ||||||
|  |               }}</span> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="品类范围描述"> | ||||||
|  |               <span class="goods-category-name">{{ form.couponName }}</span> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="状态"> | ||||||
|  |               <span class="goods-category-name">{{ | ||||||
|  |                 getStatus(form.status) | ||||||
|  |               }}</span> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="优惠券类型"> | ||||||
|  |               <span class="goods-category-name">{{ | ||||||
|  |                 getType(form.getType) | ||||||
|  |               }}</span> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="活动创建时间"> | ||||||
|  |               <span class="goods-category-name">{{ form.createTime }}</span> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="活动最后更新时间"> | ||||||
|  |               <span class="goods-category-name">{{ form.updateTime }}</span> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="更新管理员名称"> | ||||||
|  |               <span class="goods-category-name">{{ form.updateBy }}</span> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="已发放数量"> | ||||||
|  |               <span class="goods-category-name">{{ form.receivedNum }}</span> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="已使用数量"> | ||||||
|  |               <span class="goods-category-name">{{ form.usedNum }}</span> | ||||||
|  |             </FormItem> | ||||||
|  |           </div> | ||||||
|  |           <h4>适用品类范围</h4> | ||||||
|  |           <div> | ||||||
|  |             <Table :loading="loading" border :columns="columns1" :data="data1" ref="table" sortable="custom" @on-sort-change="changeSort" @on-selection-change="changeSelect"></Table> | ||||||
|  |             <Row type="flex" justify="end" class="page"> | ||||||
|  |               <Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" | ||||||
|  |                 size="small" show-total show-elevator show-sizer></Page> | ||||||
|  |             </Row> | ||||||
|  |           </div> | ||||||
|  |         </div> | ||||||
|  |       </Form> | ||||||
|  |     </div> | ||||||
|  | 
 | ||||||
|  |     <div class="footer"> | ||||||
|  |       <Button type="primary" @click="back">返回活动列表</Button> | ||||||
|  |     </div> | ||||||
|  |   </div> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  | import { getPlatformCoupon } from "@/api/promotion"; | ||||||
|  | 
 | ||||||
|  | import uploadPicThumb from "@/views/my-components/lili/upload-pic-thumb"; | ||||||
|  | import editor from "@/views/my-components/lili/editor"; | ||||||
|  | 
 | ||||||
|  | export default { | ||||||
|  |   name: "addCoupon", | ||||||
|  |   components: { | ||||||
|  |     uploadPicThumb, | ||||||
|  |     editor, | ||||||
|  |   }, | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       modalType: 0, // 当前类型 | ||||||
|  |       loading: false, // 表单加载状态 | ||||||
|  |       searchForm: { | ||||||
|  |         // 搜索框初始化对象 | ||||||
|  |         pageNumber: 1, // 当前页数 | ||||||
|  |         pageSize: 10, // 页面大小 | ||||||
|  |         sort: "createTime", // 默认排序字段 | ||||||
|  |         order: "desc", // 默认排序方式 | ||||||
|  |       }, | ||||||
|  |       form: { | ||||||
|  |         /** 店铺承担比例 */ | ||||||
|  |         sellerCommission: 0, | ||||||
|  |         /** 发行数量 */ | ||||||
|  |         publishNum: 1, | ||||||
|  |         /** 运费承担者 */ | ||||||
|  |         scopeType: "ALL", | ||||||
|  |         /** 消费限额 */ | ||||||
|  |         consumptionLimit: "", | ||||||
|  |         /** 限领数量 */ | ||||||
|  |         limitNum: 1, | ||||||
|  |         /** 活动类型 */ | ||||||
|  |         couponType: "", | ||||||
|  |         /** 优惠券名称 */ | ||||||
|  |         couponName: "", | ||||||
|  |         /** 已被使用数量 */ | ||||||
|  |         usedNum: 0, | ||||||
|  |         /** 已被领取的数量 */ | ||||||
|  |         receivedNum: 0, | ||||||
|  |       }, | ||||||
|  |       id: this.$route.query.id, | ||||||
|  |       columns1: [ | ||||||
|  |         { | ||||||
|  |           title: "一级类目", | ||||||
|  |           key: "name", | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "二级类目", | ||||||
|  |           key: "age", | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "三级类目", | ||||||
|  |           key: "address", | ||||||
|  |         }, | ||||||
|  |       ], | ||||||
|  |       data1: [ | ||||||
|  |         { | ||||||
|  |           name: "王小明", | ||||||
|  |           age: 18, | ||||||
|  |           address: "北京市朝阳区芍药居", | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           name: "张小刚", | ||||||
|  |           age: 25, | ||||||
|  |           address: "北京市海淀区西二旗", | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           name: "李小红", | ||||||
|  |           age: 30, | ||||||
|  |           address: "上海市浦东新区世纪大道", | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           name: "周小伟", | ||||||
|  |           age: 26, | ||||||
|  |           address: "深圳市南山区深南大道", | ||||||
|  |         }, | ||||||
|  |       ], | ||||||
|  |       submitLoading: false, // 添加或编辑提交状态 | ||||||
|  |     }; | ||||||
|  |   }, | ||||||
|  |   mounted() { | ||||||
|  |     // 如果id不为空则查询信息 | ||||||
|  |     if (this.id) { | ||||||
|  |       this.getCoupon(); | ||||||
|  |       this.modalType = 1; | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |   methods: { | ||||||
|  |     getCouponType(value) { | ||||||
|  |       switch (value) { | ||||||
|  |         case "POINT": | ||||||
|  |           return "打折"; | ||||||
|  |         case "PRICE": | ||||||
|  |           return "减免现金"; | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     /** 获取状态 */ | ||||||
|  |     getStatus(value) { | ||||||
|  |       switch (value) { | ||||||
|  |         case "NEW": | ||||||
|  |           return "新建"; | ||||||
|  |         case "START": | ||||||
|  |           return "开始"; | ||||||
|  |         case "LOWER": | ||||||
|  |           return "结束"; | ||||||
|  |         case "CANCEL": | ||||||
|  |           return "作废"; | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     /** 关联范围类型 */ | ||||||
|  |     getScopeType(value) { | ||||||
|  |       switch (value) { | ||||||
|  |         case "PORTION_CATEGORY": | ||||||
|  |           return "部分商品分类"; | ||||||
|  |         case "PORTION_GOODS": | ||||||
|  |           return "指定商品"; | ||||||
|  |         case "ALL": | ||||||
|  |           return "全品类"; | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     /** 优惠券类型 */ | ||||||
|  |     getType(value) { | ||||||
|  |       switch (value) { | ||||||
|  |         case "FREE": | ||||||
|  |           return "免费获取"; | ||||||
|  |         case "ACTIVITY": | ||||||
|  |           return "活动获取"; | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  | 
 | ||||||
|  |     getCoupon() { | ||||||
|  |       getPlatformCoupon(this.id).then((res) => { | ||||||
|  |         this.form = res.result; | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     back() { | ||||||
|  |       this.$store.commit("removeTag", "platform-coupon-info"); | ||||||
|  |       this.$router.go(-1); | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  | }; | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <style lang="scss" scoped> | ||||||
|  | @import "couponPublish.scss"; | ||||||
|  | </style> | ||||||
|  | 
 | ||||||
|  | @ -0,0 +1,257 @@ | ||||||
|  | /*选择商品品类*/ | ||||||
|  | .content-goods-publish { | ||||||
|  |   padding: 15px; | ||||||
|  |   margin: 0 auto; | ||||||
|  |   text-align: center; | ||||||
|  |   border: 1px solid #ddd; | ||||||
|  |   background: none repeat 0 0 #fff; | ||||||
|  |   height: 100%; | ||||||
|  |   margin-bottom: 20px; | ||||||
|  | 
 | ||||||
|  |   /*商品品类*/ | ||||||
|  |   .goods-category { | ||||||
|  |     text-align: left; | ||||||
|  |     padding: 10px; | ||||||
|  |     background: #fafafa; | ||||||
|  |     border: 1px solid #e6e6e6; | ||||||
|  | 
 | ||||||
|  |     ul { | ||||||
|  |       padding: 8px 4px 8px 8px; | ||||||
|  |       list-style: none; | ||||||
|  |       width: 300px; | ||||||
|  |       background: none repeat 0 0 #fff; | ||||||
|  |       border: 1px solid #e6e6e6; | ||||||
|  |       display: inline-block; | ||||||
|  |       letter-spacing: normal; | ||||||
|  |       margin-right: 15px; | ||||||
|  |       vertical-align: top; | ||||||
|  |       word-spacing: normal; | ||||||
|  | 
 | ||||||
|  |       li { | ||||||
|  |         line-height: 20px; | ||||||
|  |         padding: 5px; | ||||||
|  |         cursor: pointer; | ||||||
|  |         color: #333; | ||||||
|  |         font-size: 12px; | ||||||
|  |         display: flex; | ||||||
|  |         flex-wrap: nowrap; | ||||||
|  |         flex-direction: row; | ||||||
|  |         justify-content: space-between; | ||||||
|  |         align-items: center; | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   /** 当前品类被选中的样式 */ | ||||||
|  |   .activeClass { | ||||||
|  |     background-color: #d9edf7; | ||||||
|  |     border: 1px solid #bce8f1; | ||||||
|  |     color: #3a87ad; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   /*!*当前选择的商品品类文字*!*/ | ||||||
|  |   .current-goods-category { | ||||||
|  |     text-align: left; | ||||||
|  |     padding: 10px; | ||||||
|  |     width: 100%; | ||||||
|  |     border: 1px solid #fbeed5; | ||||||
|  |     color: #c09853; | ||||||
|  |     background-color: #fcf8e3; | ||||||
|  |     margin: 10px auto; | ||||||
|  |     padding: 8px 35px 8px 14px; | ||||||
|  |     text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); | ||||||
|  |     font-size: 12px; | ||||||
|  |     font-weight: bold; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /*编辑基本信息*/ | ||||||
|  | .el-form { | ||||||
|  |   padding-bottom: 80px; | ||||||
|  | 
 | ||||||
|  |   .el-form-item { | ||||||
|  |     width: 100%; | ||||||
|  |     color: gray; | ||||||
|  |     text-align: left; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | div.base-info-item { | ||||||
|  | 
 | ||||||
|  |   h4 { | ||||||
|  |     margin-bottom: 10px; | ||||||
|  |     padding: 0 10px; | ||||||
|  |     border: 1px solid #ddd; | ||||||
|  |     background-color: #f8f8f8; | ||||||
|  |     font-weight: bold; | ||||||
|  |     color: #333; | ||||||
|  |     font-size: 14px; | ||||||
|  |     line-height: 40px; | ||||||
|  |     text-align: left; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   .form-item-view { | ||||||
|  |     display: flex; | ||||||
|  |     flex-direction: column; | ||||||
|  |     align-items: flex-start; | ||||||
|  |     justify-content: space-between; | ||||||
|  |     padding-left: 80px; | ||||||
|  | 
 | ||||||
|  |     .shop-category-text { | ||||||
|  |       font-size: 12px; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   .item-goods-properts-row { | ||||||
|  |     display: flex; | ||||||
|  |     flex-direction: row; | ||||||
|  |     word-break: break-all; | ||||||
|  |     white-space: normal; | ||||||
|  |     width: 300px; | ||||||
|  |     height: 100px; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   .item-goods-properts { | ||||||
|  |     display: flex; | ||||||
|  |     flex-direction: row; | ||||||
|  |     margin-bottom: 10px; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   .form-item { | ||||||
|  |     display: flex; | ||||||
|  |     align-items: center; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |   /** 审核信息-拒绝原因 */ | ||||||
|  |   .auth-info { | ||||||
|  |     color: red; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   .el-form-item { | ||||||
|  |     width: 30%; | ||||||
|  |     min-width: 300px; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   .goods-name-width { | ||||||
|  |     width: 50%; | ||||||
|  |     min-width: 300px; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   .el-form-item__content { | ||||||
|  |     margin-left: 120px; | ||||||
|  |     text-align: left; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   p.goods-group-manager { | ||||||
|  |     padding-left: 7.5%; | ||||||
|  |     text-align: left; | ||||||
|  |     color: #999; | ||||||
|  |     font-size: 13px; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   /*teatarea*/ | ||||||
|  |   /deep/ .el-textarea { | ||||||
|  |     width: 150%; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   .seo-text { | ||||||
|  |     width: 150%; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /*折叠面板*/ | ||||||
|  | .el-collapse-item { | ||||||
|  |   /deep/ .el-collapse-item__header { | ||||||
|  |     text-align: left; | ||||||
|  |     background-color: #f8f8f8; | ||||||
|  |     padding: 0 10px; | ||||||
|  |     font-weight: bold; | ||||||
|  |     color: #333; | ||||||
|  |     font-size: 14px; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   .el-form-item { | ||||||
|  |     margin-left: 5%; | ||||||
|  |     width: 25%; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   /deep/ .el-form-item__content { | ||||||
|  |     margin-left: 120px; | ||||||
|  |     text-align: left; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   p.goods-group-manager { | ||||||
|  |     padding-left: 12%; | ||||||
|  |     text-align: left; | ||||||
|  |     color: #999; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   /deep/ .el-collapse-item__content { | ||||||
|  |     padding: 10px 0; | ||||||
|  |     text-align: left; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /*商品描述*/ | ||||||
|  | .goods-intro { | ||||||
|  |   line-height: 40; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /** 底部步骤 */ | ||||||
|  | .footer { | ||||||
|  |   width: 88.7%; | ||||||
|  |   padding: 10px; | ||||||
|  |   background-color: #ffc; | ||||||
|  |   position: fixed; | ||||||
|  |   bottom: 0px; | ||||||
|  |   left: 10%; | ||||||
|  |   text-align: center; | ||||||
|  |   z-index: 9999; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /*图片上传组件第一张图设置封面*/ | ||||||
|  | .goods-images { | ||||||
|  |   /deep/ li.el-upload-list__item:first-child { | ||||||
|  |     position: relative; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   /deep/ li.el-upload-list__item:first-child:after { | ||||||
|  |     content: "封"; | ||||||
|  |     color: #fff; | ||||||
|  |     font-weight: bold; | ||||||
|  |     font-size: 12px; | ||||||
|  |     position: absolute; | ||||||
|  |     left: -15px; | ||||||
|  |     top: -6px; | ||||||
|  |     width: 40px; | ||||||
|  |     height: 24px; | ||||||
|  |     padding-top: 6px; | ||||||
|  |     background: #13ce66; | ||||||
|  |     text-align: center; | ||||||
|  |     -webkit-transform: rotate(-45deg); | ||||||
|  |     transform: rotate(-45deg); | ||||||
|  |     -webkit-box-shadow: 0 0 1pc 1px rgba(0, 0, 0, 0.2); | ||||||
|  |     box-shadow: 0 0 1pc 1px rgba(0, 0, 0, 0.2); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .el-form-item__label { | ||||||
|  |   word-break: break-all; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .step-view { | ||||||
|  |   width: 33%; | ||||||
|  |   height: 40px; | ||||||
|  |   font-size: 19px; | ||||||
|  |   text-align: center; | ||||||
|  |   display: flex; | ||||||
|  |   background-color: #fff; | ||||||
|  |   justify-content: center; | ||||||
|  |   align-items: center; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .page { | ||||||
|  |   margin-top: 2vh; | ||||||
|  |   margin-bottom: 5vh; | ||||||
|  | } | ||||||
|  | @ -0,0 +1,354 @@ | ||||||
|  | <template> | ||||||
|  |   <div> | ||||||
|  |     <Card> | ||||||
|  |       <Form ref="form" :model="form" :label-width="120" :rules="formRule"> | ||||||
|  |         <div class="base-info-item"> | ||||||
|  |           <h4>活动信息</h4> | ||||||
|  |           <div class="form-item-view"> | ||||||
|  |             <FormItem label="活动名称" prop="promotionName"> | ||||||
|  |               <Input type="text" v-model="form.promotionName" placeholder="活动名称" clearable style="width: 260px"/> | ||||||
|  |             </FormItem> | ||||||
|  | 
 | ||||||
|  |             <FormItem label="活动时间"> | ||||||
|  |               <DatePicker type="datetimerange" v-model="rangeTime" format="yyyy-MM-dd HH:mm:ss" placeholder="请选择" | ||||||
|  |                           :options="options" style="width: 260px"> | ||||||
|  |               </DatePicker> | ||||||
|  |             </FormItem> | ||||||
|  | 
 | ||||||
|  |             <FormItem label="优惠券活动类型" prop="couponActivityType"> | ||||||
|  |               <RadioGroup type="button" button-style="solid" v-model="form.couponActivityType"> | ||||||
|  |                 <Radio label="REGISTERED">新人发券</Radio> | ||||||
|  |                 <Radio label="SPECIFY">精确发券</Radio> | ||||||
|  |               </RadioGroup> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="活动范围" prop="activityScope" v-if="form.couponActivityType==='SPECIFY'"> | ||||||
|  |               <RadioGroup type="button" button-style="solid" v-model="form.activityScope"> | ||||||
|  |                 <Radio label="ALL">全部会员</Radio> | ||||||
|  |                 <Radio label="DESIGNATED">指定会员</Radio> | ||||||
|  |               </RadioGroup> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="选择会员" prop="scopeType" | ||||||
|  |                       v-if="form.couponActivityType==='SPECIFY' && form.activityScope==='DESIGNATED'"> | ||||||
|  |               <Button type="primary" icon="ios-add" @click="addVip" ghost>选择会员</Button> | ||||||
|  |             </FormItem> | ||||||
|  |             {{ selectedMember }} | ||||||
|  | 
 | ||||||
|  |             <FormItem label="活动描述" prop="activityScopeInfo"> | ||||||
|  |               <Input v-model="form.activityScopeInfo" type="textarea" :rows="4" maxlength="50" show-word-limit clearable | ||||||
|  |                      style="width: 260px"/> | ||||||
|  |             </FormItem> | ||||||
|  |           </div> | ||||||
|  |           <h4>配置优惠券</h4> | ||||||
|  |           <div class="form-item-view"> | ||||||
|  |             <FormItem label="选择优惠券" prop="scopeType"> | ||||||
|  |               <Button type="primary" :loading="submitLoading" @click="showSelector">选择优惠券</Button> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="赠送配置" prop="scopeType"> | ||||||
|  | 
 | ||||||
|  |               <Table border :columns="columns" :data="this.selectCouponList"> | ||||||
|  |                 <template slot="sendNum" slot-scope="scope"> | ||||||
|  |                   <Input type="text" v-model="form.couponActivityItems[scope.index].num" placeholder="赠送数量"/> | ||||||
|  |                   <Input type="text" v-model="form.couponActivityItems[scope.index].couponId" v-show="false"/> | ||||||
|  |                 </template> | ||||||
|  |               </Table> | ||||||
|  |             </FormItem> | ||||||
|  | 
 | ||||||
|  |             <div> | ||||||
|  |               <Button type="text" @click="closeCurrentPage">返回</Button> | ||||||
|  |               <Button type="primary" :loading="submitLoading" @click="handleSubmit">提交</Button> | ||||||
|  |             </div> | ||||||
|  |           </div> | ||||||
|  |         </div> | ||||||
|  |       </Form> | ||||||
|  |     </Card> | ||||||
|  |     <Modal v-model="showCouponSelect" width="80%"> | ||||||
|  |       <couponTemplate :checked="true" :selectList="selectCouponList" getType="ACTIVITY" @selected="selectedCoupon"/> | ||||||
|  |     </Modal> | ||||||
|  | 
 | ||||||
|  |     <Modal width="1200" v-model="checkUserList"> | ||||||
|  |       <userList @callback="callbackSelectUser" ref="memberLayout"/> | ||||||
|  |     </Modal> | ||||||
|  |   </div> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  | import couponTemplate from "@/views/promotion/coupon/coupon"; | ||||||
|  | 
 | ||||||
|  | import userList from "@/views/member/list/index"; | ||||||
|  | 
 | ||||||
|  | import { | ||||||
|  |   saveActivityCoupon, | ||||||
|  |   updateCouponActivity, | ||||||
|  | } from "@/api/promotion"; | ||||||
|  | 
 | ||||||
|  | export default { | ||||||
|  |   name: "addCouponActivity", | ||||||
|  |   components: { | ||||||
|  |     couponTemplate, | ||||||
|  |     userList, | ||||||
|  |   }, | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       showCouponSelect: false,//显示优惠券选择框 | ||||||
|  |       modalType: 0, // 是否编辑 | ||||||
|  |       rangeTime: '',//时间区间 | ||||||
|  |       checkUserList: false,//会员选择器 | ||||||
|  |       selectedMember: [],//选择的会员 | ||||||
|  |       form: { | ||||||
|  |         promotionName: '', //活动名称 | ||||||
|  |         activityScope: 'ALL',  //活动范围 | ||||||
|  |         couponActivityType: 'REGISTERED', //触发活动方式 | ||||||
|  |         activityScopeInfo: '', //活动描述 | ||||||
|  |         startTime: '', //开始时间 | ||||||
|  |         endTime: '', //结束时间 | ||||||
|  |         couponActivityItems: [] | ||||||
|  | 
 | ||||||
|  |       }, // 表单 | ||||||
|  |       id: this.$route.query.id, // 优惠券活动id | ||||||
|  |       submitLoading: false, // 添加或编辑提交状态 | ||||||
|  |       selectCouponList: [],//选择的优惠券列表 | ||||||
|  |       formRule: { | ||||||
|  |         promotionName: [{required: true, message: "活动名称不能为空"}], | ||||||
|  |         rangeTime: [{required: true, message: "请选择活动有效期"}], | ||||||
|  |         description: [{required: true, message: "请输入范围描述"}], | ||||||
|  |       }, | ||||||
|  |       //优惠券表哥 | ||||||
|  |       columns: [ | ||||||
|  |         { | ||||||
|  |           title: "优惠券名称", | ||||||
|  |           key: "couponName", | ||||||
|  |           minWidth: 120, | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "品类描述", | ||||||
|  |           key: "scopeType", | ||||||
|  |           width: 100, | ||||||
|  |           render: (h, params) => { | ||||||
|  |             let text = "未知"; | ||||||
|  |             if (params.row.scopeType == "ALL") { | ||||||
|  |               text = "全品类"; | ||||||
|  |             } else if (params.row.scopeType == "PORTION_GOODS_CATEGORY") { | ||||||
|  |               text = "商品分类"; | ||||||
|  |             } else if (params.row.scopeType == "PORTION_SHOP_CATEGORY") { | ||||||
|  |               text = "店铺分类"; | ||||||
|  |             } else if (params.row.scopeType == "PORTION_GOODS") { | ||||||
|  |               text = "指定商品"; | ||||||
|  |             } | ||||||
|  |             return h("div", [text]); | ||||||
|  |           }, | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "面额/折扣", | ||||||
|  |           key: "couponName", | ||||||
|  |           minWidth: 120, | ||||||
|  |           render: (h, params) => { | ||||||
|  |             if (params.row.price) { | ||||||
|  |               return h( | ||||||
|  |                 "div", | ||||||
|  |                 this.$options.filters.unitPrice(params.row.price, "¥") | ||||||
|  |               ); | ||||||
|  |             } else { | ||||||
|  |               return h("div", params.row.couponDiscount + "折"); | ||||||
|  |             } | ||||||
|  |           }, | ||||||
|  |         }, | ||||||
|  | 
 | ||||||
|  |         { | ||||||
|  |           title: "赠送数量", | ||||||
|  |           type: "template", | ||||||
|  |           slot: "sendNum", | ||||||
|  |           minWidth: 120, | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "操作", | ||||||
|  |           key: "action", | ||||||
|  |           minWidth: 50, | ||||||
|  |           align: "center", | ||||||
|  |           render: (h, params) => { | ||||||
|  |             return h( | ||||||
|  |               "Button", | ||||||
|  |               { | ||||||
|  |                 props: { | ||||||
|  |                   size: "small", | ||||||
|  |                   type: "error", | ||||||
|  |                   ghost: true, | ||||||
|  |                 }, | ||||||
|  |                 on: { | ||||||
|  |                   click: () => { | ||||||
|  |                     // this.delGoods(params.index); | ||||||
|  |                   }, | ||||||
|  |                 }, | ||||||
|  |               }, | ||||||
|  |               "删除" | ||||||
|  |             ); | ||||||
|  |           }, | ||||||
|  |         }, | ||||||
|  |       ], | ||||||
|  |     }; | ||||||
|  |   }, | ||||||
|  |   async mounted() { | ||||||
|  |     // 如果id不为空则查询信息 | ||||||
|  |     if (this.id) { | ||||||
|  |       this.getCoupon(); | ||||||
|  |       this.modalType = 1; | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |   methods: { | ||||||
|  | 
 | ||||||
|  |     // 返回已选择的用户 | ||||||
|  |     callbackSelectUser(val) { | ||||||
|  |       let index = this.selectedMember.indexOf(val) | ||||||
|  |       if (index > 0) { | ||||||
|  |         this.selectedMember.remove(val); | ||||||
|  |       } | ||||||
|  |       this.selectedMember.push(val); | ||||||
|  |     }, | ||||||
|  | 
 | ||||||
|  |     // 添加指定用户 | ||||||
|  |     addVip() { | ||||||
|  |       this.checkUserList = true; | ||||||
|  |       this.$nextTick(() => { | ||||||
|  |         this.$refs.memberLayout.selectedMember = true; | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     //显示优惠券选择框 | ||||||
|  |     showSelector() { | ||||||
|  |       this.showCouponSelect = true; | ||||||
|  |     }, | ||||||
|  |     /** | ||||||
|  |      * 返回优惠券*/ | ||||||
|  |     selectedCoupon(val) { | ||||||
|  |       this.selectCouponList = val | ||||||
|  |       //清空原有数据 | ||||||
|  |       this.form.couponActivityItems = []; | ||||||
|  |       val.forEach((item, index) => { | ||||||
|  | 
 | ||||||
|  |         this.form.couponActivityItems.push({ | ||||||
|  |           num: 0, | ||||||
|  |           couponId: item.id | ||||||
|  |         }) | ||||||
|  |       }) | ||||||
|  |       console.log(val) | ||||||
|  |     }, | ||||||
|  | 
 | ||||||
|  |     getCoupon() { | ||||||
|  |       /** | ||||||
|  |        * 获取优惠券活动详情 | ||||||
|  |        */ | ||||||
|  |       getPlatformCoupon(this.id).then((res) => { | ||||||
|  |         let data = res.result; | ||||||
|  |         if (!data.promotionGoodsList) data.promotionGoodsList = []; | ||||||
|  |         if (data.scopeType == "PORTION_GOODS_CATEGORY") { | ||||||
|  |           let prevCascader = data.scopeId.split(","); | ||||||
|  | 
 | ||||||
|  |           // console.log(prevCascader); | ||||||
|  |           function next(params, prev) { | ||||||
|  |             for (let i = 0; i < params.length; i++) { | ||||||
|  |               const item = params[i]; | ||||||
|  |               console.log(item); | ||||||
|  |               if (item.children) { | ||||||
|  |                 next(item.children, [...prev, item]); | ||||||
|  |               } else { | ||||||
|  |                 if (prevCascader.includes(item.id)) { | ||||||
|  |                   prevCascader = prevCascader.map((key) => { | ||||||
|  |                     if (key === item.id) { | ||||||
|  |                       let result = prev.map((item) => item.id); | ||||||
|  | 
 | ||||||
|  |                       return [...result, item.id]; | ||||||
|  |                     } else { | ||||||
|  |                       return key; | ||||||
|  |                     } | ||||||
|  |                   }); | ||||||
|  |                 } else { | ||||||
|  |                   i === params.length - 1 && (prev = []); | ||||||
|  |                 } | ||||||
|  |               } | ||||||
|  |             } | ||||||
|  |           } | ||||||
|  | 
 | ||||||
|  |           next(this.goodsCategoryList, []); | ||||||
|  |           data.scopeIdGoods = prevCascader; | ||||||
|  |         } | ||||||
|  |         data.rangeTime = []; | ||||||
|  |         data.rangeTime.push(new Date(data.startTime), new Date(data.endTime)); | ||||||
|  |         this.form = data; | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     /** 保存平台优惠券 */ | ||||||
|  |     handleSubmit() { | ||||||
|  | 
 | ||||||
|  |       this.form.startTime = this.$options.filters.unixToDate( | ||||||
|  |         this.rangeTime[0] / 1000 | ||||||
|  |       ); | ||||||
|  |       this.form.endTime = this.$options.filters.unixToDate( | ||||||
|  |         this.rangeTime[1] / 1000 | ||||||
|  |       ); | ||||||
|  | 
 | ||||||
|  |       this.$refs.form.validate((valid) => { | ||||||
|  |         if (valid) { | ||||||
|  |           const params = JSON.parse(JSON.stringify(this.form)); | ||||||
|  |           console.log(params) | ||||||
|  |           this.submitLoading = true; | ||||||
|  |           if (this.modalType === 0) { | ||||||
|  |             // 添加 避免编辑后传入id等数据 记得删除 | ||||||
|  |             delete params.id; | ||||||
|  |             saveActivityCoupon(params).then((res) => { | ||||||
|  |               this.submitLoading = false; | ||||||
|  |               if (res.success) { | ||||||
|  |                 this.$Message.success("优惠券活动创建成功"); | ||||||
|  |                 this.closeCurrentPage(); | ||||||
|  |               } | ||||||
|  |             }); | ||||||
|  |           } else { | ||||||
|  |             updateCouponActivity(params).then((res) => { | ||||||
|  |               this.submitLoading = false; | ||||||
|  |               if (res.success) { | ||||||
|  |                 this.$Message.success("优惠券活动修改成功"); | ||||||
|  |                 this.closeCurrentPage(); | ||||||
|  |               } | ||||||
|  |             }); | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     // 关闭当前页面 | ||||||
|  |     closeCurrentPage() { | ||||||
|  |       this.$store.commit("removeTag", "add-platform-coupon"); | ||||||
|  |       localStorage.pageOpenedList = JSON.stringify( | ||||||
|  |         this.$store.state.app.pageOpenedList | ||||||
|  |       ); | ||||||
|  |       this.$router.go(-1); | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  | }; | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <style lang="scss" scpoed> | ||||||
|  | h4 { | ||||||
|  |   margin-bottom: 10px; | ||||||
|  |   padding: 0 10px; | ||||||
|  |   border: 1px solid #ddd; | ||||||
|  |   background-color: #f8f8f8; | ||||||
|  |   font-weight: bold; | ||||||
|  |   color: #333; | ||||||
|  |   font-size: 14px; | ||||||
|  |   line-height: 40px; | ||||||
|  |   text-align: left; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .describe { | ||||||
|  |   font-size: 12px; | ||||||
|  |   margin-left: 10px; | ||||||
|  |   color: #999; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | .effectiveDays { | ||||||
|  |   font-size: 12px; | ||||||
|  |   color: #999; | ||||||
|  | 
 | ||||||
|  |   > * { | ||||||
|  |     margin: 0 4px; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | </style> | ||||||
|  | 
 | ||||||
|  | @ -0,0 +1,172 @@ | ||||||
|  | <template> | ||||||
|  |   <div> | ||||||
|  |     <Card> | ||||||
|  |       <Form ref="form" :model="form" :label-width="120"> | ||||||
|  |         <div class="base-info-item"> | ||||||
|  |           <h4>优惠券将在指定发放时间发放到用户账号中</h4> | ||||||
|  |           <div class="form-item-view"> | ||||||
|  |             <FormItem label="活动名称" prop="promotionName"> | ||||||
|  |               <Input type="text" v-model="form.promotionName" placeholder="活动名称" clearable style="width: 260px" /> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="目标客户" prop="vipType"> | ||||||
|  |               <RadioGroup v-model="vipType"> | ||||||
|  |                 <Radio :label="0">全平台客户</Radio> | ||||||
|  |                 <Radio :label="1">指定客户</Radio> | ||||||
|  |               </RadioGroup> | ||||||
|  |               <Button type="primary" v-if="vipType==1" icon="ios-add" @click="addVip" ghost>添加客户</Button> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="发放时间" prop="couponDiscount"> | ||||||
|  |               <DatePicker type="datetime" v-model="form.rangeTime" format="yyyy-MM-dd HH:mm:ss" placeholder="请选择" :options="options" style="width: 260px"> | ||||||
|  |               </DatePicker> | ||||||
|  |             </FormItem> | ||||||
|  |             <FormItem label="选择优惠券" prop="couponType"> | ||||||
|  |               <Button type="primary" icon="ios-add" @click="checkCoupon=!checkCoupon" ghost>选择优惠券</Button> | ||||||
|  |               <Table class="table" :columns="couponColumns" :data="couponData"></Table> | ||||||
|  |             </FormItem> | ||||||
|  |           </div> | ||||||
|  | 
 | ||||||
|  |           <div style="margin-left:100px"> | ||||||
|  |             <Button type="text" @click="closeCurrentPage">返回</Button> | ||||||
|  |             <Button type="primary" :loading="submitLoading" @click="handleSubmit">提交</Button> | ||||||
|  |           </div> | ||||||
|  | 
 | ||||||
|  |         </div> | ||||||
|  |       </Form> | ||||||
|  |       <Modal width="1200" v-model="checkCoupon"> | ||||||
|  |         <couponList checked @selected="callbackSelectCoupon" /> | ||||||
|  |       </Modal> | ||||||
|  |       <Modal width="1200" v-model="checkUserList"> | ||||||
|  |         <userList @selected="callbackSelectUser" ref="memberLayout" /> | ||||||
|  |       </Modal> | ||||||
|  |     </Card> | ||||||
|  | 
 | ||||||
|  |   </div> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  | import { addCouponActivity } from "@/api/promotion"; | ||||||
|  | 
 | ||||||
|  | import couponList from "./coupon"; | ||||||
|  | import userList from "@/views/member/list/index"; | ||||||
|  | // import userList from '' | ||||||
|  | export default { | ||||||
|  |   components: { | ||||||
|  |     couponList, | ||||||
|  |     userList, | ||||||
|  |   }, | ||||||
|  | 
 | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       // 选择优惠券 | ||||||
|  |       checkCoupon: false, | ||||||
|  |       // 选择用户 | ||||||
|  |       checkUserList: false, | ||||||
|  |       // 优惠券表格title | ||||||
|  |       couponColumns: [ | ||||||
|  |         { | ||||||
|  |           title: "优惠券名称", | ||||||
|  |           key: "name", | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "有效期", | ||||||
|  |           key: "age", | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "优惠券数量", | ||||||
|  |           key: "address", | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "操作", | ||||||
|  |           key: "action", | ||||||
|  |         }, | ||||||
|  |       ], | ||||||
|  |       // datpicker时间设置 | ||||||
|  |       options: { | ||||||
|  |         disabledDate(date) { | ||||||
|  |           return date && date.valueOf() < Date.now() - 86400000; | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  | 
 | ||||||
|  |       // | ||||||
|  |       vipType: 0, //客户会员类型  0全平台客户 1指定客户 | ||||||
|  |       form: {}, | ||||||
|  |       formRule: {}, | ||||||
|  |       id: this.$route.query.id, // 优惠券id | ||||||
|  | 
 | ||||||
|  |       callbackCoupon: [], | ||||||
|  |     }; | ||||||
|  |   }, | ||||||
|  |   mounted() {}, | ||||||
|  |   methods: { | ||||||
|  | 
 | ||||||
|  |     // 添加指定用户 | ||||||
|  |     addVip() { | ||||||
|  |       this.checkUserList = true; | ||||||
|  |       this.$nextTick(() => { | ||||||
|  |         this.$refs.memberLayout.selectedMember = true; | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |     // 返回已选择的用户 | ||||||
|  |     callbackSelectUser(val){ | ||||||
|  |       console.log(val) | ||||||
|  |     }, | ||||||
|  | 
 | ||||||
|  |     // 返回已选择的优惠券 | ||||||
|  |     callbackSelectCoupon(val) { | ||||||
|  |       if (val.___selected) { | ||||||
|  |         this.callbackCoupon.forEach((item, index) => { | ||||||
|  |           if (item.id == val.id) this.callbackCoupon.splice(index, 1); | ||||||
|  |         }); | ||||||
|  |       } else { | ||||||
|  |         this.callbackCoupon.push(val); | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |     // 关闭当前页面 | ||||||
|  |     closeCurrentPage() { | ||||||
|  |       this.$store.commit("removeTag", "add-coupon-specify"); | ||||||
|  |       localStorage.pageOpenedList = JSON.stringify( | ||||||
|  |         this.$store.state.app.pageOpenedList | ||||||
|  |       ); | ||||||
|  |       this.$router.go(-1); | ||||||
|  |     }, | ||||||
|  | 
 | ||||||
|  |     async handleSubmit() { | ||||||
|  |       let res = await addCouponActivity(); | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  | }; | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <style lang="scss" scpoed> | ||||||
|  | .table { | ||||||
|  |   width: 800px; | ||||||
|  |   margin: 20px 0; | ||||||
|  | } | ||||||
|  | h4 { | ||||||
|  |   margin-bottom: 10px; | ||||||
|  |   padding: 0 10px; | ||||||
|  |   border: 1px solid #ddd; | ||||||
|  |   background-color: #f8f8f8; | ||||||
|  |   font-weight: bold; | ||||||
|  |   color: #333; | ||||||
|  |   font-size: 14px; | ||||||
|  |   line-height: 40px; | ||||||
|  |   text-align: left; | ||||||
|  | } | ||||||
|  | .form-item-view { | ||||||
|  |   margin: 20px 0; | ||||||
|  | } | ||||||
|  | .describe { | ||||||
|  |   font-size: 12px; | ||||||
|  |   margin-left: 10px; | ||||||
|  |   color: #999; | ||||||
|  | } | ||||||
|  | .effectiveDays { | ||||||
|  |   font-size: 12px; | ||||||
|  |   color: #999; | ||||||
|  |   > * { | ||||||
|  |     margin: 0 4px; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | </style> | ||||||
|  | 
 | ||||||
|  | @ -0,0 +1,250 @@ | ||||||
|  | <template> | ||||||
|  |   <div class="search"> | ||||||
|  |     <Card> | ||||||
|  |       <Table | ||||||
|  |         :loading="loading" | ||||||
|  |         border | ||||||
|  |         :columns="columns" | ||||||
|  |         :data="data" | ||||||
|  |         ref="table" | ||||||
|  |         sortable="custom" | ||||||
|  |         @on-sort-change="changeSort" | ||||||
|  |         @on-selection-change="changeSelect" | ||||||
|  |       > | ||||||
|  |         <template slot-scope="{ row }" slot="rangeTime"> | ||||||
|  |           <div>{{ row.startTime }} ~ {{ row.endTime }}</div> | ||||||
|  |         </template> | ||||||
|  |         <template slot-scope="{ row }" slot="action"> | ||||||
|  |           <Button | ||||||
|  |             type="error" | ||||||
|  |             ghost | ||||||
|  |             size="small" | ||||||
|  |             :disabled="row.memberCouponStatus != 'NEW'" | ||||||
|  |             @click="remove(row)" | ||||||
|  |             >作废</Button | ||||||
|  |           > | ||||||
|  |         </template> | ||||||
|  |       </Table> | ||||||
|  |       <Row type="flex" justify="end" class="page"> | ||||||
|  |         <Page | ||||||
|  |           :current="searchForm.pageNumber" | ||||||
|  |           :total="total" | ||||||
|  |           :page-size="searchForm.pageSize" | ||||||
|  |           @on-change="changePage" | ||||||
|  |           @on-page-size-change="changePageSize" | ||||||
|  |           :page-size-opts="[10, 20, 50]" | ||||||
|  |           size="small" | ||||||
|  |           show-total | ||||||
|  |           show-elevator | ||||||
|  |           show-sizer | ||||||
|  |         ></Page> | ||||||
|  |       </Row> | ||||||
|  |     </Card> | ||||||
|  |   </div> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  | import { | ||||||
|  |   getMemberReceiveCouponList, | ||||||
|  |   deleteMemberReceiveCoupon, | ||||||
|  | } from "@/api/promotion"; | ||||||
|  | 
 | ||||||
|  | export default { | ||||||
|  |   name: "memberReceiveCoupon", | ||||||
|  |   components: {}, | ||||||
|  |   data() { | ||||||
|  |     return { | ||||||
|  |       loading: true, // 表单加载状态 | ||||||
|  | 
 | ||||||
|  |       searchForm: { | ||||||
|  |         // 搜索框初始化对象 | ||||||
|  |         pageNumber: 1, // 当前页数 | ||||||
|  |         pageSize: 10, // 页面大小 | ||||||
|  |         sort: "createTime", // 默认排序字段 | ||||||
|  |         order: "desc", // 默认排序方式 | ||||||
|  |       }, | ||||||
|  |       id: this.$route.query.id, // 优惠券id | ||||||
|  | 
 | ||||||
|  |       submitLoading: false, // 添加或编辑提交状态 | ||||||
|  |       selectList: [], // 多选数据 | ||||||
|  |       columns: [ | ||||||
|  |         // 表头 | ||||||
|  |         { | ||||||
|  |           title: "优惠券编号", | ||||||
|  |           key: "couponId", | ||||||
|  |           minWidth: 120, | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "面额", | ||||||
|  |           key: "price", | ||||||
|  |           render: (h, params) => { | ||||||
|  |             return h( | ||||||
|  |               "div", | ||||||
|  |               this.$options.filters.unitPrice(params.row.price, "¥") | ||||||
|  |             ); | ||||||
|  |           }, | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "消费门槛", | ||||||
|  |           key: "consumeThreshold", | ||||||
|  |           render: (h, params) => { | ||||||
|  |             return h( | ||||||
|  |               "div", | ||||||
|  |               this.$options.filters.unitPrice(params.row.consumeThreshold, "¥") | ||||||
|  |             ); | ||||||
|  |           }, | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "有效期", | ||||||
|  |           slot: "rangeTime", | ||||||
|  |           minWidth: 120 | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "会员名称", | ||||||
|  |           key: "memberName", | ||||||
|  |           minWidth: 120 | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "适用范围", | ||||||
|  |           key: "couponType", | ||||||
|  |           minWidth: 50, | ||||||
|  |           render: (h, params) => { | ||||||
|  |             let text = "未知"; | ||||||
|  |             if (params.row.scopeType == "ALL") { | ||||||
|  |               text = "全品类"; | ||||||
|  |             } else if (params.row.scopeType == "PORTION_CATEGORY") { | ||||||
|  |               text = "部分商品分类"; | ||||||
|  |             } else if (params.row.scopeType == "PORTION_GOODS") { | ||||||
|  |               text = "指定商品"; | ||||||
|  |             } | ||||||
|  |             return h("div", [text]); | ||||||
|  |           }, | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "会员名称", | ||||||
|  |           key: "memberName", | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "状态", | ||||||
|  |           key: "memberCouponStatus", | ||||||
|  |           minWidth: 50, | ||||||
|  |           render: (h, params) => { | ||||||
|  |             let text = "未知", | ||||||
|  |               color = ""; | ||||||
|  |             if (params.row.memberCouponStatus == "NEW") { | ||||||
|  |               text = "未使用"; | ||||||
|  |               color = "default"; | ||||||
|  |             } else if (params.row.memberCouponStatus == "USED") { | ||||||
|  |               text = "已使用"; | ||||||
|  |               color = "green"; | ||||||
|  |             } else if (params.row.memberCouponStatus == "EXPIRE") { | ||||||
|  |               text = "已过期"; | ||||||
|  |               color = "red"; | ||||||
|  |             } else if (params.row.memberCouponStatus == "CLOSED") { | ||||||
|  |               text = "已作废"; | ||||||
|  |               color = "red"; | ||||||
|  |             } | ||||||
|  |             return h("div", [ | ||||||
|  |               h( | ||||||
|  |                 "Tag", | ||||||
|  |                 { | ||||||
|  |                   props: { | ||||||
|  |                     color: color, | ||||||
|  |                   }, | ||||||
|  |                 }, | ||||||
|  |                 text | ||||||
|  |               ), | ||||||
|  |             ]); | ||||||
|  |           }, | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           title: "操作", | ||||||
|  |           slot: "action", | ||||||
|  |           align: "center", | ||||||
|  |           width: 100, | ||||||
|  |         }, | ||||||
|  |       ], | ||||||
|  |       data: [], // 表单数据 | ||||||
|  |       total: 0, // 表单数据总数 | ||||||
|  |     }; | ||||||
|  |   }, | ||||||
|  |   methods: { | ||||||
|  |     init() { | ||||||
|  |       this.getDataList(); | ||||||
|  |     }, | ||||||
|  |     changePage(v) { | ||||||
|  |       this.searchForm.pageNumber = v; | ||||||
|  |       this.getDataList(); | ||||||
|  |       this.clearSelectAll(); | ||||||
|  |     }, | ||||||
|  |     changePageSize(v) { | ||||||
|  |       this.searchForm.pageSize = v; | ||||||
|  |       this.getDataList(); | ||||||
|  |     }, | ||||||
|  |     handleSearch() { | ||||||
|  |       this.searchForm.pageNumber = 1; | ||||||
|  |       this.searchForm.pageSize = 10; | ||||||
|  |       this.getDataList(); | ||||||
|  |     }, | ||||||
|  |     handleReset() { | ||||||
|  |       this.$refs.searchForm.resetFields(); | ||||||
|  |       this.searchForm.pageNumber = 1; | ||||||
|  |       this.searchForm.pageSize = 10; | ||||||
|  |       // 重新加载数据 | ||||||
|  |       this.getDataList(); | ||||||
|  |     }, | ||||||
|  |     changeSort(e) { | ||||||
|  |       this.searchForm.sort = e.key; | ||||||
|  |       this.searchForm.order = e.order; | ||||||
|  |       if (e.order === "normal") { | ||||||
|  |         this.searchForm.order = ""; | ||||||
|  |       } | ||||||
|  |       this.getDataList(); | ||||||
|  |     }, | ||||||
|  |     clearSelectAll() { | ||||||
|  |       this.$refs.table.selectAll(false); | ||||||
|  |     }, | ||||||
|  |     changeSelect(e) { | ||||||
|  |       this.selectList = e; | ||||||
|  |     }, | ||||||
|  |     /** 查询单个优惠券领取详情 */ | ||||||
|  |     getDataList() { | ||||||
|  |       this.loading = true; | ||||||
|  |       // 带多条件搜索参数获取表单数据 请自行修改接口 | ||||||
|  |       getMemberReceiveCouponList(this.id).then((res) => { | ||||||
|  |         this.loading = false; | ||||||
|  |         if (res.success) { | ||||||
|  |           this.data = res.result.records; | ||||||
|  |           this.total = res.result.total; | ||||||
|  |         } | ||||||
|  |       }); | ||||||
|  |       this.total = this.data.length; | ||||||
|  |       this.loading = false; | ||||||
|  |     }, | ||||||
|  |     /** 作废优惠券 */ | ||||||
|  |     remove(v) { | ||||||
|  |       this.$Modal.confirm({ | ||||||
|  |         title: "确认作废", | ||||||
|  |         content: "您确认要作废此优惠券?", | ||||||
|  |         loading: true, | ||||||
|  |         onOk: () => { | ||||||
|  |           // 删除 | ||||||
|  |           deleteMemberReceiveCoupon(v.id).then((res) => { | ||||||
|  |             this.$Modal.remove(); | ||||||
|  |             if (res.success) { | ||||||
|  |               this.$Message.success("作废成功"); | ||||||
|  |               this.getDataList(); | ||||||
|  |             } | ||||||
|  |           }); | ||||||
|  |         }, | ||||||
|  |       }); | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  |   mounted() { | ||||||
|  |     this.init(); | ||||||
|  |   }, | ||||||
|  | }; | ||||||
|  | </script> | ||||||
|  | <style lang="scss"> | ||||||
|  | @import "@/styles/table-common.scss"; | ||||||
|  | </style> | ||||||
|  | @ -70,7 +70,7 @@ | ||||||
|                   size="16" |                   size="16" | ||||||
|                   style="margin-right: 5px" |                   style="margin-right: 5px" | ||||||
|                 ></Icon> |                 ></Icon> | ||||||
|                 <span>顶部菜单</span> |                 <span>顶级菜单</span> | ||||||
|               </div> |               </div> | ||||||
|               <div v-show="form.level == 1 || form.level == 2"> |               <div v-show="form.level == 1 || form.level == 2"> | ||||||
|                 <Icon |                 <Icon | ||||||
|  | @ -168,7 +168,7 @@ | ||||||
|               size="16" |               size="16" | ||||||
|               style="margin-right: 5px" |               style="margin-right: 5px" | ||||||
|             ></Icon> |             ></Icon> | ||||||
|             <span>顶部菜单</span> |             <span>顶级菜单</span> | ||||||
|           </div> |           </div> | ||||||
|           <div v-show="formAdd.level != 0"> |           <div v-show="formAdd.level != 0"> | ||||||
|             <Icon |             <Icon | ||||||
|  | @ -271,13 +271,11 @@ export default { | ||||||
|         path: "", |         path: "", | ||||||
|         frontRoute: "", |         frontRoute: "", | ||||||
|         parentId: "", |         parentId: "", | ||||||
|         buttonType: "", |  | ||||||
|         sortOrder: 0, |         sortOrder: 0, | ||||||
|         level: 0, |         level: 0, | ||||||
|         showAlways: true, |         showAlways: true, | ||||||
|       }, |       }, | ||||||
|       formAdd: { // 添加表单 |       formAdd: { // 添加表单 | ||||||
|         buttonType: "", |  | ||||||
|       }, |       }, | ||||||
|       formValidate: { // 验证规则 |       formValidate: { // 验证规则 | ||||||
|         title: [{required: true, message: "名称不能为空", trigger: "blur"}], |         title: [{required: true, message: "名称不能为空", trigger: "blur"}], | ||||||
|  | @ -542,7 +540,7 @@ export default { | ||||||
|         return; |         return; | ||||||
|       } |       } | ||||||
|       this.parentTitle = this.form.title; |       this.parentTitle = this.form.title; | ||||||
|       this.modalTitle = "添加子节点(可拖动)"; |       this.modalTitle = "添加子节点"; | ||||||
|       this.showParent = true; |       this.showParent = true; | ||||||
|       if (this.form.level == 2) { |       if (this.form.level == 2) { | ||||||
|         this.$Modal.warning({ |         this.$Modal.warning({ | ||||||
|  | @ -557,7 +555,6 @@ export default { | ||||||
|         parentId: this.form.id, |         parentId: this.form.id, | ||||||
|         level: Number(this.form.level) + 1, |         level: Number(this.form.level) + 1, | ||||||
|         sortOrder: 0, |         sortOrder: 0, | ||||||
|         buttonType: "", |  | ||||||
|         status: 0, |         status: 0, | ||||||
|         showAlways: true, |         showAlways: true, | ||||||
|       }; |       }; | ||||||
|  | @ -568,7 +565,7 @@ export default { | ||||||
|       this.menuModalVisible = true; |       this.menuModalVisible = true; | ||||||
|     }, |     }, | ||||||
|     addRootMenu() { |     addRootMenu() { | ||||||
|       this.modalTitle = "添加顶部菜单(可拖动)"; |       this.modalTitle = "添加顶级菜单"; | ||||||
|       this.showParent = false; |       this.showParent = false; | ||||||
|       this.formAdd = { |       this.formAdd = { | ||||||
|         level: 0, |         level: 0, | ||||||
|  |  | ||||||
|  | @ -11,7 +11,6 @@ export const result = [ | ||||||
|     isMenu: true, |     isMenu: true, | ||||||
|     url: "", |     url: "", | ||||||
|     description: "", |     description: "", | ||||||
|     buttonType: "", |  | ||||||
|     permTypes: [], |     permTypes: [], | ||||||
|     children: [ |     children: [ | ||||||
|       { |       { | ||||||
|  | @ -116,7 +115,6 @@ export const result = [ | ||||||
|     isMenu: true, |     isMenu: true, | ||||||
|     url: "", |     url: "", | ||||||
|     description: "", |     description: "", | ||||||
|     buttonType: "", |  | ||||||
|     permTypes: [], |     permTypes: [], | ||||||
|     children: [ |     children: [ | ||||||
|       { |       { | ||||||
|  | @ -249,7 +247,6 @@ export const result = [ | ||||||
|     isMenu: true, |     isMenu: true, | ||||||
|     url: "", |     url: "", | ||||||
|     description: "", |     description: "", | ||||||
|     buttonType: "", |  | ||||||
|     permTypes: [], |     permTypes: [], | ||||||
|     children: [ |     children: [ | ||||||
|       { |       { | ||||||
|  | @ -339,7 +336,6 @@ export const result = [ | ||||||
|     isMenu: true, |     isMenu: true, | ||||||
|     url: "", |     url: "", | ||||||
|     description: "", |     description: "", | ||||||
|     buttonType: "", |  | ||||||
|     permTypes: [], |     permTypes: [], | ||||||
|     children: [ |     children: [ | ||||||
|       { |       { | ||||||
|  | @ -514,7 +510,6 @@ export const result = [ | ||||||
|     isMenu: true, |     isMenu: true, | ||||||
|     url: "", |     url: "", | ||||||
|     description: "", |     description: "", | ||||||
|     buttonType: "", |  | ||||||
|     permTypes: [], |     permTypes: [], | ||||||
|     children: [ |     children: [ | ||||||
|       { |       { | ||||||
|  | @ -590,7 +585,6 @@ export const result = [ | ||||||
|     isMenu: true, |     isMenu: true, | ||||||
|     url: "", |     url: "", | ||||||
|     description: "", |     description: "", | ||||||
|     buttonType: "", |  | ||||||
|     children: [ |     children: [ | ||||||
|       { |       { | ||||||
|         name: "user-manage", |         name: "user-manage", | ||||||
|  | @ -661,7 +655,6 @@ export const result = [ | ||||||
|         isMenu: true, |         isMenu: true, | ||||||
|         url: "", |         url: "", | ||||||
|         description: "", |         description: "", | ||||||
|         buttonType: "", |  | ||||||
|         children: [ |         children: [ | ||||||
|           { |           { | ||||||
|             name: "shopSetting", |             name: "shopSetting", | ||||||
|  | @ -675,7 +668,6 @@ export const result = [ | ||||||
|             isMenu: true, |             isMenu: true, | ||||||
|             url: null, |             url: null, | ||||||
|             description: null, |             description: null, | ||||||
|             buttonType: "", |  | ||||||
|             children: null, |             children: null, | ||||||
|             permTypes: [] |             permTypes: [] | ||||||
|           }, |           }, | ||||||
|  | @ -691,7 +683,6 @@ export const result = [ | ||||||
|             isMenu: true, |             isMenu: true, | ||||||
|             url: null, |             url: null, | ||||||
|             description: null, |             description: null, | ||||||
|             buttonType: "", |  | ||||||
|             children: null, |             children: null, | ||||||
|             permTypes: [] |             permTypes: [] | ||||||
|           } |           } | ||||||
|  | @ -712,7 +703,6 @@ export const result = [ | ||||||
|     isMenu: true, |     isMenu: true, | ||||||
|     url: "", |     url: "", | ||||||
|     description: "", |     description: "", | ||||||
|     buttonType: "", |  | ||||||
|     children: [ |     children: [ | ||||||
|       { |       { | ||||||
|         name: "user-manage", |         name: "user-manage", | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue