Commit d937734e by zqm

MM-订单列表头部固定。请求动画。无数据不再请求

parent 862a7ead
......@@ -56,7 +56,6 @@
"pages/pay/coupon-input/coupon-input",
"pages/pay/coupon-detail/coupon-detail",
"pages/login/login"
],
"usingComponents": {
"navigation": "./component/navigation/navigation",
......
......@@ -33,7 +33,7 @@ Page({
// 右上角消息
passBadge: 0,
foodBadge: 22 ,
foodBadge: 22,
movieBadge: 1,
spaBadge: 0,
artBadge: 101,
......@@ -41,8 +41,7 @@ Page({
showMoreOrder: false, // 查看更多订单
showMoreActivity: false, // 查看更多活动
myOrder: {
passOrder: [
{
passOrder: [{
id: 0,
logo: '',
store: '儿童营地',
......@@ -63,26 +62,22 @@ Page({
],
artOrder: {
logo: '',
orderList: [
{
orderList: [{
id: 0,
store: '海错图展馆',
cover: '../../pay/order-detail/image/goods_item.png',
title: '《海错图》展览单人门票',
time: '有效期至 2020.09.30',
quantity: '共1张门票'
},
]
}, ]
}
},
appointmentList: [
{
appointmentList: [{
time: '8月15日-7月15日 10:00-12:00',
img: '',
title: '日落观光游船体验活动之船行碧波共赏美景',
num: 3
}
]
}]
},
close() {
......@@ -111,7 +106,12 @@ Page({
onShow: function () {
this.setUserInfo()
},
// 去核销
goCouponInput(event) {
wx.navigateTo({
url: '/pages/pay/coupon-input/coupon-input',
})
},
setUserInfo: function () {
let funcUserInfo = wx.getStorageSync('userInfo')
......@@ -214,7 +214,11 @@ Page({
var that = this
App.wxRequest({
url: '/api/v1/activity/getMyActivityList',
data: { activeState: '0,1', pageSize: 10, pageNo: 1 },
data: {
activeState: '0,1',
pageSize: 10,
pageNo: 1
},
success: function (res) {
let list = res.data.list
let tmpArr = []
......@@ -222,12 +226,18 @@ Page({
let state = item.activeState * 1
let type = 0
switch (state) {
case 0: type = 1; break;
case 1: type = 0; break;
case 2: type = 2; break;
case 0:
type = 1;
break;
case 1:
type = 0;
break;
case 2:
type = 2;
break;
}
let obj = {
time: item.enrollDate,//activeDate + ' ' + item.activeTime,
time: item.enrollDate, //activeDate + ' ' + item.activeTime,
type: type,
content: item.address,
title: item.name,
......@@ -249,7 +259,7 @@ Page({
url: '/api/v1/subscribe/getList',
data: {
state: '1',
type: ''//0 入园预约 1 看房预约 全部 空字符
type: '' //0 入园预约 1 看房预约 全部 空字符
},
success: function (res) {
let tmpArr = []
......
......@@ -47,7 +47,7 @@
</view>
</view>
<view class="coupon row align-c">
<view class="coupon row align-c" bindtap="goCouponInput">
<view class="cpopon-info col">
<text>券码核销</text>
<text>所属门店:拾光花坊</text>
......
......@@ -30,6 +30,8 @@ Page({
orderList: [],
orderPages: 1,
winOrderType: false,
isLoading: false,
isFinished: false
},
onLoad: function (options) {
this.setOrderType()
......@@ -42,9 +44,21 @@ Page({
* @returns
*/
queryOrder: function () {
// 数据全部加载完成不再执行
console.log(this.data.isFinished, '-----------------------------------this.data.isFinished');
if (this.data.isFinished) return
let that = this;
let funcName = this.data.orderType[this.data.orderTypeActive].value
let funcValue = this.data.statusList[this.data.statusActive].value
this.setData({
isLoading: true
})
wx.showLoading({
title: '加载中',
})
App.wxRequest({
url: '/api/v1/order/getOrderList',
data: {
......@@ -54,7 +68,13 @@ Page({
'pageNo': this.data.orderPages,
},
success: (response) => {
wx.hideLoading()
let funcResponse = response.data
if (funcResponse.length < 10) {
that.setData({
isFinished: true
})
}
let funcList = []
for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = {
......@@ -99,8 +119,11 @@ Page({
this.setData({
orderList: this.data.orderList.concat(funcList)
})
that.setData({
isLoading: false
})
console.log(this.data.orderList)
}
})
},
......@@ -162,12 +185,23 @@ Page({
'orderTypeActive': funcIndex,
'orderPages': 1,
'orderList': [],
'isFinished': false
})
this.queryOrder()
},
/**
* 去逛逛
* @function
* @param {object} - event
* @returns
*/
onToBuy: function (event) {
this.onOrderAgain(event)
},
/**
* 订单状态
* @function
* @param {object} - event
......@@ -175,6 +209,7 @@ Page({
*/
onSelectionStatus: function (event) {
this.setData({
'isFinished': false,
'statusActive': Number(event.currentTarget.dataset.type),
'orderPages': 1,
'orderList': [],
......@@ -379,17 +414,44 @@ Page({
onOrderEvaluate: function (event) {
},
/**
* 缓存用户信息
* @function
* @param {object} - event
* @returns
*/
setShopInfo: function (funcShopAppId, funcShopType) {
// 获取门店基本信息
let funcShopId = App.globalData.shopId
for (let i = 0, l = funcShopId.length; i < l; i++) {
if (funcShopAppId === funcShopId[i].appId) {
let funcShopInfo = {
'id': funcShopId[i].id,
'appId': funcShopId[i].appId,
'name': funcShopId[i].title[funcShopType],
'logo': funcShopId[i].logo,
'cover': funcShopId[i].cover,
'shopType': funcShopType,
}
wx.setStorageSync('shopInfoBuffer', funcShopInfo)
break
}
}
},
/**
* 订单再次下单
* 订单再次下单、去逛逛
* @function
* @param
* @returns
*/
onOrderAgain: function (event) {
console.log(event, 'onOrderAgain');
let item = event.currentTarget.dataset.item
let commodityType = item.goodType
let shopAppId = wx.getStorageSync('shopInfoBuffer') ? wx.getStorageSync('shopInfoBuffer').appId : ""
wx.navigateTo({
url: '/pages/commodity/menu-food/menu-food',
url: `/pages/commodity/menu-food/menu-food?formPage=order&shopAppId=${shopAppId}&commodityType=${commodityType}`,
})
},
......@@ -401,6 +463,7 @@ Page({
* @returns
*/
onReachBottom: function () {
this.setData({
orderPages: this.data.orderPages + 1
})
......
......@@ -13,39 +13,21 @@
<view>
<view class="order-type-row row con-b align-c">
<block wx:for="{{orderType}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view
wx:if="{{index < 3}}"
class="order-type-item row con-c align-c {{orderTypeActive === index ? 'order-type-item-active' : ''}}"
data-item="{{item}}"
data-index="{{index}}"
bindtap="onOrderTypeSelection"
>
<view wx:if="{{index < 3}}" class="order-type-item row con-c align-c {{orderTypeActive === index ? 'order-type-item-active' : ''}}" data-item="{{item}}" data-index="{{index}}" bindtap="onOrderTypeSelection">
<text>{{item.name}}</text>
</view>
</block>
</view>
<view class="order-type-row row con-b align-c">
<block wx:for="{{orderType}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view
wx:if="{{3 <= index && index < 6}}"
class="order-type-item row con-c align-c {{orderTypeActive === index ? 'order-type-item-active' : ''}}"
data-item="{{item}}"
data-index="{{index}}"
bindtap="onOrderTypeSelection"
>
<view wx:if="{{3 <= index && index < 6}}" class="order-type-item row con-c align-c {{orderTypeActive === index ? 'order-type-item-active' : ''}}" data-item="{{item}}" data-index="{{index}}" bindtap="onOrderTypeSelection">
<text>{{item.name}}</text>
</view>
</block>
</view>
<view class="order-type-row row con-b align-c">
<block wx:for="{{orderType}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view
wx:if="{{6 <= index && index < 9}}"
class="order-type-item row con-c align-c {{orderTypeActive === index ? 'order-type-item-active' : ''}}"
data-item="{{item}}"
data-index="{{index}}"
bindtap="onOrderTypeSelection"
>
<view wx:if="{{6 <= index && index < 9}}" class="order-type-item row con-c align-c {{orderTypeActive === index ? 'order-type-item-active' : ''}}" data-item="{{item}}" data-index="{{index}}" bindtap="onOrderTypeSelection">
<text>{{item.name}}</text>
</view>
</block>
......@@ -55,14 +37,14 @@
<!-- 订单列表 -->
<view class="container-order">
<view class="status row con-b align-c">
<view class="status row con-b align-c fixed-tab">
<block wx:for="{{statusList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="status-item row con-c align-c {{index === statusActive ? 'status-item-active' : ''}}" data-type="{{index}}" bindtap="onSelectionStatus">
<text>{{item.name}}</text>
</view>
</block>
</view>
<block wx:if="{{orderList.length>0}}">
<view class="order-list col con-c align-c">
<block wx:for="{{orderList}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="order-list-item col align-c" data-item="{{item}}" bindtap="onOrderDetail">
......@@ -113,6 +95,18 @@
</view>
</block>
</view>
</block>
<block wx:else>
<view class="empty col con-c align-c" wx:if="{{!isLoading}}">
<image class="empty-cart" src=""></image>
<view class="empty-title">
<text>{{ statusActive!=0? '暂无相关订单':'暂无订单'}}</text>
</view>
<view class="empty-btn" bindtap="onToBuy" wx:if="{{statusActive===0}}">
<text>去逛逛</text>
</view>
</view>
</block>
</view>
<!-- 二维码弹窗 -->
......
......@@ -2,6 +2,14 @@ page {
height: 100%;
}
.fixed-tab {
position: fixed;
background: #fff;
top: 176rpx;
z-index: 99;
}
.navigation-order {
z-index: 1700;
position: fixed;
......@@ -45,7 +53,7 @@ page {
background: rgba(0, 0, 0, .65);
}
.order-type-selection > view {
.order-type-selection>view {
width: 750rpx;
min-height: 240rpx;
padding-top: 10rpx;
......@@ -77,7 +85,9 @@ page {
}
.container-order {
margin-top: 170rpx;
/* margin-top: 170rpx; */
margin-top: 288rpx;
}
.container {
......@@ -124,7 +134,7 @@ page {
background: #FFFFFF;
}
.order-list-item > view {
.order-list-item>view {
width: 610rpx;
}
......@@ -242,7 +252,7 @@ page {
margin-top: 56rpx;
}
.code-info-qrcode > image {
.code-info-qrcode>image {
display: block;
width: 296rpx;
height: 296rpx;
......@@ -297,7 +307,34 @@ page {
background: #A9A8A7;
}
.code-close > image {
.code-close>image {
width: 48rpx;
height: 48rpx;
}
.empty-cart {
width: 176rpx;
height: 176rpx;
/* background-color: #ccc; */
}
.empty-title {
margin-top: 64rpx;
color: #959DA9;
font-size: 38rpx;
line-height: 52rpx;
}
.empty-btn {
width: 308rpx;
height: 96rpx;
margin-top: 68rpx;
color: #fff;
font-size: 30rpx;
line-height: 96rpx;
text-align: center;
background: #86C5E1;
border-radius: 4rpx;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment