ts_aimz/pages/mine/mineIndex/mine.js

126 lines
3.5 KiB
JavaScript
Raw Normal View History

2025-03-21 18:05:54 +08:00
// pages/mine/mine.js
2025-03-31 18:23:29 +08:00
import UserApi from '../../../net/api/userApi'
2025-04-03 17:40:39 +08:00
import {
copyrightUrl
} from '../../../net/http'
2025-04-03 10:44:12 +08:00
const Utils = require('../../../utils/util')
2025-03-21 18:05:54 +08:00
const app = getApp()
2025-03-24 18:05:54 +08:00
const deviceInfo = wx.getDeviceInfo()
const screenInfo = wx.getWindowInfo();
const statusBarHeight = screenInfo.statusBarHeight; // 状态栏高度
const navBarHeight = deviceInfo.platform == 'IOS' ? 48 : 50; // 导航栏高度iOS 为 44pxAndroid 为 48px
const windowHeight = screenInfo.windowHeight - navBarHeight - statusBarHeight; //可用内容高度
2025-03-21 18:05:54 +08:00
Page({
/**
* 页面的初始数据
*/
data: {
statusBarHeight: statusBarHeight,
navBarHeight: navBarHeight,
totalHeight: navBarHeight, // 导航栏总高度
contentHeight: windowHeight,
2025-03-31 18:23:29 +08:00
allCount: 0,
materialCount: 0,
accountInfo: {},
2025-03-21 18:05:54 +08:00
menuList: [{
2025-04-03 17:40:39 +08:00
"icon": "ic-user",
"title": "个人信息",
"path": "/pages/mine/mineAccount/mineInfo/mineInfo"
2025-03-21 18:05:54 +08:00
}, {
2025-04-03 17:40:39 +08:00
"icon": "ic-order",
"title": "我的订单",
"path": "/pages/mine/mineAccount/mineOrder/mineOrder"
2025-03-21 18:05:54 +08:00
}, {
2025-04-03 17:40:39 +08:00
"icon": "ic-invoice",
"title": "发票管理",
"path": ""
2025-03-21 18:05:54 +08:00
}, {
2025-04-03 17:40:39 +08:00
"icon": "ic-contact",
"title": "产权联系人",
2025-04-07 11:04:08 +08:00
"path": "/pages/mine/mineAccount/mineContact/mineContact"
}],
buttons: [{
text: '知道了'
}],
hintTxt: '',
showHint: false
2025-03-21 18:05:54 +08:00
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
2025-03-31 18:23:29 +08:00
const _self = this
_self.getMineAccount()
_self.getMinePackageCount()
2025-04-03 10:44:12 +08:00
const h = Utils.pxToRpx(_self.data.contentHeight)
_self.setData({
contentHeight: h
})
},
onShow(options) {
this.getMineAccount() //获取账户信息
this.getMinePackageCount() //获取套餐包信息
2025-03-31 18:23:29 +08:00
},
getMineAccount() {
const _self = this
UserApi.doGetMineAccount()
.then(res => {
_self.setData({
accountInfo: res
})
}, err => {
console.log(err)
})
},
getMinePackageCount() {
2025-04-03 10:44:12 +08:00
const _self = this
2025-03-31 18:23:29 +08:00
UserApi.doGetMinePackageCount()
.then(res => {
console.log(res)
2025-04-03 10:44:12 +08:00
_self.setData({
allCount: res.ALL,
materialCount: res.MATERIAL
})
2025-03-31 18:23:29 +08:00
}, err => {
console.log(err)
2025-04-03 10:44:12 +08:00
_self.setData({
allCount: 0,
materialCount: 0
})
2025-03-31 18:23:29 +08:00
})
},
//优惠卷
doCoupons() {
wx.navigateTo({
url: '/pages/mine/mineAccount/mineCoupons/mineCoupons',
})
2025-03-21 18:05:54 +08:00
},
2025-03-24 18:05:54 +08:00
//跳转充值页面
doPay() {
wx.navigateTo({
url: '/pages/copyright/payment/payment',
})
2025-04-03 17:40:39 +08:00
},
//条目点击
itemClick(e) {
const path = e.currentTarget.dataset.path
if (path == '') {
2025-04-07 11:04:08 +08:00
this.setData({
showHint: true,
hintTxt: `鉴于功能特性,需在电脑端完成操作。请打开浏览器,登录网址${copyrightUrl},进行后续操作。`
2025-04-03 17:40:39 +08:00
})
} else {
wx.navigateTo({
url: path,
})
}
2025-04-07 11:04:08 +08:00
},
closeHint(e) {
this.setData({
showHint: false,
hintTxt: ''
})
2025-03-24 18:05:54 +08:00
}
2025-03-21 18:05:54 +08:00
})