Commit 40247ef6 by liimin

refactor(order): 重构售后详情页面

- 新增 RefundStatus 常量,用于定义退款状态
- 优化页面布局和样式,增加更多视觉元素
- 添加快递公司选择功能
- 修复部分组件样式问题
- 优化数据处理逻辑,提高页面响应速度
1 parent 5a9eaf47
...@@ -87,3 +87,18 @@ export const RefundReason = [ ...@@ -87,3 +87,18 @@ export const RefundReason = [
value: 12, value: 12,
}, },
]; ];
export const RefundStatus= [
{ status: 1, title: "待处理", tips: "等待平台处理",image:'mine/order/wait.png' },
{ status: 2, title: "待发货", tips: "等待平台处理" ,image:'mine/order/wait.png' },
{ status: 3, title: "待确认收到退货", tips: "等待平台处理",image:'mine/order/wait.png' },
{ status: 4, title: "退款中", tips: "等待平台处理",image:'mine/order/wait.png' },
{ status: 5, title: "已退款", tips: "钱款已退回至原账户" ,image:'mine/order/success.png' },
{ status: 6, title: "退款失败", tips: "您可以尝试再次提交退款申请" ,image:'mine/order/error.png' },
{
status: 7,
title: "审核不通过",
tips: "您可以尝试再次提交退款申请",
image:'mine/order/error.png'
},
];
{
"navigationBarTitleText": "Flex自适应宽度示例"
}
\ No newline at end of file \ No newline at end of file
<!-- flex子元素自适应宽度示例 -->
<view class="container">
<view class="section">
<view class="title">使用 flex: 1 平均分配宽度</view>
<view class="flex-container">
<view class="flex-item item1">项目1</view>
<view class="flex-item item2">项目2</view>
<view class="flex-item item3">项目3</view>
</view>
</view>
<view class="section">
<view class="title">使用不同 flex 值分配宽度</view>
<view class="flex-container">
<view class="flex-item item1" style="flex: 2">项目1 (flex: 2)</view>
<view class="flex-item item2" style="flex: 1">项目2 (flex: 1)</view>
<view class="flex-item item3" style="flex: 1">项目3 (flex: 1)</view>
</view>
</view>
<view class="section">
<view class="title">根据内容自适应宽度</view>
<view class="flex-container">
<view class="flex-item item1 auto-width">短</view>
<view class="flex-item item2 auto-width">中等长度内容</view>
<view class="flex-item item3 auto-width">这是一个很长的内容</view>
</view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* flex子元素自适应宽度示例样式 */
.container {
padding: 20rpx;
}
.section {
margin-bottom: 40rpx;
}
.title {
font-size: 32rpx;
font-weight: bold;
margin-bottom: 20rpx;
color: #333;
}
.flex-container {
display: flex;
width: 100%;
gap: 20rpx;
margin-bottom: 20rpx;
}
.flex-item {
height: 80rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 10rpx;
color: white;
font-size: 28rpx;
}
.item1 {
background-color: #ff6b6b;
}
.item2 {
background-color: #4ecdc4;
}
.item3 {
background-color: #45b7d1;
}
/* 平均分配宽度 */
.flex-item {
flex: 1;
}
/* 根据内容自适应宽度 */
.auto-width {
flex: 0 1 auto;
/* flex-grow: 0 (不扩展)
flex-shrink: 1 (可以收缩)
flex-basis: auto (根据内容确定基础宽度) */
}
\ No newline at end of file \ No newline at end of file
// packageMine/pages/order/afterSaleDetail/afterSaleDetail.js import { RefundStatus } from "~/constants/mine.js";
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
refundStatus: {
1: '待处理',
2: '待发货',
3: '待确认收到退货',
4: '退款中',
5: '已退款',
6: '退款失败',
7: '审核不通过'
},
// 退款状态1:待处理,2待发货,3待确认收到退货,4:退款中,5:已退款,6:退款失败,7:审核不通过 // 退款状态1:待处理,2待发货,3待确认收到退货,4:退款中,5:已退款,6:退款失败,7:审核不通过
afterSaleObj: [ afterSaleObj: Object.freeze([
{ {
title: '售后类型', title: "退款金额",
key: 'refundType', key: "refundPrice",
enum: {
1: '我要退款退货',
2: '我要退款(无需退货)'
}
}, },
{ {
title: '售后商品', title: "退款数量",
isArray: true, key: "goodsNumber",
key: 'goodsNames'
}, },
{ {
title: '申请金额', title: "售后编号",
key: 'refundPrice' key: "orderCode",
}, },
{ {
title: '申请时间', title: "申请时间",
key: 'time' key: "time",
}, },
{ {
title: '申请描述', title: "申请描述",
key: 'remark' key: "remark",
}, },
]),
address: [
{ {
title: '订单编号', title: "地址",
key: 'orderCode' key: "address",
} },
] {
title: "收货人",
key: "name",
},
{
title: "联系电话",
key: "phone",
},
],
addressObject: {
name: "张三",
phone: "12345678901",
address: "广东省深圳市南山区",
},
expressList: [
{
value: 0,
text: "圆通",
},
{
value: 1,
text: "顺丰",
},
{
value: 2,
text: "中通",
},
{
value: 3,
text: "韵达",
},
{
value: 4,
text: "京东",
type: "warn",
},
{
value: 5,
text: "百世",
},
{
value: 6,
text: "德邦",
},
{
value: 7,
text: "其他",
},
],
// Mock数据用于页面展示
orderInfo: {
refundStatus: 1, // 1:待处理
orderClassify: 1,
orderSource: 5,
orderStatus: 9,
activityBigImg: "https://picsum.photos/200/200",
activityName: "洗车服务券",
orderGoods: [
{
id: "106",
goodsImage: "https://picsum.photos/200/200",
goodsName: "洗车服务券",
specificationData: "1次洗车服务",
retailPrice: "299",
activityPrice: null,
goodsNumber: 1,
warrantyDate: "2024-09-01 11:30:00",
},
],
refundType: 1, // 1:我要退款退货
goodsName: ["商品名称1", "商品名称2"],
refundPrice: "1000积分",
time: "2023-05-20 12:00:00",
remark: "商品质量有问题,申请退款退货",
orderCode: "2023052012000001",
deliveryCompany: "顺丰快递",
goodsNumber: 1,
deliveryNumber: "SF1234567890",
imgUrls: [
"https://picsum.photos/200/200",
"https://picsum.photos/200/200",
"https://picsum.photos/200/200",
],
createdDate: "2023-05-20T12:00:00",
},
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.getOrderRefundDetail(options.orderCode) // this.getOrderRefundDetail(options.orderCode)
this.setData({
refund: RefundStatus.find(
(item) => item.status == this.data.orderInfo.refundStatus
),
});
},
showPopup() {
this.setData({
showPopup: true,
});
},
selectExpress(e) {
this.setData({
showPopup: false,
});
const expressList = this.data.expressList.map((item) => {
if (item.value == e.detail.value) {
item.type = "warn";
this.setData({
express: item,
});
} else {
item.type = "";
}
return item;
});
this.setData({
expressList,
});
}, },
getOrderRefundDetail(orderCode) { getOrderRefundDetail(orderCode) {
wx.p.wxApi.showLoading('加载中...') wx.p.wxApi.showLoading("加载中...");
wx.p.api.shopmallApi.getOrderRefundDetail(orderCode).then(data => { wx.p.api.shopmallApi.getOrderRefundDetail(orderCode).then((data) => {
wx.hideLoading() wx.hideLoading();
console.log(data)
if (data.refundStatus == 2 && data.refundType == 1) { if (data.refundStatus == 2 && data.refundType == 1) {
wx.p.router.redirectTo('/packageMine/pages/order/afterSale_step_three/afterSale_step_three', data) wx.p.router.redirectTo(
return "/packageMine/pages/order/afterSale_step_three/afterSale_step_three",
data
);
return;
} }
data.time = new Date(data.createdDate).format('yyyy-MM-dd hh:mm:ss') data.time = new Date(data.createdDate).format("yyyy-MM-dd hh:mm:ss");
this.setData({ this.setData({
orderInfo: data orderInfo: data,
}) });
}) });
}, },
confirm() { confirm() {
let { orderInfo } = this.data let { orderInfo } = this.data;
console.log(orderInfo) console.log(orderInfo);
wx.p.router.go('/packageMine/pages/order/afterSale_step_two/afterSale_step_two', orderInfo) wx.p.router.go(
"/packageMine/pages/order/afterSale_step_two/afterSale_step_two",
orderInfo
);
}, },
previewImage(e) { previewImage(e) {
let params = e.currentTarget.dataset let params = e.currentTarget.dataset;
wx.p.wxApi.previewImage(params) wx.p.wxApi.previewImage(params);
}, },
/** });
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {}
})
{ {
"navigationBarTitleText": "售后详情" "navigationBarTitleText": "售后详情",
"usingComponents": {
"content": "../index/components/Content/Content",
"mp-icon": "weui-miniprogram/icon/icon",
"mp-actionSheet": "weui-miniprogram/actionsheet/actionsheet"
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -3,47 +3,127 @@ ...@@ -3,47 +3,127 @@
} }
.status-box { .status-box {
text-align: center; display: flex;
justify-content: flex-start;
align-items: center;
gap: 24rpx;
.icon {
width: 80rpx;
height: 80rpx;
}
.box-info {
.title {
font-size: 40rpx;
font-weight: 500;
color: #282829;
}
.tips {
font-size: 28rpx;
font-weight: 400;
color: #656566;
}
}
margin-bottom: 32rpx;
} }
.status-box .icon { .box {
margin: 80rpx auto 84rpx; border-radius: 16rpx;
width: 140rpx; background-color: #fff;
height: 140rpx;
} }
.mb {
.status-box .title { margin-bottom: 24rpx;
font-size: 40rpx;
font-weight: 500;
} }
.status-box .tips { // .section {
margin: 20rpx 0 59rpx; // font-size: 32rpx;
color: #656566; // font-weight: 400;
// color: #323233;
// height: 104rpx;
// line-height: 104rpx;
// text-align: center;
// &.active {
// color: var(--btnColor);
// background: #fff9f5;
// }
// }
.weui-actionsheet__cell {
&::before {
display: none;
}
} }
.weui-actionsheet__cell_warn {
.box { color: var(--btnColor);
background: #fff9f5;
border-radius: 8rpx;
background-color: #fff;
} }
.text-box { .text-box {
padding: 32rpx 24rpx; padding: 32rpx 24rpx;
border-bottom: 2rpx solid #EFF0F2; border-bottom: 2rpx solid #eff0f2;
.title {
font-weight: 600;
font-size: 32rpx;
color: #282829;
}
.form {
margin-top: 24rpx;
background: #f7f8fa;
border-radius: 12rpx;
padding: 0 32rpx;
.item {
height: 104rpx;
line-height: 104rpx;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 0;
.label {
margin-right: 12rpx;
font-size: 28rpx;
color: #282829;
}
&:first-child {
border-bottom: 2rpx solid #eff0f2;
}
}
}
.header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 16rpx;
.copy {
background: #e8e8ea;
border-radius: 18rpx;
font-weight: 400;
font-size: 22rpx;
color: #707071;
padding: 4rpx 18rpx;
}
}
} }
.text-box .item{ .text-box .item {
margin-bottom: 12rpx; margin-bottom: 12rpx;
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
} }
.text-box .item .label{ .text-box .item .label {
width: 140rpx; width: 140rpx;
} }
.text-box .item .value{ .text-box .item .value {
color: #656566; color: #656566;
width: calc(100% - 150rpx); width: calc(100% - 150rpx);
.arrow {
margin-left: 16rpx;
width: 20rpx;
height: 20rpx;
transform: translateY(1rpx);
}
&.icon {
display: flex;
align-items: center;
justify-content: space-between;
}
} }
.photo-box { .photo-box {
...@@ -55,6 +135,6 @@ ...@@ -55,6 +135,6 @@
.photo-box .item { .photo-box .item {
width: 200rpx; width: 200rpx;
height: 200rpx; height: 200rpx;
background: #D8D8D8; background: #d8d8d8;
margin: 0 20rpx 20rpx 0; margin: 0 20rpx 20rpx 0;
}
\ No newline at end of file \ No newline at end of file
}
...@@ -3,55 +3,63 @@ ...@@ -3,55 +3,63 @@
<view class="status-box"> <view class="status-box">
<!-- 退款状态1:待处理,2待发货,3待确认收到退货,4:退款中,5:已退款,6:退款失败,7:审核不通过 --> <!-- 退款状态1:待处理,2待发货,3待确认收到退货,4:退款中,5:已退款,6:退款失败,7:审核不通过 -->
<view class="icon"> <view class="icon">
<block wx:if="{{orderInfo.refundStatus == 5}}"> <glsx-image webp src="{{refund.image}}"></glsx-image>
<glsx-image webp src="mine/order/success.png"></glsx-image> </view>
</block> <view class="box-info">
<block wx:elif="{{orderInfo.refundStatus <5}}"> <view class="title">{{refund.title}}</view>
<glsx-image webp src="mine/order/wait.png"></glsx-image> <view class="tips">{{refund.tips}}</view>
</block>
<block wx:else>
<glsx-image webp src="mine/order/error.png"></glsx-image>
</block>
</view> </view>
<view class="title">{{refundStatus[orderInfo.refundStatus]}}</view> </view>
<view class="tips"> <view class="box mb">
<block wx:if="{{orderInfo.refundStatus == 5}}"> <view class="text-box">
钱款将原路退回至您的账户 <view class="header">
<view class="title">商品寄回地址</view>
<view class="copy">复制</view>
</view>
<block wx:for="{{address}}" wx:key="index">
<view class="item">
<view class="label">{{item.title}}:</view>
<view class="value">
<view>{{addressObject[item.key]}}</view>
</view>
</view>
</block> </block>
<block wx:elif="{{orderInfo.refundStatus > 5 }}">退款不成功,您可以再次提交退款申请重试</block> <view class="title">请填写退货物流</view>
<block wx:else>等待平台处理</block> <view class="form">
<view class="item">
<view class="label">物流公司:</view>
<view class="value icon" bindtap="showPopup">
<view>{{express.name||'请选择'}}</view>
<mp-icon icon="arrow" color="#B1B1B3" size="12"></mp-icon>
</view>
</view>
<view class="item">
<view class="label">快递单号:</view>
<view class="value">
<input type="text" value="{{order.express_no}}" placeholder="请输入" placeholder-style="color: #999999;" />
</view>
</view>
</view>
</view> </view>
</view> </view>
<view class="box"> <view class="box">
<view class="text-box"> <view class="text-box">
<view class="title">售后信息</view>
<content item="{{orderInfo}}" />
<block wx:for="{{afterSaleObj}}" wx:key="index"> <block wx:for="{{afterSaleObj}}" wx:key="index">
<view class="item"> <view class="item">
<view class="label">{{item.title}}:</view> <view class="label">{{item.title}}:</view>
<view class="value"> <view class="value">
<block wx:if="{{item.enum}}"> <block wx:if="{{item.enum}}">{{item.enum[orderInfo[item.key]]}}</block>
{{item.enum[orderInfo[item.key]]}}
</block>
<block wx:elif="{{item.isArray}}"> <block wx:elif="{{item.isArray}}">
<block wx:for="{{orderInfo[item.key]}}" wx:key="index" wx:for-item="i"> <block wx:for="{{orderInfo[item.key]}}" wx:key="index" wx:for-item="i">
<text>{{i}};</text> <text>{{i}};</text>
</block> </block>
</block> </block>
<block wx:else> <block wx:else>{{orderInfo[item.key] || ''}}</block>
{{orderInfo[item.key] || ''}}
</block>
</view> </view>
</view> </view>
</block> </block>
<block wx:if="{{orderInfo.deliveryCompany}}">
<view class="item">
<view class="label">快递公司:</view>
<view class="value">{{orderInfo.deliveryCompany}}</view>
</view>
<view class="item">
<view class="label">快递单号:</view>
<view class="value">{{orderInfo.deliveryNumber}}</view>
</view>
</block>
</view> </view>
<block wx:if="{{orderInfo.imgUrls && orderInfo.imgUrls.length}}"> <block wx:if="{{orderInfo.imgUrls && orderInfo.imgUrls.length}}">
<view class="photo-box"> <view class="photo-box">
...@@ -66,5 +74,12 @@ ...@@ -66,5 +74,12 @@
<block wx:if="{{orderInfo.refundStatus >5}}"> <block wx:if="{{orderInfo.refundStatus >5}}">
<view class="default-btn" bindtap="confirm">重新提交</view> <view class="default-btn" bindtap="confirm">重新提交</view>
</block> </block>
</view> </view>
<!-- <popup show="{{showPopup}}" title="选择快递公司" bindconfirm="confirmPopup">
<view wx:for="{{expressList}}" wx:key="index" bindtap="selectExpress" data-item="{{item}}" class="section {{item.id==express.id?'active':''}}">
{{item.name}}
</view>
</popup> -->
<mp-actionSheet bindactiontap="selectExpress" show="{{showPopup}}" actions="{{expressList}}" title="选择快递公司" >
</mp-actionSheet>
</block> </block>
\ No newline at end of file \ No newline at end of file
import { afterSaleMixin } from "~/mixins/index"; import { afterSaleMixin } from "~/mixins/index";
import { RefundReason } from "~/constants/mine.js"; import { RefundReason } from "~/constants/mine.js";
console.log("🚀 ~ RefundReason:", RefundReason)
Page({ Page({
behaviors: [afterSaleMixin], behaviors: [afterSaleMixin],
...@@ -45,9 +44,14 @@ Page({ ...@@ -45,9 +44,14 @@ Page({
}); });
}, },
changeRefundCount(e) { changeRefundCount(e) {
console.log("🚀 ~ changeRefundCount ~ e:", e);
this.setData({ this.setData({
"orderObj.refundCount": e.detail, "orderObj.refundCount": e.detail
});
},
radioChange(e){
this.setData({
"orderObj.reason": e.detail.value,
refundReason:RefundReason.find(item => item.value == e.detail.value).text
}); });
}, },
noScroll() {}, noScroll() {},
...@@ -107,7 +111,7 @@ Page({ ...@@ -107,7 +111,7 @@ Page({
}); });
}); });
}, },
confirm() { submit() {
let { orderObj, imgUrls } = this.data; let { orderObj, imgUrls } = this.data;
orderObj.imgUrls = imgUrls; orderObj.imgUrls = imgUrls;
console.log(orderObj); console.log(orderObj);
......
...@@ -10,6 +10,26 @@ ...@@ -10,6 +10,26 @@
color: #1b233d; color: #1b233d;
} }
.page-section {
max-height: calc(100%);
overflow: hidden;
overflow-y: scroll;
.weui-cell {
height: 88rpx;
line-height: 88rpx;
font-size: 28rpx;
color: #333435;
box-sizing: border-box;
.weui-cell__hd {
margin-left: 10rpx;
margin-right: 20rpx;
}
&::before {
display: none;
}
}
}
.box { .box {
background: #ffffff; background: #ffffff;
border-radius: 8rpx; border-radius: 8rpx;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<view class="box-item"> <view class="box-item">
<text class="box-item-title">退款原因</text> <text class="box-item-title">退款原因</text>
<view class="box-item-value" bindtap="showPopup"> <view class="box-item-value" bindtap="showPopup">
请选择 {{refundReason||'请选择'}}
<view class="arrow"> <view class="arrow">
<glsx-image webp src="mine/mine-arrow.png"></glsx-image> <glsx-image webp src="mine/mine-arrow.png"></glsx-image>
</view> </view>
...@@ -62,14 +62,14 @@ ...@@ -62,14 +62,14 @@
</block> </block>
</block> </block>
</view> </view>
<view class="btn text-center" bindtap="confirm">提交</view> <view class="btn text-center" bindtap="submit">提交</view>
</view> </view>
<popup show="{{showPopup}}" only="{{false}}" title="请选择退款原因" bindconfirm="confirmPopup"> <popup show="{{showPopup}}" only="{{false}}" title="请选择退款原因" bindconfirm="confirmPopup">
<view class="page-section"> <view class="page-section">
<radio-group bindchange="radioChange"> <radio-group bindchange="radioChange">
<label class="weui-cell weui-check__label" wx:for="{{RefundReason}}" wx:key="{{item.value}}"> <label class="weui-cell weui-check__label" wx:for="{{RefundReason}}" wx:key="{{item.value}}">
<view class="weui-cell__hd"> <view class="weui-cell__hd">
<radio value="{{item.value}}" checked="true" /> <radio value="{{item.value}}" checked="true" color="#FC8A32" />
</view> </view>
<view class="weui-cell__bd">{{item.text}}</view> <view class="weui-cell__bd">{{item.text}}</view>
</label> </label>
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
</view> </view>
</view> </view>
<!-- !hasUserInfo --> <!-- !hasUserInfo -->
<view wx:if="{{item.orderGoods.length > 1 && !hasUserInfo}}"> <!-- <view wx:if="{{item.orderGoods.length > 1 && !hasUserInfo}}">
<block wx:if="{{item.orderStatus == 5 || item.orderStatus == 8}}"> <block wx:if="{{item.orderStatus == 5 || item.orderStatus == 8}}">
<block wx:if="{{item.evaluatedFlag == 'Y'}}"> <block wx:if="{{item.evaluatedFlag == 'Y'}}">
<view class="btn confirm" catchtap="onLookEvaluate" data-item="{{item}}">查看评价</view> <view class="btn confirm" catchtap="onLookEvaluate" data-item="{{item}}">查看评价</view>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<view class="btn confirm" catchtap="onEvaluate" wx:else data-item="{{item}}">立即评价</view> <view class="btn confirm" catchtap="onEvaluate" wx:else data-item="{{item}}">立即评价</view>
</block> </block>
</block> </block>
</view> </view> -->
</view> </view>
</view> </view>
</block> </block>
......
<view class="item" catchtap="onJump" data-item="{{item}}"> <view class="item" catchtap="onJump" data-item="{{item}}">
<top item="{{item}}" after-sale-status="{{afterSaleStatus}}" status-enum="{{statusEnum}}"></top> <top item="{{item}}" after-sale-status="{{afterSaleStatus}}" status-enum="{{statusEnum}}"></top>
<content item="{{item}}" has-user-info="{{hasUserInfo}}" bind:lookEvaluate="onLookEvaluate" bind:getUserProfile="onGetUserProfile" bind:evaluate="onEvaluate"></content> <content item="{{item}}"></content>
<bottom item="{{item}}" /> <bottom item="{{item}}" />
</view> </view>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!