161 lines
3.9 KiB
JavaScript
161 lines
3.9 KiB
JavaScript
const baseUrl = getApp();
|
|
const api = require('../../config/api.js');
|
|
const util = require('../../config/util.js');
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
listdata:[
|
|
{
|
|
goodsid:1,
|
|
goodsimgurl:'https://ndnd.duiduiedu.com/uploads/pics/192187.png',
|
|
goodsname:'商品名称测试完成',
|
|
goodsintro:'这个商品的确不错哦',
|
|
goodsmoney:888,
|
|
goodsmoneyintro:'还要现金666元'
|
|
},
|
|
{
|
|
goodsid:1,
|
|
goodsimgurl:'https://ndnd.duiduiedu.com/uploads/pics/192187.png',
|
|
goodsname:'商品名称测试完成',
|
|
goodsintro:'这个商品的确不错哦',
|
|
goodsmoney:888,
|
|
goodsmoneyintro:'还要现金666元'
|
|
}, {
|
|
goodsid:1,
|
|
goodsimgurl:'https://ndnd.duiduiedu.com/uploads/pics/192187.png',
|
|
goodsname:'商品名称测试完成',
|
|
goodsintro:'这个商品的确不错哦',
|
|
goodsmoney:888,
|
|
goodsmoneyintro:'还要现金666元'
|
|
}, {
|
|
goodsid:1,
|
|
goodsimgurl:'https://ndnd.duiduiedu.com/uploads/pics/192187.png',
|
|
goodsname:'商品名称测试完成',
|
|
goodsintro:'这个商品的确不错哦',
|
|
goodsmoney:888,
|
|
goodsmoneyintro:'还要现金666元'
|
|
}, {
|
|
goodsid:1,
|
|
goodsimgurl:'https://ndnd.duiduiedu.com/uploads/pics/192187.png',
|
|
goodsname:'商品名称测试完成',
|
|
goodsintro:'这个商品的确不错哦',
|
|
goodsmoney:888,
|
|
goodsmoneyintro:'还要现金666元'
|
|
},
|
|
{
|
|
goodsid:1,
|
|
goodsimgurl:'https://ndnd.duiduiedu.com/uploads/pics/192187.png',
|
|
goodsname:'商品名称测试完成',
|
|
goodsintro:'这个商品的确不错哦',
|
|
goodsmoney:888,
|
|
goodsmoneyintro:'还要现金666元'
|
|
},
|
|
{
|
|
goodsid:1,
|
|
goodsimgurl:'https://ndnd.duiduiedu.com/uploads/pics/192187.png',
|
|
goodsname:'商品名称测试完成',
|
|
goodsintro:'这个商品的确不错哦',
|
|
goodsmoney:888,
|
|
goodsmoneyintro:'还要现金666元'
|
|
},
|
|
{
|
|
goodsid:1,
|
|
goodsimgurl:'https://ndnd.duiduiedu.com/uploads/pics/192187.png',
|
|
goodsname:'商品名称测试完成',
|
|
goodsintro:'这个商品的确不错哦',
|
|
goodsmoney:888,
|
|
goodsmoneyintro:'还要现金666元'
|
|
}
|
|
],
|
|
userinfo:[]
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
|
|
baseUrl.islogin();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
this.loaddata();
|
|
},
|
|
loaddata:function(params) {
|
|
//加载数据
|
|
let url = baseUrl.globalData.baseUrl + '/user/getuserinfobyopenid';
|
|
var param = {
|
|
id: baseUrl.globalData.currentuserinfo.id
|
|
};
|
|
//此处为使用封装的post请求
|
|
util.post(url, param).then((res) => {
|
|
// console.log(res);
|
|
this.setData({
|
|
userinfo: res.data
|
|
});
|
|
|
|
}).catch((errMsg) => {
|
|
console.log(errMsg);
|
|
});
|
|
},
|
|
myodersclick:function(params) {
|
|
wx.navigateTo({
|
|
url: '/pages/myorder/myorder',
|
|
})
|
|
},
|
|
goodinfoclick:function(params) {
|
|
console.log(params);
|
|
wx.navigateTo({
|
|
url: '/pages/goodsinfo/goodsinfo?id='
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
}
|
|
}) |