Commit bd661296c07abf62d4347ff3e8a36e00116c2712
1 parent
2aaeb7af
promotion:完善优惠劵模板的功能
Showing
12 changed files
with
104 additions
and
536 deletions
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java
| @@ -53,6 +53,7 @@ public class ProductSpuController { | @@ -53,6 +53,7 @@ public class ProductSpuController { | ||
| 53 | return success(true); | 53 | return success(true); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | + // TODO 芋艿:修改接口 | ||
| 56 | @GetMapping("/get/detail") | 57 | @GetMapping("/get/detail") |
| 57 | @ApiOperation("获得商品 SPU") | 58 | @ApiOperation("获得商品 SPU") |
| 58 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) | 59 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| @@ -79,6 +80,14 @@ public class ProductSpuController { | @@ -79,6 +80,14 @@ public class ProductSpuController { | ||
| 79 | return success(ProductSpuConvert.INSTANCE.convertList(list)); | 80 | return success(ProductSpuConvert.INSTANCE.convertList(list)); |
| 80 | } | 81 | } |
| 81 | 82 | ||
| 83 | + @GetMapping("/get-simple-list") | ||
| 84 | + @ApiOperation("获得商品 SPU 精简列表") | ||
| 85 | + @PreAuthorize("@ss.hasPermission('product:spu:query')") | ||
| 86 | + public CommonResult<List<ProductSpuSimpleRespVO>> getSpuSimpleList() { | ||
| 87 | + List<ProductSpuDO> list = spuService.getSpuList(); | ||
| 88 | + return success(ProductSpuConvert.INSTANCE.convertList02(list)); | ||
| 89 | + } | ||
| 90 | + | ||
| 82 | @GetMapping("/page") | 91 | @GetMapping("/page") |
| 83 | @ApiOperation("获得商品 SPU 分页") | 92 | @ApiOperation("获得商品 SPU 分页") |
| 84 | @PreAuthorize("@ss.hasPermission('product:spu:query')") | 93 | @PreAuthorize("@ss.hasPermission('product:spu:query')") |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuSimpleRespVO.java
0 → 100755
| 1 | +package cn.iocoder.yudao.module.product.controller.admin.spu.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.annotations.ApiModel; | ||
| 4 | +import io.swagger.annotations.ApiModelProperty; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import lombok.EqualsAndHashCode; | ||
| 7 | +import lombok.ToString; | ||
| 8 | + | ||
| 9 | +@ApiModel("管理后台 - 商品 SPU 精简 Response VO") | ||
| 10 | +@Data | ||
| 11 | +@EqualsAndHashCode(callSuper = true) | ||
| 12 | +@ToString(callSuper = true) | ||
| 13 | +public class ProductSpuSimpleRespVO extends ProductSpuBaseVO { | ||
| 14 | + | ||
| 15 | + @ApiModelProperty(value = "主键", required = true, example = "1") | ||
| 16 | + private Long id; | ||
| 17 | + | ||
| 18 | + @ApiModelProperty(value = "商品名称", required = true, example = "芋道") | ||
| 19 | + private String name; | ||
| 20 | + | ||
| 21 | + @ApiModelProperty(value = " 最小价格,单位使用:分", required = true, example = "1024") | ||
| 22 | + private Integer minPrice; | ||
| 23 | + | ||
| 24 | + @ApiModelProperty(value = "最大价格,单位使用:分", required = true, example = "1024") | ||
| 25 | + private Integer maxPrice; | ||
| 26 | + | ||
| 27 | +} |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java
| @@ -36,5 +36,7 @@ public interface ProductSpuConvert { | @@ -36,5 +36,7 @@ public interface ProductSpuConvert { | ||
| 36 | AppSpuPageRespVO convertAppResp(ProductSpuDO list); | 36 | AppSpuPageRespVO convertAppResp(ProductSpuDO list); |
| 37 | 37 | ||
| 38 | List<SpuInfoRespDTO> convertList2(List<ProductSpuDO> list); | 38 | List<SpuInfoRespDTO> convertList2(List<ProductSpuDO> list); |
| 39 | - | 39 | + |
| 40 | + List<ProductSpuSimpleRespVO> convertList02(List<ProductSpuDO> list); | ||
| 41 | + | ||
| 40 | } | 42 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuService.java
| @@ -64,6 +64,13 @@ public interface ProductSpuService { | @@ -64,6 +64,13 @@ public interface ProductSpuService { | ||
| 64 | List<ProductSpuDO> getSpuList(Collection<Long> ids); | 64 | List<ProductSpuDO> getSpuList(Collection<Long> ids); |
| 65 | 65 | ||
| 66 | /** | 66 | /** |
| 67 | + * 获得所有商品 SPU 列表 | ||
| 68 | + * | ||
| 69 | + * @return 商品 SPU 列表 | ||
| 70 | + */ | ||
| 71 | + List<ProductSpuDO> getSpuList(); | ||
| 72 | + | ||
| 73 | + /** | ||
| 67 | * 获得商品 SPU 分页 | 74 | * 获得商品 SPU 分页 |
| 68 | * | 75 | * |
| 69 | * @param pageReqVO 分页查询 | 76 | * @param pageReqVO 分页查询 |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java
| @@ -177,6 +177,11 @@ public class ProductSpuServiceImpl implements ProductSpuService { | @@ -177,6 +177,11 @@ public class ProductSpuServiceImpl implements ProductSpuService { | ||
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | @Override | 179 | @Override |
| 180 | + public List<ProductSpuDO> getSpuList() { | ||
| 181 | + return productSpuMapper.selectList(); | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + @Override | ||
| 180 | public PageResult<ProductSpuRespVO> getSpuPage(ProductSpuPageReqVO pageReqVO) { | 185 | public PageResult<ProductSpuRespVO> getSpuPage(ProductSpuPageReqVO pageReqVO) { |
| 181 | // 库存告警的 SPU 编号的集合 | 186 | // 库存告警的 SPU 编号的集合 |
| 182 | Set<Long> alarmStockSpuIds = null; | 187 | Set<Long> alarmStockSpuIds = null; |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/coupon/vo/CouponTemplateBaseVO.java
| @@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.validation.InEnum; | @@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 6 | import cn.iocoder.yudao.module.promotion.enums.common.PromotionDiscountTypeEnum; | 6 | import cn.iocoder.yudao.module.promotion.enums.common.PromotionDiscountTypeEnum; |
| 7 | import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum; | 7 | import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum; |
| 8 | import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTemplateValidityTypeEnum; | 8 | import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTemplateValidityTypeEnum; |
| 9 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 9 | import com.fasterxml.jackson.annotation.JsonIgnore; | 10 | import com.fasterxml.jackson.annotation.JsonIgnore; |
| 10 | import io.swagger.annotations.ApiModelProperty; | 11 | import io.swagger.annotations.ApiModelProperty; |
| 11 | import lombok.Data; | 12 | import lombok.Data; |
| @@ -19,6 +20,7 @@ import java.util.List; | @@ -19,6 +20,7 @@ import java.util.List; | ||
| 19 | import java.util.Objects; | 20 | import java.util.Objects; |
| 20 | 21 | ||
| 21 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 22 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 23 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT; | ||
| 22 | 24 | ||
| 23 | /** | 25 | /** |
| 24 | * 优惠劵模板 Base VO,提供给添加、修改、详细的子 VO 使用 | 26 | * 优惠劵模板 Base VO,提供给添加、修改、详细的子 VO 使用 |
| @@ -62,10 +64,12 @@ public class CouponTemplateBaseVO { | @@ -62,10 +64,12 @@ public class CouponTemplateBaseVO { | ||
| 62 | 64 | ||
| 63 | @ApiModelProperty(value = "固定日期 - 生效开始时间") | 65 | @ApiModelProperty(value = "固定日期 - 生效开始时间") |
| 64 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | 66 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 67 | + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) | ||
| 65 | private Date validStartTime; | 68 | private Date validStartTime; |
| 66 | 69 | ||
| 67 | @ApiModelProperty(value = "固定日期 - 生效结束时间") | 70 | @ApiModelProperty(value = "固定日期 - 生效结束时间") |
| 68 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | 71 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 72 | + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) | ||
| 69 | private Date validEndTime; | 73 | private Date validEndTime; |
| 70 | 74 | ||
| 71 | @ApiModelProperty(value = "领取日期 - 开始天数") | 75 | @ApiModelProperty(value = "领取日期 - 开始天数") |
| @@ -82,15 +86,14 @@ public class CouponTemplateBaseVO { | @@ -82,15 +86,14 @@ public class CouponTemplateBaseVO { | ||
| 82 | private Integer discountType; | 86 | private Integer discountType; |
| 83 | 87 | ||
| 84 | @ApiModelProperty(value = "折扣百分比", example = "80", notes = "例如说,80% 为 80") | 88 | @ApiModelProperty(value = "折扣百分比", example = "80", notes = "例如说,80% 为 80") |
| 85 | - @Min(value = 1) | ||
| 86 | private Integer discountPercent; | 89 | private Integer discountPercent; |
| 87 | 90 | ||
| 88 | @ApiModelProperty(value = "优惠金额", example = "10", notes = "单位:分") | 91 | @ApiModelProperty(value = "优惠金额", example = "10", notes = "单位:分") |
| 89 | - @Min(value = 1) | 92 | + @Min(value = 0, message = "优惠金额需要大于等于 0") |
| 90 | private Integer discountPrice; | 93 | private Integer discountPrice; |
| 91 | 94 | ||
| 92 | @ApiModelProperty(value = "折扣上限", example = "100", notes = "单位:分,仅在 discountType 为 PERCENT 使用") | 95 | @ApiModelProperty(value = "折扣上限", example = "100", notes = "单位:分,仅在 discountType 为 PERCENT 使用") |
| 93 | - private Integer discountPriceLimit; | 96 | + private Integer discountLimitPrice; |
| 94 | 97 | ||
| 95 | @AssertTrue(message = "商品 SPU 编号的数组不能为空") | 98 | @AssertTrue(message = "商品 SPU 编号的数组不能为空") |
| 96 | @JsonIgnore | 99 | @JsonIgnore |
| @@ -127,11 +130,11 @@ public class CouponTemplateBaseVO { | @@ -127,11 +130,11 @@ public class CouponTemplateBaseVO { | ||
| 127 | || fixedEndTerm != null; | 130 | || fixedEndTerm != null; |
| 128 | } | 131 | } |
| 129 | 132 | ||
| 130 | - @AssertTrue(message = "折扣百分比不能为空") | 133 | + @AssertTrue(message = "折扣百分比需要大于等于 1") |
| 131 | @JsonIgnore | 134 | @JsonIgnore |
| 132 | public boolean isDiscountPercentValid() { | 135 | public boolean isDiscountPercentValid() { |
| 133 | return ObjectUtil.notEqual(discountType, PromotionDiscountTypeEnum.PERCENT.getType()) | 136 | return ObjectUtil.notEqual(discountType, PromotionDiscountTypeEnum.PERCENT.getType()) |
| 134 | - || discountPercent != null; | 137 | + || (discountPercent != null && discountPercent >= 1); |
| 135 | } | 138 | } |
| 136 | 139 | ||
| 137 | @AssertTrue(message = "优惠金额不能为空") | 140 | @AssertTrue(message = "优惠金额不能为空") |
| @@ -143,9 +146,9 @@ public class CouponTemplateBaseVO { | @@ -143,9 +146,9 @@ public class CouponTemplateBaseVO { | ||
| 143 | 146 | ||
| 144 | @AssertTrue(message = "折扣上限不能为空") | 147 | @AssertTrue(message = "折扣上限不能为空") |
| 145 | @JsonIgnore | 148 | @JsonIgnore |
| 146 | - public boolean isDiscountPriceLimit() { | 149 | + public boolean isDiscountLimitPriceValid() { |
| 147 | return ObjectUtil.notEqual(discountType, PromotionDiscountTypeEnum.PERCENT.getType()) | 150 | return ObjectUtil.notEqual(discountType, PromotionDiscountTypeEnum.PERCENT.getType()) |
| 148 | - || discountPriceLimit != null; | 151 | + || discountLimitPrice != null; |
| 149 | } | 152 | } |
| 150 | 153 | ||
| 151 | } | 154 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponTemplateServiceImpl.java
| 1 | package cn.iocoder.yudao.module.promotion.service.coupon; | 1 | package cn.iocoder.yudao.module.promotion.service.coupon; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.CouponTemplateCreateReqVO; | 5 | import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.CouponTemplateCreateReqVO; |
| 5 | import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.CouponTemplatePageReqVO; | 6 | import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.CouponTemplatePageReqVO; |
| @@ -30,7 +31,8 @@ public class CouponTemplateServiceImpl implements CouponTemplateService { | @@ -30,7 +31,8 @@ public class CouponTemplateServiceImpl implements CouponTemplateService { | ||
| 30 | @Override | 31 | @Override |
| 31 | public Long createCouponTemplate(CouponTemplateCreateReqVO createReqVO) { | 32 | public Long createCouponTemplate(CouponTemplateCreateReqVO createReqVO) { |
| 32 | // 插入 | 33 | // 插入 |
| 33 | - CouponTemplateDO couponTemplate = CouponTemplateConvert.INSTANCE.convert(createReqVO); | 34 | + CouponTemplateDO couponTemplate = CouponTemplateConvert.INSTANCE.convert(createReqVO) |
| 35 | + .setStatus(CommonStatusEnum.ENABLE.getStatus()); | ||
| 34 | couponTemplateMapper.insert(couponTemplate); | 36 | couponTemplateMapper.insert(couponTemplate); |
| 35 | // 返回 | 37 | // 返回 |
| 36 | return couponTemplate.getId(); | 38 | return couponTemplate.getId(); |
yudao-ui-admin/src/api/mall/CouponTemplete/CouponTemplete.js deleted
| 1 | -import request from '@/utils/request' | ||
| 2 | - | ||
| 3 | -// 创建优惠券模板 | ||
| 4 | -export function create(data) { | ||
| 5 | - return request({ | ||
| 6 | - url: '/coupon/template/create', | ||
| 7 | - method: 'post', | ||
| 8 | - data: data | ||
| 9 | - }) | ||
| 10 | -} | ||
| 11 | - | ||
| 12 | -// 更新优惠券模板 | ||
| 13 | -export function update(data) { | ||
| 14 | - return request({ | ||
| 15 | - url: '/coupon/template/update', | ||
| 16 | - method: 'put', | ||
| 17 | - data: data | ||
| 18 | - }) | ||
| 19 | -} | ||
| 20 | - | ||
| 21 | -// 删除优惠券模板 | ||
| 22 | -export function deleteCouponTemplete (id) { | ||
| 23 | - return request({ | ||
| 24 | - url: '/coupon/template/delete?id=' + id, | ||
| 25 | - method: 'delete' | ||
| 26 | - }) | ||
| 27 | -} | ||
| 28 | - | ||
| 29 | -// 获得优惠券模板 | ||
| 30 | -export function get(id) { | ||
| 31 | - return request({ | ||
| 32 | - url: '/coupon/template/get?id=' + id, | ||
| 33 | - method: 'get' | ||
| 34 | - }) | ||
| 35 | -} | ||
| 36 | - | ||
| 37 | -// 获得优惠券模板分页 | ||
| 38 | -export function getPage(query) { | ||
| 39 | - return request({ | ||
| 40 | - url: '/coupon/template/page', | ||
| 41 | - method: 'get', | ||
| 42 | - params: query | ||
| 43 | - }) | ||
| 44 | -} | ||
| 45 | - | ||
| 46 | -// 导出优惠券模板 Excel | ||
| 47 | -export function exportExcel(query) { | ||
| 48 | - return request({ | ||
| 49 | - url: '/coupon/template/export-excel', | ||
| 50 | - method: 'get', | ||
| 51 | - params: query, | ||
| 52 | - responseType: 'blob' | ||
| 53 | - }) | ||
| 54 | -} |
yudao-ui-admin/src/api/mall/product/spu.js
| @@ -50,3 +50,11 @@ export function getSpuPage(query) { | @@ -50,3 +50,11 @@ export function getSpuPage(query) { | ||
| 50 | params: query | 50 | params: query |
| 51 | }) | 51 | }) |
| 52 | } | 52 | } |
| 53 | + | ||
| 54 | +// 获得商品 SPU 精简列表 | ||
| 55 | +export function getSpuSimpleList() { | ||
| 56 | + return request({ | ||
| 57 | + url: '/product/spu/get-simple-list', | ||
| 58 | + method: 'get', | ||
| 59 | + }) | ||
| 60 | +} |
yudao-ui-admin/src/api/promotion/couponTemplate.js renamed to yudao-ui-admin/src/api/mall/promotion/couponTemplate.js
yudao-ui-admin/src/views/mall/CouponTemplete/index.vue deleted
| 1 | -<template> | ||
| 2 | - <div class="app-container"> | ||
| 3 | - | ||
| 4 | - <!-- 搜索工作栏 --> | ||
| 5 | - <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> | ||
| 6 | - <el-form-item label="优惠券类" prop="type"> | ||
| 7 | - <el-select v-model="queryParams.type" placeholder="请选择优惠券类型 reward-满减 discount-折扣 random-随机" clearable size="small"> | ||
| 8 | - <el-option label="请选择字典生成" value="" /> | ||
| 9 | - </el-select> | ||
| 10 | - </el-form-item> | ||
| 11 | - <el-form-item label="优惠券名称" prop="name"> | ||
| 12 | - <el-input v-model="queryParams.name" placeholder="请输入优惠券名称" clearable @keyup.enter.native="handleQuery"/> | ||
| 13 | - </el-form-item> | ||
| 14 | - | ||
| 15 | - <el-form-item label="状态" prop="status"> | ||
| 16 | - <el-select v-model="queryParams.status" placeholder="请选择状态(1进行中2已结束-1已关闭)" clearable size="small"> | ||
| 17 | - <el-option label="请选择字典生成" value="" /> | ||
| 18 | - </el-select> | ||
| 19 | - </el-form-item> | ||
| 20 | - <el-form-item label="有效日期结束时间" prop="endTime"> | ||
| 21 | - <el-date-picker v-model="queryParams.endTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange" | ||
| 22 | - range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" /> | ||
| 23 | - </el-form-item> | ||
| 24 | - | ||
| 25 | - <el-form-item> | ||
| 26 | - <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> | ||
| 27 | - <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> | ||
| 28 | - </el-form-item> | ||
| 29 | - </el-form> | ||
| 30 | - | ||
| 31 | - <!-- 操作工具栏 --> | ||
| 32 | - <el-row :gutter="10" class="mb8"> | ||
| 33 | - <el-col :span="1.5"> | ||
| 34 | - <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" | ||
| 35 | - v-hasPermi="['CouponTemplete::create']">新增</el-button> | ||
| 36 | - </el-col> | ||
| 37 | - <el-col :span="1.5"> | ||
| 38 | - <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" | ||
| 39 | - v-hasPermi="['CouponTemplete::export']">导出</el-button> | ||
| 40 | - </el-col> | ||
| 41 | - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | ||
| 42 | - </el-row> | ||
| 43 | - | ||
| 44 | - <!-- 列表 --> | ||
| 45 | - <el-table v-loading="loading" :data="list"> | ||
| 46 | - | ||
| 47 | - <!-- todo 优惠券类型--> | ||
| 48 | - <el-table-column label="优惠券类型" align="center" prop="type" /> | ||
| 49 | - <el-table-column label="优惠券名称" align="center" prop="name" /> | ||
| 50 | - <el-table-column label="优惠券图片" align="center" prop="image" /> | ||
| 51 | - <el-table-column label="发放数量" align="center" prop="count" /> | ||
| 52 | - <el-table-column label="已领取数量" align="center" prop="leadCount" /> | ||
| 53 | - <el-table-column label="已使用数量" align="center" prop="usedCount" /> | ||
| 54 | -<!-- todo 适用商品类型--> | ||
| 55 | -<!-- <el-table-column label="适用商品类型" align="center" prop="goodsType" />--> | ||
| 56 | - <!-- todo 使用门槛0-无门槛 1-有门槛--> | ||
| 57 | - | ||
| 58 | - <el-table-column label="使用门槛" align="center" prop="hasUseLimit" /> | ||
| 59 | -<!-- <el-table-column label="满多少元使用 0代表无限制" align="center" prop="atLeast" />--> | ||
| 60 | - <!-- todo 发放面额 折扣--> | ||
| 61 | - <el-table-column label="优惠金额/折扣" align="center" prop="money" /> | ||
| 62 | -<!-- <el-table-column label="1 =< 折扣 <= 9.9 当type为discount时需要添加" align="center" prop="discount" />--> | ||
| 63 | -<!-- <el-table-column label="最多折扣金额 当type为discount时可选择性添加" align="center" prop="discountLimit" />--> | ||
| 64 | -<!-- <el-table-column label="最低金额 当type为radom时需要添加" align="center" prop="minMoney" />--> | ||
| 65 | -<!-- <el-table-column label="最大金额 当type为radom时需要添加" align="center" prop="maxMoney" />--> | ||
| 66 | - <!-- todo 1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期 --> | ||
| 67 | - <el-table-column label="有效期限" align="center" prop="validityType" /> | ||
| 68 | -<!-- <el-table-column label="使用开始日期 过期类型1时必填" align="center" prop="startUseTime" width="180">--> | ||
| 69 | -<!-- <template slot-scope="scope">--> | ||
| 70 | -<!-- <span>{{ parseTime(scope.row.startUseTime) }}</span>--> | ||
| 71 | -<!-- </template>--> | ||
| 72 | -<!-- </el-table-column>--> | ||
| 73 | -<!-- <el-table-column label="使用结束日期 过期类型1时必填" align="center" prop="endUseTime" width="180">--> | ||
| 74 | -<!-- <template slot-scope="scope">--> | ||
| 75 | -<!-- <span>{{ parseTime(scope.row.endUseTime) }}</span>--> | ||
| 76 | -<!-- </template>--> | ||
| 77 | -<!-- </el-table-column>--> | ||
| 78 | -<!-- <el-table-column label="有效日期结束时间" align="center" prop="endTime" width="180">--> | ||
| 79 | -<!-- <template slot-scope="scope">--> | ||
| 80 | -<!-- <span>{{ parseTime(scope.row.endTime) }}</span>--> | ||
| 81 | -<!-- </template>--> | ||
| 82 | -<!-- </el-table-column>--> | ||
| 83 | -<!-- <el-table-column label="当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效" align="center" prop="fixedTerm" />--> | ||
| 84 | -<!-- <el-table-column label="是否无限制0-否 1是" align="center" prop="whetherLimitless" />--> | ||
| 85 | - <el-table-column label="领取上限" align="center" prop="maxFetch" /> | ||
| 86 | - <!-- todo 0-不限制 1- 优惠券仅原价购买商品时可用--> | ||
| 87 | - <el-table-column label="优惠叠加" align="center" prop="whetherForbidPreference" /> | ||
| 88 | - <el-table-column label="是否显示" align="center" prop="whetherShow" /> | ||
| 89 | - <el-table-column label="订单的优惠总金额" align="center" prop="discountOrderMoney" /> | ||
| 90 | - <el-table-column label="用券总成交额" align="center" prop="orderMoney" /> | ||
| 91 | - <el-table-column label="是否禁止发放" align="center" prop="whetherForbidden" /> | ||
| 92 | - <el-table-column label="使用优惠券购买的商品数量" align="center" prop="orderGoodsNum" /> | ||
| 93 | - <el-table-column label="状态" align="center" prop="status" /> | ||
| 94 | - | ||
| 95 | - <el-table-column label="备注" align="center" prop="couponNameRemark" /> | ||
| 96 | - | ||
| 97 | - <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||
| 98 | - | ||
| 99 | - <template #scope> | ||
| 100 | - <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" | ||
| 101 | - v-hasPermi="['CouponTemplete::update']">修改</el-button> | ||
| 102 | - <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" | ||
| 103 | - v-hasPermi="['CouponTemplete::delete']">删除</el-button> | ||
| 104 | - </template> | ||
| 105 | - </el-table-column> | ||
| 106 | - </el-table> | ||
| 107 | - <!-- 分页组件 --> | ||
| 108 | - <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | ||
| 109 | - @pagination="getList"/> | ||
| 110 | - | ||
| 111 | - <!-- 对话框(添加 / 修改) --> | ||
| 112 | - <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body> | ||
| 113 | - <el-form ref="form" :model="form" :rules="rules" label-width="150px"> | ||
| 114 | - <el-form-item label="优惠券类型" prop="type"> | ||
| 115 | - <el-select v-model="form.type" placeholder="请选择优惠券类型 reward-满减 discount-折扣 random-随机"> | ||
| 116 | - <el-option label="请选择字典生成" value="" /> | ||
| 117 | - </el-select> | ||
| 118 | - </el-form-item> | ||
| 119 | - <el-form-item label="优惠券名称" prop="name"> | ||
| 120 | - <el-input v-model="form.name" placeholder="请输入优惠券名称" /> | ||
| 121 | - </el-form-item> | ||
| 122 | - <el-form-item label="名称备注" prop="couponNameRemark"> | ||
| 123 | - <el-input v-model="form.couponNameRemark" placeholder="请输入名称备注" /> | ||
| 124 | - </el-form-item> | ||
| 125 | - <el-form-item label="发放数量" prop="count"> | ||
| 126 | - <el-input v-model="form.count" placeholder="请输入发放数量" /> | ||
| 127 | - </el-form-item> | ||
| 128 | - <el-form-item label="适用商品类型" prop="goodsType"> | ||
| 129 | - <el-radio-group v-model="form.goodsType"> | ||
| 130 | - <el-radio label="1">请选择字典生成</el-radio> | ||
| 131 | - </el-radio-group> | ||
| 132 | - </el-form-item> | ||
| 133 | - <!-- todo 请输入适用商品id--> | ||
| 134 | - <el-form-item label="适用商品id" prop="productIds"> | ||
| 135 | - <el-input v-model="form.productIds" placeholder="请输入适用商品id" /> | ||
| 136 | - </el-form-item> | ||
| 137 | - <el-form-item label="使用门槛" prop="hasUseLimit"> | ||
| 138 | - <el-radio-group v-model="form.hasUseLimit"> | ||
| 139 | - <el-radio label="1">请选择字典生成</el-radio> | ||
| 140 | - </el-radio-group> | ||
| 141 | - </el-form-item> | ||
| 142 | - <el-form-item label="满多少元使用" prop="atLeast"> | ||
| 143 | - <el-input v-model="form.atLeast" placeholder="请输入满多少元使用 0代表无限制" /> | ||
| 144 | - </el-form-item> | ||
| 145 | - <el-form-item label="发放面额" prop="money"> | ||
| 146 | - <el-input v-model="form.money" placeholder="请输入发放面额 当type为reward时需要添加" /> | ||
| 147 | - </el-form-item> | ||
| 148 | - <el-form-item label="1 =< 折扣 <= 9.9" prop="discount"> | ||
| 149 | - <el-input v-model="form.discount" placeholder="请输入1 =< 折扣 <= 9.9 当type为discount时需要添加" /> | ||
| 150 | - </el-form-item> | ||
| 151 | - <el-form-item label="最多折扣金额" prop="discountLimit"> | ||
| 152 | - <el-input v-model="form.discountLimit" placeholder="请输入最多折扣金额 当type为discount时可选择性添加" /> | ||
| 153 | - </el-form-item> | ||
| 154 | - <el-form-item label="最低金额" prop="minMoney"> | ||
| 155 | - <el-input v-model="form.minMoney" placeholder="请输入最低金额 当type为radom时需要添加" /> | ||
| 156 | - </el-form-item> | ||
| 157 | - <el-form-item label="最大金额" prop="maxMoney"> | ||
| 158 | - <el-input v-model="form.maxMoney" placeholder="请输入最大金额 当type为radom时需要添加" /> | ||
| 159 | - </el-form-item> | ||
| 160 | - <el-form-item label="过期类型" prop="validityType"> | ||
| 161 | - <el-radio-group v-model="form.validityType"> | ||
| 162 | - <el-radio label="1">请选择字典生成</el-radio> | ||
| 163 | - </el-radio-group> | ||
| 164 | - </el-form-item> | ||
| 165 | - <el-form-item label="使用开始日期 过期类型1时必填" prop="startUseTime"> | ||
| 166 | - <el-date-picker clearable v-model="form.startUseTime" type="date" value-format="timestamp" placeholder="选择使用开始日期 过期类型1时必填" /> | ||
| 167 | - </el-form-item> | ||
| 168 | - <el-form-item label="使用结束日期 过期类型1时必填" prop="endUseTime"> | ||
| 169 | - <el-date-picker clearable v-model="form.endUseTime" type="date" value-format="timestamp" placeholder="选择使用结束日期 过期类型1时必填" /> | ||
| 170 | - </el-form-item> | ||
| 171 | - <el-form-item label="当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效" prop="fixedTerm"> | ||
| 172 | - <el-input v-model="form.fixedTerm" placeholder="请输入当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效" /> | ||
| 173 | - </el-form-item> | ||
| 174 | - <el-form-item label="是否无限制0-否 1是" prop="whetherLimitless"> | ||
| 175 | - <el-radio-group v-model="form.whetherLimitless"> | ||
| 176 | - <el-radio label="1">请选择字典生成</el-radio> | ||
| 177 | - </el-radio-group> | ||
| 178 | - </el-form-item> | ||
| 179 | - <el-form-item label="每人最大领取个数" prop="maxFetch"> | ||
| 180 | - <el-input v-model="form.maxFetch" placeholder="请输入每人最大领取个数" /> | ||
| 181 | - </el-form-item> | ||
| 182 | - <el-form-item label="是否开启过期提醒0-不开启 1-开启" prop="whetherExpireNotice"> | ||
| 183 | - <el-radio-group v-model="form.whetherExpireNotice"> | ||
| 184 | - <el-radio label="1">请选择字典生成</el-radio> | ||
| 185 | - </el-radio-group> | ||
| 186 | - </el-form-item> | ||
| 187 | - <el-form-item label="过期前N天提醒" prop="expireNoticeFixedTerm"> | ||
| 188 | - <el-input v-model="form.expireNoticeFixedTerm" placeholder="请输入过期前N天提醒" /> | ||
| 189 | - </el-form-item> | ||
| 190 | - <el-form-item label="优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用" prop="whetherForbidPreference"> | ||
| 191 | - <el-radio-group v-model="form.whetherForbidPreference"> | ||
| 192 | - <el-radio label="1">请选择字典生成</el-radio> | ||
| 193 | - </el-radio-group> | ||
| 194 | - </el-form-item> | ||
| 195 | - <el-form-item label="是否显示" prop="whetherShow"> | ||
| 196 | - <el-input v-model="form.whetherShow" placeholder="请输入是否显示" /> | ||
| 197 | - </el-form-item> | ||
| 198 | - <el-form-item label="订单的优惠总金额" prop="discountOrderMoney"> | ||
| 199 | - <el-input v-model="form.discountOrderMoney" placeholder="请输入订单的优惠总金额" /> | ||
| 200 | - </el-form-item> | ||
| 201 | - <el-form-item label="用券总成交额" prop="orderMoney"> | ||
| 202 | - <el-input v-model="form.orderMoney" placeholder="请输入用券总成交额" /> | ||
| 203 | - </el-form-item> | ||
| 204 | - <el-form-item label="是否禁止发放0-否 1-是" prop="whetherForbidden"> | ||
| 205 | - <el-radio-group v-model="form.whetherForbidden"> | ||
| 206 | - <el-radio label="1">请选择字典生成</el-radio> | ||
| 207 | - </el-radio-group> | ||
| 208 | - </el-form-item> | ||
| 209 | - <el-form-item label="使用优惠券购买的商品数量" prop="orderGoodsNum"> | ||
| 210 | - <el-input v-model="form.orderGoodsNum" placeholder="请输入使用优惠券购买的商品数量" /> | ||
| 211 | - </el-form-item> | ||
| 212 | - <el-form-item label="状态" prop="status"> | ||
| 213 | - <el-radio-group v-model="form.status"> | ||
| 214 | - <el-radio label="1">请选择字典生成</el-radio> | ||
| 215 | - </el-radio-group> | ||
| 216 | - </el-form-item> | ||
| 217 | - <el-form-item label="有效日期结束时间" prop="endTime"> | ||
| 218 | - <el-date-picker clearable v-model="form.endTime" type="date" value-format="timestamp" placeholder="选择有效日期结束时间" /> | ||
| 219 | - </el-form-item> | ||
| 220 | - </el-form> | ||
| 221 | - <div slot="footer" class="dialog-footer"> | ||
| 222 | - <el-button type="primary" @click="submitForm">确 定</el-button> | ||
| 223 | - <el-button @click="cancel">取 消</el-button> | ||
| 224 | - </div> | ||
| 225 | - </el-dialog> | ||
| 226 | - </div> | ||
| 227 | -</template> | ||
| 228 | - | ||
| 229 | -<script> | ||
| 230 | -import { create, update, deleteCouponTemplete, get, getPage, exportExcel } from "@/api/mall/CouponTemplete/CouponTemplete.js"; | ||
| 231 | -import {getDictDatas} from "@/utils/dict"; | ||
| 232 | - | ||
| 233 | -export default { | ||
| 234 | - name: "", | ||
| 235 | - components: { | ||
| 236 | - }, | ||
| 237 | - data() { | ||
| 238 | - return { | ||
| 239 | - // 遮罩层 | ||
| 240 | - loading: true, | ||
| 241 | - // 导出遮罩层 | ||
| 242 | - exportLoading: false, | ||
| 243 | - // 显示搜索条件 | ||
| 244 | - showSearch: true, | ||
| 245 | - // 总条数 | ||
| 246 | - total: 0, | ||
| 247 | - // 优惠券模板列表 | ||
| 248 | - list: [], | ||
| 249 | - // 弹出层标题 | ||
| 250 | - title: "", | ||
| 251 | - // 是否显示弹出层 | ||
| 252 | - open: false, | ||
| 253 | - // 查询参数 | ||
| 254 | - queryParams: { | ||
| 255 | - pageNo: 1, | ||
| 256 | - pageSize: 10, | ||
| 257 | - type: null, | ||
| 258 | - name: null, | ||
| 259 | - couponNameRemark: null, | ||
| 260 | - image: null, | ||
| 261 | - count: null, | ||
| 262 | - leadCount: null, | ||
| 263 | - usedCount: null, | ||
| 264 | - goodsType: null, | ||
| 265 | - productIds: null, | ||
| 266 | - hasUseLimit: null, | ||
| 267 | - atLeast: null, | ||
| 268 | - money: null, | ||
| 269 | - discount: null, | ||
| 270 | - discountLimit: null, | ||
| 271 | - minMoney: null, | ||
| 272 | - maxMoney: null, | ||
| 273 | - validityType: null, | ||
| 274 | - startUseTime: [], | ||
| 275 | - endUseTime: [], | ||
| 276 | - fixedTerm: null, | ||
| 277 | - whetherLimitless: null, | ||
| 278 | - maxFetch: null, | ||
| 279 | - whetherExpireNotice: null, | ||
| 280 | - expireNoticeFixedTerm: null, | ||
| 281 | - whetherForbidPreference: null, | ||
| 282 | - whetherShow: null, | ||
| 283 | - discountOrderMoney: null, | ||
| 284 | - orderMoney: null, | ||
| 285 | - whetherForbidden: null, | ||
| 286 | - orderGoodsNum: null, | ||
| 287 | - status: null, | ||
| 288 | - endTime: [], | ||
| 289 | - createTime: [], | ||
| 290 | - }, | ||
| 291 | - //数据字典 | ||
| 292 | - datas:getDictDatas(), | ||
| 293 | - | ||
| 294 | - // 表单参数 | ||
| 295 | - form: {}, | ||
| 296 | - // 表单校验 | ||
| 297 | - rules: { | ||
| 298 | - type: [{ required: true, message: "优惠券类型 reward-满减 discount-折扣 random-随机不能为空", trigger: "change" }], | ||
| 299 | - name: [{ required: true, message: "优惠券名称不能为空", trigger: "blur" }], | ||
| 300 | - count: [{ required: true, message: "发放数量不能为空", trigger: "blur" }], | ||
| 301 | - leadCount: [{ required: true, message: "已领取数量不能为空", trigger: "blur" }], | ||
| 302 | - usedCount: [{ required: true, message: "已使用数量不能为空", trigger: "blur" }], | ||
| 303 | - goodsType: [{ required: true, message: "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用不能为空", trigger: "blur" }], | ||
| 304 | - hasUseLimit: [{ required: true, message: "使用门槛0-无门槛 1-有门槛不能为空", trigger: "blur" }], | ||
| 305 | - atLeast: [{ required: true, message: "满多少元使用 0代表无限制不能为空", trigger: "blur" }], | ||
| 306 | - money: [{ required: true, message: "发放面额 当type为reward时需要添加不能为空", trigger: "blur" }], | ||
| 307 | - discount: [{ required: true, message: "1 =< 折扣 <= 9.9 当type为discount时需要添加不能为空", trigger: "blur" }], | ||
| 308 | - discountLimit: [{ required: true, message: "最多折扣金额 当type为discount时可选择性添加不能为空", trigger: "blur" }], | ||
| 309 | - minMoney: [{ required: true, message: "最低金额 当type为radom时需要添加不能为空", trigger: "blur" }], | ||
| 310 | - maxMoney: [{ required: true, message: "最大金额 当type为radom时需要添加不能为空", trigger: "blur" }], | ||
| 311 | - validityType: [{ required: true, message: "过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期不能为空", trigger: "blur" }], | ||
| 312 | - fixedTerm: [{ required: true, message: "当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效不能为空", trigger: "blur" }], | ||
| 313 | - whetherLimitless: [{ required: true, message: "是否无限制0-否 1是不能为空", trigger: "blur" }], | ||
| 314 | - maxFetch: [{ required: true, message: "每人最大领取个数不能为空", trigger: "blur" }], | ||
| 315 | - whetherExpireNotice: [{ required: true, message: "是否开启过期提醒0-不开启 1-开启不能为空", trigger: "blur" }], | ||
| 316 | - expireNoticeFixedTerm: [{ required: true, message: "过期前N天提醒不能为空", trigger: "blur" }], | ||
| 317 | - whetherForbidPreference: [{ required: true, message: "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用不能为空", trigger: "blur" }], | ||
| 318 | - whetherShow: [{ required: true, message: "是否显示不能为空", trigger: "blur" }], | ||
| 319 | - discountOrderMoney: [{ required: true, message: "订单的优惠总金额不能为空", trigger: "blur" }], | ||
| 320 | - orderMoney: [{ required: true, message: "用券总成交额不能为空", trigger: "blur" }], | ||
| 321 | - whetherForbidden: [{ required: true, message: "是否禁止发放0-否 1-是不能为空", trigger: "blur" }], | ||
| 322 | - orderGoodsNum: [{ required: true, message: "使用优惠券购买的商品数量不能为空", trigger: "blur" }], | ||
| 323 | - status: [{ required: true, message: "状态(1进行中2已结束-1已关闭)不能为空", trigger: "blur" }], | ||
| 324 | - } | ||
| 325 | - }; | ||
| 326 | - }, | ||
| 327 | - created() { | ||
| 328 | - this.getList(); | ||
| 329 | - }, | ||
| 330 | - methods: { | ||
| 331 | - /** 查询列表 */ | ||
| 332 | - getList() { | ||
| 333 | - this.loading = true; | ||
| 334 | - // 执行查询 | ||
| 335 | - getPage(this.queryParams).then(response => { | ||
| 336 | - this.list = response.data.list; | ||
| 337 | - this.total = response.data.total; | ||
| 338 | - this.loading = false; | ||
| 339 | - }); | ||
| 340 | - }, | ||
| 341 | - /** 取消按钮 */ | ||
| 342 | - cancel() { | ||
| 343 | - this.open = false; | ||
| 344 | - this.reset(); | ||
| 345 | - }, | ||
| 346 | - /** 表单重置 */ | ||
| 347 | - reset() { | ||
| 348 | - this.form = { | ||
| 349 | - id: undefined, | ||
| 350 | - type: undefined, | ||
| 351 | - name: undefined, | ||
| 352 | - couponNameRemark: undefined, | ||
| 353 | - image: undefined, | ||
| 354 | - count: undefined, | ||
| 355 | - leadCount: undefined, | ||
| 356 | - usedCount: undefined, | ||
| 357 | - goodsType: undefined, | ||
| 358 | - productIds: undefined, | ||
| 359 | - hasUseLimit: undefined, | ||
| 360 | - atLeast: undefined, | ||
| 361 | - money: undefined, | ||
| 362 | - discount: undefined, | ||
| 363 | - discountLimit: undefined, | ||
| 364 | - minMoney: undefined, | ||
| 365 | - maxMoney: undefined, | ||
| 366 | - validityType: undefined, | ||
| 367 | - startUseTime: undefined, | ||
| 368 | - endUseTime: undefined, | ||
| 369 | - fixedTerm: undefined, | ||
| 370 | - whetherLimitless: undefined, | ||
| 371 | - maxFetch: undefined, | ||
| 372 | - whetherExpireNotice: undefined, | ||
| 373 | - expireNoticeFixedTerm: undefined, | ||
| 374 | - whetherForbidPreference: undefined, | ||
| 375 | - whetherShow: undefined, | ||
| 376 | - discountOrderMoney: undefined, | ||
| 377 | - orderMoney: undefined, | ||
| 378 | - whetherForbidden: undefined, | ||
| 379 | - orderGoodsNum: undefined, | ||
| 380 | - status: undefined, | ||
| 381 | - endTime: undefined, | ||
| 382 | - }; | ||
| 383 | - this.resetForm("form"); | ||
| 384 | - }, | ||
| 385 | - /** 搜索按钮操作 */ | ||
| 386 | - handleQuery() { | ||
| 387 | - this.queryParams.pageNo = 1; | ||
| 388 | - this.getList(); | ||
| 389 | - }, | ||
| 390 | - /** 重置按钮操作 */ | ||
| 391 | - resetQuery() { | ||
| 392 | - this.resetForm("queryForm"); | ||
| 393 | - this.handleQuery(); | ||
| 394 | - }, | ||
| 395 | - /** 新增按钮操作 */ | ||
| 396 | - handleAdd() { | ||
| 397 | - this.reset(); | ||
| 398 | - this.open = true; | ||
| 399 | - this.title = "添加优惠券模板"; | ||
| 400 | - }, | ||
| 401 | - /** 修改按钮操作 */ | ||
| 402 | - handleUpdate(row) { | ||
| 403 | - this.reset(); | ||
| 404 | - const id = row.id; | ||
| 405 | - get(id).then(response => { | ||
| 406 | - this.form = response.data; | ||
| 407 | - this.open = true; | ||
| 408 | - this.title = "修改优惠券模板"; | ||
| 409 | - }); | ||
| 410 | - }, | ||
| 411 | - /** 提交按钮 */ | ||
| 412 | - submitForm() { | ||
| 413 | - this.$refs["form"].validate(valid => { | ||
| 414 | - if (!valid) { | ||
| 415 | - return; | ||
| 416 | - } | ||
| 417 | - // 修改的提交 | ||
| 418 | - if (this.form.id != null) { | ||
| 419 | - update(this.form).then(response => { | ||
| 420 | - this.$modal.msgSuccess("修改成功"); | ||
| 421 | - this.open = false; | ||
| 422 | - this.getList(); | ||
| 423 | - }); | ||
| 424 | - return; | ||
| 425 | - } | ||
| 426 | - // 添加的提交 | ||
| 427 | - create(this.form).then(response => { | ||
| 428 | - this.$modal.msgSuccess("新增成功"); | ||
| 429 | - this.open = false; | ||
| 430 | - this.getList(); | ||
| 431 | - }); | ||
| 432 | - }); | ||
| 433 | - }, | ||
| 434 | - /** 删除按钮操作 */ | ||
| 435 | - handleDelete(row) { | ||
| 436 | - const id = row.id; | ||
| 437 | - this.$modal.confirm('是否确认删除优惠券模板编号为"' + id + '"的数据项?').then(function() { | ||
| 438 | - return deleteCouponTemplete(id); | ||
| 439 | - }).then(() => { | ||
| 440 | - this.getList(); | ||
| 441 | - this.$modal.msgSuccess("删除成功"); | ||
| 442 | - }).catch(() => {}); | ||
| 443 | - }, | ||
| 444 | - /** 导出按钮操作 */ | ||
| 445 | - handleExport() { | ||
| 446 | - // 处理查询参数 | ||
| 447 | - let params = {...this.queryParams}; | ||
| 448 | - params.pageNo = undefined; | ||
| 449 | - params.pageSize = undefined; | ||
| 450 | - this.$modal.confirm('是否确认导出所有优惠券模板数据项?').then(() => { | ||
| 451 | - this.exportLoading = true; | ||
| 452 | - return exportExcel(params); | ||
| 453 | - }).then(response => { | ||
| 454 | - this.$download.excel(response, '优惠券模板.xls'); | ||
| 455 | - this.exportLoading = false; | ||
| 456 | - }).catch(() => {}); | ||
| 457 | - } | ||
| 458 | - } | ||
| 459 | -}; | ||
| 460 | -</script> |
yudao-ui-admin/src/views/promotion/couponTemplate/index.vue renamed to yudao-ui-admin/src/views/mall/promotion/couponTemplate/index.vue
| @@ -108,7 +108,7 @@ | @@ -108,7 +108,7 @@ | ||
| 108 | </el-radio-group> | 108 | </el-radio-group> |
| 109 | </el-form-item> | 109 | </el-form-item> |
| 110 | <el-form-item v-if="form.takeType === 1" label="发放数量" prop="totalCount"> | 110 | <el-form-item v-if="form.takeType === 1" label="发放数量" prop="totalCount"> |
| 111 | - <el-input-number v-model="form.usePrice" placeholder="发放数量,没有之后不能领取或发放,-1 为不限制" | 111 | + <el-input-number v-model="form.totalCount" placeholder="发放数量,没有之后不能领取或发放,-1 为不限制" |
| 112 | style="width: 400px" :precision="0" :min="-1" /> 张 | 112 | style="width: 400px" :precision="0" :min="-1" /> 张 |
| 113 | </el-form-item> | 113 | </el-form-item> |
| 114 | <el-form-item v-if="form.takeType === 1" label="每人限领个数" prop="takeLimitCount"> | 114 | <el-form-item v-if="form.takeType === 1" label="每人限领个数" prop="takeLimitCount"> |
| @@ -122,8 +122,8 @@ | @@ -122,8 +122,8 @@ | ||
| 122 | </el-radio-group> | 122 | </el-radio-group> |
| 123 | </el-form-item> | 123 | </el-form-item> |
| 124 | <el-form-item v-if="form.validityType === CouponTemplateValidityTypeEnum.DATE.type" label="固定日期" prop="validTimes"> | 124 | <el-form-item v-if="form.validityType === CouponTemplateValidityTypeEnum.DATE.type" label="固定日期" prop="validTimes"> |
| 125 | - <el-date-picker v-model="queryParams.validTimes" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange" | ||
| 126 | - range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" /> | 125 | + <el-date-picker v-model="form.validTimes" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" |
| 126 | + :default-time="['00:00:00', '23:59:59']" /> | ||
| 127 | </el-form-item> | 127 | </el-form-item> |
| 128 | <el-form-item v-if="form.validityType === CouponTemplateValidityTypeEnum.TERM.type" label="领取日期" prop="fixedStartTerm"> | 128 | <el-form-item v-if="form.validityType === CouponTemplateValidityTypeEnum.TERM.type" label="领取日期" prop="fixedStartTerm"> |
| 129 | 第 <el-input-number v-model="form.fixedStartTerm" placeholder="0 为今天生效" | 129 | 第 <el-input-number v-model="form.fixedStartTerm" placeholder="0 为今天生效" |
| @@ -138,7 +138,13 @@ | @@ -138,7 +138,13 @@ | ||
| 138 | </el-radio-group> | 138 | </el-radio-group> |
| 139 | </el-form-item> | 139 | </el-form-item> |
| 140 | <el-form-item v-if="form.productScope === PromotionProductScopeEnum.SPU.scope" prop="productSpuIds"> | 140 | <el-form-item v-if="form.productScope === PromotionProductScopeEnum.SPU.scope" prop="productSpuIds"> |
| 141 | - <el-input v-model="form.productSpuIds" placeholder="请输入商品 SPU 编号的数组" /> | 141 | + <el-select v-model="form.productSpuIds" placeholder="请选择活动商品" clearable size="small" |
| 142 | + multiple filterable style="width: 400px"> | ||
| 143 | + <el-option v-for="item in productSpus" :key="item.id" :label="item.name" :value="item.id"> | ||
| 144 | + <span style="float: left">{{ item.name }}</span> | ||
| 145 | + <span style="float: right; color: #8492a6; font-size: 13px">¥{{ (item.minPrice / 100.0).toFixed(2) }}</span> | ||
| 146 | + </el-option> | ||
| 147 | + </el-select> | ||
| 142 | </el-form-item> | 148 | </el-form-item> |
| 143 | </el-form> | 149 | </el-form> |
| 144 | <div slot="footer" class="dialog-footer"> | 150 | <div slot="footer" class="dialog-footer"> |
| @@ -150,8 +156,10 @@ | @@ -150,8 +156,10 @@ | ||
| 150 | </template> | 156 | </template> |
| 151 | 157 | ||
| 152 | <script> | 158 | <script> |
| 153 | -import { createCouponTemplate, updateCouponTemplate, deleteCouponTemplate, getCouponTemplate, getCouponTemplatePage } from "@/api/promotion/couponTemplate"; | ||
| 154 | -import { CommonStatusEnum, CouponTemplateValidityTypeEnum, PromotionDiscountTypeEnum, PromotionProductScopeEnum} from "@/utils/constants"; | 159 | +import { createCouponTemplate, updateCouponTemplate, deleteCouponTemplate, getCouponTemplate, getCouponTemplatePage } from "@/api/mall/promotion/couponTemplate"; |
| 160 | +import { CouponTemplateValidityTypeEnum, PromotionDiscountTypeEnum, PromotionProductScopeEnum} from "@/utils/constants"; | ||
| 161 | +import { getSpuSimpleList } from "@/api/mall/product/spu"; | ||
| 162 | +import { parseTime } from "@/utils/ruoyi"; | ||
| 155 | 163 | ||
| 156 | export default { | 164 | export default { |
| 157 | name: "CouponTemplate", | 165 | name: "CouponTemplate", |
| @@ -202,6 +210,8 @@ export default { | @@ -202,6 +210,8 @@ export default { | ||
| 202 | productScope: [{ required: true, message: "商品范围不能为空", trigger: "blur" }], | 210 | productScope: [{ required: true, message: "商品范围不能为空", trigger: "blur" }], |
| 203 | productSpuIds: [{ required: true, message: "商品范围不能为空", trigger: "blur" }], | 211 | productSpuIds: [{ required: true, message: "商品范围不能为空", trigger: "blur" }], |
| 204 | }, | 212 | }, |
| 213 | + // 商品列表 | ||
| 214 | + productSpus: [], | ||
| 205 | // 如下的变量,主要为了 v-if 判断可以使用到 | 215 | // 如下的变量,主要为了 v-if 判断可以使用到 |
| 206 | PromotionProductScopeEnum: PromotionProductScopeEnum, | 216 | PromotionProductScopeEnum: PromotionProductScopeEnum, |
| 207 | CouponTemplateValidityTypeEnum: CouponTemplateValidityTypeEnum, | 217 | CouponTemplateValidityTypeEnum: CouponTemplateValidityTypeEnum, |
| @@ -221,6 +231,10 @@ export default { | @@ -221,6 +231,10 @@ export default { | ||
| 221 | this.total = response.data.total; | 231 | this.total = response.data.total; |
| 222 | this.loading = false; | 232 | this.loading = false; |
| 223 | }); | 233 | }); |
| 234 | + // 查询商品列表 | ||
| 235 | + getSpuSimpleList().then(response => { | ||
| 236 | + this.productSpus = response.data | ||
| 237 | + }) | ||
| 224 | }, | 238 | }, |
| 225 | /** 取消按钮 */ | 239 | /** 取消按钮 */ |
| 226 | cancel() { | 240 | cancel() { |
| @@ -233,7 +247,7 @@ export default { | @@ -233,7 +247,7 @@ export default { | ||
| 233 | id: undefined, | 247 | id: undefined, |
| 234 | name: undefined, | 248 | name: undefined, |
| 235 | discountType: PromotionDiscountTypeEnum.PRICE.type, | 249 | discountType: PromotionDiscountTypeEnum.PRICE.type, |
| 236 | - discountPrice: 0, | 250 | + discountPrice: undefined, |
| 237 | discountPercent: undefined, | 251 | discountPercent: undefined, |
| 238 | discountLimitPrice: undefined, | 252 | discountLimitPrice: undefined, |
| 239 | usePrice: undefined, | 253 | usePrice: undefined, |
| @@ -274,9 +288,11 @@ export default { | @@ -274,9 +288,11 @@ export default { | ||
| 274 | getCouponTemplate(id).then(response => { | 288 | getCouponTemplate(id).then(response => { |
| 275 | this.form = { | 289 | this.form = { |
| 276 | ...response.data, | 290 | ...response.data, |
| 277 | - discountPrice: response.data.discountPrice ? response.data.discountPrice / 100.0 : undefined, | ||
| 278 | - discountPercent: response.data.discountPercent ? response.data.discountPercent / 10.0 : undefined, | ||
| 279 | - usePrice: response.data.usePrice ? response.data.usePrice / 100.0 : undefined, | 291 | + discountPrice: response.data.discountPrice !== undefined ? response.data.discountPrice / 100.0 : undefined, |
| 292 | + discountPercent: response.data.discountPercent !== undefined ? response.data.discountPercent / 10.0 : undefined, | ||
| 293 | + discountLimitPrice: response.data.discountLimitPrice !== undefined ? response.data.discountLimitPrice / 100.0 : undefined, | ||
| 294 | + usePrice: response.data.usePrice !== undefined ? response.data.usePrice / 100.0 : undefined, | ||
| 295 | + validTimes: [response.data.validStartTime, response.data.validEndTime] | ||
| 280 | } | 296 | } |
| 281 | this.open = true; | 297 | this.open = true; |
| 282 | this.title = "修改优惠劵"; | 298 | this.title = "修改优惠劵"; |
| @@ -291,9 +307,12 @@ export default { | @@ -291,9 +307,12 @@ export default { | ||
| 291 | // 金额相关字段的缩放 | 307 | // 金额相关字段的缩放 |
| 292 | let data = { | 308 | let data = { |
| 293 | ...this.form, | 309 | ...this.form, |
| 294 | - discountPrice: this.form.discountPrice ? this.form.discountPrice * 100 : undefined, | ||
| 295 | - discountPercent: this.form.discountPercent ? this.form.discountPercent * 10 : undefined, | ||
| 296 | - usePrice: this.form.usePrice ? this.form.usePrice * 100 : undefined, | 310 | + discountPrice: this.form.discountPrice !== undefined ? this.form.discountPrice * 100 : undefined, |
| 311 | + discountPercent: this.form.discountPercent !== undefined ? this.form.discountPercent * 10 : undefined, | ||
| 312 | + discountLimitPrice: this.form.discountLimitPrice !== undefined ? this.form.discountLimitPrice * 100 : undefined, | ||
| 313 | + usePrice: this.form.usePrice !== undefined ? this.form.usePrice * 100 : undefined, | ||
| 314 | + validStartTime: this.form.validTimes && this.form.validTimes.length === 2 ? this.form.validTimes[0] : undefined, | ||
| 315 | + validEndTime: this.form.validTimes && this.form.validTimes.length === 2 ? this.form.validTimes[1] : undefined, | ||
| 297 | } | 316 | } |
| 298 | // 修改的提交 | 317 | // 修改的提交 |
| 299 | if (this.form.id != null) { | 318 | if (this.form.id != null) { |