|
|
@ -20,57 +20,49 @@ Page({ |
|
|
typeNum: 10, |
|
|
typeNum: 10, |
|
|
addrArray: { id: [440100000, 430426000], name: ['广州', '深圳', '上海', '长沙', '武汉', '杭州', '北京'] }, |
|
|
addrArray: { id: [440100000, 430426000], name: ['广州', '深圳', '上海', '长沙', '武汉', '杭州', '北京'] }, |
|
|
addrIndex: 0, |
|
|
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' |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
items1: [], |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
getActive: function (e) { |
|
|
getActive: function (e) { |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
_num: e.target.dataset.num |
|
|
_num: e.target.dataset.num |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
bindAddrChange: function (e) { |
|
|
bindAddrChange: function (e) { |
|
|
this.setData({ |
|
|
|
|
|
_num: e.detail.value + 1, |
|
|
|
|
|
addrIndex: e.detail.value |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
if (e != undefined && e.detail != undefined) { |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
_num: e.detail == undefined ? 1 : e.detail.value + 1, |
|
|
|
|
|
addrIndex: e.detail == undefined ? 0 : e.detail.value, |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
var that = this; |
|
|
wx.request({ |
|
|
wx.request({ |
|
|
url: 'http://192.168.0.165:9999/mall/web/vgoods/list', |
|
|
|
|
|
data: { selectedCityId: this.data.addrArray.id[e.detail.value] }, |
|
|
|
|
|
|
|
|
url: getApp().gw.hostUrl + '/mall/web/goods/list', |
|
|
|
|
|
data: { selectedCityId: that.data.addrIndex }, |
|
|
header: { "Content-Type": "application/json" }, |
|
|
header: { "Content-Type": "application/json" }, |
|
|
method: 'GET', |
|
|
method: 'GET', |
|
|
dataType: 'json', |
|
|
dataType: 'json', |
|
|
responseType: 'text', |
|
|
responseType: 'text', |
|
|
success: function (res) { |
|
|
success: function (res) { |
|
|
console.log(res.response); |
|
|
|
|
|
|
|
|
if (res.data.code == 0 && res.data.response.goodsList.length > 0) { |
|
|
|
|
|
that.setData({ |
|
|
|
|
|
items1: res.data.response.goodsList, |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
fail: function (res) { }, |
|
|
fail: function (res) { }, |
|
|
complete: function (res) { }, |
|
|
complete: function (res) { }, |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
loading: function (e) { |
|
|
|
|
|
|
|
|
|
|
|
let str = JSON.stringify(e.currentTarget.dataset.item); |
|
|
|
|
|
|
|
|
loading: function (e) { |
|
|
|
|
|
console.log("detail>>" + e.currentTarget.dataset.item.goodsNo); |
|
|
wx.navigateTo({ |
|
|
wx.navigateTo({ |
|
|
url: '../detail/detail?jsonStr=' + str |
|
|
|
|
|
|
|
|
url: '../detail/detail?goodsNo=' + e.currentTarget.dataset.item.goodsNo |
|
|
}) |
|
|
}) |
|
|
console.log(str); |
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
loadingClick: function () { |
|
|
loadingClick: function () { |
|
|
var price = event.currentTarget.dataset.price; |
|
|
var price = event.currentTarget.dataset.price; |
|
|
console.log(price); |
|
|
console.log(price); |
|
|
@ -84,12 +76,14 @@ Page({ |
|
|
price: price |
|
|
price: price |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
onLoad: function () { |
|
|
onLoad: function () { |
|
|
if (app.globalData.userInfo) { |
|
|
if (app.globalData.userInfo) { |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
userInfo: app.globalData.userInfo, |
|
|
userInfo: app.globalData.userInfo, |
|
|
hasUserInfo: true |
|
|
hasUserInfo: true |
|
|
}) |
|
|
}) |
|
|
|
|
|
this.bindAddrChange(); |
|
|
} else if (this.data.canIUse) { |
|
|
} else if (this.data.canIUse) { |
|
|
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|
|
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
|
|
// 所以此处加入 callback 以防止这种情况
|
|
|
// 所以此处加入 callback 以防止这种情况
|
|
|
@ -98,6 +92,7 @@ Page({ |
|
|
userInfo: res.userInfo, |
|
|
userInfo: res.userInfo, |
|
|
hasUserInfo: true |
|
|
hasUserInfo: true |
|
|
}) |
|
|
}) |
|
|
|
|
|
this.bindAddrChange(); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
// 在没有 open-type=getUserInfo 版本的兼容处理
|
|
|
// 在没有 open-type=getUserInfo 版本的兼容处理
|
|
|
@ -108,16 +103,18 @@ Page({ |
|
|
userInfo: res.userInfo, |
|
|
userInfo: res.userInfo, |
|
|
hasUserInfo: true |
|
|
hasUserInfo: true |
|
|
}) |
|
|
}) |
|
|
|
|
|
this.bindAddrChange(); |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
getUserInfo: function (e) { |
|
|
getUserInfo: function (e) { |
|
|
console.log(e) |
|
|
|
|
|
app.globalData.userInfo = e.detail.userInfo |
|
|
app.globalData.userInfo = e.detail.userInfo |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
userInfo: e.detail.userInfo, |
|
|
userInfo: e.detail.userInfo, |
|
|
hasUserInfo: true |
|
|
hasUserInfo: true |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}) |
|
|
}) |