对接售后接口 - 申请退款 确认收货 取消订单

This commit is contained in:
赵毅 2025-08-19 09:55:09 +08:00
parent 8418040927
commit 5b934ecd17
7 changed files with 180 additions and 31 deletions

5
api/afterSale.js Normal file
View File

@ -0,0 +1,5 @@
export const apiArr = {
afterSaleCreate: "/api/v2/wechat/commodity/after-sales/refund-info/create", //商品订单售后信息创建
cancelOrConfirm: "/api/v2/wechat/commodity/order/cancel_or_confirm", //商品订单确认收货或取消
isAllow: "/api/v2/wechat/commodity/after-sales/is-allow", //判断订单是否能申请售后
};

View File

@ -111,10 +111,10 @@ export default {
});
},
pendingPage(item) {
// NavgateTo(`/packages/myOrders/pending/index?item=${JSON.stringify(item)}`); //
NavgateTo(`/packages/myOrders/pending/index?item=${JSON.stringify(item)}`); //
// NavgateTo(`/packages/myOrders/sendBack/index?item=${JSON.stringify(item)}`); //
// NavgateTo(`/packages/myOrders/refundOver/index?item=${JSON.stringify(item)}`); //退
NavgateTo(`/packages/myOrders/changeInfo/index?item=${JSON.stringify(item)}`); //
// NavgateTo(`/packages/myOrders/changeInfo/index?item=${JSON.stringify(item)}`); //
}
}

View File

@ -48,18 +48,18 @@
</view>
<view>
<view class="btn-group" v-if="item.order_status === 1">
<button class="cancel-btn" @click="cancelOrder">
<button class="cancel-btn" @click="cancelOrder(item)">
取消订单
</button>
<!-- <button class="yfd-btn" @click="cancelOrder">运费单</button> -->
<button class="pay-btn" @click="goToPay">立即支付</button>
</view>
<view class="btn-group" v-if="item.order_status === 3">
<button class="cancel-btn" @click="applyRefund">申请退款</button>
<button class="cancel-btn" @click="applyRefund(item)">申请退款</button>
</view>
<view class="btn-group" v-if="item.order_status === 4">
<button class="cancel-btn" @click="cancelOrder">查看物流</button>
<button class="pay-btn" @click="confirmReceiving">确认收货</button>
<button class="pay-btn" @click="confirmReceiving(item)">确认收货</button>
</view>
<view class="btn-group" v-if="item.order_status === 5">
<text class="afterSaleNum">4笔售后</text>
@ -117,6 +117,7 @@ import {
NavgateTo
} from '../../../utils';
import { apiArr } from "../../../api/order";
import { apiArr as afterSaleApi } from "../../../api/afterSale";
import Rated from "../rated/rated.vue";
import AwaitRated from "../awaitRated/awaitRated.vue";
import AfterSale from "../afterSale/index.vue";
@ -155,6 +156,7 @@ export default {
afterSaleGoods: [],//
noSalePopup: false,//
showTkPopup: false,//退
afterSaleItem: '',//
};
},
methods: {
@ -165,26 +167,43 @@ export default {
}
},
//
cancelOrder() {
cancelOrder(item) {
this.afterSaleItem = item;
this.showPopup = true
},
//
handleOrderCancelled(data) {
console.log("🚀 ~ handleOrderCancelled ~ 取消原因:", data.reason);
const params = {
order_id: this.afterSaleItem.id,
method: 1,
cancel_reason: data.reason,
}
request(afterSaleApi.cancelOrConfirm, "POST", params).then((res) => {
console.log("🚀 ~ handleOrderCancelled ~ res:", res)
});
},
//
afterSale(item) {
//
if (item) {
console.log("🚀 ~ afterSale ~ item:", item)
this.afterSaleGoods = item.commodity_order_item_list;
this.selectedAsGood = item.commodity_order_item_list[0].id;
this.$refs.afterSalePopupRef.openAfterSalePopup();
} else {
this.noSalePopup = true
}
this.afterSaleGoods = item.commodity_order_item_list;
this.$refs.afterSalePopupRef.openAfterSalePopup();
// //
// request(afterSaleApi.isAllow, "POST", {
// order_id: item.id,
// }).then((res) => {
// console.log("🚀 ~ afterSale ~ res:", res)
// if (res.data.is_allow_after_sales) {
// this.afterSaleGoods = res.data.allow_items;
// // this.selectedAsGood = item.commodity_order_item_list[0].id;
// this.$refs.afterSalePopupRef.openAfterSalePopup();
// } else {
// this.noSalePopup = true
// }
// });
},
// 退
@ -194,22 +213,44 @@ export default {
// 退
applyRefund() {
applyRefund(item) {
this.afterSaleItem = item;
this.showTkPopup = true
},
// 退
handleRefundConfirmed(data) {
console.log("🚀 ~ handleRefundConfirmed ~ handleRefundConfirmed:", this.afterSaleItem)
console.log("🚀 ~ handleRefundConfirmed ~ 退款原因:", data.reason);
const params = {
nick_name: uni.getStorageSync("nickName"),
order_id: this.afterSaleItem.id,
after_sales_type: 1,
after_sales_reason: data.reason,
refund_amount: this.afterSaleItem.total_amount,
order_status: 3
}
console.log("🚀 ~ handleRefundConfirmed ~ parasm:", params)
request(afterSaleApi.afterSaleCreate, "POST", params).then((res) => {
console.log("🚀 ~ handleRefundConfirmed ~ res:", res)
});
},
//
confirmReceiving() {
confirmReceiving(item) {
uni.showModal({
title: "确认收货",
content: "确认收货后订单状态将变为【已完成】,如有售后需求可正常申请退款/售后,确定要确认收货吗?",
success: (res) => {
if (res.confirm) {
const params = {
order_id: item.id,
method: 2,
}
console.log("🚀 ~ confirmReceiving ~ params:", params)
request(afterSaleApi.cancelOrConfirm, "POST", params).then((res) => {
console.log("🚀 ~ handleRefundConfirmed ~ res:", res)
});
}
},
});

View File

@ -25,11 +25,10 @@
<view class="asGoodDetail">
<view class="asGoodTitle">
<text class="asGoodTag asGoodTag1" v-if="item.is_support_same_day === 1">当日达</text>
{{ item.goods_name
}}
{{ item.goods_name}}
</view>
<view class="asGoodDesc">{{ item.goods_desc }}</view>
<view class="asGoodPrice">¥{{ item.sales_price }}/</view>
<view class="asGoodDesc">{{ item.goods_spec }}</view>
<view class="asGoodPrice">¥{{ item.cost_price }}/</view>
</view>
<view class="asGoodNum">x{{ item.count }}</view>
</view>

View File

@ -4,7 +4,8 @@
<view class="cancel-reason-container">
<view class="title">选择退款原因</view>
<view class="reason-list">
<view v-for="(reason, index) in applyRefundReasons" :key="index" class="reason-item" @click="selectReason(index)">
<view v-for="(reason, index) in applyRefundReasons" :key="index" class="reason-item"
@click="selectReason(index)">
<view :class="['radio', selectedReason === index ? 'active' : '']"></view>
<text>{{ reason }}</text>
</view>
@ -24,7 +25,7 @@ export default {
showPopup: {
type: Boolean,
default: false
}
},
},
data() {
return {
@ -52,10 +53,15 @@ export default {
console.log("🚀 ~ confirmRefund ~ 退款原因:", selectedText);
this.$emit('update:showPopup', false);
this.$emit('refundConfirmed', { reason: selectedText });
uni.showToast({
uni.showModal({
title: '退款申请成功',
content: "将在审核后完成退款",
icon: 'success'
content: '将在审核后完成退款',
showCancel: false,
success: (res) => {
if (res.confirm) {
console.log('用户点击确定');
}
}
});
}
},

View File

@ -242,4 +242,81 @@
font-size: 28rpx;
line-height: 80rpx;
text-align: center;
}
/* 弹窗样式 */
.popup-content {
width: 600rpx;
background-color: #ffffff;
border-radius: 20rpx;
padding: 40rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.success-icon {
margin: 20rpx 0;
}
.check-circle {
width: 120rpx;
height: 120rpx;
background-color: #00c853;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
}
.check-mark {
color: #ffffff;
font-size: 70rpx;
font-weight: bold;
}
.popup-title {
font-size: 36rpx;
font-weight: bold;
color: #333333;
margin: 20rpx 0;
}
.popup-desc {
font-size: 28rpx;
color: #666666;
text-align: center;
line-height: 40rpx;
margin-bottom: 30rpx;
padding: 0 20rpx;
}
.popup-buttons {
display: flex;
justify-content: space-between;
width: 100%;
margin-top: 20rpx;
}
.continue-btn {
width: 240rpx;
height: 80rpx;
background-color: #f6f7fb;
color: #333333;
border-radius: 40rpx;
font-size: 28rpx;
line-height: 80rpx;
text-align: center;
}
.know-btn {
width: 240rpx;
height: 80rpx;
background-color: #ff4d4f;
color: #ffffff;
border: none;
border-radius: 40rpx;
font-size: 28rpx;
line-height: 80rpx;
text-align: center;
}

View File

@ -92,7 +92,25 @@
<view class="action-buttons">
<button class="cancel-btn" @click="cancelRefund">撤销申请</button>
<button class="modify-btn" @click="modifyRefund">修改申请</button>
<button class="urge-btn" @click="urgeProcess">催处理</button>
</view>
<u-popup ref="popup" :show="showPopup" @close="closePopup" :mask-close-able="false"
:close-on-click-overlay="false">
<view class="popup-content">
<view class="success-icon">
<view class="check-circle">
<text class="check-mark"></text>
</view>
</view>
<view class="popup-title">已为您催处理</view>
<view class="popup-desc">平台客服已帮您催促卖家07月26日20:49前卖家未处理系统将自动退款</view>
<view class="popup-buttons">
<button class="continue-btn" @click="closePopup">继续联系卖家</button>
<button class="know-btn" @click="closePopup">我知道了</button>
</view>
</view>
</u-popup>
</view>
</template>
@ -110,7 +128,8 @@ export default {
data() {
return {
currentAfterSale: {},
pickerDefaultDate: new Date()
pickerDefaultDate: new Date(),
showPopup: false
};
},
created() {
@ -181,10 +200,12 @@ export default {
//
urgeProcess() {
uni.showToast({
title: '已发送催处理通知',
icon: 'success'
});
this.showPopup = true;
},
//
closePopup() {
this.showPopup = false;
}
}
};