250 lines
6.9 KiB
JavaScript
250 lines
6.9 KiB
JavaScript
//获取应用实例
|
||
var app = getApp();
|
||
Page({
|
||
|
||
/**
|
||
* 页面的初始数据
|
||
*/
|
||
data: {
|
||
resp:{
|
||
"erro": 0,
|
||
"msg": "查询成功",
|
||
"special_offer": [
|
||
{
|
||
"goods_name": "贺xx(男) 陪诊员",
|
||
"id": "3c1cbcfdc0759b8956d8a2e0cc5bb19e",
|
||
"index_img": "https://www.zoowoo.net/uploadnv/2022/02/14/164482701755126.jpg",
|
||
"mechanism_name": "年龄:28岁 经验:2年",
|
||
"original_price": "简介:xxxxxxxxxxx",
|
||
"price": "100.00"
|
||
},
|
||
{
|
||
"goods_name": "贺xx(男) 陪诊员",
|
||
"id": "3c1cbcfdc0759b8956d8a2e0cc5bb19e",
|
||
"index_img": "https://www.zoowoo.net/uploadnv/2022/02/14/164482701755126.jpg",
|
||
"mechanism_name": "年龄:28岁 经验:2年",
|
||
"original_price": "简介:xxxxxxxxxxx",
|
||
"price": "100.00"
|
||
},
|
||
{
|
||
"goods_name": "贺xx(男) 陪诊员",
|
||
"id": "3c1cbcfdc0759b8956d8a2e0cc5bb19e",
|
||
"index_img": "https://www.zoowoo.net/uploadnv/2022/02/14/164482701755126.jpg",
|
||
"mechanism_name": "年龄:28岁 经验:2年",
|
||
"original_price": "简介:xxxxxxxxxxx",
|
||
"price": "180.00"
|
||
}
|
||
],
|
||
|
||
},
|
||
order_list:[],
|
||
navHeight: '',
|
||
menuButtonInfo: {},
|
||
searchMarginTop: 0, // 搜索框上边距
|
||
searchWidth: 0, // 搜索框宽度
|
||
searchHeight: 0 ,// 搜索框高度
|
||
type:''
|
||
},
|
||
back(){
|
||
wx.navigateBack()
|
||
},
|
||
/**
|
||
* 生命周期函数--监听页面加载
|
||
*/
|
||
onLoad: function (options) {
|
||
this.setData({
|
||
type:options.type
|
||
})
|
||
if(options.type==1){
|
||
wx.setNavigationBarTitle({
|
||
title: '我的关注'
|
||
})
|
||
this.getCollection();
|
||
}
|
||
if(options.type==2){
|
||
wx.setNavigationBarTitle({
|
||
title: '我的拼团'
|
||
})
|
||
this.getCollage()
|
||
}
|
||
if(options.type==3){
|
||
wx.setNavigationBarTitle({
|
||
title: '我的砍价'
|
||
})
|
||
}
|
||
|
||
this.setData({
|
||
menuButtonInfo: wx.getMenuButtonBoundingClientRect()
|
||
})
|
||
console.log(this.data.menuButtonInfo)
|
||
const { top, width, height, right } = this.data.menuButtonInfo
|
||
wx.getSystemInfo({
|
||
success: (res) => {
|
||
const { statusBarHeight } = res
|
||
const margin = top - statusBarHeight
|
||
this.setData({
|
||
navHeight: (height + statusBarHeight + (margin * 2) + 15),
|
||
searchMarginTop: statusBarHeight + margin, // 状态栏 + 胶囊按钮边距
|
||
searchHeight: height, // 与胶囊按钮同高
|
||
searchWidth: right - width // 胶囊按钮右边坐标 - 胶囊按钮宽度 = 按钮左边可使用宽度
|
||
})
|
||
},
|
||
})
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面初次渲染完成
|
||
*/
|
||
onReady: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面显示
|
||
*/
|
||
onShow: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面隐藏
|
||
*/
|
||
onHide: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面卸载
|
||
*/
|
||
onUnload: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 页面相关事件处理函数--监听用户下拉动作
|
||
*/
|
||
onPullDownRefresh: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 页面上拉触底事件的处理函数
|
||
*/
|
||
onReachBottom: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 用户点击右上角分享
|
||
*/
|
||
onShareAppMessage: function () {
|
||
|
||
},
|
||
// 跳转详情
|
||
activity(e){
|
||
|
||
if (e.currentTarget.dataset.id != 0) {
|
||
console.log("你选择的课程id是"+e.currentTarget.dataset.id);
|
||
if(this.data.type==1){
|
||
wx.navigateTo({
|
||
url: "/shopping/pages/goddess/goddess?id=" + e.currentTarget.dataset.id,
|
||
});
|
||
}
|
||
if(this.data.type==2){
|
||
wx.navigateTo({
|
||
url: '/pages/myshoucang/myorderdetail?'+"type="+'2'+ '&id=' +e.currentTarget.dataset.id,
|
||
});
|
||
}
|
||
}
|
||
|
||
},
|
||
//商品列表
|
||
// getGoodsList: function () {
|
||
// var that = this;
|
||
// wx.request({
|
||
// url: app.buildUrl("/app/Goddesswechat/getGoodsList"),
|
||
// header: app.getRequestHeader(),
|
||
// method:'POST',
|
||
// data: {
|
||
// version_number: this.data.version_number,
|
||
// uid:wx.getStorageSync('uid'),
|
||
// token:wx.getStorageSync('token'),
|
||
// page:'1',
|
||
// page_size:10,
|
||
// city:'',
|
||
// style_id:'',
|
||
// mechanism_id:'',
|
||
// serach_name:'',
|
||
// px_type:'',
|
||
// lng:'',
|
||
// lat:''
|
||
// },
|
||
// success: function (res) {
|
||
// var resp = res.data;
|
||
// console.log(resp+"=================dddddddddddddddddddddddddddddddddddddddddddd")
|
||
// console.log(resp.erro+"=================dddddddddddddddddddddddddddddddddddddddddddd")
|
||
// if(resp.erro==0){
|
||
// that.setData({
|
||
// order_list:resp.lists
|
||
|
||
// });
|
||
// }
|
||
// }
|
||
// });
|
||
// },
|
||
/**
|
||
* 我的拼团
|
||
*/
|
||
getCollage: function () {
|
||
var that = this;
|
||
wx.request({
|
||
url: app.buildUrl("/app/Goddesswechat/getCollage"),
|
||
header: app.getRequestHeader(),
|
||
method:'POST',
|
||
data: {
|
||
version_number: this.data.version_number,
|
||
uid:wx.getStorageSync('uid'),
|
||
token:wx.getStorageSync('token'),
|
||
},
|
||
success: function (res) {
|
||
var resp = res.data;
|
||
if(resp.erro==0){
|
||
that.setData({
|
||
order_list:resp.lists
|
||
|
||
});
|
||
}
|
||
}
|
||
});
|
||
},
|
||
//我的收藏
|
||
getCollection: function () {
|
||
var that = this;
|
||
//假数据
|
||
if(this.data.resp.erro==0){
|
||
that.setData({
|
||
order_list:this.data.resp.special_offer
|
||
|
||
});
|
||
}
|
||
wx.request({
|
||
url: app.buildUrl("/app/Goddesswechat/getCollection"),
|
||
header: app.getRequestHeader(),
|
||
method:'POST',
|
||
data: {
|
||
version_number: this.data.version_number,
|
||
uid:wx.getStorageSync('uid'),
|
||
token:wx.getStorageSync('token'),
|
||
},
|
||
success: function (res) {
|
||
var resp = res.data;
|
||
if(resp.erro==0){
|
||
that.setData({
|
||
order_list:resp.lists
|
||
|
||
});
|
||
}
|
||
}
|
||
});
|
||
},
|
||
}) |