|
@@ -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({
|