You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.0 KiB

4 years ago
// pages/my_order/my_order.js
import {
http,login_check
} from '../../../utils/util'
Page({
/**
* 页面的初始数据
*/
data: {
order_status:[null,'已支付','待支付','客服取消',null,null,'已打票',null,null,'重打申请中','重打申请通过','重打申请不通过','已完成',null,null,'已过期'],
active:0,
switch_:["麻花官网","合作平台"],
},
onChange(event) {
this.setData({
_type:event.detail.name+1
})
},
detail(e){
wx.navigateTo({
url: '/pages/user/order_detail/order_detail?order_no='+e.currentTarget.dataset.order_no,
})
},
pay(e){
wx.navigateTo({
url: '/pages/user/order_detail/order_detail?order_no='+e.currentTarget.dataset.order_no,
})
},
cancel(e){
wx.showModal({
content: '是否取消订单',
success(res) {
if (res.confirm) {
http("/api/v1/order-cancel","post",{order_no:e.currentTarget.dataset.order_no}).then(res=>{
wx.showToast({
title: '取消订单成功!',
duration: 2000
})
this.onLoad()
this.onShow()
})
}}})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if(login_check(1)){
http("/api/v1/order-list","get",{type:1}).then(res=>{
this.setData({order_list:res.order_list,
_type:res.type})
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})