Commit 132a5c67 by liimin

refactor(order): 重构订单相关页面和组件

- 移除了多处 console.log 语句
- 优化了订单详情和售后流程中的数量和价格计算逻辑
- 删除了未使用的 mock 数据文件
- 调整了订单列表项的样式和布局
1 parent 9baf52ca
......@@ -19,7 +19,6 @@ Page({
*/
onLoad: function (options) {
wx.p.router.getRouterParams(options).then((params) => {
console.log("🚀 ~ params:", params)
if (params) {
this.setData({
...params,
......
......@@ -7,7 +7,7 @@
<!-- 退款信息组件 -->
<refund-info-box
orderObj="{{orderObj}}"
refund-count="{{orderObj.applyQty||orderObj.sellQty}}"
refund-count="{{orderObj.___qty}}"
max-refund-count="{{maxRefundCount}}"
refund-price="{{orderObj.refundPoints}}"
show-refund-count="{{showRefundCount}}"
......
const { mockDeliveryInfoData } = require("./mock.js");
Component({
properties: {
showExpress: {
......@@ -11,6 +9,4 @@ Component({
value: {}
}
},
data: {
},
});
\ No newline at end of file
const mockDeliveryInfoData = {
orderInfo: {
deliveryCompany: '深圳市南山区留仙大道3370号南山智园崇文园区1号楼14层深圳广联赛讯有限公司',
deliveryNumber: 'SF1234567890',
deliveryStatus: 2
},
deliveryStatus: {
1: "待发货",
2: "已发货",
3: "已收货",
}
};
module.exports = {
mockDeliveryInfoData
};
\ No newline at end of file
......@@ -3,21 +3,21 @@ Component({
orderInfo: {
type: Object,
value: {},
observer: function (v) {
this.compute(v);
}
// observer: function (v) {
// this.compute(v);
// }
}
},
methods: {
compute(info) {
let { freightAmount = 0, sellQty,applyQty, redeemPoints } = info;
const total = +redeemPoints * +(sellQty||applyQty) + +freightAmount;
this.setData({
total,
freightAmount,
info
})
console.log(this.data.orderInfo)
}
// compute(info) {
// let { freightAmount = 0, sellQty,applyQty, redeemPoints } = info;
// const total = +redeemPoints * +(sellQty||applyQty) + +freightAmount;
// this.setData({
// total,
// freightAmount,
// info
// })
// console.log(this.data.orderInfo)
// }
}
})
\ No newline at end of file
......@@ -17,11 +17,11 @@
</block> -->
<view class="item">
<view class="label">实付款:</view>
<view class="value fontColor">{{total}}积分</view>
<view class="value fontColor">{{orderInfo.___totalPrice}}积分</view>
</view>
<view class="item">
<view class="label">运费:</view>
<view class="value">{{freightAmount}}</view>
<view class="value">{{orderInfo.freightAmount||0}}</view>
</view>
<view class="item">
<view class="label">订单编号:</view>
......
// 整合所有组件的mock数据,用于页面整体调试
const { mockDeliveryInfoData } = require('./components/DeliveryInfo/mock.js');
const { mockOrderInfoData } = require('./components/OrderInfo/mock.js');
const { mockOrderGoodsData } = require('./components/OrderGoods/mock.js');
const { mockOrderAmountData } = require('./components/OrderAmount/mock.js');
const mockOrderDetailData = {
orderInfo: {
...mockDeliveryInfoData.orderInfo,
...mockOrderInfoData.orderInfo,
...mockOrderGoodsData.orderInfo,
...mockOrderAmountData.orderInfo,
merchantName: '官方旗舰店',
orderSource: 1
},
orderObj: mockOrderInfoData.orderObj,
statusEnum: mockOrderInfoData.statusEnum,
deliveryStatus: mockDeliveryInfoData.deliveryStatus
};
module.exports = {
mockOrderDetailData
};
\ No newline at end of file
......@@ -7,9 +7,9 @@ Component({
item: {
type: Object,
value: {},
observer: function (v) {
this.compute(v);
},
// observer: function (v) {
// this.compute(v);
// },
},
},
......@@ -17,14 +17,14 @@ Component({
* 组件的方法列表
*/
methods: {
compute(item) {
let { applyQty, sellQty, redeemPoints, freightAmount = 0 } = item;
const total = sellQty || applyQty || 0;
let sum = redeemPoints * total + +freightAmount;
this.setData({
sum,
total,
});
},
// compute(item) {
// let { applyQty, sellQty, redeemPoints, freightAmount = 0 } = item;
// const total = sellQty || applyQty || 0;
// let sum = redeemPoints * total + +freightAmount;
// this.setData({
// sum,
// total,
// });
// },
},
});
<view class="bottom">
<view class="total">
共{{total}}件,实付款
<text class="price">{{sum||'--'}}积分</text>
共{{item.___qty}}件,实付款
<text class="price">{{item.___totalPrice||'--'}}积分</text>
</view>
<order-action-buttons order="{{item}}" has-user-info="{{hasUserInfo}}" />
</view>
\ No newline at end of file
......@@ -8,7 +8,7 @@
<view class="info-top">
<view class="name text-hide">{{item.goodsSkuName}}</view>
<view class="number">
<mp-icon icon="close" color="#656566" size="{{12}}"></mp-icon>{{item.sellQty||item.applyQty}}
<mp-icon icon="close" color="#656566" size="{{12}}"></mp-icon>{{item.___qty}}
</view>
</view>
<view class="info-bottom">
......
......@@ -140,7 +140,7 @@ Component({
// 售后
onAfterSale(e) {
let { subOrderCode, redeemPoints, goodsSource, sellQty,applyQty,goodsSkuCode } =
let { subOrderCode, redeemPoints, goodsSource,goodsSkuCode,___qty } =
this.data.order;
console.log(this.data.order)
wx.p.router.go(
......@@ -149,7 +149,7 @@ Component({
subOrderCode,
refundPoints: redeemPoints,
goodsSource,
applyQty: applyQty || sellQty,
applyQty: ___qty,
goodsSkuCode
}
);
......
/* packageMine/pages/order/index/index.wxss */
.sticky-box {
background-color: #F9F7F7;
}
.tab {
position: fixed;
top: 0;
left: 0;
width: 100%;
background-color: #F9F7F7;
z-index: 2;
transition: all 0.4s;
}
.navigation {
width: 100%;
height: 100%;
position: relative;
}
.navigation .back {
width: 64rpx;
height: 64rpx;
background: rgba(255, 255, 255, 0.5);
border-radius: var(--margin);
position: absolute;
left: 20rpx;
}
.navigation .back .icon {
width: 36rpx;
height: 36rpx;
}
.search-box {
position: absolute;
left: 80rpx;
width: 420rpx;
height: 72rpx;
background: #F7F8FA;
border-radius: 36rpx;
display: flex;
align-items: center;
box-sizing: border-box;
padding: 0 16rpx 0 var(--margin);
}
.search-box .icon {
width: 40rpx;
height: 100%;
margin-right: 10rpx;
}
.search-box .input {
width: calc(100% - 98rpx);
}
.search-box .clear-box {
width: 58rpx;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.search-box .clear-box .clear {
width: 32rpx;
height: 32rpx;
opacity: 0.7;
}
.placeholder-class {
color: #C8C9CC;
}
.layout {
padding: 24rpx var(--margin) 40rpx;
}
.layout .item {
position: relative;
padding-left: 24rpx;
margin-bottom: 20rpx;
background-color: #fff;
box-sizing: border-box;
border-radius: var(--borderRadius);
display: flex;
flex-direction: column;
}
.layout .item .top {
height: 82rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding-right: 24rpx;
position: relative;
}
.layout .item .top .name {
width: 410rpx;
height: 40rpx;
font-size: 28rpx;
color: #2D2D2E;
}
.layout .item .goods {
height: 208rpx;
padding: 24rpx 24rpx 24rpx 0;
box-sizing: border-box;
display: flex;
}
.addTo {
border-bottom: 2rpx solid #eff0f2;
}
.layout .item .goods .btn {
display: flex;
align-items: center;
justify-content: center;
width: 124rpx;
height: 46rpx;
border-radius: 25rpx;
border: 2rpx solid #b1b1b3;
font-size: 24rpx;
margin-left: 12rpx;
color: #656566;
position: absolute;
bottom: 0;
right: 0;
}
.layout .item .goods .confirm {
border-color: var(--btnColor);
color: var(--btnColor);
font-weight: 500;
}
.layout .item .icon {
width: 160rpx;
height: 160rpx;
margin-right: 20rpx;
border-radius: 8rpx;
overflow: hidden;
}
.background-X {
background-color: rgb(244, 244, 244);
}
.layout .item .info {
width: calc(100% - 180rpx);
height: 160rpx;
display: flex;
flex-direction: column;
position: relative;
}
.layout .item .info .info-top,
.layout .item .info .info-bottom {
display: flex;
align-items: center;
justify-content: space-between;
}
.layout .item .info .info-top .number {
color: #656566;
font-size: 24rpx;
}
.layout .item .info .info-bottom {
margin-top: 4rpx;
font-size: 24rpx;
color: #707071;
display: flex;
flex-direction: column;
align-items:flex-start;
gap: 8rpx;
}
.layout .item .info .info-bottom .price {
color: var(--themeColor);
font-size: 26rpx;
font-weight: 500;
}
.layout .item .info .info-bottom .specification {
color: #b1b1b3;
}
.layout .item .status {
font-size: 28rpx;
color: #282829;
font-weight: 400;
}
.layout .item .bottom {
margin-top: 36rpx;
height: 64rpx;
display: flex;
align-items: flex-start;
font-size: 24rpx;
color: #656566;
}
.layout .item .bottom .total {
position: relative;
bottom: 16rpx;
}
.layout .item .bottom .price {
color: var(--themeColor);
font-weight: 600;
margin-left: 10rpx;
}
.layout .item .btn-box {
position: absolute;
right: 24rpx;
bottom: 16rpx;
display: flex;
align-items: center;
justify-content: flex-end;
}
.layout .item .btn-box .btn {
display: flex;
align-items: center;
justify-content: center;
width: 144rpx;
height: 64rpx;
border-radius: 16rpx;
border: 1rpx solid #DCDFE6;
font-size: 24rpx;
margin-left: 12rpx;
color: #1B233D;
}
.layout .item .btn-box .pay {
background-color: var(--btnColor);
color: #fff;
border-color: var(--btnColor);
}
.layout .item .btn-box .empty{
color: var(--btnColor);
background-color: #fff;
}
.layout .item .btn-box .confirm {
border-color: var(--btnColor);
color: var(--btnColor);
font-weight: 500;
}
.userProfile {
background-color: #fff;
font-size: 24rpx;
margin: 0;
padding: 0;
font-weight: 500;
line-height: 46rpx;
}
.layout .coupon-item {
height: 202rpx;
background: #fefffe;
border-radius: 8rpx;
margin-bottom: 36rpx;
padding: 20rpx;
box-sizing: border-box;
position: relative;
}
.layout .coupon-item .orderPrices {
position: absolute;
color: var(--btnColor);
font-size: 48rpx;
right: 32rpx;
}
.layout .coupon-item .orderPrices text {
font-size: 36rpx;
}
.layout .coupon-item .icon {
width: 162rpx;
height: 162rpx;
margin-right: 20rpx;
}
.layout .coupon-item .info {
width: 360rpx;
height: 100%;
color: #b1b1b3;
font-size: 24rpx;
}
.layout .coupon-item .info .name {
font-size: 28rpx;
font-weight: 500;
color: #282829;
}
.layout .coupon-item .info .order-btn {
width: 138rpx;
height: 48rpx;
background: var(--btnColor);
border-radius: 24rpx;
margin-top: 40rpx;
color: #ffffff;
font-size: 24rpx;
}
.imageHeight {
height: 99rpx !important;
}
.imageStraight {
width: 92rpx;
height: 92rpx;
border-radius: 50%;
}
\ No newline at end of file
......@@ -164,29 +164,16 @@ Page({
let list = [];
wx.p.api.mineApi[requestMethod](obj).then((data) => {
wx.hideLoading();
data?.list?.map((e) => {
// let {
// orderGoods,
// createdDate,
// orderClassify
// } = e;
// let goodsNumber = 0;
// let expiredTime = 0;
// orderGoods?.map((i) => {
// i.retailPrice = Number(i.retailPrice).toFixed(2);
// if (i.activityPrice)
// i.activityPrice = Number(i.activityPrice).toFixed(2);
// goodsNumber += i.goodsNumber;
// expiredTime = new Date(i.warrantyDate).format("yyyy-MM-dd hh:mm:ss");
// if (orderClassify == 5) {
// e.payPrice = NP.times(i.retailPrice, i.goodsNumber);
// }
// });
data?.list?.forEach((e) => {
const { applyQty, sellQty, redeemPoints, freightAmount = 0 } = e;
const ___qty = sellQty || applyQty || 0;
const ___price = (redeemPoints || 0) * ___qty;
const ___totalPrice = (redeemPoints || 0) * ___qty + +freightAmount;
list.push({
...e,
// goodsNumber,
// time: new Date(createdDate).format("yyyy-MM-dd hh:mm:ss"),
// expiredTime,
___price,
___totalPrice,
___qty,
});
});
this.setData({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!