Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
mini-program
/
points-mall
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit cb134b98
authored
Aug 15, 2025
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
refactor(order): 使用 mock 数据调试订单详情页面
- 添加了 mock 订单数据用于调试 - 实现了订单信息的格式化处理,包括价格数据和优惠券信息
1 parent
2a2e7b22
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
123 additions
and
6 deletions
packageMine/pages/order/components/BlockBox/BlockBox.js
packageMine/pages/order/components/BlockBox/BlockBox.json
packageMine/pages/order/components/BlockBox/BlockBox.wxml
packageMine/pages/order/components/BlockBox/BlockBox.wxss
packageMine/pages/order/detail/detail.js
packageMine/pages/order/detail/detail.wxml
packageMine/pages/order/components/BlockBox/BlockBox.js
0 → 100644
View file @
cb134b9
// packageMine/pages/order/index/components/bottom/bottom.js
Component
({
})
\ No newline at end of file
\ No newline at end of file
packageMine/pages/order/components/BlockBox/BlockBox.json
0 → 100644
View file @
cb134b9
{
"component"
:
true
,
"style"
:
"v2"
}
\ No newline at end of file
\ No newline at end of file
packageMine/pages/order/components/BlockBox/BlockBox.wxml
0 → 100644
View file @
cb134b9
<view class="block">
<slot></slot>
</view>
\ No newline at end of file
\ No newline at end of file
packageMine/pages/order/components/BlockBox/BlockBox.wxss
0 → 100644
View file @
cb134b9
.block{
border-radius: 16rpx;
background-color: #fff;
padding: var(--margin);
}
\ No newline at end of file
\ No newline at end of file
packageMine/pages/order/detail/detail.js
View file @
cb134b9
...
@@ -33,16 +33,124 @@ Page({
...
@@ -33,16 +33,124 @@ Page({
2
:
"已发货"
,
2
:
"已发货"
,
3
:
"已收货"
,
3
:
"已收货"
,
},
},
// Mock数据用于调试
mockOrderInfo
:
{
orderStatus
:
5
,
// 已收货
orderSource
:
1
,
deliveryCompany
:
"顺丰快递"
,
deliveryNumber
:
"SF1234567890"
,
deliveryStatus
:
3
,
merchantName
:
"海马刀官方旗舰店"
,
activityBigImg
:
"https://picsum.photos/200/200"
,
activityName
:
"洗车服务券"
,
orderGoods
:
[
{
id
:
"106"
,
goodsImage
:
"https://picsum.photos/200/200"
,
goodsName
:
"洗车服务券"
,
specificationData
:
"1次洗车服务"
,
retailPrice
:
"299.00"
,
activityPrice
:
null
,
goodsNumber
:
1
,
},
{
id
:
"107"
,
goodsImage
:
"https://picsum.photos/200/200?random=1"
,
goodsName
:
"打蜡服务券"
,
specificationData
:
"1次打蜡服务"
,
retailPrice
:
"199.00"
,
activityPrice
:
"159.00"
,
goodsNumber
:
2
,
},
],
time
:
"2023.05.20 12:00:00"
,
orderCode
:
"2023052012000001"
,
shipAddress
:
"广东省深圳市南山区科技园南区R2-B三楼301室"
,
outTradeNo
:
"PAY2023052012000001"
,
orderPrice
:
"798.00"
,
expressFee
:
"0.00"
,
payPrice
:
"699.00"
,
subOrderCoupon
:
{
denomination
:
true
,
discountAmount
:
10000
,
// 100元
},
relatedUserCoupon
:
[
{
discountType
:
2
,
useChannel
:
1
,
id
:
"coupon001"
,
receiveStartTime
:
"2023.05.01"
,
effectiveType
:
1
,
receiveEndTime
:
"2023.06.01 23:59:59"
,
},
],
deliveryType
:
1
,
orderVerification
:
{
verificationCode
:
"VERIFY2023052012000001"
,
},
},
},
},
/**
/**
* 生命周期函数--监听页面加载
* 生命周期函数--监听页面加载
*/
*/
onLoad
:
function
(
options
)
{
onLoad
:
function
(
options
)
{
// 使用mock数据进行调试
const
useMockData
=
true
;
// 设置为true使用mock数据,设置为false使用真实接口
if
(
useMockData
)
{
// 使用mock数据
let
{
orderObj
,
mockOrderInfo
}
=
this
.
data
;
// 格式化价格数据
mockOrderInfo
.
orderGoods
.
map
((
e
)
=>
{
e
.
retailPrice
=
Number
(
e
.
retailPrice
).
toFixed
(
2
);
if
(
e
.
activityPrice
)
e
.
activityPrice
=
Number
(
e
.
activityPrice
).
toFixed
(
2
);
});
mockOrderInfo
.
orderPrice
=
Number
(
mockOrderInfo
.
orderPrice
).
toFixed
(
2
);
mockOrderInfo
.
expressFee
=
Number
(
mockOrderInfo
.
expressFee
).
toFixed
(
2
);
mockOrderInfo
.
payPrice
=
Number
(
mockOrderInfo
.
payPrice
).
toFixed
(
2
);
// 根据订单来源调整订单信息
if
(
mockOrderInfo
.
orderSource
==
4
)
{
orderObj
[
2
]
=
{
label
:
"商户订单号"
,
key
:
"outTradeNo"
,
};
}
this
.
setData
({
orderInfo
:
mockOrderInfo
,
orderObj
,
});
// 设置二维码
if
(
mockOrderInfo
.
deliveryType
==
1
&&
mockOrderInfo
.
orderVerification
)
this
.
setQr
(
mockOrderInfo
.
orderVerification
.
verificationCode
);
// 处理优惠券数据
if
(
mockOrderInfo
.
relatedUserCoupon
)
{
let
list
=
mockOrderInfo
.
relatedUserCoupon
.
map
((
item
)
=>
{
item
.
receiveStartTime
=
item
.
receiveStartTime
;
if
(
item
.
effectiveType
==
1
)
{
item
.
receiveEndTime
=
item
.
receiveEndTime
;
}
else
{
item
.
receiveEndTime
=
item
.
receiveEndTime
.
split
(
' '
)[
0
];
}
return
item
;
});
this
.
setData
({
couponsList
:
list
,
});
}
}
else
{
// 使用真实接口数据
wx
.
p
.
router
.
getRouterParams
(
options
).
then
(({
orderCode
}
=
{})
=>
{
wx
.
p
.
router
.
getRouterParams
(
options
).
then
(({
orderCode
}
=
{})
=>
{
if
(
orderCode
)
{
if
(
orderCode
)
{
this
.
getOrderDetail
(
orderCode
);
this
.
getOrderDetail
(
orderCode
);
}
}
});
});
}
},
},
getOrderDetail
(
orderCode
)
{
getOrderDetail
(
orderCode
)
{
let
{
orderObj
}
=
this
.
data
;
let
{
orderObj
}
=
this
.
data
;
...
...
packageMine/pages/order/detail/detail.wxml
View file @
cb134b9
...
@@ -82,13 +82,7 @@
...
@@ -82,13 +82,7 @@
运费:
运费:
<view class="price"><text class="unit">¥</text>{{orderInfo.expressFee}}</view>
<view class="price"><text class="unit">¥</text>{{orderInfo.expressFee}}</view>
</view>
</view>
<view class="price-item line discounts" wx:if="{{orderInfo.subOrderCoupon.denomination}}">
优惠:
<view class="selected">已选一张</view>
<view class="price"><text class="unit">¥</text>{{(orderInfo.subOrderCoupon.discountAmount)/100}}</view>
</view>
<view class="price-item">
<view class="price-item">
订单金额:
<view class="price sum"><text class="unit">¥</text>{{orderInfo.payPrice}}</view>
<view class="price sum"><text class="unit">¥</text>{{orderInfo.payPrice}}</view>
</view>
</view>
</view>
</view>
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment