Commit 26d02c4b by zqm

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

parent 5dc1f218
...@@ -4,23 +4,29 @@ Page({ ...@@ -4,23 +4,29 @@ Page({
data: { data: {
imageBase: App.globalData.appImageBase, imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase, resourcesBase: App.globalData.appResourcesBase,
orderTypeTitle: '全部分类', orderTypeTitle: '全部分类',
orderTypeHeight: 0, orderTypeHeight: 0,
orderType: [], orderType: [],
orderTypeActive: 0, orderTypeActive: 0,
isDoing: false,
statusList: [ statusList: [{
{ 'value': '', 'name': '全部' }, 'value': '',
{ 'value': '0', 'name': '待付款' }, 'name': '全部'
{ 'value': '1', 'name': '待使用' }, },
{ 'value': '-1, 4', 'name': '取消/过期' }, {
'value': '0',
'name': '待付款'
},
{
'value': '1',
'name': '待使用'
},
{
'value': '-1, 4',
'name': '取消/过期'
},
], ],
statusActive: 0, statusActive: 0,
orderList: [], orderList: [],
orderPages: 1, orderPages: 1,
winOrderType: false, winOrderType: false,
...@@ -61,6 +67,7 @@ Page({ ...@@ -61,6 +67,7 @@ Page({
'status': Number(funcResponse[i].status), 'status': Number(funcResponse[i].status),
'amount': funcResponse[i].totalMoney, 'amount': funcResponse[i].totalMoney,
'commodity': [], 'commodity': [],
'wxRequest': funcResponse[i].wxRequest
} }
// 添加订单商品列表 // 添加订单商品列表
...@@ -113,7 +120,10 @@ Page({ ...@@ -113,7 +120,10 @@ Page({
success: (response) => { success: (response) => {
console.log(response) console.log(response)
let funcResponse = response.data let funcResponse = response.data
let funcList = [{ 'value': '', 'name': '全部分类' }] let funcList = [{
'value': '',
'name': '全部分类'
}]
for (let i = 0, l = funcResponse.length; i < l; i++) { for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = { let funcItem = {
'value': funcResponse[i].value, 'value': funcResponse[i].value,
...@@ -209,7 +219,21 @@ Page({ ...@@ -209,7 +219,21 @@ Page({
* @returns * @returns
*/ */
onOrderCancel: function (event) { onOrderCancel: function (event) {
let that = this
wx.showLoading({
title: '处理中',
mask: true
})
this.setData({
isDoing: true
})
let funcItem = event.target.dataset.item let funcItem = event.target.dataset.item
// let index = event.target.dataset.index
// // 无刷新更新数据
// let status = `orderList[${index}].status`
// this.setData({
// [status]:-1
// })
App.wxRequest({ App.wxRequest({
url: '/api/v1/order/cancelOrder', url: '/api/v1/order/cancelOrder',
data: { data: {
...@@ -217,14 +241,19 @@ Page({ ...@@ -217,14 +241,19 @@ Page({
'type': 0, 'type': 0,
}, },
success: (response) => { success: (response) => {
console.log(response) wx.hideLoading()
that.setData({
isDoing: false
})
that.setData({
'orderList': [],
'orderPages': 1,
})
that.queryOrder()
} }
}) })
this.setData({
'orderList': [],
'orderPages': 1,
})
this.queryOrder()
}, },
/** /**
...@@ -234,6 +263,14 @@ Page({ ...@@ -234,6 +263,14 @@ Page({
* @returns * @returns
*/ */
onOrderRemove: function (event) { onOrderRemove: function (event) {
let that = this
wx.showLoading({
title: '处理中',
mask: true
})
this.setData({
isDoing: true
})
let funcItem = event.target.dataset.item let funcItem = event.target.dataset.item
App.wxRequest({ App.wxRequest({
url: '/api/v1/order/cancelOrder', url: '/api/v1/order/cancelOrder',
...@@ -242,14 +279,48 @@ Page({ ...@@ -242,14 +279,48 @@ Page({
'type': 1, 'type': 1,
}, },
success: (response) => { success: (response) => {
wx.hideLoading()
that.setData({
isDoing: false,
'orderList': [],
'orderPages': 1,
})
that.queryOrder()
console.log(response) console.log(response)
} }
}) })
this.setData({
'orderList': [], },
'orderPages': 1, /**
}) * 检验数据是否都通过
this.queryOrder() * @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({ ...@@ -258,7 +329,34 @@ Page({
* @param * @param
* @returns * @returns
*/ */
onOrderPay: function (event) { 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({ ...@@ -269,7 +367,7 @@ Page({
* @returns * @returns
*/ */
onOrderUse: function (event) { onOrderUse: function (event) {
this.onOrderDetail() this.onOrderDetail(event)
}, },
/** /**
...@@ -289,6 +387,10 @@ Page({ ...@@ -289,6 +387,10 @@ Page({
* @returns * @returns
*/ */
onOrderAgain: function (event) { onOrderAgain: function (event) {
console.log(event, 'onOrderAgain');
wx.navigateTo({
url: '/pages/commodity/menu-food/menu-food',
})
}, },
......
...@@ -99,15 +99,15 @@ ...@@ -99,15 +99,15 @@
<view class="order-list-item-operation row con-b align-c"> <view class="order-list-item-operation row con-b align-c">
<view class="row align-c"> <view class="row align-c">
<text class="amount">实付:</text> <text class="amount">实付:</text>
<text class="amount">¥20.00</text> <text class="amount">¥{{item.amount}}</text>
</view> </view>
<view class="row align-c"> <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 === 0}}" class="delete row con-c align-c" data-index="{{index}}" data-item="{{item}}" catchtap="onOrderCancel" disabled="{{isDoing}}">取消订单</button>
<button 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 === -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 disabled="{{isDoing}}" 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 disabled="{{isDoing}}" 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 disabled="{{isDoing}}" 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 disabled="{{isDoing}}" wx:if="{{item.status === -1}}" class="again row con-c align-c" data-item="{{item}}" catchtap="onOrderAgain">再次下单</button>
</view> </view>
</view> </view>
</view> </view>
......
...@@ -7,13 +7,15 @@ Page({ ...@@ -7,13 +7,15 @@ Page({
shopInfo: {}, shopInfo: {},
orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影 orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影
orderInfo: {}, orderInfo: {},
fromPage: '', fromPage: '',
codeInfo: {}, codeInfo: {},
isFromUse: false, isFromUse: false,
winCode: false, winCode: false,
residuePayTime: "",//剩余支付时间
}, },
onLoad: function (options) { onLoad: function (options) {
...@@ -46,15 +48,14 @@ Page({ ...@@ -46,15 +48,14 @@ Page({
let funcResponse = response.data let funcResponse = response.data
let funcOrderInfo = { let funcOrderInfo = {
'id': this.data.orderInfo.id, 'id': this.data.orderInfo.id,
'score': funcResponse.integral, // 积分 'score': funcResponse.integral, // 积分
'state': Number(funcResponse.status), // 订单状态 'state': Number(funcResponse.status), // 订单状态
'amount': funcResponse.totalMoney, // 实付金额 'amount': funcResponse.totalMoney, // 实付金额
'contactName': funcResponse.name, // 联系人名称 'contactName': funcResponse.name, // 联系人名称
'contactPhone': funcResponse.mobilePhone, // 联系人电话 'contactPhone': funcResponse.mobilePhone, // 联系人电话
'commodityType': Number(funcResponse.goodType), // 商品类型 'commodityType': Number(funcResponse.goodType), // 商品类型
'commodity': [], 'commodity': [],
'tipOrderNo': funcResponse.orderSerialNumber, // 订单编号
'tipOrderNo': funcResponse.orderSerialNumber, // 订单编号
'tipTimeSubmit': funcResponse.createDate, 'tipTimeSubmit': funcResponse.createDate,
'tipTimePay': App.modular.miment(funcResponse.paymentTime).format('YYYY-MM-DD hh:mm:ss'), 'tipTimePay': App.modular.miment(funcResponse.paymentTime).format('YYYY-MM-DD hh:mm:ss'),
'tipIntegral': funcResponse.integral 'tipIntegral': funcResponse.integral
...@@ -65,14 +66,36 @@ Page({ ...@@ -65,14 +66,36 @@ Page({
for (let i = 0, l = funcCommodity.length; i < l; i++) { for (let i = 0, l = funcCommodity.length; i < l; i++) {
let funcCommodityItem = { let funcCommodityItem = {
'cover': funcCommodity[i].imgUrl, 'cover': funcCommodity[i].imgUrl,
'name': funcCommodity[i].name, // 名称 'name': funcCommodity[i].name, // 名称
'quantity': funcCommodity[i].number, // 数量 'quantity': funcCommodity[i].number, // 数量
'amount': funcCommodity[i].totalPrices, // 总价 'amount': funcCommodity[i].totalPrices, // 总价
'state': Number(funcCommodity[i].status), // 状态 'state': Number(funcCommodity[i].status), // 状态
'codeId': funcCommodity[i].volumeId, // 券码 'codeId': funcCommodity[i].volumeId, // 券码
} }
funcOrderInfo.commodity.push(funcCommodityItem) 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({ this.setData({
orderInfo: funcOrderInfo orderInfo: funcOrderInfo
...@@ -87,6 +110,8 @@ Page({ ...@@ -87,6 +110,8 @@ Page({
}) })
}, },
onCouponCode: function (event) { onCouponCode: function (event) {
let funcOrderInfo = event.currentTarget.dataset.item let funcOrderInfo = event.currentTarget.dataset.item
App.wxRequest({ App.wxRequest({
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<text>订单待付款</text> <text>订单待付款</text>
</view> </view>
<view class="state-content-tip row"> <view class="state-content-tip row">
<text>内付款,否则将自动取消订单</text> <text>请在 {{residuePayTime}} 内付款,否则将自动取消订单</text>
</view> </view>
</view> </view>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<text>订单已过期</text> <text>订单已过期</text>
</view> </view>
<view class="state-content-tip row"> <view class="state-content-tip row">
<text>内付款,否则将自动取消订单</text> <text>有效期xxx-xxx</text>
</view> </view>
</view> </view>
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<text>订单已取消</text> <text>订单已取消</text>
</view> </view>
<view class="state-content-tip row"> <view class="state-content-tip row">
<text>内付款,否则将自动取消订单</text> <text>下单后15分钟内未付款,自动取消订单</text>
</view> </view>
</view> </view>
...@@ -79,7 +79,6 @@ ...@@ -79,7 +79,6 @@
<text class="info-content-item-tip">18030303030</text> <text class="info-content-item-tip">18030303030</text>
</view> </view>
</view> </view>
<view class="info-line row con-b align-c"> <view class="info-line row con-b align-c">
<view class="info-line-point-left"></view> <view class="info-line-point-left"></view>
<view class="info-line-line"></view> <view class="info-line-line"></view>
......
...@@ -18,9 +18,7 @@ Page({ ...@@ -18,9 +18,7 @@ Page({
data: { data: {
imageBase: App.globalData.appImageBase, imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase, resourcesBase: App.globalData.appResourcesBase,
animation: {}, animation: {},
shopInfo: {}, shopInfo: {},
orderId: '', orderId: '',
orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影 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