// pages/personorder/personorder.js const app = getApp() Page({ /** * 页面的初始数据 */ data: { activeTab: 0, orderHeight: 0, tabs:[] }, /** * 生命周期函数--监听页面加载 */ onLoad: async function () { console.log(this) const isAuth = await app.isAuth() if (!isAuth){ wx.redirectTo({ url: '/pages/prompt/prompt?page='+this.route, }) } var tabs = await this.getOrderList(); this.setData({ tabs }); this.getOrderHeight() }, //动态生成产品的父盒子高度 getOrderHeight: function () { var h = wx.getSystemInfoSync().windowHeight * (750 / wx.getSystemInfoSync().windowWidth); var orderHeight = h - 95; this.setData({ orderHeight }) }, getOrderList: async function () { const self = this var titles = ["全部", "代消费", "待评价", "已完成"]; const tabs = []; // 订单的三个状态,0是未付款,是未完成订单,1是未评价,待评价订单,2是已评价的完成订单 var list = [{ id: "1", orderId: "20200625118", orderStatus:1, title: "中式古法推拿", price: "1299", orderTime: "8-26 16:26", shopAddress: "上海市普陀区中江路3600号", distance: ">6km", imgurl: "../../images/order-img01.jpg" }, { id: "2", orderId: "20200625118", orderStatus:0, title: "中式古法推拿", price: "1299", orderTime: "8-26 16:26", shopAddress: "上海市普陀区中江路3600号", distance: ">6km", imgurl: "../../images/order-img02.jpg" }, { id: "3", orderId: "20200625118", orderStatus:2, title: "中式古法推拿", price: "1299", orderTime: "8-26 16:26", shopAddress: "上海市普陀区中江路3600号", distance: ">6km", imgurl: "../../images/order-img01.jpg" }, { id: "4", orderId: "20200625118", orderStatus:1, title: "中式古法推拿", price: "1299", orderTime: "8-26 16:26", shopAddress: "上海市普陀区中江路3600号", distance: ">6km", imgurl: "../../images/order-img02.jpg" } ]; for (let i = 0; i < titles.length; i++) { let title = titles[i]; tabs.push({ title, list }) } tabs[2].list = [{ id: "1", orderId: "20200625118", title: "中式古法推拿", price: "1299", orderTime: "8-26 16:26", shopAddress: "上海市普陀区中江路3600号", distance: ">6km", imgurl: "../../images/order-img02.jpg" }]; return tabs; }, onTabClick(e) { const index = e.detail.index this.setData({ activeTab: index }) }, onChange(e) { const index = e.detail.index this.setData({ activeTab: index }) }, handleClick(e) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, gotoComment:function (e) { wx.navigateTo({ url: '../commentinfo/commentinfo', }) } })