123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- <template>
- <view class="container-view">
- <view class="top-bg" >
- <navBar name="我的套餐" bgColor="transparent"></navBar>
- <!-- <view class="flex-row" :style="'height:'+navabarHeight+'px;'">
- <view class="flex-row" @tap="bindReturnView"><img class="return-view" src="https://qiniu.bms16.com/FnHXbzly7aXi8zLghrTU5BZdwH5_" /></view>
- <text class="top-text">我的套餐</text>
- </view> -->
-
- <view class="package-card flex-row flex-between">
- <view class="flex-row flex-column" style="align-items: flex-start;">
- <view class="left-first flex-row">
- <view>{{car_info.car_name}}</view>
- <img class="left-img" src="https://qiniu.bms16.com/Fpf25Lkkrx05pvLw08mksVQKAQWf" />
- </view>
- <view class="left-second flex-row">
- <view style="margin-right: 32rpx;">适用电池:<text>48v20Ah</text></view>
- <!-- <view>押金:<text>$5.0</text></view> -->
- </view>
- <view class="left-third">
- <view>车辆编号:<text>{{car_info.car_sn}}</text></view>
- </view>
- </view>
- <img class="card-right" src="https://qiniu.bms16.com/FuOJQxzypa-NginyHGdsWlzwnB8z" />
- </view>
- </view>
- <view class="box-view">
- <!-- <view class="package-card flex-row flex-between">
- <view class="flex-row flex-column" style="align-items: flex-start;">
- <view class="left-first flex-row">
- <view>小米 Su7</view>
- <img class="left-img" src="https://qiniu.bms16.com/Fpf25Lkkrx05pvLw08mksVQKAQWf" />
- </view>
- <view class="left-second flex-row">
- <view style="margin-right: 32rpx;">适用电池:<text>48v20Ah</text></view>
- <view>押金:<text>$5.0</text></view>
- </view>
- <view class="left-third">
- <view>卡号:<text>2024110202578</text></view>
- </view>
- </view>
- <img class="card-right" src="https://qiniu.bms16.com/FuOJQxzypa-NginyHGdsWlzwnB8z" />
- </view> -->
- <view class="package-view" v-for="item in hireOrderList">
- <view class="top-view flex-row flex-between">
- <view class="top-title" v-if="item.package_type == 1">
- {{item.total_day}}天
- </view>
- <view class="top-title" v-if="item.package_type == 2">
- {{item.num}}次
- </view>
- <view class="top-title" v-if="item.package_type == 3">
- {{item.total_day}}天{{item.num}}次
- </view>
- <view v-if="item.package_status==1" class="card-text card-b">生效中</view>
- <view v-if="item.package_status==0" class="card-text card-o">待生效</view>
- <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 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 style="color: #9FA7B7;">/{{item.total_day}}天</text>
- </view>
- </view>
- <view v-if="item.package_type == 1" class="package-item">
- <view class="item-title">免费换电数</view>
- <view style="color: #060809;" class="item-info">{{item.last_num}}次</view>
- </view>
- <view v-if="item.package_type == 2" class="package-item">
- <view class="item-title">免费换电数</view>
- <view class="item-info">{{item.last_num}} <text style="color: #9FA7B7;">/{{item.num}}次</text></view>
- </view>
- <view v-if="item.package_type == 3" class="package-item">
- <view class="item-title">免费换电数</view>
- <view style="color: #060809;" class="item-info">{{item.total_day}}天/{{item.last_num}}次</view>
- </view>
- </view>
- </view>
- <view style="height: 200rpx;"></view>
- <view @click='srcFn' class="packageBtn">前往购买套餐</view>
- </view>
- </template>
- <script module="tools" lang="wxs" src="@/pages/common/wxs/tools.wxs"></script>
- <script module="tools" lang="sjs" src="@/pages/common/wxs/tools.sjs"></script>
- <script>
- var config = require('../../common/config_gyq.js');
- var common = require('../../common/common.js');
- var http = require('../../common/request.js');
- var storage = require('../../common/storage.js');
- const dayjs = require('dayjs');
- import { getRemainingTime } from '../../utils/util.js';
- export default {
- components: {
-
- },
- data() {
- return {
- hireOrderList:[],
- page: 1,
- limit: 10,
- car_info:{},
- // statusBarHeight: 0,
- // navabarHeight: 0,
- packageList: [
- {ctime: '2024-04-04 16:15',total_duration: 30,efficient_day: 24,change_rate: 6,total_times: 10,status:1},
- {ctime: '2024-04-04 16:15',total_duration: 30,efficient_day: 24,change_rate: 6,total_times: 10,status:2},
- ]
- };
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function(options) {
- this.car_info = uni.getStorageSync('car_info') || {};
- // const clientRect = uni.getMenuButtonBoundingClientRect()
- // const sysinfo = uni.getSystemInfoSync()
- // let GAP = 8
- // // #ifdef MP-ALIPAY
- // GAP = 0
- // // #endif
- // const navabarHeight = (clientRect.bottom - sysinfo.statusBarHeight) + (clientRect.top - sysinfo.statusBarHeight) + GAP
- // this.navabarHeight = navabarHeight
- // this.statusBarHeight = sysinfo.statusBarHeight
- this.mapCtx = uni.createMapContext('myMap');
- this.listFn()
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function() {
-
- },
- methods: {
- calculateRemainingDays(expirationDate) {
- // 获取当前时间
- const now = dayjs();
- // 解析到期时间
- const endDate = dayjs(expirationDate);
- // 计算剩余天数
- const remainingDays = endDate.diff(now, 'day');
- return remainingDays || 0;
- },
- srcFn(){
- uni.navigateTo({
- url: `/pages/batteryPackage/batteryPackage`
- })
- },
- validDurationFn(start,end){
- return getRemainingTime(start,end)
- },
- async listFn(){
- let {
- data
- } = await http.postApi(config.API_FLK_EXCHANGE_PACKAGE_ORDER_LIST, {
- page: this.page,
- pay_status:2,
- car_sn:this.car_info.car_sn,
- limit: this.limit,
- })
- if (data.code == 200) {
- this.hireOrderList.push.apply(this.hireOrderList, data.data.list)
- } else {
- common.simpleToast(resp.data.msg)
- }
- },
- bindReturnView() {
- uni.navigateBack({
- delta: 1,
- }) // 返回上一页
- },
- }
- };
- </script>
- <style>
- @import './package.css';
- .packageBtn{
- width: 686rpx;
- height: 80rpx;
- background: #060809;
- border-radius: 40rpx;
- font-family: PingFangSC, PingFang SC;
- font-weight: 500;
- font-size: 32rpx;
- color: #FFFFFF;
- display: flex;
- align-items: center;
- justify-content: center;
- position: fixed;
- left: 0;
- right: 0;
- margin: auto;
- bottom: 60rpx;
- }
- </style>
|