123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- // index.js
- var app = getApp()
- Page({
- data: {
- userId : '',
- userInfo: {},
- phone:'',
- hidden : 'hidden',
- userListInfo1: [{
- icon: '/images/mine_order.png',
- text: '我的订单',
- url:"/pages/orderList/orderList?isSelect=1"
- }, {
- icon: '/images/mine_collect.png',
- text: '我的收藏',
- addclass:"no_border",
- url: "/pages/mineCollect/mineCollect"
- }],
- userListInfo2: [
- {
- icon: '/images/mine_coupon.png',
- text: '优惠券',
- addclass: "no_border",
- url: "/pages/mineCoupon/coupon"
- }],
- userListInfo3: [{
- icon: '/images/mine_address.png',
- text: '我的地址',
- url: "/pages/mineAddress/mineAddress"
- }, {
- icon: '/images/mine_help.png',
- text: '帮助及意见反馈',
- addclass: "no_border",
- url: "/pages/problemList/problemList"
- }],
- userRole : 0, //用户身份【普通用户 / 商务用户】
- hiddenmodal: true, //提示弹窗
- modalCont: '', //提示内容
- },
- onLoad: function () {
- var that = this;
- var openid = getApp().globalData.openid;
- var un_id = getApp().globalData.un_id;
- var host = getApp().globalData.servsers;
- wx.showNavigationBarLoading();
- wx.request({
- url: host + "phoneapi/phoneall",
- data: {},
- method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
- header: {
- 'Accept': 'application/json'
- },
- success: function (res) {
- that.setData({
- phone: res.data.rows[0].phone,
- });
- if (res == null || res.data == null) {
- console.error('网络请求失败');
- return;
- }
- wx:wx.hideNavigationBarLoading(
- that.setData({
- hidden : ''
- })
- )
- }
- });
- that.setData({
- userInfo: getApp().globalData.userInfo,
- userId: getApp().globalData.un_id
- })
-
- },
- //重新加载
- onShow: function () {
- var that = this;
- var host = getApp().globalData.servsers;
- var un_id = getApp().globalData.un_id;
- var openid = getApp().globalData.openid;
- var userInfo = getApp().globalData.userInfo;
- var userRole = getApp().globalData.userRole;
- // if ((un_id == undefined || un_id == '' || un_id == null) || (openid == undefined || openid == '' || openid == null)) {
- // wx.navigateTo({
- // url: '/pages/authorize/authorize?link=mine',
- // })
- // } else {
- userInfo = getApp().globalData.userInfo;
-
- //查询用户身份
- // getApp().getUserRole(un_id);//获取用户角色
- // userRole = getApp().globalData.userRole;
- // }
- that.setData({
- userInfo: userInfo,
- userId: un_id,
- userRole: userRole
- })
- },
- //我的订单
- linkOrder: function () {
- var that = this;
- var un_id = getApp().globalData.un_id;
- var openid = getApp().globalData.openid;
- if ((un_id == undefined || un_id == '' || un_id == null) || (openid == undefined || openid == '' || openid == null)){
- wx.navigateTo({
- url: '/pages/authorize/authorize?link=orderList',
- })
- }else{
- wx.navigateTo({
- url: '/pages/orderList/orderList?isSelect=0'
- })
- }
- },
- //我的礼物
- linkGift: function () {
- var that = this;
- var un_id = getApp().globalData.un_id;
- var openid = getApp().globalData.openid;
- if ((un_id == undefined || un_id == '' || un_id == null) || (openid == undefined || openid == '' || openid == null)) {
- wx.navigateTo({
- url: '/pages/authorize/authorize?link=mineGiftList',
- })
- } else {
- wx.navigateTo({
- url: '/pages/mineGiftList/mineGiftList'
- })
- }
- },
- //我的地址
- linkAddress: function () {
- var that = this;
- var un_id = getApp().globalData.un_id;
- var openid = getApp().globalData.openid;
- if ((un_id == undefined || un_id == '' || un_id == null) || (openid == undefined || openid == '' || openid == null)) {
- wx.navigateTo({
- url: '/pages/authorize/authorize?link=mineAddress',
- })
- } else {
- wx.navigateTo({
- url: '/pages/mineAddress/mineAddress'
- })
- }
- },
- //我的收藏
- linkCollect: function () {
- var that = this;
- var un_id = getApp().globalData.un_id;
- var openid = getApp().globalData.openid;
- if ((un_id == undefined || un_id == '' || un_id == null) || (openid == undefined || openid == '' || openid == null)) {
- wx.navigateTo({
- url: '/pages/authorize/authorize?link=mineCollect',
- })
- } else {
- wx.navigateTo({
- url: '/pages/mineCollect/mineCollect'
- })
- }
- },
- //下拉刷新
- onPullDownRefresh: function (e) {
- var that = this;
- that.onLoad();
- wx.stopPullDownRefresh();
- },
- //我的收益
- mineEarnings:function(e){
- var that = this;
- var userRole = that.data.userRole;
- wx.navigateTo({
- url: '/pages/jianshe/jianshe',
- })
- // if (userRole == 0){//普通用户
- // wx.navigateTo({
- // url: '/pages/partnerMineEarnings/partnerMineEarnings',
- // })
- // }else{
- // wx.navigateTo({
- // url: '/pages/partnerBusinessEarnings/partnerBusinessEarnings',
- // })
- // }
- }
- })
- var that;
- var Util = require('../../utils/util.js');
|