| | |
| | | scrollViewHeight: 0, |
| | | listData: [], |
| | | isRefreshing: false, |
| | | isWXRefreshing: false |
| | | isWXRefreshing: false, |
| | | errorData: '', //错误内容 |
| | | showErrorDialog: false, |
| | | confirmBtn: { |
| | | content: '确认' |
| | | }, |
| | | errorDialogTitle: "关阀错误", |
| | | showForceConfirm: false //是否强制开阀 |
| | | }, |
| | | |
| | | openValve: function (e) { |
| | |
| | | |
| | | }, |
| | | recharge() { |
| | | wx.navigateTo({ |
| | | url: '/pages/rechargeCard/rechargeCard', |
| | | // wx.navigateTo({ |
| | | // url: '/pages/rechargeCard/rechargeCard', |
| | | // }) |
| | | wx.showToast({ |
| | | title: '暂未开放', |
| | | icon: 'none' |
| | | }) |
| | | }, |
| | | openValveList() { |
| | | wx.navigateTo({ |
| | | url: '/pages/valveList/valveList', |
| | | // wx.navigateTo({ |
| | | // url: '/pages/valveList/valveList', |
| | | // }) |
| | | wx.showToast({ |
| | | title: '暂未开放', |
| | | icon: 'none' |
| | | }) |
| | | }, |
| | | feedBack() { |
| | |
| | | }); |
| | | }, |
| | | closeDialog() { |
| | | console.log("closeDialog"); |
| | | this.setData({ |
| | | showConfirm: false, |
| | | showErrorDialog: false, |
| | | showForceConfirm: false |
| | | }); |
| | | }, |
| | | cancelDialog(){ |
| | | this.setData({ |
| | | showForceConfirm: false, |
| | | showConfirm: false |
| | | }); |
| | | }, |
| | |
| | | post({ |
| | | url: "wx/valve/close_wx", |
| | | data: data, |
| | | isShowLoding: false |
| | | isShowLoding: false, |
| | | timeout: 185000 |
| | | }).then(response => { |
| | | |
| | | // 处理成功响应 |
| | |
| | | }) |
| | | }).catch(error => { |
| | | wx.hideLoading(); |
| | | if (error.code === "1002") { |
| | | wx.showToast({ |
| | | title: '关阀失败', |
| | | icon: 'error', |
| | | duration: 3000 // 提示的持续时间,单位毫秒 |
| | | }) |
| | | } |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg, |
| | | errorDialogTitle: "关阀错误" |
| | | }) |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | |
| | |
| | | // 错误回调 |
| | | this.setData({ |
| | | isRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | isWXRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | }) |
| | | wx.showToast({ |
| | | title: err.msg, |
| | | icon: 'error', |
| | | duration: 3000 |
| | | }) |
| | | }); |
| | | }, |
| | |
| | | getUserDataBySession() { |
| | | const app = getApp(); |
| | | const params = { |
| | | url: 'sell/client/simple_info', |
| | | url: 'wx/client/simple_info', |
| | | data: { |
| | | sessionId: app.globalData.sessionId |
| | | } |
| | |
| | | }) |
| | | }).catch(err => { |
| | | // 错误回调 |
| | | |
| | | wx.showToast({ |
| | | title: err.msg, |
| | | icon: 'error', |
| | | duration: 3000 |
| | | }) |
| | | }) |
| | | }, |
| | | maskPhoneNumber(phoneNumber) { |
| | |
| | | // 使用正则表达式替换中间四位数字为星号 |
| | | const maskedPhoneNumber = phoneNumber.replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2"); |
| | | return maskedPhoneNumber; |
| | | }, |
| | | |
| | | closeDialog() { |
| | | this.setData({ |
| | | showErrorDialog: false |
| | | }) |
| | | }, |
| | | /** |
| | | * 扫码开阀 |
| | | */ |
| | | scenCode() { |
| | | const that = this; |
| | | wx.scanCode({ |
| | | success(res) { |
| | | console.log(res.result); // 当且仅当扫码为非微信二维码时,会返回result |
| | | wx.showLoading({ |
| | | title: '正在开阀请稍候...', // 加载提示文字 |
| | | mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false |
| | | }); |
| | | const app = getApp(); |
| | | const data = { |
| | | intakeName: res.result, //取水口ID |
| | | // vcId: vcId, //虚拟卡ID |
| | | operator: app.globalData.sessionId //操作员 |
| | | }; |
| | | post({ |
| | | url: "wx/valve/open_wx", |
| | | data: data, |
| | | timeout: 180000 |
| | | }).then(response => { |
| | | |
| | | // 处理成功响应 |
| | | console.log('请求成功:', response); |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | //完成后回到首页 |
| | | wx.reLaunch({ |
| | | url: '/pages/home/home?param=true' // 首页的路径,根据实际情况填写 |
| | | }); |
| | | }).catch(error => { |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | if (error.code==="1003") { |
| | | that.setData({ |
| | | showForceConfirm:true |
| | | }) |
| | | } else { |
| | | that.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg, |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } |
| | | |
| | | |
| | | }); |
| | | }, |
| | | fail(err) { |
| | | console.error(err); |
| | | } |
| | | |
| | | }) |
| | | }, |
| | | confirmForceDialog(){ |
| | | console.log("confirmForceDialog"); |
| | | } |
| | | |
| | | |
| | | |
| | | }) |