order_detail.vue 4.9 KB
<template>
	<view class="orderDetail">
		<view class="dettop">
			<view class="top flexA">
				<text>{{detail.orderinfo.seller_name}}</text>
				<image src="/static/2.png" mode=""></image>
				<text>{{detail.buyer_name}}</text>
			</view>
			<view class="topbox" @click="ondetail(detail.id)">
				<view class="boxtop flexD">
					<view class="order">
						订单号:{{detail.order_no}}
					</view>
					<view class="ordstats">
						<text v-if="detail.status==1">待支付</text>
						<text v-if="detail.status==2">待接收</text>
						<text v-if="detail.status==3">待买家确认</text>
						<text v-if="detail.status==4">已收货</text>
						<text v-if="detail.status==5">平台裁决</text>
						<text v-if="detail.status==6">已完成</text>
						<text v-if="detail.status==7">交易失败</text>
					</view>
				</view>
				<view class="item flexA">
					<view class="left">
						<image :src="detail.orderinfo.images_preview" mode=""></image>
					</view>
					<view class="right">
						<view class="">{{detail.orderinfo.product_name}}</view>
						<view class="money"><text>¥</text> {{detail.orderinfo.price}}</view>
					</view>
				</view>
			</view>

		</view>
		<view class="express">
			<view class="bar" v-for="(item,index) in expresslist" :key="index">
				<view class="time">
					<view>{{item.date}}</view>
					<view>{{item.time}}</view>
				</view>
				<view class="centers flexcolum">
					<image v-if="detail.status==6" src="/static/3.png" mode=""></image>
					<image v-else src="/static/4.png" mode=""></image>
					<view class="tip">
					</view>
				</view>
				<view class="contant">
					{{item.name}}
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	import {
		order_detail
	} from '@/api/order.js'
	export default {
		data() {
			return {
				id: '',
				expresslist: [],
				detail: {
					buyer_name: "",
					order_no: "",
					status: "",
					orderinfo: {
						seller_name: "",
						product_name: "",
						price: "",
						images_preview: "",
					}
				},
			};
		},
		onLoad(options) {
			this.id = options.id
			this.order_detail()
		},
		methods: {
			//跳转详情
			ondetail(item) {
				uni.navigateTo({
					url: "/pages/index/detail?id=" + item
				})
			},
			//订单详情
			async order_detail() {
				try {
					const res = await order_detail(this.id)
					console.log('order_detail', res)
					this.detail = res.detail
					this.expresslist = res.detail.time_data
					// 保存数据
				} catch (err) {
					uni.showToast({
						title: err,
						icon: 'none'
					})
					console.log('order_detail', err)
				}
			},
		}
	}
</script>

<style lang="scss">
	page {
		background: #f6f6f6;
	}

	.orderDetail {
		.dettop {
			height: 294rpx;
			opacity: 1;
			padding: 40rpx 32rpx;
			background: linear-gradient(180deg, rgba(254, 208, 0, 1) 0%, rgba(254, 208, 0, 0) 92%);

			.top {
				color: rgba(0, 0, 0, 1);
				font-size: 26rpx;
				font-weight: 400;
				font-family: "PingFang SC";
				text-align: left;

				image {
					margin: 0 12rpx;
					width: 80rpx;
					height: 9rpx;
				}

			}

			.topbox {
				margin-top: 24rpx;
				border-radius: 24rpx;
				padding: 28rpx 32rpx;
				background: #ffffff;

				.boxtop {
					.order {
						color: rgba(0, 0, 0, 0.6);
						font-size: 24rpx;
						font-weight: 400;
						font-family: "PingFang SC";
					}

					.ordstats {
						color: rgba(254, 208, 0, 1);
						font-size: 28rpx;
						font-weight: 500;
						font-family: "PingFang SC";
						text-align: left;
						line-height: 40rpx;
					}
				}

				.item {
					margin-top: 20rpx;

					.left {
						image {
							margin-right: 16rpx;
							width: 120rpx;
							height: 120rpx;
							border-radius: 16rpx;
						}
					}

					.right {
						color: rgba(0, 0, 0, 0.9);
						font-size: 28rpx;
						font-weight: 400;
						font-family: "PingFang SC";
						text-align: center;

						.money {
							margin-top: 32rpx;
							color: rgba(248, 83, 23, 1);
							font-size: 32rpx;
							font-weight: 700;
							font-family: "Montserrat";

							text {
								font-size: 28rpx;
							}
						}
					}
				}

			}
		}

		.express {
			padding: 66rpx 30rpx;
			background-color: #ffffff;
			box-sizing: border-box;
			width: 686rpx;
			// height: 628rpx;
			border-radius: 24rpx;
			margin: 0 auto;

			.bar {
				display: flex;



				.time {
					color: rgba(135, 144, 153, 1);
					font-size: 22rpx;
					font-weight: 400;
					font-family: "PingFang SC";
				}

				.centers {
					image {
						width: 48rpx;
						height: 48rpx;
					}

					.tip {
						height: 80rpx;
						width: 4rpx;
						background-color: #f6f6f6;
					}
				}

				.contant {
					margin-left: 8rpx;
					color: rgba(135, 144, 153, 1);
					font-size: 28rpx;
					font-weight: 400;
					font-family: "PingFang SC";
				}

				&:last-child {
					.centers {
						.tip {
							height: 0;
							width: 0;
							background-color: #f6f6f6;
						}
					}
				}
			}
		}
	}
</style>