// pages/info/groupOrderInfo/index.js import commonApi from "../../../utils/https/common" Page({ /** * 页面的初始数据 */ data: { info:null, keywords:"", id:null, img:null }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData({ id:options.id }) }, edit:function(e){ let item = e.currentTarget.dataset.item wx.navigateTo({ url: '/pages/order/joinOrder/index?id='+item.team_id+'&mid='+item.id+'&oid='+this.data.id }) }, delItem:function(e){ // 删除团员 let item = e.currentTarget.dataset.item,index = e.currentTarget.dataset.index,info = this.data.info,that = this wx.showModal({ title:"提示", content:"确定删除该团员吗?", success:function(res){ if(res.confirm){ commonApi.user_post("team_order/del",{ team_id:item.team_id, member_id:item.id }).then(res=>{ if(res.code==1){ wx.showToast({ title: '删除成功', icon:'success' }) info.list.members.splice(index,1) that.setData({ info:info }) } }) } } }) }, changeKeywords:function(e){ this.setData({ keywords:e.detail.value }) }, search:function(e){ commonApi.user_post("team_order/get_team_detail",{ order_id:this.data.id, name:this.data.keywords }).then(res=>{ if(res.code==1){ this.setData({ info:res.data }) } }) }, order:function(){ commonApi.user_post("team_order/create",{ team_id:this.data.info.list.id }).then(res=>{ if(res.code==1){ // todo wx.navigateTo({ url: '/pages/user/order/groupOrderInfo/index?id=', }) } }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { commonApi.user_post("team_order/get_team_detail",{ order_id:this.data.id }).then(res=>{ if(res.code==1){ this.setData({ info:res.data }) commonApi._post("scene/detail_for_venue",{ id:res.data.list.scene_id }).then(res=>{ this.setData({ img:res.data.headimg }) this.onShareAppMessage() }) } }) }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { if(this.data.info){ return { title:"加入我的旅游团", path:"/pages/order/joinOrder/index?id="+this.data.info.list.id+'&uid='+this.data.info.list.user_id+'&oid='+this.data.id, imageUrl:this.data.img } } } })