After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 552 B |
After Width: | Height: | Size: 806 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 605 B |
After Width: | Height: | Size: 8.6 KiB |
@ -0,0 +1,170 @@ |
|||
// pages/chooseArea/chooseArea.js
|
|||
var app = getApp(); |
|||
var WXAPI = require('../../utils/server.js'); |
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
searchKey: '', |
|||
city_list: {}, |
|||
area_list: [], |
|||
choose_area: [], |
|||
seeAreaFlag: false, |
|||
filterKey: '', |
|||
level: 0, |
|||
region: '', |
|||
GroupID: '', |
|||
titleKey: 'A', |
|||
scrollKey: 'A', |
|||
}, |
|||
getLocation(groupID) { |
|||
var that = this; |
|||
WXAPI.getLocation({ |
|||
accessId: app.globalData.accessId, |
|||
GroupID: groupID |
|||
}).then(res => { |
|||
if (res.code == 200) { |
|||
var data = res.data |
|||
that.setData({ |
|||
city_list: data.list, |
|||
area_list: data.xian, |
|||
}) |
|||
} |
|||
}); |
|||
}, |
|||
seeAreaClick(){ |
|||
var that = this; |
|||
that.setData({ |
|||
seeAreaFlag: !that.data.seeAreaFlag |
|||
}) |
|||
}, |
|||
searchInput: function(e) { |
|||
this.setData({ |
|||
searchKey: e.detail.value |
|||
}) |
|||
}, |
|||
cleardata() { |
|||
console.log('1111') |
|||
this.setData({ |
|||
searchKey: '' |
|||
}) |
|||
}, |
|||
search() { |
|||
var that = this; |
|||
var result_list = [] |
|||
var city_list = that.data.city_list |
|||
for (var i = 0; i < city_list.length; i++) { |
|||
city_list[i].filter(item=>{ |
|||
if(item.G_CName.includes(that.data.searchKey)) { |
|||
result_list.push(item) |
|||
} |
|||
}) |
|||
} |
|||
that.setData({ |
|||
filterKey: that.data.searchKey, |
|||
city_list: result_list |
|||
}) |
|||
}, |
|||
changeTitle(e){ |
|||
var that = this; |
|||
that.setData({ |
|||
titleKey: e.currentTarget.dataset.key, |
|||
scrollKey: e.currentTarget.dataset.key, |
|||
}) |
|||
}, |
|||
clickArea(e){ |
|||
var that = this; |
|||
var data = e.currentTarget.dataset |
|||
// var choose_area = []
|
|||
// that.setData({
|
|||
// choose_area: choose_area.splice(0,1,data.item),
|
|||
// GroupID: data.item.GroupID
|
|||
// })
|
|||
// that.data.choose_area = choose_area.splice(0,1,data.item)
|
|||
var region = { |
|||
city: data.item.G_CName, |
|||
city_GroupID: data.item.GroupID, |
|||
// district: that.data.choose_area[1].G_CName,
|
|||
// district_GroupID: that.data.choose_area[1].GroupID,
|
|||
} |
|||
wx.setStorageSync('region',region) |
|||
// that.getLocation(that.data.choose_area[1].GroupID)
|
|||
wx.navigateBack() |
|||
}, |
|||
contentScroll(e){ |
|||
var offset = e.detail.scrollTop; |
|||
var lineHeight; |
|||
var that = this; |
|||
var cityarr = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'W', 'X', 'Y', 'Z'] |
|||
var city_list = that.data.city_list |
|||
// for (var i in cityarr) {
|
|||
// lineHeight = city_list[cityarr[i]].length*40;
|
|||
// }
|
|||
var index = parseInt(offset / 660); |
|||
that.setData({ |
|||
titleKey: cityarr[index] |
|||
}) |
|||
}, |
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad(options) { |
|||
var that = this; |
|||
var region = wx.getStorageSync('region') |
|||
that.setData({ |
|||
region: region, |
|||
}) |
|||
that.getLocation(region.city_GroupID) |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage() { |
|||
|
|||
} |
|||
}) |
@ -0,0 +1,4 @@ |
|||
{ |
|||
"usingComponents": {}, |
|||
"navigationBarTitleText": "选择地区" |
|||
} |
@ -0,0 +1,46 @@ |
|||
<!--pages/chooseArea/chooseArea.wxml--> |
|||
<view class="container"> |
|||
<view class="topBox"> |
|||
<view class="searchBox"> |
|||
<view class="searchBox_left"> |
|||
<image class='searchImg' src="/images/icon-search.png"></image> |
|||
<input type="text" value="{{searchKey}}" placeholder="请输入城市名称" bindinput="searchInput"/> |
|||
<view wx:if="{{searchKey}}" bindtap="cleardata"> |
|||
<image class="cancel" src="/images/delete.png" mode=""></image> |
|||
</view> |
|||
</view> |
|||
<view class="searchBox_btn" bindtap="search">搜索</view> |
|||
</view> |
|||
|
|||
<view class="area"> |
|||
<view class="area_left"> |
|||
<text>当前位置:</text> |
|||
<view class="area_left_item" wx:if="{{choose_area.length>0}}"> |
|||
<text wx:for="{{choose_area}}" wx:key="index">{{item.G_CName}}</text> |
|||
</view> |
|||
<view wx:else>{{region.city}}</view> |
|||
</view> |
|||
|
|||
<view class="area_right" bindtap="seeAreaClick"> |
|||
<text>切换区县</text> |
|||
<image src="/images/xjt.png"></image> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="areaItemBox" wx:if="{{seeAreaFlag}}"> |
|||
<view class="areaItem" wx:for="{{area_list}}" wx:key="index" data-item="{{item}}" bindtap="clickArea">{{item.G_CName}}</view> |
|||
</view> |
|||
</view> |
|||
<scroll-view class="content" scroll-y="true" bindscroll="contentScroll" scroll-into-view="{{scrollKey}}" scroll-with-animation="true"> |
|||
<view class="list-table" wx:for="{{city_list}}" id="{{index}}" wx:key="index"> |
|||
<view class="listTitle" wx:if="{{!filterKey}}">{{index}}</view> |
|||
<view wx:for="{{city_list[index]}}" wx:key="index"> |
|||
<view class="list" wx:if="{{!item.G_CName.includes(filterKey)}}" wx:key="index" data-item="{{item}}" bindtap="clickArea">{{item.G_CName}}</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="listRight" wx:if="{{!filterKey}}"> |
|||
<view wx:for="{{city_list}}" wx:key="key" class="{{index == titleKey?'active': ''}}" data-key="{{index}}" bindtap="changeTitle">{{index}}</view> |
|||
</view> |
|||
</scroll-view> |
|||
</view> |
@ -0,0 +1,153 @@ |
|||
/* pages/chooseArea/chooseArea.wxss */ |
|||
.container{ |
|||
display: flex; |
|||
flex-direction: column; |
|||
height: 100vh; |
|||
overflow: hidden; |
|||
} |
|||
.searchBox{ |
|||
display: flex; |
|||
width: 100%; |
|||
padding: 6rpx 0 17rpx 30rpx; |
|||
box-sizing: border-box; |
|||
background-color: #fff; |
|||
} |
|||
.searchBox_btn{ |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
height: 68rpx; |
|||
padding: 0 30rpx 0 20rpx; |
|||
font-size: 28rpx; |
|||
} |
|||
.searchBox .searchBox_left { |
|||
position: relative; |
|||
flex: 1; |
|||
display: flex; |
|||
align-items: center; |
|||
height: 68rpx; |
|||
border-radius: 40rpx; |
|||
padding-left: 69rpx; |
|||
box-sizing: border-box; |
|||
background-color: #F4F5F6; |
|||
} |
|||
.searchBox_left image{ |
|||
position: absolute; |
|||
top: 50%; |
|||
transform: translateY(-50%); |
|||
left: 20rpx; |
|||
width: 30rpx; |
|||
height: 30rpx; |
|||
} |
|||
.searchBox_left .cancel{ |
|||
width: 35rpx; |
|||
height: 35rpx; |
|||
left: 570rpx; |
|||
z-index: 10; |
|||
} |
|||
|
|||
.searchBox_left input{ |
|||
width: 100%; |
|||
font-size: 28rpx; |
|||
color: #020202; |
|||
} |
|||
|
|||
.area{ |
|||
display: flex; |
|||
align-items: center; |
|||
height: 84rpx; |
|||
padding: 0 30rpx; |
|||
font-size: 28rpx; |
|||
} |
|||
.area_left{ |
|||
display: flex; |
|||
align-items: center; |
|||
} |
|||
.area_left_item{ |
|||
max-width: 370rpx; |
|||
white-space: nowrap; |
|||
overflow: hidden; |
|||
text-overflow: ellipsis; |
|||
} |
|||
.area_right{ |
|||
display: flex; |
|||
align-items: center; |
|||
margin-left: auto; |
|||
} |
|||
.area_right text{ |
|||
font-size: 26rpx; |
|||
color: #666666; |
|||
} |
|||
.area_right image{ |
|||
width: 20rpx; |
|||
height: 12rpx; |
|||
margin-left: 10rpx; |
|||
} |
|||
.areaItemBox{ |
|||
display: flex; |
|||
flex-wrap: wrap; |
|||
padding: 12rpx 0 0 30rpx; |
|||
max-height: 450rpx; |
|||
overflow-y: auto; |
|||
} |
|||
.areaItemBox .areaItem{ |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
min-width: 210rpx; |
|||
padding: 0 20rpx; |
|||
height: 80rpx; |
|||
background: #FFFFFF; |
|||
border: 1px solid #E6E6E6; |
|||
border-radius: 4rpx; |
|||
box-sizing: border-box; |
|||
margin-right: 30rpx; |
|||
margin-bottom: 30rpx; |
|||
font-size: 28rpx; |
|||
color: #0F0F1C; |
|||
} |
|||
.areaItemBox .areaItem.active{ |
|||
background-color: #F4F4F4; |
|||
} |
|||
.content{ |
|||
position: relative; |
|||
flex: 1; |
|||
display: flex; |
|||
flex-direction: column; |
|||
overflow: hidden; |
|||
} |
|||
.content .listRight{ |
|||
position: fixed; |
|||
right: 0; |
|||
top: 260rpx; |
|||
} |
|||
.listRight view{ |
|||
font-size: 24rpx; |
|||
padding: 8rpx 18rpx; |
|||
color: #999999; |
|||
} |
|||
|
|||
.listRight view.active{ |
|||
color: #020202; |
|||
} |
|||
.content .listTitle{ |
|||
display: flex; |
|||
align-items: center; |
|||
height: 54rpx; |
|||
background: #F8F8F8; |
|||
padding: 0 30rpx; |
|||
font-size: 30rpx; |
|||
color: #999999; |
|||
} |
|||
.content .list{ |
|||
display: flex; |
|||
align-items: center; |
|||
height: 80rpx; |
|||
padding: 0 30rpx; |
|||
margin-right: 70rpx; |
|||
font-size: 30rpx; |
|||
border-bottom: 1px solid #E6E6E6; |
|||
} |
|||
.content .list.active{ |
|||
background-color: #F4F4F4; |
|||
} |
@ -1,4 +1,5 @@ |
|||
{ |
|||
"usingComponents": {}, |
|||
"navigationBarTitleText": "互利商城" |
|||
"navigationBarTitleText": "互利商城", |
|||
"navigationStyle": "custom" |
|||
} |
@ -1,3 +1,4 @@ |
|||
{ |
|||
|
|||
"usingComponents": {}, |
|||
"navigationBarTitleText": "" |
|||
} |
|||
|
@ -0,0 +1,68 @@ |
|||
// pages/login/register.js
|
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad(options) { |
|||
wx.setNavigationBarTitle({ |
|||
title: options.name, |
|||
}) |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage() { |
|||
|
|||
} |
|||
}) |
@ -0,0 +1,3 @@ |
|||
{ |
|||
"usingComponents": {} |
|||
} |
@ -0,0 +1,5 @@ |
|||
<!--pages/login/register.wxml--> |
|||
<view class="container"> |
|||
<image class="codeImage" src="/images/red_packet_share.png" mode="aspectFill"></image> |
|||
<view class="title">请添加上方二维码联系客服注册账号</view> |
|||
</view> |
@ -0,0 +1,19 @@ |
|||
/* pages/login/register.wxss */ |
|||
page{ |
|||
background-color: #F4F5F6; |
|||
} |
|||
.container{ |
|||
font-size: 30rpx; |
|||
width: 100%; |
|||
align-items: center; |
|||
} |
|||
.codeImage{ |
|||
margin-top: 60rpx; |
|||
width: 320rpx; |
|||
height: 320rpx; |
|||
} |
|||
.title{ |
|||
margin-top: 30rpx; |
|||
height: 60rpx; |
|||
line-height: 60rpx; |
|||
} |
@ -0,0 +1,66 @@ |
|||
// pages/mchList/mchList.js
|
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad(options) { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom() { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
onShareAppMessage() { |
|||
|
|||
} |
|||
}) |
@ -0,0 +1,6 @@ |
|||
{ |
|||
"usingComponents": {}, |
|||
"navigationBarTitleText": "优选店铺", |
|||
"navigationBarBackgroundColor": "#FA5151", |
|||
"navigationBarTextStyle": "white" |
|||
} |
@ -0,0 +1,2 @@ |
|||
<!--pages/mchList/mchList.wxml--> |
|||
<text>pages/mchList/mchList.wxml</text> |
@ -0,0 +1 @@ |
|||
/* pages/mchList/mchList.wxss */ |
@ -1,3 +1,3 @@ |
|||
{ |
|||
"navigationBarTitleText": "新品推荐" |
|||
"usingComponents": {} |
|||
} |