promotion:完善优惠劵模板的功能
parent
2aaeb7af88
commit
bd661296c0
|
@ -53,6 +53,7 @@ public class ProductSpuController {
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO 芋艿:修改接口
|
||||||
@GetMapping("/get/detail")
|
@GetMapping("/get/detail")
|
||||||
@ApiOperation("获得商品 SPU")
|
@ApiOperation("获得商品 SPU")
|
||||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||||
|
@ -79,6 +80,14 @@ public class ProductSpuController {
|
||||||
return success(ProductSpuConvert.INSTANCE.convertList(list));
|
return success(ProductSpuConvert.INSTANCE.convertList(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-simple-list")
|
||||||
|
@ApiOperation("获得商品 SPU 精简列表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('product:spu:query')")
|
||||||
|
public CommonResult<List<ProductSpuSimpleRespVO>> getSpuSimpleList() {
|
||||||
|
List<ProductSpuDO> list = spuService.getSpuList();
|
||||||
|
return success(ProductSpuConvert.INSTANCE.convertList02(list));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@ApiOperation("获得商品 SPU 分页")
|
@ApiOperation("获得商品 SPU 分页")
|
||||||
@PreAuthorize("@ss.hasPermission('product:spu:query')")
|
@PreAuthorize("@ss.hasPermission('product:spu:query')")
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@ApiModel("管理后台 - 商品 SPU 精简 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class ProductSpuSimpleRespVO extends ProductSpuBaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "主键", required = true, example = "1")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商品名称", required = true, example = "芋道")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = " 最小价格,单位使用:分", required = true, example = "1024")
|
||||||
|
private Integer minPrice;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "最大价格,单位使用:分", required = true, example = "1024")
|
||||||
|
private Integer maxPrice;
|
||||||
|
|
||||||
|
}
|
|
@ -37,4 +37,6 @@ public interface ProductSpuConvert {
|
||||||
|
|
||||||
List<SpuInfoRespDTO> convertList2(List<ProductSpuDO> list);
|
List<SpuInfoRespDTO> convertList2(List<ProductSpuDO> list);
|
||||||
|
|
||||||
|
List<ProductSpuSimpleRespVO> convertList02(List<ProductSpuDO> list);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,13 @@ public interface ProductSpuService {
|
||||||
*/
|
*/
|
||||||
List<ProductSpuDO> getSpuList(Collection<Long> ids);
|
List<ProductSpuDO> getSpuList(Collection<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得所有商品 SPU 列表
|
||||||
|
*
|
||||||
|
* @return 商品 SPU 列表
|
||||||
|
*/
|
||||||
|
List<ProductSpuDO> getSpuList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得商品 SPU 分页
|
* 获得商品 SPU 分页
|
||||||
*
|
*
|
||||||
|
|
|
@ -176,6 +176,11 @@ public class ProductSpuServiceImpl implements ProductSpuService {
|
||||||
return productSpuMapper.selectBatchIds(ids);
|
return productSpuMapper.selectBatchIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ProductSpuDO> getSpuList() {
|
||||||
|
return productSpuMapper.selectList();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ProductSpuRespVO> getSpuPage(ProductSpuPageReqVO pageReqVO) {
|
public PageResult<ProductSpuRespVO> getSpuPage(ProductSpuPageReqVO pageReqVO) {
|
||||||
// 库存告警的 SPU 编号的集合
|
// 库存告警的 SPU 编号的集合
|
||||||
|
|
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||||
import cn.iocoder.yudao.module.promotion.enums.common.PromotionDiscountTypeEnum;
|
import cn.iocoder.yudao.module.promotion.enums.common.PromotionDiscountTypeEnum;
|
||||||
import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum;
|
import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum;
|
||||||
import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTemplateValidityTypeEnum;
|
import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTemplateValidityTypeEnum;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -19,6 +20,7 @@ import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 优惠劵模板 Base VO,提供给添加、修改、详细的子 VO 使用
|
* 优惠劵模板 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||||
|
@ -62,10 +64,12 @@ public class CouponTemplateBaseVO {
|
||||||
|
|
||||||
@ApiModelProperty(value = "固定日期 - 生效开始时间")
|
@ApiModelProperty(value = "固定日期 - 生效开始时间")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
|
||||||
private Date validStartTime;
|
private Date validStartTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "固定日期 - 生效结束时间")
|
@ApiModelProperty(value = "固定日期 - 生效结束时间")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
|
||||||
private Date validEndTime;
|
private Date validEndTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "领取日期 - 开始天数")
|
@ApiModelProperty(value = "领取日期 - 开始天数")
|
||||||
|
@ -82,15 +86,14 @@ public class CouponTemplateBaseVO {
|
||||||
private Integer discountType;
|
private Integer discountType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "折扣百分比", example = "80", notes = "例如说,80% 为 80")
|
@ApiModelProperty(value = "折扣百分比", example = "80", notes = "例如说,80% 为 80")
|
||||||
@Min(value = 1)
|
|
||||||
private Integer discountPercent;
|
private Integer discountPercent;
|
||||||
|
|
||||||
@ApiModelProperty(value = "优惠金额", example = "10", notes = "单位:分")
|
@ApiModelProperty(value = "优惠金额", example = "10", notes = "单位:分")
|
||||||
@Min(value = 1)
|
@Min(value = 0, message = "优惠金额需要大于等于 0")
|
||||||
private Integer discountPrice;
|
private Integer discountPrice;
|
||||||
|
|
||||||
@ApiModelProperty(value = "折扣上限", example = "100", notes = "单位:分,仅在 discountType 为 PERCENT 使用")
|
@ApiModelProperty(value = "折扣上限", example = "100", notes = "单位:分,仅在 discountType 为 PERCENT 使用")
|
||||||
private Integer discountPriceLimit;
|
private Integer discountLimitPrice;
|
||||||
|
|
||||||
@AssertTrue(message = "商品 SPU 编号的数组不能为空")
|
@AssertTrue(message = "商品 SPU 编号的数组不能为空")
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
|
@ -127,11 +130,11 @@ public class CouponTemplateBaseVO {
|
||||||
|| fixedEndTerm != null;
|
|| fixedEndTerm != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@AssertTrue(message = "折扣百分比不能为空")
|
@AssertTrue(message = "折扣百分比需要大于等于 1")
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
public boolean isDiscountPercentValid() {
|
public boolean isDiscountPercentValid() {
|
||||||
return ObjectUtil.notEqual(discountType, PromotionDiscountTypeEnum.PERCENT.getType())
|
return ObjectUtil.notEqual(discountType, PromotionDiscountTypeEnum.PERCENT.getType())
|
||||||
|| discountPercent != null;
|
|| (discountPercent != null && discountPercent >= 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AssertTrue(message = "优惠金额不能为空")
|
@AssertTrue(message = "优惠金额不能为空")
|
||||||
|
@ -143,9 +146,9 @@ public class CouponTemplateBaseVO {
|
||||||
|
|
||||||
@AssertTrue(message = "折扣上限不能为空")
|
@AssertTrue(message = "折扣上限不能为空")
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
public boolean isDiscountPriceLimit() {
|
public boolean isDiscountLimitPriceValid() {
|
||||||
return ObjectUtil.notEqual(discountType, PromotionDiscountTypeEnum.PERCENT.getType())
|
return ObjectUtil.notEqual(discountType, PromotionDiscountTypeEnum.PERCENT.getType())
|
||||||
|| discountPriceLimit != null;
|
|| discountLimitPrice != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package cn.iocoder.yudao.module.promotion.service.coupon;
|
package cn.iocoder.yudao.module.promotion.service.coupon;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.CouponTemplateCreateReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.CouponTemplateCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.CouponTemplatePageReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.CouponTemplatePageReqVO;
|
||||||
|
@ -30,7 +31,8 @@ public class CouponTemplateServiceImpl implements CouponTemplateService {
|
||||||
@Override
|
@Override
|
||||||
public Long createCouponTemplate(CouponTemplateCreateReqVO createReqVO) {
|
public Long createCouponTemplate(CouponTemplateCreateReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
CouponTemplateDO couponTemplate = CouponTemplateConvert.INSTANCE.convert(createReqVO);
|
CouponTemplateDO couponTemplate = CouponTemplateConvert.INSTANCE.convert(createReqVO)
|
||||||
|
.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||||
couponTemplateMapper.insert(couponTemplate);
|
couponTemplateMapper.insert(couponTemplate);
|
||||||
// 返回
|
// 返回
|
||||||
return couponTemplate.getId();
|
return couponTemplate.getId();
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
import request from '@/utils/request'
|
|
||||||
|
|
||||||
// 创建优惠券模板
|
|
||||||
export function create(data) {
|
|
||||||
return request({
|
|
||||||
url: '/coupon/template/create',
|
|
||||||
method: 'post',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新优惠券模板
|
|
||||||
export function update(data) {
|
|
||||||
return request({
|
|
||||||
url: '/coupon/template/update',
|
|
||||||
method: 'put',
|
|
||||||
data: data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除优惠券模板
|
|
||||||
export function deleteCouponTemplete (id) {
|
|
||||||
return request({
|
|
||||||
url: '/coupon/template/delete?id=' + id,
|
|
||||||
method: 'delete'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获得优惠券模板
|
|
||||||
export function get(id) {
|
|
||||||
return request({
|
|
||||||
url: '/coupon/template/get?id=' + id,
|
|
||||||
method: 'get'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获得优惠券模板分页
|
|
||||||
export function getPage(query) {
|
|
||||||
return request({
|
|
||||||
url: '/coupon/template/page',
|
|
||||||
method: 'get',
|
|
||||||
params: query
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 导出优惠券模板 Excel
|
|
||||||
export function exportExcel(query) {
|
|
||||||
return request({
|
|
||||||
url: '/coupon/template/export-excel',
|
|
||||||
method: 'get',
|
|
||||||
params: query,
|
|
||||||
responseType: 'blob'
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -50,3 +50,11 @@ export function getSpuPage(query) {
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获得商品 SPU 精简列表
|
||||||
|
export function getSpuSimpleList() {
|
||||||
|
return request({
|
||||||
|
url: '/product/spu/get-simple-list',
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -1,460 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="app-container">
|
|
||||||
|
|
||||||
<!-- 搜索工作栏 -->
|
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
||||||
<el-form-item label="优惠券类" prop="type">
|
|
||||||
<el-select v-model="queryParams.type" placeholder="请选择优惠券类型 reward-满减 discount-折扣 random-随机" clearable size="small">
|
|
||||||
<el-option label="请选择字典生成" value="" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="优惠券名称" prop="name">
|
|
||||||
<el-input v-model="queryParams.name" placeholder="请输入优惠券名称" clearable @keyup.enter.native="handleQuery"/>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="状态" prop="status">
|
|
||||||
<el-select v-model="queryParams.status" placeholder="请选择状态(1进行中2已结束-1已关闭)" clearable size="small">
|
|
||||||
<el-option label="请选择字典生成" value="" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="有效日期结束时间" prop="endTime">
|
|
||||||
<el-date-picker v-model="queryParams.endTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
|
|
||||||
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item>
|
|
||||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
|
||||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
|
|
||||||
<!-- 操作工具栏 -->
|
|
||||||
<el-row :gutter="10" class="mb8">
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
|
||||||
v-hasPermi="['CouponTemplete::create']">新增</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
|
|
||||||
v-hasPermi="['CouponTemplete::export']">导出</el-button>
|
|
||||||
</el-col>
|
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<!-- 列表 -->
|
|
||||||
<el-table v-loading="loading" :data="list">
|
|
||||||
|
|
||||||
<!-- todo 优惠券类型-->
|
|
||||||
<el-table-column label="优惠券类型" align="center" prop="type" />
|
|
||||||
<el-table-column label="优惠券名称" align="center" prop="name" />
|
|
||||||
<el-table-column label="优惠券图片" align="center" prop="image" />
|
|
||||||
<el-table-column label="发放数量" align="center" prop="count" />
|
|
||||||
<el-table-column label="已领取数量" align="center" prop="leadCount" />
|
|
||||||
<el-table-column label="已使用数量" align="center" prop="usedCount" />
|
|
||||||
<!-- todo 适用商品类型-->
|
|
||||||
<!-- <el-table-column label="适用商品类型" align="center" prop="goodsType" />-->
|
|
||||||
<!-- todo 使用门槛0-无门槛 1-有门槛-->
|
|
||||||
|
|
||||||
<el-table-column label="使用门槛" align="center" prop="hasUseLimit" />
|
|
||||||
<!-- <el-table-column label="满多少元使用 0代表无限制" align="center" prop="atLeast" />-->
|
|
||||||
<!-- todo 发放面额 折扣-->
|
|
||||||
<el-table-column label="优惠金额/折扣" align="center" prop="money" />
|
|
||||||
<!-- <el-table-column label="1 =< 折扣 <= 9.9 当type为discount时需要添加" align="center" prop="discount" />-->
|
|
||||||
<!-- <el-table-column label="最多折扣金额 当type为discount时可选择性添加" align="center" prop="discountLimit" />-->
|
|
||||||
<!-- <el-table-column label="最低金额 当type为radom时需要添加" align="center" prop="minMoney" />-->
|
|
||||||
<!-- <el-table-column label="最大金额 当type为radom时需要添加" align="center" prop="maxMoney" />-->
|
|
||||||
<!-- todo 1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期 -->
|
|
||||||
<el-table-column label="有效期限" align="center" prop="validityType" />
|
|
||||||
<!-- <el-table-column label="使用开始日期 过期类型1时必填" align="center" prop="startUseTime" width="180">-->
|
|
||||||
<!-- <template slot-scope="scope">-->
|
|
||||||
<!-- <span>{{ parseTime(scope.row.startUseTime) }}</span>-->
|
|
||||||
<!-- </template>-->
|
|
||||||
<!-- </el-table-column>-->
|
|
||||||
<!-- <el-table-column label="使用结束日期 过期类型1时必填" align="center" prop="endUseTime" width="180">-->
|
|
||||||
<!-- <template slot-scope="scope">-->
|
|
||||||
<!-- <span>{{ parseTime(scope.row.endUseTime) }}</span>-->
|
|
||||||
<!-- </template>-->
|
|
||||||
<!-- </el-table-column>-->
|
|
||||||
<!-- <el-table-column label="有效日期结束时间" align="center" prop="endTime" width="180">-->
|
|
||||||
<!-- <template slot-scope="scope">-->
|
|
||||||
<!-- <span>{{ parseTime(scope.row.endTime) }}</span>-->
|
|
||||||
<!-- </template>-->
|
|
||||||
<!-- </el-table-column>-->
|
|
||||||
<!-- <el-table-column label="当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效" align="center" prop="fixedTerm" />-->
|
|
||||||
<!-- <el-table-column label="是否无限制0-否 1是" align="center" prop="whetherLimitless" />-->
|
|
||||||
<el-table-column label="领取上限" align="center" prop="maxFetch" />
|
|
||||||
<!-- todo 0-不限制 1- 优惠券仅原价购买商品时可用-->
|
|
||||||
<el-table-column label="优惠叠加" align="center" prop="whetherForbidPreference" />
|
|
||||||
<el-table-column label="是否显示" align="center" prop="whetherShow" />
|
|
||||||
<el-table-column label="订单的优惠总金额" align="center" prop="discountOrderMoney" />
|
|
||||||
<el-table-column label="用券总成交额" align="center" prop="orderMoney" />
|
|
||||||
<el-table-column label="是否禁止发放" align="center" prop="whetherForbidden" />
|
|
||||||
<el-table-column label="使用优惠券购买的商品数量" align="center" prop="orderGoodsNum" />
|
|
||||||
<el-table-column label="状态" align="center" prop="status" />
|
|
||||||
|
|
||||||
<el-table-column label="备注" align="center" prop="couponNameRemark" />
|
|
||||||
|
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
||||||
|
|
||||||
<template #scope>
|
|
||||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
|
||||||
v-hasPermi="['CouponTemplete::update']">修改</el-button>
|
|
||||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
|
||||||
v-hasPermi="['CouponTemplete::delete']">删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<!-- 分页组件 -->
|
|
||||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
|
||||||
@pagination="getList"/>
|
|
||||||
|
|
||||||
<!-- 对话框(添加 / 修改) -->
|
|
||||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
|
|
||||||
<el-form-item label="优惠券类型" prop="type">
|
|
||||||
<el-select v-model="form.type" placeholder="请选择优惠券类型 reward-满减 discount-折扣 random-随机">
|
|
||||||
<el-option label="请选择字典生成" value="" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="优惠券名称" prop="name">
|
|
||||||
<el-input v-model="form.name" placeholder="请输入优惠券名称" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="名称备注" prop="couponNameRemark">
|
|
||||||
<el-input v-model="form.couponNameRemark" placeholder="请输入名称备注" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="发放数量" prop="count">
|
|
||||||
<el-input v-model="form.count" placeholder="请输入发放数量" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="适用商品类型" prop="goodsType">
|
|
||||||
<el-radio-group v-model="form.goodsType">
|
|
||||||
<el-radio label="1">请选择字典生成</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<!-- todo 请输入适用商品id-->
|
|
||||||
<el-form-item label="适用商品id" prop="productIds">
|
|
||||||
<el-input v-model="form.productIds" placeholder="请输入适用商品id" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="使用门槛" prop="hasUseLimit">
|
|
||||||
<el-radio-group v-model="form.hasUseLimit">
|
|
||||||
<el-radio label="1">请选择字典生成</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="满多少元使用" prop="atLeast">
|
|
||||||
<el-input v-model="form.atLeast" placeholder="请输入满多少元使用 0代表无限制" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="发放面额" prop="money">
|
|
||||||
<el-input v-model="form.money" placeholder="请输入发放面额 当type为reward时需要添加" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="1 =< 折扣 <= 9.9" prop="discount">
|
|
||||||
<el-input v-model="form.discount" placeholder="请输入1 =< 折扣 <= 9.9 当type为discount时需要添加" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="最多折扣金额" prop="discountLimit">
|
|
||||||
<el-input v-model="form.discountLimit" placeholder="请输入最多折扣金额 当type为discount时可选择性添加" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="最低金额" prop="minMoney">
|
|
||||||
<el-input v-model="form.minMoney" placeholder="请输入最低金额 当type为radom时需要添加" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="最大金额" prop="maxMoney">
|
|
||||||
<el-input v-model="form.maxMoney" placeholder="请输入最大金额 当type为radom时需要添加" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="过期类型" prop="validityType">
|
|
||||||
<el-radio-group v-model="form.validityType">
|
|
||||||
<el-radio label="1">请选择字典生成</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="使用开始日期 过期类型1时必填" prop="startUseTime">
|
|
||||||
<el-date-picker clearable v-model="form.startUseTime" type="date" value-format="timestamp" placeholder="选择使用开始日期 过期类型1时必填" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="使用结束日期 过期类型1时必填" prop="endUseTime">
|
|
||||||
<el-date-picker clearable v-model="form.endUseTime" type="date" value-format="timestamp" placeholder="选择使用结束日期 过期类型1时必填" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效" prop="fixedTerm">
|
|
||||||
<el-input v-model="form.fixedTerm" placeholder="请输入当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="是否无限制0-否 1是" prop="whetherLimitless">
|
|
||||||
<el-radio-group v-model="form.whetherLimitless">
|
|
||||||
<el-radio label="1">请选择字典生成</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="每人最大领取个数" prop="maxFetch">
|
|
||||||
<el-input v-model="form.maxFetch" placeholder="请输入每人最大领取个数" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="是否开启过期提醒0-不开启 1-开启" prop="whetherExpireNotice">
|
|
||||||
<el-radio-group v-model="form.whetherExpireNotice">
|
|
||||||
<el-radio label="1">请选择字典生成</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="过期前N天提醒" prop="expireNoticeFixedTerm">
|
|
||||||
<el-input v-model="form.expireNoticeFixedTerm" placeholder="请输入过期前N天提醒" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用" prop="whetherForbidPreference">
|
|
||||||
<el-radio-group v-model="form.whetherForbidPreference">
|
|
||||||
<el-radio label="1">请选择字典生成</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="是否显示" prop="whetherShow">
|
|
||||||
<el-input v-model="form.whetherShow" placeholder="请输入是否显示" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="订单的优惠总金额" prop="discountOrderMoney">
|
|
||||||
<el-input v-model="form.discountOrderMoney" placeholder="请输入订单的优惠总金额" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="用券总成交额" prop="orderMoney">
|
|
||||||
<el-input v-model="form.orderMoney" placeholder="请输入用券总成交额" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="是否禁止发放0-否 1-是" prop="whetherForbidden">
|
|
||||||
<el-radio-group v-model="form.whetherForbidden">
|
|
||||||
<el-radio label="1">请选择字典生成</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="使用优惠券购买的商品数量" prop="orderGoodsNum">
|
|
||||||
<el-input v-model="form.orderGoodsNum" placeholder="请输入使用优惠券购买的商品数量" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="状态" prop="status">
|
|
||||||
<el-radio-group v-model="form.status">
|
|
||||||
<el-radio label="1">请选择字典生成</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="有效日期结束时间" prop="endTime">
|
|
||||||
<el-date-picker clearable v-model="form.endTime" type="date" value-format="timestamp" placeholder="选择有效日期结束时间" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<div slot="footer" class="dialog-footer">
|
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
||||||
<el-button @click="cancel">取 消</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { create, update, deleteCouponTemplete, get, getPage, exportExcel } from "@/api/mall/CouponTemplete/CouponTemplete.js";
|
|
||||||
import {getDictDatas} from "@/utils/dict";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "",
|
|
||||||
components: {
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
// 遮罩层
|
|
||||||
loading: true,
|
|
||||||
// 导出遮罩层
|
|
||||||
exportLoading: false,
|
|
||||||
// 显示搜索条件
|
|
||||||
showSearch: true,
|
|
||||||
// 总条数
|
|
||||||
total: 0,
|
|
||||||
// 优惠券模板列表
|
|
||||||
list: [],
|
|
||||||
// 弹出层标题
|
|
||||||
title: "",
|
|
||||||
// 是否显示弹出层
|
|
||||||
open: false,
|
|
||||||
// 查询参数
|
|
||||||
queryParams: {
|
|
||||||
pageNo: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
type: null,
|
|
||||||
name: null,
|
|
||||||
couponNameRemark: null,
|
|
||||||
image: null,
|
|
||||||
count: null,
|
|
||||||
leadCount: null,
|
|
||||||
usedCount: null,
|
|
||||||
goodsType: null,
|
|
||||||
productIds: null,
|
|
||||||
hasUseLimit: null,
|
|
||||||
atLeast: null,
|
|
||||||
money: null,
|
|
||||||
discount: null,
|
|
||||||
discountLimit: null,
|
|
||||||
minMoney: null,
|
|
||||||
maxMoney: null,
|
|
||||||
validityType: null,
|
|
||||||
startUseTime: [],
|
|
||||||
endUseTime: [],
|
|
||||||
fixedTerm: null,
|
|
||||||
whetherLimitless: null,
|
|
||||||
maxFetch: null,
|
|
||||||
whetherExpireNotice: null,
|
|
||||||
expireNoticeFixedTerm: null,
|
|
||||||
whetherForbidPreference: null,
|
|
||||||
whetherShow: null,
|
|
||||||
discountOrderMoney: null,
|
|
||||||
orderMoney: null,
|
|
||||||
whetherForbidden: null,
|
|
||||||
orderGoodsNum: null,
|
|
||||||
status: null,
|
|
||||||
endTime: [],
|
|
||||||
createTime: [],
|
|
||||||
},
|
|
||||||
//数据字典
|
|
||||||
datas:getDictDatas(),
|
|
||||||
|
|
||||||
// 表单参数
|
|
||||||
form: {},
|
|
||||||
// 表单校验
|
|
||||||
rules: {
|
|
||||||
type: [{ required: true, message: "优惠券类型 reward-满减 discount-折扣 random-随机不能为空", trigger: "change" }],
|
|
||||||
name: [{ required: true, message: "优惠券名称不能为空", trigger: "blur" }],
|
|
||||||
count: [{ required: true, message: "发放数量不能为空", trigger: "blur" }],
|
|
||||||
leadCount: [{ required: true, message: "已领取数量不能为空", trigger: "blur" }],
|
|
||||||
usedCount: [{ required: true, message: "已使用数量不能为空", trigger: "blur" }],
|
|
||||||
goodsType: [{ required: true, message: "适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用不能为空", trigger: "blur" }],
|
|
||||||
hasUseLimit: [{ required: true, message: "使用门槛0-无门槛 1-有门槛不能为空", trigger: "blur" }],
|
|
||||||
atLeast: [{ required: true, message: "满多少元使用 0代表无限制不能为空", trigger: "blur" }],
|
|
||||||
money: [{ required: true, message: "发放面额 当type为reward时需要添加不能为空", trigger: "blur" }],
|
|
||||||
discount: [{ required: true, message: "1 =< 折扣 <= 9.9 当type为discount时需要添加不能为空", trigger: "blur" }],
|
|
||||||
discountLimit: [{ required: true, message: "最多折扣金额 当type为discount时可选择性添加不能为空", trigger: "blur" }],
|
|
||||||
minMoney: [{ required: true, message: "最低金额 当type为radom时需要添加不能为空", trigger: "blur" }],
|
|
||||||
maxMoney: [{ required: true, message: "最大金额 当type为radom时需要添加不能为空", trigger: "blur" }],
|
|
||||||
validityType: [{ required: true, message: "过期类型1-时间范围过期 2-领取之日固定日期后过期 3-领取次日固定日期后过期不能为空", trigger: "blur" }],
|
|
||||||
fixedTerm: [{ required: true, message: "当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效不能为空", trigger: "blur" }],
|
|
||||||
whetherLimitless: [{ required: true, message: "是否无限制0-否 1是不能为空", trigger: "blur" }],
|
|
||||||
maxFetch: [{ required: true, message: "每人最大领取个数不能为空", trigger: "blur" }],
|
|
||||||
whetherExpireNotice: [{ required: true, message: "是否开启过期提醒0-不开启 1-开启不能为空", trigger: "blur" }],
|
|
||||||
expireNoticeFixedTerm: [{ required: true, message: "过期前N天提醒不能为空", trigger: "blur" }],
|
|
||||||
whetherForbidPreference: [{ required: true, message: "优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用不能为空", trigger: "blur" }],
|
|
||||||
whetherShow: [{ required: true, message: "是否显示不能为空", trigger: "blur" }],
|
|
||||||
discountOrderMoney: [{ required: true, message: "订单的优惠总金额不能为空", trigger: "blur" }],
|
|
||||||
orderMoney: [{ required: true, message: "用券总成交额不能为空", trigger: "blur" }],
|
|
||||||
whetherForbidden: [{ required: true, message: "是否禁止发放0-否 1-是不能为空", trigger: "blur" }],
|
|
||||||
orderGoodsNum: [{ required: true, message: "使用优惠券购买的商品数量不能为空", trigger: "blur" }],
|
|
||||||
status: [{ required: true, message: "状态(1进行中2已结束-1已关闭)不能为空", trigger: "blur" }],
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.getList();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
/** 查询列表 */
|
|
||||||
getList() {
|
|
||||||
this.loading = true;
|
|
||||||
// 执行查询
|
|
||||||
getPage(this.queryParams).then(response => {
|
|
||||||
this.list = response.data.list;
|
|
||||||
this.total = response.data.total;
|
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 取消按钮 */
|
|
||||||
cancel() {
|
|
||||||
this.open = false;
|
|
||||||
this.reset();
|
|
||||||
},
|
|
||||||
/** 表单重置 */
|
|
||||||
reset() {
|
|
||||||
this.form = {
|
|
||||||
id: undefined,
|
|
||||||
type: undefined,
|
|
||||||
name: undefined,
|
|
||||||
couponNameRemark: undefined,
|
|
||||||
image: undefined,
|
|
||||||
count: undefined,
|
|
||||||
leadCount: undefined,
|
|
||||||
usedCount: undefined,
|
|
||||||
goodsType: undefined,
|
|
||||||
productIds: undefined,
|
|
||||||
hasUseLimit: undefined,
|
|
||||||
atLeast: undefined,
|
|
||||||
money: undefined,
|
|
||||||
discount: undefined,
|
|
||||||
discountLimit: undefined,
|
|
||||||
minMoney: undefined,
|
|
||||||
maxMoney: undefined,
|
|
||||||
validityType: undefined,
|
|
||||||
startUseTime: undefined,
|
|
||||||
endUseTime: undefined,
|
|
||||||
fixedTerm: undefined,
|
|
||||||
whetherLimitless: undefined,
|
|
||||||
maxFetch: undefined,
|
|
||||||
whetherExpireNotice: undefined,
|
|
||||||
expireNoticeFixedTerm: undefined,
|
|
||||||
whetherForbidPreference: undefined,
|
|
||||||
whetherShow: undefined,
|
|
||||||
discountOrderMoney: undefined,
|
|
||||||
orderMoney: undefined,
|
|
||||||
whetherForbidden: undefined,
|
|
||||||
orderGoodsNum: undefined,
|
|
||||||
status: undefined,
|
|
||||||
endTime: undefined,
|
|
||||||
};
|
|
||||||
this.resetForm("form");
|
|
||||||
},
|
|
||||||
/** 搜索按钮操作 */
|
|
||||||
handleQuery() {
|
|
||||||
this.queryParams.pageNo = 1;
|
|
||||||
this.getList();
|
|
||||||
},
|
|
||||||
/** 重置按钮操作 */
|
|
||||||
resetQuery() {
|
|
||||||
this.resetForm("queryForm");
|
|
||||||
this.handleQuery();
|
|
||||||
},
|
|
||||||
/** 新增按钮操作 */
|
|
||||||
handleAdd() {
|
|
||||||
this.reset();
|
|
||||||
this.open = true;
|
|
||||||
this.title = "添加优惠券模板";
|
|
||||||
},
|
|
||||||
/** 修改按钮操作 */
|
|
||||||
handleUpdate(row) {
|
|
||||||
this.reset();
|
|
||||||
const id = row.id;
|
|
||||||
get(id).then(response => {
|
|
||||||
this.form = response.data;
|
|
||||||
this.open = true;
|
|
||||||
this.title = "修改优惠券模板";
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 提交按钮 */
|
|
||||||
submitForm() {
|
|
||||||
this.$refs["form"].validate(valid => {
|
|
||||||
if (!valid) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 修改的提交
|
|
||||||
if (this.form.id != null) {
|
|
||||||
update(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("修改成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 添加的提交
|
|
||||||
create(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("新增成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 删除按钮操作 */
|
|
||||||
handleDelete(row) {
|
|
||||||
const id = row.id;
|
|
||||||
this.$modal.confirm('是否确认删除优惠券模板编号为"' + id + '"的数据项?').then(function() {
|
|
||||||
return deleteCouponTemplete(id);
|
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.$modal.msgSuccess("删除成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
handleExport() {
|
|
||||||
// 处理查询参数
|
|
||||||
let params = {...this.queryParams};
|
|
||||||
params.pageNo = undefined;
|
|
||||||
params.pageSize = undefined;
|
|
||||||
this.$modal.confirm('是否确认导出所有优惠券模板数据项?').then(() => {
|
|
||||||
this.exportLoading = true;
|
|
||||||
return exportExcel(params);
|
|
||||||
}).then(response => {
|
|
||||||
this.$download.excel(response, '优惠券模板.xls');
|
|
||||||
this.exportLoading = false;
|
|
||||||
}).catch(() => {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
|
@ -108,7 +108,7 @@
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="form.takeType === 1" label="发放数量" prop="totalCount">
|
<el-form-item v-if="form.takeType === 1" label="发放数量" prop="totalCount">
|
||||||
<el-input-number v-model="form.usePrice" placeholder="发放数量,没有之后不能领取或发放,-1 为不限制"
|
<el-input-number v-model="form.totalCount" placeholder="发放数量,没有之后不能领取或发放,-1 为不限制"
|
||||||
style="width: 400px" :precision="0" :min="-1" /> 张
|
style="width: 400px" :precision="0" :min="-1" /> 张
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="form.takeType === 1" label="每人限领个数" prop="takeLimitCount">
|
<el-form-item v-if="form.takeType === 1" label="每人限领个数" prop="takeLimitCount">
|
||||||
|
@ -122,8 +122,8 @@
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="form.validityType === CouponTemplateValidityTypeEnum.DATE.type" label="固定日期" prop="validTimes">
|
<el-form-item v-if="form.validityType === CouponTemplateValidityTypeEnum.DATE.type" label="固定日期" prop="validTimes">
|
||||||
<el-date-picker v-model="queryParams.validTimes" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
|
<el-date-picker v-model="form.validTimes" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange"
|
||||||
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
|
:default-time="['00:00:00', '23:59:59']" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="form.validityType === CouponTemplateValidityTypeEnum.TERM.type" label="领取日期" prop="fixedStartTerm">
|
<el-form-item v-if="form.validityType === CouponTemplateValidityTypeEnum.TERM.type" label="领取日期" prop="fixedStartTerm">
|
||||||
第 <el-input-number v-model="form.fixedStartTerm" placeholder="0 为今天生效"
|
第 <el-input-number v-model="form.fixedStartTerm" placeholder="0 为今天生效"
|
||||||
|
@ -138,7 +138,13 @@
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="form.productScope === PromotionProductScopeEnum.SPU.scope" prop="productSpuIds">
|
<el-form-item v-if="form.productScope === PromotionProductScopeEnum.SPU.scope" prop="productSpuIds">
|
||||||
<el-input v-model="form.productSpuIds" placeholder="请输入商品 SPU 编号的数组" />
|
<el-select v-model="form.productSpuIds" placeholder="请选择活动商品" clearable size="small"
|
||||||
|
multiple filterable style="width: 400px">
|
||||||
|
<el-option v-for="item in productSpus" :key="item.id" :label="item.name" :value="item.id">
|
||||||
|
<span style="float: left">{{ item.name }}</span>
|
||||||
|
<span style="float: right; color: #8492a6; font-size: 13px">¥{{ (item.minPrice / 100.0).toFixed(2) }}</span>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
|
@ -150,8 +156,10 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { createCouponTemplate, updateCouponTemplate, deleteCouponTemplate, getCouponTemplate, getCouponTemplatePage } from "@/api/promotion/couponTemplate";
|
import { createCouponTemplate, updateCouponTemplate, deleteCouponTemplate, getCouponTemplate, getCouponTemplatePage } from "@/api/mall/promotion/couponTemplate";
|
||||||
import { CommonStatusEnum, CouponTemplateValidityTypeEnum, PromotionDiscountTypeEnum, PromotionProductScopeEnum} from "@/utils/constants";
|
import { CouponTemplateValidityTypeEnum, PromotionDiscountTypeEnum, PromotionProductScopeEnum} from "@/utils/constants";
|
||||||
|
import { getSpuSimpleList } from "@/api/mall/product/spu";
|
||||||
|
import { parseTime } from "@/utils/ruoyi";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "CouponTemplate",
|
name: "CouponTemplate",
|
||||||
|
@ -202,6 +210,8 @@ export default {
|
||||||
productScope: [{ required: true, message: "商品范围不能为空", trigger: "blur" }],
|
productScope: [{ required: true, message: "商品范围不能为空", trigger: "blur" }],
|
||||||
productSpuIds: [{ required: true, message: "商品范围不能为空", trigger: "blur" }],
|
productSpuIds: [{ required: true, message: "商品范围不能为空", trigger: "blur" }],
|
||||||
},
|
},
|
||||||
|
// 商品列表
|
||||||
|
productSpus: [],
|
||||||
// 如下的变量,主要为了 v-if 判断可以使用到
|
// 如下的变量,主要为了 v-if 判断可以使用到
|
||||||
PromotionProductScopeEnum: PromotionProductScopeEnum,
|
PromotionProductScopeEnum: PromotionProductScopeEnum,
|
||||||
CouponTemplateValidityTypeEnum: CouponTemplateValidityTypeEnum,
|
CouponTemplateValidityTypeEnum: CouponTemplateValidityTypeEnum,
|
||||||
|
@ -221,6 +231,10 @@ export default {
|
||||||
this.total = response.data.total;
|
this.total = response.data.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
|
// 查询商品列表
|
||||||
|
getSpuSimpleList().then(response => {
|
||||||
|
this.productSpus = response.data
|
||||||
|
})
|
||||||
},
|
},
|
||||||
/** 取消按钮 */
|
/** 取消按钮 */
|
||||||
cancel() {
|
cancel() {
|
||||||
|
@ -233,7 +247,7 @@ export default {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
name: undefined,
|
name: undefined,
|
||||||
discountType: PromotionDiscountTypeEnum.PRICE.type,
|
discountType: PromotionDiscountTypeEnum.PRICE.type,
|
||||||
discountPrice: 0,
|
discountPrice: undefined,
|
||||||
discountPercent: undefined,
|
discountPercent: undefined,
|
||||||
discountLimitPrice: undefined,
|
discountLimitPrice: undefined,
|
||||||
usePrice: undefined,
|
usePrice: undefined,
|
||||||
|
@ -274,9 +288,11 @@ export default {
|
||||||
getCouponTemplate(id).then(response => {
|
getCouponTemplate(id).then(response => {
|
||||||
this.form = {
|
this.form = {
|
||||||
...response.data,
|
...response.data,
|
||||||
discountPrice: response.data.discountPrice ? response.data.discountPrice / 100.0 : undefined,
|
discountPrice: response.data.discountPrice !== undefined ? response.data.discountPrice / 100.0 : undefined,
|
||||||
discountPercent: response.data.discountPercent ? response.data.discountPercent / 10.0 : undefined,
|
discountPercent: response.data.discountPercent !== undefined ? response.data.discountPercent / 10.0 : undefined,
|
||||||
usePrice: response.data.usePrice ? response.data.usePrice / 100.0 : undefined,
|
discountLimitPrice: response.data.discountLimitPrice !== undefined ? response.data.discountLimitPrice / 100.0 : undefined,
|
||||||
|
usePrice: response.data.usePrice !== undefined ? response.data.usePrice / 100.0 : undefined,
|
||||||
|
validTimes: [response.data.validStartTime, response.data.validEndTime]
|
||||||
}
|
}
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改优惠劵";
|
this.title = "修改优惠劵";
|
||||||
|
@ -291,9 +307,12 @@ export default {
|
||||||
// 金额相关字段的缩放
|
// 金额相关字段的缩放
|
||||||
let data = {
|
let data = {
|
||||||
...this.form,
|
...this.form,
|
||||||
discountPrice: this.form.discountPrice ? this.form.discountPrice * 100 : undefined,
|
discountPrice: this.form.discountPrice !== undefined ? this.form.discountPrice * 100 : undefined,
|
||||||
discountPercent: this.form.discountPercent ? this.form.discountPercent * 10 : undefined,
|
discountPercent: this.form.discountPercent !== undefined ? this.form.discountPercent * 10 : undefined,
|
||||||
usePrice: this.form.usePrice ? this.form.usePrice * 100 : undefined,
|
discountLimitPrice: this.form.discountLimitPrice !== undefined ? this.form.discountLimitPrice * 100 : undefined,
|
||||||
|
usePrice: this.form.usePrice !== undefined ? this.form.usePrice * 100 : undefined,
|
||||||
|
validStartTime: this.form.validTimes && this.form.validTimes.length === 2 ? this.form.validTimes[0] : undefined,
|
||||||
|
validEndTime: this.form.validTimes && this.form.validTimes.length === 2 ? this.form.validTimes[1] : undefined,
|
||||||
}
|
}
|
||||||
// 修改的提交
|
// 修改的提交
|
||||||
if (this.form.id != null) {
|
if (this.form.id != null) {
|
Loading…
Reference in New Issue