手机网页开发_青岛网页建设_合肥网页设计公司_哪里设计网页便宜 <div class="menu"><div class="w_1200"><img height="55px" src="images/logo_white.png" alt=""><ul><a href="home.html" class="active"><li>首页</li></a><a href="#"><li>底妆</li></a><a href="#"><li>唇妆</li></a><a href="yanzhuang.html"><li>眼妆</li></a><a href="#"><li>卸妆</li></a></ul></div>">

郑州网站制作公司

永久免费建个人网站、自助网站、永久使用、不限域名、青岛网站公司

分销网站系统?

手机网页开发_青岛网页建设_合肥网页设计公司_哪里设计网页便宜

Page({changeImage:function(){wx.navigateTo({url: '/pages/qin/qin',})},data: {//leftitem是定义左边侧边栏的选项,rightitem是定义右边商品的展示,tag主要是把商品进行一个类别的划分leftitem:[{id:1,name:"真鲜果茶"},{id:2,name:"醇香奶茶"},{id:3,name:"轻乳系列"},{id:4,name:"新鲜冰淇淋"},{id:5,name:"芝士奶盖"},{id:6,name:"原味纯茶"},{id:7,name:"美味咖啡"}],rightitem:[{id:1,name:"菠萝甜心橘",price:8,url:"../../images/caomeibobo.jpg",tag:0,},{id:1,name:"草莓啵啵",price:9,url:"../../images/molilvcha.jpg",tag:0},{id:1,name:"柠檬绿茶",price:5,url:"../../images/ningmenglvcha.jpg",tag:0},{id:2,name:"芋圆奶茶",price:8,url:"../../images/yuanweibingqiling.jpg",tag:1},{id:2,name:"布丁奶茶",price:7,url:"../../images/zhishilvcha.jpg",tag:1},{id:3,name:"草莓椰奶露",price:7,url:"../../images/zhishisijic.jpg",tag:2},],count:0,//我们把前端的index值传到js中,并把它赋值给count,储存在js中,方便右边商品通过count完成与侧边栏的相同的那一类的商品展示,同时完成侧边栏的样式,保证选中的选项有与其他未选择的选项的区别},click_nav_right(event){//这个主要是完成商品分类页的数据传递到商品详情页var data_one=event.currentTarget.dataset.index_two//前端的右边商品定义了一个index_two这个变量,我们在js中把这个值赋值给data变量,并传递到商品详情页//console.log(data_one)wx.navigateTo({//通过这个函数,完成两个页面中数据的传递,具体的用法可以到微信的小程序文档中搜索,当然除了用这个函数,也可以通过引用全局变量的方式完成数据的传递url: '/pages/detail/detail?data='+data_one,})},switchRightTab(event){this.setData({count:event.target.dataset.index});//改变count原本的值,完成右侧商品的根据侧边栏的不同展示商品},/*** 生命周期函数--监听页面加载*/onLoad: function (options) {var that = this;var sysinfo = wx.getSystemInfoSync().windowHeight;console.log(sysinfo)wx.showLoading({title: '努力加载中',})//将本来的后台换成了easy-mock 的接口,所有数据一次请求完 略大。。wx.request({url: 'https://easy-mock.com/mock/59abab95e0dc66334199cc5f/coco/aa',method: 'GET',data: {},header: {'Accept': 'application/json'},success: function (res) {wx.hideLoading();console.log(res)that.setData({listData: res.data,loading: true})}})},selectMenu: function (e) {var index = e.currentTarget.dataset.indexconsole.log(index)this.setData({activeIndex: index,toView: 'a' + index,// scrollTop: 1186})console.log(this.data.toView);},scroll: function (e) {console.log(e)var dis = e.detail.scrollTopif (dis > 0 && dis < 1189) {this.setData({activeIndex: 0,})}if (dis > 1189 && dis < 1867) {this.setData({activeIndex: 1,})}if (dis > 1867 && dis < 2180) {this.setData({activeIndex: 2,})}if (dis > 2180 && dis < 2785) {this.setData({activeIndex: 3,})}if (dis > 2785 && dis < 2879) {this.setData({activeIndex: 4,})}if (dis > 2879 && dis < 4287) {this.setData({activeIndex: 5,})}if (dis > 4287 && dis < 4454) {this.setData({activeIndex: 6,})}if (dis > 4454 && dis < 4986) {this.setData({activeIndex: 7,})}if (dis > 4986) {this.setData({activeIndex: 8,})}},/*** 生命周期函数--监听页面初次渲染完成*/selectInfo: function (e) {var type = e.currentTarget.dataset.type;var index = e.currentTarget.dataset.index;this.setData({showModalStatus: !this.data.showModalStatus,currentType: type,currentIndex: index,sizeIndex: 0,sugarIndex: 0,temIndex: 0});},chooseSE: function (e) {var index = e.currentTarget.dataset.index;var type = e.currentTarget.dataset.type;if (type == 0) {this.setData({sizeIndex: index});}if (type == 1) {this.setData({sugarIndex: index});}if (type == 2) {this.setData({temIndex: index});}},addToCart: function () {var a = this.datavar addItem = {"name": a.listData[a.currentType].foods[a.currentIndex].name,"price": a.listData[a.currentType].foods[a.currentIndex].specfoods[0].price,"detail": a.size[a.sizeIndex] + "+" + a.sugar[a.sugarIndex] + "+" + a.tem[a.temIndex],"number": 1,"sum": a.listData[a.currentType].foods[a.currentIndex].specfoods[0].price,}var sumMonney = a.sumMonney + a.listData[a.currentType].foods[a.currentIndex].specfoods[0].price;var cartList = this.data.cartList;cartList.push(addItem);this.setData({cartList: cartList,showModalStatus: false,sumMonney: sumMonney,cupNumber: a.cupNumber + 1});console.log(this.data.cartList)},showCartList: function () {console.log(this.data.showCart)if (this.data.cartList.length != 0) {this.setData({showCart: !this.data.showCart,});}},clearCartList: function () {this.setData({cartList: [],showCart: false,sumMonney: 0});},addNumber: function (e) {var index = e.currentTarget.dataset.index;console.log(index)var cartList = this.data.cartList;cartList[index].number++;var sum = this.data.sumMonney + cartList[index].price;cartList[index].sum += cartList[index].price;this.setData({cartList: cartList,sumMonney: sum,cupNumber: this.data.cupNumber+1});},decNumber: function (e) {var index = e.currentTarget.dataset.index;console.log(index)var cartList = this.data.cartList;var sum = this.data.sumMonney - cartList[index].price;cartList[index].sum -= cartList[index].price;cartList[index].number == 1 ? cartList.splice(index, 1) : cartList[index].number--;this.setData({cartList: cartList,sumMonney: sum,showCart: cartList.length == 0 ? false : true,cupNumber: this.data.cupNumber-1});},goBalance: function () {if (this.data.sumMonney != 0) {wx.setStorageSync('cartList', this.data.cartList);wx.setStorageSync('sumMonney', this.data.sumMonney);wx.setStorageSync('cupNumber', this.data.cupNumber);wx.navigateTo({url: '../order/balance/balance'})}},onReady: function () {},/*** 生命周期函数--监听页面显示*/onShow: function () {},/*** 生命周期函数--监听页面隐藏*/onHide: function () {},/*** 生命周期函数--监听页面卸载*/onUnload: function () {},/*** 页面相关事件处理函数--监听用户下拉动作*/onPullDownRefresh: function () {},/*** 页面上拉触底事件的处理函数*/onReachBottom: function () {},/*** 用户点击右上角分享*/onShareAppMessage: function () {} 兰州seo优化网站套餐惠州seo优化电商网站开发龙岗seo培训长沙seo顾问襄阳seo上海seo优化公司萧山网站制作公司企业类网站网站摸板站长交流seo外贸推广杭州seo深圳网站优化排名外包网络推广公司长沙网络营销公司怎样制作网站上海seo顾问西安seo公司武汉seo优化seo优化公司整站模板浙江seo徐州网站优化小程序定制公司湖州网站推广广州seo优化手机凡客网惠州seo优化免费多用户商城系统

猜你喜欢