Browse Source

Merge branch 'develop-medou' of http://gogs.1hhd.com/1hjz-3N/1hjz-mini into develop-medou

* 'develop-medou' of http://gogs.1hhd.com/1hjz-3N/1hjz-mini:
  no message
feature/v1.1.0
lfs3 7 years ago
parent
commit
2fe05d6a60
5 changed files with 54 additions and 53 deletions
  1. 6
      pages/activity_detail/activity_detail.js
  2. 12
      pages/detail/detail.js
  3. 57
      pages/mall/mall.js
  4. 24
      pages/mall/mall.wxml
  5. 8
      pages/mall/mall.wxss

6
pages/activity_detail/activity_detail.js

@ -43,6 +43,12 @@ Page({
}, { }, {
name: '朋友圈', name: '朋友圈',
icon: '../../images/moments_ico.png' icon: '../../images/moments_ico.png'
}, {
name: '朋友圈',
icon: '../../images/moments_ico.png'
}, {
name: '朋友圈',
icon: '../../images/moments_ico.png'
}], }],
qrImageUrl: "", qrImageUrl: "",
}, },

12
pages/detail/detail.js

@ -81,20 +81,16 @@ Page({
} }
}, },
onLoad: function (options) { onLoad: function (options) {
let item = options.jsonStr;
var that = this; var that = this;
console.log(options.jsonStr);
wx.request({ wx.request({
url: app.gw.hostUrl + '/mall/web/goods/detail',
url: app.gw.hostUrl + '/mall/web/goods/detail?goodsNo=' + options.goodsNo,
method: 'get', method: 'get',
data: {
goodsNo: item
},
header: { header: {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
}, },
success: function (res) { success: function (res) {
//--init data
//--init data
console.log(res);
var data = res.data; var data = res.data;
var status = data.code; var status = data.code;
if (status != 0) { if (status != 0) {
@ -134,7 +130,7 @@ Page({
this.setData({ this.setData({
userInfo: app.globalData.userInfo, userInfo: app.globalData.userInfo,
hasUserInfo: true, hasUserInfo: true,
goodsNo: item
goodsNo: options.goodsNo
}) })
} else if (this.data.canIUse) { } else if (this.data.canIUse) {
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回

57
pages/mall/mall.js

@ -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
}) })
} }
}) })

24
pages/mall/mall.wxml

@ -2,7 +2,7 @@
<view class='top-left'> <view class='top-left'>
<picker class='address' bindchange="bindAddrChange" value="{{addrIndex1}}" range="{{addrArray.name}}"> <picker class='address' bindchange="bindAddrChange" value="{{addrIndex1}}" range="{{addrArray.name}}">
<view> <view>
<text>{{addrArray.name[addrIndex]}}</text>
<text>{{addrArray.name[addrIndex]}}</text>
</view> </view>
</picker> </picker>
</view> </view>
@ -19,7 +19,7 @@
</block> </block>
</swiper> --> </swiper> -->
<view> <view>
<image src="{{imgUrls[0]}}" class="slide-image" mode='widthFix'/>
<image src="{{imgUrls[0]}}" class="slide-image" mode='widthFix' />
</view> </view>
<!--广告栏--> <!--广告栏-->
<navigator url="../detail/detail" hover-class="other-navigator-hover"> <navigator url="../detail/detail" hover-class="other-navigator-hover">
@ -28,17 +28,15 @@
<view class="goods_limit_buy mb10"> <view class="goods_limit_buy mb10">
<view class="locatLabel_switch swiper-container5"> <view class="locatLabel_switch swiper-container5">
<view class="swiper-wrapper main_box"> <view class="swiper-wrapper main_box">
<view class="box swiper-slide" wx:for-items="{{_num == 1?items1:items2}}" wx:key="goodsNo">
<view wx:if='{{nowDate<item.endedAt}}'>
<view bindtap='loading' data-item='{{item}}'>
<image src="{{item.showImg}}" mode="widthFix"/>
<text class="p1">{{item.name}}</text>
<view class="p4">
<view class='p2'>¥</view>{{item.price/100}}
</view>
<view class="box swiper-slide" wx:for-items="{{items1}}" wx:key="goodsNo" wx:if='{{nowDate > item.endedAt }}'>
<view bindtap='loading' data-item='{{item}}'>
<image src="{{item.showImg}}" mode="widthFix" />
<text class="p1">{{item.name}}</text>
<view class="p4">
<view class='p2'>¥</view>{{item.price/100}}
</view> </view>
</view> </view>
</view>
</view>
</view> </view>
</view>
</view>
</view>
</view>

8
pages/mall/mall.wxss

@ -137,6 +137,7 @@ del{
position: relative; position: relative;
width: 90%; width: 90%;
margin: 0 auto; margin: 0 auto;
display:block;
} }
.goods_limit_buy .swiper-slide .p2{ .goods_limit_buy .swiper-slide .p2{
font-size: 32rpx; font-size: 32rpx;
@ -161,8 +162,11 @@ del{
.combo_type{position: absolute;display: inline-block;padding: 0px 10rpx;border-radius: 10rpx;font-size: 20rpx;line-height: 40rpx;margin-left: 20rpx;color: #fff;white-space: nowrap;} .combo_type{position: absolute;display: inline-block;padding: 0px 10rpx;border-radius: 10rpx;font-size: 20rpx;line-height: 40rpx;margin-left: 20rpx;color: #fff;white-space: nowrap;}
.middle_banner{margin-bottom: 8rpx;} .middle_banner{margin-bottom: 8rpx;}
.sell_out{position: absolute;width: 36%;z-index: 100;top:16rpx;right: 20rpx;height: auto;} .sell_out{position: absolute;width: 36%;z-index: 100;top:16rpx;right: 20rpx;height: auto;}
.main_box{
display: inline-block;width: 100%
.main_box {
display: flex;
width: 100%;
flex-direction: row;
flex-wrap: wrap;
} }
/*广告栏*/ /*广告栏*/
Loading…
Cancel
Save