This commit is contained in:
zhangjing
2021-06-15 13:32:20 +08:00
parent e3b1e0fe99
commit ffdf4bb529
9 changed files with 151 additions and 17 deletions

View File

@@ -70,6 +70,9 @@ const fridayInfo = (werlfare_id, address_id, is_deliver) => req({url: "welfare/o
//周五福利-支付 //周五福利-支付
const fridayPay = (trade_no) => req({url: "payments/welfare/wechat",method: "POST", data: {trade_no: trade_no}}) const fridayPay = (trade_no) => req({url: "payments/welfare/wechat",method: "POST", data: {trade_no: trade_no}})
//洗车券-获取跳转地址
const washcarUrl = (welfare_id, right_config_id) => req({url: "washcar/infourl", data: {welfare_id: welfare_id, right_config_id: right_config_id}})
export default({ export default({
index, index,
choice, choice,
@@ -93,5 +96,6 @@ export default({
newCity, newCity,
newidxCity, newidxCity,
fridayInfo, fridayInfo,
fridayPay fridayPay,
washcarUrl
}) })

View File

@@ -25,7 +25,8 @@
"pages/packet/packet", "pages/packet/packet",
"pages/frozen/frozen", "pages/frozen/frozen",
"pages/welfare/welfare", "pages/welfare/welfare",
"pages/classify/classify" "pages/classify/classify",
"pages/washcar/washcar"
], ],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
@@ -61,7 +62,7 @@
}, },
"plugins": { "plugins": {
"sendCoupon": { "sendCoupon": {
"version" : "1.2.0", "version": "1.2.0",
"provider": "wxf3f436ba9bd4be7b" "provider": "wxf3f436ba9bd4be7b"
} }
} }

View File

@@ -183,7 +183,9 @@ Page({
Snapup(e) { Snapup(e) {
let canBuy = e.currentTarget.dataset.can, let canBuy = e.currentTarget.dataset.can,
canText = e.currentTarget.dataset.text, canText = e.currentTarget.dataset.text,
canId = e.currentTarget.dataset.id canId = e.currentTarget.dataset.id,
canFrom = e.currentTarget.dataset.from,
canRightid = e.currentTarget.dataset.rightid
if(!canBuy) { if(!canBuy) {
wx.showToast({ wx.showToast({
title : canText, title : canText,
@@ -193,23 +195,76 @@ Page({
return return
} }
wx.getStorage({
key : 'token',
success:res=>{
if(canFrom == 'washcar') {
wx.$api.index.washcarUrl(canId, canRightid).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 : ''
})
}
})
} else {
// 跳转分类页 // 跳转分类页
wx.navigateTo({ wx.navigateTo({
url: '/pages/welfare/welfare?id=' + canId url: '/pages/welfare/welfare?id=' + canId
}) })
}
},
fail: (err) => {
wx.navigateTo({
url: "/pages/login/login"
})
}
})
}, },
/** /**
* 活动中心权益跳转详情 * 活动中心权益跳转详情
*/ */
rightNav(e) { rightNav(e) {
let id = e.currentTarget.dataset.id let id = e.currentTarget.dataset.id,
from = e.currentTarget.dataset.from,
rightid = e.currentTarget.dataset.rightid
wx.getStorage({ wx.getStorage({
key : 'token', key : 'token',
success:res=>{ success:res=>{
if(from == 'washcar') {
wx.$api.index.washcarUrl(id, rightid).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 : ''
})
}
})
} else {
// 跳转分类页
wx.navigateTo({ wx.navigateTo({
url: '/pages/rights/rights?id=' + id url: '/pages/rights/rights?id=' + id
}) })
}
}, },
fail: (err) => { fail: (err) => {
wx.navigateTo({ wx.navigateTo({

View File

@@ -68,7 +68,7 @@
<view class="cardArr-top"> <view class="cardArr-top">
<block wx:if="{{cardArr.length > 0}}"> <block wx:if="{{cardArr.length > 0}}">
<view bindtap="rightNav" wx:for="{{cardArr}}" wx:key="cardArr" class="indexCard" <view bindtap="rightNav" wx:for="{{cardArr}}" wx:key="cardArr" class="indexCard"
data-id="{{item.right_config_id}}"> data-id="{{item.right_config_id}}" data-from="{{item.from}}" data-rightid="{{item.right_config_id}}">
<image class="indexCard-img" src="{{item.cover}}"></image> <image class="indexCard-img" src="{{item.cover}}"></image>
<view class="nowrap indexCard-title">{{item.title}}</view> <view class="nowrap indexCard-title">{{item.title}}</view>
<view class="nowrap activity-remark" wx:if="{{item.subtitle != null}}"> <view class="nowrap activity-remark" wx:if="{{item.subtitle != null}}">
@@ -90,7 +90,7 @@
<view class="WelfareTitle"><text>周五会员福利日</text></view> <view class="WelfareTitle"><text>周五会员福利日</text></view>
<view class="WelfareList"> <view class="WelfareList">
<view class="WelfareList-back" bindtap="Snapup" wx:for="{{activities}}" wx:key="activities" <view class="WelfareList-back" bindtap="Snapup" wx:for="{{activities}}" wx:key="activities"
data-text="{{item.code_text}}" data-can="{{item.canBuy}}" data-id="{{item.welfare_id}}"> data-text="{{item.code_text}}" data-can="{{item.canBuy}}" data-id="{{item.welfare_id}}" data-from="{{item.right.from}}" data-rightId="{{item.right.right_config_id}}">
<image class="WelfareList-img {{item.surplus == 0 ? 'active' : ''}}" <image class="WelfareList-img {{item.surplus == 0 ? 'active' : ''}}"
src="/static/img/welfare_back.png"></image> src="/static/img/welfare_back.png"></image>
<view class="WelfareList-left"> <view class="WelfareList-left">

69
pages/washcar/washcar.js Normal file
View File

@@ -0,0 +1,69 @@
// pages/webView/webView.js
Page({
/**
* 页面的初始数据
*/
data: {
url:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
console.log(options.url)
this.setData({
url : decodeURIComponent(options.url)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

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

View File

@@ -0,0 +1 @@
<web-view src="{{url}}"></web-view>

View File

@@ -0,0 +1 @@
/* pages/washcar/washcar.wxss */

View File

@@ -23,7 +23,7 @@
"compileHotReLoad": false, "compileHotReLoad": false,
"useMultiFrameRuntime": true, "useMultiFrameRuntime": true,
"useApiHook": true, "useApiHook": true,
"useApiHostProcess": false, "useApiHostProcess": true,
"babelSetting": { "babelSetting": {
"ignore": [], "ignore": [],
"disablePlugins": [], "disablePlugins": [],