Commit e048950a by liimin

refactor(order): 重构订单页面

- 更新 Tab 组件用法,优化标签页切换逻辑
- 移除订单列表硬编码,使用动态数据渲染
- 新增 OrderCard 组件,用于渲染订单卡片
- 优化订单详情跳转逻辑
- 删除冗余代码,提升代码可读性和维护性
1 parent 93158a78
Showing 30 changed files with 991 additions and 513 deletions
......@@ -35,13 +35,15 @@ Component({
methods: {
click(e) {
let {
count
count,
item
} = e.currentTarget.dataset
this.setData({
count,
to: `to-${count}`
})
this.triggerEvent('click', count)
}
this.triggerEvent('change', {count,item})
},
}
})
\ No newline at end of file
<block wx:if="{{openScroll}}">
<scroll-view class="tab-box {{align}}" scroll-x enable-flex scroll-with-animation scroll-into-view="{{to}}">
<block wx:for="{{tab}}" wx:key="index">
<view class="tab {{index==count?'active':''}}" bindtap="click" data-count="{{index}}" id="to-{{index}}" >
<view class="text" >{{item}}</view>
<view class="tab {{index==count||count==item.code?'active':''}}" bindtap="click" data-count="{{index}}" id="to-{{index}}" >
<view class="text" >{{item.text||item}}</view>
<!-- <view class="text" style="width:{{38 * item.length + 20}}rpx;">{{item}}</view> -->
<view class="line"></view>
</view>
......@@ -12,8 +12,8 @@
<block wx:else>
<view class="tab-box flex">
<block wx:for="{{tab}}" wx:key="index">
<view class="tab {{index==count?'active':''}}" bindtap="click" data-count="{{index}}">
<view class="text text-center">{{item}}</view>
<view class="tab {{index==count||count==item.code?'active':''}}" bindtap="click" data-count="{{index}}" data-item="{{item}}">
<view class="text text-center">{{item.text||item}}</view>
<view class="line"></view>
</view>
</block>
......
......@@ -38,11 +38,11 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options,'=======')
if (options && options.orderCode) {
let orderCode = options.orderCode;
wx.p.router.getRouterParams(options).then(({ orderCode } = {}) => {
if (orderCode) {
this.getOrderDetail(orderCode);
}
});
},
getOrderDetail(orderCode) {
let { orderObj } = this.data;
......@@ -129,33 +129,4 @@ Page({
qr: QR.createQrCodeImg(`t=1&c=${data}`),
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
});
// packageMine/pages/order/index/components/bottom/bottom.js
Component({
/**
* 组件的属性列表
*/
properties: {
item: {
type: Object,
value: {}
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})
\ No newline at end of file
{
"component": true,
"style": "v2",
"usingComponents": {
"order-action-buttons": "../OrderActionButtons/OrderActionButtons"
}
}
\ No newline at end of file
<view class="bottom">
<view class="total">共{{item.goodsNumber}}件,实付款<text class="price">{{item.payPrice}}积分</text></view>
<order-action-buttons
item="{{item}}"
has-user-info="{{hasUserInfo}}"
/>
</view>
\ No newline at end of file
.bottom {
margin-top: 36rpx;
height: 64rpx;
display: flex;
align-items: flex-start;
font-size: 24rpx;
color: #656566;
}
.bottom .total {
position: relative;
bottom: 16rpx;
}
.bottom .price {
color: var(--themeColor);
font-weight: 600;
margin-left: 10rpx;
}
\ No newline at end of file
// packageMine/pages/order/index/components/content/content.js
Component({
/**
* 组件的属性列表
*/
properties: {
item: {
type: Object,
value: {}
},
hasUserInfo: {
type: Boolean,
value: false
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
// 查看评价
onLookEvaluate(e) {
this.triggerEvent('lookEvaluate', {
item: e.currentTarget.dataset.item
});
},
// 获取用户信息
onGetUserProfile(e) {
this.triggerEvent('getUserProfile', {
item: e.currentTarget.dataset.item
});
},
// 立即评价
onEvaluate(e) {
this.triggerEvent('evaluate', {
item: e.currentTarget.dataset.item
});
}
}
})
\ No newline at end of file
{
"component": true,
"style": "v2",
"usingComponents": {}
}
\ No newline at end of file
<view class="content-top {{item.orderStatus == 5 || item.orderStatus == 8?'':'content-bottom'}}">
<block wx:for="{{item.orderGoods}}" wx:for-item="i" wx:for-index="ind" wx:key="ind">
<view class="goods {{item.orderStatus == 5 || item.orderStatus == 8?'addTo':''}}">
<view class="icon">
<image webp wx:if="{{item.orderSource == 5}}" src="{{item.activityBigImg}}"></image>
<image webp wx:else src="{{i.goodsImage}}"></image>
</view>
<view class="info">
<view class="info-top">
<view class="name text-hide">{{item.orderSource == 5 ? item.activityName: i.goodsName}}</view>
<view class="number">
x{{item.orderSource == 5 ? 1: i.goodsNumber}}
</view>
</view>
<view class="info-bottom">
<block wx:if="{{i.specificationData}}">
<view class="specification">{{i.specificationData}}</view>
</block>
<view class="price">
{{item.orderSource == 5 ? item.payPrice: (i.activityPrice ||i.retailPrice)}}积分
</view>
</view>
<!-- !hasUserInfo -->
<view wx:if="{{item.orderGoods.length > 1 && !hasUserInfo}}">
<block wx:if="{{item.orderStatus == 5 || item.orderStatus == 8}}">
<block wx:if="{{item.evaluatedFlag == 'Y'}}">
<view class="btn confirm" catchtap="onLookEvaluate" data-item="{{item}}">查看评价</view>
</block>
<block wx:else>
<button catchtap="onGetUserProfile" wx:if="{{!hasUserInfo}}" class="btn confirm userProfile" data-item="{{item}}"> 立即评价 </button>
<view class="btn confirm" catchtap="onEvaluate" wx:else data-item="{{item}}">立即评价</view>
</block>
</block>
</view>
</view>
</view>
</block>
</view>
\ No newline at end of file
.content-top {
/* 样式将在使用时通过类名动态添加 */
}
.content-bottom {
/* 样式将在使用时通过类名动态添加 */
}
.goods {
height: 208rpx;
padding: 24rpx 24rpx 24rpx 0;
box-sizing: border-box;
display: flex;
}
.addTo {
border-bottom: 2rpx solid #eff0f2;
}
.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;
}
.goods .confirm {
border-color: var(--btnColor);
color: var(--btnColor);
font-weight: 500;
}
.icon {
width: 160rpx;
height: 160rpx;
margin-right: 20rpx;
border-radius: 8rpx;
overflow: hidden;
}
.background-X {
background-color: rgb(244, 244, 244);
}
.info {
width: calc(100% - 180rpx);
height: 160rpx;
display: flex;
flex-direction: column;
position: relative;
}
.info-top,
.info-bottom {
display: flex;
align-items: center;
justify-content: space-between;
}
.info-top .number {
color: #656566;
font-size: 24rpx;
}
.info-bottom {
margin-top: 4rpx;
font-size: 24rpx;
color: #707071;
display: flex;
flex-direction: column;
align-items:flex-start;
gap: 8rpx;
}
.info-bottom .price {
color: var(--themeColor);
font-size: 26rpx;
font-weight: 500;
}
.info-bottom .specification {
color: #b1b1b3;
}
.userProfile {
background-color: #fff;
font-size: 24rpx;
margin: 0;
padding: 0;
font-weight: 500;
line-height: 46rpx;
}
\ No newline at end of file
// packageMine/pages/order/index/components/orderActionButtons.js
Component({
/**
* 组件的属性列表
*/
properties: {
item: {
type: Object,
value: {}
},
hasUserInfo: {
type: Boolean,
value: false
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
// 取消付款
onCancelPay(e) {
const orderCode = e.currentTarget.dataset.orderCode;
this.triggerEvent('cancelPay', { orderCode });
},
// 去支付
onPay(e) {
const orderCode = e.currentTarget.dataset.orderCode;
this.triggerEvent('pay', { orderCode });
},
// 查看详情
onToGoldDetail(e) {
const item = e.currentTarget.dataset.item;
this.triggerEvent('toGoldDetail', { item });
},
// 售后
onAfterSale(e) {
const item = e.currentTarget.dataset.item;
this.triggerEvent('afterSale', { item });
},
// 确认收货
onConfirmReceipt(e) {
const orderCode = e.currentTarget.dataset.orderCode;
this.triggerEvent('confirmReceipt', { orderCode });
},
// 查看评价
onLookEvaluate(e) {
const item = e.currentTarget.dataset.item;
this.triggerEvent('lookEvaluate', { item });
},
// 获取用户信息
onGetUserProfile(e) {
const item = e.currentTarget.dataset.item;
this.triggerEvent('getUserProfile', { item });
},
// 立即评价
onEvaluate(e) {
const item = e.currentTarget.dataset.item;
this.triggerEvent('evaluate', { item });
},
// 取消订单
onCancelOrder(e) {
const orderCode = e.currentTarget.dataset.orderCode;
this.triggerEvent('cancelOrder', { orderCode });
},
// 售后详情
onAfterSaleDetail(e) {
const item = e.currentTarget.dataset.item;
this.triggerEvent('afterSaleDetail', { item });
}
}
})
\ No newline at end of file
{
"component": true,
"style": "v2",
"usingComponents": {}
}
\ No newline at end of file
<!-- 订单操作按钮组件 -->
<view class="btn-box">
<block wx:if="{{!item.afterSaleStatus}}">
<block wx:if="{{item.orderStatus == 1}}">
<view class="btn pay" catchtap="onCancelPay" data-order-code="{{item.orderCode}}">取消付款</view>
<block wx:if="{{item.orderSource != 4}}">
<view class="btn pay" catchtap="onPay" data-order-code="{{item.orderCode}}">去支付</view>
</block>
</block>
<block wx:if="{{item.orderSource==5 && (item.orderStatus == 2 || item.orderStatus == 7)}}">
<view class="btn pay" data-item="{{item}}" bind:tap="onToGoldDetail">查看详情</view>
</block>
<block wx:elif="{{item.orderStatus > 2 && item.orderStatus < 9}}">
<!-- deliveryType 结算方式(1:到店核销,2:快递发货) -->
<block wx:if="{{item.payPrice > 0 && item.orderSource != 4}}">
<view class="btn" catchtap="onAfterSale" data-item="{{item}}" wx:if="{{!(item.relatedUserCouponStatus == 2 || item.relatedUserCouponStatus == 3)}}">售后</view>
</block>
<block wx:if="{{item.deliveryType == 2 && item.orderStatus == 4}}">
<view class="btn confirm" catchtap="onConfirmReceipt" data-order-code="{{item.orderCode}}">确认收货</view>
</block>
</block>
<!-- !hasUserInfo -->
<view wx:if="{{item.orderGoods.length == 1 && !hasUserInfo}}">
<block wx:if="{{item.orderStatus == 5 || item.orderStatus == 8}}">
<block wx:if="{{item.evaluatedFlag == 'Y'}}">
<view class="btn confirm" catchtap="onLookEvaluate" data-item="{{item}}">查看评价</view>
</block>
<block wx:else>
<button catchtap="onGetUserProfile" wx:if="{{!hasUserInfo}}" class="btn confirm userProfile" data-item="{{item}}"> 立即评价 </button>
<view class="btn confirm" catchtap="onEvaluate" wx:else data-item="{{item}}">立即评价</view>
</block>
</block>
</view>
</block>
<block wx:else>
<block wx:if="{{item.afterSaleStatus == 1}}">
<view class="btn pay" catchtap="onCancelOrder" data-order-code="{{item.orderCode}}">取消售后</view>
</block>
<view class="btn" data-item="{{item}}" catchtap="onAfterSaleDetail">售后详情</view>
</block>
</view>
\ No newline at end of file
/* components/orderActionButtons.wxss */
.btn-box {
position: absolute;
right: 24rpx;
bottom: 16rpx;
display: flex;
align-items: center;
justify-content: flex-end;
}
.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;
}
.btn-box .pay {
background-color: var(--btnColor);
color: #fff;
border-color: var(--btnColor);
}
.btn-box .empty {
color: var(--btnColor);
background-color: #fff;
}
.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;
}
\ No newline at end of file
// packageMine/pages/order/index/components/ordercard/ordercard.js
Component({
/**
* 组件的属性列表
*/
properties: {
item: {
type: Object,
value: {},
},
afterSaleStatus: {
type: Object,
value: {},
},
statusEnum: {
type: Object,
value: {},
},
hasUserInfo: {
type: Boolean,
value: false,
},
},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
// 跳转到订单详情
onJump(e) {
let {
item: { orderStatus, orderCode, orderSource },
} = e.currentTarget.dataset;
if (orderSource == 5 && (orderStatus == 2 || orderStatus == 7)) return;
let url = "/packageMine/pages/order/detail/detail";
wx.p.router.go(url, {
orderCode,
});
},
// 取消付款
onCancelPay(e) {
this.triggerEvent("cancelPay", {
orderCode: e.detail.orderCode,
});
},
// 去支付
onPay(e) {
this.triggerEvent("pay", {
orderCode: e.detail.orderCode,
});
},
// 查看详情
onToGoldDetail(e) {
this.triggerEvent("toGoldDetail", {
item: e.detail.item,
});
},
// 售后
onAfterSale(e) {
this.triggerEvent("afterSale", {
item: e.detail.item,
});
},
// 确认收货
onConfirmReceipt(e) {
this.triggerEvent("confirmReceipt", {
orderCode: e.detail.orderCode,
});
},
// 查看评价
onLookEvaluate(e) {
this.triggerEvent("lookEvaluate", {
item: e.detail.item,
});
},
// 获取用户信息
onGetUserProfile(e) {
this.triggerEvent("getUserProfile", {
item: e.detail.item,
});
},
// 立即评价
onEvaluate(e) {
this.triggerEvent("evaluate", {
item: e.detail.item,
});
},
// 取消订单
onCancelOrder(e) {
this.triggerEvent("cancelOrder", {
orderCode: e.detail.orderCode,
});
},
// 售后详情
onAfterSaleDetail(e) {
this.triggerEvent("afterSaleDetail", {
item: e.detail.item,
});
},
},
});
{
"component": true,
"style": "v2",
"usingComponents": {
"top": "../Top/Top",
"content": "../Content/Content",
"bottom": "../Bottom/Bottom",
"order-action-buttons": "../OrderActionButtons/OrderActionButtons"
}
}
\ No newline at end of file
<view class="item" catchtap="onJump" data-item="{{item}}">
<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>
<bottom item="{{item}}" />
</view>
\ No newline at end of file
.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;
}
.text-hide {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
\ No newline at end of file
// packageMine/pages/order/index/components/top/top.js
Component({
/**
* 组件的属性列表
*/
properties: {
item: {
type: Object,
value: {}
},
afterSaleStatus: {
type: Object,
value: {}
},
statusEnum: {
type: Object,
value: {}
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})
\ No newline at end of file
{
"component": true,
"style": "v2",
"usingComponents": {}
}
\ No newline at end of file
<view class="top">
<view class="name">订单编号:{{item.orderCode}}</view>
<!-- 订单状态 orderStatus(1:待付款;2:已支付;3:已关闭;4:已发货;5:已收货;6:待发货;7:待安装;8:已安装;9:售后中;10:售后完成)
售后订单状态 afterSaleStatus(1:待审核;2:审核通过;3:审核不通过;4:待确认收到退货;5:退款中;6:已退款;7:退款失败)
-->
<view class="status">{{item.afterSaleStatus ? afterSaleStatus[item.afterSaleStatus]
:statusEnum[item.orderStatus]}}</view>
</view>
\ No newline at end of file
.top {
height: 82rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding-right: 24rpx;
position: relative;
}
.top .name {
width: 410rpx;
height: 40rpx;
font-size: 28rpx;
color: #2D2D2E;
}
.top .status {
font-size: 28rpx;
color: #282829;
font-weight: 400;
}
\ No newline at end of file
/* 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
......@@ -20,7 +20,7 @@ Page({
*/
data: {
pageNum: 1,
tab: Object.freeze(ORDER_LIST.map((item) => item.text)),
tab: Object.freeze(ORDER_LIST),
// 硬编码的订单列表数据
list: [
{
......@@ -215,82 +215,11 @@ Page({
},
changeTab(e) {
this.setData({
tabIndex: e.detail,
orderStatusPart: orderStatusPartEnum[e.detail],
tabIndex: e.detail.item.code,
orderStatusPart: e.detail.item.code,
});
this.clearData();
},
//立即评价
evaluate(e) {
let {
item: { orderCode },
} = e.currentTarget.dataset;
let { userInfo } = this.data;
wx.p.router.go("/packageMall/pages/addComment/addComment", {
orderCode,
userInfo,
});
},
//查看详情评价
lookevaluate(e) {
let {
item: { orderCode },
} = e.currentTarget.dataset;
wx.p.router.go(
"/packageMall/pages/commentDetails/commentDetails",
orderCode
);
},
//取消售后
cancelOrder(e) {
let { orderCode } = e.currentTarget.dataset;
wx.showModal({
title: "温馨提示",
content: "请问您是否要取消售后",
confirmText: "确认",
cancelText: "取消",
confirmColor: "#F13C3D",
}).then((res) => {
if (res.confirm) {
wx.p.api.shopmallApi
.cancelOrder(orderCode)
.then(({ code, message }) => {
if (code == "0") {
wx.p.wxApi.showToast("操作成功");
setTimeout(() => {
this.clearData();
}, 1.5e3);
} else {
wx.p.wxApi.showToast(message);
}
});
}
});
},
//取消付款
cancelPay(e) {
let { orderCode } = e.currentTarget.dataset;
wx.showModal({
title: "温馨提示",
content: "请问您是否要取消付款",
confirmText: "确认",
cancelText: "取消",
confirmColor: "#F13C3D",
}).then((res) => {
if (res.confirm) {
wx.p.api.shopmallApi.cancelPay(orderCode).then(({ code, message }) => {
if (code == "0") {
wx.p.wxApi.showToast("操作成功");
setTimeout(() => {
this.clearData();
}, 1.5e3);
} else {
wx.p.wxApi.showToast(message);
}
});
}
});
},
/**
* 生命周期函数--监听页面加载
*/
......@@ -387,44 +316,6 @@ Page({
});
*/
},
pay(e) {
let _this = this;
wx.p.wxApi.showLoading("结算中...");
wx.p.api.shopmallApi
.payOrder(e.currentTarget.dataset)
.then(({ needPay, payParams }) => {
wx.hideLoading();
if (needPay) {
let params = {
nonceStr: payParams.nonceStr,
paySign: payParams.paySign,
signType: payParams.signType,
timeStamp: payParams.timeStamp,
package: payParams.packages,
};
wx.requestPayment({
...params,
success(res) {
setTimeout(() => {
_this.clearData();
}, 1.5e3);
_this.requestSubscribeMessage();
},
fail(res) {
if (res.errMsg == "requestPayment:fail cancel") {
wx.p.wxApi.showToast("取消支付");
} else {
wx.p.router.go("/packageMine/pages/order/complete/complete", {
params,
});
}
},
});
} else {
_this.requestSubscribeMessage();
}
});
},
requestSubscribeMessage() {
wx.p.router.go("/packageMine/pages/order/complete/complete", {
success: true,
......@@ -450,44 +341,6 @@ Page({
});
});
},
confirmReceipt(e) {
let { orderCode } = e.currentTarget.dataset;
wx.showModal({
title: "温馨提示",
content: "是否确认收货",
confirmText: "确认",
cancelText: "取消",
confirmColor: "#F13C3D",
}).then((res) => {
if (res.confirm) {
wx.p.api.shopmallApi.confirmReceipt(orderCode).then((data) => {
wx.p.wxApi.showToast("操作成功");
setTimeout(() => {
this.clearData();
}, 1.5e3);
});
}
});
},
afterSale(e) {
let {
item: { orderCode, payPrice },
} = e.currentTarget.dataset;
wx.p.router.go(
"/packageMine/pages/order/afterSale_step_one/afterSale_step_one",
{
orderCode,
refundPrice: payPrice,
}
);
},
// 卡卷 售后详情
toSaleDetailPage(e) {
const { item } = e.currentTarget.dataset;
wx.p.router.go("/packageEquity/pages/saleDetail/saleDetail", {
orderCode: item.orderCode,
});
},
// 查看卡券
toCheckCard(e) {
const { item } = e.currentTarget.dataset;
......@@ -495,13 +348,6 @@ Page({
orderCode: item.orderCode,
});
},
// 查看膨胀金详情
toGoldDetail(e) {
const { item } = e.currentTarget.dataset;
wx.p.router.go("/packageEquity/pages/kaqDetail/orderDetail", {
orderCode: item.orderCode,
});
},
// 卡卷 申请售后
toSaleApplyPage(e) {
let { item } = e.currentTarget.dataset;
......@@ -562,4 +408,14 @@ Page({
}
);
},
/**
* 刷新订单列表
*/
onRefresh() {
// 调用混入中的方法获取订单列表
if (this.getOrderList && typeof this.getOrderList === "function") {
this.getOrderList();
}
},
});
{
"navigationStyle": "custom",
"usingComponents": {
"tab": "/components/Tab/Tab"
"tab": "/components/Tab/Tab",
"OrderCard": "./components/OrderCard/OrderCard"
}
}
\ No newline at end of file
......@@ -78,178 +78,10 @@
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;
......@@ -258,49 +90,6 @@
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;
}
......
......@@ -18,7 +18,7 @@
</view>
</navigation-bar>
<view class="tab" style="top:{{padding_bottom }}px;">
<tab tab="{{tab}}" bindclick="changeTab" index="{{tabIndex}}" ></tab>
<tab tab="{{tab}}" bindchange="changeTab" index="{{tabIndex}}"></tab>
</view>
</view>
<block wx:if="{{margin_top}}">
......@@ -26,116 +26,14 @@
<block wx:if="{{listFlag}}">
<block wx:if="{{list.length}}">
<block wx:for="{{list}}" wx:key="index">
<block wx:if="{{item.orderClassify == 1}}">
<view class="item" catchtap="jump" data-item="{{item}}">
<view class="top">
<view class="name">订单编号:{{item.orderCode}}</view>
<!-- 订单状态 orderStatus(1:待付款;2:已支付;3:已关闭;4:已发货;5:已收货;6:待发货;7:待安装;8:已安装;9:售后中;10:售后完成)
售后订单状态 afterSaleStatus(1:待审核;2:审核通过;3:审核不通过;4:待确认收到退货;5:退款中;6:已退款;7:退款失败)
-->
<view class="status">{{item.afterSaleStatus ? afterSaleStatus[item.afterSaleStatus]
:statusEnum[item.orderStatus]}}</view>
</view>
<view class="content-top {{item.orderStatus == 5 || item.orderStatus == 8?'':'content-bottom'}}">
<block wx:for="{{item.orderGoods}}" wx:for-item="i" wx:for-index="ind" wx:key="ind">
<view class="goods {{item.orderStatus == 5 || item.orderStatus == 8?'addTo':''}}">
<view class="icon">
<image webp wx:if="{{item.orderSource == 5}}" src="{{item.activityBigImg}}"></image>
<image webp wx:else src="{{i.goodsImage}}"></image>
</view>
<view class="info">
<view class="info-top">
<view class="name text-hide">{{item.orderSource == 5 ? item.activityName: i.goodsName}}</view>
<view class="number">
x{{item.orderSource == 5 ? 1: i.goodsNumber}}
</view>
</view>
<view class="info-bottom">
<block wx:if="{{i.specificationData}}">
<view class="specification">{{i.specificationData}}</view>
</block>
<view class="price">
{{item.orderSource == 5 ? item.payPrice: (i.activityPrice ||i.retailPrice)}}积分
</view>
</view>
<!-- !hasUserInfo -->
<view wx:if="{{item.orderGoods.length > 1 && !hasUserInfo}}">
<block wx:if="{{item.orderStatus == 5 || item.orderStatus == 8}}">
<block wx:if="{{item.evaluatedFlag == 'Y'}}">
<view class="btn confirm" catchtap="lookevaluate" data-item="{{item}}">查看评价</view>
</block>
<block wx:else>
<button catchtap="getUserProfile" wx:if="{{!hasUserInfo}}" class="btn confirm userProfile" data-item="{{item}}"> 立即评价 </button>
<view class="btn confirm" catchtap="evaluate" wx:else data-item="{{item}}">立即评价</view>
</block>
</block>
</view>
</view>
</view>
</block>
</view>
<view class="bottom">
<view class="total">共{{item.goodsNumber}}件,实付款<text class="price">{{item.payPrice}}积分</text></view>
<!-- 1:待付款;2:已支付;3:已关闭;4:已发货;5:已收货;6:待发货;7:待安装;8:已安装;9:售后中;10:售后完成 -->
<!-- 售后状态 1:待审核;2:审核通过;3:审核不通过;4:待确认收到退货;5:退款中;6:已退款;7:退款失败 -->
<view class="btn-box">
<block wx:if="{{!item.afterSaleStatus}}">
<block wx:if="{{item.orderStatus == 1}}">
<view class="btn pay" catchtap="cancelPay" data-order-code="{{item.orderCode}}">取消付款</view>
<block wx:if="{{item.orderSource != 4}}">
<view class="btn pay" catchtap="pay" data-order-code="{{item.orderCode}}">去支付</view>
</block>
</block>
<block wx:if="{{item.orderSource==5 && (item.orderStatus == 2 || item.orderStatus == 7)}}">
<view class="btn pay" data-item="{{item}}" bind:tap="toGoldDetail">查看详情</view>
</block>
<block wx:elif="{{item.orderStatus > 2 && item.orderStatus < 9}}">
<!-- deliveryType 结算方式(1:到店核销,2:快递发货) -->
<block wx:if="{{item.payPrice > 0 && item.orderSource != 4}}">
<view class="btn" catchtap="afterSale" data-item="{{item}}" wx:if="{{!(item.relatedUserCouponStatus == 2 || item.relatedUserCouponStatus == 3)}}">售后
</view>
</block>
<block wx:if="{{item.deliveryType == 2 && item.orderStatus == 4}}">
<view class="btn confirm" catchtap="confirmReceipt" data-order-code="{{item.orderCode}}">确认收货
</view>
</block>
</block>
<!-- !hasUserInfo -->
<view wx:if="{{item.orderGoods.length == 1 && !hasUserInfo}}">
<block wx:if="{{item.orderStatus == 5 || item.orderStatus == 8}}">
<block wx:if="{{item.evaluatedFlag == 'Y'}}">
<view class="btn confirm" catchtap="lookevaluate" data-item="{{item}}">查看评价</view>
</block>
<block wx:else>
<button catchtap="getUserProfile" wx:if="{{!hasUserInfo}}" class="btn confirm userProfile" data-item="{{item}}"> 立即评价 </button>
<view class="btn confirm" catchtap="evaluate" wx:else data-item="{{item}}">立即评价</view>
</block>
</block>
</view>
</block>
<block wx:else>
<block wx:if="{{item.afterSaleStatus == 1}}">
<view class="btn pay" catchtap="cancelOrder" data-order-code="{{item.orderCode}}">取消售后</view>
</block>
<view class="btn" data-item="{{item}}" catchtap="afterSaleDetail">售后详情</view>
</block>
</view>
</view>
</view>
</block>
<OrderCard item="{{item}}" after-sale-status="{{afterSaleStatus}}" status-enum="{{statusEnum}}" has-user-info="{{hasUserInfo}}"></OrderCard>
</block>
<block wx:if="{{nothing}}">
<view class="list-nothing to-bottom"></view>
</block>
</block>
<block wx:else>
<view class="list-nothing">
暂无相关内容
</view>
<view class="list-nothing">暂无相关内容</view>
</block>
</block>
</view>
......
......@@ -14,7 +14,8 @@ export const whiteList = [
'/pages/Login/Login',
'/pages/loading/loading',
'/pages/webView/webView',
'/packageMine/pages/order/index/index'
'/packageMine/pages/order/index/index',
'/packageMine/pages/order/detail/detail'
];
// tabBar页面路径配置
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!