123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352 |
- <template>
- <view>
- <view v-if="step">
- <u-navbar :title="title" title-color="#101010" :is-back="false" >
-
- </u-navbar>
- <view class="main2">
- <view class="item" v-for="(item,i) in meterList" :key="i" >
- <view class="item1">
- <view class="item11">{{item.name}}</view>
- <view class="item12">电源状态:<span>{{item.switchStatus?'开':'关'}}</span></view>
- </view>
-
- <view class="item2" >
- <span>关</span>
- <u-switch size="32" @change="switchBtnApi(item,$event)"
- v-model="item.switchStatus" inactive-color="#ff9900" ></u-switch >
- <span>开</span>
- </view>
-
- </view>
- </view>
- </view>
- <view v-if="!step">
- <u-navbar title="填写申请人信息" title-color="#101010" :is-back="false" >
-
- </u-navbar>
- <view class="main">
-
- <view class="item">
- <view class="title">
- 二维码
- </view>
- <view class="value">
- {{title}}
- </view>
-
- </view>
- <view class="item">
- <view class="title">
- <span>*</span>姓名
- </view>
- <view class="value">
- <input type="text" v-model="name" placeholder="请填写姓名" />
- </view>
-
- </view>
-
- <view class="item">
- <view class="title">
- <span>*</span>联系电话
- </view>
- <view class="value">
- <input type="text" v-model="phone" placeholder="请填写手机号码" />
- </view>
-
- </view>
-
- </view>
-
-
- <!-- 提交 -->
- <button class="submit" @click="submit" >提交</button>
-
- </view>
-
-
-
- <!-- 提交反馈 -->
- <u-modal v-model="show" :show-title="false" :show-cancel-button="true" cancel-text="关闭" :show-confirm-button="false" >
- <view class="modal">
- <view class="success-icon">
- <img src="@/assets/img/md-check_circle vRxbRvD@3x.png" alt="" />
- </view>
- <view class="success-text">
- 授权申请提交成功
- </view>
- <view class="wait">
- 请等待单位能源管理员审核通过
- </view>
-
- </view>
-
- </u-modal>
-
- </view>
- </template>
- <script>
- import * as API_energyManage from '@/apis/pagejs/energyManage.js'
-
- import * as API from '@/apis/pagejs/managementList.js'
- import {
- checkPhone
- } from '@/apis/utils'
- export default {
- data() {
- return {
- show:false,
- meterId:"",
- id:"",
- name:"",
- phone:"",
- title:"",
- step:false,
- meterList:[],
- }
- },
- onLoad(op) {
- this.id=op.id
-
- this.getInformation()
- },
- methods: {
- switchBtnApiMethod(node,key){
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- API_energyManage.remoteSwitch({
- meterId:node.id,
- enabled:key
- }).then((res) => {
- uni.hideLoading();
- node.switchStatus=key
-
- }).catch(error => {
-
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- switchBtnApi(node,key){
- uni.showModal({
- confirmColor:`${key?'#3CC51F':'red'}`,
- confirmText:`${key?'开启':'关闭'}`,
- content: `确认是否要"${key?'开启':'关闭'}"${node.name}`,
- title: "提示",
- success:res=> {
- if(res.confirm){
- //this.switchBtnApiMethod(node,key);
- }else{
- node.switchStatus=!key
- }
- }
- })
- console.log(node,key)
- },
- getInformation(){
- if(!this.carhelp.getOpenId()){
- uni.showToast({
- icon: "none",
- title: "未获取到OpenId,请使用微信扫码"
- })
- return
- }
-
-
-
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- API.information({
- id:this.id,
- openId:this.carhelp.getOpenId(),
- }).then((res) => {
- this.title=res.data.information.title
- uni.hideLoading();
- //this.show=true
- var info=res.data.applicationInfo;
-
- if(info&&info.status==1){
- this.step=true
- this.meterList=res.data.meterList
- var img=require('@/assets/img/controlCover.png')
- var s='background:url('+img+') center fixed;background-size:cover;';
- console.log(s)
- document.getElementsByTagName("uni-page")[0].style=s
-
- }
-
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- submit(){
- if(!this.carhelp.getOpenId()){
- uni.showToast({
- icon: "none",
- title: "未获取到OpenId,请使用微信扫码"
- })
- return
- }
-
-
- if(!this.name.length){
- uni.showToast({
- icon: "none",
- title: "请输入姓名"
- })
- return
- }
-
-
- var checkPhoneResult = checkPhone(this.phone);
-
- if (checkPhoneResult !== true) {
- uni.showToast({
- icon: "none",
- title: checkPhoneResult,
-
- })
- return;
- }
-
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- API.apply({
- id:this.id,
- name:this.name,
- phone:this.phone,
- openId:this.carhelp.getOpenId(),
- }).then((res) => {
-
- uni.hideLoading();
- this.show=true
-
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- }
-
- }
- }
- </script>
- <style lang="scss" scoped>
- page{
- //background: url('@/assets/img/controlCover.png') center fixed ;
- //background-size:cover;
- }
- .main2{
- margin: 24rpx 0;
- .item{
- margin: 32rpx ;
- padding: 32rpx ;
- background-color: #fff;
- border-radius: 15px;
-
- display: flex;
- align-items: center;
- justify-content: space-between;
- .item11{
- font-size: 32rpx;
- color: rgba(51,51,51,1);
- font-weight: bold;
- }
- .item12{
- font-size: 24rpx;
- color:#777777 ;
- span{
- font-weight: bold;
- color: rgba(51,51,51,1);
- }
- }
- .item2{
- display: flex; align-items: center;
- }
- }
- }
- .main{
- margin: 24rpx 0;
- background-color: #fff;
- .item{
- padding: 24rpx 32rpx;
- display: flex;
- align-items: center;
- border-bottom: 1px solid rgba(221,221,221,1);
- .title{
- width: 30%;
- color: #777777;
- font-size: 32rpx;
- span{
- color: #EE3138;
- }
- }
- .value{
-
- img{
- width: 80rpx;
-
- }
- .uni-input-placeholder{
- color: rgba(204,204,204,1);;
- }
- }
- .icon{
- margin-left: auto;
- }
- }
- .item:last-of-type{
- border: none;
- }
-
- }
-
- // 提交
- .submit{
- background-color: rgba(22,119,255,1);
- color: rgba(255,255,255,1);
- margin: 0 32rpx;
- border-radius: 50px;
- }
- // 提交反馈
- .modal{
- text-align: center;
- .success-icon{
- margin-top: 24rpx;
- img{
- width: 132rpx;
- height: 132rpx;
-
- }
- }
- .success-text{
- color: rgba(16,16,16,1);
- font-size: 36rpx;
- margin-top: 16rpx;
- font-weight: bold;
-
- }
- .wait{
- margin-top: 10rpx;
- margin-bottom: 48rpx;
- }
- }
- </style>
|