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

在这里插入图片描述

### 寄快递功能的小程序源码分析 对于寻找具有寄快递功能的小程序源码的需求,可以从开源社区中找到一些相关的项目。以下是几个可能满足需求的方向: #### 1. **Amis 框架** Amis 是百度推出的一个前端低代码框架,可以通过 JSON 配置快速生成页面[^1]。虽然 Amis 主要用于 Web 应用开发,但它也可以作为小程序后端服务的一部分来实现复杂的业务逻辑。如果需要构建一个带有寄快递功能的小程序,可以考虑使用 Amis 来处理部分后台配置。 #### 2. **Buefy 框架** 尽管 Buefy 是基于 Vue.js 的 UI 组件库,主要用于 Web 开发[^2],但如果开发者熟悉 Vue 技术栈,则可以将其与微信小程序结合,通过跨平台工具(如 Taro 或 Uni-app实现类似的寄快递功能。 #### 3. **进销存库存管理系统的扩展** 提到的具体案例是一个基于小程序的进销存库存管理系统[^3]。该项目提供了完整的源码、文档和运行视频教程,适合初学者学习并在此基础上进行二次开发。由于该系统已经涉及物流管理和订单跟踪功能模块,因此非常适合用来改造为支持寄快递操作的应用场景。 为了进一步适配寄快递的功能,可以在现有架构上增加如下特性: - 调用微信支付接口完成运费结算; - 整合第三方物流公司 API 实现寄件下单流程自动化; - 提供实时查询运单状态的服务给用户查看进度; 下面展示一段简单的伪代码片段说明如何调用某家快递公司的 RESTful APIs 完成创建新的运输请求: ```javascript // 创建一个新的运输请求示例 function createShipment(orderId, recipientName, phoneNumber, address){ const apiKey = 'your_api_key_here'; // 替换为您自己的API密钥 let requestData ={ order_id : orderId, consignee_name:recipientName , phone_number:phoneNumber , destination_address:address }; fetch('https://api.shippingcompany.com/v1/shipments',{ method:'POST', headers:{ Authorization:`Bearer ${apiKey}`, 'Content-Type':'application/json' }, body:JSON.stringify(requestData) }) .then(response => response.json()) .then(data =>{ console.log(`成功提交托运申请`,data); }); } ``` 以上仅为理论上的实现方式之一,在实际应用前还需要仔细阅读目标服务商的技术手册以确保兼容性和安全性等问题得到妥善解决。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Rayong有分享

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

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

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

打赏作者

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

抵扣说明:

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

余额充值