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",
......
......@@ -8,7 +8,7 @@ Page({
data: {
imageBase: App.globalData.appImageBase,
orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影
orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影
userInfo: {
'openId': '',
......@@ -20,7 +20,7 @@ Page({
'sex': '',
'userType': 0
},
mobile: '',
nickName: '',
avatarUrl: '/pages/mine/home/image/avatar.png',
......@@ -30,10 +30,10 @@ Page({
approveList: ['园区门票优惠', '餐厅价格优惠', 'SPA服务优惠', '免费观看电影', '无须预约入园', '尽享多重特权'],
activityList: [],
isRegister: false, // 是否注册,
// 右上角消息
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: [
{
id: 0,
store: '海错图展馆',
cover: '../../pay/order-detail/image/goods_item.png',
title: '《海错图》展览单人门票',
time: '有效期至 2020.09.30',
quantity: '共1张门票'
},
]
orderList: [{
id: 0,
store: '海错图展馆',
cover: '../../pay/order-detail/image/goods_item.png',
title: '《海错图》展览单人门票',
time: '有效期至 2020.09.30',
quantity: '共1张门票'
}, ]
}
},
appointmentList: [
{
time: '8月15日-7月15日 10:00-12:00',
img: '',
title: '日落观光游船体验活动之船行碧波共赏美景',
num: 3
}
]
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
})
......
<!-- 订单分类选择 -->
<view class="navigation-order row con-b align-c">
<image src="{{imageBase + 'icon/arrow-l-1.png'}}" bindtap="onNavigationBack"></image>
<view class="order-type row con-c align-c" bindtap="onOrderType">
<text>{{orderTypeTitle}}</text>
<image src="{{imageBase + 'icon/arrow-b-2.png'}}"></image>
</view>
<image src=""></image>
<image src="{{imageBase + 'icon/arrow-l-1.png'}}" bindtap="onNavigationBack"></image>
<view class="order-type row con-c align-c" bindtap="onOrderType">
<text>{{orderTypeTitle}}</text>
<image src="{{imageBase + 'icon/arrow-b-2.png'}}"></image>
</view>
<image src=""></image>
</view>
<!-- 订单状态选择 -->
<view class="order-type-selection col" wx:if="{{winOrderType}}" bindtap="onOrderType">
<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"
>
<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"
>
<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"
>
<text>{{item.name}}</text>
</view>
</block>
</view>
</view>
<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">
<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">
<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">
<text>{{item.name}}</text>
</view>
</block>
</view>
</view>
</view>
<!-- 订单列表 -->
<view class="container-order">
<view class="status row con-b align-c">
<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>
<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">
<view class="order-list-item-title row con-b align-c">
<view class="row align-c">
<image wx:if="{{item.shopLogo}}" src="{{resourcesBase + item.shopLogo}}" mode="heightFix"></image>
<text>{{item.name}}</text>
</view>
<view>
<text class="warning" wx:if="{{item.status === 0}}">待付款</text>
<text class="warning" wx:if="{{item.status === 2}}">待使用</text>
<text class="warning" wx:if="{{item.status === 3}}">待评价</text>
<text class="message" wx:if="{{item.status === -1}}">已取消</text>
<text class="message" wx:if="{{item.status === 4}}">已过期</text>
<text class="message" wx:if="{{item.status === 6}}">已评价</text>
</view>
</view>
<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">
<view class="order-list-item-title row con-b align-c">
<view class="row align-c">
<image wx:if="{{item.shopLogo}}" src="{{resourcesBase + item.shopLogo}}" mode="heightFix"></image>
<text>{{item.name}}</text>
</view>
<view>
<text class="warning" wx:if="{{item.status === 0}}">待付款</text>
<text class="warning" wx:if="{{item.status === 2}}">待使用</text>
<text class="warning" wx:if="{{item.status === 3}}">待评价</text>
<text class="message" wx:if="{{item.status === -1}}">已取消</text>
<text class="message" wx:if="{{item.status === 4}}">已过期</text>
<text class="message" wx:if="{{item.status === 6}}">已评价</text>
</view>
</view>
<!-- 商品数量样式一 -->
<view class="order-list-item-service row con-b align-c" wx:if="{{item.commodity.length === 1}}">
<image class="cover" src="{{item.commodity[0].cover}}"></image>
<text class="name">{{item.commodity[0].name}}</text>
<text class="total">{{'x ' + item.total}}</text>
</view>
<!-- 商品数量样式一 -->
<view class="order-list-item-service row con-b align-c" wx:if="{{item.commodity.length === 1}}">
<image class="cover" src="{{item.commodity[0].cover}}"></image>
<text class="name">{{item.commodity[0].name}}</text>
<text class="total">{{'x ' + item.total}}</text>
</view>
<!-- 商品数量样式二 -->
<view class="order-list-item-service row con-b align-c" wx:if="{{item.commodity.length >= 2}}">
<block wx:for="{{item.commodity}}" wx:for-index="commodityIndex" wx:for-item="commodityItem" wx:key="commodityIndex">
<image class="cover" src="{{commodityItem.cover}}"></image>
</block>
<text class="total">{{'共 ' + item.total + ' 件'}}</text>
</view>
<!-- 商品数量样式二 -->
<view class="order-list-item-service row con-b align-c" wx:if="{{item.commodity.length >= 2}}">
<block wx:for="{{item.commodity}}" wx:for-index="commodityIndex" wx:for-item="commodityItem" wx:key="commodityIndex">
<image class="cover" src="{{commodityItem.cover}}"></image>
</block>
<text class="total">{{'共 ' + item.total + ' 件'}}</text>
</view>
<view class="order-list-item-operation row con-b align-c">
<view class="row align-c">
<text class="amount">实付:</text>
<text class="amount">¥{{item.amount}}</text>
</view>
<view class="row align-c">
<button wx:if="{{item.status === 0}}" class="delete row con-c align-c" data-index="{{index}}" data-item="{{item}}" catchtap="onOrderCancel" disabled="{{isDoing}}">取消订单</button>
<button disabled="{{isDoing}}" wx:if="{{item.status === -1 || item.status === 4}}" class="delete row con-c align-c" data-item="{{item}}" catchtap="onOrderRemove">删除订单</button>
<button disabled="{{isDoing}}" wx:if="{{item.status === 0}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderPay">去支付</button>
<button disabled="{{isDoing}}" wx:if="{{item.status === 2}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderUse">去使用</button>
<button disabled="{{isDoing}}" wx:if="{{item.status === 3}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderEvaluate">去评价</button>
<button disabled="{{isDoing}}" wx:if="{{item.status === -1}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderAgain">再次下单</button>
</view>
</view>
</view>
</block>
</view>
<view class="order-list-item-operation row con-b align-c">
<view class="row align-c">
<text class="amount">实付:</text>
<text class="amount">¥{{item.amount}}</text>
</view>
<view class="row align-c">
<button wx:if="{{item.status === 0}}" class="delete row con-c align-c" data-index="{{index}}" data-item="{{item}}" catchtap="onOrderCancel" disabled="{{isDoing}}">取消订单</button>
<button disabled="{{isDoing}}" wx:if="{{item.status === -1 || item.status === 4}}" class="delete row con-c align-c" data-item="{{item}}" catchtap="onOrderRemove">删除订单</button>
<button disabled="{{isDoing}}" wx:if="{{item.status === 0}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderPay">去支付</button>
<button disabled="{{isDoing}}" wx:if="{{item.status === 2}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderUse">去使用</button>
<button disabled="{{isDoing}}" wx:if="{{item.status === 3}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderEvaluate">去评价</button>
<button disabled="{{isDoing}}" wx:if="{{item.status === -1}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderAgain">再次下单</button>
</view>
</view>
</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>
<!-- 二维码弹窗 -->
<view class="code-mask row con-c align-c" wx:if="{{winCode}}">
<view class="code col con-c align-c">
<view class="code-tip col con-c align-c">
<text>{{'请将券码出示给门店核销人员'}}</text>
<text>{{'请将券码出示给门店核销人员'}}</text>
</view>
<view class="code-info col con-c align-c">
<view class="code-info-title">
<text>{{'《 阿凡达 》电影票'}}</text>
</view>
<view class="code-info-qrcode">
<image src="{{'data:image/png;base64,' + code.codeBase64}}"></image>
</view>
<view class="code-info-copy row con-b align-c">
<text>券码</text>
<text>{{'2719 7092 0925'}}</text>
<text>复制</text>
</view>
</view>
<view class="code-close row con-c align-c" bindtap="onCodeClose">
<image src="{{imageBase + 'icon/close-1.png'}}"></image>
</view>
</view>
<view class="code col con-c align-c">
<view class="code-tip col con-c align-c">
<text>{{'请将券码出示给门店核销人员'}}</text>
<text>{{'请将券码出示给门店核销人员'}}</text>
</view>
<view class="code-info col con-c align-c">
<view class="code-info-title">
<text>{{'《 阿凡达 》电影票'}}</text>
</view>
<view class="code-info-qrcode">
<image src="{{'data:image/png;base64,' + code.codeBase64}}"></image>
</view>
<view class="code-info-copy row con-b align-c">
<text>券码</text>
<text>{{'2719 7092 0925'}}</text>
<text>复制</text>
</view>
</view>
<view class="code-close row con-c align-c" bindtap="onCodeClose">
<image src="{{imageBase + 'icon/close-1.png'}}"></image>
</view>
</view>
</view>
\ No newline at end of file
......@@ -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