|
- const imgurl = require("../../utils/imgurl");
- const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'
-
- Page({
- /**
- * 组件的初始数据
- */
- data: {
- navigationBarHeight,
- teljpgUrl: imgurl.teljpg.url,
- showMore: true,
- more: "点击查看更多",
- hidden: "hidden",
- height: "",
- merchantVoList:[]
- },
- /**
- * 跳转到门店列表的详情页面
- */
- gotoDetail(e) {
- wx.navigateTo({
- url: `/pages/index/searchbar/detail/index?id=${e.currentTarget.dataset.id}`
- })
- },
- // 点击查看更多
- more: function () {
- let that = this;
- if (that.data.more == '点击查看更多') {
- this.setData({
- hidden: "",
- height: 'auto!important',
- more: "点击收起",
- showMore: true
- })
- } else {
- that.setData({
- hidden: "hidden",
- height: 4 * 140 + 'rpx',
- more: "点击查看更多",
- showMore: true
- })
- }
- },
- phone: function (e) {
- let that = this;
- wx.makePhoneCall({
- phoneNumber: e.target.dataset.merchantlinkphone
- });
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- if (options.merchantVoList){
- this.setData({
- merchantVoList: JSON.parse(options.merchantVoList)
- })
- let merchantVoList = this.data.merchantVoList;
- if (merchantVoList.length > 0) {
- if (merchantVoList.length <= 4) {
- this.setData({
- height: merchantVoList.length * 140 + 'rpx',
- showMore: false,
- hidden: "hidden"
- })
- } else if (merchantVoList && merchantVoList.length > 4) {
- this.setData({
- height: 4 * 140 + 'rpx'
- })
- }
- }
- }
- }
- })
|