fix:修复快递归还异常bug
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
// export const URL = "https://my.gxfs123.com/api" //正式服务器
|
||||
export const URL = "https://fansdev.gxfs123.com/api" //测试服务器
|
||||
// export const URL = "http://192.168.5.22:8080" //本地调试
|
||||
// export const URL = "http://192.168.169.66:8080" //本地调试
|
||||
// export const URL = "http://127.0.0.1:8080" //本地调试
|
||||
|
||||
export const appid = "wx2165f0be356ae7a9" //小程序appid
|
||||
+3
-3
@@ -109,10 +109,10 @@ export const overOrderById = (orderId) => {
|
||||
//立即租借
|
||||
export const rentPowerBank = (deviceNo, phone) => {
|
||||
return request({
|
||||
url: '/app/device/rentPowerBank',
|
||||
url: `/app/device/rentPowerBank?deviceNo=${deviceNo}`,
|
||||
method: 'post',
|
||||
data: {
|
||||
deviceNo,
|
||||
// deviceNo,
|
||||
phone
|
||||
}
|
||||
})
|
||||
@@ -210,7 +210,7 @@ export const getPotionsDetail = (data) => {
|
||||
export const uploadOssResource = (filePath) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
url: URL + '/resource/oss/upload',
|
||||
url: URL + '/manager/upload',
|
||||
filePath,
|
||||
name: 'file',
|
||||
header: {
|
||||
|
||||
@@ -195,7 +195,7 @@ const handleSubmit = async () => {
|
||||
res = await fillExpressTrackingNumber({ id: Number(recordId.value), logisticsTrackingNumber: trackingNumber.value })
|
||||
} else {
|
||||
res = await applyExpressReturn({
|
||||
orderId: Number(orderId.value),
|
||||
orderId: orderId.value,
|
||||
logisticsTrackingNumber: trackingNumber.value,
|
||||
remark: ''
|
||||
})
|
||||
|
||||
+219
-206
@@ -19,15 +19,16 @@
|
||||
<!-- 中间内容 -->
|
||||
<view class="item-content">
|
||||
<view class="item-header">
|
||||
<text class="express-company">{{ item.expressCompany }}</text>
|
||||
<text class="tracking-number">运单号:{{ item.trackingNumber }}</text>
|
||||
<text class="tracking-number">运单号:{{ item.logisticsTrackingNumber }}</text>
|
||||
<!-- <text class="express-company">{{ item.expressCompany }}</text> -->
|
||||
</view>
|
||||
<view class="item-details">
|
||||
<text class="return-address">归还地址:{{ item.returnAddress }}</text>
|
||||
<text class="return-time">归还时间:{{ item.returnTime }}</text>
|
||||
<text class="return-time">填写时间:{{ item.returnTime }}</text>
|
||||
</view>
|
||||
<view class="item-footer">
|
||||
<text class="package-info">包裹:{{ item.packageType }} | {{ item.weight }}</text>
|
||||
<text class="package-info">订单号:{{ item.orderId }}</text>
|
||||
<text class="user-phone" v-if="item.userPhone">用户电话:{{ item.userPhone }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -57,242 +58,254 @@ const loading = ref(false)
|
||||
const query = ref({ pageNum: 1, pageSize: 20 })
|
||||
|
||||
const loadList = async () => {
|
||||
try {
|
||||
loading.value = true
|
||||
const res = await getExpressReturnList(query.value)
|
||||
if (res && res.code === 200) {
|
||||
// 将后端字段映射到前端展示字段
|
||||
const rows = (res.data && (res.data.rows || res.data)) || []
|
||||
returnList.value = rows.map(r => ({
|
||||
id: r.id,
|
||||
expressCompany: r.expressCompany || r.company || '-',
|
||||
trackingNumber: r.logisticsTrackingNumber || r.trackingNumber || '-',
|
||||
returnAddress: r.returnAddress || r.address || '-',
|
||||
returnTime: r.createTime || r.returnTime || '-',
|
||||
packageType: r.packageType || '-',
|
||||
weight: r.weight || '-',
|
||||
status: mapStatus(r.status),
|
||||
rawStatus: r.status
|
||||
}))
|
||||
} else {
|
||||
throw new Error(res?.msg || '获取列表失败')
|
||||
}
|
||||
} catch (e) {
|
||||
uni.showToast({ title: e.message || '加载失败', icon: 'none' })
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
try {
|
||||
loading.value = true
|
||||
const res = await getExpressReturnList(query.value)
|
||||
if (res && res.code === 200) {
|
||||
// 将后端字段映射到前端展示字段
|
||||
const rows = (res.data && (res.data.rows || res.data)) || []
|
||||
returnList.value = rows.map(r => ({
|
||||
id: r.id,
|
||||
expressCompany: r.expressCompany || r.company || '待填写',
|
||||
trackingNumber: r.logisticsTrackingNumber || r.trackingNumber || '待填写',
|
||||
returnAddress: r.returnAddress || r.address || '待填写',
|
||||
returnTime: r.expressFillTime || r.createTime || r.returnTime || '待填写',
|
||||
packageType: r.packageType || '待填写',
|
||||
weight: r.weight || '待填写',
|
||||
status: mapStatus(r.status),
|
||||
rawStatus: r.status,
|
||||
userPhone: r.userPhone,
|
||||
orderId: r.orderId,
|
||||
remark: r.remark
|
||||
}))
|
||||
} else {
|
||||
throw new Error(res?.msg || '获取列表失败')
|
||||
}
|
||||
} catch (e) {
|
||||
uni.showToast({ title: e.message || '加载失败', icon: 'none' })
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 状态映射
|
||||
const mapStatus = (status) => {
|
||||
// 文档:0-未填写 1-已填写 2-已取消 3-审批通过 4-审批拒绝 5-订单完成
|
||||
if (status === 5) return 'completed'
|
||||
if (status === 3 || status === 1) return 'processing'
|
||||
if (status === 4 || status === 2 || status === 0) return 'pending'
|
||||
return 'pending'
|
||||
// 文档:0-未填写 1-已填写 2-已取消 3-审批通过 4-审批拒绝 5-订单完成
|
||||
if (status === 5) return 'completed'
|
||||
if (status === 3 || status === 1) return 'processing'
|
||||
if (status === 4 || status === 2 || status === 0) return 'pending'
|
||||
return 'pending'
|
||||
}
|
||||
|
||||
const getStatusClass = (status) => ({
|
||||
'completed': 'status-completed',
|
||||
'processing': 'status-processing',
|
||||
'pending': 'status-pending'
|
||||
'completed': 'status-completed',
|
||||
'processing': 'status-processing',
|
||||
'pending': 'status-pending'
|
||||
}[status] || 'status-pending')
|
||||
|
||||
const getStatusIcon = (status) => ({
|
||||
'completed': '✓',
|
||||
'processing': '⏳',
|
||||
'pending': '⏸'
|
||||
'completed': '✓',
|
||||
'processing': '⏳',
|
||||
'pending': '⏸'
|
||||
}[status] || '⏸')
|
||||
|
||||
const getStatusText = (status) => ({
|
||||
'completed': '已完成',
|
||||
'processing': '处理中',
|
||||
'pending': '待处理'
|
||||
'completed': '已完成',
|
||||
'processing': '处理中',
|
||||
'pending': '待处理'
|
||||
}[status] || '待处理')
|
||||
|
||||
// 点击列表项
|
||||
const handleItemClick = (item) => {
|
||||
console.log('点击了归还记录:', item)
|
||||
// 未填写(status=0 -> mapped 'pending')时跳转到补填页,其它跳详情
|
||||
if (item && item.rawStatus === 0) {
|
||||
uni.navigateTo({ url: `/pages/expressReturn/addExpressReturn?id=${item.id}` })
|
||||
} else {
|
||||
uni.navigateTo({ url: `/pages/expressReturn/detail?id=${item.id}` })
|
||||
}
|
||||
console.log('点击了归还记录:', item)
|
||||
// 未填写(status=0 -> mapped 'pending')时跳转到补填页,其它跳详情
|
||||
if (item && item.rawStatus === 0) {
|
||||
uni.navigateTo({ url: `/pages/expressReturn/addExpressReturn?id=${item.id}` })
|
||||
} else {
|
||||
uni.navigateTo({ url: `/pages/expressReturn/detail?id=${item.id}` })
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(loadList)
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.express-return-container {
|
||||
min-height: 100vh;
|
||||
.express-return-container {
|
||||
min-height: 100vh;
|
||||
background-color: #f8f9fa;
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
margin-bottom: 40rpx;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
display: block;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #2c3e50;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.page-subtitle {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
color: #7f8c8d;
|
||||
}
|
||||
|
||||
.list-container {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.return-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 30rpx 24rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 20rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
transition: background-color 0.2s ease;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: #f8f9fa;
|
||||
padding: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.item-icon {
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
|
||||
.icon-wrapper {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
|
||||
&.status-completed {
|
||||
background-color: #e8f5e8;
|
||||
color: #27ae60;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
margin-bottom: 40rpx;
|
||||
padding: 20rpx 0;
|
||||
&.status-processing {
|
||||
background-color: #fff3cd;
|
||||
color: #f39c12;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
display: block;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #2c3e50;
|
||||
margin-bottom: 10rpx;
|
||||
&.status-pending {
|
||||
background-color: #f8f9fa;
|
||||
color: #6c757d;
|
||||
}
|
||||
}
|
||||
|
||||
.item-content {
|
||||
flex: 1;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.item-header {
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.express-company {
|
||||
display: block;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #2c3e50;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.tracking-number {
|
||||
display: block;
|
||||
font-size: 26rpx;
|
||||
color: #7f8c8d;
|
||||
}
|
||||
|
||||
.item-details {
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.return-address,
|
||||
.return-time {
|
||||
display: block;
|
||||
font-size: 26rpx;
|
||||
color: #34495e;
|
||||
line-height: 1.5;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.item-footer {
|
||||
margin-top: 8rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.package-info {
|
||||
font-size: 24rpx;
|
||||
color: #95a5a6;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.user-phone {
|
||||
font-size: 24rpx;
|
||||
color: #95a5a6;
|
||||
}
|
||||
|
||||
.item-status {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.status-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
padding: 8rpx 16rpx;
|
||||
border-radius: 20rpx;
|
||||
|
||||
&.status-completed {
|
||||
background-color: #e8f5e8;
|
||||
color: #27ae60;
|
||||
}
|
||||
|
||||
.page-subtitle {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
color: #7f8c8d;
|
||||
&.status-processing {
|
||||
background-color: #fff3cd;
|
||||
color: #f39c12;
|
||||
}
|
||||
|
||||
.list-container {
|
||||
background-color: transparent;
|
||||
&.status-pending {
|
||||
background-color: #f8f9fa;
|
||||
color: #6c757d;
|
||||
}
|
||||
}
|
||||
|
||||
.return-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 30rpx 24rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 20rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
transition: background-color 0.2s ease;
|
||||
.empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 120rpx 40rpx;
|
||||
// background-color: #ffffff;
|
||||
// border-radius: 16rpx;
|
||||
// box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.empty-icon {
|
||||
font-size: 80rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
}
|
||||
|
||||
.item-icon {
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
|
||||
.icon-wrapper {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
|
||||
&.status-completed {
|
||||
background-color: #e8f5e8;
|
||||
color: #27ae60;
|
||||
}
|
||||
|
||||
&.status-processing {
|
||||
background-color: #fff3cd;
|
||||
color: #f39c12;
|
||||
}
|
||||
|
||||
&.status-pending {
|
||||
background-color: #f8f9fa;
|
||||
color: #6c757d;
|
||||
}
|
||||
}
|
||||
|
||||
.item-content {
|
||||
flex: 1;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.item-header {
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.express-company {
|
||||
display: block;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #2c3e50;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.tracking-number {
|
||||
display: block;
|
||||
font-size: 26rpx;
|
||||
color: #7f8c8d;
|
||||
}
|
||||
|
||||
.item-details {
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.return-address,
|
||||
.return-time {
|
||||
display: block;
|
||||
font-size: 26rpx;
|
||||
color: #34495e;
|
||||
line-height: 1.5;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.item-footer {
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.package-info {
|
||||
font-size: 24rpx;
|
||||
color: #95a5a6;
|
||||
}
|
||||
|
||||
.item-status {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.status-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
padding: 8rpx 16rpx;
|
||||
border-radius: 20rpx;
|
||||
|
||||
&.status-completed {
|
||||
background-color: #e8f5e8;
|
||||
color: #27ae60;
|
||||
}
|
||||
|
||||
&.status-processing {
|
||||
background-color: #fff3cd;
|
||||
color: #f39c12;
|
||||
}
|
||||
|
||||
&.status-pending {
|
||||
background-color: #f8f9fa;
|
||||
color: #6c757d;
|
||||
}
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 120rpx 40rpx;
|
||||
// background-color: #ffffff;
|
||||
// border-radius: 16rpx;
|
||||
// box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.empty-icon {
|
||||
font-size: 80rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 28rpx;
|
||||
color: #7f8c8d;
|
||||
}
|
||||
.empty-text {
|
||||
font-size: 28rpx;
|
||||
color: #7f8c8d;
|
||||
}
|
||||
</style>
|
||||
@@ -21,7 +21,7 @@
|
||||
</view>
|
||||
|
||||
<!-- 图片上传 -->
|
||||
<!-- <view class="upload-section">
|
||||
<view class="upload-section">
|
||||
<view class="section-title">图片上传(选填)</view>
|
||||
<view class="upload-grid">
|
||||
<view class="upload-item" v-for="(img, index) in images" :key="index">
|
||||
@@ -33,7 +33,7 @@
|
||||
<text class="tip">上传图片</text>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- 联系方式 -->
|
||||
<view class="contact-section">
|
||||
@@ -80,6 +80,7 @@
|
||||
uni.chooseImage({
|
||||
count: 3 - images.value.length,
|
||||
success: async (res) => {
|
||||
console.log(res);
|
||||
const toUpload = res.tempFilePaths || []
|
||||
for (const localPath of toUpload) {
|
||||
// 先追加本地预览,再上传并替换为远程URL
|
||||
@@ -142,7 +143,7 @@
|
||||
type: paramsType.value,
|
||||
content: description.value,
|
||||
phone: contact.value,
|
||||
// images: images.value
|
||||
picturePath: images.value
|
||||
}
|
||||
|
||||
uni.request({
|
||||
|
||||
@@ -163,6 +163,10 @@
|
||||
'order_cancelled': {
|
||||
text: '已取消',
|
||||
class: 'status-cancelled'
|
||||
},
|
||||
'express_return': {
|
||||
text: '快递归还',
|
||||
class: 'status-express-return'
|
||||
}
|
||||
});
|
||||
|
||||
@@ -501,6 +505,10 @@
|
||||
&.status-cancelled {
|
||||
color: #9E9E9E;
|
||||
}
|
||||
|
||||
&.status-express-return {
|
||||
color: #FF9800;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
<view v-if="orderInfo.orderStatus === 'in_used'" class="action-item secondary" @click="checkReturnStatus">
|
||||
刷新状态</view>
|
||||
<view v-if="orderInfo.orderStatus === 'in_used' && !showExpressAction" class="action-item primary">
|
||||
{{ formatHms(countdownRemaining) }} 后可发起快递归还
|
||||
倒计时{{ formatHms(countdownRemaining) }}
|
||||
</view>
|
||||
<view v-if="orderInfo.orderStatus === 'in_used' && showExpressAction" class="action-item primary" @click="expressRetrunOrder">
|
||||
暂停计费,快递归还
|
||||
@@ -178,7 +178,8 @@
|
||||
statusCheckInterval: 5000, // 5秒检查一次
|
||||
isPageActive: false, // 跟踪页面是否活跃
|
||||
// 倒计时与快递归还触发(默认4小时=14400秒,可被配置覆盖)
|
||||
countdownRemaining: 14400,
|
||||
// countdownRemaining: 14400,
|
||||
countdownRemaining: 0,
|
||||
showExpressAction: false,
|
||||
countdownTimer: null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user