待付款已收货订单php,微信小程序待付款收货订单列表页样式设计制作开发教程(3)...

编程入门 行业动态 更新时间:2024-10-25 13:20:43

var wxpay = require('../../utils/pay.js')

var app = getApp()

Page({

data:{

statusType: ["待付款", "待发货", "待收货", "待评价", "已完成"],

currentType:0,

tabClass: ["", "", "", "", ""]

},

statusTap:function(e){

var curType = e.currentTarget.dataset.index;

this.data.currentType = curType

this.setData({

currentType:curType

});

this.onShow();

},

orderDetail : function (e) {

var orderId = e.currentTarget.dataset.id;

wx.navigateTo({

url: "/pages/order-details/index?id=" + orderId

})

},

cancelOrderTap:function(e){

var that = this;

var orderId = e.currentTarget.dataset.id;

wx.showModal({

title: '确定要取消该订单吗?',

content: '',

suess: function(res) {

if (res.confirm) {

wx.showLoading();

wx.request({

url: 'api.it120./' + app.globalData.subDomain + '/order/close',

data: {

token: app.globalData.token,

orderId: orderId

},

suess: (res) => {

wx.hideLoading();

if (res.data.code == 0) {

that.onShow();

}

}

})

}

}

})

},

toPayTap:function(e){

var that = this;

var orderId = e.currentTarget.dataset.id;

var money = e.currentTarget.dataset.money;

wx.request({

url: 'api.it120./' + app.globalData.subDomain + '/user/amount',

data: {

token: app.globalData.token

},

suess: function (res) {

if (res.data.code == 0) {

// res.data.data.balance

money = money - res.data.data.balance;

if (money <= 0) {

// 直接使用余额支付

wx.request({

url: 'api.it120./' + app.globalData.subDomain + '/order/pay',

method:'POST',

header: {

'content-type': 'application/x-www-form-urlencoded'

},

data: {

token: app.globalData.token,

orderId: orderId

},

suess: function (res2) {

wx.reLaunch({

url: "/pages/order-list/index"

});

}

})

} else {

wxpay.wxpay(app, money, orderId, "/pages/order-list/index");

}

} else {

wx.showModal({

title: '错误',

content: '无法获取用户资金信息',

showCancel: false

})

}

}

})

},

onLoad:function(options){

// 生命周期函数--监听页面加载

},

onReady:function(){

// 生命周期函数--监听页面初次渲染完成

},

getOrderStatistics : function () {

var that = this;

wx.request({

url: 'api.it120./' + app.globalData.subDomain + '/order/statistics',

data: { token: app.globalData.token },

suess: (res) => {

wx.hideLoading();

if (res.data.code == 0) {

var tabClass = that.data.tabClass;

if (res.data.data.count_id_no_pay > 0) {

tabClass[0] = "red-dot"

} else {

tabClass[0] = ""

}

if (res.data.data.count_id_no_transfer > 0) {

tabClass[1] = "red-dot"

} else {

tabClass[1] = ""

}

if (res.data.data.count_id_no_confirm > 0) {

tabClass[2] = "red-dot"

} else {

tabClass[2] = ""

}

if (res.data.data.count_id_no_reputation > 0) {

tabClass[3] = "red-dot"

} else {

tabClass[3] = ""

}

if (res.data.data.count_id_suess > 0) {

//tabClass[4] = "red-dot"

} else {

//tabClass[4] = ""

}

that.setData({

tabClass: tabClass,

});

}

}

})

},

onShow:function(){

// 获取订单列表

wx.showLoading();

var that = this;

var postData = {

token: app.globalData.token

};

postData.status = that.data.currentType;

this.getOrderStatistics();

wx.request({

url: 'api.it120./' + app.globalData.subDomain + '/order/list',

data: postData,

suess: (res) => {

wx.hideLoading();

if (res.data.code == 0) {

that.setData({

orderList: res.data.data.orderList,

logisticsMap : res.data.data.logisticsMap,

goodsMap : res.data.data.goodsMap

});

} else {

this.setData({

orderList: null,

logisticsMap: {},

goodsMap: {}

});

}

}

})

},

onHide:function(){

// 生命周期函数--监听页面隐藏

},

onUnload:function(){

// 生命周期函数--监听页面卸载

},

onPullDownRefresh: function() {

// 页面相关事件处理函数--监听用户下拉动作

},

onReachBottom: function() {

// 页面上拉触底事件的处理函数

}

})

更多推荐

收货,订单,设计制作,样式,程序

本文发布于:2023-05-20 23:50:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/156735.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:收货   订单   设计制作   样式   程序

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!