123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349 |
- <template>
- <scroll-view
- class="scroll-Y"
- id="slideview"
- scroll-y
- lower-threshold="50"
- scroll-top="0"
- scroll-left="0"
- scroll-with-animation="false"
- enable-back-to-top="false"
- @scrolltolower="bindscrolltolower"
- >
- <!-- <authorize ref="authorize"></authorize>-->
- <!-- <ul>-->
- <!-- <li v-for="i in 100" :key="i">{{ i }}</li>-->
- <!-- </ul>-->
- <template>
- <uni-view
- class="choice_card"
- v-for="(item, index) in list"
- :key="index"
- @click="toDetail(item.orderno)"
- >
- <uni-view
- class="choice_card_index choice_card_index1"
- style="font-size: 30px; margin: 0 12px"
- >
- <uni-view style="margin-left: 6px"
- >{{ item.orderno + '-' + item.carno }}
- </uni-view>
- <uni-view style="color: red; margin-right: 6px"
- >{{ (item.servicefee / 100) | currency }}
- </uni-view>
- </uni-view>
- <uni-view class="choice_card_index choice_card_index2"
- >{{ item.parkname }}
- </uni-view>
- <uni-view class="choice_card_index choice_card_index3">
- <uni-view>入场时间 : {{ item.entertime }}</uni-view>
- <uni-view style="margin-right: 20px">
- <uni-icons
- class="align-top"
- color="#B3B3B3"
- size="14"
- type="arrowright"
- />
- </uni-view>
- </uni-view>
- <uni-view
- class="choice_card_index choice_card_index3"
- style="padding-bottom: 20px"
- >
- <uni-view>停车时长 : {{ item.serviceMin | parkingTime }}</uni-view>
- <uni-view style="margin-right: 20px">
- {{
- item.refundStatus === 1
- ? '已退款'
- : item.payStatus === 1
- ? '支付成功'
- : '支付失败'
- }}
- </uni-view>
- </uni-view>
- </uni-view>
- <uni-view class="notice-info">
- <uni-view
- >{{ list.length === 4 ? '查看更多' : '没有更多数据了' }}
- </uni-view>
- <uni-icons
- v-if="list.length === 4"
- type="arrowdown"
- size="14"
- color="##b5b3b3"
- ></uni-icons>
- </uni-view>
- </template>
- </scroll-view>
- </template>
- <script>
- // const app = getApp()
- import uni from '@/utils/uniHooks';
- const app = {};
- let canloading = true;
- let pageNum = 1;
- import moment from 'moment';
- import authorize from '@/components/authorize/authorize.vue';
- import { mapState } from 'vuex';
- export default {
- components: {
- authorize,
- },
- data() {
- return {
- list: [],
- };
- },
- computed: {
- ...mapState({
- mallId: (state) => state.mallId,
- openId: (state) => state.openid,
- member: (state) => state.member,
- }),
- },
- // 分享
- onShareAppMessage() {
- return {
- title: '缴费记录', // 标题
- path: '/pages/parkingFee/parkingFeeList?mallid=' + app.globalData.mallid,
- imageUrl: '', // 图标
- };
- },
- // 分享
- onShareTimeline() {
- return {
- title: '缴费记录', // 标题
- path: '/pages/parkingFee/parkingFeeList?mallid=' + app.globalData.mallid,
- imageUrl: '', // 图标
- };
- },
- mounted() {
- setTimeout(() => {
- uni.setNavigationBarTitle({
- title: "缴费记录"
- })
- }, 300)
- this.list = [];
- // 重新获取数据
- canloading = true;
- pageNum = 1;
- const member = uni.getStorageSync('member');
- console.log(114, member);
- if (member) {
- this.loadData();
- } /*else {
- this.$refs.authorize.login("/pages/parkingFee/parkingFee", () => {
- this.loadData()
- });
- }*/
- },
- // mounted() {
- // console.log(123, this.$route)
- // },
- // onReachBottom: function() {
- // console.log('canloading', canloading)
- // if (canloading) {
- // pageNum++
- // this.loadData()
- // }
- // },
- filters: {
- parkingTime(val) {
- const days = parseInt(val / 60 / 24);
- const hours = parseInt((val / 60) % 24);
- const minutes = parseInt(val % 60);
- if (days > 0) {
- return `${days}天 ${hours}小时 ${minutes}分钟`;
- }
- if (hours > 0) {
- return `${hours}小时 ${minutes}分钟`;
- }
- return `${minutes}分钟`;
- },
- },
- methods: {
- bindscrolltolower: function () {
- if (canloading) {
- pageNum++;
- this.loadData();
- }
- },
- // 获取停车记录
- loadData: function () {
- canloading = false;
- const params = {
- mallid: this.mallId,
- vipcode: this.member?.vipcode,
- openId: this.openId,
- page: pageNum || 1,
- pageSize: 4,
- };
- uni.showLoading({
- title: '加载中',
- });
- this.$md(params);
- uni.request({
- url: this.$baseURL + 'api/1.0/park/parkOrderList',
- data: params,
- method: 'POST',
- header: JSON.parse(uni.getStorageSync('handleUser')),
- success: (res) => {
- uni.hideLoading();
- if (res.data.code !== 0) {
- uni.showToast({
- title: res.data.msg,
- duration: 2000,
- icon: 'none',
- });
- this.initPage();
- } else {
- // 合并数据
- const records = res.data.data || [];
- if (records.length) {
- const list = this.list;
- this.list = [...list, ...records];
- } else {
- this.initPage();
- }
- }
- canloading = true;
- },
- fail: (err) => {
- uni.hideLoading();
- canloading = true;
- this.initPage();
- uni.showToast({
- title: res.data.msg,
- duration: 2000,
- icon: 'none',
- });
- },
- });
- },
- // 页码复原
- initPage: function () {
- pageNum--;
- if (pageNum <= 0) {
- pageNum = 0;
- }
- },
- // 查看详情
- toDetail(orderno) {
- this.$router.push({
- path: './parkingFeeDetailSuccess?orderNo=' + orderno,
- });
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .scroll-Y {
- width: 100%;
- display: flex;
- flex-direction: column;
- height: 100vh;
- background: #f2f2f2;
- }
- .wrap {
- display: flex;
- flex-direction: column;
- width: 100%;
- }
- .parkingFeeList-item {
- background: #fff;
- display: flex;
- flex-direction: column;
- margin-top: 8px;
- .item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 30px 36px;
- box-sizing: border-box;
- span {
- font-size: 16px;
- }
- }
- .item-bottom {
- border-top: 1px solid #f2f2f2;
- display: flex;
- flex-direction: column;
- padding: 0px 36px;
- box-sizing: border-box;
- padding-top: 8px;
- uni-view {
- display: flex;
- flex-direction: column;
- }
- span {
- color: #999;
- font-size: 14px;
- margin-bottom: 10px;
- }
- }
- }
- .choice_card {
- width: 92%;
- margin-left: 4%;
- margin-top: 30px;
- margin-bottom: 30px;
- border-radius: 20px;
- background-color: #fff;
- position: relative;
- .choice_card_index {
- margin-left: 18px;
- padding-top: 6px;
- padding-bottom: 6px;
- font-size: 28px;
- }
- .choice_card_index1 {
- border-bottom: 1px solid #f2f2f2;
- display: flex;
- align-items: center;
- padding-top: 22px;
- padding-bottom: 22px;
- justify-content: space-between;
- }
- .choice_card_index2 {
- padding-top: 20px;
- color: #808080;
- }
- .choice_card_index3 {
- display: flex;
- align-items: center;
- justify-content: space-between;
- color: #808080;
- }
- .choice_card_index4 {
- color: #808080;
- padding-bottom: 20px;
- }
- }
- .notice-info {
- text-align: center;
- color: #b5b3b3;
- padding-bottom: 30px;
- uni-view {
- margin-bottom: -7px;
- }
- }
- </style>
|