diff --git a/api/common.js b/api/common.js
index 6b75dcb..f1b802d 100644
--- a/api/common.js
+++ b/api/common.js
@@ -4,7 +4,7 @@ const token = wx.getStorageSync('accessToken');
export default {
community:{
- list:()=>request.get('/api/community')
+ list:(data)=>request.get('/api/community',data)
},
address:{
list(commityId){
diff --git a/api/shop.js b/api/shop.js
index 2eade75..02bda2e 100644
--- a/api/shop.js
+++ b/api/shop.js
@@ -2,17 +2,7 @@ import request from './request';
export default {
category:()=>request.get('/api/merchant-categories'),
- list(category_id,longitude,latitude){
- const data = {};
- if(category_id){
- data.category_id = category_id;
- }
- if(longitude&&latitude){
- data.longitude = longitude;
- data.latitude = latitude;
- }
- return request.get('/api/merchant',data);
- },
+ list:(data)=>request.get('/api/merchant',data),
detail(id,lng,lat){
const data = {};
if(lng&&lat){
@@ -25,7 +15,7 @@ export default {
- orderList:()=>request.get('/api/merchant-pay'),
+ orderList:(data)=>request.get('/api/merchant-pay',data),
//计算商品订单金额
calculateOrderPrice:(merchant_product_id)=>request.post('/api/merchant/order/calculate-price',{merchant_product_id}),
//计算在线买单赠送积分
diff --git a/api/user.js b/api/user.js
index 1f362f5..a8f6647 100644
--- a/api/user.js
+++ b/api/user.js
@@ -30,9 +30,9 @@ export default {
},
pre:(data)=>request.post('/api/order/pre-order',data),
real:(data)=>request.post('/api/order',data),
- list:()=>request.get('/api/order/user/list'),
+ list:(data)=>request.get('/api/order/user/list',data),
cancel:(orderid)=>request.post(`/api/order/${orderid}/user/cancel`),
- merchantList:()=>request.get('/api/merchant/order/user'),
+ merchantList:(data)=>request.get('/api/merchant/order/user',data),
merchantDetail(order_id,longitude,latitude){
const data = {};
if(longitude&&latitude){
diff --git a/app.wxss b/app.wxss
index ac5528f..fd44146 100644
--- a/app.wxss
+++ b/app.wxss
@@ -2,13 +2,13 @@
page{
font-size:32rpx;
line-height: 1;
- padding-bottom:80rpx;
--main-font-color:#222222;
--main-bgclolor:#F5F5F5;
--main-color:#FEC400;
--main-hover-color:#fcce39;
color:var(--main-font-color);
background-color:var(--main-bgclolor);
+ overflow: hidden;
}
button{
@@ -262,7 +262,6 @@ page-container .content{
justify-content: space-between;
background-color: #fff;
font-size: 34rpx;
- font-weight: 600;
}
.tab-bar .item-container{
flex:1;
@@ -271,7 +270,7 @@ page-container .content{
.tab-bar .item{
position: relative;
padding:40rpx 0;
- color: #7C8695;
+ color: #555555;
transition-duration: .4s;
display: inline-block;
}
@@ -286,7 +285,8 @@ page-container .content{
transition-duration: .4s;
}
.tab-bar .current .item{
- color: var(--main-color);
+ color: var(--main-font-color);
+ font-weight: 500;
}
.tab-bar .current .item::before{
opacity: 1;
@@ -312,4 +312,8 @@ navigator button{
font-size: 26rpx;
color: #A1A1A1;
margin-top:24rpx;
+}
+
+.scroll-view-dispatch{
+ height:100rpx;
}
\ No newline at end of file
diff --git a/assets/icon/help/arrow-down@2x.png b/assets/icon/help/arrow-down@2x.png
index c0c6fa1..da14477 100644
Binary files a/assets/icon/help/arrow-down@2x.png and b/assets/icon/help/arrow-down@2x.png differ
diff --git a/assets/icon/navbar/lanfeng@2x.png b/assets/icon/navbar/lanfeng@2x.png
index 3510f5d..3a22197 100644
Binary files a/assets/icon/navbar/lanfeng@2x.png and b/assets/icon/navbar/lanfeng@2x.png differ
diff --git a/components/listView/index.js b/components/listView/index.js
new file mode 100644
index 0000000..5178677
--- /dev/null
+++ b/components/listView/index.js
@@ -0,0 +1,61 @@
+// components/listView/index.js
+Component({
+
+ /**
+ * 组件的属性列表
+ */
+ properties: {
+ "bindrefresherrefresh":{
+ type:Function
+ },
+ "refresherTriggered":{
+ type:Boolean,
+ value:false
+ },
+ "height":{
+ type:Number
+ },
+ loadMoreText:{
+ type:String,
+ value:'已经到底了'
+ },
+ showLoadMore:{
+ type:Boolean,
+ value:true
+ },
+ loadAll:{
+ type:Boolean,
+ value:false
+ }
+ },
+
+ /**
+ * 组件的初始数据
+ */
+ data: {
+ defaultHeight:''
+ },
+ lifetimes:{
+ attached(){
+ const windowInfo = wx.getWindowInfo();
+ this.setData({
+ defaultHeight:`calc(100vh)`
+ })
+ }
+ },
+ /**
+ * 组件的方法列表
+ */
+ methods: {
+ refreshList(){
+ this.triggerEvent('refresh');
+ },
+ scrolling(event){
+ //scrollTop scrollHeight
+ const bottomHeight = event.detail.scrollHeight-event.detail.scrollTop-this.properties.height;
+ if(bottomHeight<100){
+ this.triggerEvent('loadMore');
+ }
+ }
+ }
+})
\ No newline at end of file
diff --git a/components/listView/index.json b/components/listView/index.json
new file mode 100644
index 0000000..e8cfaaf
--- /dev/null
+++ b/components/listView/index.json
@@ -0,0 +1,4 @@
+{
+ "component": true,
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/components/listView/index.wxml b/components/listView/index.wxml
new file mode 100644
index 0000000..3b044a7
--- /dev/null
+++ b/components/listView/index.wxml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/listView/index.wxss b/components/listView/index.wxss
new file mode 100644
index 0000000..6c9d683
--- /dev/null
+++ b/components/listView/index.wxss
@@ -0,0 +1,21 @@
+.load-more{
+ padding:100rpx 0;
+ text-align: center;
+ color: #888888;
+ font-size:24rpx;
+ position: relative;
+ width:80%;
+ margin:0 auto;
+}
+.load-more .text{
+ background-color: var(--main-bgclolor);
+ padding:0 30rpx;
+}
+.load-more::before{
+ content: '';
+ position: absolute;
+ left:0;top:112rpx;
+ width:100%;height:1.5rpx;
+ background-color: rgba(136, 136, 136, 0.25);
+ z-index: -1;
+}
\ No newline at end of file
diff --git a/components/navbar/index.js b/components/navbar/index.js
index 41b9578..28d0974 100644
--- a/components/navbar/index.js
+++ b/components/navbar/index.js
@@ -34,6 +34,7 @@ Component({
attached(){
console.log('1212121212');
const windowInfo = wx.getWindowInfo();
+
this.setData({
statusBarHeight:windowInfo.statusBarHeight
})
diff --git a/pages/help/community/index.js b/pages/help/community/index.js
index 9739bf6..561ba7b 100644
--- a/pages/help/community/index.js
+++ b/pages/help/community/index.js
@@ -1,4 +1,5 @@
import commonApi from '../../../api/common';
+const app = getApp();
Page({
@@ -7,7 +8,12 @@ Page({
*/
data: {
currentCommunity:null,
- communityList:[]
+ defaultCommunityId:null,
+ communityList:[],
+ scrollViewHeight:0,
+ lng:0,
+ lat:0,
+ pager:{limit:10,loading:false,loadAll:false,pageIndex:0,refreshTrigger:false}
},
onSelectItem(event){
const pages = getCurrentPages();
@@ -22,22 +28,72 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
- console.log(options);
- commonApi.community.list().then((data)=>{
+ const windowInfo = wx.getWindowInfo();
+ this.setData({
+ scrollViewHeight:windowInfo.windowHeight,
+ defaultCommunityId:options.communityId
+ })
+ app.getLocation().then((res)=>{
+ this.setData({
+ lng:res.longitude,
+ lat:res.latitude
+ });
+ this.loadList();
+ }).catch(()=>{
+ this.loadList();
+ })
+ },
+ loadList(){
+ if(this.data.pager.loading||this.data.pager.loadAll){
+ return;
+ }
+ this.data.pager.loading = true;
+ this.setData({
+ pager:this.data.pager
+ });
+ const data = {
+ skip:this.data.pager.limit*this.data.pager.pageIndex,
+ limit:this.data.pager.limit
+ }
+ if(this.data.lng&&this.data.lat){
+ data.longitude = this.data.lng;
+ data.latitude = this.data.lat;
+ }
+ commonApi.community.list(data).then((data)=>{
const communityList = data.items;
let currentCommunity;
data.items.map((item)=>{
- if(item.id==options.communityId){
+ if(item.distance){
+ if(item.distance>=100){
+ item.distance = parseFloat(item.distance/1000).toFixed(1)+'km';
+ }else{
+ item.distance+='m';
+ }
+ }
+ if(item.id==this.data.defaultCommunityId){
currentCommunity = item;
}
})
+
+ if(this.data.pager.pageIndex==0){
+ this.data.communityList = data.items;
+ }else{
+ this.data.communityList = this.data.communityList.concat(data.items);
+ }
+ this.data.pager.loading = false;
+ this.data.pager.pageIndex++;
+ this.data.pager.refreshTrigger = false;
+ if(data.items.length