From 438e8e43830638842cc8af88a1dac6dae15928c8 Mon Sep 17 00:00:00 2001 From: liugongyu <290219706@qq.com> Date: Thu, 19 May 2022 14:43:17 +0800 Subject: [PATCH] 卡券购买下单 --- pages.json | 17 ++++++++++------- pages/businessCard/businessCard.vue | 99 +++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------- pages/businessCard/buyCard.vue | 30 +++++++++++++++--------------- pages/businessCard/cardDetail.vue | 46 ++++++++++++++++------------------------------ 4 files changed, 84 insertions(+), 108 deletions(-) diff --git a/pages.json b/pages.json index 3f93101..f8ac915 100644 --- a/pages.json +++ b/pages.json @@ -14,12 +14,21 @@ "pages": [ // pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages { + "path": "pages/businessCard/cardDetail", + "style": { + "navigationBarTitleText": "商户卡券明细", + "enablePullDownRefresh": true + } + }, + { "path": "pages/businessCard/businessCard", "style": { "navigationBarTitleText": "商户卡券" } }, + + { "path": "pages/businessCard/buyCard", "style": { @@ -27,13 +36,7 @@ } }, - { - "path": "pages/businessCard/cardDetail", - "style": { - "navigationBarTitleText": "商户卡券明细", - "enablePullDownRefresh": true - } - }, + { "path": "pages/businessCard/provideCard", diff --git a/pages/businessCard/businessCard.vue b/pages/businessCard/businessCard.vue index c1419a3..259dcd3 100644 --- a/pages/businessCard/businessCard.vue +++ b/pages/businessCard/businessCard.vue @@ -32,8 +32,8 @@ - - 暂无可以购买的商户卡券 + + @@ -44,15 +44,9 @@ export default { dataList: [], rows: [], pageNum: 1,//当前页 - pageSize: 1,//每页条数 - reload: false, - status: 'more', - contentText: { - contentdown: '上拉加载更多~', - contentrefresh: '正在加载更多~', - contentmore: '我是有底线的~' - }, - iconType: 'auto', // 图标样式 + pageSize: 10,//每页条数 + totalPages: '1', // 总条数 + status: 'no-more', } }, onLoad(params) { @@ -64,14 +58,37 @@ export default { onShow() { var me = this; }, + // 下拉刷新触发 + onPullDownRefresh(val) { + console.log('下拉刷新触发') + this.pageNum = 1 + this.pageSize = this.pageSize + this.totalPages = 1 + this.dataList = [] + this.couponRuleParkPage() + }, + // 上拉加载触发 + onReachBottom() { + console.log('上拉加载触发') + console.log(this.totalPages) + console.log(this.dataList.length) + if (this.totalPages == this.dataList.length) { + this.status = 'no-more' + return + } else { + this.pageNum++; + this.couponRuleParkPage() + } + }, computed: {}, methods: { // 通过商户ID查询停车记录信息 couponRuleParkPage() { let that = this + that.status = 'loading' let paramsData = { - pageNum: '1', - pageSize: '10' + pageNum: this.pageNum, + pageSize: this.pageSize } // 首页信息获取 接口 that.$myRequest({ @@ -79,8 +96,19 @@ export default { method: 'POST', data: that.$common.requestSign(paramsData) }).then(res => { - this.dataList = res.data.dataList - console.log(this.dataList) + if(res.data.dataList.length>0){ + if (res.data.pageTotals < 10) { + that.status = 'no-more' + } else { + that.status = 'more' + console.log('more') + } + }else{ + that.status = 'no-more' + } + that.totalPages = res.data.pageTotals; + that.dataList = that.dataList.concat(res.data.dataList) + console.log(that.dataList.length) }) }, toBuy(i) { @@ -107,48 +135,7 @@ export default { padding-bottom: 10px; } - .rechargeWrap { - position: relative; - .rechargeArrow { - position: absolute; - right: 10px; - top: 30px; - font-size: 20px; - color: #999; - } - } - - .recordCon { - padding-right: 35px; - color: #999; - display: flex; - justify-content: space-between; - } - .container { - overflow: hidden; - } - - .custom-cover { - flex: 1; - flex-direction: row; - position: relative; - } - - .cover-content { - position: absolute; - bottom: 0; - left: 0; - right: 0; - height: 40px; - background-color: rgba($color: #000000, $alpha: 0.4); - display: flex; - flex-direction: row; - align-items: center; - padding-left: 15px; - font-size: 14px; - color: #fff; - } .card-actions { display: flex; diff --git a/pages/businessCard/buyCard.vue b/pages/businessCard/buyCard.vue index dbe8302..61b7484 100644 --- a/pages/businessCard/buyCard.vue +++ b/pages/businessCard/buyCard.vue @@ -45,22 +45,22 @@ @close="dialogClose"> - - - - - + + + + + - - - - - - - - + + + + + + + + + + diff --git a/pages/businessCard/cardDetail.vue b/pages/businessCard/cardDetail.vue index 789e06d..3a9be3c 100644 --- a/pages/businessCard/cardDetail.vue +++ b/pages/businessCard/cardDetail.vue @@ -107,9 +107,9 @@ - + - + @@ -253,8 +253,6 @@ export default { pageNum: '1',//当前页 pageSize: '10',//每页条数 totalPages: '1', // 总条数 - // isLoadAll: false, - // reload: false, status: 'no-more', dataList: [], issuedCount: 0,// 被领取张数 @@ -288,7 +286,6 @@ export default { console.log(this.dataList.length) if (this.totalPages == this.dataList.length) { this.status = 'no-more' - console.log('111') return } else { this.pageNum++; @@ -322,11 +319,17 @@ export default { data: that.$common.requestSign(paramsData) }).then(res => { // const resDataArray = that.dataList.concat(res.data.dataList); - if (res.data.pageTotals < 10) { - this.status = 'no-more' - } else { - this.status = 'more' + if(res.data.dataList.length>0){ + if (res.data.pageTotals < 10) { + that.status = 'no-more' + } else { + that.status = 'more' + console.log('more') + } + }else{ + that.status = 'no-more' } + that.totalPages = res.data.pageTotals; that.dataList = that.dataList.concat(res.data.dataList) console.log(that.dataList.length) @@ -361,7 +364,7 @@ export default { this.pageSize = this.pageSize this.totalPages = 1 this.dataList = [] - this.couponIssuedParkPage() + this.fetchData() this.couponDetailSummary() }, bindPickerChangeWay: function (e, storage) { @@ -372,7 +375,7 @@ export default { this.pageSize = this.pageSize this.totalPages = 1 this.dataList = [] - this.couponIssuedParkPage() + this.fetchData() this.couponDetailSummary() }, bindStartDateChange: function (e) { @@ -382,7 +385,7 @@ export default { this.pageSize = this.pageSize this.totalPages = 1 this.dataList = [] - this.couponIssuedParkPage() + this.fetchData() this.couponDetailSummary() }, bindEndDateChange: function (e) { @@ -391,7 +394,7 @@ export default { this.pageSize = this.pageSize this.totalPages = 1 this.dataList = [] - this.couponIssuedParkPage() + this.fetchData() this.couponDetailSummary() }, getDate(type) { @@ -413,23 +416,6 @@ export default {