Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
YunaiV committed Sep 3, 2023
2 parents 067f89f + 1302089 commit 881ec67
Show file tree
Hide file tree
Showing 23 changed files with 888 additions and 450 deletions.
8 changes: 8 additions & 0 deletions src/api/mall/promotion/coupon/coupon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,11 @@ export const getCouponPage = async (params: PageParam) => {
params: params
})
}

// 发送优惠券
export const sendCoupon = async (data: any) => {
return request.post({
url: '/promotion/coupon/send',
data: data
})
}
2 changes: 1 addition & 1 deletion src/api/mall/promotion/coupon/couponTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface CouponTemplateVO {
takeType: number
usePrice: number
productScope: number
productSpuIds: string
productScopeValues: number[]
validityType: number
validStartTime: Date
validEndTime: Date
Expand Down
18 changes: 15 additions & 3 deletions src/api/mall/trade/order/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ export interface OrderVO {
cancelTime?: Date | null // 订单取消时间
cancelType?: number | null // 取消类型
remark?: string // 商家备注
payOrderId: number | null // 支付订单编号
payOrderId?: number | null // 支付订单编号
payed?: boolean // 是否已支付
payTime?: Date | null // 付款时间
payChannelCode?: string // 支付渠道
originalPrice?: number | null // 商品原价(总)
totalPrice?: number | null // 商品原价(总)
orderPrice?: number | null // 订单原价(总)
discountPrice?: number | null // 订单优惠(总)
deliveryPrice?: number | null // 运费金额
Expand All @@ -44,12 +44,19 @@ export interface OrderVO {
pointPrice?: number | null // 积分抵扣的金额
receiverAreaName?: string //收件人地区名字
items?: OrderItemRespVO[] // 订单项列表
//用户信息
// 用户信息
user?: {
id?: number | null
nickname?: string
avatar?: string
}
// 订单操作日志
orderLog: orderLog[]
}

export interface orderLog {
content?: string
createTime?: Date
}

export interface OrderItemRespVO {
Expand Down Expand Up @@ -94,6 +101,11 @@ export const getOrder = async (id: number | null) => {
return await request.get({ url: `/trade/order/get-detail?id=` + id })
}

// 查询交易订单物流详情
export const getExpressTrackList = async (id: number | null) => {
return await request.get({ url: `/trade/order/get-express-track-list?id=` + id })
}

export interface DeliveryVO {
id: number // 订单编号
logisticsId: number | null // 物流公司编号
Expand Down
26 changes: 24 additions & 2 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,39 @@ export const CouponTemplateValidityTypeEnum = {
}
}

/**
* 优惠劵模板的领取方式的枚举
*/
export const CouponTemplateTakeTypeEnum = {
USER: {
type: 1,
name: '直接领取'
},
ADMIN: {
type: 2,
name: '指定发放'
},
REGISTER: {
type: 3,
name: '新人券'
}
}

/**
* 营销的商品范围枚举
*/
export const PromotionProductScopeEnum = {
ALL: {
scope: 1,
name: '全部商品参与'
name: '通用劵'
},
SPU: {
scope: 2,
name: '指定商品参与'
name: '商品劵'
},
CATEGORY: {
scope: 3,
name: '品类劵'
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/views/mall/product/brand/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<el-table-column label="品牌名称" prop="name" sortable />
<el-table-column label="品牌图片" align="center" prop="picUrl">
<template #default="scope">
<img v-if="scope.row.picUrl" :src="scope.row.picUrl" alt="品牌图片" class="h-100px" />
<img v-if="scope.row.picUrl" :src="scope.row.picUrl" alt="品牌图片" class="h-30px" />
</template>
</el-table-column>
<el-table-column label="品牌排序" align="center" prop="sort" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<template>
<el-tree-select
v-model="selectCategoryId"
:data="categoryList"
:props="defaultProps"
:multiple="multiple"
:show-checkbox="multiple"
class="w-1/1"
node-key="id"
placeholder="请选择商品分类"
/>
</template>
<script lang="ts" setup>
import { defaultProps, handleTree } from '@/utils/tree'
import * as ProductCategoryApi from '@/api/mall/product/category'
import { oneOfType } from 'vue-types'
import { propTypes } from '@/utils/propTypes'
/** 商品分类选择组件 */
defineOptions({ name: 'ProductCategorySelect' })
const props = defineProps({
modelValue: oneOfType([propTypes.number.def(undefined), propTypes.array.def([])]).def(undefined), // 选中的ID
multiple: propTypes.bool.def(false) // 是否多选
})
/** 选中的分类 ID */
const selectCategoryId = computed({
get: () => {
return props.modelValue
},
set: (val: number | number[]) => {
emit('update:modelValue', val)
}
})
/** 分类选择 */
const emit = defineEmits(['update:modelValue'])
/** 初始化 **/
const categoryList = ref([]) // 分类树
onMounted(async () => {
// 获得分类树
const data = await ProductCategoryApi.getCategoryList({})
categoryList.value = handleTree(data, 'id', 'parentId')
})
</script>
2 changes: 1 addition & 1 deletion src/views/mall/product/category/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<el-table-column label="分类名称" prop="name" sortable />
<el-table-column label="移动端分类图" align="center" prop="picUrl">
<template #default="scope">
<img v-if="scope.row.picUrl" :src="scope.row.picUrl" alt="移动端分类图" class="h-100px" />
<img v-if="scope.row.picUrl" :src="scope.row.picUrl" alt="移动端分类图" class="h-30px" />
</template>
</el-table-column>
<el-table-column label="分类排序" align="center" prop="sort" />
Expand Down
2 changes: 1 addition & 1 deletion src/views/mall/product/comment/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
:formatter="dateFormatter"
width="170"
/>
<el-table-column label="状态" align="center" width="65px">
<el-table-column label="是否展示" align="center" width="80px">
<template #default="scope">
<el-switch
v-model="scope.row.visible"
Expand Down
2 changes: 1 addition & 1 deletion src/views/mall/product/property/value/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const handleDelete = async (id: number) => {
// 删除的二次确认
await message.delConfirm()
// 发起删除
await PropertyApi.deleteProperty(id)
await PropertyApi.deletePropertyValue(id)
message.success(t('common.delSuccess'))
// 刷新列表
await getList()
Expand Down
17 changes: 4 additions & 13 deletions src/views/mall/product/spu/components/SkuList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -328,24 +328,15 @@ const tableHeaders = ref<{ prop: string; label: string }[]>([]) // 多属性表
* 保存时,每个商品规格的表单要校验下。例如说,销售金额最低是 0.01 这种。
*/
const validateSku = () => {
const checks = ['price', 'marketPrice', 'costPrice']
let warningInfo = '请检查商品各行相关属性配置,'
let validate = true // 默认通过
for (const sku of formData.value!.skus!) {
// 作为活动组件的校验
if (props.isActivityComponent) {
for (const rule of props?.ruleConfig) {
const arg = getValue(sku, rule.name)
if (!rule.rule(arg)) {
validate = false // 只要有一个不通过则直接不通过
warningInfo += rule.message
break
}
}
} else {
if (checks.some((check) => sku[check] < 0.01)) {
for (const rule of props?.ruleConfig) {
const arg = getValue(sku, rule.name)
if (!rule.rule(arg)) {
validate = false // 只要有一个不通过则直接不通过
warningInfo = '商品相关价格不能低于 0.01 元!!'
warningInfo += rule.message
break
}
}
Expand Down
Loading

0 comments on commit 881ec67

Please sign in to comment.