123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- // pages/user/user.js
- var http = require("../../utils/http.js");
- var util = require("../../utils/util.js");
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- orderAmount: '',
- sts: '',
- collectionCount: 0
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function(options) {
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function() {
- //加载订单数字
- var ths = this;
- // var status = ths.data.status
- wx.showLoading();
- var params = {
- url: "/p/myOrder/orderCount",
- method: "GET",
- data: {},
- callBack: function(res) {
- wx.hideLoading();
- ths.setData({
- orderAmount: res
- });
- }
- };
- http.request(params);
- this.showCollectionCount();
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function() {
- },
- toDistCenter: function () {
- wx.showToast({
- icon: "none",
- title: '该功能未开源'
- })
- },
- toCouponCenter: function() {
- wx.showToast({
- icon: "none",
- title: '该功能未开源'
- })
- },
- toMyCouponPage: function() {
- wx.showToast({
- icon: "none",
- title: '该功能未开源'
- })
- },
- toAddressList: function() {
- wx.navigateTo({
- url: '/pages/delivery-address/delivery-address',
- })
- },
- // 跳转绑定手机号
- toBindingPhone: function() {
- wx.navigateTo({
- url: '/pages/binding-phone/binding-phone',
- })
- },
- /**
- * 退出登录
- */
- logout: function() {
- // 请求退出登陆接口
- http.request({
- url: '/logOut',
- method: 'post',
- callBack: res => {
- util.removeTabBadge()
- wx.removeStorageSync('loginResult');
- wx.removeStorageSync('token');
- // this.$Router.pushTab('/pages/index/index')
- wx.showToast({
- title: "退出成功",
- icon: "none"
- })
-
- this.setData({
- orderAmount: ''
- });
- setTimeout(() => {
- wx.switchTab({
- url: "/pages/index/index"
- })
- }, 1000)
- }
- })
- },
- toOrderListPage: function(e) {
- var sts = e.currentTarget.dataset.sts;
- wx.navigateTo({
- url: '/pages/orderList/orderList?sts=' + sts,
- })
- },
- /**
- * 查询所有的收藏量
- */
- showCollectionCount: function() {
- var ths = this;
- wx.showLoading();
- var params = {
- url: "/p/user/collection/count",
- method: "GET",
- data: {},
- callBack: function(res) {
- wx.hideLoading();
- ths.setData({
- collectionCount: res
- });
- }
- };
- http.request(params);
- },
- /**
- * 我的收藏跳转
- */
- myCollectionHandle: function() {
- var url = '/pages/prod-classify/prod-classify?sts=5';
- var id = 0;
- var title = "我的收藏商品";
- if (id) {
- url += "&tagid=" + id + "&title=" + title;
- }
- wx.navigateTo({
- url: url
- })
- }
- })
|