Commit 63d96bfc by 匡雅琴

跳转更多页面

1 parent 7d5f6008
...@@ -129,6 +129,12 @@ ...@@ -129,6 +129,12 @@
"pages": [ "pages": [
"pages/strategyDetail/index" "pages/strategyDetail/index"
] ]
},
{
"root": "packageSaveMoney",
"pages": [
"pages/allEquity/allEquity"
]
} }
], ],
"usingComponents": { "usingComponents": {
......
// import { equityApi } from '~/api/api'
import { isMember } from '~/utils/cache/storageApi'
Page({
/**
* 页面的初始数据
*/
data: {
cHeight: 600,
curIndex: 0,
equityList: [],
to: 'to-0'
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let system = wx.getSystemInfoSync()
this.getAllMerchantList()
this.setData(
{
cHeight: system.windowHeight
},
() => {
isMember(true)
}
)
if (options.showToast) {
setTimeout(()=>{
wx.$api.showToast('原商品及品牌均已下架,您可查看其他权益商品')
},500)
}
},
computerHeight() {
let query = wx.createSelectorQuery().in(this)
let heightArr = []
let s = 0
query
.selectAll('.scroll_item_wrap')
.boundingClientRect(react => {
react.forEach(item => {
s += item.height
heightArr.push(s)
})
this.data.heightArr = heightArr
})
.exec()
query
.select('.right_wrap')
.boundingClientRect(res => {
this.data.rightHeight = res.height
})
.exec()
},
scrollViewFn(e) {
let scrollTop = e.detail.scrollTop
let scrollArr = this.data.heightArr
if (this.data.isClickLeft) {
this.data.isClickLeft = false
return
}
if (scrollTop >= scrollArr[scrollArr.length - 1] - this.data.rightHeight) {
return
} else {
for (let i = 0; i < scrollArr.length; i++) {
if (scrollTop >= 0 && scrollTop < scrollArr[0]) {
this.setData({
curIndex: 0
})
} else if (scrollTop >= scrollArr[i - 1] - 110 && scrollTop < scrollArr[i] - 110) {
this.setData({
curIndex: i
})
}
}
}
},
slectLeftItem(e) {
const { index } = e.currentTarget.dataset
this.setData({
curIndex: index,
to: `to-${index}`,
isClickLeft: true
})
},
getAllMerchantList() {
let merchantId = wx.$storage.get('srcm_shopmall_merchant_id')
let para = {
merchantId
}
wx.p.api.equityApi.getAllEquity(para).then(res => {
let tempArr = res.goodsServiceList
tempArr.unshift({
goodsCategory: '汽车权益',
equityGoodsGroupDescDtos: res.carServiceList
})
this.setData(
{
equityList: tempArr
},
() => {
this.computerHeight()
}
)
})
},
toNewPage(e) {
const { item } = e.currentTarget.dataset
let url = ''
if (item.supplier == 'GL_OIL') {
let sid = wx.$util.getSessionId()
if (!sid) {
url = '/packageShopmall/packageEquity/pages/oil/oil?open=2'
} else {
const vip = isMember()
url = '/packageShopmall/packageEquity/pages/oil/oil?open=' + `${vip ? 1 : 2}`
}
// let para = 'https://mp.weixin.qq.com/s/Gj3PE3n31PHMOMc5S1CYkg'
} else if (item.supplier == 'GL_ROAD_RESCUE') {
url = '/packageShopmall/packageEquity/pages/road/index/index'
} else if (item.supplier == 'EDJ') {
let para = wx.$storage.get('edjurl') || ''
para = encodeURIComponent(para)
url = '/pages/webView/webView?url=' + para
} else if (item.appearance == 1) {
let para = {
supplier: item.supplier,
brandName: item.brandName,
location: true
}
const temp = JSON.stringify(para)
url = '/packageShopmall/packageEquity/pages/commodity/detail/detail?param=' + temp
} else if (item.appearance == 2) {
let para = {
supplier: item.supplier,
brandName: item.brandName,
icon: item.equityIcon
}
const temp = JSON.stringify(para)
url = '/packageShopmall/packageEquity/pages/commodity/chargeDetail/chargeDetail?param=' + temp
}
wx.navigateTo({
url
})
}
})
{
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<view class="allEquity-container">
<view style="height:{{cHeight}}px" class="left_wrap">
<block wx:for="{{equityList}}" wx:key="index">
<view bind:tap="slectLeftItem" data-index="{{index}}" class="selecTab flex_cc {{curIndex==index?'actvie_class':''}}">
<text>{{item.goodsCategory}}</text>
<view wx:if="{{curIndex==index}}" class="active_line"></view>
</view>
</block>
</view>
<view style="height:{{cHeight}}px" class="right_wrap">
<scroll-view scroll-y="{{true}}" scroll-with-animation scroll-into-view="{{to}}" bindscroll="scrollViewFn" style="height:{{cHeight}}px">
<block wx:for="{{equityList}}" wx:key="index">
<view id="to-{{index}}" class="scroll_item_wrap">
<view class="scroll_title">{{item.goodsCategory}}</view>
<view class="scroll_content">
<view wx:for="{{item.equityGoodsGroupDescDtos}}" wx:for-item="childItem" wx:for-index="indexs" wx:key="indexs" class="element" data-item="{{childItem}}" bind:tap="toNewPage">
<image webp class="element_icon" src="{{childItem.equityIcon}}" />
<view class="element_label common_element_text">
{{childItem.equityName}}
</view>
<view class="element_tip common_element_text">
{{childItem.equityDesc}}
</view>
</view>
</view>
</view>
</block>
</scroll-view>
</view>
</view>
\ No newline at end of file \ No newline at end of file
/* packageEquity/pages/allEquity/allEquity.wxss */
page {
background: #F7F8FA;
}
.allEquity-container {
display: flex;
}
.left_wrap {
width: 21.33%;
}
.right_wrap {
width: 78.67%;
overflow: hidden;
background: white;
box-sizing: border-box;
padding: 0rpx 30rpx 0rpx 32rpx;
}
.scroll_item_wrap {
width: 100%;
padding: 16rpx 0 0rpx 0;
}
.scroll_title {
font-size: 26rpx;
font-weight: 600;
color: #282829;
}
.scroll_content {
margin-top: 36rpx;
display: flex;
flex-wrap: wrap;
}
.element {
width: 25%;
min-height: 176rpx;
margin-bottom: 20rpx;
}
.element_icon {
width: 70%;
height: 92rpx;
}
.element_label {
font-size: 24rpx;
font-weight: 400;
color: #282829;
line-height: 34rpx;
margin-top: 10rpx;
}
.element_tip {
font-size: 20rpx;
font-weight: 400;
color: #FC5B32;
line-height: 40rpx;
text-align: center;
}
.common_element_text {
width: calc(100% - 21rpx);
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.selecTab {
height: 120rpx;
position: relative;
background: #EFF0F2;
font-size: 26rpx;
font-weight: 400;
color: #656566;
}
.active_line {
position: absolute;
top: 50%;
left: 0;
transform: translate(0, -50%);
width: 8rpx;
height: 60rpx;
background: #FC5B32;
border-radius: 2rpx;
}
.actvie_class {
background: #FFFFFF;
color: #282829;
}
.flex_cc {
display: flex;
align-items: center;
justify-content: center;
}
\ No newline at end of file \ No newline at end of file
...@@ -32,13 +32,8 @@ Page({ ...@@ -32,13 +32,8 @@ Page({
}, },
navbarReady(e) { goMorePage() {
let { wx.p.router.go('/packageSaveMoney/pages/allEquity/allEquity')
height
} = e.detail
this.setData({
user_box_style: `padding-top:${height + 20}px`
})
}, },
// 获取附近优惠数据 // 获取附近优惠数据
...@@ -60,7 +55,7 @@ Page({ ...@@ -60,7 +55,7 @@ Page({
if (page) { if (page) {
para.pageSize = 0 para.pageSize = 0
} }
equityApi.lasteCommodity(para).then(res => { wx.p.api.equityApi.lasteCommodity(para).then(res => {
if (!res) { if (!res) {
this.setData({ this.setData({
loadOver: true loadOver: true
......
...@@ -10,17 +10,17 @@ ...@@ -10,17 +10,17 @@
</view> </view>
<view class="title-box flex"> <view class="title-box flex">
<main-title title="吃喝省"></main-title> <main-title title="吃喝省"></main-title>
<view class="more-text">更多 <gl-icon iconName="{{'gl-icon-the-arrow'}}" fontSize="26" color="#666666"></gl-icon></view> <view class="more-text" bind:tap="goMorePage">更多 <gl-icon iconName="{{'gl-icon-the-arrow'}}" fontSize="26" color="#666666"></gl-icon></view>
</view> </view>
<menu-box menuList="{{foodMenuList}}"></menu-box> <menu-box menuList="{{foodMenuList}}"></menu-box>
<view class="title-box flex"> <view class="title-box flex">
<main-title title="娱乐省"></main-title> <main-title title="娱乐省"></main-title>
<view class="more-text">更多 <gl-icon iconName="{{'gl-icon-the-arrow'}}" fontSize="26" color="#666666"></gl-icon></view> <view class="more-text" bind:tap="goMorePage">更多 <gl-icon iconName="{{'gl-icon-the-arrow'}}" fontSize="26" color="#666666"></gl-icon></view>
</view> </view>
<menu-box menuList="{{funMenuList}}"></menu-box> <menu-box menuList="{{funMenuList}}"></menu-box>
<view class="title-box flex"> <view class="title-box flex">
<main-title title="用车省"></main-title> <main-title title="用车省"></main-title>
<view class="more-text">更多 <gl-icon iconName="{{'gl-icon-the-arrow'}}" fontSize="26" color="#666666"></gl-icon></view> <view class="more-text" bind:tap="goMorePage">更多 <gl-icon iconName="{{'gl-icon-the-arrow'}}" fontSize="26" color="#666666"></gl-icon></view>
</view> </view>
<menu-box menuList="{{carMenuList}}"></menu-box> <menu-box menuList="{{carMenuList}}"></menu-box>
<view class="title-box"> <view class="title-box">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!