This commit is contained in:
zhangmanman
2021-06-29 14:15:41 +08:00
parent fa6638c90b
commit b5c5316f8b
17 changed files with 136 additions and 7 deletions

37
pages/car/index.js Normal file
View File

@@ -0,0 +1,37 @@
/*
* 本时生活
*/
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
console.log(options)
// this.couponInfo()
},
/**
* 生命周期函数--监听页面显示
*/
onShow () {
},
/**
* 卡券列表
*/
couponInfo() {
wx.$api.user.washcarBuy().then(res=>{
console.log(res)
})
}
})

3
pages/car/index.json Normal file
View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

2
pages/car/index.wxml Normal file
View File

@@ -0,0 +1,2 @@
<!--pages/car/index.wxml-->
<text>pages/car/index.wxml</text>

1
pages/car/index.wxss Normal file
View File

@@ -0,0 +1 @@
/* pages/car/index.wxss */

View File

@@ -92,5 +92,36 @@ Page({
delta: 1
})
}
},
// 优惠券跳转
couponUrl(e) {
let newFrom = e.currentTarget.dataset.from,
newId = e.currentTarget.dataset.id,
newStatus = e.currentTarget.dataset.status
if(newStatus == 0) {
if(newFrom == 'washcar') {
wx.$api.index.washcarCoupon(newId).then(res=>{
const newUrl = res.data
let url= encodeURIComponent(newUrl)
wx.redirectTo({
// 跳转到webview页面
url: `/pages/washcar/washcar?url=${url}`
});
}).catch(err=>{
if(!err.login){
// 写入缓存
wx.setStorage({
key : 'token',
data : ''
})
}
})
return
}
wx.navigateTo({
url: '/pages/couponDetails/couponDetails?id=' + newId
})
}
}
})

View File

@@ -16,7 +16,8 @@
<!-- 卡券列表 -->
<view class="coupon" wx:if="{{coupons != ''}}">
<view class="couponCont {{item.status != 0 ? 'active' : ''}}" wx:for="{{coupons}}" wx:key="coupons">
<navigator hover-class="none" class="couponList" url="{{item.status == 0 ? '/pages/couponDetails/couponDetails?id=' + item.coupon_id : ''}}">
<!-- url="{{item.status == 0 ? '/pages/couponDetails/couponDetails?id=' + item.coupon_id : ''}}" -->
<view hover-class="none" class="couponList" bindtap="couponUrl" data-id="{{item.coupon_id }}" data-from="{{item.from }}" data-status="{{item.status}}">
<view class="couponList-left">
<image class="couponList-img" src="/static/img/coupon_img.png"></image>
@@ -54,7 +55,7 @@
<image wx:if="{{item.status == 1}}" src="/static/img/coupon_tips_00.png" class="coupoTips"></image>
<image wx:if="{{item.status == 2}}" src="/static/img/coupon_tips_01.png" class="coupoTips"></image>
</navigator>
</view>
<view class="couponMore" wx-if="{{item.count > 1}}" >
<view class="couponMore-text" bindtap="couponTap" data-id="{{item.activityId}}" data-status="{{item.status}}">
<view class="couponMore-title">查看全部{{item.count}}张卡券</view>

View File

@@ -64,6 +64,37 @@ Page({
pageNumber++
this.couponInfo(pageNumber)
}
},
// 优惠券跳转
couponUrl(e) {
let newFrom = e.currentTarget.dataset.from,
newId = e.currentTarget.dataset.id,
newStatus = e.currentTarget.dataset.status
if(newStatus == 0) {
if(newFrom == 'washcar') {
wx.$api.index.washcarCoupon(newId).then(res=>{
const newUrl = res.data
let url= encodeURIComponent(newUrl)
wx.redirectTo({
// 跳转到webview页面
url: `/pages/washcar/washcar?url=${url}`
});
}).catch(err=>{
if(!err.login){
// 写入缓存
wx.setStorage({
key : 'token',
data : ''
})
}
})
return
}
wx.navigateTo({
url: '/pages/couponDetails/couponDetails?id=' + newId
})
}
}
/**

View File

@@ -1,7 +1,8 @@
<!-- 卡券列表 -->
<view class="coupon" wx:if="couponArr != ''">
<navigator class="couponCont {{item.status != 0 ? 'active' : ''}}" wx:for="{{couponArr}}" wx:key="couponArr" hover-class="none" url="{{item.status == 0 ? '/pages/couponDetails/couponDetails?id=' + item.id : ''}}">
<!-- url="{{item.status == 0 ? '/pages/couponDetails/couponDetails?id=' + item.id : ''}}" -->
<view class="couponCont {{item.status != 0 ? 'active' : ''}}" wx:for="{{couponArr}}" wx:key="couponArr" bindtap="couponUrl" data-id="{{item.id}}" data-from="{{item.from }}" data-status="{{item.status}}">
<view class="couponList">
<view class="couponList-left">
<image class="couponList-img" src="/static/img/coupon_img.png"></image>
@@ -47,7 +48,7 @@
<image class="couponMore-arrow" src="/static/icon/arrow_left.png"></image>
</view>
</view>
</navigator>
</view>
<view class="pagesLoding" wx:if="{{lodingStats}}">
<block wx:if="{{page.has_more}}">
<image class="pagesLoding-icon" src="/static/icon/refresh_loding.gif" mode="widthFix"></image>加载中...

View File

@@ -33,6 +33,7 @@ Page({
*/
frozenInfo() {
wx.$api.user.ungrants(this.data.type).then(res=>{
console.log(res.data)
this.setData({
frozenData: res.data
})

View File

@@ -105,7 +105,7 @@
<image src="/static/icon/frozen_arrow.png"></image>
返回上一个权益
</view>
<view class="frozenArrow-right" wx:if="{{frozenData.length > 1}}">
<view class="frozenArrow-right" wx:if="{{current == 0 || frozenData[frozenData.length - 1] > 0}}">
<image src="/static/icon/frozen_arrow.png"></image>
查看下一个权益
</view>

View File

@@ -219,6 +219,7 @@ Page({
* 选择收货地址
*/
selectAddress(e){
console.log(e)
let new_addressId = e.currentTarget.dataset.id,
addressId = this.data.address.id
if (new_addressId != addressId) {

View File

@@ -133,6 +133,8 @@ Page({
this.setData({
regiList : res.data
})
console.log(this.data.regiList)
})
},
@@ -140,6 +142,7 @@ Page({
* 选择市区返回
*/
regionOpt (e) {
console.log(e)
let area_name = e.currentTarget.dataset.city
var pages = getCurrentPages();
var prevPage = pages[pages.length - 2];

View File

@@ -15,6 +15,8 @@ Page({
this.setData({
url : decodeURIComponent(options.url)
})
console.log(this.data.url)
},
/**