style: 添加VO

This commit is contained in:
dhb52 2023-06-01 18:08:23 +08:00
parent c3b0403ade
commit c5a7d05821
5 changed files with 64 additions and 18 deletions

View File

@ -90,3 +90,8 @@ export const deleteSpu = (id: number) => {
export const exportSpu = async (params) => {
return await request.download({ url: '/product/spu/export', params })
}
// 获得商品 SPU 精简列表
export const getSpuSimpleList = async () => {
return request.get({ url: '/product/spu/get-simple-list' })
}

View File

@ -1,16 +1,16 @@
import request from '@/config/axios'
// 删除优惠劵
export function deleteCoupon(id) {
export const deleteCoupon = async (id: number) => {
return request.delete({
url: `/promotion/coupon/delete?id=${id}`
})
}
// 获得优惠劵分页
export function getCouponPage(query) {
export const getCouponPage = async (params: PageParam) => {
return request.get({
url: '/promotion/coupon/page',
params: query
params: params
})
}

View File

@ -1,7 +1,30 @@
import request from '@/config/axios'
export interface CouponTemplateVO {
id: number
name: string
status: number
totalCount: number
takeLimitCount: number
takeType: number
usePrice: number
productScope: number
productSpuIds: string
validityType: number
validStartTime: Date
validEndTime: Date
fixedStartTerm: number
fixedEndTerm: number
discountType: number
discountPercent: number
discountPrice: number
discountLimitPrice: number
takeCount: number
useCount: number
}
// 创建优惠劵模板
export function createCouponTemplate(data) {
export function createCouponTemplate(data: CouponTemplateVO) {
return request.post({
url: '/promotion/coupon-template/create',
data: data
@ -9,7 +32,7 @@ export function createCouponTemplate(data) {
}
// 更新优惠劵模板
export function updateCouponTemplate(data) {
export function updateCouponTemplate(data: CouponTemplateVO) {
return request.put({
url: '/promotion/coupon-template/update',
data: data
@ -17,7 +40,7 @@ export function updateCouponTemplate(data) {
}
// 更新优惠劵模板的状态
export function updateCouponTemplateStatus(id, status) {
export function updateCouponTemplateStatus(id: number, status: [0, 1]) {
const data = {
id,
status
@ -29,32 +52,32 @@ export function updateCouponTemplateStatus(id, status) {
}
// 删除优惠劵模板
export function deleteCouponTemplate(id) {
export function deleteCouponTemplate(id: number) {
return request.delete({
url: '/promotion/coupon-template/delete?id=' + id
})
}
// 获得优惠劵模板
export function getCouponTemplate(id) {
export function getCouponTemplate(id: number) {
return request.get({
url: '/promotion/coupon-template/get?id=' + id
})
}
// 获得优惠劵模板分页
export function getCouponTemplatePage(query) {
export function getCouponTemplatePage(params: PageParam) {
return request.get({
url: '/promotion/coupon-template/page',
params: query
params: params
})
}
// 导出优惠劵模板 Excel
export function exportCouponTemplateExcel(query) {
export function exportCouponTemplateExcel(params: PageParam) {
return request.get({
url: '/promotion/coupon-template/export-excel',
params: query,
params: params,
responseType: 'blob'
})
}

View File

@ -221,6 +221,24 @@ export const PayRefundStatusEnum = {
}
}
/**
* SPU
*/
export const ProductSpuStatusEnum = {
RECYCLE: {
status: -1,
name: '回收站'
},
DISABLE: {
status: 0,
name: '下架'
},
ENABLE: {
status: 1,
name: '上架'
}
}
/**
*
*/

View File

@ -491,7 +491,7 @@ const handleAdd = () => {
}
/** 修改按钮操作 */
const handleUpdate = async (row) => {
const handleUpdate = async (row: any) => {
reset()
const id = row.id
try {
@ -558,7 +558,7 @@ const submitForm = async () => {
}
/** 优惠劵模板状态修改 */
const handleStatusChange = async (row) => {
const handleStatusChange = async (row: any) => {
// row
let text = row.status === CommonStatusEnum.ENABLE ? '启用' : '停用'
@ -574,7 +574,7 @@ const handleStatusChange = async (row) => {
}
/** 删除按钮操作 */
const handleDelete = async (row) => {
const handleDelete = async (row: any) => {
const id = row.id
try {
await message.confirm('是否确认删除优惠劵编号为"' + id + '"的数据项?')
@ -583,7 +583,7 @@ const handleDelete = async (row) => {
}
// /
const discountFormat = (row) => {
const discountFormat = (row: any) => {
if (row.discountType === PromotionDiscountTypeEnum.PRICE.type) {
return `${(row.discountPrice / 100.0).toFixed(2)}`
}
@ -594,7 +594,7 @@ const discountFormat = (row) => {
}
//
const takeLimitCountFormat = (row) => {
const takeLimitCountFormat = (row: any) => {
if (row.takeLimitCount === -1) {
return '无领取限制'
}
@ -602,7 +602,7 @@ const takeLimitCountFormat = (row) => {
}
//
const validityTypeFormat = (row) => {
const validityTypeFormat = (row: any) => {
if (row.validityType === CouponTemplateValidityTypeEnum.DATE.type) {
return `${formatDate(row.validStartTime)}${formatDate(row.validEndTime)}`
}