wangfukang 1 week ago
parent
commit
80aabbc99d
  1. 4
      package1/buyFood/buyFood.vue
  2. 76
      package1/order/orderDetail.vue
  3. 98
      package1/order/orderList.vue
  4. 161
      package1/order/returnOrder.vue

4
package1/buyFood/buyFood.vue

@ -673,7 +673,9 @@
}, },
fail: function(err) { fail: function(err) {
that.tui.toast("支付失败或取消"); uni.redirectTo({
url: '/package1/order/orderDetail?id=' + that.currentOrderId
});
} }
}); });
} else { } else {

76
package1/order/orderDetail.vue

@ -134,7 +134,7 @@
<view class="status-btn" style="top: 0;" v-if="orderStatus(orderDetail)" @tap="returnPopupProp(orderDetail)"> <view class="status-btn" style="top: 0;" v-if="orderStatus(orderDetail)" @tap="returnPopupProp(orderDetail)">
取消订单 取消订单
</view> </view>
<view class="status-btn" style="top: 0;" v-if="orderDetail.status == 5" @tap="returnProducts(orderDetail)"> <view class="status-btn" style="top: 0;" v-if="orderDetail.status == 5 && orderDetail.mallRefundRecord == null" @tap="returnProducts(orderDetail)">
申请售后 申请售后
</view> </view>
<view class="status-btn" style="top: 35px;" @tap="refreah(orderDetail)"> <view class="status-btn" style="top: 35px;" @tap="refreah(orderDetail)">
@ -170,8 +170,12 @@
</view> </view>
<view class="box1"> <view class="box1">
<view style="width: 100%;line-height: 70rpx;font-size: 28rpx;font-weight: 700;"> <view style="width: 100%;line-height: 70rpx;font-size: 28rpx;font-weight: 700;">
{{orderDetail.shopName}} {{orderDetail.shopName}}
<img @tap="makeCall(orderDetail.shopPhone)"
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/869a7af6a1c24bf3a0d523c4a18b55c6.png"
alt="" style="width: 60rpx;height: 60rpx;" />
</view> </view>
<view v-for="(item1,index1) in orderDetail.goodsList" :key="index1" v-if="orderDetail.goodsList != null && orderDetail.goodsList.length > 0" style="display: flex;padding: 20rpx;background: #eee;border-radius: 20rpx;"> <view v-for="(item1,index1) in orderDetail.goodsList" :key="index1" v-if="orderDetail.goodsList != null && orderDetail.goodsList.length > 0" style="display: flex;padding: 20rpx;background: #eee;border-radius: 20rpx;">
<view class="goods-img"> <view class="goods-img">
<img :src="item1.productPicture" alt=""> <img :src="item1.productPicture" alt="">
@ -262,6 +266,9 @@
</view> </view>
<view style="color: #000;font-weight: 700;" v-if="orderDetail.deliveryInfo.workerId != null && orderDetail.deliveryInfo.workerId != ''"> <view style="color: #000;font-weight: 700;" v-if="orderDetail.deliveryInfo.workerId != null && orderDetail.deliveryInfo.workerId != ''">
{{orderDetail.deliveryInfo.workerName != null ? orderDetail.deliveryInfo.workerName : ''}} {{orderDetail.deliveryInfo.workerName != null ? orderDetail.deliveryInfo.workerName : ''}}
<img @tap="makeCall(orderDetail.deliveryInfo.workerPhone)"
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/869a7af6a1c24bf3a0d523c4a18b55c6.png"
alt="" style="width: 60rpx;height: 60rpx;" />
</view> </view>
<view style="color: #000;font-weight: 700;" v-else> <view style="color: #000;font-weight: 700;" v-else>
未指定等待接单中 未指定等待接单中
@ -299,15 +306,6 @@
{{orderDetail.deliveryInfo.getTime ? orderDetail.deliveryInfo.getTime : '' | formatTime}} {{orderDetail.deliveryInfo.getTime ? orderDetail.deliveryInfo.getTime : '' | formatTime}}
</view> </view>
</view> </view>
<view style="height: 80rpx;line-height: 80rpx;display: flex;" v-if="orderDetail.deliveryType == 1 && orderDetail.deliveryInfo.workerId != ''">
<view style="flex: 1;color: #777;font-weight: 700;">
配送员送达时间
</view>
<view style="color: #000;font-weight: 700;">
{{orderDetail.deliveryInfo.finishTime ? orderDetail.deliveryInfo.finishTime : '' | formatTime}}
</view>
</view>
<view style="height: 80rpx;line-height: 80rpx;display: flex;" v-if="orderDetail.deliveryType == 1"> <view style="height: 80rpx;line-height: 80rpx;display: flex;" v-if="orderDetail.deliveryType == 1">
<view style="flex: 1;color: #777;font-weight: 700;"> <view style="flex: 1;color: #777;font-weight: 700;">
送达时间 送达时间
@ -332,7 +330,8 @@
<view class="guize-list"> <view class="guize-list">
<view style="height: 80rpx;line-height: 80rpx;font-size: 36rpx;font-weight: 700;text-align: center;"> <view style="height: 80rpx;line-height: 80rpx;font-size: 36rpx;font-weight: 700;text-align: center;">
确定要取消订单吗 确定要取消订单吗
<text v-if="payData.status == 2 || payData.status == 3 || payData.status == 4 || payData.status == 4">取消订单需要商家同意</text> <text v-if="((payData.orderType == 2 || payData.orderType == 3) && payData.status == 2) || payData.status == 3 || payData.status == 4">取消订单需要商家同意</text>
<text v-if="(payData.status == 3 && payData.deliveryType ==1) || payData.status == 4">本单商家备餐时长共计{{payData | shopTime}} 配送员配送时长共计{{payData | peisongTime}}</text>
</view> </view>
<view class="btn" @tap="returnOrder()"> <view class="btn" @tap="returnOrder()">
确认取消 确认取消
@ -377,7 +376,7 @@
}, },
formatTime(value) { formatTime(value) {
if (!value) return ''; if (!value) return '';
if(value == '尽快送达') return '尽快送达';
const date = new Date(value); const date = new Date(value);
// //
@ -400,6 +399,52 @@
// -- :: // -- ::
return `${year}-${month}-${day} ${hour}:${minute}:${second}`; return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
},
shopTime(item){
if(item.shopMakeTime == null){
return '商家还未出餐';
}
const date1 = new Date(item.deliveryInfo.acceptTime);
const date2 = new Date(item.shopMakeTime);
// 2. ()
let diffMs = Math.abs(date2 - date1);
// 3.
// 1 = 1000
// 1 = 60
// 1 = 60
const seconds = Math.floor((diffMs / 1000) % 60);
const minutes = Math.floor((diffMs / (1000 * 60)) % 60);
const hours = Math.floor(diffMs / (1000 * 60 * 60));
// 4. ( 9 -> 09)
const fmt = (num) => num.toString().padStart(2, '0');
return `${fmt(hours)}${fmt(minutes)}${fmt(seconds)}`;
},
peisongTime(item){
if(item.shopMakeTime == null){
return '商家还未出餐';
}
const date1 = new Date(item.shopMakeTime);
const date2 = new Date();
// 2. ()
let diffMs = Math.abs(date2 - date1);
// 3.
// 1 = 1000
// 1 = 60
// 1 = 60
const seconds = Math.floor((diffMs / 1000) % 60);
const minutes = Math.floor((diffMs / (1000 * 60)) % 60);
const hours = Math.floor(diffMs / (1000 * 60 * 60));
// 4. ( 9 -> 09)
const fmt = (num) => num.toString().padStart(2, '0');
return `${fmt(hours)}${fmt(minutes)}${fmt(seconds)}`;
} }
}, },
onLoad(option) { onLoad(option) {
@ -415,6 +460,11 @@
openCode(){ openCode(){
this.$refs.imgPopup.open() this.$refs.imgPopup.open()
}, },
makeCall(phone){
uni.makePhoneCall({
phoneNumber: phone
});
},
orderStatus(item){ orderStatus(item){
if(item.status == 0 || item.status == 10 || item.status == 2 || (item.status == 3 && item.deliveryType == 1) || (item.status == 3 && item.deliveryType == 2) || item.status == 4){ if(item.status == 0 || item.status == 10 || item.status == 2 || (item.status == 3 && item.deliveryType == 1) || (item.status == 3 && item.deliveryType == 2) || item.status == 4){
return true; return true;

98
package1/order/orderList.vue

@ -118,6 +118,12 @@
<view class="ziqu-xuanfu" v-if="item.status == 8"> <view class="ziqu-xuanfu" v-if="item.status == 8">
已退款 已退款
</view> </view>
<view class="ziqu-xuanfu" v-if="item.status == 11">
售后中
</view>
<view class="ziqu-xuanfu" v-if="item.status == 12">
已售后
</view>
<view style="width: 100%;line-height: 70rpx;font-size: 28rpx;font-weight: 700;display: flex;"> <view style="width: 100%;line-height: 70rpx;font-size: 28rpx;font-weight: 700;display: flex;">
<view style="height: 40rpx;line-height: 40rpx;background: linear-gradient(90deg, rgba(255, 77, 0, 1), rgba(255, 184, 84, 1));padding: 0 16rpx;border-radius: 40rpx;color: #fff;margin: 14rpx 20rpx 0 0;"> <view style="height: 40rpx;line-height: 40rpx;background: linear-gradient(90deg, rgba(255, 77, 0, 1), rgba(255, 184, 84, 1));padding: 0 16rpx;border-radius: 40rpx;color: #fff;margin: 14rpx 20rpx 0 0;">
{{item.orderType == 4 ? '快递' : item.orderType == 5 ? '跑腿' : item.orderType == 6 ? '二手':"饭团"}} {{item.orderType == 4 ? '快递' : item.orderType == 5 ? '跑腿' : item.orderType == 6 ? '二手':"饭团"}}
@ -245,6 +251,7 @@
<view style="height: 80rpx;line-height: 80rpx;font-size: 36rpx;font-weight: 700;text-align: center;"> <view style="height: 80rpx;line-height: 80rpx;font-size: 36rpx;font-weight: 700;text-align: center;">
确定要取消订单吗 确定要取消订单吗
<text v-if="payData.status == 2 || payData.status == 3 || payData.status == 4 || payData.status == 4">取消订单需要商家同意</text> <text v-if="payData.status == 2 || payData.status == 3 || payData.status == 4 || payData.status == 4">取消订单需要商家同意</text>
<text v-if="(payData.status == 3 && payData.deliveryType ==1) || payData.status == 4">本单商家备餐时长共计{{payData | shopTime}} 配送员配送时长共计{{payData | peisongTime}}</text>
</view> </view>
<view class="btn" @tap="returnOrder()"> <view class="btn" @tap="returnOrder()">
确认取消 确认取消
@ -285,6 +292,97 @@
this.searchForm.pageNum++; this.searchForm.pageNum++;
this.getOrderList(); this.getOrderList();
}, },
filters: {
formatHourMinute(value) {
if (!value) return '';
const date = new Date(value);
// (getDate)0
const day = String(date.getDate()).padStart(2, '0');
// (getHours)0
const hour = String(date.getHours()).padStart(2, '0');
// (getMinutes)0
const minute = String(date.getMinutes()).padStart(2, '0');
// --:
return `${day}-${hour}:${minute}`;
},
formatTime(value) {
if (!value) return '';
if(value == '尽快送达') return '尽快送达';
const date = new Date(value);
//
const year = date.getFullYear();
// (getMonth 0-11 +1)0
const month = String(date.getMonth() + 1).padStart(2, '0');
// (getDate)0
const day = String(date.getDate()).padStart(2, '0');
// (getHours)0
const hour = String(date.getHours()).padStart(2, '0');
// (getMinutes)0
const minute = String(date.getMinutes()).padStart(2, '0');
// (getSeconds)0
const second = String(date.getSeconds()).padStart(2, '0');
// -- ::
return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
},
shopTime(item){
if(item.shopMakeTime == null){
return '商家还未出餐';
}
const date1 = new Date(item.deliveryInfo.acceptTime);
const date2 = new Date(item.shopMakeTime);
// 2. ()
let diffMs = Math.abs(date2 - date1);
// 3.
// 1 = 1000
// 1 = 60
// 1 = 60
const seconds = Math.floor((diffMs / 1000) % 60);
const minutes = Math.floor((diffMs / (1000 * 60)) % 60);
const hours = Math.floor(diffMs / (1000 * 60 * 60));
// 4. ( 9 -> 09)
const fmt = (num) => num.toString().padStart(2, '0');
return `${fmt(hours)}${fmt(minutes)}${fmt(seconds)}`;
},
peisongTime(item){
if(item.shopMakeTime == null){
return '商家还未出餐';
}
const date1 = new Date(item.shopMakeTime);
const date2 = new Date();
// 2. ()
let diffMs = Math.abs(date2 - date1);
// 3.
// 1 = 1000
// 1 = 60
// 1 = 60
const seconds = Math.floor((diffMs / 1000) % 60);
const minutes = Math.floor((diffMs / (1000 * 60)) % 60);
const hours = Math.floor(diffMs / (1000 * 60 * 60));
// 4. ( 9 -> 09)
const fmt = (num) => num.toString().padStart(2, '0');
return `${fmt(hours)}${fmt(minutes)}${fmt(seconds)}`;
}
},
onLoad(option) { onLoad(option) {
this.getOrderList() this.getOrderList()
}, },

161
package1/order/returnOrder.vue

@ -22,7 +22,7 @@
<view class="goods-content"> <view class="goods-content">
<view class="goods-name"> <view class="goods-name">
{{item1.productName}} {{item1.productName}}
<view class="goods-num"> <view class="goods-num" v-if="sellTime == 0">
<view class="num-plus" style="background: #999;color: #fff;" <view class="num-plus" style="background: #999;color: #fff;"
@tap="changeValue('minus',index1)"> @tap="changeValue('minus',index1)">
- -
@ -171,9 +171,33 @@
{{orderDetail.deliveryInfo.finishTime ? orderDetail.deliveryInfo.finishTime : '尽快送达' | formatTime}} {{orderDetail.deliveryInfo.finishTime ? orderDetail.deliveryInfo.finishTime : '尽快送达' | formatTime}}
</view> </view>
</view> </view>
<uni-forms-item label="上传图片" name="pictures">
<view class="upload-img" @tap="pictureAdd"
style="background: #eee;text-align: center;line-height: 160rpx;">
<uni-icons type="camera" size="28" color="#777"></uni-icons>
</view>
<view style="overflow-x: scroll;display: flex;width: 350rpx;">
<view v-if="returnData.pictures !=''" style="width: 160rpx;height: 160rpx;margin-left: 20rpx;">
<img :src="returnData.pictures" alt="" class="upload-img">
</view>
</view>
</uni-forms-item>
<view class="content-box" style="line-height: 200rpx;">
<view class="content-title">
订单备注<text>*</text>
</view>
<view style="height: 200rpx;background: #eee;border-radius: 40rpx;padding: 20rpx;width: 70%;">
<textarea name="" id="" cols="30" rows="10" placeholder="请填写备注" v-model="returnData.reason"
style="height: 160rpx;width: 100%;"></textarea>
</view>
</view>
<view class="btn"
@tap.stop="$refs.carPopup.open()">
售后原因
</view>
<view class="btn" <view class="btn"
@tap.stop=""> @tap.stop="submit()">
申请售后{{allReturnPrice}} 申请售后{{returnData.refundAmount}}
</view> </view>
</view> </view>
</view> </view>
@ -181,9 +205,9 @@
</view> </view>
<!-- 退款原因弹窗 --> <!-- 退款原因弹窗 -->
<uni-popup ref="carPopup" background-color="#fff"> <uni-popup ref="carPopup" background-color="#fff" :mask-click="false">
<view class="car-content"> <view class="car-content">
<view class="car-close" @tap="$refs.carPopup.close()"> <view class="car-close">
<uni-icons type="close" size="30" color="#fff"></uni-icons> <uni-icons type="close" size="30" color="#fff"></uni-icons>
</view> </view>
<view class="car-title"> <view class="car-title">
@ -206,8 +230,12 @@
全额退款配送员原因 全额退款配送员原因
<radio :checked="sellTime==3" name="sellTime" @click="checkSellTime(3)" /> <radio :checked="sellTime==3" name="sellTime" @click="checkSellTime(3)" />
</view> </view>
<view class="">
全额退款商家+配送员原因
<radio :checked="sellTime==4" name="sellTime" @click="checkSellTime(4)" />
</view>
</view> </view>
<view class="btn">确认</view> <view class="btn" @tap="chooseReturnType()">确认</view>
</view> </view>
</uni-popup> </uni-popup>
@ -233,8 +261,10 @@
pintuan:false, pintuan:false,
menuButtonInfo: {}, menuButtonInfo: {},
orderId:'', orderId:'',
allReturnPrice:0,
vModelValue:0, vModelValue:0,
returnData:{
refundAmount:0
},
payData:{}, payData:{},
orderDetail:{}, orderDetail:{},
codeImg:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/3a4e68eb14d7417cbb4f15fa85907c64.jpg' codeImg:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/3a4e68eb14d7417cbb4f15fa85907c64.jpg'
@ -298,9 +328,120 @@
this.$refs.carPopup.open('bottom'); this.$refs.carPopup.open('bottom');
}, },
methods: { methods: {
chooseReturnType(){
this.$refs.carPopup.close()
if(this.sellTime == 0){
this.returnData.refundAmount = 0
this.returnData.refundType = 1
}else if(this.sellTime == 1){
this.returnData.refundAmount = this.orderDetail.deliveryFee
this.returnData.refundType = 2
}else if(this.sellTime == 2){
this.returnData.refundAmount = this.orderDetail.totalAmount
this.returnData.refundType = 3
this.returnData.refundTypeStatus = 1
}else if(this.sellTime == 3){
this.returnData.refundAmount = this.orderDetail.totalAmount
this.returnData.refundType = 3
this.returnData.refundTypeStatus = 2
}else{
this.returnData.refundAmount = this.orderDetail.totalAmount
this.returnData.refundType = 3
this.returnData.refundTypeStatus = 3
}
this.changeProduct()
},
changeProduct(){
for(let i = 0; i< this.orderDetail.goodsList.length;i++){
if(this.orderDetail.goodsList[i].returnCount){
this.orderDetail.goodsList[i].returnCount = 0
}
}
},
pictureAdd(id, huan) {
let that = this
uni.chooseMedia({
count: 9,
mediaType: ['image'],
sourceType: ['album', 'camera'],
success(res) {
uni.showLoading({
title: '加载中...',
mask: true
})
for (let i = 0; i < res.tempFiles.length; i++) {
that.upLoadFile(res.tempFiles[i].tempFilePath)
}
}
})
},
async upLoadFile(path) {
let that = this;
let hiver_token = uni.getStorageSync("hiver_token")
await uni.uploadFile({
url: that.tui.interfaceUrl() + '/upload/file',
filePath: path,
name: 'file',
header: {
"content-type": "multipart/form-data",
'accessToken': hiver_token
},
formData: {},
success: (uploadFileRes) => {
let pathData = JSON.parse(uploadFileRes.data)
that.returnData.pictures = pathData.result
that.$forceUpdate()
},
fail: (err) => {
uni.hideLoading();
uni.showToast({
title: JSON.stringify(err),
icon: 'none'
})
}
});
await setTimeout(res => {
uni.hideLoading();
}, 1000)
},
checkSellTime(type){ checkSellTime(type){
this.sellTime = type; this.sellTime = type;
}, },
submit(){
this.returnData.orderId = this.orderDetail.id
this.returnData.userId = this.orderDetail.userId
this.returnData.shopId = this.orderDetail.shopId
if(this.orderDetail.deliveryInfo){
this.returnData.workerId = this.orderDetail.deliveryInfo.workerId
}
this.returnData.items = [];
for(let i = 0; i< this.orderDetail.goodsList.length;i++){
if(this.orderDetail.goodsList[i].returnCount){
this.orderDetail.goodsList[i].quantity = this.orderDetail.goodsList[i].returnCount
console.log(this.orderDetail.goodsList[i])
this.orderDetail.goodsList[i].price = Number(this.orderDetail.goodsList[i].price) + Number(this.orderDetail.goodsList[i].packageFee)
this.returnData.items.push(this.orderDetail.goodsList[i])
}
}
uni.showLoading({
title: '提交售后中...'
});
this.tui.request("/mall/refund/create", "POST", this.returnData, false, false).then(res => {
uni.hideLoading();
if (res.code == 200) {
uni.redirectTo({
url: '/package1/order/orderDetail?id=' + this.orderDetail.id
});
} else {
uni.showToast({
title: res.message || '提交失败',
icon: 'none'
});
}
}).catch(err => {
uni.hideLoading();
});
},
openCode(){ openCode(){
this.$refs.imgPopup.open() this.$refs.imgPopup.open()
}, },
@ -322,11 +463,13 @@
if(type == 'plus'){ if(type == 'plus'){
if((this.orderDetail.goodsList[index].returnCount + 1) <= this.orderDetail.goodsList[index].quantity){ if((this.orderDetail.goodsList[index].returnCount + 1) <= this.orderDetail.goodsList[index].quantity){
this.orderDetail.goodsList[index].returnCount += 1 this.orderDetail.goodsList[index].returnCount += 1
this.allReturnPrice += Number(Number(this.orderDetail.goodsList[index].price + this.orderDetail.goodsList[index].packageFee).toFixed(2)) this.returnData.refundAmount += Number(Number(this.orderDetail.goodsList[index].price + this.orderDetail.goodsList[index].packageFee).toFixed(2))
this.returnData.refundAmount = Number(this.returnData.refundAmount.toFixed(2))
} }
}else{ }else{
if(this.orderDetail.goodsList[index].returnCount > 0){ if(this.orderDetail.goodsList[index].returnCount > 0){
this.allReturnPrice -= Number(Number(this.orderDetail.goodsList[index].price + this.orderDetail.goodsList[index].packageFee).toFixed(2)) this.returnData.refundAmount -= Number(Number(this.orderDetail.goodsList[index].price + this.orderDetail.goodsList[index].packageFee).toFixed(2))
this.returnData.refundAmount = Number(this.returnData.refundAmount.toFixed(2))
} }
this.orderDetail.goodsList[index].returnCount = this.orderDetail.goodsList[index].returnCount > 0 ?this.orderDetail.goodsList[index].returnCount -= 1:0 this.orderDetail.goodsList[index].returnCount = this.orderDetail.goodsList[index].returnCount > 0 ?this.orderDetail.goodsList[index].returnCount -= 1:0
} }

Loading…
Cancel
Save