| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501 |
- <template>
- <view class="order-detail-page">
- <!-- 顶部状态栏 -->
- <view class="status-header">
- <view class="status-text" v-if="orderInfo.cancelStatus == 1">已取消</view>
- <view class="status-text" v-else-if="orderInfo.refundStatus == 3">交易关闭</view>
- <view class="status-text" v-else-if="orderInfo.refundStatus == 2">退款中</view>
- <view class="status-text" v-else>{{ statusText }}</view>
- <view class="status-desc" v-if="orderInfo.status == '2'">
- 订单编号:{{ orderInfo.orderId }}
- <u-icon name="copy" size="28" @click="copyOrderNo" style="margin-left: 10rpx;"></u-icon>
- </view>
- <view class="status-desc" v-else-if="orderInfo.status == '3'">
- 订单编号:{{ orderInfo.orderId }}
- <u-icon name="copy" size="28" @click="copyOrderNo" style="margin-left: 10rpx;"></u-icon>
- </view>
- <view class="status-desc-block" v-else-if="orderInfo.status == '8'">
- <view class="status-tip">还剩9天22时18分自动确认收货</view>
- <view class="status-desc-row">
- 订单编号:{{ orderInfo.orderId }}
- <u-icon name="copy" size="28" @click="copyOrderNo" style="margin-left: 10rpx;"></u-icon>
- </view>
- </view>
- <view class="status-desc" v-else>
- 订单编号:{{ orderInfo.orderId }}
- <u-icon name="copy" size="28" @click="copyOrderNo" style="margin-left: 10rpx;"></u-icon>
- </view>
- </view>
- <!-- 地址信息 -->
- <view class="info-card address-card">
- <view class="icon-box">
- <u-icon name="map-fill" color="#ff0000" size="40"></u-icon>
- </view>
- <view class="address-content">
- <view class="user-info">
- <text class="name">{{ orderInfo.receiverName }}</text>
- <text class="mobile">{{ orderInfo.receiverMobile }}</text>
- </view>
- <view class="address-detail">{{ orderInfo.receiverAddress }}</view>
- </view>
- <u-icon name="arrow-right" color="#999" size="28"></u-icon>
- </view>
- <!-- 物流信息 (已发货/已完成/退款) -->
- <view class="info-card logistics-card"
- v-if="['8', '12', '10'].includes(String(orderInfo.status)) && orderInfo.waybillCode">
- <view class="icon-box">
- <u-icon name="car-fill" color="#38C148" size="40"></u-icon>
- </view>
- <view class="logistics-content" @click="viewLogistics">
- <view class="company-name">物流单号: {{ orderInfo.waybillCode }}</view>
- <view class="latest-trace">点击查看物流详情</view>
- </view>
- <u-icon name="arrow-right" color="#999" size="28"></u-icon>
- </view>
- <!-- 商品列表 -->
- <view class="info-card goods-card">
- <view class="goods-item" v-for="(goods, index) in orderInfo.detailVoList" :key="index">
- <image :src="goods.cover" mode="aspectFill" class="goods-cover"></image>
- <view class="goods-info">
- <view class="goods-title">{{ goods.bookName }}</view>
- <view class="goods-quality" v-if="goods.isbn">ISBN:{{ goods.isbn }}</view>
- <view class="price-box">
- <text class="price">¥{{ goods.price }}</text>
- <text class="num">x{{ goods.num }}</text>
- </view>
- </view>
- <!-- 商品级按钮,如退款 -->
- <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 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>
- </view>
- </view>
- <!-- 价格明细 -->
- <view class="price-detail">
- <view class="row">
- <text>邮费</text>
- <text>¥ {{ orderInfo.expressMoney || '0.00' }}</text>
- </view>
- <view class="row">
- <text>商品金额</text>
- <text class="goods-total">¥{{ orderInfo.totalMoney }}</text>
- </view>
- <view class="row">
- <text>优惠金额</text>
- <text class="discount">-¥{{ orderInfo.discountMoney || '0.00' }}</text>
- </view>
- <view class="real-pay-row">
- <text>实付款 ({{ orderInfo.payType == 1 ? '余额支付' : '微信支付' }})</text>
- <text class="real-price">¥ {{ orderInfo.payMoney }}</text>
- </view>
- </view>
- </view>
- <!-- 订单时间信息 -->
- <view class="info-card time-card">
- <view class="row">
- <text class="label">下单时间</text>
- <text class="value">{{ orderInfo.createTime }}</text>
- </view>
- <view class="row" v-if="orderInfo.payTime">
- <text class="label">付款时间</text>
- <text class="value">{{ orderInfo.payTime }}</text>
- </view>
- <view class="row" v-if="orderInfo.deliveryTime">
- <text class="label">发货时间</text>
- <text class="value">{{ orderInfo.deliveryTime }}</text>
- </view>
- <view class="row" v-if="orderInfo.finishTime">
- <text class="label">完成时间</text>
- <text class="value">{{ orderInfo.finishTime }}</text>
- </view>
- </view>
- <!-- 底部操作栏 -->
- <view class="bottom-bar">
- <!-- 待付款 -->
- <template v-if="orderInfo.status == '2'">
- <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
- @click="handleAction('addToCart')">加入购物车</u-button>
- <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
- @click="handleAction('cancel')">取消订单</u-button>
- <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
- @click="handleAction('address')">修改地址</u-button>
- <u-button size="mini" shape="circle" :custom-style="themeBtnStyle"
- @click="handleAction('pay')">继续付款</u-button>
- </template>
- <!-- 待发货 -->
- <template v-else-if="orderInfo.status == '3'">
- <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
- @click="handleAction('addToCart')">加入购物</u-button>
- <u-button size="mini" shape="circle" type="warning" :custom-style="btnStyle"
- @click="handleAction('overtime')">超时发货</u-button>
- <u-button size="mini" shape="circle" :custom-style="themeBtnStyle"
- @click="handleAction('remind')">催发货</u-button>
- </template>
- <!-- 已发货 -->
- <template v-else-if="orderInfo.status == '8'">
- <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
- @click="handleAction('addToCart')">加入购物</u-button>
- <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
- @click="handleAction('complaint')">投诉</u-button>
- <u-button size="mini" shape="circle" type="primary" :custom-style="themeLightBtnStyle"
- @click="handleAction('priceMatch')">降价补差</u-button>
- <u-button size="mini" shape="circle" :custom-style="themeBtnStyle"
- @click="handleAction('confirm')">确认收货</u-button>
- </template>
- <!-- 交易关闭/已退款 -->
- <template v-else-if="orderInfo.status == '-1' || orderInfo.status == '10'">
- <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
- @click="handleAction('addToCart')">加入购物</u-button>
- <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
- @click="handleAction('complaint')">投诉</u-button>
- <u-button size="mini" shape="circle" :custom-style="themeBtnStyle"
- @click="handleAction('moneyWhere')">钱款去向</u-button>
- </template>
- <!-- 交易完成 -->
- <template v-else-if="orderInfo.status == '12'">
- <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
- @click="handleAction('addToCart')">加入购物</u-button>
- <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
- @click="handleAction('complaint')">投诉</u-button>
- </template>
- </view>
- <!-- 占位符,防止底部按钮遮挡内容 -->
- <view style="height: 120rpx;"></view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- orderInfo: {
- status: '2',
- orderId: '',
- detailVoList: [],
- receiverName: '',
- receiverMobile: '',
- receiverAddress: '',
- expressMoney: 0,
- totalMoney: 0,
- discountMoney: 0,
- payMoney: 0,
- createTime: ''
- },
- btnStyle: {
- marginLeft: '20rpx',
- width: '160rpx',
- height: '60rpx',
- lineHeight: '60rpx',
- padding: '0'
- },
- themeBtnStyle: {
- marginLeft: '20rpx',
- width: '160rpx',
- height: '60rpx',
- lineHeight: '60rpx',
- padding: '0',
- backgroundColor: '#38C148',
- color: '#fff',
- border: 'none'
- },
- themeLightBtnStyle: {
- marginLeft: '20rpx',
- width: '160rpx',
- height: '60rpx',
- lineHeight: '60rpx',
- padding: '0',
- backgroundColor: '#5bc0de',
- color: '#fff',
- border: 'none'
- }
- };
- },
- computed: {
- statusText() {
- const map = {
- '1': '等待买家付款',
- '2': '等待卖家发货',
- '3': '已发货',
- '4': '交易完成',
- };
- return map[String(this.orderInfo.status)] || '未知状态';
- }
- },
- onLoad(options) {
- if (options.orderId) {
- this.loadOrderDetail(options.orderId);
- }
- },
- methods: {
- loadOrderDetail(orderId) {
- uni.$u.http.get('/token/shop/order/getOrderDetail', {
- orderId: orderId
- }).then((res) => {
- if (res.code === 200) {
- this.orderInfo = res.data;
- }
- });
- },
- copyOrderNo() {
- uni.setClipboardData({
- data: String(this.orderInfo.orderId),
- success: () => {
- uni.showToast({ title: '复制成功', icon: 'none' });
- }
- });
- },
- viewLogistics() {
- uni.navigateTo({
- url: `/pages-car/pages/logistics-detail?orderId=${this.orderInfo.orderId}`
- });
- },
- handleAction(type) {
- if (type === 'complaint') {
- uni.setStorageSync('tempComplaintOrder', this.orderInfo);
- uni.navigateTo({
- url: `/pages-car/pages/complaint?orderId=${this.orderInfo.orderId}`
- });
- return;
- }
- uni.showToast({ title: `点击了${type}`, icon: 'none' });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .order-detail-page {
- min-height: 100vh;
- background-color: #F5F5F5;
- padding-bottom: 20rpx;
- .status-header {
- background-color: #d1f2d8; // Light green bg
- padding: 40rpx 30rpx;
- color: #333;
- .status-text {
- font-size: 36rpx;
- font-weight: bold;
- margin-bottom: 10rpx;
- }
- .status-desc {
- font-size: 26rpx;
- color: #666;
- display: flex;
- align-items: center;
- }
- .status-desc-block {
- font-size: 26rpx;
- color: #666;
- .status-tip {
- margin-bottom: 10rpx;
- }
- .status-desc-row {
- display: flex;
- align-items: center;
- }
- }
- }
- .info-card {
- background-color: #fff;
- margin: 20rpx;
- border-radius: 16rpx;
- padding: 30rpx;
- display: flex;
- &.address-card {
- align-items: center;
- .icon-box {
- margin-right: 20rpx;
- }
- .address-content {
- flex: 1;
- margin-right: 20rpx;
- .user-info {
- font-size: 30rpx;
- font-weight: 500;
- margin-bottom: 10rpx;
- .mobile {
- margin-left: 20rpx;
- }
- }
- .address-detail {
- font-size: 26rpx;
- color: #666;
- line-height: 1.4;
- }
- }
- }
- &.logistics-card {
- align-items: center;
- .icon-box {
- margin-right: 20rpx;
- }
- .logistics-content {
- flex: 1;
- margin-right: 20rpx;
- .company-name {
- font-size: 28rpx;
- color: #38C148;
- margin-bottom: 6rpx;
- }
- .latest-trace {
- font-size: 26rpx;
- color: #333;
- margin-bottom: 6rpx;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- }
- .update-time {
- font-size: 24rpx;
- color: #999;
- }
- }
- }
- &.goods-card {
- display: block;
- .goods-item {
- display: flex;
- margin-bottom: 30rpx;
- .goods-cover {
- width: 120rpx;
- height: 120rpx;
- border-radius: 8rpx;
- margin-right: 20rpx;
- background-color: #eee;
- }
- .goods-info {
- flex: 1;
- .goods-title {
- font-size: 28rpx;
- color: #333;
- margin-bottom: 10rpx;
- }
- .goods-quality {
- font-size: 24rpx;
- color: #999;
- }
- .price-box {
- margin-top: 10rpx;
- display: flex;
- justify-content: space-between;
- .price {
- font-weight: 500;
- }
- .num {
- color: #999;
- }
- }
- }
- .goods-action {
- display: flex;
- align-items: center;
- }
- }
- .price-detail {
- border-top: 1rpx solid #eee;
- padding-top: 20rpx;
- .row {
- display: flex;
- justify-content: space-between;
- font-size: 26rpx;
- color: #666;
- margin-bottom: 10rpx;
- .goods-total {
- color: #38C148;
- }
- .discount {
- color: #38C148;
- }
- }
- .real-pay-row {
- display: flex;
- justify-content: space-between;
- font-size: 30rpx;
- font-weight: 500;
- margin-top: 20rpx;
- .real-price {
- color: #38C148;
- }
- }
- }
- }
- &.time-card {
- display: block;
- .row {
- display: flex;
- justify-content: space-between;
- font-size: 24rpx;
- color: #999;
- margin-bottom: 10rpx;
- &:last-child {
- margin-bottom: 0;
- }
- }
- }
- }
- .bottom-bar {
- position: fixed;
- bottom: 0;
- left: 0;
- right: 0;
- background-color: #fff;
- padding: 20rpx 30rpx;
- padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
- display: flex;
- justify-content: flex-end;
- align-items: center;
- box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
- }
- }
- </style>
|