init
This commit is contained in:
@@ -0,0 +1,524 @@
|
||||
<!-- 订单详情 -->
|
||||
<template>
|
||||
<s-pages title="订单详情">
|
||||
<view class="flex-center al-flex-end ju-between p-x-32 m-b-54">
|
||||
<view>
|
||||
<view class="size40 weight500 m-b-16">{{ statusObj[state.orderInfo.status]?.text }}</view>
|
||||
<view class="size24">{{ statusObj[state.orderInfo.status]?.text1 }}</view>
|
||||
</view>
|
||||
<view class="w_120 h_120" v-if="statusObj[state.orderInfo.status]?.icon">
|
||||
<image
|
||||
class="w100 h100"
|
||||
:src="statusObj[state.orderInfo.status]?.icon"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 收货地址 -->
|
||||
<view class="order-address-box flex-row bg24 c0" v-if="state.orderInfo.receiverAreaId > 0">
|
||||
<view class="cityImg">
|
||||
<image :src="`${$url}goods/city1.png`" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="size32">
|
||||
<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
|
||||
theme="2"
|
||||
class="order-goods"
|
||||
v-if="state?.orderInfo?.items?.length > 0"
|
||||
:data="state.orderInfo"
|
||||
type="4"
|
||||
@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 c25">{{ 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>
|
||||
<!-- 订单信息 -->
|
||||
<view
|
||||
class="notice-box bg24"
|
||||
:class="{
|
||||
'm-b-90':
|
||||
statusObj[state.orderInfo.status]?.btn1 || statusObj[state.orderInfo.status]?.btn2,
|
||||
}"
|
||||
>
|
||||
<view class="notice-box__content">
|
||||
<view class="notice-item--center">
|
||||
<view class="ss-flex ss-flex-1 flex-row ju-between">
|
||||
<text class="title c25">订单编号</text>
|
||||
<text class="detail right c0">{{ state.orderInfo.no }}</text>
|
||||
</view>
|
||||
<view class="copy" @click.stop="onCopy">
|
||||
<image :src="`${$url}goods/copy2.svg`" mode="scaleToFill" />
|
||||
</view>
|
||||
<!-- <truckLine :data="state.orderInfo" :code="2" v-if="state.orderInfo.deliveryTime"></truckLine> -->
|
||||
</view>
|
||||
<view class="notice-item flex-row ju-between">
|
||||
<text class="title c25">下单时间</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 c25">支付时间:</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 c25">支付方式</text>
|
||||
<text class="detail right c0">{{ state.orderInfo.payChannelName || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="flex btns bg16"
|
||||
v-if="statusObj[state.orderInfo.status]?.btn1 || statusObj[state.orderInfo.status]?.btn2"
|
||||
>
|
||||
<view
|
||||
class="ai-button1 h_70 line70 size28"
|
||||
:class="{
|
||||
'm-r-28': statusObj[state.orderInfo.status]?.btn2,
|
||||
}"
|
||||
v-if="statusObj[state.orderInfo.status]?.btn1"
|
||||
@click="btn(1)"
|
||||
>{{ statusObj[state.orderInfo.status]?.btn1 }}</view
|
||||
>
|
||||
<view
|
||||
class="ai-button3 h_70 line70 size28"
|
||||
v-if="statusObj[state.orderInfo.status]?.btn2"
|
||||
@click="btn(2)"
|
||||
>{{ statusObj[state.orderInfo.status]?.btn2 }}</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { reactive, ref, getCurrentInstance } from 'vue';
|
||||
import { isEmpty } from 'lodash-es';
|
||||
import {
|
||||
fen2yuan,
|
||||
formatOrderStatus,
|
||||
formatOrderStatusDescription,
|
||||
handleOrderButtons,
|
||||
} from '@/sheep/hooks/useGoods';
|
||||
import * as OrderApi from '@/sheep/api/ai/index';
|
||||
import DeliveryApi from '@/sheep/api/trade/delivery';
|
||||
import PickUpVerify from '@/pages/order/pickUpVerify.vue';
|
||||
import card_order from '@/components/orderItem/card_order.vue';
|
||||
|
||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||
const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
|
||||
let { proxy } = getCurrentInstance();
|
||||
|
||||
const state = reactive({
|
||||
orderInfo: {},
|
||||
merchantTradeNo: '', // 商户订单号
|
||||
comeinType: '', // 进入订单详情的来源类型
|
||||
});
|
||||
let statusObj = ref({
|
||||
0: {
|
||||
text: '待付款',
|
||||
text1: '付款时间还剩余',
|
||||
btn1: '去支付',
|
||||
btn2: '取消订单',
|
||||
},
|
||||
10: {
|
||||
text: '待发货',
|
||||
text1: '您的商品即将发货...',
|
||||
icon: `${proxy.$url}ai/member/12.png`,
|
||||
},
|
||||
20: {
|
||||
text: '待收货',
|
||||
text1: '您的商品已发货,待您确认收货...',
|
||||
icon: `${proxy.$url}ai/member/12.png`,
|
||||
btn1: '确认收货',
|
||||
},
|
||||
30: {
|
||||
text: '已完成',
|
||||
text1: '您的订单已完成,感谢您的购买!',
|
||||
},
|
||||
40: {
|
||||
text: '已取消',
|
||||
text1: '您的订单已取消!',
|
||||
},
|
||||
});
|
||||
|
||||
// ========== 门店自提(核销) ==========
|
||||
const systemStore = ref({}); // 门店信息
|
||||
|
||||
// 复制
|
||||
const onCopy = () => {
|
||||
sheep.$helper.copyText(state.orderInfo.no);
|
||||
};
|
||||
|
||||
const pickUpVerifyRef = ref();
|
||||
let orderId = ref();
|
||||
|
||||
async function getOrderDetail() {
|
||||
let id = orderId.value;
|
||||
// 对详情数据进行适配
|
||||
let res;
|
||||
res = await OrderApi.getOrderDetail({ id });
|
||||
if (res.code === 0) {
|
||||
state.orderInfo = res.data;
|
||||
handleOrderButtons(state.orderInfo);
|
||||
if (state.orderInfo.deliveryType === 2 && state.orderInfo.payStatus) {
|
||||
pickUpVerifyRef.value && pickUpVerifyRef.value.markCode(res.data.pickUpVerifyCode);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
onShow(async () => {
|
||||
//onShow中获取订单列表,保证跳转后页面为最新状态
|
||||
await getOrderDetail();
|
||||
});
|
||||
onLoad(async (options) => {
|
||||
if (options.id) {
|
||||
orderId.value = options.id;
|
||||
}
|
||||
// await getOrderDetail();
|
||||
});
|
||||
|
||||
const priceArr = ref([
|
||||
{
|
||||
title: '商品金额',
|
||||
value: 'totalPrice',
|
||||
type: 1,
|
||||
},
|
||||
{
|
||||
title: '运费',
|
||||
value: 'deliveryPrice',
|
||||
type: 1,
|
||||
},
|
||||
{
|
||||
title: '实付金额',
|
||||
value: 'payPrice',
|
||||
type: 1,
|
||||
},
|
||||
]);
|
||||
const btn = async (type) => {
|
||||
if (state.orderInfo.status === 0 && type === 1) {
|
||||
// 去支付
|
||||
goPay();
|
||||
}
|
||||
if (state.orderInfo.status === 0 && type === 2) {
|
||||
// 取消订单
|
||||
cancelOrder();
|
||||
}
|
||||
if (state.orderInfo.status === 20 && type === 1) {
|
||||
// 确认收货confirmReceive
|
||||
OrderApi.confirmReceive({
|
||||
id: orderId.value,
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
getOrderDetail();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const goPay = () => {
|
||||
proxy.utils.go('/pages/AI/cashierDesk', {
|
||||
id: state.orderInfo.id,
|
||||
payOrderId: state.orderInfo.payOrderId,
|
||||
});
|
||||
};
|
||||
const cancelOrder = () => {
|
||||
OrderApi.cancelOrder({
|
||||
id: orderId.value,
|
||||
}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
getOrderDetail();
|
||||
}
|
||||
});
|
||||
};
|
||||
</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: 24rpx;
|
||||
|
||||
.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: 100rpx;
|
||||
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;
|
||||
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: 100rpx;
|
||||
width: 100%;
|
||||
padding: 0 24rpx;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0px -4px 30px 0px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.btns {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
padding: 10rpx 32rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user