Browse Source

feat(订单): 完善订单管理和物流追踪功能

- 新增取消订单弹窗组件,支持选择取消原因并调用取消接口
- 在订单详情页和订单列表页集成取消订单、催发货和修改地址功能
- 重构物流详情页,对接后端物流信息接口,显示实时物流轨迹
- 修复分页组件中hasMore的计算逻辑,使用页码判断替代列表长度比较
- 优化商品条件显示逻辑,统一使用过滤器处理条件文本
- 在mall.js中新增取消订单、催发货、修改地址和查询物流信息的API接口
ylong 2 weeks ago
parent
commit
bbcfb9fcc0

+ 12 - 0
api/modules/mall.js

@@ -58,5 +58,17 @@ export const useMallApi = (Vue, vm) => {
 		
 		// 申请退款
 		applyRefundAjax: (data) => vm.$u.post('/token/shop/order/applyRefund', data),
+		
+		// 取消订单
+		cancelOrderAjax: (data) => vm.$u.post('/token/shop/order/orderCancel', data),
+
+        // 催发货
+        urgeSendAjax: (orderId) => vm.$u.post('/token/shop/order/urgeSend?orderId=' + orderId),
+
+        // 修改订单地址
+        modifyOrderAddressAjax: (data) => vm.$u.post('/token/shop/order/orderModifyAddress', data),
+
+        // 查看订单快递信息
+        getOrderTrackingAjax: (params) => vm.$u.get('/token/shop/order/getOrderTracking', params),
 	}
 }

+ 1 - 1
components/pageScroll/index.vue

@@ -133,7 +133,7 @@ export default {
                     .then((res) => {
                         resolve({
                             list: res.rows,
-                            hasMore: res.rows ? res.rows.length < res.total - this.dataList.length : false,
+                            hasMore: res.rows ? (this.page * this.pageSize) < res.total : false,
                         });
                     })
                     .finally(() => {

+ 21 - 24
pages-car/components/buy-order-item.vue

@@ -43,35 +43,35 @@
         <view class="action-box">
             <!-- 付款 (未包含在Flags中,保留原逻辑: 待付款且未取消) -->
             <u-button v-if="order.status == '1' && order.cancelStatus == '0'" size="mini" shape="circle"
-                :custom-style="themeBtnStyle" @click.stop="handleAction('pay')">付款</u-button>
+                :custom-style="themeBtnStyle" @click.stop="handleAction('pay', order)">付款</u-button>
 
             <!-- 确认收货 -->
             <u-button v-if="order.showConfirmShop == 1" size="mini" shape="circle" :custom-style="themeBtnStyle"
-                @click.stop="handleAction('confirm')">确认收货</u-button>
+                @click.stop="handleAction('confirm', order)">确认收货</u-button>
 
             <!-- 加入购物车 -->
             <u-button v-if="order.showAddToCart == 1" size="mini" shape="circle" :custom-style="themeBtnStyle"
-                @click.stop="handleAction('addToCart')">加入购物车</u-button>
+                @click.stop="handleAction('addToCart', order)">加入购物车</u-button>
 
             <!-- 再来一单 -->
             <u-button v-if="order.showBuyAgain == 1" size="mini" shape="circle" type="primary" plain
-                :custom-style="btnStyle" @click.stop="handleAction('rebuy')">再买一单</u-button>
+                :custom-style="btnStyle" @click.stop="handleAction('rebuy', order)">再买一单</u-button>
 
             <!-- 评价 -->
             <u-button v-if="order.showEvaluation == 1" size="mini" shape="circle" type="primary" plain
-                :custom-style="btnStyle" @click.stop="handleAction('evaluate')">评价</u-button>
+                :custom-style="btnStyle" @click.stop="handleAction('evaluate', order)">评价</u-button>
 
             <!-- 查看物流 -->
-            <u-button v-if="order.showCheckExpress == 1 && order.status != '4'" size="mini" shape="circle"
-                type="primary" plain :custom-style="btnStyle" @click.stop="handleAction('logistics')">查看物流</u-button>
+            <u-button v-if="order.showCheckExpress == 1" size="mini" shape="circle"
+                type="primary" plain :custom-style="btnStyle" @click.stop="handleAction('logistics', order)">查看物流</u-button>
 
             <!-- 延长收货 -->
             <u-button v-if="order.showExtendReceivingTime == 1" size="mini" shape="circle" plain
-                :custom-style="btnStyle" @click.stop="handleAction('extend')">延长收货</u-button>
+                :custom-style="btnStyle" @click.stop="handleAction('extend', order)">延长收货</u-button>
 
             <!-- 催发货 -->
             <u-button v-if="order.showUrge == 1" size="mini" shape="circle" type="warning" plain
-                :custom-style="btnStyle" @click.stop="handleAction('remind')">催发货</u-button>
+                :custom-style="btnStyle" @click.stop="handleAction('remind', order)">催发货</u-button>
 
             <!-- 更多操作 (仅在已完成状态下显示) -->
             <u-button
@@ -81,35 +81,31 @@
 
             <!-- 申请售后 -->
             <u-button v-if="order.showAfterSales == 1 && order.status != '4'" size="mini" shape="circle" type="error"
-                plain :custom-style="btnStyle" @click.stop="handleAction('refund')">申请售后</u-button>
+                plain :custom-style="btnStyle" @click.stop="handleAction('refund', order)">申请售后</u-button>
 
             <!-- 取消订单 (未包含在Flags中,保留原逻辑: 待付款且未取消) -->
-            <u-button v-if="order.status == '1' && order.cancelStatus == '0'" size="mini" shape="circle" type="error"
-                plain :custom-style="btnStyle" @click.stop="handleAction('cancel')">取消订单</u-button>
-
-            <!-- 删除订单 (未包含在Flags中,保留原逻辑) -->
-            <u-button v-if="order.cancelStatus == '1'" size="mini" shape="circle" type="error" plain
-                :custom-style="btnStyle" @click.stop="handleAction('delete')">删除订单</u-button>
+            <u-button v-if="order.showCancel" size="mini" shape="circle" type="error"
+                plain :custom-style="btnStyle" @click.stop="handleAction('cancel', order)">取消订单</u-button>
 
             <!-- 钱款去向 -->
             <u-button v-if="order.showMoneyDestination == 1" size="mini" shape="circle" type="primary" plain
-                :custom-style="btnStyle" @click.stop="handleAction('moneyWhere')">钱款去向</u-button>
+                :custom-style="btnStyle" @click.stop="handleAction('moneyWhere', order)">钱款去向</u-button>
 
             <!-- 查看详情 -->
             <u-button v-if="order.showShowDetail == 1" size="mini" shape="circle" plain
-                :custom-style="btnStyle" @click.stop="handleAction('detail')">查看详情</u-button>
+                :custom-style="btnStyle" @click.stop="handleAction('detail', order)">查看详情</u-button>
 
             <!-- 申请开票 -->
             <u-button v-if="order.showApplyInvoice == 1 && order.status != '4'" size="mini" shape="circle" plain
-                :custom-style="btnStyle" @click.stop="handleAction('invoice')">申请开票</u-button>
+                :custom-style="btnStyle" @click.stop="handleAction('invoice', order)">申请开票</u-button>
 
             <!-- 投诉 -->
             <u-button v-if="order.showComplaint == 1" size="mini" shape="circle" plain :custom-style="btnStyle"
-                @click.stop="handleAction('complaint')">投诉</u-button>
+                @click.stop="handleAction('complaint', order)">投诉</u-button>
 
             <!-- 修改地址 -->
             <u-button v-if="order.showModifyAddress == 1" size="mini" shape="circle" plain :custom-style="btnStyle"
-                @click.stop="handleAction('address')">修改地址</u-button>
+                @click.stop="handleAction('address', order)">修改地址</u-button>
         </view>
     </view>
 </template>
@@ -164,9 +160,9 @@
             },
             handleAction(type, data) {
                 if (type === 'complaint') {
-                    uni.setStorageSync('tempComplaintOrder', this.order);
+                    uni.setStorageSync('tempComplaintOrder', data);
                     uni.navigateTo({
-                        url: `/pages-car/pages/complaint?orderId=${this.order.orderId}`
+                        url: `/pages-car/pages/complaint?orderId=${data.orderId}`
                     });
                     return;
                 }
@@ -178,7 +174,8 @@
                     });
                     return;
                 }
-                this.$emit('action', { type, order: this.order, data })
+                console.log('handleAction', type, data)
+                this.$emit('action', { type, order: data })
             },
             handleMoreAction() {
                 // 收集更多按钮下的操作

+ 106 - 0
pages-car/components/cancel-order-popup.vue

@@ -0,0 +1,106 @@
+<template>
+	<common-dialog ref="popup" title="取消订单" confirm-text="确定" @confirm="handleConfirm" @cancel="close"
+		:custom-style="{width: '600rpx'}">
+		<view class="reason-list">
+			<u-radio-group v-model="selectedReason" :wrap="true">
+				<view class="reason-item" v-for="(item, index) in reasonList" :key="index"
+					@click="selectedReason = item.value">
+					<text class="reason-text">{{ item.label }}</text>
+					<u-radio :name="item.value" active-color="#38C148"></u-radio>
+				</view>
+			</u-radio-group>
+		</view>
+	</common-dialog>
+</template>
+
+<script>
+	import CommonDialog from '@/components/common-dialog.vue';
+
+	export default {
+		name: "cancel-order-popup",
+		components: {
+			CommonDialog
+		},
+		data() {
+			return {
+				reasonList: [],
+				selectedReason: '',
+				currentOrderId: null
+			};
+		},
+		methods: {
+			open(orderId) {
+				this.currentOrderId = orderId;
+				this.$refs.popup.openPopup();
+				this.selectedReason = '';
+				if (this.reasonList.length === 0) {
+					this.getReasonList();
+				}
+			},
+			close() {
+				this.$refs.popup.closePopup();
+			},
+			getReasonList() {
+				uni.$u.http.get('/token/common/getDictOptions?type=cancel_reason').then(res => {
+					if (res.code === 200) {
+						this.reasonList = res.data.map(item => ({
+							label: item.dictLabel,
+							value: item.dictValue
+						}));
+					}
+				});
+			},
+			handleConfirm() {
+				if (!this.selectedReason) {
+					uni.showToast({
+						title: '请选择取消原因',
+						icon: 'none'
+					});
+					return;
+				}
+				if (!this.currentOrderId) return;
+
+				this.$u.api.cancelOrderAjax({
+					orderId: this.currentOrderId,
+					reason: this.selectedReason
+				}).then(res => {
+					if (res.code === 200) {
+						uni.showToast({
+							title: '订单取消成功',
+							icon: 'success'
+						});
+						this.close();
+						this.$emit('success');
+					}
+				});
+			}
+		}
+	};
+</script>
+
+<style lang="scss" scoped>
+	.reason-list {
+		padding: 20rpx 0;
+		text-align: left;
+		max-height: 500rpx;
+		overflow-y: auto;
+
+		.reason-item {
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			padding: 20rpx 0;
+			border-bottom: 1px solid #f5f5f5;
+
+			&:last-child {
+				border-bottom: none;
+			}
+
+			.reason-text {
+				font-size: 28rpx;
+				color: #333;
+				flex: 1;
+			}
+		}
+	}
+</style>

+ 1 - 1
pages-car/components/cart-item.vue

@@ -76,7 +76,7 @@
         computed: {
             conditionName() {
                 // 如果是数字,映射;如果是字符串,直接显示
-                return this.$conditionMap[this.item.conditionType] || this.item.conditionType || '-';
+                return this.$conditionMap[this.item.conditionType] || '-';
             },
             isValid() {
                 // stockStatus: 1-有库存 2-库存紧张 3-暂无库存

+ 20 - 11
pages-car/components/urge-delivery-dialog.vue

@@ -39,18 +39,27 @@
         methods: {
             open(order) {
                 this.order = order;
-                // 计算发货截止时间,这里假设是下单时间+48小时,如果有字段则直接使用
-                // 如果没有 createTime,则默认为当前时间+48小时
-                let baseTime = new Date();
-                if (order && order.createTime) {
-                    // 兼容处理 ios 时间格式
-                    baseTime = new Date(order.createTime.replace(/-/g, '/'));
-                }
-                // 加48小时
-                const deadline = new Date(baseTime.getTime() + 48 * 60 * 60 * 1000);
-                this.deadlineTime = this.formatDate(deadline);
 
-                this.$refs.urgeDialog.openPopup();
+                // 调用催发货接口
+                uni.showLoading({ title: '处理中' });
+                this.$u.api.urgeSendAjax(order.orderId).then(res => {
+                    uni.hideLoading();
+                    if (res.code === 200) {
+                        // 计算发货截止时间
+                        let baseTime = new Date();
+                        if (order && order.createTime) {
+                            // 兼容处理 ios 时间格式
+                            baseTime = new Date(order.createTime.replace(/-/g, '/'));
+                        }
+                        // 加72小时
+                        const deadline = new Date(baseTime.getTime() + 72 * 60 * 60 * 1000);
+                        this.deadlineTime = this.formatDate(deadline);
+
+                        this.$refs.urgeDialog.openPopup();
+                    }
+                }).catch(() => {
+                    uni.hideLoading();
+                });
             },
             closePopup() {
                 this.$refs.urgeDialog.closePopup();

+ 47 - 74
pages-car/pages/logistics-detail.vue

@@ -14,11 +14,11 @@
         <view class="card info-card">
             <view class="info-row">
                 <text class="label">承运商:</text>
-                <text class="value">{{ currentPackage.carrier }}</text>
+                <text class="value">{{ currentPackage.expressName }}</text>
             </view>
             <view class="info-row">
                 <text class="label">物流单号:</text>
-                <text class="value">{{ currentPackage.trackingNo }}</text>
+                <text class="value">{{ currentPackage.waybillCode }}</text>
                 <view class="copy-btn" @click="copyTrackingNo">复制</view>
             </view>
         </view>
@@ -32,12 +32,12 @@
                     <view class="line"></view>
                 </view>
                 <view class="right-col">
-                    <view class="status-title">收货地址:{{ currentPackage.address }}</view>
+                    <view class="status-title">收货地址:{{ currentPackage.receiveAddress }}</view>
                 </view>
             </view>
 
             <!-- 轨迹列表 -->
-            <view class="timeline-item" v-for="(trace, index) in currentPackage.traces" :key="index">
+            <view class="timeline-item" v-for="(trace, index) in currentPackage.trackingVoList" :key="index">
                 <view class="left-col">
                     <!-- 不同状态显示不同图标 -->
                     <view v-if="index === 0 && trace.status === '已签收'" class="icon-box check-icon">
@@ -54,13 +54,13 @@
                     </view>
                     <view v-else class="dot"></view>
 
-                    <view class="line" v-if="index !== currentPackage.traces.length - 1"></view>
+                    <view class="line" v-if="index !== currentPackage.trackingVoList.length - 1"></view>
                 </view>
 
                 <view class="right-col" :class="{ 'is-first': index === 0 }">
                     <view class="status-title">{{ trace.status }}</view>
-                    <view class="status-desc">{{ trace.desc }}</view>
-                    <view class="status-time">{{ trace.time }}</view>
+                    <view class="status-desc">{{ trace.context }}</view>
+                    <view class="status-time">{{ trace.ftime }}</view>
                 </view>
             </view>
         </view>
@@ -72,86 +72,59 @@ export default {
     data() {
         return {
             currentPackageIndex: 0,
-            packages: [
-                {
-                    name: '包裹1',
-                    carrier: '顺丰快递',
-                    trackingNo: '1486662178863',
-                    address: '四川省成都市武侯区城区锦城大道武侯区城区锦城大道武侯区城区锦城大道',
-                    traces: [
-                        {
-                            status: '已签收',
-                            desc: '您的包裹正在配送途中(快递员:蔡波,电话:18282828281)',
-                            time: '2021.03.03 21:29'
-                        },
-                        {
-                            status: '派送中',
-                            desc: '您的包裹正在配送途中(快递员:蔡波,电话:18285878382)',
-                            time: '2021.03.03 21:29'
-                        },
-                        {
-                            status: '运输中',
-                            desc: '您提交了订单,请等待第三方卖家系统确认',
-                            time: '2021.03.03 21:29'
-                        },
-                        {
-                            status: '',
-                            desc: '您的订单由第三方卖家捡货完成,待出库交付圆通快递包裹,运单号为:9830165317459',
-                            time: '2021.03.03 21:29'
-                        },
-                        {
-                            status: '',
-                            desc: '第三方卖家已经开始捡货',
-                            time: '2021.03.03 21:29'
-                        },
-                        {
-                            status: '',
-                            desc: '您的订单已进入第三方卖家仓库,准备出库',
-                            time: '2021.03.03 21:29'
-                        },
-                        {
-                            status: '已下单',
-                            desc: '您提交了订单,请等待第三方卖家系统确认',
-                            time: '2021.03.03 21:29'
-                        }
-                    ]
-                },
-                {
-                    name: '包裹2',
-                    carrier: '圆通速递',
-                    trackingNo: 'YT1234567890',
-                    address: '北京市朝阳区...',
-                    traces: []
-                },
-                {
-                    name: '包裹3',
-                    carrier: '中通快递',
-                    trackingNo: 'ZT0987654321',
-                    address: '上海市浦东新区...',
-                    traces: []
-                },
-                {
-                    name: '包裹4',
-                    carrier: '韵达快递',
-                    trackingNo: 'YD1122334455',
-                    address: '广东省广州市...',
-                    traces: []
-                }
-            ]
+            packages: [], // Changed to empty array, will be populated by API
+            orderId: '',
+            refundOrderId: ''
         };
     },
+    onLoad(options) {
+        if (options.orderId) {
+            this.orderId = options.orderId;
+            this.getLogisticsData();
+        } else if (options.refundOrderId) {
+            this.refundOrderId = options.refundOrderId;
+            this.getLogisticsData();
+        }
+    },
     computed: {
         currentPackage() {
             return this.packages[this.currentPackageIndex] || {};
         }
     },
     methods: {
+        getLogisticsData() {
+            uni.showLoading({
+                title: '加载中'
+            });
+            const params = {};
+            if (this.orderId) params.orderId = this.orderId;
+            if (this.refundOrderId) params.refundOrderId = this.refundOrderId;
+
+            this.$u.api.getOrderTrackingAjax(params).then(res => {
+                uni.hideLoading();
+                if (res.code == 200) {
+                    const data = res.data;
+                    
+                    // 直接使用后端返回的字段
+                    this.packages = [{
+                        name: '包裹1', // 前端固定名称,因为接口只返回一个包裹信息
+                        ...data
+                    }];
+                } else {
+                    this.$u.toast(res.msg || '获取物流信息失败');
+                }
+            }).catch(() => {
+                uni.hideLoading();
+                this.$u.toast('网络请求失败');
+            });
+        },
         switchPackage(index) {
             this.currentPackageIndex = index;
         },
         copyTrackingNo() {
+            if (!this.currentPackage.waybillCode) return;
             uni.setClipboardData({
-                data: this.currentPackage.trackingNo,
+                data: this.currentPackage.waybillCode,
                 success: () => {
                     uni.showToast({
                         title: '复制成功',

+ 37 - 29
pages-car/pages/my-order.vue

@@ -24,6 +24,9 @@
         
         <!-- 催发货弹窗 -->
         <urge-delivery-dialog ref="urgeDialog"></urge-delivery-dialog>
+
+        <!-- 取消订单弹窗 -->
+        <cancel-order-popup ref="cancelDialog" @success="loadOrders(true, params)"></cancel-order-popup>
     </view>
 </template>
 
@@ -32,13 +35,15 @@
     import pageScroll from '@/components/pageScroll/index.vue';
     import FastRefundDialog from '../components/fast-refund-dialog.vue';
     import UrgeDeliveryDialog from '../components/urge-delivery-dialog.vue';
+    import CancelOrderPopup from '../components/cancel-order-popup.vue';
 
     export default {
         components: {
             BuyOrderItem,
             pageScroll,
             FastRefundDialog,
-            UrgeDeliveryDialog
+            UrgeDeliveryDialog,
+            CancelOrderPopup
         },
         data() {
             return {
@@ -56,7 +61,8 @@
                 params: {},
                 showActionSheet: false,
                 actionSheetList: [],
-                currentOrder: null
+                currentOrder: null,
+                modifyingOrderId: null
             };
         },
         onLoad(options) {
@@ -69,8 +75,30 @@
             }
 
             this.loadOrders(true, this.params);
+
+            // 监听地址选择
+            uni.$on('selectAddr', this.onAddressSelected);
+        },
+        onUnload() {
+            uni.$off('selectAddr', this.onAddressSelected);
         },
         methods: {
+            onAddressSelected(addr) {
+                if (this.modifyingOrderId && addr && addr.id) {
+                    uni.showLoading({ title: '修改中' });
+                    this.$u.api.modifyOrderAddressAjax({
+                        orderId: this.modifyingOrderId,
+                        addressId: addr.id
+                    }).then(res => {
+                        uni.hideLoading();
+                        if (res.code == 200) {
+                            uni.showToast({ title: '修改成功', icon: 'success' });
+                        }
+                    }).finally(() => {
+                        this.modifyingOrderId = null;
+                    });
+                }
+            },
             loadOrders(refresh = false, params = {}) {
                 this.$nextTick(() => {
                     this.$refs.pageRef?.loadData(refresh, params);
@@ -112,23 +140,8 @@
             },
             processAction(type, order) {
                 if (type === 'rebuy' || type === 'addToCart') {
-                    // Logic to add to cart
                     uni.showToast({ title: '已加入购物车', icon: 'none' });
-                } else if (type === 'delete') {
-                    uni.showModal({
-                        title: '提示',
-                        content: '确定要删除该订单吗?',
-                        success: (res) => {
-                            if (res.confirm) {
-                                // Remove from list
-                                this.orderList = this.orderList.filter(item => item.orderId !== order.orderId);
-                                uni.showToast({ title: '删除成功', icon: 'none' });
-                                // Call API to delete if needed
-                            }
-                        }
-                    });
                 } else if (type === 'remind') {
-                    // uni.showToast({ title: '已提醒商家发货', icon: 'none' });
                     this.$refs.urgeDialog.open(order);
                 } else if (type === 'refund') {
                     if (order.status == '2') {
@@ -146,7 +159,6 @@
                         success: (res) => {
                             if (res.confirm) {
                                 uni.showToast({ title: '确认收货成功', icon: 'none' });
-                                // Update status locally or reload
                                 this.loadOrders(true, this.params);
                             }
                         }
@@ -154,23 +166,19 @@
                 } else if (type === 'logistics') {
                     uni.showToast({ title: '查看物流信息', icon: 'none' });
                 } else if (type === 'address') {
-                    uni.showToast({ title: '修改地址', icon: 'none' });
+                    this.modifyingOrderId = order.orderId;
+                    // 兼容列表和详情可能的字段差异
+                    const addressId = order.addressId || order.receiverAddressId || '';
+                    uni.navigateTo({
+                        url: `/pages-mine/pages/address/list?id=${addressId}&isSelect=1&editAddress=1`
+                    });
                 } else if (type === 'pay') {
                     // 跳转到收银台
                     uni.navigateTo({
                         url: `/pages-car/pages/cashier-desk?id=${order.orderId}`
                     });
                 } else if (type === 'cancel') {
-                    uni.showModal({
-                        title: '提示',
-                        content: '确定要取消订单吗?',
-                        success: (res) => {
-                            if (res.confirm) {
-                                uni.showToast({ title: '订单已取消', icon: 'none' });
-                                this.loadOrders(true, this.params);
-                            }
-                        }
-                    });
+                    this.$refs.cancelDialog.open(order.orderId);
                 } else {
                     uni.showToast({ title: '功能开发中', icon: 'none' });
                 }

+ 54 - 2
pages-car/pages/order-detail.vue

@@ -122,6 +122,12 @@
         <!-- 底部操作栏 -->
         <order-bottom-bar :orderInfo="orderInfo" @action="handleAction"></order-bottom-bar>
 
+        <!-- 取消订单弹窗 -->
+        <cancel-order-popup ref="cancelDialog" @success="loadOrderDetail(orderInfo.orderId)"></cancel-order-popup>
+
+        <!-- 催发货弹窗 -->
+        <urge-delivery-dialog ref="urgeDialog"></urge-delivery-dialog>
+
         <!-- 占位符,防止底部按钮遮挡内容 -->
         <view style="height: 120rpx;"></view>
     </view>
@@ -129,10 +135,14 @@
 
 <script>
     import OrderBottomBar from '../components/order-bottom-bar.vue';
+    import CancelOrderPopup from '../components/cancel-order-popup.vue';
+    import UrgeDeliveryDialog from '../components/urge-delivery-dialog.vue';
 
     export default {
         components: {
-            OrderBottomBar
+            OrderBottomBar,
+            CancelOrderPopup,
+            UrgeDeliveryDialog
         },
         data() {
             return {
@@ -148,7 +158,8 @@
                     discountMoney: 0,
                     payMoney: 0,
                     createTime: ''
-                }
+                },
+                isModifyingAddress: false
             };
         },
         computed: {
@@ -166,8 +177,32 @@
             if (options.orderId) {
                 this.loadOrderDetail(options.orderId);
             }
+            // 监听地址选择
+            uni.$on('selectAddr', this.onAddressSelected);
+        },
+        onUnload() {
+            uni.$off('selectAddr', this.onAddressSelected);
         },
         methods: {
+            onAddressSelected(addr) {
+                if (this.isModifyingAddress && addr && addr.id) {
+                    uni.showLoading({ title: '修改中' });
+                    this.$u.api.modifyOrderAddressAjax({
+                        orderId: this.orderInfo.orderId,
+                        addressId: addr.id
+                    }).then(res => {
+                        uni.hideLoading();
+                        if (res.code == 200) {
+                            uni.showToast({ title: '修改成功', icon: 'success' });
+                            setTimeout(() => {
+                                this.loadOrderDetail(this.orderInfo.orderId);
+                            }, 1500);
+                        }
+                    }).finally(() => {
+                        this.isModifyingAddress = false;
+                    });
+                }
+            },
             loadOrderDetail(orderId) {
                 uni.$u.http.get('/token/shop/order/getOrderDetail', {
                     orderId: orderId
@@ -198,6 +233,23 @@
                     });
                     return;
                 }
+                if (type === 'cancel') {
+                    this.$refs.cancelDialog.open(this.orderInfo.orderId);
+                    return;
+                }
+                if (type === 'remind') {
+                    this.$refs.urgeDialog.open(this.orderInfo);
+                    return;
+                }
+                if (type === 'address') {
+                    this.isModifyingAddress = true;
+                    // 兼容可能的字段差异
+                    const addressId = this.orderInfo.addressId || this.orderInfo.receiverAddressId || '';
+                    uni.navigateTo({
+                        url: `/pages-mine/pages/address/list?isSelect=1&id=${addressId}`
+                    });
+                    return;
+                }
                 uni.showToast({ title: `点击了${type}`, icon: 'none' });
             }
         }

+ 1 - 1
pages-sell/components/select-good-popup/index.vue

@@ -45,7 +45,7 @@
 					<image v-if="currentQuality === opt.conditionType" src="/pages-sell/static/select-good/selected.png"
 						class="bg-image"></image>
 					<view class="left">
-						<text class="opt-name">{{ $conditionMap[opt.conditionType] || '-' }}</text>
+						<text class="opt-name">{{ opt.conditionType | conditionText }}</text>
 						<view class="opt-discount" :class="{ active: currentQuality === opt.conditionType }">
 							<text>{{ opt.discount }}折</text>
 						</view>