feat 我的优惠券默认城市

develop
GJW200011 4 years ago
parent 32d25f13b8
commit a39bd028e1

@ -37,11 +37,15 @@ Page({
icon: 'success', icon: 'success',
mask: true mask: true
}) })
setTimeout(() => { this.data.coupons_list[e.currentTarget.dataset.index].is_received = 1
wx.redirectTo({ this.setData({
url: '/pages/user/discount/discount/discount', coupons_list: this.data.coupons_list
}) })
}, 1000); })
},
mydiscount() {
wx.redirectTo({
url: '/pages/user/discount/discount/discount',
}) })
}, },
/** /**

@ -15,7 +15,8 @@
</view> </view>
<view class="_ln">有效期至{{item.end_date}}</view> <view class="_ln">有效期至{{item.end_date}}</view>
</view> </view>
<view class="_rightbtn" bindtap="collect_receive" data-id="{{item.id}}" wx:if="{{!item.is_received}}">领取</view> <view class="_rightbtn" bindtap="collect_receive" data-id="{{item.id}}" data-index='{{index}}' wx:if="{{!item.is_received}}">领取</view>
<view class="_rightbtn received" wx:else>已领取</view> <view class="_rightbtn received" wx:else>已领取</view>
</view> </view>
</view> </view>
<button class="_button" bindtap="mydiscount">我的优惠券</button>

@ -56,3 +56,14 @@
font-size: 28rpx; font-size: 28rpx;
margin-bottom: 10rpx; 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);
}

@ -1,6 +1,7 @@
import { import {
http http,
location_city
} from '../../../../utils/util' } from '../../../../utils/util'
Page({ Page({
@ -19,13 +20,26 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
let coupon_id = options.coupon_id let coupon_id = options.coupon_id
let city_id = getApp().globalData.city_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 })
}) })
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */

Loading…
Cancel
Save