wangfukang 1 week ago
parent
commit
6eb440d013
  1. 2
      package1/buyFood/buyFood.vue
  2. 15
      package1/group/groupBuySingle.vue
  3. 150
      package1/order/orderDetail.vue
  4. 145
      package1/order/orderList.vue
  5. 5
      package1/order/returnOrder.vue

2
package1/buyFood/buyFood.vue

@ -643,7 +643,7 @@
if (!this.currentOrderId || !this.backendTotalAmount) return;
let amountInCents = Math.round(this.backendTotalAmount * 100);
let payDesc = this.isGroupBuy ? '拼团订单' : '商城订单';
let payDesc = '商城订单';
this.tui.request("/api/wechat/pay/unified-order", "POST", {
openid: uni.getStorageSync('miniProgramOpenid') || 'test-openid',

15
package1/group/groupBuySingle.vue

@ -1020,6 +1020,12 @@
}
let packageFee = parseFloat(this.currentItem.lunchBox || 0);
this.currentItem.moreBuyData = []
for(let i = 0;i<this.moreBuyData.length;i++){
if(this.moreBuyData[i].quantity != undefined && this.moreBuyData[i].quantity > 0){
this.currentItem.moreBuyData.push(this.moreBuyData[i])
}
}
if (this.groupId && this.isFaceToFaceGroup) {
// Direct face-to-face pay path
this.submitFTFJoinPay(specChoices);
@ -1027,12 +1033,7 @@
}
// Pack data for checkout
this.currentItem.moreBuyData = []
for(let i = 0;i<this.moreBuyData.length;i++){
if(this.moreBuyData[i].quantity != undefined && this.moreBuyData[i].quantity > 0){
this.currentItem.moreBuyData.push(this.moreBuyData[i])
}
}
let goData = {
item: this.currentItem,
groupRule: this.selectedGroupRule,
@ -1279,7 +1280,7 @@
this.tui.request("/api/wechat/pay/unified-order", "POST", {
openid: uni.getStorageSync('miniProgramOpenid') || 'test-openid',
amount: amountInCents,
description: '拼团参与订单',
description: '商城订单',
outTradeNo: this.currentOrderId
}, false, false).then((res) => {
if (res.code == 200) {

150
package1/order/orderDetail.vue

@ -114,7 +114,7 @@
<text v-if="orderDetail.status == 3 && orderDetail.deliveryType == 2">待消费</text>
<text v-if="orderDetail.status == 4 && orderDetail.deliveryType == 1">配送员已取货</text>
<text v-if="orderDetail.status == 5">订单已完成</text>
<text v-if="orderDetail.status == 7">等待商家同意退款</text>
<text v-if="orderDetail.status == 7">等待同意退款</text>
<text v-if="orderDetail.status == 6">订单已取消</text>
<text v-if="orderDetail.status == 8">订单已退款</text>
<text v-if="orderDetail.status == 11">售后中</text>
@ -264,7 +264,7 @@
<view style="flex: 1;color: #777;font-weight: 700;">
配送员
</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 && orderDetail.deliveryInfo.workerId != null && orderDetail.deliveryInfo.workerId != ''">
{{orderDetail.deliveryInfo.workerName != null ? orderDetail.deliveryInfo.workerName : ''}}
<img @tap="makeCall(orderDetail.deliveryInfo.workerPhone)"
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/869a7af6a1c24bf3a0d523c4a18b55c6.png"
@ -274,7 +274,7 @@
未指定等待接单中
</view>
</view>
<view style="height: 80rpx;line-height: 80rpx;display: flex;" v-if="orderDetail.deliveryType == 1 && orderDetail.deliveryInfo.workerId">
<view style="height: 80rpx;line-height: 80rpx;display: flex;" v-if="orderDetail.deliveryInfo && orderDetail.deliveryType == 1 && orderDetail.deliveryInfo.workerId">
<view style="flex: 1;color: #777;font-weight: 700;">
配送员接单时间
</view>
@ -286,19 +286,19 @@
<view style="flex: 1;color: #777;font-weight: 700;">
商家出餐时间
</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 && orderDetail.deliveryInfo.workerId != null && orderDetail.deliveryInfo.workerId != ''">
{{orderDetail.shopMakeTime ? orderDetail.shopMakeTime : '' | formatTime}}
</view>
</view>
<view style="height: 80rpx;line-height: 80rpx;display: flex;" v-if="orderDetail.deliveryType == 1 && orderDetail.deliveryInfo.workerId != ''">
<view style="height: 80rpx;line-height: 80rpx;display: flex;" v-if="orderDetail.deliveryInfo && orderDetail.deliveryType == 1 && orderDetail.deliveryInfo.workerId != ''">
<view style="flex: 1;color: #777;font-weight: 700;">
配送员到店时间
</view>
<view style="color: #000;font-weight: 700;">
<view style="color: #000;font-weight: 700;" v-if="orderDetail.deliveryInfo">
{{orderDetail.deliveryInfo.arriveTime ? orderDetail.deliveryInfo.arriveTime : '' | formatTime}}
</view>
</view>
<view style="height: 80rpx;line-height: 80rpx;display: flex;" v-if="orderDetail.deliveryType == 1 && orderDetail.deliveryInfo.workerId != ''">
<view style="height: 80rpx;line-height: 80rpx;display: flex;" v-if="orderDetail.deliveryInfo && orderDetail.deliveryType == 1 && orderDetail.deliveryInfo.workerId != ''">
<view style="flex: 1;color: #777;font-weight: 700;">
配送员取货时间
</view>
@ -310,7 +310,7 @@
<view style="flex: 1;color: #777;font-weight: 700;">
送达时间
</view>
<view style="color: #000;font-weight: 700;">
<view style="color: #000;font-weight: 700;" v-if="orderDetail.deliveryInfo">
{{orderDetail.deliveryInfo.finishTime ? orderDetail.deliveryInfo.finishTime : '尽快送达' | formatTime}}
</view>
</view>
@ -327,11 +327,36 @@
</uni-popup>
<uni-popup ref="returnPopup" background-color="#fff" style="height: 1600rpx !important;">
<view class="car-content" v-if="orderDetail.deliveryType == 1 && orderDetail.status != 10">
<view class="car-close">
<uni-icons type="close" size="30" color="#fff"></uni-icons>
</view>
<view class="car-title">
选择退款原因
</view>
<view class="">
<view class="">
全额退款商家原因
<radio :checked="sellTime==2" name="sellTime" @click="checkSellTime(2)" />
</view>
<view class="">
全额退款配送员原因
<radio :checked="sellTime==3" name="sellTime" @click="checkSellTime(3)" />
</view>
<view class="">
全额退款商家+配送员原因
<radio :checked="sellTime==4" name="sellTime" @click="checkSellTime(4)" />
</view>
</view>
</view>
<view class="guize-list">
<view style="height: 80rpx;line-height: 80rpx;font-size: 36rpx;font-weight: 700;text-align: center;">
确定要取消订单吗
<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>
<text v-if="((payData.orderType == 2 || payData.orderType == 3) && payData.status == 2) || ((payData.orderType == 2 || payData.orderType == 3) && payData.status == 3) || (payData.deliveryType == 1 && payData.status == 3) || payData.status == 4">取消订单需要商家同意</text>
<view v-if="(payData.status == 3 && payData.deliveryType ==1) || payData.status == 4">
<text v-if="payData.shopMakeTime == null">商家还未出餐</text>
<text v-else>本单商家备餐时长共计{{shopTime}} 配送员配送时长共计{{peisongTime}}</text>
</view>
</view>
<view class="btn" @tap="returnOrder()">
确认取消
@ -346,7 +371,12 @@
data() {
return {
pintuan:false,
sellTime:2,
menuButtonInfo: {},
refundType:3,
refundTypeStatus:4,
shopTime:'',
peisongTime:'',
orderId:'',
payData:{},
orderDetail:{},
@ -399,52 +429,6 @@
// -- ::
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) {
@ -460,6 +444,22 @@
openCode(){
this.$refs.imgPopup.open()
},
checkSellTime(type){
this.sellTime = type;
if(this.sellTime == 2){
//this.returnData.refundAmount = this.orderDetail.totalAmount
this.refundType = 3
this.refundTypeStatus = 1
}else if(this.sellTime == 3){
//this.returnData.refundAmount = this.orderDetail.totalAmount
this.refundType = 3
this.refundTypeStatus = 2
}else{
//this.returnData.refundAmount = this.orderDetail.totalAmount
this.refundType = 3
this.refundTypeStatus = 3
}
},
makeCall(phone){
uni.makePhoneCall({
phoneNumber: phone
@ -473,13 +473,48 @@
},
returnPopupProp(item){
this.payData = item;
if(this.payData.shopMakeTime != null){
const date1 = new Date(this.payData.deliveryInfo.acceptTime);
const date2 = new Date(this.payData.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');
this.shopTime = `${fmt(hours)}${fmt(minutes)}${fmt(seconds)}`;
const date3 = new Date();
// 2. ()
let diffMs1 = Math.abs(date3 - date2);
// 3.
// 1 = 1000
// 1 = 60
// 1 = 60
const seconds1 = Math.floor((diffMs1 / 1000) % 60);
const minutes1 = Math.floor((diffMs1 / (1000 * 60)) % 60);
const hours1 = Math.floor(diffMs1 / (1000 * 60 * 60));
this.peisongTime = `${fmt(hours1)}${fmt(minutes1)}${fmt(seconds1)}`;
}
this.$refs.returnPopup.open('bottom');
},
returnOrder(){
this.$refs.returnPopup.close();
let item = this.payData
let that = this
that.tui.request("/mall/order/cancel", "POST", {orderId:item.id,userId:uni.getStorageSync('id')}, false, true).then((res) => {
that.tui.request("/mall/order/cancel", "POST", {refundType:this.refundType,refundTypeStatus:this.refundTypeStatus,orderId:item.id,userId:uni.getStorageSync('id')}, false, true).then((res) => {
if (res.code == 200) {
that.tui.toast("取消订单成功");
that.getOrderDetail(item.id)
@ -501,6 +536,7 @@
});
},
getOrderDetail(id){
this.pintuan = false;
let that = this
that.tui.request("/mall/order/detail/"+id, "GET", {}, false, true).then((res) => {
if (res.code == 200) {

145
package1/order/orderList.vue

@ -113,7 +113,7 @@
已取消
</view>
<view class="ziqu-xuanfu" v-if="item.status == 7">
商家同意退款
待同意退款
</view>
<view class="ziqu-xuanfu" v-if="item.status == 8">
已退款
@ -184,9 +184,9 @@
</view>
</view>
<view class="bottom-btn">
<view class="btn1" v-if="orderStatus(item)" @tap="returnPopupProp(item)">
<!-- <view class="btn1" v-if="orderStatus(item)" @tap="returnPopupProp(item)">
取消订单
</view>
</view> -->
<view class="btn1" v-if="item.status == 0" @tap="payAgain(item)"
style="background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));color: #000;">
去支付
@ -247,11 +247,36 @@
</uni-popup>
<uni-popup ref="returnPopup" background-color="#fff" style="height: 1600rpx !important;">
<view class="car-content">
<view class="car-close">
<uni-icons type="close" size="30" color="#fff"></uni-icons>
</view>
<view class="car-title">
选择退款原因
</view>
<view class="">
<view class="">
全额退款商家原因
<radio :checked="sellTime==2" name="sellTime" @click="checkSellTime(2)" />
</view>
<view class="">
全额退款配送员原因
<radio :checked="sellTime==3" name="sellTime" @click="checkSellTime(3)" />
</view>
<view class="">
全额退款商家+配送员原因
<radio :checked="sellTime==4" name="sellTime" @click="checkSellTime(4)" />
</view>
</view>
</view>
<view class="guize-list">
<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 == 3 && payData.deliveryType ==1) || payData.status == 4">本单商家备餐时长共计{{payData | shopTime}} 配送员配送时长共计{{payData | peisongTime}}</text>
<text v-if="((payData.orderType == 2 || payData.orderType == 3) && payData.status == 2) || payData.status == 3 || payData.status == 4">取消订单需要商家同意</text>
<view v-if="(payData.status == 3 && payData.deliveryType ==1) || payData.status == 4">
<text v-if="payData.shopMakeTime == null">商家还未出餐</text>
<text v-else>本单商家备餐时长共计{{shopTime}} 配送员配送时长共计{{peisongTime}}</text>
</view>
</view>
<view class="btn" @tap="returnOrder()">
确认取消
@ -273,6 +298,11 @@
tab2Checked: 10,
totalPages: 1,
pageNum:1,
shopTime:'',
peisongTime:'',
sellTime:2,
refundType:2,
refundTypeStatus:1,
payData:{},
orderList:[],
searchForm:{
@ -335,52 +365,6 @@
// -- ::
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) {
@ -404,6 +388,22 @@
this.searchForm.pageNum = 1
this.getOrderList()
},
checkSellTime(type){
this.sellTime = type;
if(this.sellTime == 2){
//this.returnData.refundAmount = this.orderDetail.totalAmount
this.refundType = 3
this.refundTypeStatus = 1
}else if(this.sellTime == 3){
//this.returnData.refundAmount = this.orderDetail.totalAmount
this.refundType = 3
this.refundTypeStatus = 2
}else{
//this.returnData.refundAmount = this.orderDetail.totalAmount
this.refundType = 3
this.refundTypeStatus = 3
}
},
goSearch(){
this.searchForm.pageNum = 1
this.getOrderList()
@ -417,7 +417,7 @@
this.tui.request("/api/wechat/pay/unified-order", "POST", {
openid: uni.getStorageSync('miniProgramOpenid') || 'test-openid',
amount: amountInCents,
description: '拼团参与订单',
description: '商城订单',
outTradeNo: this.payData.id
}, false, false).then((res) => {
if (res.code == 200) {
@ -493,14 +493,49 @@
}).catch((res) => {});
},
returnPopupProp(item){
this.payData = item;
this.$refs.returnPopup.open('bottom');
this.payData = item;
if(this.payData.shopMakeTime != null){
const date1 = new Date(this.payData.deliveryInfo.acceptTime);
const date2 = new Date(this.payData.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');
this.shopTime = `${fmt(hours)}${fmt(minutes)}${fmt(seconds)}`;
const date3 = new Date();
// 2. ()
let diffMs1 = Math.abs(date3 - date2);
// 3.
// 1 = 1000
// 1 = 60
// 1 = 60
const seconds1 = Math.floor((diffMs1 / 1000) % 60);
const minutes1 = Math.floor((diffMs1 / (1000 * 60)) % 60);
const hours1 = Math.floor(diffMs1 / (1000 * 60 * 60));
this.peisongTime = `${fmt(hours1)}${fmt(minutes1)}${fmt(seconds1)}`;
}
this.$refs.returnPopup.open('bottom');
},
returnOrder(){
this.$refs.returnPopup.close();
let item = this.payData
let that = this
that.tui.request("/mall/order/cancel", "POST", {orderId:item.id,userId:uni.getStorageSync('id')}, false, true).then((res) => {
that.tui.request("/mall/order/cancel", "POST", {refundType:this.refundType,refundTypeStatus:this.refundTypeStatus,orderId:item.id,userId:uni.getStorageSync('id')}, false, true).then((res) => {
if (res.code == 200) {
that.tui.toast("取消订单成功");
that.searchForm.pageNum = 1

5
package1/order/returnOrder.vue

@ -411,14 +411,17 @@
this.returnData.orderId = this.orderDetail.id
this.returnData.userId = this.orderDetail.userId
this.returnData.shopId = this.orderDetail.shopId
this.returnData.goodsAmount = this.orderDetail.goodsAmount
this.returnData.packageFee = this.orderDetail.packageFee
if(this.orderDetail.deliveryInfo){
this.returnData.workerId = this.orderDetail.deliveryInfo.workerId
this.returnData.deliveryFee = this.orderDetail.deliveryFee
}
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])
}

Loading…
Cancel
Save