订单加价

This commit is contained in:
2025-03-07 21:52:56 +08:00
parent c9b691ea7e
commit 010f796196
12 changed files with 314 additions and 9 deletions

View File

@ -56,7 +56,15 @@ export default {
},
orderQRCode:(order_id)=>request.get(`/api/merchant/order/${order_id}/verify-qrcode`),
detail:(orderid)=>request.get(`/api/order/${orderid}`),
merchantRefund:(order_id)=>request.post(`/api/merchant/order/${order_id}/refund/apply`)
merchantRefund:(order_id)=>request.post(`/api/merchant/order/${order_id}/refund/apply`),
markup:{
status:{
pending:"PENDING",
accepted:"ACCEPTED"
},
get:(orderid)=>request.get(`/api/order-additional-fee/order/${orderid}`,{},{noTips:true}),
accept:(request_id)=>request.put(`/api/order-additional-fee/${request_id}/accept`)
}
},
coupon:{
status:{

View File

@ -24,7 +24,8 @@
"pages/shop/bill_success/index",
"pages/my/setting/name/index",
"pages/browser/index",
"pages/my/promation/wx-group/index"
"pages/my/promation/wx-group/index",
"pages/order/markup/index"
],
"window": {
"navigationBarTextStyle": "black",

View File

@ -259,8 +259,8 @@ Page({
try{
uploadResult = await commonApi.uploadImg(file,onProgress);
}catch(e){
await this.uploadImages();
return;
// await this.uploadImages();
// return;
}
if(uploadResult.url){
this.setData({
@ -270,6 +270,10 @@ Page({
await this.uploadImages();
}else{
//上传失败
wx.showToast({
icon:'error',
title: '图片上传失败',
})
return new Error('失败')
}
},

View File

@ -21,10 +21,10 @@ Page({
*/
onLoad(options) {
this.setData({
activityId:options.id
activityId:options.id||2
});
this.getActivityDetail();
userApi.coupon.check(options.id).then((data)=>{
userApi.coupon.check(options.id||2).then((data)=>{
if(!data.can_receive){
this.setData({
isShowModal:true,

View File

@ -13,7 +13,7 @@ page{
background-color: #fff;
border-radius: 24rpx;
padding:32rpx 40rpx 40rpx;
margin-bottom:50rpx;
margin-bottom:24rpx;
box-shadow: 0px 4px 10px 2px rgba(222, 169, 0, 0.5);
position: relative;
z-index: 1;

View File

@ -17,7 +17,7 @@ Page({
refresherTriggered:true,
genderKV:userApi.genderKV,
cancelling:false,
isShowCancelView:false
isShowCancelView:false,
},
/**
@ -41,7 +41,15 @@ Page({
orderDetail:data,
refresherTriggered:false
})
// return userApi.order.markup.get(this.data.orderId);
})
// .then((data)=>{
// const show = data.result==userApi.order.markup.status.pending&&
// this.data.orderDetail.status==this.data.orderStatus.received
// this.setData({
// isShowMarkupView:show
// })
// })
},
showCancelModal(){
this.setData({

View File

@ -5,6 +5,10 @@
<view class="cancel-reason" wx:if="{{orderDetail.status==orderStatus.cancelled}}">
原因:<label class="reason">{{orderDetail.cancel_reason}}</label>
</view>
<navigator url="/pages/order/markup/index?orderid={{orderDetail.orderid}}"
class="markup-tips right-arrow" wx:if="{{orderDetail.status==orderStatus.received&&orderDetail.order_additional_fee&&orderDetail.order_additional_fee.result=='PENDING'}}">
配送员发起了加价申请,请点击查看
</navigator>
<view class="page-container sender" wx:if="{{orderDetail.deliveryman_user_id}}">
<view class="title">配送员</view>
<view class="spliter"></view>

View File

@ -39,11 +39,15 @@
.order-status.COMPLETED::before,.order-status.CANCELLED::before{
background-color:var(--main-font-color);
}
.cancel-reason{
.cancel-reason,.markup-tips{
background: rgba(255, 195, 0, 0.15);
border-radius: 18rpx;
padding:36rpx;
margin:20rpx;
color: var(--main-font-color);
}
.markup-tips.right-arrow::after{
right:20rpx;
}
.cancel-reason .reason{
font-weight: 500;

136
pages/order/markup/index.js Normal file
View File

@ -0,0 +1,136 @@
import userApi from '../../../api/user';
Page({
/**
* 页面的初始数据
*/
data: {
orderId:'',
applyDetail:{},
cancelling:false,
isShowCancelView:false,
isShowAcceptView:false,
refresherTriggered:false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.data.orderId = options.orderid;
this.getDetail();
},
getDetail(){
this.setData({
refresherTriggered:true
})
userApi.order.markup.get(this.data.orderId).then((data)=>{
this.setData({
applyDetail:data,
refresherTriggered:false
})
})
},
accept(){
this.setData({
isShowAcceptView:true
})
},
acceptRequest(){
userApi.order.markup.accept(this.data.applyDetail.id).then((data)=>{
wx.navigateBack({
success(){
wx.showToast({
title: '加价成功',
})
}
});
this.updatePrePage();
})
},
cancel(){
this.setData({
isShowCancelView:true
})
},
cancelOrder(){
this.setData({
cancelling:true
})
userApi.order.cancel(this.data.orderId).then(()=>{
wx.navigateBack({
success(){
wx.showToast({
title: '取消成功',
})
}
});
this.updatePrePage();
});
},
updatePrePage(){
const pages = getCurrentPages();
const prePage = pages[pages.length-2];
prePage.getOrderDetail();
},
makePhoneCall(){
wx.makePhoneCall({
phoneNumber: this.data.applyDetail.deliveryman_phone,
})
},
viewImage(event){
wx.previewImage({
urls: this.data.applyDetail.photo_urls,
current:event.currentTarget.dataset.item
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,5 @@
{
"usingComponents": {
"modal-view":"/components/modalView"
}
}

View File

@ -0,0 +1,55 @@
<view class="custom-scroll-view">
<scroll-view class="main" bindrefresherrefresh="getDetail" refresher-enabled
refresher-triggered="{{refresherTriggered}}">
<view class="page-container right-arrow order-info">
<view>
<label>订单编号</label>
<label class="value">{{applyDetail.orderid}}</label>
</view>
<view>
<label>申请时间</label>
<label class="value">{{applyDetail.create_time}}</label>
</view>
</view>
<view class="page-container delivery-man">
<view class="head">跑腿员</view>
<view class="spliter"></view>
<view class="info">
<image class="avatar" src="{{applyDetail.deliveryman_avatar||'/assets/icon/my/avatar.png'}}"/>
<view class="name">{{applyDetail.deliveryman_name}}</view>
<button class="button" plain size="mini" bind:tap="makePhoneCall">
<image class="icon" src="/assets/icon/shop/phone@2x.png"/>
<label>联系他</label>
</button>
</view>
</view>
<view class="page-container reason-area">
<view class="head">加价原因</view>
<view class="spliter"></view>
<view class="reason">{{applyDetail.reason}}</view>
<view class="imgs">
<image class="item" src="{{item}}" wx:for="{{applyDetail.photo_urls}}"
wx:key="index" data-item="{{item}}" bind:tap="viewImage"/>
</view>
</view>
<view class="page-container markup-money">
<view>加价金额</view>
<view class="money">{{applyDetail.additional_fee_amount}}</view>
</view>
</scroll-view>
<view class="bottom-bar-v2">
<view class="btns">
<button loading="{{cancelling}}" disabled="{{cancelling}}"
class="cancel" plain bind:tap="cancel">取消订单</button>
<button disabled="{{cancelling}}" class="accept" type="primary"
bind:tap="accept">同意</button>
</view>
</view>
</view>
<modal-view titleText="你确定取消此订单吗?" wx:if="{{isShowCancelView}}"
model:show="{{isShowCancelView}}" bind:ok="cancelOrder"></modal-view>
<modal-view titleText="你确定同意此次加价吗?" wx:if="{{isShowAcceptView}}"
model:show="{{isShowAcceptView}}" bind:ok="acceptRequest"></modal-view>

View File

@ -0,0 +1,80 @@
.page-container .head{
font-size: 34rpx;
font-weight: 500;
}
.page-container .spliter{
margin:30rpx 0;
}
.order-info{
color:#666666;
display: flex;
flex-direction: column;
gap: 36rpx;
}
.order-info::after{
right:20rpx;
}
.order-info .value{
font-size: 32rpx;
color:#222222;
margin-left:30rpx;
}
.delivery-man .info{
display:flex;
align-items: center;
}
.delivery-man .info .avatar{
width:100rpx;height:100rpx;
border-radius: 50%;
}
.delivery-man .info .name{
font-size: 32rpx;
font-weight: 600;
margin-left: 30rpx;
flex:1;
}
.delivery-man .info .button{
border-radius: 10rpx;
font-size: 24rpx;
font-weight: normal;
}
.delivery-man .info .button .icon{
width:24rpx;height:24rpx;
}
.reason-area .imgs{
display: flex;
margin-top:30rpx;
gap: 20rpx;
}
.reason-area .reason{
color:#555555;
}
.reason-area .imgs .item{
width:144rpx;height:144rpx;
border-radius: 12rpx;
}
.markup-money{
display: flex;
padding:40rpx 30rpx;
justify-content: space-between;
align-items: center;
font-size: 32rpx;
font-weight: 500;
}
.markup-money .money{
font-size: 40rpx;
}
.bottom-bar-v2 .btns{
display: flex;
gap: 24rpx;
}
.bottom-bar-v2 .btns .cancel{
width:240rpx;
font-weight: normal;
}
.bottom-bar-v2 .btns .accept{
flex:1;
font-weight: 500;
}