订单详情增加操作按钮

This commit is contained in:
2025-03-17 19:12:00 +08:00
parent 2d9451438c
commit 27025cecc4
8 changed files with 288 additions and 124 deletions

View File

@ -129,10 +129,10 @@ checkbox .wx-checkbox-input{
}
checkbox .wx-checkbox-input.wx-checkbox-input-checked{
border-color: var(--main-font-color);
border: 2px solid #000000;
border: 2px solid var(--main-color);
}
checkbox .wx-checkbox-input.wx-checkbox-input-checked::before{
color: var(--main-font-color);
color: var(--main-color);
/* font-size: 30px; */
}

View File

@ -7,9 +7,10 @@
.move-area .tips{
position: absolute;
/* right:120rpx; */
top:30rpx;
top:50%;
color: #000000;
font-size: 36rpx;
margin-top:-18rpx;
z-index: 0;
font-weight: 500;
transition-duration: .1s;
@ -22,13 +23,14 @@
.move-view{
background-color: #fff;
/* 为了精确定位width 用 px 单位 包括下面的 border*/
width: 88px;height:88rpx;
width: 92px;height:100%;
display: flex;
align-items: center;
justify-content:center;
border-radius: 12rpx;
border:2px solid var(--main-color);
z-index: 1;
box-sizing: border-box;
}
.move-view .icon{
width:56rpx;height:56rpx;

View File

@ -151,7 +151,6 @@ Page({
},
setStatus(event){
const status = event.currentTarget.dataset.item;
console.log(status);
//先不setData 让加载出来之后再设置
this.data.statusDetailKey = status.key.toLowerCase();
this.loadBuilding().then((data)=>{
@ -568,7 +567,6 @@ Page({
},
emptyFun(){},
onShow(){
console.log('onshow');
if(this.data.statusDetailKey==this.data.statusDetail.received.key.toLowerCase()){
let needRefreshData = {}
this.data.list.map((item,index)=>{
@ -580,10 +578,15 @@ Page({
this.setData(needRefreshData);
}
if(this.haveNewOrder){
//新订单刷新 暂时没做刷新,因为如果在其他 tab来了刷新会很怪
this.data.statusDetailKey = this.data.statusDetail.created.key.toLowerCase();
this.data.buildingIndex = 0;
this.refreshList();
this.haveNewOrder = false;
}else if(app.globalData.needRefreshOrderList){
//订单详情回来的刷新
this.refreshList();
app.globalData.needRefreshOrderList = false;
}
},
getPackageReceiveStatus(orderId,pkg){
@ -619,7 +622,7 @@ Page({
},
navToAgreement(){
wx.navigateTo({
url: `/pages/browser/index?url=${this.data.appConfig.url_user_agreement}`,
url: `/pages/browser/index?url=${encodeURIComponent(this.data.appConfig.url_user_agreement)}`,
})
}
})

View File

@ -76,12 +76,12 @@ Page({
},
navToAgreement(){
wx.navigateTo({
url: `/pages/browser/index?url=${this.data.appConfig.url_user_agreement}`,
url: `/pages/browser/index?url=${encodeURIComponent(this.data.appConfig.url_user_agreement)}`,
})
},
navToPrivacy(){
wx.navigateTo({
url: `/pages/browser/index?url=${this.data.appConfig.url_user_privacy}`,
url: `/pages/browser/index?url=${encodeURIComponent(this.data.appConfig.url_user_privacy)}`,
})
},
/**

View File

@ -1,5 +1,6 @@
import orderApi from '../../api/order';
import userApi from '../../api/user';
const app = getApp();
import {hidePhoneNumber} from '../../utils/util';
Page({
@ -21,7 +22,10 @@ Page({
genderKV:userApi.genderKV,
orderStep:0
orderStep:0,
receiving:false,
isShowRefundConfirm:false
},
/**
@ -71,6 +75,7 @@ Page({
this.setData({
orderDetail:data,
refreshTrigger:false,
receiving:false,
orderStep
})
}).catch((res)=>{
@ -120,6 +125,95 @@ Page({
data:receviedStatus
})
},
showMoreAS(event){
const item = this.data.orderDetail;
const markupAction = ()=>{
const markupView = this.selectComponent('#markupView');
markupView.show(item)
}
const makePhoneCallAction = ()=>{
wx.makePhoneCall({
phoneNumber: item.address_phone,
});
}
const refundAction = ()=>{
console.log(item.receiving);
if(item.receiving)return;
this.setData({
isShowRefundConfirm:true
});
}
let items = [];
let actions = [];
if(item.status==this.data.orderStatus.created){
items = ['联系用户','取消订单'];
actions = [makePhoneCallAction,refundAction]
}else if(item.status==this.data.orderStatus.received){
items = ['包裹加价','联系用户','取消订单'];
actions = [markupAction,makePhoneCallAction,refundAction]
}else if(item.status==this.data.orderStatus.delivering){
items = ['联系用户'];
actions = [makePhoneCallAction]
}
if(items.length!=actions.length){
throw new Error('sb')
}
wx.showActionSheet({
itemList: items,
success:(res)=>{
actions[res.tapIndex]();
}
})
},
markupSuccess(){
app.globalData.needRefreshOrderList = true;
this.getOrderDetail();
},
refund(event){
const item = this.data.orderDetail;
if(item.receiving)return;
this.setData({
receiving:true
})
orderApi.cancel(item.orderid,event.detail).then((data)=>{
wx.showToast({
title: '取消成功',
icon:'success'
});
app.globalData.needRefreshOrderList = true;
this.getOrderDetail();
})
},
receivedOrder(){
const item = this.data.orderDetail;
const hasUnReceive = !!item.packages.find((p)=>!p.receivedAll);
if(hasUnReceive){
this.setData({
receiving:false
})
wx.showToast({
icon:'none',
title: '请先取件',
})
return;
}
orderApi.pickup(item.orderid).then((data)=>{
wx.showToast({
icon:'success',
title: '取货成功',
})
app.globalData.needRefreshOrderList = true;
this.getOrderDetail();
wx.removeStorage({
key: item.orderid,
})
}).catch(()=>{
this.setData({
receiving:false
})
})
},
emptyFun(){},
/**
* 生命周期函数--监听页面初次渲染完成
*/

View File

@ -1,4 +1,8 @@
{
"usingComponents": {},
"usingComponents": {
"swipe-button":"/components/swipeButton",
"modal-view":"/components/modalView",
"mark-up":"../index/mark-up"
},
"navigationBarTitleText": "订单详情"
}

View File

@ -1,5 +1,6 @@
<scroll-view refresher-triggered="{{refreshTrigger}}" bindrefresherrefresh="getOrderDetail"
refresher-enabled scroll-y class="order-detail {{orderDetail.is_first_order?'is-new-order':''}}"
<view class="custom-scroll-view">
<scroll-view refresher-triggered="{{refreshTrigger}}" bindrefresherrefresh="getOrderDetail"
refresher-enabled scroll-y class="order-detail main {{orderDetail.is_first_order?'is-new-order':''}}"
enhanced show-scrollbar="{{false}}">
<view class="scroll-view-top-margin"></view>
<view class="page-container address-info">
@ -105,14 +106,14 @@
<view class="key">取件数量</view>
<view class="value">{{orderDetail.package_count}}</view>
</view>
<view class="row" wx:if="{{orderDetail.additional_fee_amount}}">
<view class="key">加价金额</view>
<view class="value money money-normal">{{orderDetail.additional_fee_amount}}</view>
</view>
<view class="row">
<view class="key">基础配送费</view>
<view class="value money money-normal">{{orderDetail.base_delivery_amount}}</view>
</view>
<view class="row" wx:if="{{orderDetail.additional_fee_amount}}">
<view class="key">加价金额</view>
<view class="value money money-normal">{{orderDetail.additional_fee_amount}}</view>
</view>
<view class="row" wx:if="{{orderDetail.more_station_price}}">
<view class="key">多驿站费</view>
<view class="value money money-normal">{{orderDetail.more_station_price}}</view>
@ -123,5 +124,16 @@
</view>
</view>
<view class="scroll-view-dispatch"></view>
</scroll-view>
</scroll-view>
<view class="bottom-bar-v2" wx:if="{{orderDetail.status==orderStatus.received}}">
<button disabled="{{item.receiving}}" class="button more-btn" plain capture-catch:tap="showMoreAS">
<view class="icon"></view>
</button>
<swipe-button class="swipe-button" loading="{{receiving}}" bind:done="receivedOrder"
button-text="我已取货" button-loading-text="取货中..." capture-catch:tap="emptyFun"/>
</view>
</view>
<mark-up id="markupView" class="mark-up" bind:success="markupSuccess"/>
<modal-view titleText="取消订单需联系客户说明原因" editable content-placeholder="请输入退单原因" bind:ok="refund" model:show="{{isShowRefundConfirm}}" titleTextCenter="{{false}}" editRequired/>

View File

@ -236,3 +236,52 @@
width:160rpx;height:160rpx;
border-radius: 12rpx;
}
.bottom-bar-v2{
display: flex;
gap:24rpx;
}
.bottom-bar-v2 .button{
height:100rpx;
line-height: 1;
border-radius: 12rpx;
border: 1.2px solid rgba(85, 85, 85, 0.5);
color: #555555;
font-weight: normal;
padding:30rpx 40rpx;
margin:0;
}
.bottom-bar-v2 .more-btn{
width:180rpx;
display: flex;
align-items: center;
justify-content: center;
}
.bottom-bar-v2 .more-btn .icon,
.bottom-bar-v2 .more-btn .icon::before,
.bottom-bar-v2 .more-btn .icon::after{
width:16rpx;height:16rpx;
background: #555555;
border-radius: 50%;
position: relative;
overflow: visible;
}
.bottom-bar-v2 .more-btn .icon::before{
content:'';
position:absolute;
left:-36rpx;top:0;
}
.bottom-bar-v2 .more-btn .icon::after{
content:'';
position:absolute;
left:36rpx;top:0;
}
.bottom-bar-v2 .more-btn[disabled]{
color:#999;
border-color:rgb(221, 219, 219);
}
.bottom-bar-v2 .swipe-button{
height:100rpx;
flex:1;
}