Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ec412f7a
authored
Aug 26, 2023
by
owen
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into owen_dev
parents
bce427f7
b8ca5800
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
187 additions
and
183 deletions
+187
-183
src/api/mall/product/spu.ts
+6
-5
src/api/mall/trade/order/index.ts
+7
-7
src/router/modules/remaining.ts
+14
-17
src/utils/dict.ts
+1
-1
src/utils/index.ts
+25
-1
src/views/mall/product/comment/CommentForm.vue
+1
-0
src/views/mall/product/comment/components/SkuTableSelect.vue
+1
-0
src/views/mall/product/comment/components/SpuTableSelect.vue
+1
-0
src/views/mall/product/comment/index.vue
+3
-1
src/views/mall/product/property/index.vue
+2
-1
src/views/mall/product/spu/addForm.vue
+22
-12
src/views/mall/product/spu/components/index.ts
+0
-1
src/views/mall/product/spu/index.vue
+9
-11
src/views/mall/promotion/seckill/activity/SeckillActivityForm.vue
+0
-12
src/views/mall/trade/order/components/OrderDeliveryForm.vue
+14
-11
src/views/mall/trade/order/components/OrderUpdateAddressForm.vue
+28
-12
src/views/mall/trade/order/components/OrderUpdatePriceForm.vue
+10
-8
src/views/mall/trade/order/components/OrderUpdateRemarkForm.vue
+9
-5
src/views/mall/trade/order/detail/index.vue
+34
-78
src/views/mall/trade/order/index.vue
+0
-0
No files found.
src/api/mall/product/spu.ts
View file @
ec412f7a
...
...
@@ -9,18 +9,19 @@ export interface Property {
export
interface
Sku
{
id
?:
number
// 商品 SKU 编号
name
?:
string
// 商品 SKU 名称
spuId
?:
number
// SPU 编号
properties
?:
Property
[]
// 属性数组
price
?:
number
// 商品价格
marketPrice
?:
number
// 市场价
costPrice
?:
number
// 成本价
price
?:
number
|
string
// 商品价格
marketPrice
?:
number
|
string
// 市场价
costPrice
?:
number
|
string
// 成本价
barCode
?:
string
// 商品条码
picUrl
?:
string
// 图片地址
stock
?:
number
// 库存
weight
?:
number
// 商品重量,单位:kg 千克
volume
?:
number
// 商品体积,单位:m^3 平米
subCommissionFirstPrice
?:
number
// 一级分销的佣金
subCommissionSecondPrice
?:
number
// 二级分销的佣金
subCommissionFirstPrice
?:
number
|
string
// 一级分销的佣金
subCommissionSecondPrice
?:
number
|
string
// 二级分销的佣金
salesCount
?:
number
// 商品销量
}
...
...
src/api/mall/trade/order/index.ts
View file @
ec412f7a
...
...
@@ -102,20 +102,20 @@ export interface DeliveryVO {
// 订单发货
export
const
delivery
=
async
(
data
:
DeliveryVO
)
=>
{
return
await
request
.
p
os
t
({
url
:
`/trade/order/delivery`
,
data
})
return
await
request
.
p
u
t
({
url
:
`/trade/order/delivery`
,
data
})
}
// 订单备注
export
const
remark
=
async
(
data
)
=>
{
return
await
request
.
p
ost
({
url
:
`/trade/order/
remark`
,
data
})
export
const
updateRemark
=
async
(
data
:
any
)
=>
{
return
await
request
.
p
ut
({
url
:
`/trade/order/update-
remark`
,
data
})
}
// 订单调价
export
const
adjustPrice
=
async
(
data
)
=>
{
return
await
request
.
p
ost
({
url
:
`/trade/order/adjust
-price`
,
data
})
export
const
updatePrice
=
async
(
data
:
any
)
=>
{
return
await
request
.
p
ut
({
url
:
`/trade/order/update
-price`
,
data
})
}
// 修改订单地址
export
const
adjustAddress
=
async
(
data
)
=>
{
return
await
request
.
p
ost
({
url
:
`/trade/order/adjust
-address`
,
data
})
export
const
updateAddress
=
async
(
data
:
any
)
=>
{
return
await
request
.
p
ut
({
url
:
`/trade/order/update
-address`
,
data
})
}
src/router/modules/remaining.ts
View file @
ec412f7a
...
...
@@ -347,22 +347,6 @@ const remainingRouter: AppRouteRecordRaw[] = [
]
},
{
path
:
'/property'
,
// TODO @puhui999:这里的 path 有问题,应该是 /product/property
component
:
Layout
,
name
:
'Property'
,
meta
:
{
hidden
:
true
},
children
:
[
{
path
:
'value/:propertyId(\\d+)'
,
component
:
()
=>
import
(
'@/views/mall/product/property/value/index.vue'
),
name
:
'ProductPropertyValue'
,
meta
:
{
title
:
'商品属性值'
,
icon
:
''
,
activeMenu
:
'/product/property'
}
}
]
},
{
path
:
'/product'
,
component
:
Layout
,
name
:
'Product'
,
...
...
@@ -408,6 +392,19 @@ const remainingRouter: AppRouteRecordRaw[] = [
title
:
'商品详情'
,
activeMenu
:
'/product/product-spu'
}
},
{
path
:
'property/value/:propertyId(\\d+)'
,
component
:
()
=>
import
(
'@/views/mall/product/property/value/index.vue'
),
name
:
'ProductPropertyValue'
,
meta
:
{
noCache
:
true
,
hidden
:
true
,
canTo
:
true
,
icon
:
'ep:view'
,
title
:
'商品属性值'
,
activeMenu
:
'/product/property'
}
}
]
},
...
...
@@ -421,7 +418,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
children
:
[
{
path
:
'detail/:orderId(\\d+)'
,
component
:
()
=>
import
(
'@/views/mall/trade/order/
components/OrderDetailForm
.vue'
),
component
:
()
=>
import
(
'@/views/mall/trade/order/
detail/index
.vue'
),
name
:
'TradeOrderDetailForm'
,
meta
:
{
title
:
'订单详情'
,
icon
:
''
,
activeMenu
:
'/trade/trade/order'
}
}
...
...
src/utils/dict.ts
View file @
ec412f7a
...
...
@@ -131,7 +131,7 @@ export enum DICT_TYPE {
BPM_OA_LEAVE_TYPE
=
'bpm_oa_leave_type'
,
// ========== PAY 模块 ==========
PAY_CHANNEL_CODE
=
'pay_channel_code'
,
// 支付渠道编码类型
PAY_CHANNEL_CODE
=
'pay_channel_code
_type
'
,
// 支付渠道编码类型
PAY_ORDER_STATUS
=
'pay_order_status'
,
// 商户支付订单状态
PAY_REFUND_STATUS
=
'pay_refund_status'
,
// 退款订单状态
PAY_NOTIFY_STATUS
=
'pay_notify_status'
,
// 商户支付回调状态
...
...
src/utils/index.ts
View file @
ec412f7a
...
...
@@ -174,7 +174,6 @@ export const copyValueToTarget = (target, source) => {
Object
.
assign
(
target
,
newObj
)
}
// TODO @puhui999:返回要带上 .00 哈.例如说 1.00
/**
* 将一个整数转换为分数保留两位小数
* @param num
...
...
@@ -186,6 +185,31 @@ export const formatToFraction = (num: number | string | undefined): number => {
}
/**
* 将一个数转换为 1.00 这样
* 数据呈现的时候使用
*
* @param num 整数
*/
export
const
floatToFixed2
=
(
num
:
number
|
string
|
undefined
):
string
=>
{
let
str
=
'0.00'
if
(
typeof
num
===
'undefined'
)
{
return
str
}
const
f
=
formatToFraction
(
num
)
const
decimalPart
=
f
.
toString
().
split
(
'.'
)[
1
]
const
len
=
decimalPart
?
decimalPart
.
length
:
0
switch
(
len
)
{
case
0
:
str
=
f
.
toString
()
+
'.00'
break
case
1
:
str
=
f
.
toString
()
+
'0'
break
}
return
str
}
/**
* 将一个分数转换为整数
* @param num
*/
...
...
src/views/mall/product/comment/CommentForm.vue
View file @
ec412f7a
...
...
@@ -36,6 +36,7 @@
<el-form-item
label=
"评论内容"
prop=
"content"
>
<el-input
type=
"textarea"
v-model=
"formData.content"
/>
</el-form-item>
<!-- TODO @疯狂:formData.scores 是通过后端计算的哈,不要前端传递 -->
<el-form-item
label=
"评分星级"
prop=
"scores"
>
<el-rate
v-model=
"formData.scores"
/>
</el-form-item>
...
...
src/views/mall/product/comment/components/SkuTableSelect.vue
View file @
ec412f7a
...
...
@@ -37,6 +37,7 @@ import { ElTable } from 'element-plus'
import
*
as
ProductSpuApi
from
'@/api/mall/product/spu'
import
{
propTypes
}
from
'@/utils/propTypes'
// TODO @疯狂:是不是挪到 spu 的 components 下哈
defineOptions
({
name
:
'SkuTableSelect'
})
const
props
=
defineProps
({
...
...
src/views/mall/product/comment/components/SpuTableSelect.vue
View file @
ec412f7a
...
...
@@ -86,6 +86,7 @@ import { defaultProps, handleTree } from '@/utils/tree'
import
*
as
ProductCategoryApi
from
'@/api/mall/product/category'
import
*
as
ProductSpuApi
from
'@/api/mall/product/spu'
// TODO @疯狂:是不是挪到 spu 的 components 下哈
defineOptions
({
name
:
'SpuTableSelect'
})
const
message
=
useMessage
()
// 消息弹窗
...
...
src/views/mall/product/comment/index.vue
View file @
ec412f7a
...
...
@@ -60,6 +60,7 @@
<ContentWrap>
<el-table
v-loading=
"loading"
:data=
"list"
:stripe=
"true"
:show-overflow-tooltip=
"false"
>
<el-table-column
label=
"评论编号"
align=
"center"
prop=
"id"
min-width=
"60"
/>
<!-- TODO @疯狂:后端貌似没读取? -->
<el-table-column
label=
"用户名称"
align=
"center"
prop=
"userNickname"
width=
"80"
/>
<el-table-column
label=
"商品信息"
align=
"center"
min-width=
"210"
>
<template
#
default=
"scope"
>
...
...
@@ -210,7 +211,7 @@ const getList = async () => {
loading
.
value
=
true
try
{
const
data
=
await
CommentApi
.
getCommentPage
(
queryParams
)
// visible 如果为 null,会导致刷新的时候触发
e-switch的change
事件
// visible 如果为 null,会导致刷新的时候触发
e-switch 的 change
事件
data
.
list
.
forEach
((
item
)
=>
{
if
(
!
item
.
visible
)
{
item
.
visible
=
false
...
...
@@ -241,6 +242,7 @@ const openForm = (type: string, id?: number) => {
formRef
.
value
.
open
(
type
,
id
)
}
// TODO @疯狂:要不回复,也搞一个组件出去?
/** 回复 **/
const
replyFormRef
=
ref
()
const
replyDialog
=
reactive
({
...
...
src/views/mall/product/property/index.vue
View file @
ec412f7a
...
...
@@ -101,6 +101,7 @@
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
*
as
PropertyApi
from
'@/api/mall/product/property'
import
PropertyForm
from
'./PropertyForm.vue'
const
{
push
}
=
useRouter
()
defineOptions
({
name
:
'ProductProperty'
})
...
...
@@ -164,7 +165,7 @@ const handleDelete = async (id: number) => {
/** 跳转商品属性列表 */
const
goValueList
=
(
id
:
number
)
=>
{
push
({
path
:
'/property/value/'
+
id
})
push
({
path
:
'/pro
duct/pro
perty/value/'
+
id
})
}
/** 初始化 **/
...
...
src/views/mall/product/spu/addForm.vue
View file @
ec412f7a
...
...
@@ -42,7 +42,9 @@ import { useTagsViewStore } from '@/store/modules/tagsView'
import
{
BasicInfoForm
,
DescriptionForm
,
OtherSettingsForm
}
from
'./components'
// 业务api
import
*
as
ProductSpuApi
from
'@/api/mall/product/spu'
import
{
convertToInteger
,
formatToFraction
}
from
'@/utils'
import
{
convertToInteger
,
floatToFixed2
,
formatToFraction
}
from
'@/utils'
// TODO @芋艿:后续稍微调整下;
defineOptions
({
name
:
'ProductSpuForm'
})
...
...
@@ -107,12 +109,20 @@ const getDetail = async () => {
try
{
const
res
=
(
await
ProductSpuApi
.
getSpu
(
id
))
as
ProductSpuApi
.
Spu
res
.
skus
?.
forEach
((
item
)
=>
{
// 回显价格分转元
item
.
price
=
formatToFraction
(
item
.
price
)
item
.
marketPrice
=
formatToFraction
(
item
.
marketPrice
)
item
.
costPrice
=
formatToFraction
(
item
.
costPrice
)
item
.
subCommissionFirstPrice
=
formatToFraction
(
item
.
subCommissionFirstPrice
)
item
.
subCommissionSecondPrice
=
formatToFraction
(
item
.
subCommissionSecondPrice
)
if
(
isDetail
.
value
===
true
)
{
item
.
price
=
floatToFixed2
(
item
.
price
)
item
.
marketPrice
=
floatToFixed2
(
item
.
marketPrice
)
item
.
costPrice
=
floatToFixed2
(
item
.
costPrice
)
item
.
subCommissionFirstPrice
=
floatToFixed2
(
item
.
subCommissionFirstPrice
)
item
.
subCommissionSecondPrice
=
floatToFixed2
(
item
.
subCommissionSecondPrice
)
}
else
{
// 回显价格分转元
item
.
price
=
formatToFraction
(
item
.
price
)
item
.
marketPrice
=
formatToFraction
(
item
.
marketPrice
)
item
.
costPrice
=
formatToFraction
(
item
.
costPrice
)
item
.
subCommissionFirstPrice
=
formatToFraction
(
item
.
subCommissionFirstPrice
)
item
.
subCommissionSecondPrice
=
formatToFraction
(
item
.
subCommissionSecondPrice
)
}
})
formData
.
value
=
res
}
finally
{
...
...
@@ -132,19 +142,19 @@ const submitForm = async () => {
await
unref
(
descriptionRef
)?.
validate
()
await
unref
(
otherSettingsRef
)?.
validate
()
// 深拷贝一份, 这样最终 server 端不满足,不需要恢复,
const
deepCopyFormData
=
cloneDeep
(
unref
(
formData
.
value
))
const
deepCopyFormData
=
cloneDeep
(
unref
(
formData
.
value
))
as
ProductSpuApi
.
Spu
// 兜底处理 sku 空数据
formData
.
value
.
skus
!
.
forEach
((
sku
)
=>
{
// 因为是空数据这里判断一下商品条码是否为空就行
if
(
sku
.
barCode
===
''
)
{
const
index
=
deepCopyFormData
.
skus
.
findIndex
(
const
index
=
deepCopyFormData
.
skus
!
.
findIndex
(
(
item
)
=>
JSON
.
stringify
(
item
.
properties
)
===
JSON
.
stringify
(
sku
.
properties
)
)
// 删除这条 sku
deepCopyFormData
.
skus
.
splice
(
index
,
1
)
deepCopyFormData
.
skus
!
.
splice
(
index
,
1
)
}
})
deepCopyFormData
.
skus
.
forEach
((
item
)
=>
{
deepCopyFormData
.
skus
!
.
forEach
((
item
)
=>
{
// 给sku name赋值
item
.
name
=
deepCopyFormData
.
name
// sku相关价格元转分
...
...
@@ -156,7 +166,7 @@ const submitForm = async () => {
})
// 处理轮播图列表
const
newSliderPicUrls
:
any
[]
=
[]
deepCopyFormData
.
sliderPicUrls
.
forEach
((
item
:
any
)
=>
{
deepCopyFormData
.
sliderPicUrls
!
.
forEach
((
item
:
any
)
=>
{
// 如果是前端选的图
typeof
item
===
'object'
?
newSliderPicUrls
.
push
(
item
.
url
)
:
newSliderPicUrls
.
push
(
item
)
})
...
...
src/views/mall/product/spu/components/index.ts
View file @
ec412f7a
...
...
@@ -7,7 +7,6 @@ import SkuList from './SkuList.vue'
import
{
Spu
}
from
'@/api/mall/product/spu'
// TODO @puhui999:Properties 改成 Property 更合适?Property 在 Spu 中已存在避免冲突 PropertyAndValues
interface
PropertyAndValues
{
id
:
number
name
:
string
...
...
src/views/mall/product/spu/index.vue
View file @
ec412f7a
...
...
@@ -80,7 +80,7 @@
<el-table
v-loading=
"loading"
:data=
"list"
>
<el-table-column
type=
"expand"
width=
"30"
>
<template
#
default=
"
{ row }">
<el-form
class=
"
demo
-table-expand"
label-position=
"left"
>
<el-form
class=
"
spu
-table-expand"
label-position=
"left"
>
<el-row>
<el-col
:span=
"24"
>
<el-row>
...
...
@@ -91,12 +91,12 @@
</el-col>
<el-col
:span=
"8"
>
<el-form-item
label=
"市场价:"
>
<span>
{{
f
ormatToFraction
(
row
.
marketPrice
)
}}
</span>
<span>
{{
f
loatToFixed2
(
row
.
marketPrice
)
}}
元
</span>
</el-form-item>
</el-col>
<el-col
:span=
"8"
>
<el-form-item
label=
"成本价:"
>
<span>
{{
f
ormatToFraction
(
row
.
costPrice
)
}}
</span>
<span>
{{
f
loatToFixed2
(
row
.
costPrice
)
}}
元
</span>
</el-form-item>
</el-col>
</el-row>
...
...
@@ -130,9 +130,7 @@
</el-table-column>
<el-table-column
:show-overflow-tooltip=
"true"
label=
"商品名称"
min-width=
"300"
prop=
"name"
/>
<el-table-column
align=
"center"
label=
"商品售价"
min-width=
"90"
prop=
"price"
>
<
template
#
default=
"{ row }"
>
{{
formatToFraction
(
row
.
price
)
}}
</
template
>
<
template
#
default=
"{ row }"
>
{{
floatToFixed2
(
row
.
price
)
}}
元
</
template
>
</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"
/>
...
...
@@ -229,7 +227,7 @@ import { createImageViewer } from '@/components/ImageViewer'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
{
checkSelectedNode
,
defaultProps
,
handleTree
,
treeToString
}
from
'@/utils/tree'
import
{
ProductSpuStatusEnum
}
from
'@/utils/constants'
import
{
f
ormatToFraction
}
from
'@/utils'
import
{
f
loatToFixed2
}
from
'@/utils'
import
download
from
'@/utils/download'
import
*
as
ProductSpuApi
from
'@/api/mall/product/spu'
import
*
as
ProductCategoryApi
from
'@/api/mall/product/category'
...
...
@@ -392,7 +390,7 @@ const resetQuery = () => {
const
openForm
=
(
id
?:
number
)
=>
{
// 修改
if
(
typeof
id
===
'number'
)
{
push
(
'/product/spu/edit/'
+
id
)
push
(
{
name
:
'ProductSpuEdit'
,
params
:
{
spuId
:
id
}
}
)
return
}
// 新增
...
...
@@ -402,8 +400,8 @@ const openForm = (id?: number) => {
/**
* 查看商品详情
*/
const
openDetail
=
(
id
?
:
number
)
=>
{
push
(
'/product/spu/detail/'
+
id
)
const
openDetail
=
(
id
:
number
)
=>
{
push
(
{
name
:
'ProductSpuDetail'
,
params
:
{
spuId
:
id
}
}
)
}
/** 导出按钮操作 */
...
...
@@ -458,7 +456,7 @@ onMounted(async () => {
})
</
script
>
<
style
lang=
"scss"
scoped
>
.
demo
-table-expand
{
.
spu
-table-expand
{
padding-left
:
42px
;
:deep(.el-form-item__label)
{
...
...
src/views/mall/promotion/seckill/activity/SeckillActivityForm.vue
View file @
ec412f7a
...
...
@@ -193,16 +193,4 @@ const resetForm = async () => {
await
nextTick
()
formRef
.
value
.
getElFormRef
().
resetFields
()
}
// TODO @puhui999:下面的 css 名字,是不是可以改下;demo-table-expand
</
script
>
<
style
lang=
"scss"
scoped
>
.demo-table-expand
{
padding-left
:
42px
;
:deep(.el-form-item__label)
{
width
:
82px
;
font-weight
:
bold
;
color
:
#99a9bf
;
}
}
</
style
>
src/views/mall/trade/order/components/
DeliveryOrder
Form.vue
→
src/views/mall/trade/order/components/
OrderDelivery
Form.vue
View file @
ec412f7a
...
...
@@ -2,12 +2,12 @@
<Dialog
v-model=
"dialogVisible"
title=
"订单发货"
width=
"25%"
>
<el-form
ref=
"formRef"
v-loading=
"formLoading"
:model=
"formData"
label-width=
"80px"
>
<el-form-item
label=
"发货方式"
>
<el-radio-group
v-model=
"
radio
"
>
<el-radio
border
label=
"
1
"
>
快递物流
</el-radio>
<el-radio
border
label=
"
2
"
>
无需发货
</el-radio>
<el-radio-group
v-model=
"
expressType
"
>
<el-radio
border
label=
"
express
"
>
快递物流
</el-radio>
<el-radio
border
label=
"
none
"
>
无需发货
</el-radio>
</el-radio-group>
</el-form-item>
<template
v-if=
"
radio === '1
'"
>
<template
v-if=
"
expressType === 'express
'"
>
<el-form-item
label=
"物流公司"
>
<el-select
v-model=
"formData.logisticsId"
placeholder=
"请选择"
style=
"width: 100%"
>
<el-option
...
...
@@ -32,16 +32,17 @@
<
script
lang=
"ts"
setup
>
import
*
as
DeliveryExpressApi
from
'@/api/mall/trade/delivery/express'
import
*
as
TradeOrderApi
from
'@/api/mall/trade/order'
import
{
copyValueToTarget
}
from
'@/utils'
// TODO @puhui999:
是不是名字叫 OrderDeliveryForm 保持统一
defineOptions
({
name
:
'
DeliveryOrder
Form'
})
// TODO @puhui999:
要不 Form 保持和别的模块一样,和 index.vue 放在一个目录下,不作为 components;components 更多要支持给多个模块使用哈。
defineOptions
({
name
:
'
OrderDelivery
Form'
})
const
{
t
}
=
useI18n
()
// 国际化
const
message
=
useMessage
()
// 消息弹窗
const
dialogVisible
=
ref
(
false
)
// 弹窗的是否展示
const
formLoading
=
ref
(
false
)
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const
radio
=
ref
(
'1'
)
// TODO @puhui999:尽量不用 radio 这种命名,无业务含义。这里的话,可以考虑用 expressType,如果值是 express,则是快递;none 则是无;未来做同城配送,就比较容易拓展啦
;
const
expressType
=
ref
(
'express'
)
// 如果值是 express,则是快递;none 则是无;未来做同城配送
;
const
formData
=
ref
<
TradeOrderApi
.
DeliveryVO
>
({
id
:
0
,
// 订单编号
logisticsId
:
null
,
// 物流公司编号
...
...
@@ -49,12 +50,14 @@ const formData = ref<TradeOrderApi.DeliveryVO>({
})
const
formRef
=
ref
()
// 表单 Ref
// TODO @puhui999:每次点击发货的时候,是不是可以把之前的信息带过来哈。
/** 打开弹窗 */
const
open
=
async
(
orderId
:
number
)
=>
{
const
open
=
async
(
row
:
TradeOrderApi
.
OrderVO
)
=>
{
resetForm
()
// 设置数据
formData
.
value
.
id
=
orderId
copyValueToTarget
(
formData
.
value
,
row
)
if
(
row
.
logisticsId
===
null
||
row
.
logisticsId
===
0
)
{
expressType
.
value
=
'none'
}
dialogVisible
.
value
=
true
}
defineExpose
({
open
})
// 提供 open 方法,用于打开弹窗
...
...
@@ -66,7 +69,7 @@ const submitForm = async () => {
formLoading
.
value
=
true
try
{
const
data
=
unref
(
formData
)
if
(
radio
.
value
===
'2
'
)
{
if
(
expressType
.
value
===
'none
'
)
{
// 无需发货的情况
data
.
logisticsId
=
0
data
.
logisticsNo
=
''
...
...
src/views/mall/trade/order/components/Order
Adjust
AddressForm.vue
→
src/views/mall/trade/order/components/Order
Update
AddressForm.vue
View file @
ec412f7a
<
template
>
<Dialog
v-model=
"dialogVisible"
title=
"修改订单收货地址"
width=
"35%"
>
<el-form
ref=
"formRef"
v-loading=
"formLoading"
:model=
"formData"
label-width=
"120px"
>
<el-form-item
label=
"收件人
名称
"
>
<el-input
v-model=
"formData.receiverName"
/>
<el-form-item
label=
"收件人"
>
<el-input
v-model=
"formData.receiverName"
placeholder=
"请输入收件人名称"
/>
</el-form-item>
<el-form-item
label=
"
收件人手机
"
>
<el-input
v-model=
"formData.receiverMobile"
/>
<el-form-item
label=
"
手机号
"
>
<el-input
v-model=
"formData.receiverMobile"
placeholder=
"请输入收件人手机号"
/>
</el-form-item>
<!-- TODO @puhui999:应该是个地区下拉框,可以看下 UserForm 所在地 -->
<el-form-item
label=
"收件人地区编号"
>
<el-input
v-model=
"formData.receiverAreaId"
/>
<el-form-item
label=
"所在地"
>
<el-tree-select
v-model=
"formData.receiverAreaId"
:data=
"areaList"
:props=
"defaultProps"
:render-after-expand=
"true"
/>
</el-form-item>
<el-form-item
label=
"收件人详细地址"
>
<el-input
v-model=
"formData.receiverDetailAddress"
/>
<el-form-item
label=
"详细地址"
>
<el-input
v-model=
"formData.receiverDetailAddress"
:rows=
"3"
placeholder=
"请输入收件人详细地址"
type=
"textarea"
/>
</el-form-item>
</el-form>
<template
#
footer
>
...
...
@@ -23,10 +32,11 @@
</template>
<
script
lang=
"ts"
setup
>
import
*
as
TradeOrderApi
from
'@/api/mall/trade/order'
import
{
getAreaTree
}
from
'@/api/system/area'
import
{
copyValueToTarget
}
from
'@/utils'
import
{
defaultProps
}
from
'@/utils/tree'
// TODO @puhui999:OrderAdjustAddressForm 改成 OrderUpdateAddressForm 更新哈,保持统一;
defineOptions
({
name
:
'OrderAdjustAddressForm'
})
defineOptions
({
name
:
'OrderUpdateAddressForm'
})
const
{
t
}
=
useI18n
()
// 国际化
const
message
=
useMessage
()
// 消息弹窗
...
...
@@ -40,6 +50,7 @@ const formData = ref({
receiverAreaId
:
null
,
//收件人地区编号
receiverDetailAddress
:
''
//收件人详细地址
})
const
areaList
=
ref
([])
// 地区列表
const
formRef
=
ref
()
// 表单 Ref
/** 打开弹窗 */
...
...
@@ -58,7 +69,7 @@ const submitForm = async () => {
formLoading
.
value
=
true
try
{
const
data
=
unref
(
formData
)
await
TradeOrderApi
.
adjust
Address
(
data
)
await
TradeOrderApi
.
update
Address
(
data
)
message
.
success
(
t
(
'common.updateSuccess'
))
dialogVisible
.
value
=
false
// 发送操作成功的事件
...
...
@@ -79,4 +90,9 @@ const resetForm = () => {
}
formRef
.
value
?.
resetFields
()
}
onMounted
(
async
()
=>
{
// 获得地区列表
areaList
.
value
=
await
getAreaTree
()
})
</
script
>
src/views/mall/trade/order/components/Order
Adjust
PriceForm.vue
→
src/views/mall/trade/order/components/Order
Update
PriceForm.vue
View file @
ec412f7a
...
...
@@ -20,11 +20,10 @@
</template>
<
script
lang=
"ts"
setup
>
import
*
as
TradeOrderApi
from
'@/api/mall/trade/order'
import
{
convertToInteger
,
formatToFraction
}
from
'@/utils'
import
{
convertToInteger
,
f
loatToFixed2
,
f
ormatToFraction
}
from
'@/utils'
import
{
cloneDeep
}
from
'lodash-es'
// TODO @puhui999:OrderAdjustPriceForm 改成 OrderUpdatePriceForm 更新哈,保持统一;
defineOptions
({
name
:
'OrderAdjustPriceForm'
})
defineOptions
({
name
:
'OrderUpdatePriceForm'
})
const
{
t
}
=
useI18n
()
// 国际化
const
message
=
useMessage
()
// 消息弹窗
...
...
@@ -40,7 +39,9 @@ const formData = ref({
watch
(
()
=>
formData
.
value
.
adjustPrice
,
(
data
:
number
)
=>
{
formData
.
value
.
newPayPrice
=
formData
.
value
.
payPrice
.
replace
(
'元'
,
''
)
*
1
+
data
+
'元'
const
num
=
formData
.
value
.
payPrice
!
.
replace
(
'元'
,
''
)
// @ts-ignore
formData
.
value
.
newPayPrice
=
(
num
*
1
+
data
).
toFixed
(
2
)
+
'元'
}
)
...
...
@@ -49,10 +50,11 @@ const formRef = ref() // 表单 Ref
/** 打开弹窗 */
const
open
=
async
(
row
:
TradeOrderApi
.
OrderVO
)
=>
{
resetForm
()
formData
.
value
.
id
=
row
.
id
formData
.
value
.
id
=
row
.
id
!
// 设置数据
formData
.
value
.
adjustPrice
=
formatToFraction
(
row
.
adjustPrice
)
formData
.
value
.
payPrice
=
formatToFraction
(
row
.
payPrice
)
+
'元'
formData
.
value
.
adjustPrice
=
formatToFraction
(
row
.
adjustPrice
!
)
formData
.
value
.
payPrice
=
floatToFixed2
(
row
.
payPrice
!
)
+
'元'
formData
.
value
.
newPayPrice
=
formData
.
value
.
payPrice
dialogVisible
.
value
=
true
}
defineExpose
({
open
})
// 提供 open 方法,用于打开弹窗
...
...
@@ -67,7 +69,7 @@ const submitForm = async () => {
data
.
adjustPrice
=
convertToInteger
(
data
.
adjustPrice
)
delete
data
.
payPrice
delete
data
.
newPayPrice
await
TradeOrderApi
.
adjust
Price
(
data
)
await
TradeOrderApi
.
update
Price
(
data
)
message
.
success
(
t
(
'common.updateSuccess'
))
dialogVisible
.
value
=
false
// 发送操作成功的事件
...
...
src/views/mall/trade/order/components/Order
Remarks
Form.vue
→
src/views/mall/trade/order/components/Order
UpdateRemark
Form.vue
View file @
ec412f7a
<
template
>
<Dialog
v-model=
"dialogVisible"
title=
"商家备注"
width=
"
2
5%"
>
<Dialog
v-model=
"dialogVisible"
title=
"商家备注"
width=
"
4
5%"
>
<el-form
ref=
"formRef"
v-loading=
"formLoading"
:model=
"formData"
label-width=
"80px"
>
<el-form-item
label=
"备注"
>
<el-input
v-model=
"formData.remark"
/>
<el-input
v-model=
"formData.remark"
:rows=
"3"
placeholder=
"请输入订单备注"
type=
"textarea"
/>
</el-form-item>
</el-form>
<template
#
footer
>
...
...
@@ -14,8 +19,7 @@
<
script
lang=
"ts"
setup
>
import
*
as
TradeOrderApi
from
'@/api/mall/trade/order'
// TODO @puhui999:OrderRemarksForm 改成 OrderUpdateRemarkForm 更新哈,保持统一;
defineOptions
({
name
:
'OrderRemarksForm'
})
defineOptions
({
name
:
'OrderUpdateRemarkForm'
})
const
{
t
}
=
useI18n
()
// 国际化
const
message
=
useMessage
()
// 消息弹窗
...
...
@@ -46,7 +50,7 @@ const submitForm = async () => {
try
{
const
data
=
unref
(
formData
)
console
.
log
(
data
)
await
TradeOrderApi
.
r
emark
(
data
)
await
TradeOrderApi
.
updateR
emark
(
data
)
message
.
success
(
t
(
'common.updateSuccess'
))
dialogVisible
.
value
=
false
// 发送操作成功的事件
...
...
src/views/mall/trade/order/
components/OrderDetailForm
.vue
→
src/views/mall/trade/order/
detail/index
.vue
View file @
ec412f7a
...
...
@@ -41,10 +41,10 @@
<dict-tag
:type=
"DICT_TYPE.TRADE_ORDER_STATUS"
:value=
"orderInfo.status"
/>
</el-descriptions-item>
<el-descriptions-item
label-class-name=
"no-colon"
>
<el-button
type=
"primary"
@
click=
"openForm('
adjust
Price')"
>
调整价格
</el-button>
<el-button
type=
"primary"
@
click=
"openForm('
update
Price')"
>
调整价格
</el-button>
<el-button
type=
"primary"
@
click=
"openForm('remark')"
>
备注
</el-button>
<el-button
type=
"primary"
@
click=
"openForm('delivery')"
>
发货
</el-button>
<el-button
type=
"primary"
@
click=
"openForm('
adjust
Address')"
>
修改地址
</el-button>
<el-button
type=
"primary"
@
click=
"openForm('
update
Address')"
>
修改地址
</el-button>
</el-descriptions-item>
<el-descriptions-item>
<template
#
label
><span
style=
"color: red"
>
提醒:
</span></
template
>
...
...
@@ -68,12 +68,12 @@
</el-tag>
</
template
>
</el-table-column>
<el-table-column
label=
"商品原价
(元)
"
prop=
"price"
width=
"150"
>
<
template
#
default=
"{ row }"
>
{{
f
ormatToFraction
(
row
.
price
)
}}
</
template
>
<el-table-column
label=
"商品原价"
prop=
"price"
width=
"150"
>
<
template
#
default=
"{ row }"
>
{{
f
loatToFixed2
(
row
.
price
)
}}
元
</
template
>
</el-table-column>
<el-table-column
label=
"数量"
prop=
"count"
width=
"100"
/>
<el-table-column
label=
"合计
(元)
"
prop=
"payPrice"
width=
"150"
>
<
template
#
default=
"{ row }"
>
{{
f
ormatToFraction
(
row
.
payPrice
)
}}
</
template
>
<el-table-column
label=
"合计"
prop=
"payPrice"
width=
"150"
>
<
template
#
default=
"{ row }"
>
{{
f
loatToFixed2
(
row
.
payPrice
)
}}
元
</
template
>
</el-table-column>
<el-table-column
label=
"售后状态"
prop=
"afterSaleStatus"
width=
"120"
>
<
template
#
default=
"{ row }"
>
...
...
@@ -91,32 +91,32 @@
</el-descriptions>
<el-descriptions
:column=
"6"
>
<el-descriptions-item
label=
"商品总额: "
>
{{ f
ormatToFraction
(orderInfo.totalPrice) }}元
{{ f
loatToFixed2
(orderInfo.totalPrice) }}元
</el-descriptions-item>
<el-descriptions-item
label=
"运费金额: "
>
{{ f
ormatToFraction
(orderInfo.deliveryPrice) }}元
{{ f
loatToFixed2
(orderInfo.deliveryPrice) }}元
</el-descriptions-item>
<el-descriptions-item
label=
"订单调价: "
>
{{ f
ormatToFraction(orderInfo.adjust
Price) }}元
{{ f
loatToFixed2(orderInfo.update
Price) }}元
</el-descriptions-item>
<el-descriptions-item>
<
template
#
label
><span
style=
"color: red"
>
商品优惠:
</span></
template
>
{{ f
ormatToFraction
(orderInfo.couponPrice) }}元
{{ f
loatToFixed2
(orderInfo.couponPrice) }}元
</el-descriptions-item>
<el-descriptions-item>
<
template
#
label
><span
style=
"color: red"
>
订单优惠:
</span></
template
>
{{ f
ormatToFraction
(orderInfo.discountPrice) }}元
{{ f
loatToFixed2
(orderInfo.discountPrice) }}元
</el-descriptions-item>
<el-descriptions-item>
<
template
#
label
><span
style=
"color: red"
>
积分抵扣:
</span></
template
>
{{ f
ormatToFraction
(orderInfo.pointPrice) }}元
{{ f
loatToFixed2
(orderInfo.pointPrice) }}元
</el-descriptions-item>
<el-descriptions-item
v-for=
"item in 5"
:key=
"item"
label-class-name=
"no-colon"
/>
<!-- 占位 -->
<el-descriptions-item
label=
"应付金额: "
>
{{ f
ormatToFraction
(orderInfo.payPrice) }}元
{{ f
loatToFixed2
(orderInfo.payPrice) }}元
</el-descriptions-item>
</el-descriptions>
...
...
@@ -199,71 +199,27 @@
</ContentWrap>
<!-- 各种操作的弹窗 -->
<
DeliveryOrder
Form
ref=
"deliveryFormRef"
@
success=
"getDetail"
/>
<Order
RemarksForm
ref=
"remarksFormRef
"
@
success=
"getDetail"
/>
<Order
AdjustAddressForm
ref=
"adjust
AddressFormRef"
@
success=
"getDetail"
/>
<Order
AdjustPriceForm
ref=
"adjust
PriceFormRef"
@
success=
"getDetail"
/>
<
OrderDelivery
Form
ref=
"deliveryFormRef"
@
success=
"getDetail"
/>
<Order
UpdateRemarkForm
ref=
"updateRemarkForm
"
@
success=
"getDetail"
/>
<Order
UpdateAddressForm
ref=
"update
AddressFormRef"
@
success=
"getDetail"
/>
<Order
UpdatePriceForm
ref=
"update
PriceFormRef"
@
success=
"getDetail"
/>
</template>
<
script
lang=
"ts"
setup
>
import
*
as
TradeOrderApi
from
'@/api/mall/trade/order'
import
{
f
ormatToFraction
}
from
'@/utils'
import
{
f
loatToFixed2
}
from
'@/utils'
import
{
DICT_TYPE
}
from
'@/utils/dict'
import
Order
RemarksForm
from
'@/views/mall/trade/order/components/OrderRemarks
Form.vue'
import
DeliveryOrderForm
from
'@/views/mall/trade/order/components/DeliveryOrder
Form.vue'
import
Order
AdjustAddressForm
from
'@/views/mall/trade/order/components/OrderAdjust
AddressForm.vue'
import
Order
AdjustPriceForm
from
'@/views/mall/trade/order/components/OrderAdjust
PriceForm.vue'
import
Order
UpdateRemarkForm
from
'@/views/mall/trade/order/components/OrderUpdateRemark
Form.vue'
import
OrderDeliveryForm
from
'@/views/mall/trade/order/components/OrderDelivery
Form.vue'
import
Order
UpdateAddressForm
from
'@/views/mall/trade/order/components/OrderUpdate
AddressForm.vue'
import
Order
UpdatePriceForm
from
'@/views/mall/trade/order/components/OrderUpdate
PriceForm.vue'
// TODO @puhui999:TradeOrderDetailForm 可以挪到 order/detail/index.vue 中,它是一个 vue 界面哈。
defineOptions
({
name
:
'TradeOrderDetailForm'
})
const
message
=
useMessage
()
// 消息弹窗
const
{
params
}
=
useRoute
()
// 查询参数
// TODO @puhui999:orderInfo 应该不用把属性弄出来也;
const
orderInfo
=
ref
<
TradeOrderApi
.
OrderVO
>
({
no
:
''
,
createTime
:
null
,
type
:
null
,
terminal
:
null
,
userId
:
null
,
userIp
:
''
,
userRemark
:
''
,
status
:
null
,
productCount
:
null
,
finishTime
:
null
,
cancelTime
:
null
,
cancelType
:
null
,
remark
:
''
,
payOrderId
:
null
,
payed
:
false
,
payTime
:
null
,
payChannelCode
:
''
,
originalPrice
:
null
,
orderPrice
:
null
,
discountPrice
:
null
,
deliveryPrice
:
null
,
adjustPrice
:
null
,
payPrice
:
null
,
deliveryTemplateId
:
null
,
logisticsId
:
null
,
logisticsNo
:
''
,
deliveryStatus
:
null
,
deliveryTime
:
null
,
receiveTime
:
null
,
receiverName
:
''
,
receiverMobile
:
''
,
receiverAreaId
:
null
,
receiverPostCode
:
null
,
receiverDetailAddress
:
''
,
afterSaleStatus
:
null
,
refundPrice
:
null
,
couponPrice
:
null
,
pointPrice
:
null
,
receiverAreaName
:
''
,
items
:
[],
user
:
{}
})
const
orderInfo
=
ref
<
TradeOrderApi
.
OrderVO
>
({})
// TODO @puhui999:这个改成直接读属性,不用按照这种写法;
// TODO @puhui999:这个改成直接读属性,不用按照这种写法;
后续再改
const
detailGroups
=
ref
([
{
title
:
'物流信息'
,
...
...
@@ -282,7 +238,7 @@ const detailGroups = ref([
}
])
// TODO @puhui999:从后台读数据哈。
// TODO @puhui999:从后台读数据哈。
后续再改
const
detailInfo
=
ref
({
// 物流信息
expressInfo
:
{
...
...
@@ -330,22 +286,22 @@ const detailInfo = ref({
})
const
deliveryFormRef
=
ref
()
// 发货表单 Ref
const
remarksFormRef
=
ref
()
// 订单备注表单 Ref
const
adjust
AddressFormRef
=
ref
()
// 收货地址表单 Ref
const
adjust
PriceFormRef
=
ref
()
// 订单调价表单 Ref
const
updateRemarkForm
=
ref
()
// 订单备注表单 Ref
const
update
AddressFormRef
=
ref
()
// 收货地址表单 Ref
const
update
PriceFormRef
=
ref
()
// 订单调价表单 Ref
const
openForm
=
(
type
:
string
)
=>
{
switch
(
type
)
{
case
'remark'
:
remarksFormRef
.
value
?.
open
(
orderInfo
.
value
)
updateRemarkForm
.
value
?.
open
(
orderInfo
.
value
)
break
case
'delivery'
:
deliveryFormRef
.
value
?.
open
(
orderInfo
.
value
.
id
)
deliveryFormRef
.
value
?.
open
(
orderInfo
.
value
)
break
case
'
adjust
Address'
:
adjust
AddressFormRef
.
value
?.
open
(
orderInfo
.
value
)
case
'
update
Address'
:
update
AddressFormRef
.
value
?.
open
(
orderInfo
.
value
)
break
case
'
adjust
Price'
:
adjust
PriceFormRef
.
value
?.
open
(
orderInfo
.
value
)
case
'
update
Price'
:
update
PriceFormRef
.
value
?.
open
(
orderInfo
.
value
)
break
}
}
...
...
src/views/mall/trade/order/index.vue
View file @
ec412f7a
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment