mirror of
https://gitee.com/hhyykk/ipms-sjy-ui.git
synced 2025-08-09 23:51:52 +08:00
Merge branch 'dev' of https://gitee.com/yudaocode/yudao-ui-admin-vue3
# Conflicts: # src/components/DiyEditor/components/mobile/PromotionCombination/index.vue # src/views/ai/mindmap/manager/index.vue
This commit is contained in:
@@ -11,9 +11,9 @@
|
||||
@click="handleClick(item.routerName)"
|
||||
>
|
||||
<CountTo
|
||||
:prefix="item.prefix"
|
||||
:end-val="item.value"
|
||||
:decimals="item.decimals"
|
||||
:end-val="item.value"
|
||||
:prefix="item.prefix"
|
||||
class="text-3xl"
|
||||
/>
|
||||
<span class="text-center">{{ item.name }}</span>
|
||||
|
@@ -180,17 +180,17 @@
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="销售价(元)" min-width="80">
|
||||
<template #default="{ row }">
|
||||
{{ row.price }}
|
||||
{{ formatToFraction(row.price) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="市场价(元)" min-width="80">
|
||||
<template #default="{ row }">
|
||||
{{ row.marketPrice }}
|
||||
{{ formatToFraction(row.marketPrice) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="成本价(元)" min-width="80">
|
||||
<template #default="{ row }">
|
||||
{{ row.costPrice }}
|
||||
{{ formatToFraction(row.costPrice) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="库存" min-width="80">
|
||||
@@ -211,12 +211,12 @@
|
||||
<template v-if="formData!.subCommissionType">
|
||||
<el-table-column align="center" label="一级返佣(元)" min-width="80">
|
||||
<template #default="{ row }">
|
||||
{{ row.firstBrokeragePrice }}
|
||||
{{ formatToFraction(row.firstBrokeragePrice) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="二级返佣(元)" min-width="80">
|
||||
<template #default="{ row }">
|
||||
{{ row.secondBrokeragePrice }}
|
||||
{{ formatToFraction(row.secondBrokeragePrice) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
@@ -260,17 +260,17 @@
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="销售价(元)" min-width="80">
|
||||
<template #default="{ row }">
|
||||
{{ row.price }}
|
||||
{{ formatToFraction(row.price) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="市场价(元)" min-width="80">
|
||||
<template #default="{ row }">
|
||||
{{ row.marketPrice }}
|
||||
{{ formatToFraction(row.marketPrice) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="成本价(元)" min-width="80">
|
||||
<template #default="{ row }">
|
||||
{{ row.costPrice }}
|
||||
{{ formatToFraction(row.costPrice) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="库存" min-width="80">
|
||||
@@ -284,7 +284,7 @@
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { PropType, Ref } from 'vue'
|
||||
import { copyValueToTarget } from '@/utils'
|
||||
import { copyValueToTarget, formatToFraction } from '@/utils'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
import { UploadImg } from '@/components/UploadFile'
|
||||
import type { Property, Sku, Spu } from '@/api/mall/product/spu'
|
||||
|
@@ -19,19 +19,19 @@
|
||||
{{ value.name }}
|
||||
</el-tag>
|
||||
<el-select
|
||||
v-show="inputVisible(index)"
|
||||
:id="`input${index}`"
|
||||
:ref="setInputRef"
|
||||
v-show="inputVisible(index)"
|
||||
v-model="inputValue"
|
||||
filterable
|
||||
allow-create
|
||||
default-first-option
|
||||
:reserve-keyword="false"
|
||||
size="small"
|
||||
allow-create
|
||||
class="!w-30"
|
||||
default-first-option
|
||||
filterable
|
||||
size="small"
|
||||
@blur="handleInputConfirm(index, item.id)"
|
||||
@keyup.enter="handleInputConfirm(index, item.id)"
|
||||
@change="handleInputConfirm(index, item.id)"
|
||||
@keyup.enter="handleInputConfirm(index, item.id)"
|
||||
>
|
||||
<el-option
|
||||
v-for="item2 in attributeOptions"
|
||||
|
@@ -12,12 +12,12 @@
|
||||
<el-form-item label="属性名称" prop="name">
|
||||
<el-select
|
||||
v-model="formData.name"
|
||||
filterable
|
||||
allow-create
|
||||
default-first-option
|
||||
:reserve-keyword="false"
|
||||
placeholder="请选择属性名称。如果不存在,可手动输入选择"
|
||||
allow-create
|
||||
class="!w-360px"
|
||||
default-first-option
|
||||
filterable
|
||||
placeholder="请选择属性名称。如果不存在,可手动输入选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in attributeOptions"
|
||||
|
@@ -2,11 +2,11 @@
|
||||
<template>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="formLoading"
|
||||
:disabled="isDetail"
|
||||
:model="formData"
|
||||
:rules="rules"
|
||||
label-width="120px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="分销类型" props="subCommissionType">
|
||||
<el-radio-group
|
||||
|
@@ -29,15 +29,14 @@
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="销量" min-width="90" prop="salesCount" />
|
||||
<el-table-column align="center" label="库存" min-width="90" prop="stock" />
|
||||
<el-table-column v-if="spuData.length > 1 && isDelete" align="center" label="操作" min-width="90" >
|
||||
<el-table-column
|
||||
v-if="spuData.length > 1 && isDelete"
|
||||
align="center"
|
||||
label="操作"
|
||||
min-width="90"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
@click="deleteSpu(scope.row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button type="primary" link @click="deleteSpu(scope.row.id)"> 删除 </el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -57,7 +56,7 @@ const props = defineProps<{
|
||||
spuList: T[]
|
||||
ruleConfig: RuleConfig[]
|
||||
spuPropertyListP: SpuProperty<T>[]
|
||||
isDelete?: boolean //spu是否可以多选
|
||||
isDelete?: boolean // SPU 是否可删除;TODO deletable 换成这个名字好点。
|
||||
}>()
|
||||
|
||||
const spuData = ref<Spu[]>([]) // spu 详情数据列表
|
||||
@@ -96,12 +95,12 @@ const emits = defineEmits<{
|
||||
(e: 'delete', spuId: number): void
|
||||
}>()
|
||||
|
||||
/** 多选时可以删除spu **/
|
||||
/** 多选时可以删除 SPU **/
|
||||
const deleteSpu = async (spuId: number) => {
|
||||
await message.confirm('是否删除商品编号为' + spuId + '的数据?')
|
||||
let index = spuData.value.findIndex((item) => item.id == spuId)
|
||||
spuData.value.splice(index,1);
|
||||
emits('delete',spuId)
|
||||
const index = spuData.value.findIndex((item) => item.id == spuId)
|
||||
spuData.value.splice(index, 1)
|
||||
emits('delete', spuId)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -33,32 +33,6 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠券状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
class="!w-240px"
|
||||
clearable
|
||||
placeholder="请选择优惠券状态"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-240px"
|
||||
end-placeholder="结束日期"
|
||||
start-placeholder="开始日期"
|
||||
type="daterange"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery">
|
||||
<Icon class="mr-5px" icon="ep:search" />
|
||||
@@ -118,13 +92,6 @@
|
||||
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
width="180"
|
||||
/>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
@@ -148,16 +115,17 @@ import {
|
||||
takeLimitCountFormat,
|
||||
validityTypeFormat
|
||||
} from '@/views/mall/promotion/coupon/formatter'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import * as CouponTemplateApi from '@/api/mall/promotion/coupon/couponTemplate'
|
||||
|
||||
defineOptions({ name: 'CouponSelect' })
|
||||
|
||||
defineProps<{
|
||||
multipleSelection: CouponTemplateApi.CouponTemplateVO[]
|
||||
const props = defineProps<{
|
||||
multipleSelection?: CouponTemplateApi.CouponTemplateVO[]
|
||||
takeType: number // 领取方式
|
||||
}>()
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:multipleSelection', v: CouponTemplateApi.CouponTemplateVO[])
|
||||
(e: 'update:multipleSelection', v: CouponTemplateApi.CouponTemplateVO[]): void
|
||||
(e: 'change', v: CouponTemplateApi.CouponTemplateVO[]): void
|
||||
}>()
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('选择优惠卷') // 弹窗的标题
|
||||
@@ -169,18 +137,18 @@ const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
status: null,
|
||||
discountType: null,
|
||||
type: null,
|
||||
createTime: []
|
||||
canTakeTypes: null
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const selectedCouponList = ref<CouponTemplateApi.CouponTemplateVO[]>([]) // 选择的数据
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
// 执行查询
|
||||
queryParams.canTakeTypes = [props.takeType] as any
|
||||
const data = await CouponTemplateApi.getCouponTemplatePage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
@@ -209,11 +177,15 @@ const open = async () => {
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
const handleSelectionChange = (val: CouponTemplateApi.CouponTemplateVO[]) => {
|
||||
emit('update:multipleSelection', val)
|
||||
if (props.multipleSelection) {
|
||||
emit('update:multipleSelection', val)
|
||||
return
|
||||
}
|
||||
selectedCouponList.value = val
|
||||
}
|
||||
|
||||
const submitForm = () => {
|
||||
dialogVisible.value = false
|
||||
emit('change', selectedCouponList.value)
|
||||
}
|
||||
// TODO @puhui999:提前 todo,先不用改;未来单独成组件,其它模块可以服用;例如说,满减送,可以选择优惠劵;
|
||||
</script>
|
||||
|
@@ -49,7 +49,7 @@ import { cloneDeep } from 'lodash-es'
|
||||
import * as DiscountActivityApi from '@/api/mall/promotion/discount/discountActivity'
|
||||
import * as ProductSpuApi from '@/api/mall/product/spu'
|
||||
import { getPropertyList, RuleConfig } from '@/views/mall/product/spu/components'
|
||||
import {formatToFraction} from "@/utils";
|
||||
import { formatToFraction } from '@/utils'
|
||||
|
||||
defineOptions({ name: 'PromotionDiscountActivityForm' })
|
||||
|
||||
@@ -68,7 +68,7 @@ const spuAndSkuListRef = ref() // sku 限时折扣 配置组件Ref
|
||||
const ruleConfig: RuleConfig[] = []
|
||||
const spuList = ref<DiscountActivityApi.SpuExtension[]>([]) // 选择的 spu
|
||||
const spuPropertyList = ref<SpuProperty<DiscountActivityApi.SpuExtension>[]>([])
|
||||
const spuIds = ref<number[]>([]);
|
||||
const spuIds = ref<number[]>([])
|
||||
const selectSpu = (spuId: number, skuIds: number[]) => {
|
||||
getSpuDetails(spuId, skuIds)
|
||||
}
|
||||
@@ -81,12 +81,12 @@ const getSpuDetails = async (
|
||||
products?: DiscountActivityApi.DiscountProductVO[],
|
||||
type?: string
|
||||
) => {
|
||||
//如果已经包含spu则跳过
|
||||
if(spuIds.value.includes(spuId)){
|
||||
if(type !== "load"){
|
||||
message.error("数据重复选择!")
|
||||
// 如果已经包含 SPU 则跳过
|
||||
if (spuIds.value.includes(spuId)) {
|
||||
if (type !== 'load') {
|
||||
message.error('数据重复选择!')
|
||||
}
|
||||
return;
|
||||
return
|
||||
}
|
||||
spuIds.value.push(spuId)
|
||||
const res = (await ProductSpuApi.getSpuDetailList([spuId])) as DiscountActivityApi.SpuExtension[]
|
||||
@@ -143,7 +143,12 @@ const open = async (type: string, id?: number) => {
|
||||
)) as DiscountActivityApi.DiscountActivityVO
|
||||
for (let productsKey in data.products) {
|
||||
const supId = data.products[productsKey].spuId
|
||||
await getSpuDetails(supId!, data.products?.map((sku) => sku.skuId), data.products,"load")
|
||||
await getSpuDetails(
|
||||
supId!,
|
||||
data.products?.map((sku) => sku.skuId),
|
||||
data.products,
|
||||
'load'
|
||||
)
|
||||
}
|
||||
formRef.value.setValues(data)
|
||||
} finally {
|
||||
@@ -164,21 +169,23 @@ const submitForm = async () => {
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formRef.value.formModel as DiscountActivityApi.DiscountActivityVO
|
||||
// 获取 折扣商品配置
|
||||
// 获取折扣商品配置
|
||||
const products = cloneDeep(spuAndSkuListRef.value.getSkuConfigs('productConfig'))
|
||||
let timp = false;
|
||||
// 校验优惠金额、折扣百分比,是否正确
|
||||
// TODO @puhui999:这个交互,可以参考下 youzan 的
|
||||
let discountInvalid = false
|
||||
products.forEach((item: DiscountActivityApi.DiscountProductVO) => {
|
||||
if(item.discountPrice != null && item.discountPrice > 0){
|
||||
if (item.discountPrice != null && item.discountPrice > 0) {
|
||||
item.discountType = 1
|
||||
}else if(item.discountPercent != null && item.discountPercent > 0){
|
||||
} else if (item.discountPercent != null && item.discountPercent > 0) {
|
||||
item.discountType = 2
|
||||
}else{
|
||||
timp = true
|
||||
} else {
|
||||
discountInvalid = true
|
||||
}
|
||||
})
|
||||
if(timp){
|
||||
message.error("优惠金额和折扣百分比需要填写一个");
|
||||
return;
|
||||
if (discountInvalid) {
|
||||
message.error('优惠金额和折扣百分比需要填写一个')
|
||||
return
|
||||
}
|
||||
data.products = products
|
||||
// 真正提交
|
||||
@@ -207,10 +214,16 @@ const resetForm = async () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除spu
|
||||
* 删除 SPU
|
||||
*/
|
||||
const deleteSpu = (spuId: number) => {
|
||||
spuIds.value.splice(spuIds.value.findIndex((item) => item == spuId), 1)
|
||||
spuPropertyList.value.splice(spuPropertyList.value.findIndex((item) => item.spuId == spuId), 1)
|
||||
spuIds.value.splice(
|
||||
spuIds.value.findIndex((item) => item == spuId),
|
||||
1
|
||||
)
|
||||
spuPropertyList.value.splice(
|
||||
spuPropertyList.value.findIndex((item) => item.spuId == spuId),
|
||||
1
|
||||
)
|
||||
}
|
||||
</script>
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<Dialog v-model="dialogVisible" :title="dialogTitle" width="65%">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="formLoading"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="80px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="活动名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入活动名称" />
|
||||
@@ -13,10 +13,11 @@
|
||||
<el-form-item label="活动时间" prop="startAndEndTime">
|
||||
<el-date-picker
|
||||
v-model="formData.startAndEndTime"
|
||||
type="datetimerange"
|
||||
range-separator="-"
|
||||
:start-placeholder="t('common.startTimeText')"
|
||||
:end-placeholder="t('common.endTimeText')"
|
||||
:start-placeholder="t('common.startTimeText')"
|
||||
range-separator="-"
|
||||
type="datetimerange"
|
||||
value-format="x"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="条件类型" prop="conditionType">
|
||||
@@ -24,187 +25,83 @@
|
||||
<el-radio
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.PROMOTION_CONDITION_TYPE)"
|
||||
:key="dict.value"
|
||||
:value="dict.value"
|
||||
:label="dict.value"
|
||||
>
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠设置">
|
||||
<template v-for="(item, index) in formData.rules" :key="index">
|
||||
<el-row type="flex">
|
||||
<el-col :span="24" style="display: flex; font-weight: bold">
|
||||
活动层级{{ index + 1 }}
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
style="margin-left: auto"
|
||||
v-if="index != 0"
|
||||
@click="deleteActivityRule(index)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-form :ref="'formRef' + index" :model="item">
|
||||
<el-form-item
|
||||
label="优惠门槛:"
|
||||
prop="limit"
|
||||
label-width="100px"
|
||||
style="padding-left: 50px"
|
||||
>
|
||||
满
|
||||
<el-input
|
||||
style="width: 150px; padding: 0 10px"
|
||||
v-model="item.limit"
|
||||
type="number"
|
||||
placeholder=""
|
||||
/>
|
||||
元
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠内容:" label-width="100px" style="padding-left: 50px">
|
||||
<el-checkbox-group v-model="activityRules[index]" style="width: 100%">
|
||||
<el-col :span="24">
|
||||
<el-checkbox label="订单金额优惠" value="订单金额优惠" name="type" />
|
||||
<el-form-item v-if="activityRules[index].includes('订单金额优惠')">
|
||||
减
|
||||
<el-input
|
||||
style="width: 150px; padding: 0 20px"
|
||||
v-model="item.discountPrice"
|
||||
type="number"
|
||||
placeholder=""
|
||||
/>
|
||||
元
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-checkbox
|
||||
v-model="item.freeDelivery"
|
||||
label="包邮"
|
||||
value="包邮"
|
||||
name="type"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-checkbox label="送积分" value="送积分" name="type" />
|
||||
<el-form-item v-if="activityRules[index].includes('送积分')">
|
||||
送
|
||||
<el-input
|
||||
style="width: 150px; padding: 0 20px"
|
||||
v-model="item.point"
|
||||
type="number"
|
||||
placeholder=""
|
||||
/>
|
||||
积分
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- 优惠券待处理 也可以参考优惠劵的SpuShowcase-->
|
||||
<!-- TODO 待实现!-->
|
||||
<el-col :span="24">
|
||||
<el-checkbox label="送优惠券" value="送优惠券" name="type" />
|
||||
</el-col>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
</template>
|
||||
<!-- TODO 实现:建议改成放在每一个【活动层级】的下面,有点类似主子表 -->
|
||||
<el-button type="primary" @click="addActivityStratum">添加活动层级</el-button>
|
||||
<RewardRule ref="rewardRuleRef" v-model="formData" />
|
||||
</el-form-item>
|
||||
<el-form-item label="活动商品" prop="productScope">
|
||||
<el-form-item label="活动范围" prop="productScope">
|
||||
<el-radio-group v-model="formData.productScope">
|
||||
<el-radio
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.PROMOTION_PRODUCT_SCOPE)"
|
||||
:key="dict.value"
|
||||
:value="dict.value"
|
||||
:label="dict.value"
|
||||
>
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<!-- TODO:活动商品的开发,可以参考优惠劵的,已经搞好啦; -->
|
||||
<el-form-item
|
||||
v-if="formData.productScope === PromotionProductScopeEnum.SPU.scope"
|
||||
prop="productSpuIds"
|
||||
>
|
||||
<el-select
|
||||
v-model="formData.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; font-size: 13px; color: #8492a6">
|
||||
¥{{ (item.price / 100.0).toFixed(2) }}
|
||||
</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<SpuShowcase v-model="formData.productSpuIds" />
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="formData.productScope === PromotionProductScopeEnum.CATEGORY.scope"
|
||||
label="分类"
|
||||
prop="productCategoryIds"
|
||||
>
|
||||
<ProductCategorySelect v-model="formData.productCategoryIds" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { getSpuSimpleList } from '@/api/mall/product/spu'
|
||||
import RewardRule from './components/RewardRule.vue'
|
||||
import SpuShowcase from '@/views/mall/product/spu/components/SpuShowcase.vue'
|
||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import * as RewardActivityApi from '@/api/mall/promotion/reward/rewardActivity'
|
||||
import { PromotionConditionTypeEnum, PromotionProductScopeEnum } from '@/utils/constants'
|
||||
import ProductCategorySelect from '@/views/mall/product/category/components/ProductCategorySelect.vue'
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
import { fenToYuan, yuanToFen } from '@/utils'
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getSpuSimpleList().then((response) => {
|
||||
productSpus.value = response
|
||||
})
|
||||
})
|
||||
defineOptions({ name: 'ProductBrandForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const productSpus = ref<any[]>([]) // 商品数据
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
startAndEndTime: undefined,
|
||||
startTime: undefined,
|
||||
endTime: undefined,
|
||||
const formData = ref<RewardActivityApi.RewardActivityVO>({
|
||||
conditionType: PromotionConditionTypeEnum.PRICE.type,
|
||||
remark: undefined,
|
||||
productScope: PromotionProductScopeEnum.ALL.scope,
|
||||
productSpuIds: undefined,
|
||||
rules: [
|
||||
{
|
||||
limit: undefined,
|
||||
discountPrice: undefined,
|
||||
freeDelivery: undefined,
|
||||
point: undefined,
|
||||
couponIds: [],
|
||||
couponCounts: []
|
||||
}
|
||||
]
|
||||
})
|
||||
const activityRules = reactive([]) // 优惠设置。每个元素都是一个 [],放“包邮”、“送积分”、“订单金额优惠”
|
||||
rules: []
|
||||
} as RewardActivityApi.RewardActivityVO)
|
||||
const formRules = reactive({
|
||||
name: [{ required: true, message: '活动名称不能为空', trigger: 'blur' }],
|
||||
startAndEndTime: [{ required: true, message: '活动时间不能为空', trigger: 'blur' }],
|
||||
conditionType: [{ required: true, message: '条件类型不能为空', trigger: 'change' }],
|
||||
productScope: [{ required: true, message: '商品范围不能为空', trigger: 'blur' }],
|
||||
productSpuIds: [{ required: true, message: '商品范围不能为空', trigger: 'blur' }]
|
||||
productSpuIds: [{ required: true, message: '商品不能为空', trigger: 'blur' }],
|
||||
productCategoryIds: [{ required: true, message: '商品分类不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref([]) // 表单 Ref
|
||||
const formRef = ref() // 表单 Ref
|
||||
const rewardRuleRef = ref<InstanceType<typeof RewardRule>>() // 活动规则 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
@@ -216,24 +113,16 @@ const open = async (type: string, id?: number) => {
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
let data = await RewardActivityApi.getReward(id)
|
||||
data.startAndEndTime = [new Date(data.startTime), new Date(data.endTime)]
|
||||
activityRules.splice(0, activityRules.length)
|
||||
data.rules.forEach((item) => {
|
||||
// TODO 是不是不用 reactive,直接 [] 就可以了?
|
||||
let array: string[] = reactive([])
|
||||
if (item.freeDelivery) {
|
||||
array.push('包邮')
|
||||
}
|
||||
if (item.point) {
|
||||
array.push('送积分')
|
||||
}
|
||||
if (item.discountPrice) {
|
||||
array.push('订单金额优惠')
|
||||
}
|
||||
activityRules.push(array)
|
||||
const data = await RewardActivityApi.getReward(id)
|
||||
// 转区段时间
|
||||
data.startAndEndTime = [data.startTime, data.endTime]
|
||||
// 规则分转元
|
||||
data.rules?.forEach((item: any) => {
|
||||
item.discountPrice = fenToYuan(item.discountPrice || 0)
|
||||
})
|
||||
formData.value = data
|
||||
// 获得商品范围
|
||||
await getProductScope()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
@@ -245,26 +134,26 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
if (!formRef) return
|
||||
if (!formRef.value) return
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) return
|
||||
// 处理下数据兼容接口
|
||||
formData.value.startTime = +new Date(formData.value.startAndEndTime[0])
|
||||
formData.value.endTime = +new Date(formData.value.startAndEndTime[1])
|
||||
activityRules.forEach((item, index) => {
|
||||
formData.value.rules[index].freeDelivery = !!item.includes('包邮')
|
||||
if (!item.includes('送积分')) {
|
||||
formData.value.rules[index].point = undefined
|
||||
}
|
||||
if (!item.includes('订单金额优惠')) {
|
||||
formData.value.rules[index].discountPrice = undefined
|
||||
}
|
||||
})
|
||||
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as RewardActivityApi.DiscountActivityVO
|
||||
// 设置活动规则优惠券
|
||||
rewardRuleRef.value?.setRuleCoupon()
|
||||
const data = cloneDeep(formData.value)
|
||||
// 时间段转换
|
||||
data.startTime = data.startAndEndTime![0]
|
||||
data.endTime = data.startAndEndTime![1]
|
||||
delete data.startAndEndTime
|
||||
// 规则元转分
|
||||
data.rules.forEach((item) => {
|
||||
item.discountPrice = yuanToFen(item.discountPrice || 0)
|
||||
})
|
||||
// 设置商品范围
|
||||
setProductScopeValues(data)
|
||||
if (formType.value === 'create') {
|
||||
await RewardActivityApi.createRewardActivity(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
@@ -280,51 +169,50 @@ const submitForm = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const addActivityStratum = () => {
|
||||
formData.value.rules.push({
|
||||
limit: undefined,
|
||||
discountPrice: undefined,
|
||||
freeDelivery: undefined,
|
||||
point: undefined,
|
||||
couponIds: [],
|
||||
couponCounts: []
|
||||
})
|
||||
activityRules.push([])
|
||||
}
|
||||
|
||||
const deleteActivityRule = (index) => {
|
||||
formData.value.rules.splice(index, 1)
|
||||
activityRules.splice(index, 1)
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
startAndEndTime: undefined,
|
||||
startTime: undefined,
|
||||
endTime: undefined,
|
||||
conditionType: PromotionConditionTypeEnum.PRICE.type,
|
||||
remark: undefined,
|
||||
productScope: PromotionProductScopeEnum.ALL.scope,
|
||||
productSpuIds: undefined,
|
||||
rules: [
|
||||
{
|
||||
limit: undefined,
|
||||
discountPrice: undefined,
|
||||
freeDelivery: undefined,
|
||||
point: undefined,
|
||||
couponIds: [],
|
||||
couponCounts: []
|
||||
rules: []
|
||||
} as RewardActivityApi.RewardActivityVO
|
||||
}
|
||||
|
||||
/** 获得商品范围 */
|
||||
const getProductScope = async () => {
|
||||
switch (formData.value.productScope) {
|
||||
case PromotionProductScopeEnum.SPU.scope:
|
||||
// 设置商品编号
|
||||
formData.value.productSpuIds = formData.value.productScopeValues
|
||||
break
|
||||
case PromotionProductScopeEnum.CATEGORY.scope:
|
||||
await nextTick()
|
||||
let productCategoryIds = formData.value.productScopeValues as any
|
||||
if (Array.isArray(productCategoryIds) && productCategoryIds.length > 0) {
|
||||
// 单选时使用数组不能反显
|
||||
productCategoryIds = productCategoryIds[0]
|
||||
}
|
||||
]
|
||||
// 设置品类编号
|
||||
formData.value.productCategoryIds = productCategoryIds
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
/** 设置商品范围 */
|
||||
function setProductScopeValues(data: any) {
|
||||
switch (formData.value.productScope) {
|
||||
case PromotionProductScopeEnum.SPU.scope:
|
||||
data.productScopeValues = formData.value.productSpuIds
|
||||
break
|
||||
case PromotionProductScopeEnum.CATEGORY.scope:
|
||||
data.productScopeValues = Array.isArray(formData.value.productCategoryIds)
|
||||
? formData.value.productCategoryIds
|
||||
: [formData.value.productCategoryIds]
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
activityRules.splice(0, activityRules.length)
|
||||
activityRules.push(reactive([]))
|
||||
// 解决下有时刷新页面第一次点编辑报错
|
||||
nextTick(() => {
|
||||
formRef.value?.resetFields()
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
@@ -0,0 +1,127 @@
|
||||
<template>
|
||||
<!-- 满减送活动规则组件 -->
|
||||
<el-row>
|
||||
<template v-if="formData.rules">
|
||||
<el-col v-for="(rule, index) in formData.rules" :key="index" :span="24">
|
||||
<span class="font-bold">活动层级{{ index + 1 }}</span>
|
||||
<el-button v-if="index !== 0" link type="danger" @click="deleteRule(index)">
|
||||
删除
|
||||
</el-button>
|
||||
<el-form ref="formRef" :model="rule">
|
||||
<el-form-item label="优惠门槛:" label-width="100px" prop="limit">
|
||||
满
|
||||
<el-input
|
||||
v-model="rule.limit"
|
||||
:min="0"
|
||||
class="w-150px! p-x-20px!"
|
||||
placeholder=""
|
||||
type="number"
|
||||
/>
|
||||
<!-- TODO @puhui999:走字典数据? -->
|
||||
{{ PromotionConditionTypeEnum.PRICE.type === formData.conditionType ? '元' : '件' }}
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠内容:" label-width="100px">
|
||||
<el-col :span="24">
|
||||
订单金额优惠
|
||||
<el-form-item>
|
||||
减
|
||||
<el-input-number
|
||||
v-model="rule.discountPrice"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="0.1"
|
||||
class="w-150px! p-x-20px!"
|
||||
controls-position="right"
|
||||
/>
|
||||
元
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<span>包邮:</span>
|
||||
<el-switch
|
||||
v-model="rule.freeDelivery"
|
||||
active-text="是"
|
||||
inactive-text="否"
|
||||
inline-prompt
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<span>送积分:</span>
|
||||
<el-form-item>
|
||||
送
|
||||
<el-input
|
||||
v-model="rule.point"
|
||||
class="w-150px! p-x-20px!"
|
||||
placeholder=""
|
||||
type="number"
|
||||
/>
|
||||
积分
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<span>送优惠券:</span>
|
||||
<RewardRuleCouponSelect ref="rewardRuleCouponSelectRef" v-model="rule!" />
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</template>
|
||||
<el-col :span="24" class="mt-10px">
|
||||
<el-button type="primary" @click="addRule">添加优惠规则</el-button>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-tag type="warning"> 赠送积分为 0 时不赠送。未选优惠券时不赠送。</el-tag>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import RewardRuleCouponSelect from './RewardRuleCouponSelect.vue'
|
||||
import { RewardActivityVO } from '@/api/mall/promotion/reward/rewardActivity'
|
||||
import { PromotionConditionTypeEnum } from '@/utils/constants'
|
||||
import { useVModel } from '@vueuse/core'
|
||||
import { isEmpty } from '@/utils/is'
|
||||
|
||||
defineOptions({ name: 'RewardRule' })
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: RewardActivityVO
|
||||
}>()
|
||||
|
||||
const emits = defineEmits<{
|
||||
(e: 'update:modelValue', v: any): void
|
||||
(e: 'deleteRule', v: number): void
|
||||
}>()
|
||||
|
||||
const formData = useVModel(props, 'modelValue', emits) // 活动数据
|
||||
const rewardRuleCouponSelectRef = ref<InstanceType<typeof RewardRuleCouponSelect>[]>() // 活动规则优惠券 Ref
|
||||
|
||||
/** 删除优惠规则 */
|
||||
const deleteRule = (ruleIndex: number) => {
|
||||
formData.value.rules.splice(ruleIndex, 1)
|
||||
}
|
||||
|
||||
/** 添加优惠规则 */
|
||||
const addRule = () => {
|
||||
if (isEmpty(formData.value.rules)) {
|
||||
formData.value.rules = []
|
||||
}
|
||||
formData.value.rules.push({
|
||||
limit: 0,
|
||||
discountPrice: 0,
|
||||
freeDelivery: false,
|
||||
point: 0
|
||||
})
|
||||
}
|
||||
|
||||
/** 设置规则优惠券-提交时 */
|
||||
const setRuleCoupon = () => {
|
||||
if (isEmpty(rewardRuleCouponSelectRef.value)) {
|
||||
return
|
||||
}
|
||||
|
||||
rewardRuleCouponSelectRef.value?.forEach((item) => item.setGiveCouponList())
|
||||
}
|
||||
|
||||
defineExpose({ setRuleCoupon })
|
||||
</script>
|
@@ -0,0 +1,136 @@
|
||||
<template>
|
||||
<el-button class="ml-10px" type="text" @click="selectCoupon">添加优惠卷</el-button>
|
||||
|
||||
<div
|
||||
v-for="(item, index) in list"
|
||||
:key="item.id"
|
||||
class="coupon-list-item p-x-10px mb-10px flex justify-between"
|
||||
>
|
||||
<div class="coupon-list-item-left flex items-center flex-wrap">
|
||||
<div class="mr-10px"> 优惠券名称:{{ item.name }}</div>
|
||||
<div class="mr-10px">
|
||||
范围:
|
||||
<dict-tag :type="DICT_TYPE.PROMOTION_PRODUCT_SCOPE" :value="item.productScope" />
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
优惠:
|
||||
<dict-tag :type="DICT_TYPE.PROMOTION_DISCOUNT_TYPE" :value="item.discountType" />
|
||||
{{ discountFormat(item) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="coupon-list-item-right">
|
||||
送
|
||||
<el-input v-model="item.giveCount" class="w-150px! p-x-20px!" placeholder="" type="number" />
|
||||
张
|
||||
<el-button class="ml-20px" link type="danger" @click="deleteCoupon(index)">删除</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 优惠券选择 -->
|
||||
<CouponSelect
|
||||
ref="couponSelectRef"
|
||||
:take-type="CouponTemplateTakeTypeEnum.ADMIN.type"
|
||||
@change="handleCouponChange"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { CouponSelect } from '@/views/mall/promotion/coupon/components'
|
||||
import * as CouponTemplateApi from '@/api/mall/promotion/coupon/couponTemplate'
|
||||
import { RewardRule } from '@/api/mall/promotion/reward/rewardActivity'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { CouponTemplateTakeTypeEnum } from '@/utils/constants'
|
||||
import { discountFormat } from '@/views/mall/promotion/coupon/formatter'
|
||||
import { isEmpty } from '@/utils/is'
|
||||
import { useVModel } from '@vueuse/core'
|
||||
|
||||
defineOptions({ name: 'RewardRuleCouponSelect' })
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: RewardRule
|
||||
}>()
|
||||
|
||||
const emits = defineEmits<{
|
||||
(e: 'update:modelValue', v: any): void
|
||||
}>()
|
||||
|
||||
const rewardRule = useVModel(props, 'modelValue', emits) // 赠送规则
|
||||
const list = ref<GiveCouponVO[]>([]) // 选择的优惠券列表
|
||||
|
||||
/** 选择赠送的优惠卷类型拓展 */
|
||||
interface GiveCouponVO extends CouponTemplateApi.CouponTemplateVO {
|
||||
giveCount?: number
|
||||
}
|
||||
|
||||
/** 选择优惠券 */
|
||||
const couponSelectRef = ref<InstanceType<typeof CouponSelect>>() // 优惠券选择
|
||||
const selectCoupon = () => {
|
||||
couponSelectRef.value?.open()
|
||||
}
|
||||
|
||||
/** 选择优惠券后的回调 */
|
||||
const handleCouponChange = (val: CouponTemplateApi.CouponTemplateVO[]) => {
|
||||
for (const item of val) {
|
||||
if (list.value.some((v) => v.id === item.id)) {
|
||||
continue
|
||||
}
|
||||
list.value.push(item)
|
||||
}
|
||||
}
|
||||
|
||||
/** 删除优惠券 */
|
||||
const deleteCoupon = (index: number) => {
|
||||
list.value.splice(index, 1)
|
||||
}
|
||||
|
||||
/** 初始化赠送的优惠券列表 */
|
||||
const initGiveCouponList = async () => {
|
||||
// 校验优惠券存在
|
||||
if (isEmpty(rewardRule.value) || isEmpty(rewardRule.value.giveCouponTemplateCounts)) {
|
||||
return
|
||||
}
|
||||
const tempLateIds = Object.keys(rewardRule.value.giveCouponTemplateCounts!).map((item) =>
|
||||
parseInt(item)
|
||||
)
|
||||
const data = await CouponTemplateApi.getCouponTemplateList(tempLateIds)
|
||||
if (!data) {
|
||||
return
|
||||
}
|
||||
// 回显
|
||||
data.forEach((coupon) => {
|
||||
list.value.push({
|
||||
...coupon,
|
||||
giveCount: rewardRule.value.giveCouponTemplateCounts![coupon.id]
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/** 设置赠送的优惠券 */
|
||||
const setGiveCouponList = () => {
|
||||
if (isEmpty(rewardRule.value) || isEmpty(list.value)) {
|
||||
return
|
||||
}
|
||||
|
||||
// 设置优惠券和其数量的对应
|
||||
list.value.forEach((rule) => {
|
||||
if (!rewardRule.value.giveCouponTemplateCounts) {
|
||||
rewardRule.value.giveCouponTemplateCounts = {}
|
||||
}
|
||||
rewardRule.value.giveCouponTemplateCounts[rule.id] = rule.giveCount!
|
||||
})
|
||||
}
|
||||
defineExpose({ setGiveCouponList })
|
||||
|
||||
/** 组件初始化 */
|
||||
onMounted(async () => {
|
||||
await nextTick()
|
||||
await initGiveCouponList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.coupon-list-item {
|
||||
border: 1px dashed var(--el-border-color-darker);
|
||||
border-radius: 8px;
|
||||
}
|
||||
</style>
|
@@ -4,27 +4,27 @@
|
||||
<!-- 搜索工作栏 -->
|
||||
<ContentWrap>
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
:model="queryParams"
|
||||
class="-mb-15px"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="活动名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入活动名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
clearable
|
||||
placeholder="请输入活动名称"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="活动状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="请选择活动状态"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
clearable
|
||||
placeholder="请选择活动状态"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.PROMOTION_ACTIVITY_STATUS)"
|
||||
@@ -37,24 +37,31 @@
|
||||
<el-form-item label="活动时间" prop="createTime">
|
||||
<el-date-picker
|
||||
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')]"
|
||||
class="!w-240px"
|
||||
end-placeholder="活动结束日期"
|
||||
start-placeholder="活动开始日期"
|
||||
type="daterange"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button @click="handleQuery">
|
||||
<Icon class="mr-5px" icon="ep:search" />
|
||||
搜索
|
||||
</el-button>
|
||||
<el-button @click="resetQuery">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
重置
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['product:brand:create']"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openForm('create')"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
新增
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -62,47 +69,47 @@
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" row-key="id" default-expand-all>
|
||||
<el-table v-loading="loading" :data="list" default-expand-all row-key="id">
|
||||
<el-table-column label="活动名称" prop="name" />
|
||||
<el-table-column
|
||||
label="活动开始时间"
|
||||
align="center"
|
||||
prop="startTime"
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="活动开始时间"
|
||||
prop="startTime"
|
||||
/>
|
||||
<el-table-column
|
||||
label="活动结束时间"
|
||||
align="center"
|
||||
prop="endTime"
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="活动结束时间"
|
||||
prop="endTime"
|
||||
/>
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<el-table-column align="center" label="状态" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.PROMOTION_ACTIVITY_STATUS" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
width="180"
|
||||
:formatter="dateFormatter"
|
||||
/>
|
||||
<el-table-column label="操作" align="center">
|
||||
<el-table-column align="center" label="操作">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-hasPermi="['product:brand:update']"
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['product:brand:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['product:brand:delete']"
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['product:brand:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
@@ -111,9 +118,9 @@
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
v-model:page="queryParams.pageNo"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
@@ -168,9 +175,9 @@ const resetQuery = () => {
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const formRef = ref<InstanceType<typeof RewardForm>>()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
formRef.value?.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
|
@@ -135,7 +135,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="订单金额" prop="refundPrice" min-width="120">
|
||||
<el-table-column align="center" label="订单金额" min-width="120" prop="refundPrice">
|
||||
<template #default="scope">
|
||||
<span>{{ fenToYuan(scope.row.refundPrice) }} 元</span>
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user