uni-app实现类似物流进度跟踪功能

1、物流进度跟踪的组件

<template>
	<view class="steps">
		<!-- 	<view class="steps_list">
			<view class="node" :class="{'active-node':item.activity == item.index}"></view>
			<view class="tail" :class="{'active-tail':item.activity == item.index}" :hidden="item.index == 0"></view>
		</view> -->
		<view class="wrapper">
			<view class="content">
				<view class="content_t">
					<view class="title">
						<text v-if="item.logType == 1">[查看]</text>
						<text v-if="item.logType == 2">[派单]</text>
						<text v-if="item.logType == 3">[督办]</text>
						<text v-if="item.logType == 4">[处理]</text>
						<text v-if="item.logType == 5">[改单]</text>
					</view>
					<view class="time">
						{{item.createTime}}
					</view>
				</view>

				<view class="content_b" v-if="item.logType == 2">
					<view class="name">
						<text>· 接收人:</text> <text>{{ item.receiverName?item.receiverName:'/' }}</text>
					</view>
					<view class="name">
						<text>· 派单说明:</text> <text>{{ item.content }}</text>
					</view>
				</view>

				<view class="content_b" v-if="item.logType == 3">
					<view class="name">
						<text>· 接收人:</text> <text>{{ item.receiverName?item.receiverName:'/' }}</text>
					</view>
					<view class="name">
						<text>· 督办内容:</text> <text>{{ item.content }}</text>
					</view>
				</view>

				<view class="content_b" v-if="item.logType == 4">
					<view class="name">
						<text>· 处理人:</text> <text>{{item.name?item.name:'/'}}</text>
					</view>
					<view class="name">
						<text>· 是否已处理:</text> <text> <text v-if="item.finishFlg == 1" class="text-green">已处理</text>
							<text class="text-red" v-else>未处理</text> </text>
					</view>
					<view class="name">
						<text>· 处理内容:</text> <text>{{item.content}}</text>
					</view>
				</view>

				<view class="content_b" v-if="item.logType == 5">
					<view class="name">
						<text>· 接收人:</text> <text>{{ item.receiverName? item.receiverName:'/' }}</text>
					</view>
					<view class="name">
						<text>· 内容:</text> <text>{{ item.content }}</text>
					</view>
				</view>

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

<script>
	/*
	item:没条记录详情
	activity: 当前进度条状态
	wrapperStatus:流程状态对应字段
	wrapperTitle:详情对应字段
	index:进度条排列序号 index == 0代表最后一个没有竖立进度条
	date:时间
	 */
	export default {
		name: 'm-steps',
		data() {
			return {

			}
		},
		props: {
			item: {
				type: Object,
			},

		},
		methods: {

		}
	}
</script>

<style lang="scss" scoped>
	.steps {
		display: flex;
		background-color: #fff;

		.steps_list {
			display: flex;
			flex-direction: column;
			align-items: center;
			// padding: 0 0 0 5px;
			// padding: 0 0 40rpx;
			margin-left: 5px;
		}

		.date {
			color: #AAAAAA;
			text-align: left;
			padding-bottom: 10rpx;
		}

		.wrapper {
			width: 100%;
		}

		.tail {
			height: calc(100% - 15rpx);
			;
			width: 2rpx;
			background-color: #eee;
		}

		.active-tail {
			width: 2rpx;
			background-color: #F87362 !important;
		}

		.active-node {
			background-color: #F87362 !important;
		}

		.text-green {
			color: #4cd964;
		}

		.text-red {
			color: red;
		}

		.node {
			width: 15rpx;
			height: 15rpx;
			background-color: #aaa;
			border-radius: 50%;
		}

		.line {
			margin: 0 30rpx;
			background-color: #ececec;
			height: 1px;
		}

		.content {
			width: 100%;
			background-color: #fff;
			border-radius: 5rpx;
			display: flex;
			// padding: 10rpx 0;
			margin-top: 16rpx;
			flex-direction: column;
			    padding: 0 16rpx;
		}

		.content_t {
			width: 100%;
			display: flex;
			align-items: center;
			height: 80rpx;
			padding: 0 24rpx;
			background-color: #fafafa;
			justify-content: space-between;

			.title {
				font-weight: bold;
				font-size: 26rpx;
			}

			.time {
				font-size: 26rpx;
				color: #333;
			}
		}

		.content_b {
			width: 100%;
			display: flex;
			flex-direction: column;
			padding: 16rpx 24rpx;
			flex-wrap: wrap;
			background-color: #fafafa;
			border-top: 1px solid #ececec;

			.name {
				font-size: 26rpx;
				display: flex;
				/* margin-bottom: 10px; */
				justify-content: space-between;
				height:48rpx;
				line-height:48rpx;
				color: #333;
			}

			.scan_time {
				font-size: 12rpx;
				color: #aaa;
				margin: 8rpx 0 0;
			}
		}
	}
</style>


2、调用组件的页面

	<view class="step-view" v-if="detail.alarmLogList.length > 0">
		<PrettySteps v-for="(item, index) in detail.alarmLogList" :item='item' :key="index"></PrettySteps>
	</view>

	import PrettySteps from '@/components/pretty-steps/pretty-steps.vue'

3、页面的效果图

在这里插入图片描述

因为UI的设计图原因,当前这里的处理是先制作好一个卡片,去掉了左侧的横向进度,然后循环遍历实现类似物流跟踪的效果。当然如果你要左侧的那个线的话,可以将我注释的代码拿出来即可。

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Rayong有分享

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值