订单列表和详情
This commit is contained in:
parent
c058795ec7
commit
3656764d80
@ -30,7 +30,6 @@ Page({
|
||||
page: data.page,
|
||||
total: data.total
|
||||
});
|
||||
console.log(self.data.orderList);
|
||||
},
|
||||
function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
@ -39,6 +38,17 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
//订单详情页
|
||||
toOrderDetail: function(options){
|
||||
var groundBookingId = options.currentTarget.dataset.id;
|
||||
if(!groundBookingId){
|
||||
return false;
|
||||
}
|
||||
wx.navigateTo({
|
||||
url: '../orderDetail/orderDetail?groundBookingId=' + groundBookingId,
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
@ -86,14 +96,12 @@ Page({
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
<view class="order">
|
||||
<view class="order-box" wx:for="{{orderList}}" wx:key="inedx">
|
||||
<view class="order-box" wx:for="{{orderList}}" wx:key="inedx" bindtap="toOrderDetail" data-id="{{item.groundBookingId}}">
|
||||
<view class="order-img">
|
||||
<image src="{{venueUrl}}{{imgRoute}}{{item.venuePanorama}}"></image>
|
||||
</view>
|
||||
@ -10,9 +10,16 @@
|
||||
</view>
|
||||
<view class="order-text">订单编号:{{item.serial}}</view>
|
||||
<view class="order-text">下单时间:{{item.gmtCreate}}</view>
|
||||
<view class="price" wx:if="{{item.price == '0' || item.price == ''}}">¥15元</view>
|
||||
<view class="price" wx:else>¥{{item.price}}元</view>
|
||||
<view class="status">已过期</view>
|
||||
<view wx:if="{{item.orderType == '0'}}">
|
||||
<view class="price" wx:if="{{item.price == '0' || item.price == ''}}">¥15元</view>
|
||||
<view class="price" wx:else>¥{{item.price}}元</view>
|
||||
</view>
|
||||
<view wx:if="{{item.orderType == '1'}}">
|
||||
<view class="status">已取消</view>
|
||||
</view>
|
||||
<view wx:if="{{item.orderType == '2'}}">
|
||||
<view class="status">已过期</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
@ -1,3 +1,4 @@
|
||||
var app = getApp();
|
||||
// pages/orderDetail/orderDetail.js
|
||||
Page({
|
||||
|
||||
@ -5,14 +6,118 @@ Page({
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
venueUrl : app.venueUrl,
|
||||
imgRoute : '/route/file/downloadfile/true/',
|
||||
token:'',
|
||||
groundBookingId: '',
|
||||
serial: '',
|
||||
venuesName: '',
|
||||
projectName: '',
|
||||
venuePanorama: '',
|
||||
gmtCreate: '',
|
||||
price: '',
|
||||
itemList:[],
|
||||
cancelType: false,
|
||||
},
|
||||
|
||||
//查询订单详情
|
||||
getDetail: function(){
|
||||
var self = this;
|
||||
app.dialog.loading('请稍等');
|
||||
app.restAjax.get(app.restAjax.path('{venueUrl}/app/booking/getmyticketdetail/{groundBookingId}', [app.venueUrl,self.data.groundBookingId]),
|
||||
{}, {headers:{token : self.data.token}},
|
||||
function (code, data) {
|
||||
self.setData({
|
||||
serial: data.data.serial,
|
||||
venuesName: data.data.venuesName,
|
||||
projectName: data.data.projectName,
|
||||
venuePanorama: data.data.venuePanorama.split(',')[0],
|
||||
gmtCreate: data.data.gmtCreate.substring(0,19),
|
||||
itemList: data.data.itemDTOList,
|
||||
cancelType: false
|
||||
})
|
||||
var totalPrice = 0;
|
||||
self.data.itemList.forEach(element => {
|
||||
if(element.orderType != '1'){
|
||||
totalPrice += Number(element.price);
|
||||
}
|
||||
if(element.orderType == '0'){
|
||||
self.setData({
|
||||
cancelType: true
|
||||
})
|
||||
}
|
||||
});
|
||||
self.setData({
|
||||
price: totalPrice
|
||||
})
|
||||
},
|
||||
function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
},function(){
|
||||
wx.hideLoading();
|
||||
})
|
||||
},
|
||||
|
||||
//取消预订场次
|
||||
cancelItem: function(options){
|
||||
var self = this;
|
||||
var bookingItemId = options.currentTarget.dataset.id;
|
||||
var unCancelNum = 0;
|
||||
self.data.itemList.forEach(element => {
|
||||
if(element.orderType == '0'){
|
||||
unCancelNum++;
|
||||
}
|
||||
});
|
||||
//取消一个
|
||||
if(unCancelNum > 1){
|
||||
app.dialog.loading('请稍等');
|
||||
app.restAjax.delete(app.restAjax.path('{venueUrl}/app/booking/removemyticketitem/{groundBookingId}/{bookingItemId}',
|
||||
[app.venueUrl,self.data.groundBookingId,bookingItemId]), {}, {headers:{token : self.data.token}},
|
||||
function (code, data) {
|
||||
self.getDetail();
|
||||
},
|
||||
function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
},function(){
|
||||
wx.hideLoading();
|
||||
})
|
||||
}
|
||||
//取消全部
|
||||
if(unCancelNum <= 1){
|
||||
self.cancelAll();
|
||||
}
|
||||
},
|
||||
|
||||
//全部取消
|
||||
cancelAll: function(){
|
||||
var self = this;
|
||||
app.dialog.loading('请稍等');
|
||||
app.restAjax.delete(app.restAjax.path('{venueUrl}/app/booking/removemyticket/{groundBookingId}',
|
||||
[app.venueUrl,self.data.groundBookingId]), {}, {headers:{token : self.data.token}},
|
||||
function (code, data) {
|
||||
self.getDetail();
|
||||
},
|
||||
function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
},function(){
|
||||
wx.hideLoading();
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
wx.getStorage({
|
||||
key: 'token',
|
||||
success: (result) => {
|
||||
this.setData({
|
||||
token : result.data,
|
||||
groundBookingId: options.groundBookingId
|
||||
})
|
||||
this.getDetail();
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1,67 +1,40 @@
|
||||
<view class="venue">
|
||||
<view class="venue-img">
|
||||
<image src="../../images/center-bg.png"></image>
|
||||
<image wx:if="{{venuePanorama}}" src="{{venueUrl}}{{imgRoute}}{{venuePanorama}}"></image>
|
||||
</view>
|
||||
<view class="venue-info">
|
||||
<view class="venue-title">场馆</view>
|
||||
<view class="venue-title">{{venuesName}}</view>
|
||||
<view class="time-number">
|
||||
<text>订单编号:</text>123456789
|
||||
<text>订单编号:</text>{{serial}}
|
||||
</view>
|
||||
<view class="time-number">
|
||||
<text>下单时间:</text>10:10:10
|
||||
<text>下单时间:</text>{{gmtCreate}}
|
||||
</view>
|
||||
<view class="time-number">
|
||||
<text>价 格:</text>15元
|
||||
<view class="time-number" wx:if="{{price == '0' || price == ''}}">
|
||||
<text>价 格:</text> -
|
||||
</view>
|
||||
<view class="time-number" wx:else>
|
||||
<text>价 格:</text> {{price}}元
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="book">
|
||||
<view class="book-title">预定详情</view>
|
||||
<view class="book-title">{{projectName}}-预定详情</view>
|
||||
<view class="order">
|
||||
<view class="order-box">
|
||||
<view class="order-box" wx:for="{{itemList}}" wx:key="index">
|
||||
<view class="top">
|
||||
<view>2020-01-01</view>
|
||||
<view>12:00-13:00</view>
|
||||
<view>{{item.bookingOrderDate}}</view>
|
||||
<view>{{item.timeStr}}-{{item.timeEnd}}</view>
|
||||
</view>
|
||||
<view class="bottom">
|
||||
<view>场地1</view>
|
||||
<view>15元</view>
|
||||
<view class="cancel">取消预定</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="order-box">
|
||||
<view class="top">
|
||||
<view>2020-01-01</view>
|
||||
<view>12:00-13:00</view>
|
||||
</view>
|
||||
<view class="bottom">
|
||||
<view>场地1</view>
|
||||
<view>15元</view>
|
||||
<view class="time-out">已过期</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="order-box">
|
||||
<view class="top">
|
||||
<view>2020-01-01</view>
|
||||
<view>12:00-13:00</view>
|
||||
</view>
|
||||
<view class="bottom">
|
||||
<view>场地1</view>
|
||||
<view>15元</view>
|
||||
<view class="time-out">已取消</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="order-box">
|
||||
<view class="top">
|
||||
<view>2020-01-01</view>
|
||||
<view>12:00-13:00</view>
|
||||
</view>
|
||||
<view class="bottom">
|
||||
<view>场地1</view>
|
||||
<view>15元</view>
|
||||
<view class="cancel">取消预定</view>
|
||||
<view>{{item.groundName}}</view>
|
||||
<view wx:if="{{item.price == '' || item.price == '0'}}">免费</view>
|
||||
<view wx:else>{{item.price}}元</view>
|
||||
<view class="cancel" wx:if="{{item.orderType == '0'}}" bindtap="cancelItem" data-id="{{item.bookingItemId}}">取消预定</view>
|
||||
<view class="time-out" wx:if="{{item.orderType == '1'}}">已取消</view>
|
||||
<view class="time-out" wx:if="{{item.orderType == '2'}}">已过期</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cancel-all">全部取消</view>
|
||||
<view class="cancel-all" wx:if="{{cancelType}}" bindtap="cancelAll">全部取消</view>
|
Loading…
Reference in New Issue
Block a user