You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
123 lines
5.0 KiB
123 lines
5.0 KiB
// pages/jz/jz.js
|
|
//获取应用实例
|
|
const app = getApp()
|
|
|
|
Page({
|
|
data: {
|
|
imgUrls: [
|
|
'/images/banner1.png'
|
|
],
|
|
indicatorDots: true,
|
|
autoplay: true,
|
|
interval: 5000,
|
|
duration: 1000,
|
|
price: '399',
|
|
img1: '/images/title-icon.png',
|
|
img2: '/images/banner2.png',
|
|
nowDate: new Date().getTime(),
|
|
cityId: 440100000,
|
|
_num: 1,
|
|
typeNum: 10,
|
|
addrArray: { id: [440100000, 430426000], name: ['广州', '深圳', '上海', '长沙', '武汉', '杭州', '北京'] },
|
|
addrIndex: 0,
|
|
items1: [
|
|
{ goodsNo: "1", merchantNo: "2", name: "5A至臻家-2次", originalPrice: 39900, price: 19900, shortDesc: "首卡体验,每个家庭一次,见证高端品质", showImg: "http://medou.oss-cn-shenzhen.aliyuncs.com/1hjz/goods/2017/09/23/thumb_59c5dd3f9d02c.png", soldNum: 2643, totalNum: 999739, type: 11, typeStr: "单月2次体验卡", serviceCount: 2, endedAt: 1596038400000 },
|
|
{ goodsNo: "2", merchantNo: "2", name: "5A至臻家-2次", originalPrice: 39900, price: 19900, shortDesc: "首卡体验,每个家庭一次,见证高端品质", showImg: "http://medou.oss-cn-shenzhen.aliyuncs.com/1hjz/goods/2017/09/23/thumb_59c5dd3f9d02c.png", soldNum: 2643, totalNum: 999739, type: 11, typeStr: "单月2次体验卡", serviceCount: 2, endedAt: 1522742277010 },
|
|
],
|
|
items2: [
|
|
{ goodsNo: "3", merchantNo: "2", name: "3A舒适家", originalPrice: 519900, price: 519900, shortDesc: "包年套餐,两周一次高端保洁服务", showImg: "http://medou.oss-cn-shenzhen.aliyuncs.com/1hjz/goods/2017/10/13/thumb_59e023b5423aa.png", soldNum: 2753, totalNum: 999739, type: 41, typeStr: "3A年卡", serviceCount: 26, endedAt: 1596038400000 },
|
|
{ goodsNo: "5", merchantNo: "2", name: "3A舒适家", originalPrice: 519900, price: 519900, shortDesc: "包年套餐,两周一次高端保洁服务", showImg: "http://medou.oss-cn-shenzhen.aliyuncs.com/1hjz/goods/2017/10/13/thumb_59e023b5423aa.png", soldNum: 2753, totalNum: 999739, type: 41, typeStr: "3A年卡", serviceCount: 26, endedAt: 1596038400000 },
|
|
],
|
|
items3: [
|
|
{ goodsNo: "6", merchantNo: "2", name: "5A至臻家-2次", originalPrice: 39900, price: 19900, shortDesc: "首卡体验,每个家庭一次,见证高端品质", showImg: "http://medou.oss-cn-shenzhen.aliyuncs.com/1hjz/goods/2017/09/23/thumb_59c5dd3f9d02c.png", soldNum: 2643, totalNum: 999739, type: 11, typeStr: "单月4次体验卡" },
|
|
{ goodsNo: "7", merchantNo: "2", name: "5A至臻家-2次", originalPrice: 39900, price: 19900, shortDesc: "首卡体验,每个家庭一次,见证高端品质", showImg: "http://medou.oss-cn-shenzhen.aliyuncs.com/1hjz/goods/2017/09/23/thumb_59c5dd3f9d02c.png", soldNum: 2643, totalNum: 999739, type: 11, typeStr: "单月4次体验卡" },
|
|
],
|
|
},
|
|
//事件处理函数
|
|
bindViewTap: function () {
|
|
wx.navigateTo({
|
|
url: '../logs/logs'
|
|
})
|
|
},
|
|
getActive: function (e) {
|
|
this.setData({
|
|
_num: e.target.dataset.num
|
|
})
|
|
},
|
|
bindAddrChange: function (e) {
|
|
this.setData({
|
|
_num: e.detail.value + 1,
|
|
addrIndex: e.detail.value
|
|
})
|
|
wx.request({
|
|
url: 'http://192.168.0.165:9999/mall/web/vgoods/list',
|
|
data: { selectedCityId: this.data.addrArray.id[e.detail.value] },
|
|
header: { "Content-Type": "application/json" },
|
|
method: 'GET',
|
|
dataType: 'json',
|
|
responseType: 'text',
|
|
success: function (res) {
|
|
console.log(res.response);
|
|
},
|
|
fail: function (res) { },
|
|
complete: function (res) { },
|
|
})
|
|
},
|
|
loading: function (e) {
|
|
|
|
let str = JSON.stringify(e.currentTarget.dataset.item);
|
|
wx.navigateTo({
|
|
url: '../detail/detail?jsonStr=' + str
|
|
})
|
|
console.log(str);
|
|
},
|
|
loadingClick: function () {
|
|
var price = event.currentTarget.dataset.price;
|
|
console.log(price);
|
|
|
|
var pages = getCurrentPages();
|
|
var currPage = pages[pages.length - 1]; //当前页面
|
|
var prevPage = pages[pages.length]; //下一个页面
|
|
|
|
//直接调用上一个页面的setData()方法,把数据存到下一个页面中去
|
|
prevPage.setData({
|
|
price: price
|
|
});
|
|
},
|
|
onLoad: function () {
|
|
if (app.globalData.userInfo) {
|
|
this.setData({
|
|
userInfo: app.globalData.userInfo,
|
|
hasUserInfo: true
|
|
})
|
|
} else if (this.data.canIUse) {
|
|
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|
// 所以此处加入 callback 以防止这种情况
|
|
app.userInfoReadyCallback = res => {
|
|
this.setData({
|
|
userInfo: res.userInfo,
|
|
hasUserInfo: true
|
|
})
|
|
}
|
|
} else {
|
|
// 在没有 open-type=getUserInfo 版本的兼容处理
|
|
wx.getUserInfo({
|
|
success: res => {
|
|
app.globalData.userInfo = res.userInfo
|
|
this.setData({
|
|
userInfo: res.userInfo,
|
|
hasUserInfo: true
|
|
})
|
|
}
|
|
})
|
|
}
|
|
},
|
|
getUserInfo: function (e) {
|
|
console.log(e)
|
|
app.globalData.userInfo = e.detail.userInfo
|
|
this.setData({
|
|
userInfo: e.detail.userInfo,
|
|
hasUserInfo: true
|
|
})
|
|
}
|
|
})
|