| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299 |
- <template>
- <view class="content">
- <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
- <!-- 空白页 -->
- <!-- #ifdef H5 -->
- <empty src="../../../static/error/emptyMyCart.png" v-if="navList[0].loaded === true && navList[0].orderList.length === 0"></empty>
- <!-- #endif -->
- <!-- #ifndef H5 -->
- <empty src="../static/error/emptyMyCart.png" v-if="navList[0].loaded === true && navList[0].orderList.length === 0"></empty>
- <!-- #endif -->
- <!-- 订单列表 -->
- <view class="listItem" v-for="(item, index) in navList[0].orderList" :key='index'>
- <view v-if="item.day>0" class="topRightTip" @click="navTo('./Prepayment?id='+item.car_number)">
- <image src="../../../static/image/moneyPay.png" mode="widthFix"></image>
- </view>
- <view class="flex">
- <view class="imgbox">
- <image :src="item.image" mode="widthFix"></image>
- </view>
- <view class="contentDetail flex">
- <view class="goodsName">
- <view class="topName">
- {{item.car_name}}
- </view>
- <view class="goodsType">
- {{item.car_sku}}
- </view>
- <view class="goodsTime margin-t-10">
- 激活时间:{{item.bind_time}}
- </view>
- </view>
- <view class="goodsRight">
- <view class="status">
- 已授权
- </view>
- <navigator :url="'./authorizationList?id='+item.car_number">
- <view class="numR">
- {{item.auth_num}}
- </view>
- </navigator>
- </view>
- </view>
- </view>
- <view class="address">
- 当前位置:{{item.address}}
- </view>
- <map @click="openMap(item.latitude,item.longitude)" class="map" :enable-zoom='false' :enable-scroll='false' :latitude="item.latitude" :longitude="item.longitude" :markers="[{
- latitude: item.latitude,
- longitude:item.longitude,
- iconPath: '../../../static/image/location.png',
- width:35,
- height:35
- }]"></map>
- <view class="detail flex">
- <view class="item">
- <view class="type">
- 剩余电量
- </view>
- <view class="num">
- {{item.residue}}%
- </view>
- </view>
- <view class="item">
- <view class="type">
- 剩余天数
- </view>
- <view class="num">
- {{item.day}}
- </view>
- </view>
- <!-- <view class="item">
- <view class="type">
- 总里程数
- </view>
- <view class="num">
- 200
- </view>
- </view> -->
- </view>
- <cartConfing @tab="changetab($event,item)" :item='item'></cartConfing>
- </view>
- <uni-load-more :status=" navList[0].loadingType"></uni-load-more>
- </scroll-view>
- </view>
- </template>
- <script>
- import cartConfing from './cartConfing.vue';
- import {
- carList,
- } from '@/api/user.js';
- export default {
- components: {
- cartConfing
- },
- data() {
- return {
- tabCurrentIndex: 0,
- navList: [{
- state: 0,
- text: '待付款',
- loadingType: 'more',
- orderList: [],
- page: 1, //当前页数
- limit: 10 //每次信息条数
- }]
- };
- },
- onLoad(options) {
- this.loadData();
- },
- methods: {
- // tab改变事件
- changetab(tab,item){
- item.status = tab
- },
- // 打开地图导航
- openMap(lat, long) {
- uni.openLocation({
- latitude: +lat,
- longitude: +long,
- complete(e){
- console.log(e,'地图打开');
- }
- })
- },
- navTo(url) {
- uni.navigateTo({
- url: url
- })
- },
- //获取列表
- loadData(source) {
- //这里是将订单挂载到tab列表下
- let index = this.tabCurrentIndex;
- let navItem = this.navList[index];
- if (source === 'tabChange' && navItem.loaded === true) {
- //tab切换只有第一次需要加载数据
- return;
- }
- if (navItem.loadingType === 'loading') {
- //防止重复加载
- return;
- }
- if (navItem.loadingType === 'noMore') {
- //防止重复加载
- return;
- }
- // 修改当前对象状态为加载中
- navItem.loadingType = 'loading';
- carList({
- page: navItem.page,
- limit: navItem.limit
- })
- .then(({
- data
- }) => {
- let arr = data.data.map(e => {
- return e;
- });
- navItem.orderList = navItem.orderList.concat(arr);
- navItem.page++;
- if (navItem.limit == arr.length) {
- //判断是否还有数据, 有改为 more, 没有改为noMore
- navItem.loadingType = 'more';
- return;
- } else {
- //判断是否还有数据, 有改为 more, 没有改为noMore
- navItem.loadingType = 'noMore';
- }
- uni.hideLoading();
- this.$set(navItem, 'loaded', true);
- })
- .catch(e => {
- console.log(e);
- });
- },
- }
- };
- </script>
- <style lang="scss">
- page,
- .content {
- height: 100%;
- }
- .list-scroll-content {
- padding-top: 30rpx;
- height: 100%;
- }
- .listItem {
- margin: 0rpx 20rpx 30rpx;
- border-radius: 20rpx;
- padding: 30rpx;
- background-color: #FFFFFF;
- position: relative;
- overflow: hidden;
- .topRightTip {
- position: absolute;
- top: 0;
- right: 0;
- image {
- width: 80rpx;
- }
- }
- .imgbox {
- width: 160rpx;
- height: 160rpx;
- border-radius: 20rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .contentDetail {
- padding-left: 30rpx;
- flex-grow: 1;
- .goodsName {
- .topName {
- color: $font-color-dark;
- font-size: 32rpx;
- font-weight: bold;
- margin-bottom: 30rpx;
- }
- .goodsType,
- .goodsTime {
- color: $font-color-light;
- font-size: 24rpx;
- }
- }
- }
- .map {
- width: 630rpx;
- height: 200rpx;
- font-size: 35rpx;
- }
- .goodsRight {
- flex-shrink: 0;
- .status {
- color: $font-color-light;
- font-size: 24rpx;
- }
- .numR {
- height: 60rpx;
- width: 60rpx;
- border-radius: 10rpx;
- border: 1px solid $color-green;
- line-height: 60rpx;
- font-size: 32rpx;
- color: $color-green;
- text-align: center;
- margin: 0 auto;
- margin-top: 20rpx;
- }
- }
- .address {
- color: $font-color-light;
- font-size: 24rpx;
- line-height: 1;
- padding: 30rpx 0;
- }
- .detail {
- margin-top: 30rpx;
- padding: 0 20rpx;
- justify-content: space-around;
- .item {
- color: $font-color-light;
- text-align: center;
- line-height: 1.5;
- .type {
- font-size: 24rpx;
- }
- .num {
- font-size: 32rpx;
- }
- }
- }
- }
- </style>
|