7 changed files with 587 additions and 2 deletions
-
3app.json
-
441pages/queuing-information/queuing-information.js
-
6pages/queuing-information/queuing-information.json
-
62pages/queuing-information/queuing-information.wxml
-
73pages/queuing-information/queuing-information.wxss
-
2pages/user-orders/user-orders.wxml
-
2pages/withdrawal-management/withdrawal-management.wxml
@ -0,0 +1,441 @@ |
|||
// order.js
|
|||
var api = require('../../api.js'); |
|||
var app = getApp(); |
|||
var is_no_more = false; |
|||
var is_loading = false; |
|||
var pageSize = 5; |
|||
var pageNum = 1; |
|||
var utils = require('../../utils.js'); |
|||
var util = require('../../utils/util.js'); |
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
imgServer: api.default.img_server, |
|||
|
|||
status: -1, |
|||
order_list: [], |
|||
show_no_data_tip: false, |
|||
hide: 1, |
|||
qrcode: "", |
|||
key:"" |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function(options) { |
|||
var page = this; |
|||
is_no_more = false; |
|||
is_loading = false; |
|||
page.data.key = "" |
|||
pageNum = 1; |
|||
pageSize = 1000; |
|||
page.loadOrderList(options.status || -1); |
|||
var pages = getCurrentPages(); |
|||
if (pages.length < 9) { |
|||
page.setData({ |
|||
show_index: true, |
|||
}); |
|||
} |
|||
}, |
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow: function () { |
|||
// this.loadOrderList(this.data.status);
|
|||
|
|||
}, |
|||
formSubmit: function (e) { |
|||
var page = this; |
|||
pageNum = 1; |
|||
page.data.key = e.detail.value.search; |
|||
page.loadOrderList(page.data.status); |
|||
|
|||
} |
|||
, |
|||
loadOrderList: function(status) { |
|||
var access_token = wx.getStorageSync("access_token"); |
|||
if (status == undefined) |
|||
status = -1; |
|||
var page = this; |
|||
page.setData({ |
|||
status: status, |
|||
}); |
|||
wx.showLoading({ |
|||
title: "正在加载", |
|||
mask: true, |
|||
}); |
|||
app.request({ |
|||
url: api.order.list, |
|||
data: { |
|||
userid: access_token, |
|||
pageNum: pageNum, |
|||
pageSize: pageSize, |
|||
key:page.data.key, |
|||
status: page.data.status, |
|||
}, |
|||
success: function(res) { |
|||
console.log(res) |
|||
if (res.code == 200) { |
|||
page.setData({ |
|||
order_list: res.data.list, |
|||
}); |
|||
if (res.data.total > pageSize) { |
|||
is_no_more = false |
|||
pageNum++ |
|||
} else { |
|||
is_no_more = true |
|||
} |
|||
} |
|||
page.setData({ |
|||
show_no_data_tip: (page.data.order_list.length == 0), |
|||
}); |
|||
}, |
|||
complete: function() { |
|||
wx.hideLoading(); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
statusChange: function(e) { |
|||
var page = this; |
|||
pageNum = 1; |
|||
is_no_more = false; |
|||
is_loading = false; |
|||
var status = e.currentTarget.dataset.status |
|||
page.setData({ |
|||
status: status |
|||
}); |
|||
page.loadOrderList(status) |
|||
}, |
|||
|
|||
onReachBottom: function() { |
|||
var access_token = wx.getStorageSync("access_token"); |
|||
var page = this; |
|||
if (is_loading || is_no_more) |
|||
return; |
|||
is_loading = true; |
|||
app.request({ |
|||
url: api.order.list, |
|||
data: { |
|||
userid: access_token, |
|||
pageNum: pageNum, |
|||
pageSize: pageSize, |
|||
key:page.data.key, |
|||
status: page.data.status, |
|||
}, |
|||
success: function(res) { |
|||
console.log(res) |
|||
if (res.code == 200) { |
|||
|
|||
var order_list = page.data.order_list.concat(res.data.list); |
|||
page.setData({ |
|||
order_list: order_list, |
|||
}); |
|||
if (res.data.total > order_list.length) { |
|||
is_no_more = false |
|||
pageNum++ |
|||
} else { |
|||
is_no_more = true |
|||
} |
|||
} |
|||
}, |
|||
complete: function() { |
|||
is_loading = false; |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
orderPay: function(e) { |
|||
wx.showLoading({ |
|||
title: "正在提交", |
|||
mask: true, |
|||
}); |
|||
app.request({ |
|||
url: api.order.pay_data, |
|||
data: { |
|||
order_id: e.currentTarget.dataset.id, |
|||
pay_type: "WECHAT_PAY", |
|||
}, |
|||
complete: function() { |
|||
wx.hideLoading(); |
|||
}, |
|||
success: function(res) { |
|||
console.log(res); |
|||
if (res.code == 200) { |
|||
|
|||
wx.requestPayment({ |
|||
timeStamp: res.data.timeStamp, |
|||
nonceStr: res.data.nonceStr, |
|||
package: res.data.package, |
|||
signType: res.data.signType, |
|||
paySign: res.data.paySign, |
|||
success: function(e) { |
|||
console.log("success"); |
|||
console.log(e); |
|||
wx.requestSubscribeMessage({ |
|||
tmplIds: ['bPgXd4I-7E-GYafPJSNJEAQMuptkU_SYG1OscN7MM0o'], |
|||
success(res) { |
|||
console.log(res) |
|||
}, |
|||
fail(error) { |
|||
console.log(error) |
|||
} |
|||
}); |
|||
}, |
|||
fail: function(e) { |
|||
console.log("fail"); |
|||
console.log(e); |
|||
}, |
|||
complete: function(e) { |
|||
console.log("complete"); |
|||
console.log(e); |
|||
|
|||
if (e.errMsg == "requestPayment:fail" || e.errMsg == "requestPayment:fail cancel") { //支付失败转到待支付订单列表
|
|||
wx.showModal({ |
|||
title: "提示", |
|||
content: "订单尚未支付", |
|||
showCancel: false, |
|||
confirmText: "确认", |
|||
success: function(res) { |
|||
if (res.confirm) { |
|||
wx.redirectTo({ |
|||
url: "/pages/order/order?status=9", |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
|
|||
wx.redirectTo({ |
|||
url: "/pages/order/order?status=9", |
|||
}); |
|||
|
|||
|
|||
}, |
|||
}); |
|||
} |
|||
if (res.code == 1) { |
|||
wx.showToast({ |
|||
title: res.msg, |
|||
image: "/images/icon-warning.png", |
|||
}); |
|||
} |
|||
|
|||
} |
|||
}); |
|||
}, |
|||
onShareAppMessage: function (e) { |
|||
var page = this; |
|||
console.log("+++++++++"); |
|||
console.log(e); |
|||
var res = { |
|||
path: "/pages/order-detail-daifu/order-detail-daifu?id=" |
|||
+ e.target.dataset.id, |
|||
success: function (e) { |
|||
console.log(e); |
|||
share_count++; |
|||
if (share_count == 1) |
|||
app.shareSendCoupon(page); |
|||
}, |
|||
title: "帮我代付一下,江湖救急~", |
|||
imageUrl: "https://lovehomelive.oss-cn-beijing.aliyuncs.com/ic_logo.png", |
|||
}; |
|||
return res; |
|||
}, |
|||
toPay: function(e) { |
|||
//获取支付数据
|
|||
app.request({ |
|||
url: api.order.pay_data, |
|||
data: { |
|||
id: e.currentTarget.dataset.id, |
|||
payType: 2, |
|||
}, |
|||
success: function(res) { |
|||
console.log(res); |
|||
|
|||
|
|||
if (res.code == 200) { |
|||
//发起支付
|
|||
wx.requestPayment({ |
|||
timeStamp: res.data.timeStamp, |
|||
nonceStr: res.data.nonceStr, |
|||
package: res.data.package, |
|||
signType: res.data.signType, |
|||
paySign: res.data.paySign, |
|||
success: function(e) { |
|||
console.log('1'); |
|||
console.log(e); |
|||
wx.requestSubscribeMessage({ |
|||
tmplIds: ['bPgXd4I-7E-GYafPJSNJEAQMuptkU_SYG1OscN7MM0o'], |
|||
success(res) { |
|||
console.log(res) |
|||
}, |
|||
fail(error) { |
|||
console.log(error) |
|||
} |
|||
}); |
|||
wx.redirectTo({ |
|||
url: "/pages/order/order?status=3", |
|||
}); |
|||
}, |
|||
fail: function(e) { |
|||
console.log('2'); |
|||
console.log(e); |
|||
}, |
|||
complete: function(e) { |
|||
console.log('3'); |
|||
console.log(e); |
|||
if (e.errMsg == "requestPayment:fail" || e.errMsg == "requestPayment:fail cancel") { //支付失败转到待支付订单列表
|
|||
wx.showModal({ |
|||
title: "提示", |
|||
content: "订单尚未支付", |
|||
showCancel: false, |
|||
confirmText: "确认", |
|||
success: function(res) { |
|||
if (res.confirm) { |
|||
wx.redirectTo({ |
|||
url: "/pages/order/order?status=2", |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
return; |
|||
} |
|||
if (e.errMsg == "requestPayment:ok") { |
|||
return; |
|||
} |
|||
}, |
|||
}); |
|||
return; |
|||
} |
|||
if (res.code == 1) { |
|||
wx.showToast({ |
|||
title: res.msg, |
|||
image: "/images/icon-warning.png", |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
|
|||
orderRevoke: function(e) { |
|||
var page = this; |
|||
wx.showModal({ |
|||
title: "提示", |
|||
content: "是否取消该订单?", |
|||
cancelText: "否", |
|||
confirmText: "是", |
|||
success: function(res) { |
|||
if (res.cancel) |
|||
return true; |
|||
if (res.confirm) { |
|||
wx.showLoading({ |
|||
title: "操作中", |
|||
}); |
|||
app.request({ |
|||
url: api.order.revoke, |
|||
data: { |
|||
orderId: e.currentTarget.dataset.id, |
|||
}, |
|||
success: function(res) { |
|||
wx.hideLoading(); |
|||
page.loadOrderList(page.data.status); |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
orderConfirm: function (e) { |
|||
var page = this; |
|||
wx.requestSubscribeMessage({ |
|||
tmplIds: ['LYqmtO9TqZNW4MUcdIjfZ6id2t_LheP98foMtJA92j4','CKLCPm5agmZHhhXItoo7foFN_S_5bt2CWiw-_-OvIVw'], |
|||
success(res) { |
|||
page.orderConfirm2(e); |
|||
console.log(res) |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
orderConfirm2: function(e) { |
|||
var page = this; |
|||
wx.showModal({ |
|||
title: "提示", |
|||
content: "是否确认已收到货?", |
|||
cancelText: "否", |
|||
confirmText: "是", |
|||
success: function(res) { |
|||
if (res.cancel) |
|||
return true; |
|||
if (res.confirm) { |
|||
wx.showLoading({ |
|||
title: "操作中", |
|||
}); |
|||
app.request({ |
|||
url: api.order.confirm, |
|||
data: { |
|||
orderId: e.currentTarget.dataset.id, |
|||
}, |
|||
success: function(res) { |
|||
wx.hideLoading(); |
|||
wx.showToast({ |
|||
title: res.msg, |
|||
}); |
|||
if (res.code == 200) { |
|||
page.loadOrderList(3); |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
}, |
|||
orderQrcode: function(e) { |
|||
var page = this; |
|||
var order_list = page.data.order_list; |
|||
var index = e.target.dataset.index; |
|||
wx.showLoading({ |
|||
title: "正在加载", |
|||
mask: true, |
|||
}); |
|||
if (page.data.order_list[index].offline_qrcode) { |
|||
|
|||
page.setData({ |
|||
hide: 0, |
|||
qrcode: page.data.order_list[index].offline_qrcode |
|||
}); |
|||
wx.hideLoading(); |
|||
} else { |
|||
app.request({ |
|||
url: api.order.get_qrcode, |
|||
data: { |
|||
order_no: order_list[index].order_no |
|||
}, |
|||
success: function(res) { |
|||
page.setData({ |
|||
hide: 0, |
|||
qrcode: res.data.url |
|||
}); |
|||
}, |
|||
complete: function() { |
|||
wx.hideLoading(); |
|||
} |
|||
}); |
|||
} |
|||
}, |
|||
hide: function(e) { |
|||
this.setData({ |
|||
hide: 1 |
|||
}); |
|||
} |
|||
|
|||
}); |
|||
@ -0,0 +1,6 @@ |
|||
{ |
|||
"navigationBarTitleText": "用户排队信息", |
|||
"enablePullDownRefresh": false, |
|||
"navigationBarBackgroundColor": "#fff", |
|||
"navigationBarTextStyle": "black" |
|||
} |
|||
@ -0,0 +1,62 @@ |
|||
<view class="page-content"> |
|||
<view class="flex-row tab-bar"> |
|||
<view class="flex-grow-1"> |
|||
<view class="{{status==-1?'active':''}}" bindtap="statusChange" data-status="-1"> |
|||
<text>按时间排序</text> |
|||
</view> |
|||
</view> |
|||
<view class="flex-grow-1"> |
|||
<view class="{{status==0?'active':''}}" bindtap="statusChange" data-status="0"> |
|||
<text>按最快排序</text> |
|||
</view> |
|||
</view> |
|||
|
|||
</view> |
|||
<view class="queued-content"> |
|||
<view class="queued-content-item"> |
|||
<view class="content-item-title">李姐烧烤(普罗旺斯店)</view> |
|||
<view class="content-item-text">购买时排队<span class="text-style">10</span>,当前<span class="text-style">2</span></view> |
|||
</view> |
|||
<view class="queued-content-item"> |
|||
<view class="content-item-title">李姐烧烤(青秀万达店)</view> |
|||
<view class="content-item-text">购买时排队<span class="text-style">200</span>,当前<span class="text-style">48</span></view> |
|||
</view> |
|||
<view class="queued-content-item"> |
|||
<view class="content-item-title">李姐烧烤(江南万达店)</view> |
|||
<view class="content-item-text">购买时排队<span class="text-style">400</span>,当前<span class="text-style">108</span></view> |
|||
</view> |
|||
<view class="queued-content-item"> |
|||
<view class="content-item-title">李姐烧烤(普罗旺斯店)</view> |
|||
<view class="content-item-text">购买时排队<span class="text-style">10</span>,当前<span class="text-style">2</span></view> |
|||
</view> |
|||
<view class="queued-content-item"> |
|||
<view class="content-item-title">李姐烧烤(青秀万达店)</view> |
|||
<view class="content-item-text">购买时排队<span class="text-style">200</span>,当前<span class="text-style">48</span></view> |
|||
</view> |
|||
<view class="queued-content-item"> |
|||
<view class="content-item-title">李姐烧烤(江南万达店)</view> |
|||
<view class="content-item-text">购买时排队<span class="text-style">400</span>,当前<span class="text-style">108</span></view> |
|||
</view> |
|||
<view class="queued-content-item"> |
|||
<view class="content-item-title">李姐烧烤(普罗旺斯店)</view> |
|||
<view class="content-item-text">购买时排队<span class="text-style">10</span>,当前<span class="text-style">2</span></view> |
|||
</view> |
|||
<view class="queued-content-item"> |
|||
<view class="content-item-title">李姐烧烤(青秀万达店)</view> |
|||
<view class="content-item-text">购买时排队<span class="text-style">200</span>,当前<span class="text-style">48</span></view> |
|||
</view> |
|||
<view class="queued-content-item"> |
|||
<view class="content-item-title">李姐烧烤(江南万达店)</view> |
|||
<view class="content-item-text">购买时排队<span class="text-style">400</span>,当前<span class="text-style">108</span></view> |
|||
</view> |
|||
<view class="queued-content-item"> |
|||
<view class="content-item-title">李姐烧烤(普罗旺斯店)</view> |
|||
<view class="content-item-text">购买时排队<span class="text-style">10</span>,当前<span class="text-style">2</span></view> |
|||
</view> |
|||
<view class="queued-content-item"> |
|||
<view class="content-item-title">李姐烧烤(青秀万达店)</view> |
|||
<view class="content-item-text">购买时排队<span class="text-style">200</span>,当前<span class="text-style">48</span></view> |
|||
</view> |
|||
|
|||
</view> |
|||
</view> |
|||
@ -0,0 +1,73 @@ |
|||
page{ |
|||
background: #F7F7F7; |
|||
} |
|||
.page-content{ |
|||
background: #fff; |
|||
padding: 30rpx; |
|||
padding-top: 0; |
|||
} |
|||
.tab-bar{ |
|||
background: #fff; |
|||
position: fixed; |
|||
top:0; |
|||
left: 0; |
|||
width: 100%; |
|||
z-index: 1000; |
|||
margin-bottom: 10rpx; |
|||
} |
|||
|
|||
.flex-grow-1 view{ |
|||
display: block; |
|||
padding:0 8rpx; |
|||
text-align: center; |
|||
} |
|||
|
|||
.flex-grow-1 view text{ |
|||
height: 100rpx; |
|||
line-height: 100rpx; |
|||
display: inline-block; |
|||
font-family: PingFangSC-Regular, sans-serif; |
|||
font-size: 30rpx; |
|||
color: #454545; |
|||
} |
|||
|
|||
.flex-grow-1 view.active text{ |
|||
font-family: PingFangSC-Regular, sans-serif; |
|||
font-size: 30rpx; |
|||
color: #F52F3E; |
|||
font-weight: bold; |
|||
border-bottom: 4rpx solid #F52F3E; |
|||
} |
|||
/****tab切换 结束****/ |
|||
|
|||
.queued-content{ |
|||
background: #fff; |
|||
padding: 30rpx 0; |
|||
padding-top: 0; |
|||
margin-top: 110rpx; |
|||
} |
|||
.queued-content-item{ |
|||
display: flex; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
padding: 40rpx 0; |
|||
border-bottom: 1rpx solid #eee; |
|||
} |
|||
.content-item-title{ |
|||
font-family: PingFangSC-Regular, sans-serif; |
|||
font-size: 24rpx; |
|||
color: #454545; |
|||
font-weight: bold; |
|||
} |
|||
.content-item-text{ |
|||
font-family: PingFangSC-Regular, sans-serif; |
|||
font-size: 24rpx; |
|||
color: #454545; |
|||
} |
|||
span.text-style{ |
|||
font-family: PingFangSC-Regular, sans-serif; |
|||
font-size: 24rpx; |
|||
color: #F52F3E; |
|||
padding: 0 15rpx; |
|||
font-weight: bold; |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue