接着做首页的充值,,调试接口
This commit is contained in:
		
							
								
								
									
										6
									
								
								app.json
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								app.json
									
									
									
									
									
								
							@@ -1,12 +1,12 @@
 | 
			
		||||
{
 | 
			
		||||
  "pages": [
 | 
			
		||||
    "pages/home/index",
 | 
			
		||||
    "pages/my/index",
 | 
			
		||||
    "pages/handleLogin/index",
 | 
			
		||||
    "pages/member/index",
 | 
			
		||||
    "pages/login/index",
 | 
			
		||||
    "pages/apply/index",
 | 
			
		||||
    "pages/qrCode/index",
 | 
			
		||||
    "pages/my/index",
 | 
			
		||||
    "pages/handleLogin/index",
 | 
			
		||||
    "pages/waitApprove/index",
 | 
			
		||||
    "pages/rechargeRecord/index",
 | 
			
		||||
    "pages/invoiceList/index",
 | 
			
		||||
@@ -35,7 +35,7 @@
 | 
			
		||||
  },
 | 
			
		||||
  "window": {
 | 
			
		||||
    "navigationBarTextStyle": "black",
 | 
			
		||||
    "navigationBarTitleText": "Weixin",
 | 
			
		||||
    "navigationBarTitleText": "华昌宝能用电管理",
 | 
			
		||||
    "navigationBarBackgroundColor": "#ffffff"
 | 
			
		||||
  },
 | 
			
		||||
  "sitemapLocation": "sitemap.json",
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								app.wxss
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								app.wxss
									
									
									
									
									
								
							@@ -8,7 +8,7 @@ page {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.border {
 | 
			
		||||
  border: 1rpx solid #f0f0f0;
 | 
			
		||||
  border: 0.5rpx solid #f0f0f0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.radius12 {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/* components/avatar/index.wxss */
 | 
			
		||||
.wrapper {
 | 
			
		||||
  width: 100rpx;
 | 
			
		||||
  height: 100rpx;
 | 
			
		||||
  width: 150rpx;
 | 
			
		||||
  height: 150rpx;
 | 
			
		||||
  border-radius: 50%;
 | 
			
		||||
  background: radial-gradient(circle, var(--light-green), var(--middle-green),var(--deep-green) );
 | 
			
		||||
  display: flex;
 | 
			
		||||
 
 | 
			
		||||
@@ -18,11 +18,11 @@
 | 
			
		||||
  <view class="content">
 | 
			
		||||
    <template is="content" data="{{title, rightArrow}}" />
 | 
			
		||||
  </view>
 | 
			
		||||
  <view class="borderBottom border" wx:if="{{borderBottom}}"></view>
 | 
			
		||||
  <view class="borderBottom" wx:if="{{borderBottom}}"></view>
 | 
			
		||||
</view>
 | 
			
		||||
<view wx:else  bind:tap="click">
 | 
			
		||||
  <button class="button" open-type="{{openType}}" 	plain="true">
 | 
			
		||||
    <template is="content" data="{{title, rightArrow}}" />
 | 
			
		||||
  </button>
 | 
			
		||||
  <view class="borderBottom border" wx:if="{{borderBottom}}"></view>
 | 
			
		||||
  <view class="borderBottom" wx:if="{{borderBottom}}"></view>
 | 
			
		||||
</view>
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,7 @@
 | 
			
		||||
  border-radius: 5rpx;
 | 
			
		||||
  box-sizing: border-box;
 | 
			
		||||
  width: calc(100% - 64rpx);
 | 
			
		||||
  max-height: 50vh;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.option {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,5 @@
 | 
			
		||||
import { alertInfo } from "../../utils/index";
 | 
			
		||||
 | 
			
		||||
// pages/home/index.js
 | 
			
		||||
Page({
 | 
			
		||||
 | 
			
		||||
@@ -5,15 +7,14 @@ Page({
 | 
			
		||||
   * 页面的初始数据
 | 
			
		||||
   */
 | 
			
		||||
  data: {
 | 
			
		||||
    user: {}
 | 
			
		||||
    user: {},
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * 生命周期函数--监听页面加载
 | 
			
		||||
   */
 | 
			
		||||
  onLoad(options) {
 | 
			
		||||
    const user = wx.getStorageSync('user')
 | 
			
		||||
    this.setData({ user })
 | 
			
		||||
   
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
@@ -21,6 +22,23 @@ Page({
 | 
			
		||||
   */
 | 
			
		||||
  onReady() {
 | 
			
		||||
 | 
			
		||||
  },
 | 
			
		||||
  changeMoney(e) {
 | 
			
		||||
    const { money } = e.currentTarget.dataset;
 | 
			
		||||
    this.setData({
 | 
			
		||||
      money
 | 
			
		||||
    })
 | 
			
		||||
  },
 | 
			
		||||
  onChangeMoney(e) {
 | 
			
		||||
    console.log('e', e)
 | 
			
		||||
    this.setData({ money: Number(e.detail) })
 | 
			
		||||
  },
 | 
			
		||||
  recharge() {
 | 
			
		||||
    const { user, money } = this.data;
 | 
			
		||||
    if (!user || !user.id) {
 | 
			
		||||
      alertInfo("请先登录")
 | 
			
		||||
      return
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  jumpToLogin() {
 | 
			
		||||
    wx.navigateTo({
 | 
			
		||||
@@ -31,7 +49,8 @@ Page({
 | 
			
		||||
   * 生命周期函数--监听页面显示
 | 
			
		||||
   */
 | 
			
		||||
  onShow() {
 | 
			
		||||
 | 
			
		||||
    const user = wx.getStorageSync('user')
 | 
			
		||||
    this.setData({ user })
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,8 @@
 | 
			
		||||
    "van-icon": "@vant/weapp/icon/index",
 | 
			
		||||
    "van-button": "@vant/weapp/button/index",
 | 
			
		||||
    "van-image": "@vant/weapp/image/index",
 | 
			
		||||
    "avatar": "/components/avatar/index"
 | 
			
		||||
    "avatar": "/components/avatar/index",
 | 
			
		||||
    "van-field": "@vant/weapp/field/index"
 | 
			
		||||
  },
 | 
			
		||||
  "navigationStyle": "custom"
 | 
			
		||||
}
 | 
			
		||||
@@ -11,15 +11,19 @@
 | 
			
		||||
    </view>
 | 
			
		||||
  </view>
 | 
			
		||||
</view>
 | 
			
		||||
<custom-status-bar />
 | 
			
		||||
  <view class="chooseParkWrapper">
 | 
			
		||||
   
 | 
			
		||||
  </view>
 | 
			
		||||
<view class="login" wx:if="{{!user || !user.id}}" class="notLoginWrapper">
 | 
			
		||||
  <van-image width="100rpx" height="100rpx" src="/assets/images/defaultAvatar.png" class="defaultAvatar"/>
 | 
			
		||||
  <van-button type="info" size="small" plain="{{true}}" class="loginBtn" bind:tap="jumpToLogin">请登录</van-button>
 | 
			
		||||
</view>
 | 
			
		||||
<view class="logined" wx:else>
 | 
			
		||||
  <avatar text="11" />
 | 
			
		||||
  <avatar text="{{ user.tenement.name.slice(0,2) }}" />
 | 
			
		||||
  <view>
 | 
			
		||||
    <van-button type="info" size="small" plain="{{true}}" class="loginBtn" bind:tap="jumpToLogin">{{user.tenement.name}}</van-button>
 | 
			
		||||
    <view></view>
 | 
			
		||||
    <van-button type="info" size="small" plain="{{true}}" class="loginBtn" >{{user.tenement.name}}    <van-icon name="arrow-down" style="margin-left: 16rpx;" /></van-button>
 | 
			
		||||
    <view class="welcome"> 欢迎使用华昌宝能用电管理系统! </view>
 | 
			
		||||
  </view>
 | 
			
		||||
</view>
 | 
			
		||||
<view class="rechargeWrapper">
 | 
			
		||||
@@ -56,11 +60,21 @@
 | 
			
		||||
  </view>
 | 
			
		||||
  <view class="recharge">
 | 
			
		||||
    <view> 请输入金额: </view>
 | 
			
		||||
    <view>
 | 
			
		||||
      <view> ¥30 </view>
 | 
			
		||||
      <view> ¥50 </view>
 | 
			
		||||
      <view> ¥100 </view>
 | 
			
		||||
      <view> ¥200 </view>
 | 
			
		||||
    <view class="moneyBox">
 | 
			
		||||
      <view class="money" bind:tap="changeMoney" data-money="30"> ¥30 </view>
 | 
			
		||||
      <view class="money" bind:tap="changeMoney" data-money="50"> ¥50 </view>
 | 
			
		||||
      <view class="money" bind:tap="changeMoney" data-money="100"> ¥100 </view>
 | 
			
		||||
      <view class="money" style="margin-right: 0;" bind:tap="changeMoney" data-money="200"> ¥200 </view>
 | 
			
		||||
    </view>
 | 
			
		||||
    <view class="moneyInput">
 | 
			
		||||
      <van-field
 | 
			
		||||
        value="{{ money }}"
 | 
			
		||||
        placeholder="请输入充值金额"
 | 
			
		||||
        border="{{true}}"
 | 
			
		||||
        bind:change="onChangeMoney"
 | 
			
		||||
        size="large"
 | 
			
		||||
        type="number"
 | 
			
		||||
      />
 | 
			
		||||
    </view>
 | 
			
		||||
  </view>
 | 
			
		||||
  <view class="operate">
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,11 @@
 | 
			
		||||
 | 
			
		||||
.top {
 | 
			
		||||
  background-color: var(--deep-green);
 | 
			
		||||
  position: fixed;
 | 
			
		||||
  left: 0;
 | 
			
		||||
  top: 0;
 | 
			
		||||
  width: 100vw;
 | 
			
		||||
  z-index: 99;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.chooseParkWrapper {
 | 
			
		||||
@@ -94,4 +99,28 @@
 | 
			
		||||
.operate {
 | 
			
		||||
  margin-left: 46rpx;
 | 
			
		||||
  margin-right: 46rpx;
 | 
			
		||||
  margin-bottom: 40rpx;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.welcome {
 | 
			
		||||
  margin-top: 20rpx;
 | 
			
		||||
  margin-left: 30rpx;
 | 
			
		||||
  font-size: 32rpx;
 | 
			
		||||
  color: #fff;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.moneyBox {
 | 
			
		||||
  display: flex;
 | 
			
		||||
  justify-content: space-between;
 | 
			
		||||
  margin-top: 30rpx;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.money {
 | 
			
		||||
  flex: 1;
 | 
			
		||||
  padding: 16rpx;
 | 
			
		||||
  display: flex;
 | 
			
		||||
  justify-content: center;
 | 
			
		||||
  align-items: center;
 | 
			
		||||
  border: 1rpx solid #ccc;
 | 
			
		||||
  margin-right: 30rpx;
 | 
			
		||||
}
 | 
			
		||||
@@ -39,19 +39,20 @@ Component({
 | 
			
		||||
    },
 | 
			
		||||
    async setAdmin(e) {
 | 
			
		||||
      const { user, tenement } = e.currentTarget.dataset;
 | 
			
		||||
      await wxModal({ content: `你的管理员身份将转交给${user.nickName}` })
 | 
			
		||||
      await wxModal({ content: `你的管理员身份将转交给${user.name}` })
 | 
			
		||||
      const { code, message } = await approveUser({ userId: user.id, type: 2, tenement })
 | 
			
		||||
      if (code !== OK) {
 | 
			
		||||
        alertInfo(message)
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
      alertSuccess("转交成功")
 | 
			
		||||
      
 | 
			
		||||
      const newUser = wx.getStorageSync('user')
 | 
			
		||||
      newUser.isAdmin = false;
 | 
			
		||||
      wx.setStorageSync('user', newUser)
 | 
			
		||||
      wx.redirectTo({
 | 
			
		||||
      wx.switchTab({
 | 
			
		||||
        url: '/pages/home/index',
 | 
			
		||||
      })
 | 
			
		||||
      alertSuccess("转交成功")
 | 
			
		||||
    },
 | 
			
		||||
    async remove(e) {
 | 
			
		||||
      const { user, tenement } = e.currentTarget.dataset;
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@
 | 
			
		||||
  <van-tab wx:for="{{list}}" wx:key="index" title="{{item.name}}">
 | 
			
		||||
    <view wx:for="{{item.users}}" wx:key="index" wx:for-item="ele"  class="item">
 | 
			
		||||
      <view class="nickName"> {{ ele.name }} </view>
 | 
			
		||||
      <view class="operate">
 | 
			
		||||
      <view class="operate" wx:if="{{!ele.isAdmin}}">
 | 
			
		||||
        <view class="primaryTextBtn" data-user="{{ele}}" bind:tap="setAdmin" data-tenement="{{item.id}}"> 设为管理员 </view>
 | 
			
		||||
        <view class="disAgree dangerTextBtn" data-user="{{ele}}" bind:tap="remove" data-tenement="{{item.id}}"> 移除 </view>
 | 
			
		||||
      </view>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,5 @@
 | 
			
		||||
import { alertInfo } from "../../utils/index";
 | 
			
		||||
import Dialog from '@vant/weapp/dialog/dialog';
 | 
			
		||||
// pages/my/index.js
 | 
			
		||||
Page({
 | 
			
		||||
 | 
			
		||||
@@ -5,17 +7,16 @@ Page({
 | 
			
		||||
   * 页面的初始数据
 | 
			
		||||
   */
 | 
			
		||||
  data: {
 | 
			
		||||
    user: {}
 | 
			
		||||
    user: {},
 | 
			
		||||
    visible: false,
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * 生命周期函数--监听页面加载
 | 
			
		||||
   */
 | 
			
		||||
  onLoad(options) {
 | 
			
		||||
    const user = wx.getStorageSync('user');
 | 
			
		||||
    this.setData({ user })
 | 
			
		||||
    
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * 生命周期函数--监听页面初次渲染完成
 | 
			
		||||
   */
 | 
			
		||||
@@ -41,9 +42,27 @@ Page({
 | 
			
		||||
   * 生命周期函数--监听页面显示
 | 
			
		||||
   */
 | 
			
		||||
  onShow() {
 | 
			
		||||
 | 
			
		||||
    const user = wx.getStorageSync('user');
 | 
			
		||||
    if (!user || !user.id) {
 | 
			
		||||
      wx.switchTab({
 | 
			
		||||
        url: '/pages/home/index',
 | 
			
		||||
      })
 | 
			
		||||
      alertInfo("请先登录");
 | 
			
		||||
      return false;
 | 
			
		||||
    }
 | 
			
		||||
    this.setData({ user })
 | 
			
		||||
  },
 | 
			
		||||
  connect() {
 | 
			
		||||
    Dialog.alert({
 | 
			
		||||
      title: '提示',
 | 
			
		||||
      message: '将进入咨询客服页面',
 | 
			
		||||
      confirmButtonOpenType: "contact",
 | 
			
		||||
      showCancelButton: true,
 | 
			
		||||
    }).then(() => {
 | 
			
		||||
      // on close
 | 
			
		||||
    });
 | 
			
		||||
    
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * 生命周期函数--监听页面隐藏
 | 
			
		||||
   */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,9 @@
 | 
			
		||||
{
 | 
			
		||||
  "usingComponents": {
 | 
			
		||||
    "van-cell": "@vant/weapp/cell/index",
 | 
			
		||||
    "van-cell-group": "@vant/weapp/cell-group/index"
 | 
			
		||||
    "van-cell-group": "@vant/weapp/cell-group/index",
 | 
			
		||||
    "cell": "/components/cell/index",
 | 
			
		||||
    "van-dialog": "@vant/weapp/dialog/index"
 | 
			
		||||
  },
 | 
			
		||||
  "navigationBarTitleText": "我的"
 | 
			
		||||
}
 | 
			
		||||
@@ -4,9 +4,13 @@
 | 
			
		||||
<cell  title="常见问题" bind:click="jumpToQuestions" /> -->
 | 
			
		||||
 | 
			
		||||
<!-- <van-cell-group title=" "> -->
 | 
			
		||||
  <van-cell title="二维码" value="" is-link bind:click="jumpToQrCode" />
 | 
			
		||||
 | 
			
		||||
  <van-cell title="联系客服" value="" is-link bind:tap="connect" />
 | 
			
		||||
  <van-cell wx:if="{{!!user.isAdmin}}" title="二维码" value="" is-link bind:click="jumpToQrCode" />
 | 
			
		||||
  <van-cell wx:if="{{!!user.isAdmin}}" title="成员管理" value="" is-link bind:click="jumpToMember" />
 | 
			
		||||
<!-- </van-cell-group> -->
 | 
			
		||||
<!-- <van-cell-group title=" ">
 | 
			
		||||
  <van-cell title="单元格" value="内容" is-link />
 | 
			
		||||
</van-cell-group> -->
 | 
			
		||||
</van-cell-group> -->
 | 
			
		||||
 | 
			
		||||
<van-dialog id="van-dialog" />
 | 
			
		||||
@@ -1 +1 @@
 | 
			
		||||
/* pages/my/index.wxss */
 | 
			
		||||
/* pages/my/index.wxss */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user