123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- // pages/tabber/news/index.js
- import Dialog from '../../../miniprogram_npm/@vant/weapp/dialog/dialog';
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- orderList: [],
- status: 0,
- logisticsStatus: "",
- page_load:false,
- pageindex: 1
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- //this.alert()
- this.getorderList()
- this.setData({
- logisticsStatus: app.globalData.logisticsStatus,
- page_load:true
- })
- },
- onShow() {
- },
- onHide(){
- console.log("隐藏")
- this.setData({
- page_load:false
- })
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- this.setData({pageindex:this.data.pageindex+=1})
- this.getorderList()
- },
- alert() {
- Dialog.alert({
- title: '退费说明',
- message: `
- 本次服务实际发生费用26.00元(抵扣优
- 惠后),订单完成后剩余10.00元会原路
- 退回到您的支付账户。实际到账时间请
- 以银行及第三方支付机构退款时间为准,
- 通常不超过7个工作日。`,
- messageAlign: 'left',
- confirmButtonText: "我知道了",
- }).then(() => {
- // on close
- });
- },
- detail(e) {
- wx.navigateTo({
- url: '/pages/order/detail/detail?order_no='+ e.currentTarget.dataset.no,
- })
- },
- onClick(event) {
- // wx.showToast({
- // title: `点击标签 ${event.detail.name}`,
- // icon: 'none',
- // });
- this.getorderList(event.detail.name);
- },
- toDetail(e) {
- wx.navigateTo({
- url: '/pages/order/detail/detail?order_no=' + e.currentTarget.dataset.no,
- })
- },
- getorderList(se) {
- var that = this;
- var status = se ? se : this.data.status;
- app.api.useApi(app.globalData.baseAppUrl + "api/order/index", {
- status: status,
- page: that.data.pageindex
- }, "get").then(function (res) {
- if (res.code != 200) {
- console.log(res.message.msg)
- wx.showLoading({
- title: '订单加载失败',
- })
- that.setData({pageindex: that.data.pageindex -= 1})
- } else {
- if (that.data.pageindex == 1) {
- that.setData({orderList: []})
- }
- if (res.message.data.data.length > 0) {
- that.setData({orderList: that.data.orderList.concat(res.message.data.data)})
- } else {
- that.setData({pageindex: that.data.pageindex -= 1})
- }
- }
- wx.hideLoading();
- }).catch(function (err) {
- console.log(222);
- })
- },
- pay(e){
- wx.navigateTo({
- url: '/pages/my/cashier/cashier?order_no='+e.currentTarget.dataset.oid,
- })
- },
- closOrder(e) {
- console.log(e);
- var that = this;
- var order = e.currentTarget.dataset.oid
- wx.showModal({
- title: '取消订单',
- content: '确认确认取消订单吗?',
- success: function (res) {
- if (res.confirm) {//这里是点击了确定以后
- app.api.useApi(app.globalData.baseAppUrl + "api/CancelOrders", {
- order_id: order,
- }, "post").then(function (res) {
- if (res.code != 200) {
- console.log(res.message.msg)
- wx.showToast({
- title: '取消成功',
- })
- console.log(getCurrentPages().length);
- that.getorderList();
- } else {
- wx.showLoading({
- title: res.message.msg,
- })
- }
- wx.hideLoading();
- }).catch(function (err) {
- console.log(err);
- })
- } else {//这里是点击了取消以后
- console.log('用户点击取消')
- return false;
- }
- }
- })
- },
- onTabItemTap(e){
- if(!this.data.page_load){
- this.getorderList()
- }
-
- }
- })
|