ソースを参照

feat: 优化订单和提现功能,添加余额支付优惠提示

- 在购物车商品项中恢复品相显示,使用过滤器格式化条件文本
- 在收银台余额支付选项添加“8折优惠”标签
- 优化修改订单地址后的刷新逻辑,添加延迟确保数据同步
- 移除订单详情页的商品级退款按钮以简化界面
- 在提现页面添加确认弹窗,提示余额购买可享8折优惠
- 在物流详情页添加空状态显示,优化无数据时的用户体验
ylong 1 ヶ月 前
コミット
4e2c0a3735

+ 3 - 3
pages-car/components/buy-book-item.vue

@@ -12,9 +12,9 @@
                     </view>
                 </view>
 
-                <!-- <view class="flex flex-j-b flex-a-c">
-                    <view class="book-quality">品相:{{ book.conditionName || '中等' }}</view>
-                </view> -->
+                <view class="flex flex-j-b flex-a-c">
+                    <view class="book-quality">品相:{{ book.conditionType | conditionText }}</view>
+                </view>
                 
                 <view class="flex flex-j-b flex-a-c mt-10">
                     <view class="book-price">

+ 11 - 0
pages-car/pages/cashier-desk.vue

@@ -27,6 +27,7 @@
                     <view class="left">
                         <image src="/pages-mine/static/pay2.png" class="payment-icon"></image>
                         <text>余额支付(余额{{ orderInfo.accountMoney || 0 }})</text>
+                        <view class="discount-tag">8折优惠</view>
                     </view>
                     <u-radio active-color="#38C148" name="1" />
                 </view>
@@ -232,6 +233,16 @@
                         font-size: 30rpx;
                         color: #333;
                     }
+
+                    .discount-tag {
+                        background: linear-gradient(90deg, #ff6034, #ee0a24);
+                        color: #fff;
+                        font-size: 22rpx;
+                        padding: 4rpx 12rpx;
+                        border-radius: 20rpx 20rpx 20rpx 0;
+                        margin-left: 10rpx;
+                        font-weight: bold;
+                    }
                 }
             }
         }

+ 77 - 44
pages-car/pages/logistics-detail.vue

@@ -1,7 +1,7 @@
 <template>
     <view class="logistics-page">
         <!-- 顶部包裹切换 -->
-        <scroll-view scroll-x class="package-tabs" :scroll-into-view="'tab-' + currentPackageIndex">
+        <scroll-view scroll-x class="package-tabs" :scroll-into-view="'tab-' + currentPackageIndex" v-if="packages.length > 0">
             <view class="tab-list">
                 <view class="tab-item" v-for="(item, index) in packages" :key="index" :id="'tab-' + index"
                     :class="{ active: currentPackageIndex === index }" @click="switchPackage(index)">
@@ -10,59 +10,70 @@
             </view>
         </scroll-view>
 
-        <!-- 物流基本信息 -->
-        <view class="card info-card">
-            <view class="info-row">
-                <text class="label">承运商:</text>
-                <text class="value">{{ currentPackage.expressName }}</text>
-            </view>
-            <view class="info-row">
-                <text class="label">物流单号:</text>
-                <text class="value">{{ currentPackage.waybillCode }}</text>
-                <view class="copy-btn" @click="copyTrackingNo">复制</view>
-            </view>
-        </view>
-
-        <!-- 物流轨迹 -->
-        <view class="card timeline-card">
-            <!-- 收货地址 -->
-            <view class="timeline-item address-item">
-                <view class="left-col">
-                    <view class="icon-box address-icon">收</view>
-                    <view class="line"></view>
+        <template v-if="packages.length > 0">
+            <!-- 物流基本信息 -->
+            <view class="card info-card">
+                <view class="info-row">
+                    <text class="label">承运商:</text>
+                    <text class="value">{{ currentPackage.expressName }}</text>
                 </view>
-                <view class="right-col">
-                    <view class="status-title">收货地址:{{ currentPackage.receiveAddress }}</view>
+                <view class="info-row">
+                    <text class="label">物流单号:</text>
+                    <text class="value">{{ currentPackage.waybillCode }}</text>
+                    <view class="copy-btn" @click="copyTrackingNo">复制</view>
                 </view>
             </view>
 
-            <!-- 轨迹列表 -->
-            <view class="timeline-item" v-for="(trace, index) in currentPackage.trackingVoList" :key="index">
-                <view class="left-col">
-                    <!-- 不同状态显示不同图标 -->
-                    <view v-if="index === 0 && ['已签收', '签收'].includes(trace.status)" class="icon-box check-icon">
-                        <u-icon name="checkmark" color="#fff" size="20"></u-icon>
-                    </view>
-                    <view v-else-if="['派送中', '派件'].includes(trace.status)" class="icon-box delivery-icon">
-                        <u-icon name="man" color="#fff" size="24"></u-icon>
-                    </view>
-                    <view v-else-if="['运输中', '在途'].includes(trace.status)" class="icon-box transport-icon">
-                        <u-icon name="car" color="#fff" size="24"></u-icon>
+            <!-- 物流轨迹 -->
+            <view class="card timeline-card">
+                <!-- 收货地址 -->
+                <view class="timeline-item address-item">
+                    <view class="left-col">
+                        <view class="icon-box address-icon">收</view>
+                        <view class="line"></view>
                     </view>
-                    <view v-else-if="['已下单', '揽收'].includes(trace.status)" class="icon-box order-icon">
-                        <u-icon name="order" color="#fff" size="24"></u-icon>
+                    <view class="right-col">
+                        <view class="status-title">收货地址:{{ currentPackage.receiveAddress }}</view>
                     </view>
-                    <view v-else class="dot"></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.context }}</view>
-                    <view class="status-time">{{ trace.ftime }}</view>
+                <!-- 轨迹列表 -->
+                <view class="timeline-item" v-for="(trace, index) in currentPackage.trackingVoList" :key="index">
+                    <view class="left-col">
+                        <!-- 不同状态显示不同图标 -->
+                        <view v-if="index === 0 && ['已签收', '签收'].includes(trace.status)" class="icon-box check-icon">
+                            <u-icon name="checkmark" color="#fff" size="20"></u-icon>
+                        </view>
+                        <view v-else-if="['派送中', '派件'].includes(trace.status)" class="icon-box delivery-icon">
+                            <u-icon name="man" color="#fff" size="24"></u-icon>
+                        </view>
+                        <view v-else-if="['运输中', '在途'].includes(trace.status)" class="icon-box transport-icon">
+                            <u-icon name="car" color="#fff" size="24"></u-icon>
+                        </view>
+                        <view v-else-if="['已下单', '揽收'].includes(trace.status)" class="icon-box order-icon">
+                            <u-icon name="order" color="#fff" size="24"></u-icon>
+                        </view>
+                        <view v-else class="dot"></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.context }}</view>
+                        <view class="status-time">{{ trace.ftime }}</view>
+                    </view>
                 </view>
             </view>
+        </template>
+        
+        <!-- 空状态 -->
+        <view class="empty-state" v-else-if="!loading">
+            <view class="flex-d flex-a-c empty-box">
+                <image src="https://shuhi.oss-cn-qingdao.aliyuncs.com/mini/no-data.png"
+                    style="width: 100%; height: 260rpx" mode="heightFix"></image>
+                <view class="common-title">暂无物流信息</view>
+            </view>
         </view>
     </view>
 </template>
@@ -71,6 +82,7 @@
 export default {
     data() {
         return {
+            loading: true,
             currentPackageIndex: 0,
             packages: [], // Changed to empty array, will be populated by API
             orderId: '',
@@ -93,6 +105,7 @@ export default {
     },
     methods: {
         getLogisticsData() {
+            this.loading = true;
             uni.showLoading({
                 title: '加载中'
             });
@@ -102,6 +115,7 @@ export default {
 
             this.$u.api.getOrderTrackingAjax(params).then(res => {
                 uni.hideLoading();
+                this.loading = false;
                 if (res.code == 200) {
                     const data = res.data || [];
                     
@@ -115,6 +129,7 @@ export default {
                 }
             }).catch(() => {
                 uni.hideLoading();
+                this.loading = false;
                 this.$u.toast('网络请求失败');
             });
         },
@@ -324,4 +339,22 @@ export default {
         }
     }
 }
+
+.empty-state {
+    padding-top: 100rpx;
+    display: flex;
+    justify-content: center;
+
+    .empty-box {
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+
+        .common-title {
+            font-size: 30rpx;
+            color: #999;
+            margin-top: 30rpx;
+        }
+    }
+}
 </style>

+ 4 - 4
pages-car/pages/my-order.vue

@@ -21,7 +21,7 @@
 
         <!-- 极速退款弹窗 -->
         <fast-refund-dialog ref="refundDialog" @refresh="loadOrders(true, params)"></fast-refund-dialog>
-        
+
         <!-- 催发货弹窗 -->
         <urge-delivery-dialog ref="urgeDialog" @success="loadOrders(true, params)"></urge-delivery-dialog>
 
@@ -85,7 +85,6 @@
         methods: {
             onAddressSelected(addr) {
                 if (this.modifyingOrderId && addr && addr.id) {
-                    uni.showLoading({ title: '修改中' });
                     this.$u.api.modifyOrderAddressAjax({
                         orderId: this.modifyingOrderId,
                         addressId: addr.id
@@ -93,8 +92,9 @@
                         uni.hideLoading();
                         if (res.code == 200) {
                             uni.showToast({ title: '修改成功', icon: 'success' });
-                            // 刷新列表
-                            this.loadOrders(true, this.params);
+                            setTimeout(() => {
+                                this.loadOrders(true, this.params);
+                            }, 1000)
                         }
                     }).finally(() => {
                         this.modifyingOrderId = null;

+ 3 - 4
pages-car/pages/order-detail.vue

@@ -65,10 +65,10 @@
                     </view>
                 </view>
                 <!-- 商品级按钮,如退款 -->
-                <view class="goods-action" v-if="['3', '8'].includes(String(orderInfo.status))">
+                <!-- <view class="goods-action" v-if="['3', '8'].includes(String(orderInfo.status))">
                     <u-button size="mini" shape="circle" plain
                         custom-style="margin-left: 20rpx; height: 50rpx; line-height: 50rpx;">退款</u-button>
-                </view>
+                </view> -->
                 <view class="goods-action" v-if="['10'].includes(String(orderInfo.status))">
                     <u-button size="mini" shape="circle" plain disabled
                         custom-style="margin-left: 20rpx; height: 50rpx; line-height: 50rpx; background: #f5f5f5; color: #999; border: none;">退款成功</u-button>
@@ -187,7 +187,6 @@
         methods: {
             onAddressSelected(addr) {
                 if (this.isModifyingAddress && addr && addr.id) {
-                    uni.showLoading({ title: '修改中' });
                     this.$u.api.modifyOrderAddressAjax({
                         orderId: this.orderInfo.orderId,
                         addressId: addr.id
@@ -197,7 +196,7 @@
                             uni.showToast({ title: '修改成功', icon: 'success' });
                             setTimeout(() => {
                                 this.loadOrderDetail(this.orderInfo.orderId);
-                            }, 1500);
+                            }, 1000);
                         }
                     }).finally(() => {
                         this.isModifyingAddress = false;

+ 47 - 3
pages-mine/pages/withdraw.vue

@@ -52,13 +52,26 @@
         </view>
         <!-- 提现按钮 -->
         <view class="submit-btn mt-60">
-            <u-button type="primary" @click="submitWithdraw">确认提现</u-button>
+            <u-button type="primary" @click="showConfirmDialog">确认提现</u-button>
         </view>
+
+        <!-- 提现确认弹窗 -->
+        <common-dialog ref="withdrawDialog" title="温馨提示" cancelText="继续提现" confirmText="购买书籍" @confirm="goToHome" @cancel="submitWithdraw" :customStyle="{ paddingBottom: '20rpx' }">
+            <view class="dialog-tip-content">
+                <view>亲,余额不支持充值哦!余额购买商城所有商品可享<text class="highlight">8折优惠</text>。</view>
+                <view class="mt-10">发起提现后,平台会逐一审核付款,提现金额最晚会在<text class="highlight">72小时到账</text>(周末/节假日顺延)</view>
+            </view>
+        </common-dialog>
     </view>
 </template>
 
 <script>
+import CommonDialog from '@/components/common-dialog.vue';
+
 export default {
+    components: {
+        CommonDialog
+    },
     data() {
         return {
             userInfo: {
@@ -97,8 +110,8 @@ export default {
             this.withdrawAmount = this.userInfo.restMoney
         },
 
-        // 提交提现
-        async submitWithdraw() {
+        // 显示确认提现弹窗
+        showConfirmDialog() {
             if (this.withdrawAmount <= 0) {
                 uni.showToast({ title: '请输入提现金额', icon: 'none' })
                 return
@@ -112,6 +125,19 @@ export default {
                 return
             }
 
+            // 参数校验通过后显示弹窗
+            this.$refs.withdrawDialog.openPopup()
+        },
+
+        // 跳转首页购买书籍
+        goToHome() {
+            uni.switchTab({
+                url: '/pages/sell/index'
+            })
+        },
+
+        // 提交提现
+        async submitWithdraw() {
             uni.showLoading({
                 title: '提交中...',
                 mask: true
@@ -257,5 +283,23 @@ export default {
         color: #333333;
         line-height: 42rpx;
     }
+
+    .dialog-tip-content {
+        text-align: left;
+        font-size: 28rpx;
+        color: #666;
+        line-height: 48rpx;
+        padding: 10rpx 0;
+
+        .highlight {
+            color: #ee0a24;
+            font-weight: bold;
+            margin: 0 4rpx;
+        }
+
+        .mt-10 {
+            margin-top: 20rpx;
+        }
+    }
 }
 </style>