123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- const app = getApp();
- Page({
- data: {
- images: {
- logo:'/static_file/logo.png',
- background:'/static_file/background.png',
- card:'/static_file/card.png',
- tzd:'/static_file/backgrountzdd.png',
- phone:'/static_file/phone.png',
- yl:'/static_file/background.yl',
- jcsfcjtzd:'/static_file/jcsfcjtzd.png',
- kapiantubiao:'/static_file/kapiantubiao.png'
- },
- // 用户信息
- userInfo: {
- name: "",
- accountNumber: "",
- address: ""
- },
-
- // 账单信息
- billInfo: {
- totalAmount: 0, // 总计应缴
- waterUsage: 0, // 用水量
- balance: 0 // 账户余额
- },
- // 功能按钮配置
- functionList: [
- {
- icon: '/static_file/zdlb.png',
- text: '账单列表',
- url: '/pages/zhangdanlist/zhangdanlist'
- },
- {
- icon: '/static_file/jfjl.png',
- text: '缴费记录',
- // url: '/pages/feedback/feedback'
- },
- {
- icon: '/static_file/yhbx.png',
- text: '用户报修',
- url: '/pages/baoxiudj/baoxiudj'
- },
- {
- icon: '/static_file/tzgg.png',
- text: '通知公告',
- url: '/pages/tongzhiList/tongzhiList'
- },
- {
- icon: '/static_file/ckys.png',
- text: '户号绑定',
- url: '/pages/huhaoguanli/huhaoguanli'
- },
- {
- icon: '/static_file/yjfk.png',
- text: '投诉建议',
- url: '/pages/tousujianyi/tousujianyi'
- }
- ],
- // 活动信息
- activity: {
- title: '净水器活动',
- subtitle: '预留入口',
- imageUrl: '/static_file/background.png'
- }
- },
- onLoad() {
- debugger;
- let refresh= app.globalData.refresh;
- if(refresh==1){
- wx.showLoading({
- title: '加载中...',
- });
- if(!app.globalData.userWxInfo.token){
- wx.hideLoading();
- return;
- }
- const _this = this;
- debugger;
- wx.request({
- url: app.globalData.interfaceUrls.homePageInfo+app.globalData.currentAccountInfo.usernumber,
- method: 'GET',
- header: {
- 'content-type': 'application/json', // 默认值
- 'token':app.globalData.userWxInfo.token,
- 'source':"wc",
- '!SAAS_LOGIN_TOKEN_!':app.globalData.currentAccountInfo.dsKey
- },
- success (res) {
- wx.hideLoading();
- let apiReturnData=res.data;
- debugger;
- _this.setData({
- billInfo:{
- totalAmount:apiReturnData.data.duFees, // 总计应缴
- waterUsage:apiReturnData.data.waterConsumption, // 用水量
- balance: apiReturnData.data.accountbalance // 账户余额
- },
- userInfo:{
- name: apiReturnData.data.username,
- accountNumber: apiReturnData.data.usernumber,
- address: apiReturnData.data.address
- },
- })
- },
- fail(error) {
- wx.hideLoading()
- utils.simleInfo('登录失败,请稍后再试')
- }
- })
- }
- },
- onShow() {
-
- },
-
- // 切换水表
- handleSwitchMeter() {
- wx.navigateTo({
- // url: '/pages/meterList/meterList'
- })
- },
- // 充值缴费
- handlePayment() {
- wx.navigateTo({
- // url: '/pages/payment/payment'
- })
- },
- // 功能按钮点击事件
- handleFunctionClick(e) {
- const index = e.currentTarget.dataset.index
- const item = this.data.functionList[index]
-
- if (item && item.url) {
- wx.navigateTo({
- url: item.url,
- fail: function(err) {
- console.error('页面跳转失败:', err)
- wx.showToast({
- title: '功能开发中',
- icon: 'none',
- duration: 2000
- })
- }
- })
- } else {
- wx.showToast({
- title: '功能开发中',
- icon: 'none',
- duration: 2000
- })
- }
- },
- // 查看账单列表
- handleViewBill() {
- wx.navigateTo({
- // url: '/pages/billList/billList'
- })
- },
- // 查看更多活动
- handleMoreActivity() {
- wx.navigateTo({
- // url: '/pages/activityList/activityList'
- })
- },
- // 跳转到立即缴费页面
- goToPayment: function() {
- wx.navigateTo({
- url: '/pages/lijijiaofei/lijijiaofei',
- })
- },
-
- // 跳转到通知公告列表页面
- goToNoticeList: function() {
- wx.navigateTo({
- url: '/pages/tongzhiList/tongzhiList'
- })
- }
- })
|