| @@ -50,6 +50,9 @@ App({ | |||
| if (that.couponListCallback) { | |||
| that.couponListCallback(that.globalData.token); | |||
| } | |||
| if (that.businessListCallback) { | |||
| that.businessListCallback(that.globalData.token); | |||
| } | |||
| return Http.post({ | |||
| url: config.api.checkUserStatus, | |||
| data: {} | |||
| @@ -21,7 +21,6 @@ Component({ | |||
| * 组件的方法列表 | |||
| */ | |||
| ready(){ | |||
| console.log(this.data.list) | |||
| }, | |||
| methods: { | |||
| swiperChange: function (e) { | |||
| @@ -1,25 +1,27 @@ | |||
| <navigator url="/pages/coupon/detail/index?id={{data.id}}"> | |||
| <navigator url="/pages/coupon/detail/index?id={{data.couponId}}&targetAd={{data.targetAd}}"> | |||
| <!-- 首页优惠券列表页面 --> | |||
| <view class="coupons"> | |||
| <view class="coupons-img"> | |||
| <image src="{{data.coverImg}}"></image> | |||
| </view> | |||
| <view class="coupons-info"> | |||
| <view class="coupons-info-name">{{data.title}}</view> | |||
| <view class="coupons-info-name tit">{{data.title}}</view> | |||
| <view class="coupons-info-name subtitle">{{data.subTitle}}</view> | |||
| <view class="coupons-info-manjian" style="margin-top:10rpx;" wx:if="{{data.type == 1}}"> | |||
| 满¥{{data.usePriceStr}}可用 | |||
| <view class="coupons-info-price-p"> | |||
| <text class="i">¥</text>{{data.salePriceStr}} | |||
| <view class="coupons-info-manjian" style="margin-top:10rpx;" wx:if="{{data.type == 1}}"> | |||
| 满¥{{data.usePriceStr}}可用 | |||
| </view> | |||
| <view class="coupons-info-manjian" wx:elif="{{data.type == 2||data.type == 3||data.type==4||data.type==5}}"> | |||
| 仅限本店使用 | |||
| </view> | |||
| </view> | |||
| <view class="coupons-info-manjian" wx:elif="{{data.type == 2||data.type == 3||data.type==4||data.type==5}}"> | |||
| 仅限本店使用 | |||
| </view> | |||
| <view class="coupons-info-name subtitle ">剩余库存: {{data.remainInventory}}</view> | |||
| </view> | |||
| <view class="coupons-btn"> | |||
| <!-- 优惠券价格 --> | |||
| <view class="coupons-info-price"> | |||
| <text class="coupons-info-price-p">¥{{data.salePriceStr}}</text> | |||
| <text class="coupons-info-price-o">¥{{data.priceStr}}</text> | |||
| <view class="coupons-info-name subtitle sy">剩余: {{data.remainInventory}}</view> | |||
| <!-- <text class="coupons-info-price-o"><text class='i'>¥</text>{{data.priceStr}}</text> --> | |||
| </view> | |||
| <i-button i-class="coupons-btn-gm" wx:if="{{data.type==4}}" data-date='{{data}}'>领取</i-button> | |||
| <i-button i-class="coupons-btn-gm" wx:elif="{{data.type == 1||data.type == 2||data.type==3||data.type==4}}" data-date='{{data}}'>购买</i-button> | |||
| @@ -32,25 +32,27 @@ | |||
| } | |||
| .coupons-info-name { | |||
| font-size: 30rpx; | |||
| font-size: 28rpx; | |||
| color: #000000; | |||
| letter-spacing: 0; | |||
| line-height: 42rpx; | |||
| font-weight: bold; | |||
| margin-top: 10rpx; | |||
| line-height: 38rpx; | |||
| } | |||
| .coupons-info-price { | |||
| padding: 10rpx 0 15rpx; | |||
| height: 88rpx; | |||
| padding: 32rpx 0 0; | |||
| } | |||
| .i{ | |||
| font-size: 20rpx; | |||
| font-style: normal; | |||
| } | |||
| .coupons-info-price-p { | |||
| display: block; | |||
| text-align: center; | |||
| display: inline-block; | |||
| font-size: 36rpx; | |||
| color: #ff3434; | |||
| color: #f96563; | |||
| line-height: 50rpx; | |||
| } | |||
| .tit{ | |||
| margin-top: 32rpx; | |||
| } | |||
| .coupons-info-price-o { | |||
| display: block; | |||
| text-align: center; | |||
| @@ -96,15 +98,16 @@ | |||
| line-height: 50rpx !important; | |||
| } | |||
| .subtitle { | |||
| font-size: 26rpx; | |||
| font-size: 22rpx; | |||
| color: #333; | |||
| font-weight: 100; | |||
| text-align: left; | |||
| } | |||
| .coupons-info-manjian { | |||
| color: #999; | |||
| font-size: 26rpx; | |||
| color: #fa7c7a; | |||
| font-size: 20rpx; | |||
| line-height: 34rpx; | |||
| font-weight: 100; | |||
| display: inline-block; | |||
| } | |||
| /**上拉加载更多**/ | |||
| @@ -124,7 +127,10 @@ | |||
| .userinfo-nickname { | |||
| color: #aaa; | |||
| } | |||
| .sy{ | |||
| display: block; | |||
| text-align: center; | |||
| } | |||
| .usermotto { | |||
| margin-top: 200px; | |||
| } | |||
| @@ -6,125 +6,125 @@ var config = { | |||
| /** | |||
| * 接口用途:login | |||
| */ | |||
| login: '/user/login', | |||
| login: "/user/login", | |||
| /** | |||
| * 授权后获取用户的昵称,unionId等信息 | |||
| */ | |||
| getUserInfo: '/user/getUserInfo', | |||
| getUserInfo: "/user/getUserInfo", | |||
| /** | |||
| * 接口用途:授权后获取用户的手机号 | |||
| */ | |||
| getUserPhone: '/user/getUserPhone', | |||
| getUserPhone: "/user/getUserPhone", | |||
| /** | |||
| * 检查用户授权状态 | |||
| */ | |||
| checkUserStatus: '/user/checkUserStatus', | |||
| checkUserStatus: "/user/checkUserStatus", | |||
| /** | |||
| * 检查用户手机授权状态 | |||
| */ | |||
| checkPhoneStatus: '/user/checkPhoneStatus', | |||
| checkPhoneStatus: "/user/checkPhoneStatus", | |||
| /** | |||
| * 优惠券查询 | |||
| */ | |||
| couponList: '/wxCoupon/list', | |||
| couponList: "/wxCoupon/list", | |||
| /** | |||
| * 优惠券详情 | |||
| */ | |||
| couponDetail: '/wxCoupon/findById', | |||
| couponDetail: "/wxCoupon/detail", | |||
| /** | |||
| * 业态查询 | |||
| */ | |||
| businessList: '/wxBusiness/list', // TODO | |||
| businessList: "/wxBusiness/list", | |||
| /** | |||
| * 频道查询 | |||
| */ | |||
| couponChannelList: '/wxCouponChannel/list', | |||
| couponChannelList: "/wxCouponChannel/list", | |||
| /** | |||
| * 下订单 | |||
| */ | |||
| orderSave: '/order/save', | |||
| orderSave: "/order/save", | |||
| /** | |||
| * 支付订单 | |||
| */ | |||
| payOrderCreate: '/pay/create', | |||
| payOrderCreate: "/pay/create", | |||
| /** | |||
| * 订单状态更新 | |||
| */ | |||
| payOrderUpdate: '/pay/updatePayOrder', | |||
| payOrderUpdate: "/pay/updatePayOrder", | |||
| /** | |||
| * 订单列表 | |||
| */ | |||
| orderList: '/order/list', | |||
| orderList: "/order/list", | |||
| /** | |||
| * 券包 | |||
| */ | |||
| couponOrderList: '/couponOrder/list', | |||
| couponOrderList: "/couponOrder/list", | |||
| /** | |||
| * 券包详情 | |||
| */ | |||
| couponOrderDetail: '/couponOrder/detail', /// TODO | |||
| couponOrderDetail: "/couponOrder/detail", /// TODO | |||
| /** | |||
| * 验证码发送 | |||
| */ | |||
| sendValidationCode: '/wxMsgValidationcode/sendvalidationcode', | |||
| sendValidationCode: "/wxMsgValidationcode/sendvalidationcode", | |||
| /** | |||
| * 验证码确认 | |||
| */ | |||
| validationCode: '/wxMsgValidationcode/hasvalidationcode', | |||
| validationCode: "/wxMsgValidationcode/hasvalidationcode", | |||
| /** | |||
| * 车场信息获取 | |||
| */ | |||
| getParkInfo: '/wxPark/info', | |||
| getParkInfo: "/wxPark/info", | |||
| /** | |||
| * 用户所绑车牌获取 | |||
| */ | |||
| userCarCount: '/user/carCount', | |||
| userCarCount: "/user/carCount", | |||
| /** | |||
| * 用户所绑车牌获取 | |||
| */ | |||
| getUserCarList: '/user/carList', | |||
| getUserCarList: "/user/carList", | |||
| /** | |||
| * 联合登录 | |||
| */ | |||
| carInit: '/car/init', | |||
| carInit: "/car/init", | |||
| /** | |||
| * 绑车牌 | |||
| */ | |||
| bindCar: '/car/bindCar', | |||
| bindCar: "/car/bindCar", | |||
| /** | |||
| * 解绑车牌 | |||
| */ | |||
| unbindCar: '/car/unbindCar', | |||
| unbindCar: "/car/unbindCar", | |||
| /** | |||
| * 停车费 | |||
| */ | |||
| getCarStopFee: '/car/getCarStopFee', | |||
| getCarStopFee: "/car/getCarStopFee", | |||
| /** | |||
| * 停车费抵扣 (TJD) | |||
| */ | |||
| deductionFee: '/car/deductionFee', | |||
| deductionFee: "/car/deductionFee", | |||
| /** | |||
| * 优免券领取 | |||
| */ | |||
| getCoupon: '/car/getCoupon', | |||
| * 优免券领取 | |||
| */ | |||
| getCoupon: "/car/getCoupon", | |||
| /** | |||
| * banner | |||
| */ | |||
| bannerlist:'/wxCampaign/list' | |||
| bannerlist: "/wxCampaign/list" | |||
| }, | |||
| weapp: { | |||
| AppId: 'wx8eb8275b78db4ede', | |||
| AppId: "wx8eb8275b78db4ede" | |||
| }, | |||
| ErrorCode: { | |||
| NICK_NOT_AUTH: 11004, | |||
| PHONE_NOT_AUTH: 11005, | |||
| PHONE_IS_ENCRYPTED: 11006, | |||
| }, | |||
| PHONE_IS_ENCRYPTED: 11006 | |||
| } | |||
| }; | |||
| /* | |||
| for (var key in config.api) { | |||
| config.api[key] = apiPrefix + config.api[key]; | |||
| } | |||
| */ | |||
| module.exports = config; | |||
| module.exports = config; | |||
| @@ -1,50 +1,50 @@ | |||
| Component({ | |||
| externalClasses: ['i-class'], | |||
| externalClasses: ["i-class"], | |||
| relations: { | |||
| '../tabs/index': { | |||
| type: 'parent' | |||
| } | |||
| }, | |||
| relations: { | |||
| "../tabs/index": { | |||
| type: "parent" | |||
| } | |||
| }, | |||
| properties: { | |||
| key: { | |||
| type: String, | |||
| value: '' | |||
| }, | |||
| title: { | |||
| type: String, | |||
| value: '' | |||
| }, | |||
| dot: { | |||
| type: Boolean, | |||
| value: false | |||
| }, | |||
| count: { | |||
| type: Number, | |||
| value: 0 | |||
| } | |||
| properties: { | |||
| key: { | |||
| type: String, | |||
| value: "" | |||
| }, | |||
| data: { | |||
| current: false, | |||
| currentColor: '', | |||
| scroll: false | |||
| title: { | |||
| type: String, | |||
| value: "" | |||
| }, | |||
| dot: { | |||
| type: Boolean, | |||
| value: false | |||
| }, | |||
| count: { | |||
| type: Number, | |||
| value: 0 | |||
| } | |||
| }, | |||
| methods: { | |||
| changeCurrent (current) { | |||
| this.setData({ current }); | |||
| }, | |||
| changeCurrentColor (currentColor) { | |||
| this.setData({ currentColor }); | |||
| }, | |||
| changeScroll (scroll) { | |||
| this.setData({ scroll }); | |||
| }, | |||
| handleClickItem () { | |||
| const parent = this.getRelationNodes('../tabs/index')[0]; | |||
| parent.emitEvent(this.data.key); | |||
| } | |||
| data: { | |||
| current: false, | |||
| currentColor: "", | |||
| scroll: false | |||
| }, | |||
| methods: { | |||
| changeCurrent(current) { | |||
| this.setData({ current }); | |||
| }, | |||
| changeCurrentColor(currentColor) { | |||
| this.setData({ currentColor }); | |||
| }, | |||
| changeScroll(scroll) { | |||
| this.setData({ scroll }); | |||
| }, | |||
| handleClickItem() { | |||
| const parent = this.getRelationNodes("../tabs/index")[0]; | |||
| parent.emitEvent(this.data.key); | |||
| } | |||
| } | |||
| }); | |||
| @@ -1,7 +1,8 @@ | |||
| <view class="i-class i-tabs-tab {{ scroll ? 'i-tabs-tab-scroll' : '' }} {{ current ? 'i-tabs-tab-current' : '' }}"> | |||
| <i-badge dot="{{ dot }}" count="{{ dot ? 0 : count }}"> | |||
| <view bindtap="handleClickItem"> | |||
| <view class="i-tabs-tab-title {{ current ? 'i-tabs-tab-title-current' : '' }}" wx:if="{{ current && currentColor }}" style="color: {{ currentColor }}">{{ title }}</view> | |||
| <view class="i-tabs-tab-title {{ current ? 'i-tabs-tab-title-current' : '' }}" wx:if="{{ current && currentColor }}" style="color: {{ currentColor }}">{{ | |||
| title }}</view> | |||
| <view class="i-tabs-tab-title {{ current ? 'i-tabs-tab-title-current' : '' }}" wx:else>{{ title }}</view> | |||
| </view> | |||
| </i-badge> | |||
| @@ -88,14 +88,14 @@ | |||
| } | |||
| .addpark-choose-font { | |||
| width: 66rpx; | |||
| height: 66rpx; | |||
| width: 80rpx; | |||
| height: 77rpx; | |||
| background: #f8f8f8; | |||
| text-align: center; | |||
| line-height: 66rpx; | |||
| line-height: 77rpx; | |||
| border: 1 px solid #f8f8f8; | |||
| border-radius: 8rpx; | |||
| margin: 10rpx; | |||
| margin: 5rpx; | |||
| } | |||
| .addpark-choose-font p{ | |||
| @@ -104,6 +104,7 @@ | |||
| .addpark-choose-font p image{ | |||
| width:5vmin; | |||
| height:3.5vmin; | |||
| margin-top: -0.8vmin; | |||
| vertical-align: middle; | |||
| } | |||
| .addpark-choose-num { | |||
| @@ -120,7 +121,6 @@ | |||
| } | |||
| .choose-title{ | |||
| border:6rpx solid #ffd255; | |||
| } | |||
| .addpark-button-submit{ | |||
| @@ -13,6 +13,8 @@ Page({ | |||
| }, | |||
| onLoad(options) { | |||
| let that = this; | |||
| console.log(options.id); | |||
| console.log(options.targetAd); | |||
| wx.showLoading({ | |||
| title: "加载中..." | |||
| }); | |||
| @@ -23,7 +25,8 @@ Page({ | |||
| Http.get({ | |||
| url: config.api.couponDetail, | |||
| data: { | |||
| id: options.id | |||
| couponId: options.id, | |||
| targetAd:options.targetAd | |||
| } | |||
| }).then(res => { | |||
| console.log(res); | |||
| @@ -1,3 +1,4 @@ | |||
| <!-- 券的详情页面 --> | |||
| <view class='coupons'> | |||
| <view class="coupons-body"> | |||
| <view class='banner'> | |||
| @@ -15,15 +16,14 @@ | |||
| </view> | |||
| </view> | |||
| <!-- 未解决 商场的名称 --> | |||
| <view class='posi'> | |||
| <view class='posi_logo'> | |||
| <view> | |||
| <image src='http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg'></image> | |||
| <image src='{{data.merChantImgUrl}}'></image> | |||
| </view> | |||
| <view> | |||
| <text>iFORMALL(西单大悦城店)</text> | |||
| <text>北京市西城区西单北大街131号</text> | |||
| <text>{{data.merchantName}}</text> | |||
| <text>{{data.addr}}{{data.buildingName}}{{data.floorName}}</text> | |||
| </view> | |||
| </view> | |||
| <!-- <view> | |||
| @@ -19,10 +19,10 @@ | |||
| <image src="./../../../assets/img/shiyong.jpg" mode="widthFix"></image> | |||
| </view> | |||
| <view class="pane2" wx:if="{{data.couponOrderStatus==2}}"> | |||
| <image src="./../../../assets/img/tui.png" mode="widthFix"></image> | |||
| <image src="./../../../assets/img/guoqi.jpg" mode="widthFix"></image> | |||
| </view> | |||
| <view class="pane2" wx:if="{{data.couponOrderStatus==3}}"> | |||
| <image src="./../../../assets/img/guoqi.jpg" mode="widthFix"></image> | |||
| <image src="./../../../assets/img/tui.jpg" mode="widthFix"></image> | |||
| </view> | |||
| <view class="panel" wx:if="{{data.couponOrderStatus==0}}"> | |||
| <view class="barcode"> | |||
| @@ -90,7 +90,6 @@ | |||
| .coupon_detail .title { | |||
| font-size: 36rpx; | |||
| font-weight: bold; | |||
| } | |||
| .time { | |||
| @@ -83,7 +83,7 @@ Page({ | |||
| handleChangeScroll({ detail }) { | |||
| console.log(detail.key); | |||
| console.log("0000"); | |||
| this.getList(detail.key,1); | |||
| this.getList(detail.key, 1); | |||
| this.setData({ | |||
| current_scroll: detail.key | |||
| }); | |||
| @@ -3,30 +3,28 @@ | |||
| <i-tabs class='tabs' current="{{ current_scroll }}" scroll bindchange="handleChangeScroll"> | |||
| <i-tab class='i-tab' wx:for="{{tabs}}" wx:key="unique" key="{{item.key}}" title="{{item.name}}"></i-tab> | |||
| </i-tabs> | |||
| <view> | |||
| <view class="nocoupon" wx:if="{{list.length==0}}"> | |||
| <image src="./../../../assets/img/cou.png" mode="widthFix" /> | |||
| <text>没有优惠券哦</text> | |||
| </view> | |||
| <view class='section' wx:for='{{list}}' wx:key='{{index}}' bindtap="gotouse" data-quancode="{{item.id}}"> | |||
| <view class='detail_msg'> | |||
| <view class='logo'> | |||
| <image src='{{item.coverImg}}'></image> | |||
| <view class='section' wx:for='{{list}}' wx:key='{{index}}' bindtap="gotouse" data-quancode="{{item.id}}"> | |||
| <view class='detail_msg'> | |||
| <view class='logo'> | |||
| <image src='{{item.coverImg}}'></image> | |||
| </view> | |||
| <view class='info'> | |||
| <view> | |||
| <text>{{item.title}}</text> | |||
| </view> | |||
| <view class='info'> | |||
| <view> | |||
| <text>{{item.title}}</text> | |||
| </view> | |||
| <view> | |||
| <text class="txt1">有效期至:</text> | |||
| <text class="txt2">{{item.expiredTime}}</text> | |||
| </view> | |||
| <view wx:if="{{item.couponOrderStatus==0}}" class="btns" bindtap="gotouse" data-quancode="{{item.id}}">立即使用</view> | |||
| <view wx:elif="{{item.couponOrderStatus==1||item.couponOrderStatus==2||item.couponOrderStatus==3}}" class="btns">查看</view> | |||
| <view> | |||
| <text class="txt1">有效期至:</text> | |||
| <text class="txt2">{{item.expiredTime}}</text> | |||
| </view> | |||
| <view wx:if="{{item.couponOrderStatus==0}}" class="btns" bindtap="gotouse" data-quancode="{{item.id}}">立即使用</view> | |||
| <view wx:elif="{{item.couponOrderStatus==1||item.couponOrderStatus==2||item.couponOrderStatus==3}}" class="btns">查看</view> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| @@ -55,6 +55,7 @@ | |||
| .info view:nth-child(1) text { | |||
| font-size: 30rpx; | |||
| margin-top: 10rpx; | |||
| color: #666; | |||
| } | |||
| .info view:nth-child(2) { | |||
| @@ -77,7 +78,7 @@ | |||
| color: #fff; | |||
| float: right; | |||
| border-radius: 15rpx; | |||
| font-size: 30rpx; | |||
| font-size: 28rpx; | |||
| margin-top: 20rpx; | |||
| } | |||
| @@ -88,7 +89,7 @@ | |||
| .txt2 { | |||
| font-size: 22rpx; | |||
| color: red; | |||
| color: #f96563; | |||
| } | |||
| .nocoupon image{ | |||
| @@ -4,7 +4,7 @@ | |||
| } | |||
| .userinfo button { | |||
| background: #9d285c; | |||
| background: #00c0ff; | |||
| border-radius: 10rpx; | |||
| color: #fff; | |||
| height: 84rpx; | |||
| @@ -15,12 +15,15 @@ Component({ | |||
| data: { | |||
| tabs: [], | |||
| list: [], | |||
| current: "0", | |||
| current_scroll: "0", | |||
| flag: "", | |||
| return_list: [], | |||
| current: 0, | |||
| current_scroll: 0, | |||
| pageNum: 1, // 设置加载的第几次,默认是第一次 | |||
| pageSize: 10, //返回数据的个数 | |||
| searchLoading: false, //"上拉加载"的变量,默认false,隐藏 | |||
| searchLoadingComplete: false //“没有数据”的变量,默认false,隐藏 | |||
| searchLoadingComplete: false, //“没有数据”的变量,默认false,隐藏 | |||
| allow_load: true // 是否允许继续加载标识 默认 true 允许,false 加载完成 | |||
| }, | |||
| /** | |||
| * 组件的方法列表 | |||
| @@ -31,28 +34,104 @@ Component({ | |||
| current: detail.key | |||
| }); | |||
| }, | |||
| handleChangeScroll({ detail }) { | |||
| this.setData({ | |||
| current_scroll: detail.key | |||
| let that = this; | |||
| // 切换tab时重新初始化下list 和 allow_load | |||
| that.setData({ | |||
| current_scroll: detail.key, | |||
| flag: "click", | |||
| list: [], | |||
| allow_load: true | |||
| }); | |||
| this.getList(detail.key, 1); | |||
| var val = detail.key; | |||
| //通过这个传递数据 | |||
| var myEventDetail = { | |||
| val: val, | |||
| pageNum: 1 | |||
| }; | |||
| // detail对象,提供给事件监听函数 | |||
| this.triggerEvent("myevent", myEventDetail); | |||
| }, | |||
| //滚动到底部触发事件 | |||
| searchScrollLower() { | |||
| // let that = this; | |||
| console.log("00000000"); | |||
| // if(that.data.searchLoading && !that.data.searchLoadingComplete){ | |||
| // that.setData({ | |||
| // searchPageNum: that.data.searchPageNum+1, | |||
| // isFromSearch: false | |||
| // }); | |||
| // that.fetchSearchList(); | |||
| // } | |||
| getList(key, pageNum) { | |||
| var that = this; | |||
| app.couponListCallback = token => { | |||
| Http.setToken(token); | |||
| // 券list获取 | |||
| if (that.data.allow_load) { | |||
| /** | |||
| * 用户在点击切换时 不showloadimg | |||
| * 只有用户在下拉加载的时候 showloading | |||
| */ | |||
| wx.showLoading({ | |||
| title: "飞速加载中" | |||
| }); | |||
| // 根据 key == 0 区分全部或其它tab,决定是否传参数 business | |||
| if (key == 0) { | |||
| var param = { | |||
| pageNum: pageNum, | |||
| pageSize: 2, | |||
| targetAd: 1 | |||
| }; | |||
| } else { | |||
| var param = { | |||
| pageNum: pageNum, | |||
| pageSize: 2, | |||
| business: key, | |||
| targetAd: 1 | |||
| }; | |||
| } | |||
| // 请求接口 | |||
| Http.get({ | |||
| url: config.api.couponChannelList, | |||
| data: param | |||
| }).then(res => { | |||
| console.log(res); | |||
| if (pageNum >= res.data.pages) { | |||
| // wx.showToast({ | |||
| // title: "加载完成喽", | |||
| // icon: "success" | |||
| // }); | |||
| that.setData({ | |||
| allow_load: false | |||
| }); | |||
| } | |||
| /** | |||
| * 先赋值后渲染页面 | |||
| * concat 不会改变原数组值 | |||
| * push 会改变原数组值,但不会一条一条插入,而是整个数组插入 | |||
| */ | |||
| that.data.list = that.data.list.concat(res.data.list); | |||
| that.setData({ | |||
| list: that.data.list | |||
| }); | |||
| }); | |||
| setTimeout(function() { | |||
| wx.hideLoading(); | |||
| }, 1000); | |||
| } else { | |||
| console.info("allow_load==false 已禁止加载"); | |||
| } | |||
| }; | |||
| if (app.globalData.token && app.globalData.token != null) { | |||
| app.couponListCallback(app.globalData.token); | |||
| } | |||
| } | |||
| }, | |||
| ready() { | |||
| var that = this; | |||
| app.couponListCallback = token => { | |||
| let that = this; | |||
| app.businessListCallback = token => { | |||
| Http.setToken(token); | |||
| // business获取 | |||
| Http.get({ | |||
| @@ -63,28 +142,14 @@ Component({ | |||
| type: 1 | |||
| } | |||
| }).then(res => { | |||
| console.log(res); | |||
| that.setData({ | |||
| tabs: res.data.list | |||
| }); | |||
| }); | |||
| // 券list获取 | |||
| Http.get({ | |||
| url: config.api.couponList, | |||
| data: { | |||
| pageNum: 1, | |||
| pageSize: 20 | |||
| } | |||
| }).then(res => { | |||
| console.log(res); | |||
| that.setData({ | |||
| list: res.data.list | |||
| }); | |||
| }); | |||
| }; | |||
| if (app.globalData.token && app.globalData.token != null) { | |||
| app.couponListCallback(app.globalData.token); | |||
| } | |||
| that.getList(0, 1); | |||
| } | |||
| }); | |||
| @@ -1,8 +1,6 @@ | |||
| <view class="index-coupons"> | |||
| <i-tabs current="{{ current_scroll }}" scroll bindchange="handleChangeScroll"> | |||
| <i-tabs current="{{current_scroll}}" scroll bindchange="handleChangeScroll"> | |||
| <i-tab wx:for="{{tabs}}" wx:key="unique" key="{{item.id}}" title="{{item.title}}"></i-tab> | |||
| </i-tabs> | |||
| <scroll-view scroll-y="true" bindscrolltolower="searchScrollLower"> | |||
| <c-coupons wx:for="{{list}}" paramAtoB="{{scrollHeight}}" wx:key="unique" data="{{item}}" /> | |||
| </scroll-view> | |||
| <c-coupons wx:for="{{list}}" paramAtoB="{{scrollHeight}}" wx:key="unique" data="{{item}}" /> | |||
| </view> | |||
| @@ -6,7 +6,8 @@ Page({ | |||
| market: app.globalData.market, | |||
| list: [], | |||
| swiperCurrent: 0, | |||
| scrollTop: 0 | |||
| scrollTop: 0, | |||
| page: 1 // 刷新进入页面时已经加载了第一页数据,onReachBottom时 page++,从第2页开始加载 | |||
| }, | |||
| swiperChange: function(e) { | |||
| this.setData({ | |||
| @@ -16,15 +17,10 @@ Page({ | |||
| /** | |||
| * 生命周期函数--监听页面初次渲染完成 | |||
| */ | |||
| onShow: function(options) { | |||
| console.log("0000"); | |||
| console.log(app.globalData.token); | |||
| }, | |||
| onLoad: function(options) { | |||
| var that = this; | |||
| var scene = decodeURIComponent(options.scene); | |||
| if (app.globalData.token && app.globalData.token != null) { | |||
| console.log("index ++ " + app.globalData.token); | |||
| } else { | |||
| // 由于是网络请求,可能会在 Page.onLoad 之后才返回 | |||
| // 所以此处加入 callback 以防止这种情况 | |||
| @@ -39,10 +35,8 @@ Page({ | |||
| sceneAddress: app.globalData.sceneAddress | |||
| } | |||
| }).then(res => { | |||
| //banner | |||
| console.log(res); | |||
| //banner渲染 | |||
| app.globalData.token = res.data.token; | |||
| console.log(app.globalData.token) | |||
| Http.setToken(res.data.token); | |||
| if (res.code == 200) { | |||
| Http.get({ | |||
| @@ -52,25 +46,43 @@ Page({ | |||
| pageSize: 10 | |||
| } | |||
| }).then(res => { | |||
| console.log(res); | |||
| that.setData({ | |||
| list: res.data.list | |||
| }) | |||
| console.log(res.data.list); | |||
| }); | |||
| }); | |||
| } | |||
| }) | |||
| }); | |||
| } | |||
| }) | |||
| }); | |||
| } | |||
| wx.showLoading({ | |||
| title: "加载中" | |||
| }, | |||
| onGetCode: function(e) { | |||
| //子组件传递给父组件的值 | |||
| this.setData({ | |||
| code: e.detail.val, | |||
| page: e.detail.pageNum | |||
| }); | |||
| setTimeout(function() { | |||
| wx.hideLoading(); | |||
| }, 2200); | |||
| }, | |||
| //下拉加载更多 | |||
| onReachBottom: function() { | |||
| let that = this; | |||
| console.info("before++ " + that.data.page); | |||
| that.data.page++; | |||
| console.info("after++ " + that.data.page); | |||
| that.setData({ | |||
| page: that.data.page | |||
| }); | |||
| //父组件获得子组件的方法 | |||
| //如果code == 0 | |||
| if (that.data.code == 0 || that.data.code == undefined) { | |||
| that.selectComponent("#lists").getList(0, that.data.page); | |||
| } else { | |||
| that.selectComponent("#lists").getList(that.data.code, that.data.page); | |||
| } | |||
| }, | |||
| // 用户点击右上角分享 | |||
| onShareAppMessage: function() { | |||
| return { | |||
| @@ -4,7 +4,7 @@ | |||
| <text class="iconfont icon-dingweib txt"></text> {{market.name}} <text class="iconfont icon-choose"></text> | |||
| </navigator> | |||
| </view> --> | |||
| <c-banner wx:key="unique" list="{{list}}"/> | |||
| <c-banner wx:key="unique" list="{{list}}" /> | |||
| <c-rushToBuy /> | |||
| <c-coupons /> | |||
| <c-coupons id="lists" bind:myevent="onGetCode" /> | |||
| </view> | |||
| @@ -12,51 +12,46 @@ Component({ | |||
| * 组件的初始数据 | |||
| */ | |||
| data: { | |||
| list: [ | |||
| // { | |||
| // img: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg", | |||
| // name: "海鲜焗饭", | |||
| // time: "2天12小时25分钟", | |||
| // oPrice: "59.00", | |||
| // pPrice: "1.00", | |||
| // }, | |||
| // { | |||
| // img: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg", | |||
| // name: "海鲜焗饭", | |||
| // time: "2天12小时25分钟", | |||
| // oPrice: "59.00", | |||
| // pPrice: "1.00", | |||
| // }, | |||
| // { | |||
| // img: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg", | |||
| // name: "海鲜焗饭", | |||
| // time: "2天12小时25分钟", | |||
| // oPrice: "59.00", | |||
| // pPrice: "1.00", | |||
| // }, | |||
| // { | |||
| // img: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg", | |||
| // name: "海鲜焗饭", | |||
| // time: "2天12小时25分钟", | |||
| // oPrice: "59.00", | |||
| // pPrice: "1.00", | |||
| // }, | |||
| ] | |||
| list: [] | |||
| }, | |||
| /** | |||
| * 组件的方法列表 | |||
| */ | |||
| methods: {}, | |||
| methods: { | |||
| gotomore: function() { | |||
| wx.navigateTo({ | |||
| url: "/pages/rushToBuy/index", | |||
| success: function(res) { | |||
| // success | |||
| }, | |||
| fail: function() { | |||
| // fail | |||
| }, | |||
| complete: function() { | |||
| // complete | |||
| } | |||
| }); | |||
| }, | |||
| gotodetail: function(e) { | |||
| console.log(e); | |||
| console.log("出错啦 大哥") | |||
| console.log(e.currentTarget.dataset.couponid); | |||
| console.log(e.currentTarget.dataset.targetad); | |||
| wx.navigateTo({ | |||
| url: `/pages/coupon/detail/index?id=${e.currentTarget.dataset.couponid}&targetAd=${e.currentTarget.dataset.targetad}` | |||
| }); | |||
| } | |||
| }, | |||
| ready() { | |||
| app.couponChannelListCallback = token => { | |||
| console.log("couponChannelList init"); | |||
| Http.setToken(token); | |||
| Http.get({ | |||
| url: config.api.couponChannelList, | |||
| data: { | |||
| pageNum: 1, | |||
| pageSize: 10 | |||
| pageSize: 2, | |||
| targetAd: 2 | |||
| } | |||
| }).then(res => { | |||
| console.log(res); | |||
| @@ -1,8 +1,8 @@ | |||
| <view class="index-rushToBuy"> | |||
| <view class="index-rushToBuy-title">限时抢购</view> | |||
| <view class="index-rushToBuy-title">限时抢购<text bindtap="gotomore">查看更多></text></view> | |||
| <scroll-view scroll-x class="index-scroll-view"> | |||
| <view class="commodity" wx:for="{{list}}" wx:key="unique"> | |||
| <navigator url="/pages/coupon/detail/index"> | |||
| <view bindtap="gotodetail" data-couponId="{{item.couponId}}" data-targetAd="{{item.targetAd}}"> | |||
| <image class="commodity-img" src="{{item.coverImg}}" /> | |||
| <view class="commodity-info"> | |||
| <view class="commodity-info-name">{{item.subTitle}}</view> | |||
| @@ -11,7 +11,7 @@ | |||
| <text class="commodity-info-price-o">¥{{item.priceStr}}</text> | |||
| </view> | |||
| </view> | |||
| </navigator> | |||
| </view> | |||
| </view> | |||
| </scroll-view> | |||
| </view> | |||
| @@ -11,6 +11,12 @@ | |||
| padding-left: 30rpx; | |||
| } | |||
| .index-rushToBuy-title text{ | |||
| float: right; | |||
| margin-right: 20rpx; | |||
| color: #f96563; | |||
| font-size: 26rpx; | |||
| } | |||
| .index-scroll-view { | |||
| width: 100%; | |||
| white-space: nowrap; | |||
| @@ -24,7 +30,7 @@ | |||
| position: relative; | |||
| background: #fff; | |||
| /* border: 1rpx solid #dddee1; */ | |||
| width: 392rpx; | |||
| width: 355rpx; | |||
| box-shadow: 0 0 10px 0 rgba(211,211,211,0.50); | |||
| border-radius: 10rpx; | |||
| } | |||
| @@ -32,7 +38,7 @@ | |||
| margin-right: 30rpx; | |||
| } | |||
| .index-scroll-view .commodity-img { | |||
| height: 187rpx; | |||
| height: 213rpx; | |||
| } | |||
| .index-scroll-view .commodity-img image{ | |||
| width: 100%; | |||
| @@ -7,6 +7,7 @@ Page({ | |||
| park: null, | |||
| carList: [], | |||
| addCar: null, | |||
| tcq:2 | |||
| }, | |||
| onLoad: function(options) { | |||
| var that = this | |||
| @@ -28,6 +29,20 @@ Page({ | |||
| }) | |||
| } | |||
| }, | |||
| //我的停车券的显示与消失 | |||
| showquan:function(){ | |||
| let that = this; | |||
| if(that.data.tcq==1){ | |||
| that.setData({ | |||
| tcq:2 | |||
| }) | |||
| } | |||
| else if (that.data.tcq == 2) { | |||
| that.setData({ | |||
| tcq: 1 | |||
| }) | |||
| } | |||
| }, | |||
| jumpToAdd: function() { | |||
| wx.navigateTo({ | |||
| url: '/pages/addPark/addPark', | |||
| @@ -25,18 +25,19 @@ | |||
| <button class='deleteButton' bindtap='unbindCarBtn' data-car='{{item.carNumber}}'>解绑</button> | |||
| </view> | |||
| <view class='addBox'> | |||
| <view class='add' bindtap="jumpToAdd">点击添加我的爱车</view> | |||
| <view class='add' bindtap="jumpToAdd"><text>+</text>添加爱车</view> | |||
| </view> | |||
| </view> | |||
| <view class='bottonBox'> | |||
| <view class='textStyle'> | |||
| <view class='textStyle' bindtap='showquan'> | |||
| <image src='../../assets/img/quan.png'></image> | |||
| 我的停车券 | |||
| <view class='detail'> | |||
| <image src='../../assets/img/down.png'></image> | |||
| <image wx:if="{{tcq==1}}" src='../../assets/img/down.png'></image> | |||
| <image wx:elif="{{tcq!=1}}" src='../../assets/img/right.png'></image> | |||
| </view> | |||
| </view> | |||
| <view class='voucher'> | |||
| <view class='voucher' wx:if="{{tcq==1}}"> | |||
| <text class='textV1'>2小时免费停车券</text> | |||
| <text class='textV2'>¥10.00元</text> | |||
| <view class='choice'> | |||
| @@ -14,8 +14,8 @@ page{ | |||
| .headBox image{ | |||
| width: 150rpx; | |||
| height: 150rpx; | |||
| margin-right: 62rpx; | |||
| border: 1px #cbcbcb solid; | |||
| margin-right: 30rpx; | |||
| border-radius:16rpx; | |||
| } | |||
| .numberBox{ | |||
| width: 400rpx; | |||
| @@ -24,12 +24,11 @@ page{ | |||
| .titleName{ | |||
| line-height: 60rpx; | |||
| height:60rpx; | |||
| color: #333; | |||
| font-size: 36rpx; | |||
| color: #666; | |||
| font-size: 32rpx; | |||
| width: 400rpx; | |||
| word-break:break-all; | |||
| text-align: justify; | |||
| } | |||
| ::-webkit-scrollbar{ | |||
| width: 0; | |||
| @@ -38,10 +37,10 @@ color: transparent; | |||
| } | |||
| .carLocation,.locationNumber{ | |||
| width: 400rpx; | |||
| height: 50rpx; | |||
| color: #333; | |||
| font-size: 28rpx; | |||
| line-height: 50rpx; | |||
| height: 40rpx; | |||
| color: #666; | |||
| font-size: 24rpx; | |||
| line-height: 30rpx; | |||
| } | |||
| .borderBox{ | |||
| width: 750rpx; | |||
| @@ -78,8 +77,14 @@ color: transparent; | |||
| left: 50%; | |||
| top: 50%; | |||
| transform: translate(-50%,-50%); | |||
| font-size: 36rpx; | |||
| color: #333; | |||
| font-size: 34rpx; | |||
| color: #666; | |||
| border:2px dashed #eee; | |||
| padding: 30rpx 50rpx; | |||
| border-radius:16rpx; | |||
| } | |||
| .add text{ | |||
| font-size: 40rpx; | |||
| } | |||
| .bottonBox{ | |||
| width: 750rpx; | |||
| @@ -1,65 +1,94 @@ | |||
| // pages/index/sw/index.js | |||
| let config = require("../../config/config.js"); | |||
| let Http = require("../../utils/HttpBasics"); | |||
| const app = getApp(); | |||
| Page({ | |||
| /** | |||
| * 页面的初始数据 | |||
| */ | |||
| data: { | |||
| list: [] | |||
| }, | |||
| /** | |||
| * 生命周期函数--监听页面加载 | |||
| */ | |||
| onLoad: function (options) { | |||
| }, | |||
| onLoad: function(options) {}, | |||
| /** | |||
| * 生命周期函数--监听页面初次渲染完成 | |||
| */ | |||
| onReady: function () { | |||
| }, | |||
| /** | |||
| * 生命周期函数--监听页面显示 | |||
| */ | |||
| onShow: function () { | |||
| onReady: function() { | |||
| app.couponChannelListCallback = token => { | |||
| Http.setToken(token); | |||
| Http.get({ | |||
| url: config.api.couponChannelList, | |||
| data: { | |||
| pageNum: 2, | |||
| pageSize: 2, | |||
| targetAd: 2 | |||
| } | |||
| }).then(res => { | |||
| console.log(res); | |||
| console.log("限时抢购页面"); | |||
| this.setData({ | |||
| list: res.data.list | |||
| }); | |||
| }); | |||
| }; | |||
| if (app.globalData.token && app.globalData.token != null) { | |||
| console.log("couponChannelList init 1"); | |||
| app.couponChannelListCallback(app.globalData.token); | |||
| } | |||
| }, | |||
| //限时抢购的强请页面 | |||
| gotodetail: function(e) { | |||
| console.log(e) | |||
| console.log("姐姐在测试") | |||
| console.log(e.currentTarget.dataset.couponid); | |||
| console.log(e.currentTarget.dataset.targetad); | |||
| wx.navigateTo({ | |||
| url: `/pages/coupon/detail/index?id=${e.currentTarget.dataset.couponid}&targetAd=${e.currentTarget.dataset.targetad}`, | |||
| success: function(res) { | |||
| // success | |||
| }, | |||
| fail: function() { | |||
| // fail | |||
| }, | |||
| complete: function() { | |||
| // complete | |||
| } | |||
| }); | |||
| }, | |||
| /** | |||
| * 生命周期函数--监听页面隐藏 | |||
| */ | |||
| onHide: function () { | |||
| }, | |||
| onHide: function() {}, | |||
| /** | |||
| * 生命周期函数--监听页面卸载 | |||
| */ | |||
| onUnload: function () { | |||
| }, | |||
| onUnload: function() {}, | |||
| /** | |||
| * 页面相关事件处理函数--监听用户下拉动作 | |||
| */ | |||
| onPullDownRefresh: function () { | |||
| onPullDownRefresh: function() { | |||
| console.log(""); | |||
| }, | |||
| /** | |||
| * 页面上拉触底事件的处理函数 | |||
| */ | |||
| onReachBottom: function () { | |||
| onReachBottom: function() { | |||
| }, | |||
| /** | |||
| * 用户点击右上角分享 | |||
| */ | |||
| onShareAppMessage: function () { | |||
| } | |||
| }) | |||
| onShareAppMessage: function() {} | |||
| }); | |||
| @@ -1,85 +1,31 @@ | |||
| <!-- 限时抢购 --> | |||
| <!-- 限时抢购 详情 --> | |||
| <view class='flashSale'> | |||
| <view class='flashSaleItemWrap'> | |||
| <view wx:for="{{list}}" class='flashSaleItemWrap' data-couponId="{{item.couponId}}" data-targetAd="{{item.targetAd}}" bindtap="gotodetail" wx:key="index"> | |||
| <view class='flashSaleItem'> | |||
| <view class='flashSaleItemTop'> | |||
| <view class='flashSaleItemTopL'> | |||
| <image src='/assets/img/food.png' class='food'></image> | |||
| </view> | |||
| <view class='flashSaleItemTopR'> | |||
| <view class='flashSaleItemTopRTop'> | |||
| <text class='foodname'>黑椒牛排</text> | |||
| <text class='small'>小程序专享</text> | |||
| </view> | |||
| <view class='flashSaleItemTopRBottom'> | |||
| <text class='presentPrice'>¥1.00</text> | |||
| <text class='originalPrice'>¥59.00</text> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| <view class='flashSaleItemBottom'> | |||
| <view class='flashSaleItemBottomTop'><text class='remainingTime'>剩余时间:</text><text class='realRemainingTime'>2天 12小时25分钟</text></view> | |||
| <view class='flashSaleItemBottomBottm'> | |||
| <view><text class="remainingNumber">剩余件数:</text><text class='realnumber'>19件</text></view> | |||
| <view class='buy'>购买</view> | |||
| </view> | |||
| </view> | |||
| <view class='flashSaleItemTop'> | |||
| <view class='flashSaleItemTopL'> | |||
| <image src='{{item.coverImg}}' class='food'></image> | |||
| </view> | |||
| </view> | |||
| <view class='flashSaleItemWrap'> | |||
| <view class='flashSaleItem'> | |||
| <view class='flashSaleItemTop'> | |||
| <view class='flashSaleItemTopL'> | |||
| <image src='/assets/img/food.png' class='food'></image> | |||
| </view> | |||
| <view class='flashSaleItemTopR'> | |||
| <view class='flashSaleItemTopRTop'> | |||
| <text class='foodname'>黑椒牛排</text> | |||
| <text class='small'>小程序专享</text> | |||
| </view> | |||
| <view class='flashSaleItemTopRBottom'> | |||
| <text class='presentPrice'>¥1.00</text> | |||
| <text class='originalPrice'>¥59.00</text> | |||
| </view> | |||
| </view> | |||
| <view class='flashSaleItemTopR'> | |||
| <view class='flashSaleItemTopRTop'> | |||
| <text class='foodname'>{{item.title}}</text> | |||
| <text class='small'>{{item.subTitle}}</text> | |||
| </view> | |||
| <view class='flashSaleItemBottom'> | |||
| <view class='flashSaleItemBottomTop'><text class='remainingTime'>剩余时间:</text><text class='realRemainingTime'>2天 12小时25分钟</text></view> | |||
| <view class='flashSaleItemBottomBottm'> | |||
| <view><text class="remainingNumber">剩余件数:</text><text class='realnumber'>19件</text></view> | |||
| <view class='buy'>购买</view> | |||
| </view> | |||
| <view class='flashSaleItemTopRBottom'> | |||
| <text class='presentPrice'>¥{{item.salePriceStr}}</text> | |||
| <text class='originalPrice'>¥{{item.priceStr}}</text> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| <view class='flashSaleItemWrap'> | |||
| <view class='flashSaleItem'> | |||
| <view class='flashSaleItemTop'> | |||
| <view class='flashSaleItemTopL'> | |||
| <image src='/assets/img/food.png' class='food'></image> | |||
| </view> | |||
| <view class='flashSaleItemTopR'> | |||
| <view class='flashSaleItemTopRTop'> | |||
| <text class='foodname'>黑椒牛排</text> | |||
| <text class='small'>小程序专享</text> | |||
| </view> | |||
| <view class='flashSaleItemTopRBottom'> | |||
| <text class='presentPrice'>¥1.00</text> | |||
| <text class='originalPrice'>¥59.00</text> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| <view class='flashSaleItemBottom'> | |||
| <view class='flashSaleItemBottomTop'><text class='remainingTime'>剩余时间:</text><text class='realRemainingTime'>2天12小时25分钟</text></view> | |||
| <view class='flashSaleItemBottomBottm'> | |||
| <view><text class="remainingNumber">剩余件数:</text><text class='realnumber'>19件</text></view> | |||
| <view class='buy'>购买</view> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| <view class='flashSaleItemBottom'> | |||
| <view class='flashSaleItemBottomTop'><text class='remainingTime'>剩余时间:</text><text class='realRemainingTime'>2天 12小时25分钟</text></view> | |||
| <view class='flashSaleItemBottomBottm'> | |||
| <view><text class="remainingNumber">剩余件数:</text><text class='realnumber'>{{item.remainInventory}}件</text></view> | |||
| <view class='buy'>购买</view> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| </view> | |||
| @@ -54,7 +54,7 @@ | |||
| margin-top: 15rpx; | |||
| } | |||
| .flashSaleItemTopRBottom{ | |||
| margin-top: 50rpx; | |||
| margin-top: 24rpx; | |||
| } | |||
| .presentPrice{ | |||
| font-size: 36rpx; | |||
| @@ -101,4 +101,5 @@ | |||
| border-radius: 10rpx; | |||
| margin-left: 350rpx; | |||
| font-size: 28rpx; | |||
| margin-top: -23rpx; | |||
| } | |||
| @@ -62,7 +62,7 @@ | |||
| display: flex; | |||
| height: 88rpx; | |||
| font-size: 30rpx; | |||
| color: #000; | |||
| color: #666; | |||
| line-height: 88rpx; | |||
| border-bottom: 1rpx solid #eee; | |||
| } | |||