!293 完善 banner 管理。商品 spu 剔除优惠卷相关逻辑

Merge pull request !293 from puhui999/dev-to-dev
pull/294/head
芋道源码 2023-10-24 12:00:48 +00:00 committed by Gitee
commit ed0f3a3043
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
14 changed files with 242 additions and 169 deletions

View File

@ -6,31 +6,32 @@ export interface BannerVO {
picUrl: string picUrl: string
status: number status: number
url: string url: string
position: number
sort: number sort: number
memo: string memo: string
} }
// 查询Banner管理列表 // 查询Banner管理列表
export const getBannerPage = async (params) => { export const getBannerPage = async (params) => {
return await request.get({ url: `/market/banner/page`, params }) return await request.get({ url: `/promotion/banner/page`, params })
} }
// 查询Banner管理详情 // 查询Banner管理详情
export const getBanner = async (id: number) => { export const getBanner = async (id: number) => {
return await request.get({ url: `/market/banner/get?id=` + id }) return await request.get({ url: `/promotion/banner/get?id=` + id })
} }
// 新增Banner管理 // 新增Banner管理
export const createBanner = async (data: BannerVO) => { export const createBanner = async (data: BannerVO) => {
return await request.post({ url: `/market/banner/create`, data }) return await request.post({ url: `/promotion/banner/create`, data })
} }
// 修改Banner管理 // 修改Banner管理
export const updateBanner = async (data: BannerVO) => { export const updateBanner = async (data: BannerVO) => {
return await request.put({ url: `/market/banner/update`, data }) return await request.put({ url: `/promotion/banner/update`, data })
} }
// 删除Banner管理 // 删除Banner管理
export const deleteBanner = async (id: number) => { export const deleteBanner = async (id: number) => {
return await request.delete({ url: `/market/banner/delete?id=` + id }) return await request.delete({ url: `/promotion/banner/delete?id=` + id })
} }

View File

@ -61,7 +61,6 @@ export interface Spu {
createTime?: Date // 商品创建时间 createTime?: Date // 商品创建时间
status?: number // 商品状态 status?: number // 商品状态
activityOrders: number[] // 活动排序 activityOrders: number[] // 活动排序
giveCouponTemplates: GiveCouponTemplate[] // 优惠卷
} }
// 获得 Spu 列表 // 获得 Spu 列表

View File

@ -184,6 +184,7 @@ export enum DICT_TYPE {
PROMOTION_CONDITION_TYPE = 'promotion_condition_type', // 营销的条件类型枚举 PROMOTION_CONDITION_TYPE = 'promotion_condition_type', // 营销的条件类型枚举
PROMOTION_BARGAIN_RECORD_STATUS = 'promotion_bargain_record_status', // 砍价记录的状态 PROMOTION_BARGAIN_RECORD_STATUS = 'promotion_bargain_record_status', // 砍价记录的状态
PROMOTION_COMBINATION_RECORD_STATUS = 'promotion_combination_record_status', // 拼团记录的状态 PROMOTION_COMBINATION_RECORD_STATUS = 'promotion_combination_record_status', // 拼团记录的状态
BANNER_POSITION = 'banner_position', // banner 定位
// ========== CRM - 客户管理模块 ========== // ========== CRM - 客户管理模块 ==========
CRM_RECEIVABLE_CHECK_STATUS = 'crm_receivable_check_status', CRM_RECEIVABLE_CHECK_STATUS = 'crm_receivable_check_status',

View File

@ -54,6 +54,13 @@ const initSortable = () => {
} }
onMounted(async () => { onMounted(async () => {
await nextTick() await nextTick()
//
if (props.activityOrders && props.activityOrders.length === 0) {
emit(
'update:activityOrders',
props.promotionTypes.map((item) => item.value as number)
)
}
initSortable() initSortable()
}) })
</script> </script>

View File

@ -42,25 +42,12 @@
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="活动优先级"> <el-form-item label="活动优先级">
<!-- TODO @puhui999这个目前先写死主要是这个优惠类型不好用 promotion_type_enum因为优惠劵会员折扣都算 -->
<ActivityOrdersSort <ActivityOrdersSort
v-model:activity-orders="formData.activityOrders" v-model:activity-orders="formData.activityOrders"
:promotion-types="promotionTypes" :promotion-types="promotionTypes"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24">
<el-form-item label="赠送优惠劵">
<el-tag
v-for="coupon in formData.giveCouponTemplates"
:key="coupon.id as number"
class="mr-[10px]"
>
{{ coupon.name }}
</el-tag>
<el-button @click="openCouponSelect"></el-button>
</el-form-item>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
@ -91,17 +78,7 @@
{{ promotionTypes.find((item) => item.value === activityType)?.label }} {{ promotionTypes.find((item) => item.value === activityType)?.label }}
</el-tag> </el-tag>
</template> </template>
<template #giveCouponTemplates="{ row }">
<el-tag
v-for="coupon in row.giveCouponTemplates"
:key="coupon.id as number"
class="mr-[10px]"
>
{{ coupon.name }}
</el-tag>
</template>
</Descriptions> </Descriptions>
<CouponSelect ref="couponSelectRef" v-model:multiple-selection="formData.giveCouponTemplates" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import type { Spu } from '@/api/mall/product/spu' import type { Spu } from '@/api/mall/product/spu'
@ -109,8 +86,7 @@ import { PropType } from 'vue'
import { propTypes } from '@/utils/propTypes' import { propTypes } from '@/utils/propTypes'
import { copyValueToTarget } from '@/utils' import { copyValueToTarget } from '@/utils'
import { otherSettingsSchema } from './spu.data' import { otherSettingsSchema } from './spu.data'
import { DICT_TYPE, DictDataType, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, DictDataType } from '@/utils/dict'
import CouponSelect from './CouponSelect.vue'
import ActivityOrdersSort from './ActivityOrdersSort.vue' import ActivityOrdersSort from './ActivityOrdersSort.vue'
defineOptions({ name: 'OtherSettingsForm' }) defineOptions({ name: 'OtherSettingsForm' })
@ -128,14 +104,66 @@ const props = defineProps({
isDetail: propTypes.bool.def(false) // isDetail: propTypes.bool.def(false) //
}) })
// // TODO @puhui999 promotion_type_enum
const couponSelectRef = ref() // Ref
const openCouponSelect = () => {
couponSelectRef.value?.open()
}
// //
const promotionTypes = ref<DictDataType[]>(getIntDictOptions(DICT_TYPE.PROMOTION_TYPE_ENUM)) const promotionTypes = ref<DictDataType[]>([
{
dictType: 'promotionTypes',
label: '秒杀活动',
value: 1,
colorType: 'warning',
cssClass: ''
},
{
dictType: 'promotionTypes',
label: '砍价活动',
value: 2,
colorType: 'warning',
cssClass: ''
},
{
dictType: 'promotionTypes',
label: '拼团活动',
value: 3,
colorType: 'warning',
cssClass: ''
},
{
dictType: 'promotionTypes',
label: '限时折扣',
value: 4,
colorType: 'warning',
cssClass: ''
},
{
dictType: 'promotionTypes',
label: '满减送',
value: 5,
colorType: 'warning',
cssClass: ''
},
{
dictType: 'promotionTypes',
label: '会员折扣',
value: 6,
colorType: 'warning',
cssClass: ''
},
{
dictType: 'promotionTypes',
label: '优惠劵',
value: 7,
colorType: 'warning',
cssClass: ''
},
{
dictType: 'promotionTypes',
label: '积分',
value: 8,
colorType: 'warning',
cssClass: ''
}
])
const otherSettingsFormRef = ref() // Ref const otherSettingsFormRef = ref() // Ref
// //
@ -148,8 +176,7 @@ const formData = ref<Spu>({
recommendBest: false, // recommendBest: false, //
recommendNew: false, // recommendNew: false, //
recommendGood: false, // recommendGood: false, //
activityOrders: [], // activityOrders: [] //
giveCouponTemplates: [] //
}) })
// //
const rules = reactive({ const rules = reactive({

View File

@ -95,8 +95,7 @@ const formData = ref<ProductSpuApi.Spu>({
recommendBest: false, // recommendBest: false, //
recommendNew: false, // recommendNew: false, //
recommendGood: false, // recommendGood: false, //
activityOrders: [], // activityOrders: [] //
giveCouponTemplates: [] //
}) })
/** 获得详情 */ /** 获得详情 */

View File

@ -94,10 +94,6 @@ export const otherSettingsSchema = reactive<CrudSchema[]>([
label: '是否优品推荐', label: '是否优品推荐',
field: 'recommendGood' field: 'recommendGood'
}, },
{
label: '赠送的优惠劵',
field: 'giveCouponTemplates'
},
{ {
label: '活动显示排序', label: '活动显示排序',
field: 'activityOrders' field: 'activityOrders'

View File

@ -41,6 +41,19 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24">
<el-form-item label="定位" prop="position">
<el-radio-group v-model="formData.position">
<el-radio
v-for="dict in getIntDictOptions(DICT_TYPE.BANNER_POSITION)"
:key="dict.value"
:label="dict.value"
>
{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="描述" prop="memo"> <el-form-item label="描述" prop="memo">
<el-input v-model="formData.memo" placeholder="请输入描述" type="textarea" /> <el-input v-model="formData.memo" placeholder="请输入描述" type="textarea" />
@ -70,6 +83,7 @@ const formData = ref({
title: undefined, title: undefined,
picUrl: undefined, picUrl: undefined,
status: 0, status: 0,
position: 1,
url: undefined, url: undefined,
sort: 0, sort: 0,
memo: undefined memo: undefined
@ -133,6 +147,7 @@ const resetForm = () => {
title: undefined, title: undefined,
picUrl: undefined, picUrl: undefined,
status: 0, status: 0,
position: 1,
url: undefined, url: undefined,
sort: 0, sort: 0,
memo: undefined memo: undefined

View File

@ -48,7 +48,7 @@
重置 重置
</el-button> </el-button>
<el-button <el-button
v-hasPermi="['market:banner:create']" v-hasPermi="['promotion:banner:create']"
plain plain
type="primary" type="primary"
@click="openForm('create')" @click="openForm('create')"
@ -74,6 +74,11 @@
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" /> <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="定位" prop="position">
<template #default="scope">
<dict-tag :type="DICT_TYPE.BANNER_POSITION" :value="scope.row.position" />
</template>
</el-table-column>
<el-table-column align="center" label="跳转地址" prop="url" /> <el-table-column align="center" label="跳转地址" prop="url" />
<el-table-column <el-table-column
:formatter="dateFormatter" :formatter="dateFormatter"
@ -87,7 +92,7 @@
<el-table-column align="center" label="操作"> <el-table-column align="center" label="操作">
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-hasPermi="['market:banner:update']" v-hasPermi="['promotion:banner:update']"
link link
type="primary" type="primary"
@click="openForm('update', scope.row.id)" @click="openForm('update', scope.row.id)"
@ -95,7 +100,7 @@
编辑 编辑
</el-button> </el-button>
<el-button <el-button
v-hasPermi="['market:banner:delete']" v-hasPermi="['promotion:banner:delete']"
link link
type="danger" type="danger"
@click="handleDelete(scope.row.id)" @click="handleDelete(scope.row.id)"

View File

@ -0,0 +1,4 @@
import CouponSendForm from './CouponSendForm.vue'
import CouponSelect from './CouponSelect.vue'
export { CouponSendForm, CouponSelect }

View File

@ -22,14 +22,14 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="商品"
v-if="formData.productScope === PromotionProductScopeEnum.SPU.scope" v-if="formData.productScope === PromotionProductScopeEnum.SPU.scope"
label="商品"
prop="productSpuIds" prop="productSpuIds"
> >
<div class="flex flex-wrap items-center gap-1"> <div class="flex flex-wrap items-center gap-1">
<div class="select-box spu-pic" v-for="(spu, index) in productSpus" :key="spu.id"> <div v-for="(spu, index) in productSpus" :key="spu.id" class="select-box spu-pic">
<el-image :src="spu.picUrl" /> <el-image :src="spu.picUrl" />
<Icon icon="ep:circle-close-filled" class="del-icon" @click="handleRemoveSpu(index)" /> <Icon class="del-icon" icon="ep:circle-close-filled" @click="handleRemoveSpu(index)" />
</div> </div>
<div class="select-box" @click="openSpuTableSelect"> <div class="select-box" @click="openSpuTableSelect">
<Icon icon="ep:plus" /> <Icon icon="ep:plus" />
@ -37,8 +37,8 @@
</div> </div>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="分类"
v-if="formData.productScope === PromotionProductScopeEnum.CATEGORY.scope" v-if="formData.productScope === PromotionProductScopeEnum.CATEGORY.scope"
label="分类"
prop="productCategoryIds" prop="productCategoryIds"
> >
<ProductCategorySelect v-model="formData.productCategoryIds" /> <ProductCategorySelect v-model="formData.productCategoryIds" />
@ -61,10 +61,10 @@
> >
<el-input-number <el-input-number
v-model="formData.discountPrice" v-model="formData.discountPrice"
placeholder="请输入优惠金额,单位:元"
class="mr-2 !w-400px"
:precision="2"
:min="0" :min="0"
:precision="2"
class="mr-2 !w-400px"
placeholder="请输入优惠金额,单位:元"
/> />
</el-form-item> </el-form-item>
@ -75,11 +75,11 @@
> >
<el-input-number <el-input-number
v-model="formData.discountPercent" v-model="formData.discountPercent"
placeholder="优惠券折扣不能小于 1 折,且不可大于 9.9 折"
class="mr-2 !w-400px"
:precision="1"
:min="1"
:max="9.9" :max="9.9"
:min="1"
:precision="1"
class="mr-2 !w-400px"
placeholder="优惠券折扣不能小于 1 折,且不可大于 9.9 折"
/> />
</el-form-item> </el-form-item>
@ -90,20 +90,20 @@
> >
<el-input-number <el-input-number
v-model="formData.discountLimitPrice" v-model="formData.discountLimitPrice"
placeholder="请输入最多优惠"
class="mr-2 !w-400px"
:precision="2"
:min="0" :min="0"
:precision="2"
class="mr-2 !w-400px"
placeholder="请输入最多优惠"
/> />
</el-form-item> </el-form-item>
<el-form-item label="满多少元可以使用" prop="usePrice"> <el-form-item label="满多少元可以使用" prop="usePrice">
<el-input-number <el-input-number
v-model="formData.usePrice" v-model="formData.usePrice"
placeholder="无门槛请设为 0"
class="mr-2 !w-400px"
:precision="2"
:min="0" :min="0"
:precision="2"
class="mr-2 !w-400px"
placeholder="无门槛请设为 0"
/> />
</el-form-item> </el-form-item>
@ -116,20 +116,20 @@
<el-form-item v-if="formData.takeType === 1" label="发放数量" prop="totalCount"> <el-form-item v-if="formData.takeType === 1" label="发放数量" prop="totalCount">
<el-input-number <el-input-number
v-model="formData.totalCount" v-model="formData.totalCount"
placeholder="发放数量,没有之后不能领取或发放,-1 为不限制"
class="mr-2 !w-400px"
:precision="0"
:min="-1" :min="-1"
:precision="0"
class="mr-2 !w-400px"
placeholder="发放数量,没有之后不能领取或发放,-1 为不限制"
/> />
</el-form-item> </el-form-item>
<el-form-item v-if="formData.takeType === 1" label="每人限领个数" prop="takeLimitCount"> <el-form-item v-if="formData.takeType === 1" label="每人限领个数" prop="takeLimitCount">
<el-input-number <el-input-number
v-model="formData.takeLimitCount" v-model="formData.takeLimitCount"
placeholder="设置为 -1 时,可无限领取"
class="mr-2 !w-400px"
:precision="0"
:min="-1" :min="-1"
:precision="0"
class="mr-2 !w-400px"
placeholder="设置为 -1 时,可无限领取"
/> />
</el-form-item> </el-form-item>
@ -151,10 +151,10 @@
> >
<el-date-picker <el-date-picker
v-model="formData.validTimes" v-model="formData.validTimes"
style="width: 240px"
value-format="x"
type="datetimerange"
:default-time="[new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]" :default-time="[new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]"
style="width: 240px"
type="datetimerange"
value-format="x"
/> />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
@ -165,18 +165,18 @@
<el-input-number <el-input-number
v-model="formData.fixedStartTerm" v-model="formData.fixedStartTerm"
placeholder="0 为今天生效"
class="mx-2"
:precision="0"
:min="0" :min="0"
:precision="0"
class="mx-2"
placeholder="0 为今天生效"
/> />
<el-input-number <el-input-number
v-model="formData.fixedEndTerm" v-model="formData.fixedEndTerm"
placeholder="请输入结束天数"
class="mx-2"
:precision="0"
:min="0" :min="0"
:precision="0"
class="mx-2"
placeholder="请输入结束天数"
/> />
天有效 天有效
</el-form-item> </el-form-item>
@ -199,6 +199,7 @@ import {
} from '@/utils/constants' } from '@/utils/constants'
import SpuTableSelect from '@/views/mall/product/spu/components/SpuTableSelect.vue' import SpuTableSelect from '@/views/mall/product/spu/components/SpuTableSelect.vue'
import ProductCategorySelect from '@/views/mall/product/category/components/ProductCategorySelect.vue' import ProductCategorySelect from '@/views/mall/product/category/components/ProductCategorySelect.vue'
import { convertToInteger, formatToFraction } from '@/utils'
defineOptions({ name: 'CouponTemplateForm' }) defineOptions({ name: 'CouponTemplateForm' })
@ -265,12 +266,11 @@ const open = async (type: string, id?: number) => {
const data = await CouponTemplateApi.getCouponTemplate(id) const data = await CouponTemplateApi.getCouponTemplate(id)
formData.value = { formData.value = {
...data, ...data,
discountPrice: data.discountPrice !== undefined ? data.discountPrice / 100.0 : undefined, discountPrice: formatToFraction(data.discountPrice),
discountPercent: discountPercent:
data.discountPercent !== undefined ? data.discountPercent / 10.0 : undefined, data.discountPercent !== undefined ? data.discountPercent / 10.0 : undefined,
discountLimitPrice: discountLimitPrice: formatToFraction(data.discountLimitPrice),
data.discountLimitPrice !== undefined ? data.discountLimitPrice / 100.0 : undefined, usePrice: formatToFraction(data.usePrice),
usePrice: data.usePrice !== undefined ? data.usePrice / 100.0 : undefined,
validTimes: [data.validStartTime, data.validEndTime] validTimes: [data.validStartTime, data.validEndTime]
} }
// //
@ -294,17 +294,13 @@ const submitForm = async () => {
try { try {
const data = { const data = {
...formData.value, ...formData.value,
discountPrice: discountPrice: convertToInteger(formData.value.discountPrice),
formData.value.discountPrice !== undefined ? formData.value.discountPrice * 100 : undefined,
discountPercent: discountPercent:
formData.value.discountPercent !== undefined formData.value.discountPercent !== undefined
? formData.value.discountPercent * 10 ? formData.value.discountPercent * 10
: undefined, : undefined,
discountLimitPrice: discountLimitPrice: convertToInteger(formData.value.discountLimitPrice),
formData.value.discountLimitPrice !== undefined usePrice: convertToInteger(formData.value.usePrice),
? formData.value.discountLimitPrice * 100
: undefined,
usePrice: formData.value.usePrice !== undefined ? formData.value.usePrice * 100 : undefined,
validStartTime: validStartTime:
formData.value.validTimes && formData.value.validTimes.length === 2 formData.value.validTimes && formData.value.validTimes.length === 2
? formData.value.validTimes[0] ? formData.value.validTimes[0]
@ -385,6 +381,7 @@ const getProductScope = async () => {
break break
} }
} }
/** 设置商品范围 */ /** 设置商品范围 */
function setProductScopeValues(data: CouponTemplateApi.CouponTemplateVO) { function setProductScopeValues(data: CouponTemplateApi.CouponTemplateVO) {
switch (formData.value.productScope) { switch (formData.value.productScope) {
@ -420,7 +417,7 @@ const handleRemoveSpu = (index: number) => {
} }
</script> </script>
<style scoped lang="scss"> <style lang="scss" scoped>
.select-box { .select-box {
display: flex; display: flex;
width: 60px; width: 60px;

View File

@ -14,8 +14,8 @@
<el-input <el-input
v-model="queryParams.name" v-model="queryParams.name"
class="!w-240px" class="!w-240px"
placeholder="请输入优惠劵名"
clearable clearable
placeholder="请输入优惠劵名"
@keyup="handleQuery" @keyup="handleQuery"
/> />
</el-form-item> </el-form-item>
@ -23,8 +23,8 @@
<el-select <el-select
v-model="queryParams.discountType" v-model="queryParams.discountType"
class="!w-240px" class="!w-240px"
placeholder="请选择优惠券类型"
clearable clearable
placeholder="请选择优惠券类型"
> >
<el-option <el-option
v-for="dict in getIntDictOptions(DICT_TYPE.PROMOTION_DISCOUNT_TYPE)" v-for="dict in getIntDictOptions(DICT_TYPE.PROMOTION_DISCOUNT_TYPE)"
@ -38,8 +38,8 @@
<el-select <el-select
v-model="queryParams.status" v-model="queryParams.status"
class="!w-240px" class="!w-240px"
placeholder="请选择优惠券状态"
clearable clearable
placeholder="请选择优惠券状态"
> >
<el-option <el-option
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)" v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
@ -52,24 +52,31 @@
<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"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px" class="!w-240px"
end-placeholder="结束日期"
start-placeholder="开始日期"
type="daterange"
value-format="YYYY-MM-DD HH:mm:ss"
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="handleQuery"> <Icon icon="ep:search" class="mr-5px" />搜索 </el-button> <el-button @click="handleQuery">
<el-button @click="resetQuery"> <Icon icon="ep:refresh" class="mr-5px" />重置 </el-button> <Icon class="mr-5px" icon="ep:search" />
搜索
</el-button>
<el-button @click="resetQuery">
<Icon class="mr-5px" icon="ep:refresh" />
重置
</el-button>
<el-button <el-button
v-hasPermi="['promotion:coupon-template:create']" v-hasPermi="['promotion:coupon-template:create']"
plain plain
type="primary" type="primary"
@click="openForm('create')" @click="openForm('create')"
> >
<Icon class="mr-5px" icon="ep:plus" /> 新增 <Icon class="mr-5px" icon="ep:plus" />
新增
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -79,15 +86,15 @@
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
<el-table-column label="优惠券名称" min-width="140" prop="name" /> <el-table-column label="优惠券名称" min-width="140" prop="name" />
<el-table-column label="类型" min-width="80" prop="productScope"> <el-table-column label="类型" min-width="130" prop="productScope">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.PROMOTION_PRODUCT_SCOPE" :value="scope.row.productScope" /> <dict-tag :type="DICT_TYPE.PROMOTION_PRODUCT_SCOPE" :value="scope.row.productScope" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="优惠" min-width="100" prop="discount"> <el-table-column label="优惠" min-width="110" 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) }} <div>{{ discountFormat(scope.row) }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="领取方式" min-width="100" prop="takeType"> <el-table-column label="领取方式" min-width="100" prop="takeType">
@ -96,26 +103,26 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="使用时间" :formatter="validityTypeFormat"
align="center" align="center"
label="使用时间"
prop="validityType" prop="validityType"
width="185" width="185"
:formatter="validityTypeFormat"
/> />
<el-table-column label="发放数量" align="center" prop="totalCount" /> <el-table-column align="center" label="发放数量" prop="totalCount" />
<el-table-column <el-table-column
label="剩余数量"
align="center"
prop="totalCount"
:formatter="remainedCountFormat" :formatter="remainedCountFormat"
align="center"
label="剩余数量"
prop="totalCount"
/> />
<el-table-column <el-table-column
label="领取上限"
align="center"
prop="takeLimitCount"
:formatter="takeLimitCountFormat" :formatter="takeLimitCountFormat"
align="center"
label="领取上限"
prop="takeLimitCount"
/> />
<el-table-column label="状态" align="center" prop="status"> <el-table-column align="center" label="状态" prop="status">
<template #default="scope"> <template #default="scope">
<el-switch <el-switch
v-model="scope.row.status" v-model="scope.row.status"
@ -126,13 +133,19 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter" :formatter="dateFormatter"
align="center"
label="创建时间"
prop="createTime"
width="180" width="180"
/> />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column
align="center"
class-name="small-padding fixed-width"
fixed="right"
label="操作"
width="120"
>
<template #default="scope"> <template #default="scope">
<el-button <el-button
v-hasPermi="['promotion:coupon-template:update']" v-hasPermi="['promotion:coupon-template:update']"

View File

@ -2,50 +2,50 @@
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form <el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef" ref="queryFormRef"
:inline="true" :inline="true"
:model="queryParams"
class="-mb-15px"
label-width="68px" label-width="68px"
> >
<el-form-item label="用户昵称" prop="nickname"> <el-form-item label="用户昵称" prop="nickname">
<el-input <el-input
v-model="queryParams.nickname" v-model="queryParams.nickname"
placeholder="请输入用户昵称"
clearable
@keyup.enter="handleQuery"
class="!w-240px" class="!w-240px"
clearable
placeholder="请输入用户昵称"
@keyup.enter="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="手机号" prop="mobile"> <el-form-item label="手机号" prop="mobile">
<el-input <el-input
v-model="queryParams.mobile" v-model="queryParams.mobile"
placeholder="请输入手机号"
clearable
@keyup.enter="handleQuery"
class="!w-240px" class="!w-240px"
clearable
placeholder="请输入手机号"
@keyup.enter="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"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px" class="!w-240px"
end-placeholder="结束日期"
start-placeholder="开始日期"
type="daterange"
value-format="YYYY-MM-DD HH:mm:ss"
/> />
</el-form-item> </el-form-item>
<el-form-item label="登录时间" prop="loginDate"> <el-form-item label="登录时间" prop="loginDate">
<el-date-picker <el-date-picker
v-model="queryParams.loginDate" v-model="queryParams.loginDate"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px" class="!w-240px"
end-placeholder="结束日期"
start-placeholder="开始日期"
type="daterange"
value-format="YYYY-MM-DD HH:mm:ss"
/> />
</el-form-item> </el-form-item>
<el-form-item label="用户标签" prop="tagIds"> <el-form-item label="用户标签" prop="tagIds">
@ -58,9 +58,15 @@
<MemberGroupSelect v-model="queryParams.groupId" /> <MemberGroupSelect v-model="queryParams.groupId" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> <el-button @click="handleQuery">
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> <Icon class="mr-5px" icon="ep:search" />
<el-button @click="openCoupon" v-hasPermi="['promotion:coupon:send']"></el-button> 搜索
</el-button>
<el-button @click="resetQuery">
<Icon class="mr-5px" icon="ep:refresh" />
重置
</el-button>
<el-button v-hasPermi="['promotion:coupon:send']" @click="openCoupon"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</ContentWrap> </ContentWrap>
@ -70,26 +76,26 @@
<el-table <el-table
v-loading="loading" v-loading="loading"
:data="list" :data="list"
:stripe="true"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
:stripe="true"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column label="用户编号" align="center" prop="id" width="120px" /> <el-table-column align="center" label="用户编号" prop="id" width="120px" />
<el-table-column label="头像" align="center" prop="avatar" width="80px"> <el-table-column align="center" label="头像" prop="avatar" width="80px">
<template #default="scope"> <template #default="scope">
<img :src="scope.row.avatar" style="width: 40px" /> <img :src="scope.row.avatar" style="width: 40px" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="手机号" align="center" prop="mobile" width="120px" /> <el-table-column align="center" label="手机号" prop="mobile" width="120px" />
<el-table-column label="昵称" align="center" prop="nickname" width="80px" /> <el-table-column align="center" label="昵称" prop="nickname" width="80px" />
<el-table-column label="等级" align="center" prop="levelName" width="100px" /> <el-table-column align="center" label="等级" prop="levelName" width="100px" />
<el-table-column label="分组" align="center" prop="groupName" width="100px" /> <el-table-column align="center" label="分组" prop="groupName" width="100px" />
<el-table-column <el-table-column
label="用户标签"
align="center"
prop="tagNames"
:show-overflow-tooltip="false" :show-overflow-tooltip="false"
align="center"
label="用户标签"
prop="tagNames"
> >
<template #default="scope"> <template #default="scope">
<el-tag v-for="(tagName, index) in scope.row.tagNames" :key="index" class="mr-5px"> <el-tag v-for="(tagName, index) in scope.row.tagNames" :key="index" class="mr-5px">
@ -97,69 +103,72 @@
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="积分" align="center" prop="point" width="100px" /> <el-table-column align="center" label="积分" prop="point" width="100px" />
<el-table-column label="状态" align="center" prop="status" width="100px"> <el-table-column align="center" label="状态" prop="status" width="100px">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" /> <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
:formatter="dateFormatter"
align="center"
label="登录时间" label="登录时间"
align="center"
prop="loginDate" prop="loginDate"
:formatter="dateFormatter"
width="180px" width="180px"
/> />
<el-table-column <el-table-column
:formatter="dateFormatter"
align="center"
label="注册时间" label="注册时间"
align="center"
prop="createTime" prop="createTime"
:formatter="dateFormatter"
width="180px" width="180px"
/> />
<el-table-column <el-table-column
label="操作"
align="center"
width="100px"
fixed="right"
:show-overflow-tooltip="false" :show-overflow-tooltip="false"
align="center"
fixed="right"
label="操作"
width="100px"
> >
<template #default="scope"> <template #default="scope">
<div class="flex items-center justify-center"> <div class="flex items-center justify-center">
<el-button link type="primary" @click="openDetail(scope.row.id)"></el-button> <el-button link type="primary" @click="openDetail(scope.row.id)"></el-button>
<el-dropdown <el-dropdown
@command="(command) => handleCommand(command, scope.row)"
v-hasPermi="[ v-hasPermi="[
'member:user:update', 'member:user:update',
'member:user:update-level', 'member:user:update-level',
'member:user:update-point', 'member:user:update-point',
'member:user:update-balance' 'member:user:update-balance'
]" ]"
@command="(command) => handleCommand(command, scope.row)"
> >
<el-button type="primary" link><Icon icon="ep:d-arrow-right" /> 更多</el-button> <el-button link type="primary">
<Icon icon="ep:d-arrow-right" />
更多
</el-button>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item <el-dropdown-item
command="handleUpdate"
v-if="checkPermi(['member:user:update'])" v-if="checkPermi(['member:user:update'])"
command="handleUpdate"
> >
编辑 编辑
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item
command="handleUpdateLevel"
v-if="checkPermi(['member:user:update-level'])" v-if="checkPermi(['member:user:update-level'])"
command="handleUpdateLevel"
> >
修改等级 修改等级
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item
command="handleUpdatePoint"
v-if="checkPermi(['member:user:update-point'])" v-if="checkPermi(['member:user:update-point'])"
command="handleUpdatePoint"
> >
修改积分 修改积分
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item <el-dropdown-item
command="handleUpdateBlance"
v-if="checkPermi(['member:user:update-balance'])" v-if="checkPermi(['member:user:update-balance'])"
command="handleUpdateBlance"
> >
修改余额(WIP) 修改余额(WIP)
</el-dropdown-item> </el-dropdown-item>
@ -172,9 +181,9 @@
</el-table> </el-table>
<!-- 分页 --> <!-- 分页 -->
<Pagination <Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize" v-model:limit="queryParams.pageSize"
v-model:page="queryParams.pageNo"
:total="total"
@pagination="getList" @pagination="getList"
/> />
</ContentWrap> </ContentWrap>
@ -188,7 +197,7 @@
<!-- 发送优惠券弹窗 --> <!-- 发送优惠券弹窗 -->
<CouponSendForm ref="couponSendFormRef" /> <CouponSendForm ref="couponSendFormRef" />
</template> </template>
<script setup lang="ts"> <script lang="ts" setup>
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import * as UserApi from '@/api/member/user' import * as UserApi from '@/api/member/user'
import { DICT_TYPE } from '@/utils/dict' import { DICT_TYPE } from '@/utils/dict'
@ -198,7 +207,7 @@ import MemberLevelSelect from '@/views/member/level/components/MemberLevelSelect
import MemberGroupSelect from '@/views/member/group/components/MemberGroupSelect.vue' import MemberGroupSelect from '@/views/member/group/components/MemberGroupSelect.vue'
import UserLevelUpdateForm from './UserLevelUpdateForm.vue' import UserLevelUpdateForm from './UserLevelUpdateForm.vue'
import UserPointUpdateForm from './UserPointUpdateForm.vue' import UserPointUpdateForm from './UserPointUpdateForm.vue'
import CouponSendForm from '@/views/mall/promotion/coupon/components/CouponSendForm.vue' import { CouponSendForm } from '@/views/mall/promotion/coupon/components'
import { checkPermi } from '@/utils/permission' import { checkPermi } from '@/utils/permission'
defineOptions({ name: 'MemberUser' }) defineOptions({ name: 'MemberUser' })