From 6893de9ff91766cfbd18ad70c5f92ff9c25c2381 Mon Sep 17 00:00:00 2001 From: YWQ HK IX <568170040@qq.com> Date: Tue, 13 Dec 2022 19:13:26 +0800 Subject: [PATCH] =?UTF-8?q?C=E7=AB=AF=E5=88=B8=E5=8C=85=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E9=9B=86=E5=9B=A2=E5=92=8C=E5=AD=90?= =?UTF-8?q?=E5=B9=BF=E5=9C=BA=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/coupon/detail/index.js | 14 -- pages/couponorder/index/index.js | 131 ++++++----- pages/couponorder/index/index.ttml | 16 +- pages/couponorder/index/index.ttss | 356 ++++++++++++++++------------- pages/order/index/index.ttml | 2 - 5 files changed, 287 insertions(+), 232 deletions(-) diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js index 8cdac91..155ee7f 100644 --- a/pages/coupon/detail/index.js +++ b/pages/coupon/detail/index.js @@ -619,20 +619,6 @@ Page({ this.setData({ mallList: mallList }) - // if (res.data && res.data.length) { - // let merchantVoList = res.data - // let idList = [] - // merchantVoList.map(item => { - // idList.push(item.id) - // }) - // this.setData({ - // idList: idList - // }) - // this.getCouponList(idList) //获取推荐列表 - // } - // this.setData({ - // merchantVoList: res.data - // }) }) }, diff --git a/pages/couponorder/index/index.js b/pages/couponorder/index/index.js index c44fe5b..6f55f9e 100644 --- a/pages/couponorder/index/index.js +++ b/pages/couponorder/index/index.js @@ -6,94 +6,111 @@ const util = require("../../../utils/util"); Page({ data: { navigationBarHeight, - boatLsit:[ - { - name:"未使用", - value:"0" + boatLsit: [{ + name: "未使用", + value: "0" }, { - name:"已使用", - value:"1" + name: "已使用", + value: "1" }, { - name:"已过期", - value:"2" + name: "已过期", + value: "2" }, { - name:"已退款", - value:"3" + name: "已退款", + value: "3" }, ], - boatFlag:"0", - content:"", + boatFlag: "0", + content: "", loading: false, //"上拉加载"的变量,默认false,隐藏 - pageNum:1, + pageNum: 1, allow_load: true, - list:[], + list: [], + shopList: [], + index: 0, + mallTenantId: '' }, - setBoatFlag(e){ + setBoatFlag(e) { let index = e.currentTarget.dataset.index console.log(index); this.setData({ - boatFlag:index, - pageNum:1, - list:[], + boatFlag: index, + pageNum: 1, + list: [], allow_load: true, loading: false, //"上拉加载"的变量,默认false,隐藏 }) this.getList() }, - getList(){ + + bindPickerChange(e) { + const index = e.detail.value + const mallTenantId = this.data.shopList[index].tenantId + tt.setStorageSync('mallTenantId', mallTenantId) + tt.setStorageSync('mallIndex', index) + this.setData({ + index: index, + mallTenantId: mallTenantId, + allow_load: true + }); + console.log(this.data.mallTenantId); + this.getList(this.data.boatFlag, 1); + }, + + getList() { let that = this if (that.data.allow_load) { that.setData({ loading: true, content: '小主,我在玩命加载中...' }) - + const mallTenantId = tt.getStorageSync('mallTenantId') Http.get({ - url:config.api.couponOrderList, - data:{ - pageNum:that.data.pageNum, + url: config.api.couponOrderList, + data: { + pageNum: that.data.pageNum, pageSize: 10, - couponOrderStatus:that.data.boatFlag=="all"?"":that.data.boatFlag, - + couponOrderStatus: that.data.boatFlag == "all" ? "" : that.data.boatFlag, + mallTenantId: mallTenantId || that.data.mallTenantId } - }).then(res=>{ - if(that.data.pageNum==1){ + }).then(res => { + if (that.data.pageNum == 1) { that.setData({ list: [] }) } - - let tempArr= that.data.list - if(tempArr.length>0){ - tempArr.map(item=>{ + + let tempArr = that.data.list + if (tempArr.length > 0) { + tempArr.map(item => { item.expiredTime = util.formatTime(item.expiredTime, "yyyy-MM-dd "); }) } - - if(that.data.pageNum>=res.data.pages){ + + if (that.data.pageNum >= res.data.pages) { that.setData({ allow_load: false }) } - - if(that.data.pageNum>1){//分页 + + if (that.data.pageNum > 1) { //分页 that.setData({ - list: res.data.list?[...tempArr ,...res.data.list]:tempArr, - loading:false + list: res.data.list ? [...tempArr, ...res.data.list] : tempArr, + loading: false }) - }else{ - let tempLsit = res.data.list?res.data.list:[] - if(tempLsit.length>0){ - tempLsit.map(item=>{ + } else { + let tempLsit = res.data.list ? res.data.list : [] + if (tempLsit.length > 0) { + tempLsit.map(item => { item.expiredTime = util.formatTime(item.expiredTime, "yyyy-MM-dd"); }) } that.setData({ list: tempLsit, - loading:false + loading: false }) } }).catch(err => { @@ -102,7 +119,7 @@ Page({ icon: "none" }); }) - }else { + } else { that.setData({ loading: true, content: "——— 再拉裤子就掉了啦 ———" @@ -113,21 +130,31 @@ Page({ }) }, 1400) } - + }, onLoad: function (options) { - + Http.get({ + url: '/mall/subMall?isAll=1', + }).then(res => { + this.setData({ + shopList: res.data, + mallTenantId: tt.getStorageSync('mallTenantId') || res.data[0].tenantId + }); + console.log(this.data.shopList, 'list'); + }).catch(err => { + console.log(err, 'err'); + }) }, - onReachBottom(){//触底 + onReachBottom() { //触底 console.log(111); this.setData({ - pageNum:this.data.pageNum+1 + pageNum: this.data.pageNum + 1 }) this.getList() - }, - onShow:function(){ + }, + onShow: function () { this.getList() - - } - + + } + }) \ No newline at end of file diff --git a/pages/couponorder/index/index.ttml b/pages/couponorder/index/index.ttml index acabd82..334b9ae 100644 --- a/pages/couponorder/index/index.ttml +++ b/pages/couponorder/index/index.ttml @@ -2,7 +2,7 @@ - + {{item.name}} @@ -12,6 +12,18 @@ + + + + + {{shopList[index].name}} + + + + + + @@ -42,4 +54,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/pages/couponorder/index/index.ttss b/pages/couponorder/index/index.ttss index 510142a..90da3f8 100644 --- a/pages/couponorder/index/index.ttss +++ b/pages/couponorder/index/index.ttss @@ -1,66 +1,91 @@ -.boatBoxf{ +.boatBoxf { width: 100%; height: 90rpx; position: fixed; top: 0; left: 0; } -.boatBox{ - - width: 100%; - height: 90rpx; - display: flex; - justify-content: space-around; - background-color: #fff; -} -.boatTitle{ - font-size: 30rpx; - text-align: center; - height: 80rpx; - line-height: 80rpx; - color: #999; -} -.boatTitleA{ - font-size: 32rpx; - text-align: center; - height: 80rpx; - line-height: 80rpx; - font-weight: 500; - -} -.boatA{ - width: 80rpx; - height: 6rpx; - background-color: #fb3e5c; - margin: 0 auto; - border-radius: 20rpx; -} -.ticketList{ - width: 90%; - margin: 20rpx auto ; - - overflow: hidden; -} -.ticketItem{ - float: left; - background-color: #fff; - border-radius: 20rpx; - width: 80%; - height: 140rpx; - overflow: hidden; -} -.useBtn{ - float: left; - border-radius: 20rpx; - width: 20%; - height: 140rpx; - line-height: 140rpx; - text-align: center; - color: #FFFFFF; - font-size: 30rpx; - background: linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%) -} -.nouseBtn{ + +.boatBox { + + width: 100%; + height: 90rpx; + display: flex; + justify-content: space-around; + background-color: #fff; +} + +.boatTitle { + font-size: 30rpx; + text-align: center; + height: 80rpx; + line-height: 80rpx; + color: #999; +} + +.boatTitleA { + font-size: 32rpx; + text-align: center; + height: 80rpx; + line-height: 80rpx; + font-weight: 500; + +} + +.picker { + margin-top: 25rpx; + padding: 25rpx 45rpx; + margin-bottom: 15rpx; + background-color: #fff; +} + +.picker .inside { + display: flex; + justify-content: space-between; +} + +.picker .inside .img { + width: 20rpx; + height: 40rpx; +} + +.boatA { + width: 80rpx; + height: 6rpx; + background-color: #fb3e5c; + margin: 0 auto; + border-radius: 20rpx; +} + +.ticketList { + width: 90%; + margin: 20rpx auto; + + overflow: hidden; +} + +.ticketItem { + float: left; + background-color: #fff; + border-radius: 20rpx; + width: 80%; + height: 140rpx; + overflow: hidden; +} + +.useBtn { + float: left; + border-radius: 20rpx; + width: 20%; + height: 140rpx; + line-height: 140rpx; + text-align: center; + color: #FFFFFF; + font-size: 30rpx; + background: linear-gradient(127deg, rgba(252, 177, 74, 1) 0%, rgba(254, 70, 20, 1) 100%) +} + +.nouseBtn { float: left; border-radius: 20rpx; width: 20%; @@ -72,122 +97,129 @@ background: #CECECE; } -.shopImg{ - width: 88rpx; - height: 88rpx; - border: 1px solid #f8f8f8; - border-radius: 50rpx; - margin-left: 20rpx; - margin-top: 30rpx; - float: left; + +.shopImg { + width: 88rpx; + height: 88rpx; + border: 1px solid #f8f8f8; + border-radius: 50rpx; + margin-left: 20rpx; + margin-top: 30rpx; + float: left; } -.shopImg image{ + +.shopImg image { width: 100%; height: 100%; border: 1px solid #f8f8f8; border-radius: 50rpx; } -.ticketData{ - margin-left: 20rpx; - overflow: hidden; - float: left; + +.ticketData { + margin-left: 20rpx; + overflow: hidden; + float: left; } -.ticketTitle{ - font-size: 32rpx; - margin-top: 30rpx; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - width: 270rpx; + +.ticketTitle { + font-size: 32rpx; + margin-top: 30rpx; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + width: 270rpx; } -.date{ - font-size: 22rpx; - margin-top: 10rpx; +.date { + font-size: 22rpx; + margin-top: 10rpx; } -.date::before{ - content: "有效期至:"; - font-size: 26rpx; + +.date::before { + content: "有效期至:"; + font-size: 26rpx; } .loading { - text-align: center; - height: 80rpx; - line-height: 80rpx; - font-size: 26rpx; - color: #999; - } - - .loading image { - width: 60rpx; - height: 60rpx; - vertical-align: middle; - margin-right: 10rpx; - } - - .dingdan { - margin-top: 33rpx; - } - - .dingdan text:nth-of-type(1) { - display: block; - font-size: 34rpx; - color: #333; - letter-spacing: 0; - text-align: center; - } - - .dingdan text:nth-of-type(2) { - display: block; - font-size: 28rpx; - color: #999; - letter-spacing: 0; - text-align: center; - } - - .dingdan image { - display: block; - width: 300rpx; - height: 300rpx; - margin: 0 auto 16rpx; - } - .wait{ - display: inline-block; - width: 123rpx !important; - overflow: visible!important; - font-size: 28rpx; - color: #FD832D; - letter-spacing: 0; - text-align: right; - line-height: 28rpx!important; - float: right; - margin: 20rpx; - } - - .sucess { - display: inline-block; - width: 123rpx !important; - /* overflow: hidden; */ - font-family:PingFangSC-Regular; - font-size: 28rpx; - font-weight:400; - color: #2C8DFF; - letter-spacing: 0; - text-align: right; - line-height: 26px; - float: right; - margin: 20rpx; - } - .close { - display: inline-block; - width: 123rpx !important; - overflow: hidden; - font-size: 28rpx; - color: #999; - letter-spacing: 0; - text-align: right; - line-height: 28rpx; - float: right; - margin: 20rpx; - } \ No newline at end of file + text-align: center; + height: 80rpx; + line-height: 80rpx; + font-size: 26rpx; + color: #999; +} + +.loading image { + width: 60rpx; + height: 60rpx; + vertical-align: middle; + margin-right: 10rpx; +} + +.dingdan { + margin-top: 33rpx; +} + +.dingdan text:nth-of-type(1) { + display: block; + font-size: 34rpx; + color: #333; + letter-spacing: 0; + text-align: center; +} + +.dingdan text:nth-of-type(2) { + display: block; + font-size: 28rpx; + color: #999; + letter-spacing: 0; + text-align: center; +} + +.dingdan image { + display: block; + width: 300rpx; + height: 300rpx; + margin: 0 auto 16rpx; +} + +.wait { + display: inline-block; + width: 123rpx !important; + overflow: visible !important; + font-size: 28rpx; + color: #FD832D; + letter-spacing: 0; + text-align: right; + line-height: 28rpx !important; + float: right; + margin: 20rpx; +} + +.sucess { + display: inline-block; + width: 123rpx !important; + /* overflow: hidden; */ + font-family: PingFangSC-Regular; + font-size: 28rpx; + font-weight: 400; + color: #2C8DFF; + letter-spacing: 0; + text-align: right; + line-height: 26px; + float: right; + margin: 20rpx; +} + +.close { + display: inline-block; + width: 123rpx !important; + overflow: hidden; + font-size: 28rpx; + color: #999; + letter-spacing: 0; + text-align: right; + line-height: 28rpx; + float: right; + margin: 20rpx; +} \ No newline at end of file diff --git a/pages/order/index/index.ttml b/pages/order/index/index.ttml index 885edfd..d3c7a27 100644 --- a/pages/order/index/index.ttml +++ b/pages/order/index/index.ttml @@ -21,11 +21,9 @@ - -