This commit is contained in:
HongRun Liu
2026-05-26 15:52:30 +08:00
commit b0744c8ab6
849 changed files with 130587 additions and 0 deletions
+459
View File
@@ -0,0 +1,459 @@
<!-- 订单详情 -->
<template>
<s-pages title="订单详情">
<!-- 收货地址 -->
<view class="order-address-box flex-row bg24" v-if="state.orderInfo.receiverAreaId > 0">
<view class="cityImg">
<image :src="`${$url}goods/city.png`" mode="scaleToFill" />
</view>
<view class="size32 c0">
<view class="ss-flex ss-col-center">
<text class="address-username">
{{ state.orderInfo.receiverName }}
</text>
<text class="address-phone">{{ state.orderInfo.receiverMobile }}</text>
</view>
<view class="address-detail size32">
{{ state.orderInfo.receiverAreaName }} {{ state.orderInfo.receiverDetailAddress }}
</view>
</view>
</view>
<view
class="detail-goods"
:style="[{ marginTop: state.orderInfo.receiverAreaId > 0 ? '0' : '-40rpx' }]"
>
<card_order
class="order-goods"
v-if="state?.orderInfo?.items?.length > 0"
:data="state.orderInfo"
type="2"
theme="2"
@getOrderDetail="getOrderDetail"
></card_order>
<!-- 价格信息 -->
<view class="order-price-box bg24">
<view class="notice-item ss-flex ss-row-between" v-for="(v, i) in priceArr" :key="i">
<text class="title c0">{{ v.title }}</text>
<view class="ss-flex">
<text class="detail c0" :class="{ 'all-price': v.value == 'payPrice' }"
><span>{{ v.type == 2 ? '-' : '' }}</span
>¥{{ fen2yuan(state.orderInfo[v.value]) }}</text
>
</view>
</view>
<view
class="notice-item all-rpice-item ss-flex ss-m-t-20"
v-if="state.orderInfo.refundPrice > 0"
>
<text class="title">已退款</text>
<text class="detail all-price">¥{{ fen2yuan(state.orderInfo.refundPrice) }}</text>
</view>
</view>
<!-- 订单信息 -->
<view class="notice-box bg24">
<view class="notice-box__content">
<view class="notice-item--center">
<view class="ss-flex ss-flex-1 flex-row ju-between">
<text class="title c0">订单编号</text>
<text class="detail right c0">{{ state.orderInfo.no }}</text>
</view>
<!-- <button class="ss-reset-button copy-btn" @tap="onCopy">复制</button> -->
<view class="copy" @click.stop="onCopy">
<image :src="`${$url}goods/copy2.svg`" mode="scaleToFill" />
</view>
<truckLine :data="state.orderInfo" :code="1" v-if="state.orderInfo.deliveryTime"></truckLine>
</view>
<view class="notice-item flex-row ju-between">
<text class="title c0">下单时间</text>
<text class="detail right c0">
{{ sheep.$helper.timeFormat(state.orderInfo.createTime, 'yyyy-mm-dd hh:MM:ss') }}
</text>
</view>
<view class="notice-item flex-row ju-between" v-if="state.orderInfo.payTime">
<text class="title c0">支付时间:</text>
<text class="detail right c0">
{{ sheep.$helper.timeFormat(state.orderInfo.payTime, 'yyyy-mm-dd hh:MM:ss') }}
</text>
</view>
<view class="notice-item flex-row ju-between">
<text class="title c0">支付方式</text>
<text class="detail right c0">{{ state.orderInfo.payChannelName || '-' }}</text>
</view>
</view>
</view>
</view>
<su-fixed bottom placeholder bg="bg24" v-if="state.orderInfo.status != 30">
<view class="orderBan flex-column ju-center">
<card_orderBan :data="state.orderInfo" @downData="getOrderDetail" type="2"></card_orderBan>
</view>
</su-fixed>
</s-pages>
</template>
<script setup>
import sheep from '@/sheep';
import { onLoad, onShow } from '@dcloudio/uni-app';
import { reactive, ref } from 'vue';
import { isEmpty } from 'lodash-es';
import {
fen2yuan,
formatOrderStatus,
formatOrderStatusDescription,
handleOrderButtons,
} from '@/sheep/hooks/useGoods';
import OrderApi from '@/sheep/api/trade/order';
import DeliveryApi from '@/sheep/api/trade/delivery';
import PickUpVerify from '@/pages/order/pickUpVerify.vue';
import card_order from '@/components/orderItem/card_order.vue';
import truckLine from '@/components/truckLine/truckLine.vue'
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
const state = reactive({
orderInfo: {},
merchantTradeNo: '', // 商户订单号
comeinType: '', // 进入订单详情的来源类型
});
// ========== 门店自提(核销) ==========
const systemStore = ref({}); // 门店信息
// 复制
const onCopy = () => {
sheep.$helper.copyText(state.orderInfo.no);
};
const pickUpVerifyRef = ref();
async function getOrderDetail() {
let id = state.orderInfo.id;
// 对详情数据进行适配
let res;
if (state.comeinType === 'wechat') {
// TODO 芋艿:【微信物流】微信场景下
res = await OrderApi.getOrderDetail(id, {
merchant_trade_no: state.merchantTradeNo,
});
} else {
res = await OrderApi.getOrderDetail(id);
}
if (res.code === 0) {
state.orderInfo = res.data;
handleOrderButtons(state.orderInfo);
// 配送方式:门店自提
if (res.data.pickUpStoreId) {
const { data } = await DeliveryApi.getDeliveryPickUpStore(res.data.pickUpStoreId);
systemStore.value = data || {};
}
if (state.orderInfo.deliveryType === 2 && state.orderInfo.payStatus) {
pickUpVerifyRef.value && pickUpVerifyRef.value.markCode(res.data.pickUpVerifyCode);
}
} else {
sheep.$router.back();
}
}
onShow(async () => {
//onShow中获取订单列表,保证跳转后页面为最新状态
await getOrderDetail();
});
onLoad(async (options) => {
let id = 0;
if (options.id) {
id = options.id;
}
// TODO 芋艿:【微信物流】下面两个变量,后续接入
state.comeinType = options.comein_type;
if (state.comeinType === 'wechat') {
state.merchantTradeNo = options.merchant_trade_no;
}
state.orderInfo.id = id;
});
const priceArr = ref([
{
title: '商品金额',
value: 'totalPrice',
type: 1,
},
{
title: '消费金抵扣',
value: 'consumptionPrice',
type: 2,
},
{
title: '运费',
value: 'deliveryPrice',
type: 1,
},
{
title: '实付金额',
value: 'payPrice',
type: 1,
},
]);
</script>
<style lang="scss" scoped>
.score-img {
width: 36rpx;
height: 36rpx;
margin: 0 4rpx;
}
.apply-btn {
width: 140rpx;
height: 50rpx;
border-radius: 25rpx;
font-size: 24rpx;
border: 2rpx solid #dcdcdc;
line-height: normal;
margin-left: 16rpx;
}
.state-box {
color: rgba(#fff, 0.9);
width: 100%;
background: v-bind(headerBg) no-repeat,
linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
background-size: 750rpx 100%;
box-sizing: border-box;
.state-img {
width: 60rpx;
height: 60rpx;
margin-right: 20rpx;
}
}
.order-address-box {
background-color: #fff;
border-radius: 12rpx;
margin: 20rpx 32rpx 24rpx 32rpx;
padding: 24rpx 30rpx 24rpx 20rpx;
font-size: 32rpx;
box-sizing: border-box;
color: #1b1b21;
.address-username {
margin-right: 20rpx;
}
.address-detail {
margin-top: 20rpx;
}
}
.detail-goods {
border-radius: 10rpx;
padding: 0 32rpx;
.order-list {
margin-bottom: 20rpx;
background-color: #fff;
.order-card {
padding: 20rpx 0;
.order-sku {
font-size: 24rpx;
font-weight: 400;
color: rgba(153, 153, 153, 1);
width: 450rpx;
margin-bottom: 20rpx;
.order-num {
margin-right: 10rpx;
}
}
.tag-btn {
margin-left: 16rpx;
font-size: 24rpx;
height: 36rpx;
color: var(--ui-BG-Main);
border: 2rpx solid var(--ui-BG-Main);
border-radius: 14rpx;
padding: 0 4rpx;
}
}
}
}
// 订单信息。
.notice-box {
background: #fff;
border-radius: 12rpx;
margin-bottom: 24rpx;
.notice-box__head {
font-size: 30rpx;
font-weight: 500;
color: rgba(51, 51, 51, 1);
line-height: 80rpx;
border-bottom: 1rpx solid #dfdfdf;
padding: 0 25rpx;
}
.notice-box__content {
padding: 20rpx;
.self-pickup-box {
width: 100%;
.self-pickup--img {
width: 200rpx;
height: 200rpx;
margin: 40rpx 0;
}
}
}
.notice-item,
.notice-item--center {
display: flex;
align-items: center;
line-height: normal;
margin-bottom: 36rpx;
.title {
font-size: 28rpx;
color: #3b3b3b;
}
.detail {
font-size: 28rpx;
color: #323232;
flex: 1;
}
}
}
.copy-btn {
width: 100rpx;
line-height: 50rpx;
border-radius: 25rpx;
padding: 0;
background: rgba(238, 238, 238, 1);
font-size: 22rpx;
font-weight: 400;
color: rgba(51, 51, 51, 1);
}
// 订单价格信息
.order-price-box {
background-color: #fff;
border-radius: 12rpx;
padding: 20rpx;
margin-bottom: 24rpx;
.notice-item {
line-height: 70rpx;
.title {
font-size: 28rpx;
color: #3b3b3b;
}
.detail {
font-size: 28rpx;
color: #323232;
font-family: OPPOSANS;
}
}
.all-rpice-item {
justify-content: flex-end;
align-items: center;
.title {
font-size: 26rpx;
font-weight: 500;
color: #3b3b3b;
line-height: normal;
}
}
}
.all-price {
color: #ee0a24 !important;
}
// 底部
.footer-box {
height: 170rpx;
width: 100%;
box-sizing: border-box;
border-radius: 10rpx;
padding-right: 20rpx;
.cancel-btn {
width: 160rpx;
height: 60rpx;
background: #eeeeee;
border-radius: 30rpx;
margin-right: 20rpx;
font-size: 26rpx;
font-weight: 400;
color: #333333;
}
.pay-btn {
width: 160rpx;
height: 60rpx;
font-size: 26rpx;
border-radius: 30rpx;
font-weight: 500;
color: #fff;
}
}
.cityImg {
width: 48rpx;
min-width: 48rpx;
height: 48rpx;
margin-top: 16rpx;
margin-right: 16rpx;
image {
width: 100%;
height: 100%;
}
}
.order-goods {
padding: 24rpx 20rpx;
box-sizing: border-box;
background-color: #fff;
margin-bottom: 24rpx;
border-radius: 12rpx;
}
.right {
text-align: right;
}
.copy {
width: 32rpx;
height: 32rpx;
margin-left: 14rpx;
image {
width: 100%;
height: 100%;
}
}
.orderBan {
height: 140rpx;
width: 100%;
padding: 0 24rpx;
box-sizing: border-box;
box-shadow: 0px -4px 30px 0px rgba(0, 0, 0, 0.1);
}
</style>