promotion:优化优惠劵的界面

This commit is contained in:
YunaiV 2023-10-03 13:01:31 +08:00
parent 59ab6218ca
commit 40f44fc78e
3 changed files with 30 additions and 27 deletions

View File

@ -9,7 +9,7 @@ export const discountFormat = (row: CouponTemplateVO) => {
return `${floatToFixed2(row.discountPrice)}` return `${floatToFixed2(row.discountPrice)}`
} }
if (row.discountType === PromotionDiscountTypeEnum.PERCENT.type) { if (row.discountType === PromotionDiscountTypeEnum.PERCENT.type) {
return `${row.discountPrice}%` return `${row.discountPercent}%`
} }
return '未知【' + row.discountType + '】' return '未知【' + row.discountType + '】'
} }

View File

@ -19,7 +19,7 @@
@keyup="handleQuery" @keyup="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="创建时间" prop="createTime"> <el-form-item label="领取时间" prop="createTime">
<el-date-picker <el-date-picker
v-model="queryParams.createTime" v-model="queryParams.createTime"
value-format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
@ -50,12 +50,17 @@
<!-- 列表 --> <!-- 列表 -->
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
<el-table-column label="会员信息" align="center" prop="nickname" /> <el-table-column label="会员昵称" align="center" min-width="100" prop="nickname" />
<!-- TODO 芋艿以后支持头像支持跳转 --> <el-table-column label="优惠券名称" align="center" min-width="140" prop="name" />
<el-table-column label="优惠劵" align="center" prop="name" /> <el-table-column label="类型" align="center" prop="discountType">
<el-table-column label="优惠券类型" align="center" prop="discountType"> <template #default="scope">
<dict-tag :type="DICT_TYPE.PROMOTION_PRODUCT_SCOPE" :value="scope.row.productScope" />
</template>
</el-table-column>
<el-table-column label="优惠" min-width="100" prop="discount">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.PROMOTION_DISCOUNT_TYPE" :value="scope.row.discountType" /> <dict-tag :type="DICT_TYPE.PROMOTION_DISCOUNT_TYPE" :value="scope.row.discountType" />
{{ discountFormat(scope.row) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="领取方式" align="center" prop="takeType"> <el-table-column label="领取方式" align="center" prop="takeType">
@ -109,6 +114,7 @@
import { deleteCoupon, getCouponPage } from '@/api/mall/promotion/coupon/coupon' import { deleteCoupon, getCouponPage } from '@/api/mall/promotion/coupon/coupon'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import { discountFormat } from '@/views/mall/promotion/coupon/formatter'
defineOptions({ name: 'PromotionCoupon' }) defineOptions({ name: 'PromotionCoupon' })

View File

@ -19,7 +19,7 @@
@keyup="handleQuery" @keyup="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="优惠类型" prop="discountType"> <el-form-item label="优惠类型" prop="discountType">
<el-select <el-select
v-model="queryParams.discountType" v-model="queryParams.discountType"
class="!w-240px" class="!w-240px"
@ -71,14 +71,6 @@
> >
<Icon class="mr-5px" icon="ep:plus" /> 新增 <Icon class="mr-5px" icon="ep:plus" /> 新增
</el-button> </el-button>
<el-button
plain
type="success"
@click="$router.push('/promotion/coupon')"
v-hasPermi="['promotion:coupon:query']"
>
<Icon icon="ep:operation" class="mr-5px" />会员优惠劵
</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</ContentWrap> </ContentWrap>
@ -86,17 +78,29 @@
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
<el-table-column label="优惠券名称" align="center" prop="name" /> <el-table-column label="优惠券名称" min-width="140" prop="name" />
<el-table-column label="优惠券类型" align="center" prop="discountType"> <el-table-column label="类型" min-width="80" prop="productScope">
<template #default="scope">
<dict-tag :type="DICT_TYPE.PROMOTION_PRODUCT_SCOPE" :value="scope.row.productScope" />
</template>
</el-table-column>
<el-table-column label="优惠" min-width="100" prop="discount">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.PROMOTION_DISCOUNT_TYPE" :value="scope.row.discountType" /> <dict-tag :type="DICT_TYPE.PROMOTION_DISCOUNT_TYPE" :value="scope.row.discountType" />
{{ discountFormat(scope.row) }}
</template>
</el-table-column>
<el-table-column label="领取方式" min-width="100" prop="takeType">
<template #default="scope">
<dict-tag :type="DICT_TYPE.PROMOTION_COUPON_TAKE_TYPE" :value="scope.row.takeType" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="优惠金额 / 折扣" label="使用时间"
align="center" align="center"
prop="discount" prop="validityType"
:formatter="discountFormat" width="185"
:formatter="validityTypeFormat"
/> />
<el-table-column label="发放数量" align="center" prop="totalCount" /> <el-table-column label="发放数量" align="center" prop="totalCount" />
<el-table-column <el-table-column
@ -111,13 +115,6 @@
prop="takeLimitCount" prop="takeLimitCount"
:formatter="takeLimitCountFormat" :formatter="takeLimitCountFormat"
/> />
<el-table-column
label="有效期限"
align="center"
prop="validityType"
width="190"
:formatter="validityTypeFormat"
/>
<el-table-column label="状态" align="center" prop="status"> <el-table-column label="状态" align="center" prop="status">
<template #default="scope"> <template #default="scope">
<el-switch <el-switch