瀏覽代碼

修改bug

xiongyi 5 天之前
父節點
當前提交
28c0dfa765
共有 2 個文件被更改,包括 21 次插入16 次删除
  1. 9 7
      pages/message/index.vue
  2. 12 9
      pages/package/package.vue

+ 9 - 7
pages/message/index.vue

@@ -87,20 +87,22 @@
 			gotoDetail(item) {
 				request.postApi(config.API_MESSAGE_READ_MESSAGE, {
 					msg_type: 2,
-					msg_id : item.plat_msg_id,
+					msg_id: item.plat_msg_id,
 					car_id: ''
 				})
-				
+
 				uni.navigateTo({
 					url: `/pages/message/detail?id=${item.plat_msg_id}`
 				})
 			},
-			toDeviceMsgPage(itemData) {
-				const {
-					car_id
-				} = itemData
+			toDeviceMsgPage(item) {
+				equest.postApi(config.API_MESSAGE_READ_MESSAGE, {
+					msg_type: 1,
+					car_id: item.car_id
+				})
+
 				uni.navigateTo({
-					url: `/pages/message/deviceInfo?car_id=${car_id}`
+					url: `/pages/message/detail?id=${item.car_id}`
 				})
 			},
 			queryDeviceMsg() {

+ 12 - 9
pages/package/package.vue

@@ -37,13 +37,13 @@
 					<view v-if="item.package_status==2" class="card-text card-o">已结束</view>
 				</view>
 				<view class="package-item" style="margin-bottom: 32rpx;">
-					<view class="item-title">有效期至</view>
+					<view v-if="item.expire_time != 0" class="item-title">有效期至</view>
 					<view class="item-info">{{tools.formatTime(item.expire_time)}}</view>
 				</view>
 				<view v-if="item.package_type != 2" class="package-item" style="margin-bottom: 32rpx;">
 					<view class="item-title">有效时长</view>
 					<view class="item-info">
-						{{calculateRemainingDays(item.expire_time)}}<text
+						{{ item.expire_time != 0 ? calculateRemainingDays(item.expire_time) : item.total_day }}<text
 							style="color: #9FA7B7;">/{{item.total_day}}天</text>
 					</view>
 				</view>
@@ -110,13 +110,16 @@
 		},
 		methods: {
 			calculateRemainingDays(expirationDate) {
-				// 获取当前时间
-				const now = dayjs();
-				// 解析到期时间
-				const endDate = dayjs(expirationDate * 1000);
-				// 计算剩余天数
-				const remainingDays = endDate.diff(now, 'day');
-				return remainingDays || 1;
+				
+				// // 获取当前时间
+				// const now = dayjs();
+				// // 解析到期时间
+				// const endDate = dayjs(expirationDate * 1000);
+				// // 计算剩余天数
+				// const remainingDays = endDate.diff(now, 'day');
+				// return remainingDays || 1;
+				
+				return  common.formatTimeDifference(expirationDate * 1000)
 			},
 			srcFn() {
 				uni.navigateTo({