Commit 26d02c4b by zqm

订单列表-各状态按钮操作

parent 5dc1f218
......@@ -4,23 +4,29 @@ Page({
data: {
imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase,
orderTypeTitle: '全部分类',
orderTypeHeight: 0,
orderType: [],
orderTypeActive: 0,
statusList: [
{ 'value': '', 'name': '全部' },
{ 'value': '0', 'name': '待付款' },
{ 'value': '1', 'name': '待使用' },
{ 'value': '-1, 4', 'name': '取消/过期' },
isDoing: false,
statusList: [{
'value': '',
'name': '全部'
},
{
'value': '0',
'name': '待付款'
},
{
'value': '1',
'name': '待使用'
},
{
'value': '-1, 4',
'name': '取消/过期'
},
],
statusActive: 0,
orderList: [],
orderPages: 1,
winOrderType: false,
......@@ -61,6 +67,7 @@ Page({
'status': Number(funcResponse[i].status),
'amount': funcResponse[i].totalMoney,
'commodity': [],
'wxRequest': funcResponse[i].wxRequest
}
// 添加订单商品列表
......@@ -113,7 +120,10 @@ Page({
success: (response) => {
console.log(response)
let funcResponse = response.data
let funcList = [{ 'value': '', 'name': '全部分类' }]
let funcList = [{
'value': '',
'name': '全部分类'
}]
for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = {
'value': funcResponse[i].value,
......@@ -209,7 +219,21 @@ Page({
* @returns
*/
onOrderCancel: function (event) {
let that = this
wx.showLoading({
title: '处理中',
mask: true
})
this.setData({
isDoing: true
})
let funcItem = event.target.dataset.item
// let index = event.target.dataset.index
// // 无刷新更新数据
// let status = `orderList[${index}].status`
// this.setData({
// [status]:-1
// })
App.wxRequest({
url: '/api/v1/order/cancelOrder',
data: {
......@@ -217,14 +241,19 @@ Page({
'type': 0,
},
success: (response) => {
console.log(response)
}
wx.hideLoading()
that.setData({
isDoing: false
})
this.setData({
that.setData({
'orderList': [],
'orderPages': 1,
})
this.queryOrder()
that.queryOrder()
}
})
},
/**
......@@ -234,6 +263,14 @@ Page({
* @returns
*/
onOrderRemove: function (event) {
let that = this
wx.showLoading({
title: '处理中',
mask: true
})
this.setData({
isDoing: true
})
let funcItem = event.target.dataset.item
App.wxRequest({
url: '/api/v1/order/cancelOrder',
......@@ -242,14 +279,48 @@ Page({
'type': 1,
},
success: (response) => {
console.log(response)
}
})
this.setData({
wx.hideLoading()
that.setData({
isDoing: false,
'orderList': [],
'orderPages': 1,
})
this.queryOrder()
that.queryOrder()
console.log(response)
}
})
},
/**
* 检验数据是否都通过
* @function
* @param
* @returns
*/
inspectData: function () {
let funcPass = true
// 校验数组用户信息
let funcRegisterInfo = this.data.registerInfo
for (let i = 0, l = funcRegisterInfo.length; i < l; i++) {
if (funcRegisterInfo[i].name === '' || funcRegisterInfo[i].errorName !== '') {
this.setUserInfo('name', funcRegisterInfo[i].name, i, App.modular.rule.item('name', funcRegisterInfo[i].name))
funcPass = false
}
if (funcRegisterInfo[i].phone === '' || funcRegisterInfo[i].errorPhone !== '') {
this.setUserInfo('phone', funcRegisterInfo[i].phone, i, App.modular.rule.item('phone', funcRegisterInfo[i].phone))
funcPass = false
}
// 仅在需要的订单场景下校验
if ([1].indexOf(this.data.orderType) >= 0) {
if (funcRegisterInfo[i].identity === '' || funcRegisterInfo[i].errorIdentity !== '') {
this.setUserInfo('identity', funcRegisterInfo[i].identity, i, App.modular.rule.item('identity', funcRegisterInfo[i].identity))
funcPass = false
}
}
}
return funcPass
},
/**
......@@ -258,7 +329,34 @@ Page({
* @param
* @returns
*/
onOrderPay: function (event) {
// 数据校验不通过
let that = this
let funcItem = event.currentTarget.dataset.item
let wxRequest = funcItem.wxRequest
// 待支付返回的wx支付参数
if (wxRequest) {
wx.requestPayment({
timeStamp: wxRequest.timeStamp,
nonceStr: wxRequest.nonceStr,
package: wxRequest.package,
signType: wxRequest.signType,
paySign: wxRequest.paySign,
success(res) {
that.setData({
'orderList': [],
'orderPages': 1,
})
that.queryOrder()
},
fail(res) {}
})
}
},
......@@ -269,7 +367,7 @@ Page({
* @returns
*/
onOrderUse: function (event) {
this.onOrderDetail()
this.onOrderDetail(event)
},
/**
......@@ -289,6 +387,10 @@ Page({
* @returns
*/
onOrderAgain: function (event) {
console.log(event, 'onOrderAgain');
wx.navigateTo({
url: '/pages/commodity/menu-food/menu-food',
})
},
......
......@@ -99,15 +99,15 @@
<view class="order-list-item-operation row con-b align-c">
<view class="row align-c">
<text class="amount">实付:</text>
<text class="amount">¥20.00</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-item="{{item}}" catchtap="onOrderCancel">取消订单</button>
<button wx:if="{{item.status === -1 || item.status === 4}}" class="delete row con-c align-c" data-item="{{item}}" catchtap="onOrderRemove">删除订单</button>
<button wx:if="{{item.status === 0}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderPay">去支付</button>
<button wx:if="{{item.status === 2}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderUse">去使用</button>
<button wx:if="{{item.status === 3}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderEvaluate">去评价</button>
<button wx:if="{{item.status === -1}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderAgain">再次下单</button>
<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>
......
......@@ -14,6 +14,8 @@ Page({
codeInfo: {},
isFromUse: false,
winCode: false,
residuePayTime: "",//剩余支付时间
},
onLoad: function (options) {
......@@ -53,7 +55,6 @@ Page({
'contactPhone': funcResponse.mobilePhone, // 联系人电话
'commodityType': Number(funcResponse.goodType), // 商品类型
'commodity': [],
'tipOrderNo': funcResponse.orderSerialNumber, // 订单编号
'tipTimeSubmit': funcResponse.createDate,
'tipTimePay': App.modular.miment(funcResponse.paymentTime).format('YYYY-MM-DD hh:mm:ss'),
......@@ -73,6 +74,28 @@ Page({
}
funcOrderInfo.commodity.push(funcCommodityItem)
}
// 倒计时
let that = this
if (funcOrderInfo.state == 0) {
let timeInter = setInterval(() => {
let creatdTime = new Date(funcOrderInfo.tipTimeSubmit.replace(/-/g, '/')).getTime()
let doTime = 15 * 60 * 1000
let endTime = creatdTime + doTime
let now = new Date().getTime()
let residueStamp = endTime - now
let residuePayTime = App.modular.miment(residueStamp).format('mm:ss') // 57
if (residueStamp > 0) {
that.setData({
residuePayTime: residuePayTime
})
} else {
that.queryOrderDetail()
clearInterval(timeInter)
}
}, 1000)
}
this.setData({
orderInfo: funcOrderInfo
......@@ -87,6 +110,8 @@ Page({
})
},
onCouponCode: function (event) {
let funcOrderInfo = event.currentTarget.dataset.item
App.wxRequest({
......
......@@ -8,7 +8,7 @@
<text>订单待付款</text>
</view>
<view class="state-content-tip row">
<text>内付款,否则将自动取消订单</text>
<text>请在 {{residuePayTime}} 内付款,否则将自动取消订单</text>
</view>
</view>
......@@ -23,7 +23,7 @@
<text>订单已过期</text>
</view>
<view class="state-content-tip row">
<text>内付款,否则将自动取消订单</text>
<text>有效期xxx-xxx</text>
</view>
</view>
......@@ -32,7 +32,7 @@
<text>订单已取消</text>
</view>
<view class="state-content-tip row">
<text>内付款,否则将自动取消订单</text>
<text>下单后15分钟内未付款,自动取消订单</text>
</view>
</view>
......@@ -79,7 +79,6 @@
<text class="info-content-item-tip">18030303030</text>
</view>
</view>
<view class="info-line row con-b align-c">
<view class="info-line-point-left"></view>
<view class="info-line-line"></view>
......
......@@ -18,9 +18,7 @@ Page({
data: {
imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase,
animation: {},
shopInfo: {},
orderId: '',
orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影
......
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