| @@ -110,7 +110,11 @@ var config = { | |||||
| /** | /** | ||||
| * banner | * banner | ||||
| */ | */ | ||||
| bannerlist: "/wxCampaign/list" | |||||
| bannerlist: "/wxCampaign/list", | |||||
| /** | |||||
| * banner详情页面 | |||||
| */ | |||||
| bannerDetail:"/wxCampaign/findById" | |||||
| }, | }, | ||||
| weapp: { | weapp: { | ||||
| @@ -14,49 +14,17 @@ Page({ | |||||
| onLoad(options) { | onLoad(options) { | ||||
| let that = this; | let that = this; | ||||
| console.log(options.id); | console.log(options.id); | ||||
| // wx.showLoading({ | |||||
| // title: "加载中..." | |||||
| // }); | |||||
| // Http.get({ | |||||
| // url: config.api.couponDetail, | |||||
| // data: { | |||||
| // couponId: options.id, | |||||
| // targetAd:options.targetAd | |||||
| // } | |||||
| // }).then(res => { | |||||
| // console.log(res); | |||||
| // //当前时间与优惠券下架时间做计算 | |||||
| // var startTime = util.fmtDate(res.data.sendEndDate); | |||||
| // console.log(startTime); | |||||
| // var s1 = new Date(startTime.replace(/-/g, "/")); | |||||
| // var s2 = new Date(); | |||||
| // var runTime = parseInt((s1.getTime() - s2.getTime()) / 1000); | |||||
| // var year = Math.floor(runTime / 86400 / 365); | |||||
| // var runTime = runTime % (86400 * 365); | |||||
| // var month = Math.floor(runTime / 86400 / 30); | |||||
| // var runTime = runTime % (86400 * 30); | |||||
| // var day = Math.floor(runTime / 86400); | |||||
| // var runTime = runTime % 86400; | |||||
| // var hour = Math.floor(runTime / 3600); | |||||
| // var runTime = runTime % 3600; | |||||
| // var minute = Math.floor(runTime / 60); | |||||
| // var runTime = runTime % 60; | |||||
| // var second = runTime; | |||||
| // console.log(year, month, day, hour, minute, second); | |||||
| // that.setData({ | |||||
| // year: year, | |||||
| // month: month, | |||||
| // day: day, | |||||
| // hour: hour, | |||||
| // minute: minute | |||||
| // }); | |||||
| // console.log(that.data.day); | |||||
| // wx.hideLoading(); | |||||
| // that.setData({ | |||||
| // data: res.data, | |||||
| // couponId: options.id | |||||
| // }); | |||||
| // }); | |||||
| Http.get({ | |||||
| url: config.api.bannerDetail, | |||||
| data: { | |||||
| id: options.id | |||||
| } | |||||
| }).then(res => { | |||||
| console.log(res); | |||||
| that.setData({ | |||||
| data: res.data | |||||
| }); | |||||
| console.log(that.data.data) | |||||
| }); | |||||
| } | } | ||||
| }); | |||||
| }); | |||||
| @@ -2,17 +2,13 @@ | |||||
| <view class='coupons'> | <view class='coupons'> | ||||
| <view class="coupons-body"> | <view class="coupons-body"> | ||||
| <view class='banner'> | <view class='banner'> | ||||
| <image src='./../../assets/img/timg.jpg' mode="widthFix"></image> | |||||
| <image src='{{data.coverImg}}' mode="widthFix"></image> | |||||
| </view> | </view> | ||||
| <view class='coupons_info'> | <view class='coupons_info'> | ||||
| <view> | <view> | ||||
| <text>大餐券<text>限购{{data.useLimitQuantity}}件</text></text> | |||||
| <text>剩余时间:<text>{{day}}天</text><text>{{hour}}小时</text><text>{{minute}}分钟</text></text> | |||||
| <text>剩余件数:<text>{{data.remainInventory}}件</text></text> | |||||
| </view> | |||||
| <view> | |||||
| <text>¥100</text> | |||||
| <text>¥10000</text> | |||||
| <text>{{data.title}}</text> | |||||
| <text>{{data.subTitle}}</text> | |||||
| <!-- <text>剩余时间:<text>{{day}}天</text><text>{{hour}}小时</text><text>{{minute}}分钟</text></text> --> | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| @@ -32,11 +28,12 @@ | |||||
| <text>活动详情</text> | <text>活动详情</text> | ||||
| </view> | </view> | ||||
| <view> | <view> | ||||
| <text><text class='spot'></text>有效期2018.01.16 至 2018.09.20的话不得不大半夜的吧大本营的被的夜班的不的夜班的也别的也好不到大本营</text> | |||||
| <text><text class='spot'></text>{{data.detail}}</text> | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <view class="buy-view app-border-top"> | <view class="buy-view app-border-top"> | ||||
| <button bindtap='orderFunc' class='buy'>立即购买</button> | <button bindtap='orderFunc' class='buy'>立即购买</button> | ||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| @@ -23,7 +23,7 @@ | |||||
| .coupons_info { | .coupons_info { | ||||
| width: 92%; | width: 92%; | ||||
| height: 186rpx; | |||||
| height: 120rpx; | |||||
| display: flex; | display: flex; | ||||
| justify-content: space-between; | justify-content: space-between; | ||||
| padding: 0 4%; | padding: 0 4%; | ||||
| @@ -142,11 +142,6 @@ | |||||
| color: #b8b8b8; | color: #b8b8b8; | ||||
| padding-top: 10rpx; | padding-top: 10rpx; | ||||
| } | } | ||||
| .notes { | |||||
| margin-top: 2%; | |||||
| } | |||||
| .notes view:nth-child(1) { | .notes view:nth-child(1) { | ||||
| width: 92%; | width: 92%; | ||||
| height: 87rpx; | height: 87rpx; | ||||
| @@ -14,6 +14,9 @@ Page({ | |||||
| onLoad(options) { | onLoad(options) { | ||||
| let that = this; | let that = this; | ||||
| console.log(options.id); | console.log(options.id); | ||||
| that.setData({ | |||||
| couponId:options.id | |||||
| }) | |||||
| console.log(options.targetAd); | console.log(options.targetAd); | ||||
| wx.showLoading({ | wx.showLoading({ | ||||
| title: "加载中..." | title: "加载中..." | ||||
| @@ -59,7 +62,6 @@ Page({ | |||||
| wx.hideLoading(); | wx.hideLoading(); | ||||
| that.setData({ | that.setData({ | ||||
| data: res.data, | data: res.data, | ||||
| couponId: options.id | |||||
| }); | }); | ||||
| }); | }); | ||||
| } | } | ||||
| @@ -6,7 +6,7 @@ | |||||
| <image class="commodity-img" src="{{item.coverImg}}" /> | <image class="commodity-img" src="{{item.coverImg}}" /> | ||||
| <view class="commodity-info"> | <view class="commodity-info"> | ||||
| <view class="commodity-info-name">{{item.title}}</view> | <view class="commodity-info-name">{{item.title}}</view> | ||||
| <view class="commodity-info-name">{{item.subTitle}}</view> | |||||
| <!-- <view class="commodity-info-name">{{item.subTitle}}</view> --> | |||||
| <view class="commodity-info-price"> | <view class="commodity-info-price"> | ||||
| <text class="commodity-info-price-p">¥{{item.salePriceStr}}</text> | <text class="commodity-info-price-p">¥{{item.salePriceStr}}</text> | ||||
| <text class="commodity-info-price-o">¥{{item.priceStr}}</text> | <text class="commodity-info-price-o">¥{{item.priceStr}}</text> | ||||
| @@ -1,49 +1,90 @@ | |||||
| let config = require('../../../config/config.js') | |||||
| let Http = require('../../../utils/HttpBasics') | |||||
| let app = getApp() | |||||
| let config = require("../../../config/config.js"); | |||||
| let Http = require("../../../utils/HttpBasics"); | |||||
| let app = getApp(); | |||||
| Page({ | Page({ | ||||
| data: { | data: { | ||||
| tabs: [{ | |||||
| key: 0, | |||||
| name: "全部" | |||||
| }, | |||||
| { | |||||
| key: 1, | |||||
| name: "待付款" | |||||
| }, | |||||
| { | |||||
| key: 2, | |||||
| name: "已完成" | |||||
| } | |||||
| tabs: [ | |||||
| { | |||||
| key: 0, | |||||
| name: "全部" | |||||
| }, | |||||
| { | |||||
| key: 1, | |||||
| name: "待付款" | |||||
| }, | |||||
| { | |||||
| key: 2, | |||||
| name: "已完成" | |||||
| } | |||||
| ], | ], | ||||
| list: [], | list: [], | ||||
| current: '', | |||||
| current_scroll: '1' | |||||
| current: "", | |||||
| current_scroll: "1", | |||||
| page: 2, | |||||
| allow_load: true | |||||
| }, | }, | ||||
| onLoad(e) { | onLoad(e) { | ||||
| this.getList(e.id, 1) | |||||
| this.getList(e.id, 1); | |||||
| this.setData({ | this.setData({ | ||||
| current_scroll: e.id | current_scroll: e.id | ||||
| }); | }); | ||||
| }, | }, | ||||
| getList(key, pageNum) { | getList(key, pageNum) { | ||||
| wx.showLoading({ | wx.showLoading({ | ||||
| title: 'loading...', | |||||
| }) | |||||
| Http.get({ | |||||
| url: config.api.orderList, | |||||
| data: { | |||||
| title: "loading..." | |||||
| }); | |||||
| console.log(key); | |||||
| /** | |||||
| * key==0 | |||||
| * 不发送该字段 | |||||
| */ | |||||
| if (key == 0) { | |||||
| var variable = { | |||||
| pageNum: pageNum, | pageNum: pageNum, | ||||
| pageSize: 3, | |||||
| pageSize: 5 | |||||
| }; | |||||
| } else { | |||||
| var variable = { | |||||
| pageNum: pageNum, | |||||
| pageSize: 5, | |||||
| orderStatus: key | orderStatus: key | ||||
| } | |||||
| }).then((res) => { | |||||
| }; | |||||
| } | |||||
| if(that.data.allow_load==''){ | |||||
| } | |||||
| Http.get({ | |||||
| url: config.api.orderList, | |||||
| data: variable | |||||
| }).then(res => { | |||||
| console.log(res); | |||||
| console.log("姐姐的订单列表"); | |||||
| wx.hideLoading(); | wx.hideLoading(); | ||||
| this.setData({ | |||||
| list: res.data.list | |||||
| }) | |||||
| }) | |||||
| 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 | |||||
| }); | |||||
| }); | |||||
| }, | }, | ||||
| handleChange({ detail }) { | handleChange({ detail }) { | ||||
| this.setData({ | this.setData({ | ||||
| @@ -51,9 +92,19 @@ Page({ | |||||
| }); | }); | ||||
| }, | }, | ||||
| handleChangeScroll({ detail }) { | handleChangeScroll({ detail }) { | ||||
| this.getList(detail.key, 1) | |||||
| this.getList(detail.key, 1); | |||||
| this.setData({ | this.setData({ | ||||
| current_scroll: detail.key | current_scroll: detail.key | ||||
| }); | }); | ||||
| }, | }, | ||||
| }) | |||||
| onReachBottom: function() { | |||||
| var that = this; | |||||
| console.info("before++ " + that.data.page); | |||||
| that.data.page++; | |||||
| console.info("after++ " + that.data.page); | |||||
| that.setData({ | |||||
| page: that.data.page | |||||
| }); | |||||
| that.getList(0, that.data.page); | |||||
| } | |||||
| }); | |||||
| @@ -12,18 +12,18 @@ | |||||
| <text>{{item.detail}}</text> | <text>{{item.detail}}</text> | ||||
| <text>等待付款</text> | <text>等待付款</text> | ||||
| </view> | </view> | ||||
| <!-- <view><text>购买数量:</text>{{item.tenantId}}件</view> --> | |||||
| <view> | <view> | ||||
| <text>购买数量:</text>{{item.tenantId}}件</view> | |||||
| <view> | |||||
| <text>下单时间:</text>2018-07-10 11:30</view> | |||||
| <text>下单时间:</text>2018-07-10 11:30 | |||||
| </view> | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <view class='payment'> | <view class='payment'> | ||||
| <view> | <view> | ||||
| <text>¥{{item.payment}}.00</text> | |||||
| <text>¥{{item.paymentType}}.00</text> | |||||
| <text>¥{{item.payment}}</text> | |||||
| <text>¥{{item.paymentType}}</text> | |||||
| </view> | </view> | ||||
| <view> | |||||
| <view class="btn"> | |||||
| <text>支付</text> | <text>支付</text> | ||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| @@ -13,9 +13,11 @@ | |||||
| width: 30% !important; | width: 30% !important; | ||||
| display: inline-block; | display: inline-block; | ||||
| } | } | ||||
| .section { | .section { | ||||
| margin-top: 2%; | margin-top: 2%; | ||||
| } | } | ||||
| .detail_msg { | .detail_msg { | ||||
| width: 92%; | width: 92%; | ||||
| height: 220rpx !important; | height: 220rpx !important; | ||||
| @@ -48,7 +50,8 @@ | |||||
| } | } | ||||
| .info view:nth-child(1) { | .info view:nth-child(1) { | ||||
| margin-bottom: 72rpx; | |||||
| margin-top: 20rpx; | |||||
| margin-bottom: 15rpx; | |||||
| } | } | ||||
| .info view:nth-child(1) text { | .info view:nth-child(1) text { | ||||
| @@ -61,7 +64,7 @@ | |||||
| } | } | ||||
| .info view:nth-child(2), .info view:nth-child(3) { | .info view:nth-child(2), .info view:nth-child(3) { | ||||
| color: #ff3434; | |||||
| color: #f96563; | |||||
| font-size: 24rpx; | font-size: 24rpx; | ||||
| padding-left: 4%; | padding-left: 4%; | ||||
| } | } | ||||
| @@ -76,19 +79,19 @@ | |||||
| } | } | ||||
| .payment { | .payment { | ||||
| position: relative; | |||||
| width: 92%; | width: 92%; | ||||
| height: 120rpx; | height: 120rpx; | ||||
| line-height: 120rpx; | line-height: 120rpx; | ||||
| padding: 0 4%; | padding: 0 4%; | ||||
| display: flex; | display: flex; | ||||
| justify-content: space-between; | justify-content: space-between; | ||||
| border-bottom: 20rpx solid #EDEDED; | |||||
| border-bottom: 20rpx solid #ededed; | |||||
| } | } | ||||
| .payment view:nth-child(1) text:nth-child(1) { | .payment view:nth-child(1) text:nth-child(1) { | ||||
| font-size: 36rpx; | font-size: 36rpx; | ||||
| color: #ff3434; | |||||
| font-weight: bold; | |||||
| color: #f96563; | |||||
| } | } | ||||
| .payment view:nth-child(1) text:nth-child(2) { | .payment view:nth-child(1) text:nth-child(2) { | ||||
| @@ -98,14 +101,21 @@ | |||||
| text-decoration: line-through; | text-decoration: line-through; | ||||
| } | } | ||||
| .payment view:nth-child(2) { | |||||
| width: 114rpx; | |||||
| height: 50rpx; | |||||
| background: #00c0ff; | |||||
| border-radius: 10px; | |||||
| line-height: 38rpx; | |||||
| .btn{ | |||||
| position: absolute; | |||||
| top: 0; | |||||
| bottom: 0; | |||||
| margin: auto; | |||||
| right: 20rpx; | |||||
| width: 200rpx; | |||||
| height: 60rpx; | |||||
| line-height: 60rpx; | |||||
| text-align: center; | text-align: center; | ||||
| margin-top: 40rpx; | |||||
| background: #00c0ff; | |||||
| color: #fff; | |||||
| float: right; | |||||
| border-radius: 15rpx; | |||||
| font-size: 28rpx; | |||||
| } | } | ||||
| .payment view:nth-child(2) text { | .payment view:nth-child(2) text { | ||||