diff --git a/pages/user/discount/coupons/coupons.js b/pages/user/discount/coupons/coupons.js index 2decbc8..980e9e6 100644 --- a/pages/user/discount/coupons/coupons.js +++ b/pages/user/discount/coupons/coupons.js @@ -37,11 +37,15 @@ Page({ icon: 'success', mask: true }) - setTimeout(() => { - wx.redirectTo({ - url: '/pages/user/discount/discount/discount', - }) - }, 1000); + this.data.coupons_list[e.currentTarget.dataset.index].is_received = 1 + this.setData({ + coupons_list: this.data.coupons_list + }) + }) + }, + mydiscount() { + wx.redirectTo({ + url: '/pages/user/discount/discount/discount', }) }, /** diff --git a/pages/user/discount/coupons/coupons.wxml b/pages/user/discount/coupons/coupons.wxml index 6c6c2e0..068c5ed 100644 --- a/pages/user/discount/coupons/coupons.wxml +++ b/pages/user/discount/coupons/coupons.wxml @@ -15,7 +15,8 @@ 有效期至{{item.end_date}} - 领取 + 领取 已领取 - \ No newline at end of file + + \ No newline at end of file diff --git a/pages/user/discount/coupons/coupons.wxss b/pages/user/discount/coupons/coupons.wxss index e25cfa2..f33236f 100644 --- a/pages/user/discount/coupons/coupons.wxss +++ b/pages/user/discount/coupons/coupons.wxss @@ -55,4 +55,15 @@ /* color: #181818; */ font-size: 28rpx; margin-bottom: 10rpx; +} +._button{ + position: fixed; + bottom: 100rpx; + width: 312rpx; + background: linear-gradient(90deg, #FF4284 0%, #FF1D42 100%); + border-radius: 44rpx; + color: #fff; + font-size: 28rpx; + left: 50%; + transform: translate(-50%,0); } \ No newline at end of file diff --git a/pages/user/discount/discount_avilable/discount_avilable.js b/pages/user/discount/discount_avilable/discount_avilable.js index d058d93..ece7406 100644 --- a/pages/user/discount/discount_avilable/discount_avilable.js +++ b/pages/user/discount/discount_avilable/discount_avilable.js @@ -1,6 +1,7 @@ import { - http + http, + location_city } from '../../../../utils/util' Page({ @@ -19,13 +20,26 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { + let coupon_id = options.coupon_id let city_id = getApp().globalData.city_id - http("/api/v1/coupon-cycle","post",{coupon_id,city_id}).then(res=>{ - this.setData({IP_list:res}) + + if (!city_id) { + // 默认北京写法 + location_city().then(res => { + let city_id = res.city_info.city_id + getApp().globalData.city_id = city_id + this.getip_list(coupon_id, city_id) + }) + return + } + this.getip_list(coupon_id, city_id) + }, + getip_list(coupon_id, city_id) { + http("/api/v1/coupon-cycle", "post", { coupon_id, city_id }).then(res => { + this.setData({ IP_list: res }) }) }, - /** * 生命周期函数--监听页面初次渲染完成 */