商城:

1. 调整优惠劵的目录
2. 简化秒杀时间配置
This commit is contained in:
YunaiV 2023-08-12 11:39:29 +08:00
parent 815897ca8b
commit 9984de0dc7
10 changed files with 29 additions and 39 deletions

View File

@ -20,7 +20,7 @@ export const getSeckillConfig = async (id: number) => {
} }
// 获得所有开启状态的秒杀时段精简列表 // 获得所有开启状态的秒杀时段精简列表
export const getListAllSimple = async () => { export const getSimpleSeckillConfigList = async () => {
return await request.get({ url: '/promotion/seckill-config/list-all-simple' }) return await request.get({ url: '/promotion/seckill-config/list-all-simple' })
} }

View File

@ -31,9 +31,7 @@
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="handleQuery"> <el-button @click="handleQuery"> <Icon icon="ep:search" class="mr-5px" />搜索 </el-button>
<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="resetQuery"> <Icon icon="ep:refresh" class="mr-5px" />重置 </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -108,7 +106,7 @@
</template> </template>
<script setup lang="ts" name="PromotionCoupon"> <script setup lang="ts" name="PromotionCoupon">
import { deleteCoupon, getCouponPage } from '@/api/mall/promotion/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'

View File

@ -187,7 +187,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import * as CouponTemplateApi from '@/api/mall/promotion/couponTemplate' import * as CouponTemplateApi from '@/api/mall/promotion/coupon/couponTemplate'
import * as ProductSpuApi from '@/api/mall/product/spu' import * as ProductSpuApi from '@/api/mall/product/spu'
import { import {
CouponTemplateValidityTypeEnum, CouponTemplateValidityTypeEnum,

View File

@ -61,9 +61,7 @@
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="handleQuery"> <el-button @click="handleQuery"> <Icon icon="ep:search" class="mr-5px" />搜索 </el-button>
<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="resetQuery"> <Icon icon="ep:refresh" class="mr-5px" />重置 </el-button>
<el-button <el-button
v-hasPermi="['promotion:coupon-template:create']" v-hasPermi="['promotion:coupon-template:create']"
@ -172,7 +170,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import * as CouponTemplateApi from '@/api/mall/promotion/couponTemplate' import * as CouponTemplateApi from '@/api/mall/promotion/coupon/couponTemplate'
import { import {
CommonStatusEnum, CommonStatusEnum,
CouponTemplateValidityTypeEnum, CouponTemplateValidityTypeEnum,

View File

@ -71,7 +71,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { allSchemas } from './seckillActivity.data' import { allSchemas } from './seckillActivity.data'
import { getListAllSimple } from '@/api/mall/promotion/seckill/seckillConfig' import { getSimpleSeckillConfigList } from '@/api/mall/promotion/seckill/seckillConfig'
import * as SeckillActivityApi from '@/api/mall/promotion/seckill/seckillActivity' import * as SeckillActivityApi from '@/api/mall/promotion/seckill/seckillActivity'
import SeckillActivityForm from './SeckillActivityForm.vue' import SeckillActivityForm from './SeckillActivityForm.vue'
import { cloneDeep } from 'lodash-es' import { cloneDeep } from 'lodash-es'
@ -132,6 +132,6 @@ onMounted(async () => {
// //
allSchemas.tableColumns.unshift(column) allSchemas.tableColumns.unshift(column)
await getList() await getList()
configList.value = await getListAllSimple() configList.value = await getSimpleSeckillConfigList()
}) })
</script> </script>

View File

@ -1,6 +1,6 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime' import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
import { getListAllSimple } from '@/api/mall/promotion/seckill/seckillConfig' import { getSimpleSeckillConfigList } from '@/api/mall/promotion/seckill/seckillConfig'
// 表单校验 // 表单校验
export const rules = reactive({ export const rules = reactive({
@ -88,7 +88,7 @@ const crudSchemas = reactive<CrudSchema[]>([
valueField: 'id' valueField: 'id'
} }
}, },
api: getListAllSimple api: getSimpleSeckillConfigList
}, },
table: { table: {
width: 300 width: 300

View File

@ -10,7 +10,6 @@
<script lang="ts" name="SeckillConfigForm" setup> <script lang="ts" name="SeckillConfigForm" setup>
import * as SeckillConfigApi from '@/api/mall/promotion/seckill/seckillConfig' import * as SeckillConfigApi from '@/api/mall/promotion/seckill/seckillConfig'
import { allSchemas, rules } from './seckillConfig.data' import { allSchemas, rules } from './seckillConfig.data'
import { cloneDeep } from 'lodash-es'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
@ -53,19 +52,22 @@ const submitForm = async () => {
formLoading.value = true formLoading.value = true
try { try {
// //
const data = formRef.value.formModel as SeckillConfigApi.SeckillConfigVO const sliderPicUrls = []
const cloneData = cloneDeep(data) formRef.value.formModel.sliderPicUrls.forEach((item) => {
const newSliderPicUrls = []
cloneData.sliderPicUrls.forEach((item) => {
// //
typeof item === 'object' ? newSliderPicUrls.push(item.url) : newSliderPicUrls.push(item) typeof item === 'object' ? sliderPicUrls.push(item.url) : sliderPicUrls.push(item)
}) })
cloneData.sliderPicUrls = newSliderPicUrls
//
const data = {
...formRef.value.formModel,
sliderPicUrls
} as SeckillConfigApi.SeckillConfigVO
if (formType.value === 'create') { if (formType.value === 'create') {
await SeckillConfigApi.createSeckillConfig(cloneData) await SeckillConfigApi.createSeckillConfig(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else { } else {
await SeckillConfigApi.updateSeckillConfig(cloneData) await SeckillConfigApi.updateSeckillConfig(data)
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
} }
dialogVisible.value = false dialogVisible.value = false

View File

@ -76,7 +76,6 @@ import * as SeckillConfigApi from '@/api/mall/promotion/seckill/seckillConfig'
import SeckillConfigForm from './SeckillConfigForm.vue' import SeckillConfigForm from './SeckillConfigForm.vue'
import { createImageViewer } from '@/components/ImageViewer' import { createImageViewer } from '@/components/ImageViewer'
import { CommonStatusEnum } from '@/utils/constants' import { CommonStatusEnum } from '@/utils/constants'
import { isArray } from '@/utils/is'
const message = useMessage() // const message = useMessage() //
// tableObject // tableObject
@ -89,21 +88,6 @@ const { tableObject, tableMethods } = useTable({
// //
const { getList, setSearchParams } = tableMethods const { getList, setSearchParams } = tableMethods
/** 轮播图预览预览 */
const imagePreview = (args) => {
const urlList = []
if (isArray(args)) {
args.forEach((item) => {
urlList.push(item)
})
} else {
urlList.push(args)
}
createImageViewer({
urlList
})
}
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref() const formRef = ref()
const openForm = (type: string, id?: number) => { const openForm = (type: string, id?: number) => {
@ -131,6 +115,14 @@ const handleStatusChange = async (row: SeckillConfigApi.SeckillConfigVO) => {
row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE : CommonStatusEnum.ENABLE row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE : CommonStatusEnum.ENABLE
} }
} }
/** 轮播图预览预览 */
const imagePreview = (args) => {
createImageViewer({
urlList: args
})
}
/** 初始化 **/ /** 初始化 **/
onMounted(() => { onMounted(() => {
getList() getList()