diff --git a/package1/buyFood/buyFood.vue b/package1/buyFood/buyFood.vue
index 1b4251b..22f38ff 100644
--- a/package1/buyFood/buyFood.vue
+++ b/package1/buyFood/buyFood.vue
@@ -673,7 +673,9 @@
},
fail: function(err) {
- that.tui.toast("支付失败或取消");
+ uni.redirectTo({
+ url: '/package1/order/orderDetail?id=' + that.currentOrderId
+ });
}
});
} else {
diff --git a/package1/order/orderDetail.vue b/package1/order/orderDetail.vue
index b4f5afb..af7ca60 100644
--- a/package1/order/orderDetail.vue
+++ b/package1/order/orderDetail.vue
@@ -134,7 +134,7 @@
取消订单
-
+
申请售后
@@ -170,8 +170,12 @@
- {{orderDetail.shopName}}
+ {{orderDetail.shopName}}
+
+
@@ -262,6 +266,9 @@
{{orderDetail.deliveryInfo.workerName != null ? orderDetail.deliveryInfo.workerName : ''}}
+
未指定等待接单中
@@ -299,15 +306,6 @@
{{orderDetail.deliveryInfo.getTime ? orderDetail.deliveryInfo.getTime : '' | formatTime}}
-
-
- 配送员送达时间
-
-
- {{orderDetail.deliveryInfo.finishTime ? orderDetail.deliveryInfo.finishTime : '' | formatTime}}
-
-
-
送达时间
@@ -332,7 +330,8 @@
确定要取消订单吗
- 取消订单需要商家同意
+ 取消订单需要商家同意
+ 本单商家备餐时长共计{{payData | shopTime}} 配送员配送时长共计{{payData | peisongTime}}
确认取消
@@ -377,7 +376,7 @@
},
formatTime(value) {
if (!value) return '';
-
+ if(value == '尽快送达') return '尽快送达';
const date = new Date(value);
// 获取年份
@@ -400,6 +399,52 @@
// 拼接格式:年-月-日 时:分:秒
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) {
@@ -415,6 +460,11 @@
openCode(){
this.$refs.imgPopup.open()
},
+ makeCall(phone){
+ uni.makePhoneCall({
+ phoneNumber: phone
+ });
+ },
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){
return true;
diff --git a/package1/order/orderList.vue b/package1/order/orderList.vue
index f3923ac..e0e5b7f 100644
--- a/package1/order/orderList.vue
+++ b/package1/order/orderList.vue
@@ -118,6 +118,12 @@
已退款
+
+ 售后中
+
+
+ 已售后
+
{{item.orderType == 4 ? '快递' : item.orderType == 5 ? '跑腿' : item.orderType == 6 ? '二手':"饭团"}}
@@ -245,6 +251,7 @@
确定要取消订单吗
取消订单需要商家同意
+ 本单商家备餐时长共计{{payData | shopTime}} 配送员配送时长共计{{payData | peisongTime}}
确认取消
@@ -285,6 +292,97 @@
this.searchForm.pageNum++;
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) {
this.getOrderList()
},
diff --git a/package1/order/returnOrder.vue b/package1/order/returnOrder.vue
index 6d657bc..16aeab0 100644
--- a/package1/order/returnOrder.vue
+++ b/package1/order/returnOrder.vue
@@ -22,7 +22,7 @@
{{item1.productName}}
-
+
-
@@ -171,9 +171,33 @@
{{orderDetail.deliveryInfo.finishTime ? orderDetail.deliveryInfo.finishTime : '尽快送达' | formatTime}}
+
+
+
+
+
+
+
+
+
+
+
+
+ 订单备注*
+
+
+
+
+
+
+ 售后原因
+
- 申请售后¥{{allReturnPrice}}
+ @tap.stop="submit()">
+ 申请售后¥{{returnData.refundAmount}}
@@ -181,9 +205,9 @@
-
+
-
+
@@ -206,8 +230,12 @@
全额退款(配送员原因)
+
+ 全额退款(商家+配送员原因)
+
+
- 确认
+ 确认
@@ -233,8 +261,10 @@
pintuan:false,
menuButtonInfo: {},
orderId:'',
- allReturnPrice:0,
vModelValue:0,
+ returnData:{
+ refundAmount:0
+ },
payData:{},
orderDetail:{},
codeImg:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/3a4e68eb14d7417cbb4f15fa85907c64.jpg'
@@ -298,9 +328,120 @@
this.$refs.carPopup.open('bottom');
},
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){
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(){
this.$refs.imgPopup.open()
},
@@ -322,11 +463,13 @@
if(type == 'plus'){
if((this.orderDetail.goodsList[index].returnCount + 1) <= this.orderDetail.goodsList[index].quantity){
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{
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
}