70 lines
1.3 KiB
JavaScript
70 lines
1.3 KiB
JavaScript
/*
|
|
* 手太欠
|
|
* 企获客商城
|
|
*/
|
|
|
|
const app = getApp()
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
stateType : 'ALL', //订单类型
|
|
orderArr : [], //订单列表
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad (options) {},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
if(wx.getStorageSync("token") == ""){
|
|
wx.navigateTo({
|
|
url: '/pages/login/login'
|
|
})
|
|
return
|
|
}
|
|
|
|
// 获取订单列表
|
|
this.orderInfo()
|
|
},
|
|
|
|
/**
|
|
* 订单列表
|
|
*/
|
|
orderInfo(){
|
|
wx.$api.orders.index().then(res=>{
|
|
console.log(res.data)
|
|
this.setData({
|
|
orderArr : res.data
|
|
})
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 订单支付
|
|
*/
|
|
orderPay(e){
|
|
let orderId = e.currentTarget.dataset.orderid
|
|
wx.navigateTo({
|
|
url: '/pages/many_pay/many_pay?orderid=' + orderId + "&type=orderPay",
|
|
})
|
|
|
|
},
|
|
|
|
/**
|
|
* 取消订单
|
|
*/
|
|
orderDelete(e) {
|
|
let orderId = e.currentTarget.dataset.orderid
|
|
wx.$api.orders.cancel(orderId).then(res=>{
|
|
// 获取列表
|
|
this.orderInfo()
|
|
})
|
|
},
|
|
}) |