首页 > 小程序教程 > 微信小程序蛋糕馆大字体列表页样式模板制作设计下载

微信小程序蛋糕馆大字体列表页样式模板制作设计下载

上一篇 下一篇
制作好以后效果图如下:
一、wxml页面代码如下:
<view class="tab">
  <view class="{{tab==0?'tab-on':'tab-out'}}" data-index="0" catchtap="changeTab">经典系列</view>
  <view class="{{tab==1?'tab-on':'tab-out'}}" data-index="1" catchtap="changeTab">吉致系列</view>
</view>
<view class="tab-layer"></view>
<view wx:if="{{tab==0}}">
  <view class="item itemjd" data-pname="{{p.name}}" data-brand="0" bindtap="goDetail" wx:for="{{list}}" wx:key="name" wx:for-item="p">
    <view class="img">
      <image src="{{p.imgUrl}} " mode="aspectFit" />
    </view>
    <view class="con">
      <view class="nm">{{p.name}}</view>
      <view class="des">{{p.des}}</view>
      <view class="sub">¥
        <text>{{p.price}}</text>
      </view>
    </view>
  </view>
</view>
<view wx:if="{{tab==1}}">
  <view class="item itemjz" bindtap="goDetail" data-pname="{{p.name}}" data-brand="1" data-price="{{p.price}}" wx:for="{{listJz}}" wx:key="name" wx:for-item="p">
    <view class="img">
      <image src="{{p.imgUrl}}" mode="aspectFit" />
    </view>
    <view class="con">
      <view class="nm">{{p.name}}</view>
      <view class="des">{{p.des}}</view>
      <view class="sub">¥
        <text>{{p.price}}</text>
      </view>
    </view>
  </view>
</view>
 
二、wxss样式文件代码如下:
page{padding: 55px 0 0;background-color: #f3f3f3;}
.tab{width: 720rpx; position: fixed;z-index: 100; left: 14rpx; top:10rpx;border:1px solid #576b95;height: 40px; line-height:40px;border-radius: 5px;display: flex;font-size: 13pt;}
.tab-layer{width: 750rpx;height: 50px; background: #fff;opacity: 0.9;left: 0;top: 0; position: fixed;z-index: 99; border-bottom: 1rpx solid #dedede;}
.tab .tab-on{background-color: #576b95;text-align: center; color: #fff;flex: 1;}
.tab .tab-out{text-align: center;flex: 1;}

.item{display: flex; padding: 10px 0; background-color: #fff;border-bottom: 1px solid #eee;}
.item:active{background-color: #f5f5f5;}
.item .img{width:300rpx; text-align: center;}
.itemjd .img image{width: 250rpx;height: 180rpx; }
.itemjz .img image{width:100%;height:200rpx;}
.item .con{flex: 1; padding: 0 10px 0 0;}
.con .nm{font-size: 14pt; font-weight: bold;}
.con .des{line-height: 22px; font-size: 12pt; padding: 5px 0;color: #999;}
.con .sub{color: #ff6a00;font-size: 12pt;}
.con .sub text{font-size: 15pt;}

.jzitem image{width: 720rpx; height:540rpx; }
三、js页面代码如下:
var base = getApp();
var jzData = require('../../utils/jzData.js')
Page({
    data: {
        tab: 0,
        list: [],
        listJz: []
    },
    onLoad: function () {
        var _this = this;
        var _dic = base.cake.getCache();
        if (_dic) {
            this.setlist(_dic);
        } else {
            this.initData();
        }
        //极致系列
        var _jzlist = [];
        var dic = jzData.data;
        for (var i in dic) {
            _jzlist.push({
                name: i,
                price: dic[i].CakeType[0].CurrentPrice + ".00",
                des: dic[i].Means,
                imgUrl: base.path.res + dic[i].img
            })
        }
        this.setData({ "listJz": _jzlist });
    },
    onShow: function (e) {
        if (base.cake.tab != null) {
            this.setData({ "tab": base.cake.tab });
            base.cake.tab = null;
        }
        // if (base.version.current != base.version.getValue()) {

        //     this.initData();
        // }
    },
    initData: function () {
        var _this = this;
        // var _dic = base.cake.getCache();
        // if (_dic) {
        //     _this.setlist(_dic);
        // } else {
        base.get({ c: "Product", m: "GetAllProduct", City: "上海" }, function (d) {
            var data = d.data;
            if (data.Status == "ok") {
                base.cake.setCache(data.Tag);
                _this.setlist(data.Tag);
            }
        })
        //}

    },
    setlist: function (dic) {
        var _list = [];
        for (var i in dic) {
            _list.push({
                name: i,
                price: dic[i].CakeType[0].CurrentPrice + ".00",
                des: dic[i].Means,
                //imgUrl: base.path.res + "images/ksk/mlist/item/" + i + ".jpg"
                imgUrl: base.path.res + "/images-2/index-3/jdcake/w_240/" + encodeURI(i) + ".png"
            })
        }
        this.setData({ "list": _list });
    },
    ing: function (e) {
        var price = e.currentTarget.dataset.price;
        base.modal({
            title: '是否需要购买优惠券?',
            showCancel: true,
            confirmText: "去购买",
            success: function (res) {
                if (res.confirm) {
                    wx.navigateTo({
                        url: "../buy/buy?type=1&price=" + price
                    })
                }
            }
        })
    },
    changeTab: function (e) {
        var d = e.currentTarget.dataset.index;
        this.setData({ tab: d });
    },
    goDetail: function (e) {
        var d = e.currentTarget.dataset.pname;
        var b = e.currentTarget.dataset.brand;
        if (d) {
            wx.navigateTo({
                url: '../cakeDetail/cakeDetail?pname=' + d + "&brand=" + b
            })
        }
    }
});

模板简介:该模板名称为【微信小程序蛋糕馆大字体列表页样式模板制作设计下载】,大小是,文档格式为.,推荐使用打开,作品中的图片,文字等数据均可修改,图片请在作品中选中图片替换即可,文字修改直接点击文字修改即可,您也可以新增或修改作品中的内容,该模板来自用户分享,如有侵权行为请联系网站客服处理。欢迎来懒人模板【小程序教程】栏目查找您需要的精美模板。

相关搜索
  • 下载密码 lanrenmb
  • 下载次数 17,834次
  • 使用软件
  • 文件格式
  • 文件大小
  • 上传时间 06-14
  • 作者 网友投稿
  • 肖像权 人物画像及字体仅供参考
栏目分类 更多 >
热门推荐 更多 >
响应式 自适应 微信模板 单页式简历模板 html5 微信文章 微信素材 微信图片 微信公众平台 企业网站
您可能会喜欢的其他模板