uniapp订单循环列表倒计时

news2025/1/23 10:45:27

目录

    • 效果图片
    • 插件uni-countdown
    • 代码
    • 最后

效果图片

请添加图片描述

插件uni-countdown

地址

代码

<template>
	<view class="">
		<!-- 下面循环两个列表 -->
		<view class="item" v-for="(item, index) in listData" :key="index">
			<!-- <text class="shoppay-right1">{{ item.state_text }}</text>
			<view v-if="item.state_text == '待付款'">
				<uni-countdown :showDay="false" :showHour="true" :fontSize="12" color="#F81111"
					splitorColor='#F81111' :minute="item.minute" :second="item.second"
					@timeup="handleTimeup(index)" style=""></uni-countdown>
			</view> -->
			<uni-countdown :showDay="false" :showHour="true" :fontSize="12" color="#F81111" splitorColor='#F81111'
				:minute="item.minute" :second="item.second" style=""></uni-countdown>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// listData: [],
				//定义一个假数据
				listData: [
					{
						"order_id": 70,
						"order_no": "2023101751999997",
						"total_price": "345.00",
						"order_price": "345.00",
						"coupon_id": 0,
						"coupon_money": "0.00",
						"coupon_id_sys": 0,
						"coupon_money_sys": "0.00",
						"points_money": "0.00",
						"points_num": 0,
						"pay_price": "345.00",
						"update_price": {
							"symbol": "+",
							"value": "0.00"
						},
						"fullreduce_money": 0,
						"fullreduce_remark": "",
						"product_reduce_money": "0.00",
						"buyer_remark": "",
						"pay_type": {
							"text": "微信支付",
							"value": 20
						},
						"pay_source": "",
						"pay_status": {
							"text": "待付款",
							"value": 10
						},
						"pay_time": 0,
						"pay_end_time": 1697538731,
						"delivery_type": {
							"text": "快递配送",
							"value": 10
						},
						"extract_store_id": 0,
						"extract_clerk_id": 0,
						"express_price": "0.00",
						"express_id": 0,
						"express_company": "",
						"express_no": "",
						"delivery_status": {
							"text": "待发货",
							"value": 10
						},
						"delivery_time": 0,
						"receipt_status": {
							"text": "待收货",
							"value": 10
						},
						"receipt_time": 0,
						"order_status": {
							"text": "进行中",
							"value": 10
						},
						"points_bonus": 0,
						"is_settled": 0,
						"transaction_id": "",
						"is_comment": 0,
						"order_source": 10,
						"user_id": 1,
						"is_refund": 0,
						"assemble_status": 0,
						"activity_id": 0,
						"is_agent": 1,
						"shop_supplier_id": 3,
						"supplier_money": "345.00",
						"sys_money": "0.00",
						"room_id": 0,
						"cancel_remark": "",
						"virtual_auto": 0,
						"virtual_content": "",
						"balance": "0.00",
						"online_money": "0.00",
						"refund_money": "0.00",
						"trade_no": "2023101751999997",
						"wx_delivery_status": 10,
						"is_delete": 0,
						"app_id": 10001,
						"create_time": "2023-10-17 18:22:11",
						"product_id": 12,
						"category_id": 8,
						"name": "智能设备",
						"spec_name": "小时",
						"logo_id": 13,
						"storage": "local",
						"save_name": "20230926/478df4597d5266ccb33c5fb1f1b5782c.png",
						"file_url": "",
						"file_name": "20230926155419ee8325089.png",
						"pay_end_time_format": "6分钟",
						"file_path": "http://bangke.yunjingwl.com/uploads/20230926/478df4597d5266ccb33c5fb1f1b5782c.png",
						"product": [{
							"order_product_id": 44,
							"product_id": 12,
							"product_name": "测试456",
							"image_id": 37,
							"deduct_stock_type": 10,
							"spec_type": 10,
							"spec_sku_id": "0",
							"product_sku_id": 19,
							"product_attr": "",
							"product_no": "123",
							"product_price": "345.00",
							"line_price": "345.00",
							"product_weight": 34553435,
							"is_user_grade": 0,
							"grade_ratio": 0,
							"grade_product_price": "0.00",
							"grade_total_money": "0.00",
							"coupon_money_sys": "0.00",
							"coupon_money": "0.00",
							"points_money": "0.00",
							"points_num": 0,
							"points_bonus": 0,
							"total_num": 1,
							"total_price": "345.00",
							"total_pay_price": "345.00",
							"supplier_money": "345.00",
							"sys_money": "0.00",
							"fullreduce_money": "0.00",
							"product_reduce_money": "0.00",
							"is_agent": 0,
							"is_ind_agent": 0,
							"agent_money_type": 10,
							"first_money": "0.00",
							"second_money": "0.00",
							"third_money": "0.00",
							"is_comment": 0,
							"order_id": 70,
							"user_id": 1,
							"product_source_id": 0,
							"sku_source_id": 0,
							"bill_source_id": 0,
							"virtual_content": "",
							"app_id": 10001,
							"create_time": "2023-10-17 18:22:11",
							"image": {
								"file_id": 37,
								"storage": "local",
								"group_id": 0,
								"file_url": "",
								"save_name": "20231009/cfd4f6da754767b47f60197f1dd3e40b.png",
								"file_name": "2023100910385524eb17726.png",
								"file_size": 890511,
								"file_type": "image",
								"real_name": "371fa09067c9b88007071d53a38303a4@2x.png",
								"extension": "png",
								"is_user": 0,
								"is_recycle": 0,
								"shop_supplier_id": 3,
								"is_delete": 0,
								"app_id": 10001,
								"create_time": "2023-10-09 10:38:55",
								"update_time": 0,
								"file_path": "http://bangke.yunjingwl.com/uploads/20231009/cfd4f6da754767b47f60197f1dd3e40b.png"
							}
						}],
						"supplier": {
							"shop_supplier_id": 3,
							"name": "测试3",
							"user_id": 3
						},
						"advance": null,
						"state_text": "待付款",
						"order_source_text": "普通",
						"pay_end_time_text": "2023-10-17 18:32:11"
					},
					 {
						"order_id": 69,
						"order_no": "2023101799545110",
						"total_price": "100.00",
						"order_price": "100.00",
						"coupon_id": 0,
						"coupon_money": "0.00",
						"coupon_id_sys": 0,
						"coupon_money_sys": "0.00",
						"points_money": "0.00",
						"points_num": 0,
						"pay_price": "100.00",
						"update_price": {
							"symbol": "+",
							"value": "0.00"
						},
						"fullreduce_money": 0,
						"fullreduce_remark": "",
						"product_reduce_money": "0.00",
						"buyer_remark": "",
						"pay_type": {
							"text": "微信支付",
							"value": 20
						},
						"pay_source": "",
						"pay_status": {
							"text": "待付款",
							"value": 10
						},
						"pay_time": 0,
						"pay_end_time": 1697537876,
						"delivery_type": {
							"text": "快递配送",
							"value": 10
						},
						"extract_store_id": 0,
						"extract_clerk_id": 0,
						"express_price": "0.00",
						"express_id": 0,
						"express_company": "",
						"express_no": "",
						"delivery_status": {
							"text": "待发货",
							"value": 10
						},
						"delivery_time": 0,
						"receipt_status": {
							"text": "待收货",
							"value": 10
						},
						"receipt_time": 0,
						"order_status": {
							"text": "已取消",
							"value": 20
						},
						"points_bonus": 0,
						"is_settled": 0,
						"transaction_id": "",
						"is_comment": 0,
						"order_source": 10,
						"user_id": 1,
						"is_refund": 0,
						"assemble_status": 0,
						"activity_id": 0,
						"is_agent": 1,
						"shop_supplier_id": 1,
						"supplier_money": "100.00",
						"sys_money": "0.00",
						"room_id": 0,
						"cancel_remark": "",
						"virtual_auto": 0,
						"virtual_content": "",
						"balance": "0.00",
						"online_money": "0.00",
						"refund_money": "0.00",
						"trade_no": "2023101799545110",
						"wx_delivery_status": 10,
						"is_delete": 0,
						"app_id": 10001,
						"create_time": "2023-10-17 18:07:56",
						"product_id": 2,
						"category_id": 3,
						"name": "热门分类",
						"spec_name": "小时",
						"logo_id": 1,
						"storage": "local",
						"save_name": "20230926/0a1de3d0cf3ee4e7db4d84af5995237f.png",
						"file_url": "",
						"file_name": "202309261307338cdd12520.png",
						"pay_end_time_format": "",
						"file_path": "http://bangke.yunjingwl.com/uploads/20230926/0a1de3d0cf3ee4e7db4d84af5995237f.png",
						"product": [{
							"order_product_id": 43,
							"product_id": 2,
							"product_name": "哈哈哈",
							"image_id": 15,
							"deduct_stock_type": 10,
							"spec_type": 10,
							"spec_sku_id": "0",
							"product_sku_id": 2,
							"product_attr": "",
							"product_no": "123",
							"product_price": "100.00",
							"line_price": "1000.00",
							"product_weight": 1,
							"is_user_grade": 0,
							"grade_ratio": 0,
							"grade_product_price": "0.00",
							"grade_total_money": "0.00",
							"coupon_money_sys": "0.00",
							"coupon_money": "0.00",
							"points_money": "0.00",
							"points_num": 0,
							"points_bonus": 0,
							"total_num": 1,
							"total_price": "100.00",
							"total_pay_price": "100.00",
							"supplier_money": "100.00",
							"sys_money": "0.00",
							"fullreduce_money": "0.00",
							"product_reduce_money": "0.00",
							"is_agent": 0,
							"is_ind_agent": 0,
							"agent_money_type": 10,
							"first_money": "0.00",
							"second_money": "0.00",
							"third_money": "0.00",
							"is_comment": 0,
							"order_id": 69,
							"user_id": 1,
							"product_source_id": 0,
							"sku_source_id": 0,
							"bill_source_id": 0,
							"virtual_content": "",
							"app_id": 10001,
							"create_time": "2023-10-17 18:07:56",
							"image": {
								"file_id": 15,
								"storage": "local",
								"group_id": 0,
								"file_url": "",
								"save_name": "20230926/98b35fa4f297b138ddf44899da654c5f.jpg",
								"file_name": "20230926160205343ec9076.jpg",
								"file_size": 267265,
								"file_type": "image",
								"real_name": "1695715325238_wx_camera_1695603440923.jpg",
								"extension": "jpg",
								"is_user": 1,
								"is_recycle": 0,
								"shop_supplier_id": 0,
								"is_delete": 0,
								"app_id": 10001,
								"create_time": "2023-09-26 16:02:05",
								"update_time": 0,
								"file_path": "http://bangke.yunjingwl.com/uploads/20230926/98b35fa4f297b138ddf44899da654c5f.jpg"
							}
						}],
						"supplier": {
							"shop_supplier_id": 1,
							"name": "测试1-1",
							"user_id": 1
						},
						"advance": null,
						"state_text": "已取消",
						"order_source_text": "普通",
						"pay_end_time_text": "2023-10-17 18:17:56"
					}
				]
			}
		},
		mounted() {
			/*获取订单列表*/
			this.getData();

		},
		methods: {
			handleTimeup(index) {
				this.listData[index].state_text = '服务已取消';
			},
			/*获取数据*/
			getData() {
				let self = this;
				self.loading = true;
				let dataType = self.dataType;
				self._get(
					'user.order/lists', {
						dataType: dataType,
						page: self.page,
						pay_source: self.getPlatform(),
						list_rows: self.list_rows
					},
					function(res) {
						self.loading = false;
						self.listData = self.listData.concat(res.data.list.data);


						console.log(res.data.list.data, '返回数据1111111111');

						let result = res.data.list.data.map(item => {
							let {
								day,
								hour,
								minute,
								second
							} = self.countdowm(item.pay_end_time)


							// console.log(item.pay_end_time,'pay_end_time时间戳');


							// let {
							// 	day: deliveryday,
							// 	hour: deliveryhour,
							// 	minute: deliveryminute,
							// 	second: deliverysecond
							// } = self.countdowm(item.delivery_end_time)

							// let {
							// 	day: receiptday,
							// 	hour: receipthour,
							// 	minute: receiptminute,
							// 	second: receiptsecond
							// } = self.countdowm(item.receipt_end_time)

							item.day = day
							item.hour = hour
							item.minute = minute
							item.second = second

							// console.log(day, 'day');
							// console.log(hour, 'hour');
							// console.log(minute, 'minute');
							// console.log(second, 'second');

							// item.deliveryday = deliveryday
							// item.deliveryhour = deliveryhour
							// item.deliveryminute = deliveryminute
							// item.deliverysecond = deliverysecond

							// item.receiptday = receiptday
							// item.receipthour = receipthour
							// item.receiptminute = receiptminute
							// item.receiptsecond = receiptsecond

							// if(item.product.refund && item.product.refund.refund_end_time){
							// 	let {
							// 		day: refundday,
							// 		hour: refundhour,
							// 		minute: refundminute,
							// 		second: refundsecond
							// 	} = this.countdowm(item.product.refund.refund_end_time)	
							// 	item.refundday = refundday
							// 	item.refundhour = refundhour
							// 	item.refundminute = refundminute
							// 	item.refundsecond = refundsecond
							// 	return item
							// }

							return item
						})
						// 格式化后结果,赋值给data里面listData数组,然后再view循环即可
						self.listData = result;
					}
				);
			},
			// 计算时分秒	格式化
			countdowm(timestamp) {
				let nowTime = new Date();
				let endTime = new Date(timestamp * 1000);
				let t = endTime.getTime() - nowTime.getTime();
				console.log(t, 'ttttttttttttttt');
				if (t > 0) {
					let day = Math.floor(t / 86400000);
					let hour = Math.floor((t / 3600000) % 24);
					let min = Math.floor((t / 60000) % 60);
					let sec = Math.floor((t / 1000) % 60);
					return {
						day,
						hour,
						minute: min,
						second: sec
					}
				} else {
					return {
						day: 0,
						hour: 0,
						minute: 0,
						second: 0
					}
				}
			},
		}
	}
</script>

<style>
	.item{
		width: 100%;
		height: 100rpx;
		border: 1rpx solid blue;
		margin-bottom: 100rpx;
	}
</style>

最后

感觉文章好的话记得点个心心和关注和收藏,有错的地方麻烦指正一下,如果需要转载,请标明出处,多谢!!!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1102007.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

企业c#语言源代码防泄密解决方案

在当今数字化时代&#xff0c;企业的核心业务往往依赖于软件应用程序。为了保护企业的知识产权和敏感信息&#xff0c;源代码的保密至关重要。对于制造类企业尤其是智能制造业来讲&#xff0c;最近几年是高速发展的时期&#xff0c;很多公司在做工厂流水线设备时&#xff0c;就…

远程VPN登录,IPsec,VPN,win10

windows10 完美解决L2TP无法连接问题 windows10 完美解决L2TP无法连接问题 - 哔哩哔哩

点击切换播放图片

<template><!-- banner组件 --><div class"wrap-box"><div class"image-container"><img :src"currentImage" alt"Image"></div><div class"controls"><div class"btn&q…

Deploy、Service与Ingress

Deployment 自愈 介绍:控制Pod&#xff0c;使Pod拥有多副本&#xff0c;自愈&#xff0c;扩缩容等能力 # 清除所有Pod&#xff0c;比较下面两个命令有何不同效果&#xff1f; kubectl run mynginx --imagenginxkubectl create deployment mytomcat --imagetomcat:8.5.68 # 自…

安防视频监控EasyCVR平台修改默认数据为MySQL,但忘记登录密码该如何解决?

视频云存储/安防监控EasyCVR视频汇聚平台基于云边端智能协同&#xff0c;支持海量视频的轻量化接入与汇聚、转码与处理、全网智能分发、视频集中存储等。音视频流媒体视频监控平台EasyCVR拓展性强&#xff0c;视频能力丰富&#xff0c;具体可实现视频监控直播、视频轮播、视频录…

Windows设置开机自启

Windows设置开机自启 一&#xff1a;添加服务二&#xff1a;添加注册表三&#xff1a;添加本地组策略四&#xff1a;添加启动文件夹五&#xff1a;添加任务计划程序 启动优先级&#xff1a;服务>注册表>启动文件夹>任务计划 一&#xff1a;添加服务 注&#xff1a;命…

代码随想录算法训练营第五十六天| 1143.最长公共子序列 、 1035.不相交的线 、53. 最大子序和 动态规划

代码随想录算法训练营第五十六天| 1143.最长公共子序列 、 1035.不相交的线 、53. 最大子序和 动态规划 文章目录 代码随想录算法训练营第五十六天| 1143.最长公共子序列 、 1035.不相交的线 、53. 最大子序和 动态规划[toc]1143.最长公共子序列1035.不相交的线53. 最大子序和 …

【重磅!】2023亚洲品牌500强在香港隆重发布,后羿品牌与华为、抖音、比亚迪、贵州茅台等入选登榜!

9月25日&#xff0c;由专业品牌评价机构Asiabrand发起主办&#xff0c;中国亚洲经济发展协会、一带一路总商会、《环球时报》社、东盟-中国总商会、亚太第一卫视和香港中小企业发展促进会联合主办的“第18届亚洲品牌盛典”在香港隆重举行。众多国际知名品牌齐聚一堂&#xff0c…

低代码:让软件开发不再遥不可及

近些年来&#xff0c;低代码的发展趋势可谓是蒸蒸日上&#xff01;当然&#xff0c;热门的技术总会伴随着质疑的声音&#xff0c;诞生至今&#xff0c;大家各抒己见&#xff0c;也不乏有针锋相对的意思。这本质上是一件有助于推动低代码发展的事情。 业内的朋友们一定知道&…

Peter算法小课堂—蠕动区间

蠕动区间 蠕动区间&#xff08;尺取法、双游标&#xff09;是一个经典的优化算法。 我们以毛毛虫&#x1f41b;举例说明 具体的&#xff0c;我们看题目 例题 最小区间 这一题&#xff0c;我们用暴力法&#xff0c;复杂度O(N^2) 先给出暴力法代码 int ansn1; for(int tail…

Three.js图案溶解shader

上图提供两种方式溶解显示 上面一排是根据现实的图案红色通道也就是r值进行溶解 下面一排提供额外的溶解纹理 可以通过简单更改呈现多种溶解图案 代码仓库 gitee b站账号&#xff1a;https://space.bilibili.com/374230437 interface IMapPath {map: string;dissolve?: string…

Oracle database 开启归档日志 archivelog

Oracle database 开启归档日志 archivelog 归档日志模式 (Archivelog Mode)。归档日志模式是一种数据库运行模式&#xff0c;它允许数据库将日志文件保存到归档日志目录中&#xff0c;以便在需要时进行恢复和还原操作。通过开启归档日志模式&#xff0c;可以提高数据库的可靠性…

2023年中国康养产业发展历程、65岁以上人口数量及市场规模分析[图]

​​康养产业在中国吸引了越来越多的资本入场&#xff0c;形成了以房地产业、保险金融业、生物及智能制造为核心的科创企业为代表的康养资本三大主力军。康养资本的快速涌入为康养产业注入了活力&#xff0c;具有资本密集特征和高科技含量的庞大康养产业正日趋成熟。 康养产业…

户外运动盛行,运动品牌如何利用软文推广脱颖而出?

全民健康意识的提升和城市居民对亲近自然的渴望带来户外运动的盛行&#xff0c;这也使运动品牌的市场保持强劲发展势头&#xff0c;那么在激烈的市场竞争中&#xff0c;运动品牌应该如何脱颖而出呢&#xff1f;下面就让媒介盒子告诉你&#xff01; 一、 分享户外运动干货 用户…

【vue+nestjs】gitee第三方授权登录【超详细】

项目场景&#xff1a; 前端使用vue3ts 后端使用nestjs 1.配置gitee第三方设置 1.找到账号设置 2.找到数据管理下的第三方应用 3.点击创建&#xff0c;进入配置 2.代码演示 特别注意: 如果你跟我一样是前后端分离的模式开发的&#xff0c;应用回调地址填写的应该是你的前…

MATLAB——神经网络参考代码

欢迎关注“电击小子程高兴的MATLAB小屋” %% I. 清空环境变量 clear all clc %% II. 训练集/测试集产生 %% % 1. 导入数据 load spectra_data.mat %% % 2. 随机产生训练集和测试集 temp randperm(size(NIR,1)); %打乱60个样本排序 % 训练集——50个样本 P_train NIR(…

Bootstrap Collapse的使用

1、效果图&#xff1a; 2、当点击B或C时&#xff0c;A自动收缩&#xff1a; 3、html代码&#xff1a; <div class"panel-group" id"accordion" role"tablist" aria-multiselectable"true"><div class"panel panel-de…

促进国内凝聚态物理理论与统计物理及交叉学科的学术交流及促进学科发展,与龙讯旷腾相约济南

全国凝聚态理论与统计物理学术会议旨在促进国内凝聚态物理理论与统计物理及交叉学科的学术交流及促进学科发展。自创办以来已成功举办20届&#xff0c;对提升我国物理学科的水平发挥了重要作用。第二十一届全国凝聚态理论与统计物理学术会议将于2023年10月20日-22日在济南召开&…

微信批量发朋友圈,多个号同步

近年来&#xff0c;随着数字营销的飞速发展&#xff0c;越来越多的企业开始将客户引至微信&#xff0c;并通过群发广告和发布朋友圈等方式进行产品推广&#xff0c;以实现高效率、低成本和良好的转化效果。随着号多起来了&#xff0c;朋友圈推广工作变得愈发繁琐&#xff0c;需…

手机拍照转机器人末端坐标(九点标定法)

1.打印标定纸&#xff0c;随机九个点 2.让UR机器人末端分别走到P1-P9九个点 在图示位置读取九个点的X&#xff0c;Y坐标 3.手机拍照&#xff08;固定点&#xff09; 测试可以随机拍一张&#xff0c;实用的话需要固定手机的拍照位置&#xff0c;得到的图片如下&#xff1a; 4.…