123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318 |
- <template>
- <view class="app-container">
- <u-navbar
- title="我的订单"
- bgColor="#fff"
- :fixed="true"
- :autoBack="false"
- leftIconColor="#333333"
- leftIconSize="28"
- @leftClick="handleLeftClick"
- >
- </u-navbar>
- <view class="">
- </view>
- <view class="app-container-item">
- <sunui-navbar :items="navItem" :currentIndex="navIndex" @change="navChange">
- </sunui-navbar>
- </view>
- <mescroll-body ref="mescrollRef" height="" :topbar="true" :top="168" @init="mescrollInit" @down="downCallback" @up="upCallback">
- <view class="list-item flex-between" v-for="data in dataList" @click="toDetail(data)">
- <view class="info-left">
- <view class="item">
- <text style="font-size: 20px;color: #222222;font-weight: bold">{{data.title}}</text>
- <text style="font-size: 15px;color: #606266">
- {{ data.date }} {{ data.openStartTime }}-{{ data.openEndTime }}
- </text>
- </view>
- <view class="item">
- <text style="font-size: 14px;color: #7B7F86">共2张</text>
- </view>
- </view>
- <view :class="[data.state == 1 ? 'info-right-default' :(data.state == 2 ?'info-right' : 'info-right-gray'), 'flex']">
- <view class="circle flex">
- {{data.state | matchState}}
- </view>
- </view>
- </view>
- </mescroll-body>
- </view>
- </template>
- <script>
- export default {
- components: {},
- data() {
- return {
- userInfo: {},
- navIndex: 0,
- navItem: [{
- // 全部
- name: '全部',
- id: 0
- }, {
- // 待使用
- name: '待使用',
- id: 1
- }, {
- // 已核销
- name: '已核销',
- id: 2
- }, {
- // 已过期
- name: '已过期',
- id: 3
- }],
- // 列表数据
- dataList: [
- {
- title: '兰花街1、2、3',
- date: '2024.05.08',
- openStartTime: '08:00',
- openEndTime: '20:00',
- state: 1
- },
- {
- title: '兰花街1、2、3',
- date: '2024.05.08',
- openStartTime: '08:00',
- openEndTime: '20:00',
- state: 2
- }
- ],
- };
- },
- filters: {
- matchState(code) {
- switch (code) {
- case 1:
- return '未出票';
- case 2:
- return '已出票';
- case 3:
- return '已结束';
- case 4:
- return '已退票';
- }
- }
- },
- onLoad() {
- console.log('onLoad')
- },
- onShow() {
- this.userInfo = uni.getStorageSync('userInfo')
- },
- methods: {
- handleLeftClick() {
- //获取页面栈的长度
- const canNavBack = getCurrentPages()
- //判断是否刷新了浏览器,刷新了浏览器,页面栈只有当前一个
- if (canNavBack && canNavBack.length > 1) {
- uni.navigateBack({
- delta: 1
- })
- } else {
- history.back()
- }
- },
- // 顶部导航栏
- navChange(index) {
- console.log(index)
- this.navIndex = index;
- // 分页
- // this.workOrderList = [];
- // this.mescroll.resetUpScroll();
- },
- getGuideInfo() {
- // this.isLogin = true;
- },
- toDetail(item) {
- console.log('toDetail', item)
- uni.navigateTo({
- url: '/pages/order/detail?info=' + JSON.stringify(item)
- });
- },
- /*上拉加载的回调*/
- upCallback(page) {
- console.log('upCallback', page)
- let pageNum = page.num; // 页码, 默认从1开始
- let pageSize = page.size; // 页长, 默认每页10条
- let _this = this;
- /*API.getVisitorAppointList({
- pageSize,
- pageNum,
- data: {
- userId: this.userId,
- }
- }).then(res => {*/
- console.log(res);
- let res = {
- list: [
- {
- title: '兰花街1、2、3',
- date: '2024.05.08',
- openStartTime: '08:00',
- openEndTime: '20:00',
- state: 1
- },
- {
- title: '兰花街1、2、3',
- date: '2024.05.08',
- openStartTime: '08:00',
- openEndTime: '20:00',
- state: 2
- },
- {
- title: '兰花街1、2、3',
- date: '2024.05.08',
- openStartTime: '08:00',
- openEndTime: '20:00',
- state: 3
- },
- {
- title: '兰花街1、2、3',
- date: '2024.05.08',
- openStartTime: '08:00',
- openEndTime: '20:00',
- state: 4
- }
- ],
- total: 1
- }
- // 接口返回的当前页数据列表 (数组)
- let curPageData = res.list || [];
- console.log(curPageData)
- // 接口返回的当前页数据长度 (如列表有26个数据,当前页返回8个,则curPageLen=8)
- let curPageLen = curPageData.length;
- // 接口返回的总数据量(如列表有26个数据,每页10条,共3页; 则totalSize=26)
- let totalSize = res.total;
- //方法二(推荐): 后台接口有返回列表的总数据量 totalSize
- _this.mescroll.endBySize(curPageLen, totalSize);
- //设置列表数据
- if (page.num == 1) _this.dataList = []; // 如果是第一页需手动置空列表
- _this.dataList = _this.dataList.concat(curPageData); //追加新数据
- console.log('dataList', _this.dataList);
- /*}).catch(err => {
- // 请求失败,隐藏加载状态
- _this.mescroll.endErr()
- }).finally(() => {});*/
- },
- }
- };
- </script>
- <style lang="scss" scoped>
- .app-container {
- width: 100vw;
- //background: #fff;
- position: relative;
- //height: 100vh;
- &-item {
- width: 100%;
- //height: calc(100vh - 44px);
- box-sizing: border-box;
- position: absolute;
- top: 44px;
- z-index: 2;
- }
- .list-item {
- height: 120px;
- background: white;
- width: calc(100% - 30px);
- margin-left: 15px;
- border-radius: 8px;
- margin-top: 10px;
- box-shadow: 0px 0px 8px 0px #D2DBEE80;
- font-size: 16px;
- box-sizing: border-box;
- overflow: hidden;
- padding: 15px 10px;
- .info {
- &-left {
- height: 100%;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- width: calc(100% - 55px);
- .item {
- display: flex;
- flex-direction: column;
- }
- }
- &-right {
- width: 70px;
- height: 70px;
- background: #fff;
- border: 2.5px solid #D0F4FF;
- border-radius: 50%;
- .circle {
- width: 54px;
- height: 54px;
- background: #D0F4FF;
- border-radius: 50%;
- flex-shrink: 0;
- color: #48CEF9;
- display: flex;
- justify-content: center;
- align-items: center;
- transform: rotate(-15deg);
- font-size: 14px;
- }
- }
- &-right-default {
- width: 70px;
- height: 70px;
- background: #fff;
- border: 2.5px solid #E8F0FC;
- border-radius: 50%;
- .circle {
- width: 54px;
- height: 54px;
- background: #E8F0FC;
- border-radius: 50%;
- flex-shrink: 0;
- color: #A7B7D1;
- display: flex;
- justify-content: center;
- align-items: center;
- transform: rotate(-15deg);
- font-size: 14px;
- }
- }
- &-right-gray {
- width: 70px;
- height: 70px;
- background: #fff;
- border: 2.5px solid #EDF1F6;
- border-radius: 50%;
- .circle {
- width: 54px;
- height: 54px;
- background: #EDF1F6;
- border-radius: 50%;
- flex-shrink: 0;
- color: #B2BCCB;
- display: flex;
- justify-content: center;
- align-items: center;
- transform: rotate(-15deg);
- font-size: 14px;
- }
- }
- }
- }
- }
- </style>
|