eli 2 年之前
父節點
當前提交
6002e7f829
共有 89 個文件被更改,包括 1962 次插入1 次删除
  1. 二進制
      .DS_Store
  2. 二進制
      erp1/.DS_Store
  3. 1 1
      erp1/project.config.json
  4. 7 0
      erp1/project.private.config.json
  5. 二進制
      erp2/.DS_Store
  6. 19 0
      erp2/app.js
  7. 37 0
      erp2/app.json
  8. 10 0
      erp2/app.wxss
  9. 二進制
      erp2/pages/.DS_Store
  10. 56 0
      erp2/pages/bill/index.js
  11. 4 0
      erp2/pages/bill/index.json
  12. 28 0
      erp2/pages/bill/index.wxml
  13. 69 0
      erp2/pages/bill/index.wxss
  14. 55 0
      erp2/pages/index/index.js
  15. 4 0
      erp2/pages/index/index.json
  16. 9 0
      erp2/pages/index/index.wxml
  17. 29 0
      erp2/pages/index/index.wxss
  18. 45 0
      erp2/pages/list/index.js
  19. 4 0
      erp2/pages/list/index.json
  20. 15 0
      erp2/pages/list/index.wxml
  21. 50 0
      erp2/pages/list/index.wxss
  22. 103 0
      erp2/pages/recharge/index.js
  23. 4 0
      erp2/pages/recharge/index.json
  24. 19 0
      erp2/pages/recharge/index.wxml
  25. 56 0
      erp2/pages/recharge/index.wxss
  26. 38 0
      erp2/pages/record/index.js
  27. 4 0
      erp2/pages/record/index.json
  28. 16 0
      erp2/pages/record/index.wxml
  29. 69 0
      erp2/pages/record/index.wxss
  30. 33 0
      erp2/pages/submitPhone/index.js
  31. 4 0
      erp2/pages/submitPhone/index.json
  32. 6 0
      erp2/pages/submitPhone/index.wxml
  33. 31 0
      erp2/pages/submitPhone/index.wxss
  34. 55 0
      erp2/project.config.json
  35. 7 0
      erp2/project.private.config.json
  36. 7 0
      erp2/sitemap.json
  37. 二進制
      erp2/utils/.DS_Store
  38. 65 0
      erp2/utils/http.js
  39. 二進制
      erp2/utils/images/.DS_Store
  40. 二進制
      erp2/utils/images/home-1.png
  41. 二進制
      erp2/utils/images/home-img1.jpeg
  42. 二進制
      erp2/utils/images/home-img2.jpeg
  43. 二進制
      erp2/utils/images/home.png
  44. 二進制
      erp2/utils/images/jiantou.png
  45. 二進制
      erp2/utils/images/list-1.png
  46. 二進制
      erp2/utils/images/list.png
  47. 26 0
      erp2/utils/ui.js
  48. 19 0
      lt/app.js
  49. 37 0
      lt/app.json
  50. 10 0
      lt/app.wxss
  51. 二進制
      lt/pages/.DS_Store
  52. 56 0
      lt/pages/bill/index.js
  53. 4 0
      lt/pages/bill/index.json
  54. 28 0
      lt/pages/bill/index.wxml
  55. 69 0
      lt/pages/bill/index.wxss
  56. 55 0
      lt/pages/index/index.js
  57. 4 0
      lt/pages/index/index.json
  58. 9 0
      lt/pages/index/index.wxml
  59. 29 0
      lt/pages/index/index.wxss
  60. 45 0
      lt/pages/list/index.js
  61. 4 0
      lt/pages/list/index.json
  62. 15 0
      lt/pages/list/index.wxml
  63. 50 0
      lt/pages/list/index.wxss
  64. 103 0
      lt/pages/recharge/index.js
  65. 4 0
      lt/pages/recharge/index.json
  66. 19 0
      lt/pages/recharge/index.wxml
  67. 56 0
      lt/pages/recharge/index.wxss
  68. 38 0
      lt/pages/record/index.js
  69. 4 0
      lt/pages/record/index.json
  70. 16 0
      lt/pages/record/index.wxml
  71. 69 0
      lt/pages/record/index.wxss
  72. 33 0
      lt/pages/submitPhone/index.js
  73. 4 0
      lt/pages/submitPhone/index.json
  74. 6 0
      lt/pages/submitPhone/index.wxml
  75. 31 0
      lt/pages/submitPhone/index.wxss
  76. 55 0
      lt/project.config.json
  77. 7 0
      lt/project.private.config.json
  78. 7 0
      lt/sitemap.json
  79. 二進制
      lt/utils/.DS_Store
  80. 65 0
      lt/utils/http.js
  81. 二進制
      lt/utils/images/.DS_Store
  82. 二進制
      lt/utils/images/home-1.png
  83. 二進制
      lt/utils/images/home-img1.jpeg
  84. 二進制
      lt/utils/images/home-img2.jpeg
  85. 二進制
      lt/utils/images/home.png
  86. 二進制
      lt/utils/images/jiantou.png
  87. 二進制
      lt/utils/images/list-1.png
  88. 二進制
      lt/utils/images/list.png
  89. 26 0
      lt/utils/ui.js

二進制
.DS_Store


二進制
erp1/.DS_Store


+ 1 - 1
erp1/project.config.json

@@ -49,7 +49,7 @@
     "ignore": [],
     "include": []
   },
-  "appid": "wxaf30a386748b4ed8",
+  "appid": "wx236ddbded03c5fb7",
   "simulatorPluginLibVersion": {},
   "projectname": "dghd_miniapp"
 }

+ 7 - 0
erp1/project.private.config.json

@@ -0,0 +1,7 @@
+{
+  "projectname": "erp1",
+  "setting": {
+    "compileHotReLoad": true
+  },
+  "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html"
+}

二進制
erp2/.DS_Store


+ 19 - 0
erp2/app.js

@@ -0,0 +1,19 @@
+// app.js
+App({
+  onLaunch() {
+    // 展示本地存储能力
+    const logs = wx.getStorageSync('logs') || []
+    logs.unshift(Date.now())
+    wx.setStorageSync('logs', logs)
+
+    // 登录
+    wx.login({
+      success: res => {
+        // 发送 res.code 到后台换取 openId, sessionKey, unionId
+      }
+    })
+  },
+  globalData: {
+    userInfo: null
+  }
+})

+ 37 - 0
erp2/app.json

@@ -0,0 +1,37 @@
+{
+  "pages":[
+    "pages/index/index",
+    "pages/submitPhone/index",
+    "pages/list/index",
+    "pages/record/index",
+    "pages/recharge/index",
+    "pages/bill/index"
+  ],
+  "tabBar": {
+    "color": "#2c2c2c",
+    "selectedColor": "#1296db",
+    "borderStyle": "black",
+    "list": [
+      {
+        "selectedIconPath": "./utils/images/home.png",
+        "iconPath": "./utils/images/home-1.png",
+        "pagePath": "pages/index/index",
+        "text": "首页"
+      },
+      {
+        "selectedIconPath": "./utils/images/list.png",
+        "iconPath": "./utils/images/list-1.png",
+        "pagePath": "pages/list/index",
+        "text": "列表"
+      }
+    ]
+  },
+  "window":{
+    "backgroundTextStyle":"light",
+    "navigationBarBackgroundColor": "#fff",
+    "navigationBarTitleText": "电费",
+    "navigationBarTextStyle":"black"
+  },
+  "style": "v2",
+  "sitemapLocation": "sitemap.json"
+}

+ 10 - 0
erp2/app.wxss

@@ -0,0 +1,10 @@
+/**app.wxss**/
+.container {
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: space-between;
+  padding: 200rpx 0;
+  box-sizing: border-box;
+} 

二進制
erp2/pages/.DS_Store


+ 56 - 0
erp2/pages/bill/index.js

@@ -0,0 +1,56 @@
+const app = getApp()
+const httpUtils = require('../../utils/http.js')
+const ui = require('../../utils/ui.js')
+Page({
+  data: {
+    list: [],
+    deviceid: '',
+    roomName: '',
+    deviceCode: ''
+  },
+  deviceid: '',
+  roomName: '',
+  deviceCode: '',
+  balance: '',
+  onLoad(options) {
+    this.deviceid = options.deviceid
+    this.roomName = options.roomName
+    this.deviceCode = options.deviceCode
+    this.balance = options.balance
+    this.setData({
+      deviceid: options.deviceid,
+      roomName: options.roomName,
+      deviceCode: options.deviceCode,
+      balance: options.balance
+    })
+    this.getList(options.deviceid)
+  },
+  historyUrl(){
+    console.log(this)
+    wx.navigateTo({
+      url: '/pages/record/index?deviceid=' + this.deviceid + '&roomName=' + this.roomName + '&deviceCode=' + this.deviceCode
+    })
+  },
+  toRecharge(){
+    wx.navigateTo({
+      url: '/pages/recharge/index?deviceid=' + this.deviceid + '&roomName=' + this.roomName + '&deviceCode=' + this.deviceCode + '&balance=' + this.balance
+    })
+  },
+  getList(id){
+    let obj = {
+      url: '/api/erp/we/monthBill',
+      data: {
+        deviceId: id,
+        token: wx.getStorageSync('token'),
+      }
+    }
+    httpUtils.request(obj).then(res=>{
+      console.log(res)
+      this.setData({
+        list: res.data.data
+      })
+    }).catch(err=>{
+      console.log('ERROR')
+    });
+  }
+})

+ 4 - 0
erp2/pages/bill/index.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "月账单"
+}

+ 28 - 0
erp2/pages/bill/index.wxml

@@ -0,0 +1,28 @@
+<view class="container_bill">
+  <view class="bill_top">
+    <p class="top_style">房号:{{roomName}}</p>
+    <p class="top_style">表号:{{deviceCode}}</p>
+  </view>
+  <view class="bill_btn">
+    <button class="btn_style1" bindtap="historyUrl">历史充值</button>
+    <button class="btn_style2" bindtap="toRecharge">充值</button>
+  </view>
+  <view class="list" wx:for="{{list}}" wx:key="index">
+    <view class="list-inner">
+      <p class="days">{{index + 1}}.月份:<span class="normal">{{item.month}}</span></p>
+      <p class="days">期末余额:<span class="blod red">{{item.balance}}</span></p>
+    </view>
+    <view class="list-inner">
+      <p class="days">期初读数: <span class="normal">{{item.prevValue}}</span></p>
+      <p class="days">期末读数: <span class="normal">{{item.currentValue}}</span></p>
+    </view>
+    <view class="list-inner">
+      <p class="days">倍率:<span class="normal">{{item.rate}}</span></p>
+      <p class="days">电量: <span class="normal">{{item.currentUse}}</span></p>
+    </view>
+    <view class="list-inner">
+      <p class="days">电价: <span class="normal">{{item.price}}</span></p>
+      <p class="days">电费: <span class="normal">{{item.amount}}</span></p>
+    </view>
+  </view>
+</view>

+ 69 - 0
erp2/pages/bill/index.wxss

@@ -0,0 +1,69 @@
+.container_bill{
+  background: #efefef;
+  padding: 5px 0;
+}
+.bill_top{
+  width: 96%;
+  margin: 0 auto;
+  font-size: 14px;
+  color: #222;
+  display: flex;
+}
+.bill_top .top_style{
+  width: 50%;
+  text-align: center;
+}
+.bill_btn{
+  display: flex;
+  margin: 10px 0;
+}
+.bill_btn .btn_style2{
+  width: 45%;
+  margin: 0 auto;
+  font-size: 14px;
+  background: #1296db;
+  color: #fff;
+}
+.bill_btn .btn_style1{
+  width: 45%;
+  margin: 0 auto;
+  font-size: 14px;
+  background: #7dc5eb;
+  color: #fff;
+}
+.container_bill .list{
+  width: 96%;
+  margin: 0 auto;
+  border-radius: 3px;
+  padding: 10px;
+  box-sizing: border-box;
+  background: #ffffff;
+  border-bottom:1px solid #e6e6e6;
+  margin-bottom: 10px;
+}
+.container_bill .list .list-inner{
+  display: flex;
+  margin-bottom: 10px;
+}
+.container_bill .list .list-inner .days{
+  width: 60%;
+  display: block;
+  color: #999;
+  font-size: 14px;
+}
+.container_bill .list .list-inner .days{
+  color: #999;
+}
+.container_bill .list .arrow{
+  width: 20px;
+  height: 15px;
+}
+.red{
+  color: red;
+}
+.blod{
+  font-weight: bold;
+}
+.normal{
+  color: #222;
+}

+ 55 - 0
erp2/pages/index/index.js

@@ -0,0 +1,55 @@
+const app = getApp()
+const httpUtils = require('../../utils/http.js')
+const ui = require('../../utils/ui.js')
+Page({
+  data: {
+    tab: 1
+  },
+  onShow(){
+    if(wx.getStorageSync('token')){
+      this.setData({
+        tab: 2
+      })
+    }else{
+      this.setData({
+        tab: 1
+      })
+    }
+  },
+  toOut(){
+    wx.removeStorageSync('token')
+    wx.removeStorageSync('phone')
+    wx.removeStorageSync('openId')
+    wx.removeStorageSync('code')
+    this.setData({
+      tab: 1
+    })
+  },
+  toLogin(){
+    wx.login({
+      success (res) {
+        if (res.code) {
+          console.log("code",res)
+          let code = res.code
+          wx.setStorageSync('code', res.code)
+          // 调userinfo接口
+          let obj = {
+            url: '/api/erp/we/userInfo',   
+            data: {
+              code: code
+            }
+          }
+          httpUtils.request(obj).then(res1=>{
+            console.log("userInfo",res1)
+            wx.setStorageSync('openId', res1.data.data)
+            wx.navigateTo({
+              url: '/pages/submitPhone/index',
+            })
+          }).catch(err=>{
+            console.log('ERROR',err)
+          });
+        }
+      }
+    })
+  }
+})

+ 4 - 0
erp2/pages/index/index.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "首页"
+}

+ 9 - 0
erp2/pages/index/index.wxml

@@ -0,0 +1,9 @@
+<view class="container">
+  <view class="title">电费充值系统</view>
+  <image class="img-style" src="/utils/images/home-img1.jpeg"></image>
+  <image class="img-style" src="/utils/images/home-img2.jpeg"></image>
+  <button class="btn_box" wx-if="{{tab == 1}}" bindtap="toLogin">微信授权登陆</button>
+  <button class="btn_box" wx-if="{{tab == 2}}" bindtap="toOut">更换账号登陆</button>
+  <!-- <view  class="btn_box" wx-if="{{tab == 1}}" bindtap="toLogin">微信授权登陆</view> -->
+  <!-- <view class="btn_box" wx-if="{{tab == 2}}" bindtap="toOut">更换账号登陆</view> -->
+</view>

+ 29 - 0
erp2/pages/index/index.wxss

@@ -0,0 +1,29 @@
+.container{
+  padding: 0;
+}
+.title{
+  text-align: center;
+  font-size: 18px;
+  font-weight: bold;
+  color: #222;
+  margin-top: 30px;
+}
+.img-style{
+  width: 100%;
+  height: 150px;
+  display: block;
+  margin-bottom: 10px;
+}
+.btn_box{
+  width: 300px !important;
+  margin: 0 auto;
+  background: #1296db;
+  color: #ffffff;
+  font-size: 14px;
+  text-align: center;
+  height: 35px;
+  border-radius: 3px;
+  line-height: 20px;
+  position: absolute;
+  bottom: 50px;
+}

+ 45 - 0
erp2/pages/list/index.js

@@ -0,0 +1,45 @@
+const app = getApp()
+const httpUtils = require('../../utils/http.js')
+const ui = require('../../utils/ui.js')
+Page({
+  data: {
+   list: []
+  },
+  onShow(){
+    if(wx.getStorageSync('token')){
+      this.getList()
+    }else{
+      wx.switchTab({
+        url: '/pages/index/index',
+      })
+    }
+  },
+  toUrl(e){
+    console.log(e)
+    let deviceid = e.currentTarget.dataset.deviceid
+    let roomName = e.currentTarget.dataset.roomname
+    let deviceCode = e.currentTarget.dataset.devicecode
+    let balance = e.currentTarget.dataset.balance
+    wx.navigateTo({
+      url: '/pages/bill/index?deviceid=' + deviceid + '&roomName=' + roomName + '&deviceCode=' + deviceCode + '&balance=' + balance
+    })
+  },
+  getList(){
+    let obj = {
+      url: '/api/erp/we/roomList',
+      data: {
+        phone: wx.getStorageSync('phone'),
+        token: wx.getStorageSync('token'),
+      }
+    }
+    httpUtils.request(obj).then(res=>{
+      console.log(res)
+      this.setData({
+        list: res.data.data
+      })
+    }).catch(err=>{
+      console.log('ERROR')
+    });
+  }
+  
+})

+ 4 - 0
erp2/pages/list/index.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "我的电表"
+}

+ 15 - 0
erp2/pages/list/index.wxml

@@ -0,0 +1,15 @@
+<view class="container_list">
+  <view class="list" bindtap="toUrl" wx:for="{{list}}" wx:key="index" data-deviceId="{{item.deviceId}}" data-roomName="{{item.roomName}}" data-deviceCode="{{item.deviceCode}}" data-balance = "{{item.balance}}">
+    <view class="list-left">
+      <view class="list-inner">
+        <p class="house">{{index + 1}}.{{item.roomName}}</p>
+        <p class="days">余额:<span class="blod red">{{item.balance}}</span></p>
+      </view>
+      <view class="list-inner">
+        <p class="elId">电表:{{item.deviceCode}}</p>
+        <p class="days">预计可用 <span class="normal">{{item.canUse}}</span> 天</p>
+      </view>
+    </view>
+    <image class="arrow" src="../../utils/images/jiantou.png"></image>
+  </view>
+</view>

+ 50 - 0
erp2/pages/list/index.wxss

@@ -0,0 +1,50 @@
+.container_list{
+  background: #efefef;
+  padding: 10px 0;
+}
+.container_list .list{
+  width: 96%;
+  margin: 0 auto;
+  border-radius: 3px;
+  padding: 10px;
+  box-sizing: border-box;
+  background: #ffffff;
+  border-bottom:1px solid #e6e6e6;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  margin-bottom: 10px;
+}
+.container_list .list .list-left{
+  width: 95%;
+}
+.container_list .list .list-left .list-inner{
+  display: flex;
+  margin-bottom: 10px;
+}
+.container_list .list .list-left .list-inner p:first-child{
+  width: 60%;
+  display: block;
+  color: #222;
+  font-size: 14px;
+}
+.container_list .list .list-left .list-inner .house{
+  font-weight: bold;
+}
+.container_list .list .list-left .list-inner .days{
+  font-size: 14px;
+  color: #999;
+}
+.container_list .list .arrow{
+  width: 20px;
+  height: 15px;
+}
+.red{
+  color: red;
+}
+.blod{
+  font-weight: bold;
+}
+.normal{
+  color: #222;
+}

+ 103 - 0
erp2/pages/recharge/index.js

@@ -0,0 +1,103 @@
+const app = getApp()
+const httpUtils = require('../../utils/http.js')
+const ui = require('../../utils/ui.js')
+Page({
+  data: {
+    tab: 1,
+    money: 100,
+    deviceid: '',
+    roomName: '',
+    deviceCode: '',
+    balance: ''
+  },
+  deviceid: '',
+  roomName: '',
+  deviceCode: '',
+  balance: '',
+  onLoad(options) {
+    this.setData({
+      deviceid: options.deviceid,
+      roomName: options.roomName,
+      deviceCode: options.deviceCode,
+      balance: options.balance
+    })
+    this.deviceid = options.deviceid
+    this.roomName = options.roomName
+    this.deviceCode = options.deviceCode
+    this.balance = options.balance
+  },
+  getInputName(e){
+    this.setData({
+      money: e.detail.value
+    })
+  },
+  changeTab(e){
+    console.log(e)
+    this.setData({
+      tab: e.target.dataset.info
+    })
+    if(e.target.dataset.info == 1){
+      this.setData({
+        money: 100
+      })
+    }else if(e.target.dataset.info == 2){
+      this.setData({
+        money: 200
+      })
+    }else if(e.target.dataset.info == 3){
+      this.setData({
+        money: 500
+      })
+    }
+  },
+  toRecharge(){
+    let that = this
+    let obj = {
+      url: '/api/erp/we/wePhoneCharge',
+      data: {
+        deviceId: that.deviceid,
+        deposit: that.data.money,
+        token: wx.getStorageSync('token'),
+      }
+    }
+    httpUtils.request(obj).then(res=>{
+      console.log("pay",res)
+      let payInfo = res.data.data
+      // 调取后端接口后微信下单
+      wx.requestPayment({
+        timeStamp:payInfo.timeStamp,
+        nonceStr:payInfo.nonceStr,
+        package:payInfo.package,
+        signType:payInfo.signType,
+        paySign:payInfo.paySign,
+        success (res1) {
+          console.log("支付",res1)
+          if(res1.errMsg == 'requestPayment:ok'){
+            wx.showToast({
+              title: '支付成功!',
+              icon: 'success',
+              duration: 2000
+            })
+            wx.navigateTo({
+              url: '/pages/record/index?deviceid=' + that.deviceid + '&roomName=' + that.roomName + '&deviceCode=' + that.deviceCode
+            })
+          }
+        },
+        fail (res1) { 
+          wx.showToast({
+            title: '支付失败!',
+            icon: 'error',
+            duration: 2000
+          })
+        }
+      })
+    }).catch(err=>{
+      console.log(err)
+      wx.showToast({
+        title: "创建订单失败!",
+        icon: 'error',
+        duration: 2000
+      })
+    });
+  }
+})

+ 4 - 0
erp2/pages/recharge/index.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "充值"
+}

+ 19 - 0
erp2/pages/recharge/index.wxml

@@ -0,0 +1,19 @@
+<view class="container_bill">
+  <view class="bill_top">
+    <p class="top_style">房号:{{roomName}}</p>
+    <p class="top_style">表号:{{deviceCode}}</p>
+  </view>
+  <view class="bill_top">
+    <p class="top_style">余额:{{balance}}</p>
+  </view>
+  <view class="input_box">
+    <input class="input_style" bindinput='getInputName' type="digit" placeholder="请输入充值金额"/>
+  </view>
+  <view class="money_num">
+    <view class="num_inner {{ tab == 1? 'blue_style':'' }}" data-info="{{1}}" bindtap="changeTab">100</view>
+    <view class="num_inner {{ tab == 2? 'blue_style':'' }}" data-info="{{2}}" bindtap="changeTab">200</view>
+    <view class="num_inner {{ tab == 3? 'blue_style':'' }}" data-info="{{3}}" bindtap="changeTab">500</view>
+  </view>
+  <view class="btn_box" bindtap="toRecharge">充值</view>
+  
+</view>

+ 56 - 0
erp2/pages/recharge/index.wxss

@@ -0,0 +1,56 @@
+.container_bill{
+  padding: 5px 0;
+}
+.bill_top{
+  width: 90%;
+  margin: 0 auto;
+  font-size: 14px;
+  color: #222;
+  display: flex;
+  margin-bottom: 10px;
+}
+.bill_top .top_style{
+  width: 50%;
+}
+.input_style{
+  width: 90%;
+  height: 35px;
+  margin: 0 auto;
+  background: #efefef;
+  border-radius: 3px;
+  box-sizing: border-box;
+  padding: 2px 5px;
+  margin-top: 30px;
+}
+.money_num{
+  width: 90%;
+  margin: 0 auto;
+  margin-top: 25px;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  margin-bottom: 100px;
+}
+.num_inner{
+  width: 60px;
+  height: 35px;
+  line-height: 35px;
+  background: #ebebeb;
+  color: #ffffff;
+  text-align: center;
+  border-radius: 3px;
+}
+.blue_style{
+  background: #7dc5eb;
+}
+.btn_box{
+  width: 90%;
+  margin: 0 auto;
+  background: #1296db;
+  color: #ffffff;
+  font-size: 14px;
+  text-align: center;
+  height: 35px;
+  border-radius: 3px;
+  line-height: 35px;
+}

+ 38 - 0
erp2/pages/record/index.js

@@ -0,0 +1,38 @@
+const app = getApp()
+const httpUtils = require('../../utils/http.js')
+const ui = require('../../utils/ui.js')
+Page({
+  data: {
+   list: [],
+   deviceid: '',
+   roomName: '',
+   deviceCode: ''
+  },
+  onLoad(options) {
+    console.log(options)
+    this.setData({
+      deviceid: options.deviceid,
+      roomName: options.roomName,
+      deviceCode: options.deviceCode
+    })
+    this.getList(options.deviceid)
+  },
+  getList(id){
+    let obj = {
+      url: '/api/erp/we/chargeRecords',
+      data: {
+        deviceId: id,
+        token: wx.getStorageSync('token'),
+      }
+    }
+    httpUtils.request(obj).then(res=>{
+      console.log(res)
+      this.setData({
+        list: res.data.data
+      })
+    }).catch(err=>{
+      console.log('ERROR')
+    });
+  }
+  
+})

+ 4 - 0
erp2/pages/record/index.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "充值记录"
+}

+ 16 - 0
erp2/pages/record/index.wxml

@@ -0,0 +1,16 @@
+<view class="container_bill">
+  <view class="bill_top">
+    <p class="top_style">房号:{{roomName}}</p>
+    <p class="top_style">表号:{{deviceCode}}</p>
+  </view>
+  <view class="list" wx:for="{{list}}" wx:key="index">
+    <view class="list-inner">
+      <p class="days">{{index + 1}}.日期:<span class="normal">{{item.createTime}}</span></p>
+    </view>
+    <view class="list-inner">
+      <p class="days">充值方式: <span class="normal">{{item.paywayName}}</span></p>
+      <p class="days">充值金额: <span class="blod red">{{item.amount}}</span></p>
+    </view>
+  </view>
+</view>
+

+ 69 - 0
erp2/pages/record/index.wxss

@@ -0,0 +1,69 @@
+.container_bill{
+  background: #efefef;
+  padding: 5px 0;
+}
+.bill_top{
+  width: 96%;
+  margin: 0 auto;
+  font-size: 14px;
+  color: #222;
+  display: flex;
+  margin-bottom: 10px;
+}
+.bill_top .top_style{
+  width: 50%;
+}
+.bill_btn{
+  display: flex;
+  margin: 10px 0;
+}
+.bill_btn .btn_style2{
+  width: 45%;
+  margin: 0 auto;
+  font-size: 14px;
+  background: #1296db;
+  color: #fff;
+}
+.bill_btn .btn_style1{
+  width: 45%;
+  margin: 0 auto;
+  font-size: 14px;
+  background: #7dc5eb;
+  color: #fff;
+}
+.container_bill .list{
+  width: 96%;
+  margin: 0 auto;
+  border-radius: 3px;
+  padding: 10px;
+  box-sizing: border-box;
+  background: #ffffff;
+  border-bottom:1px solid #e6e6e6;
+  margin-bottom: 10px;
+}
+.container_bill .list .list-inner{
+  display: flex;
+  margin-bottom: 10px;
+}
+.container_bill .list .list-inner .days{
+  width: 60%;
+  display: block;
+  color: #999;
+  font-size: 14px;
+}
+.container_bill .list .list-inner .days{
+  color: #999;
+}
+.container_bill .list .arrow{
+  width: 20px;
+  height: 15px;
+}
+.red{
+  color: red;
+}
+.blod{
+  font-weight: bold;
+}
+.normal{
+  color: #222;
+}

+ 33 - 0
erp2/pages/submitPhone/index.js

@@ -0,0 +1,33 @@
+const app = getApp()
+const httpUtils = require('../../utils/http.js')
+const ui = require('../../utils/ui.js')
+Page({
+  data: {
+    phone: ''
+  },
+  getInputName(e){
+    this.setData({
+      phone: e.detail.value
+    })
+  },
+  toSubmit() {
+    let phoneNumber = this.data.phone;
+    let obj = {
+      url: '/api/erp/we/phoneInfo',   
+      data: {
+        phone: phoneNumber,
+        openId: wx.getStorageSync('openId')
+      }
+    }
+    httpUtils.request(obj).then(res=>{
+      console.log(res)
+      wx.setStorageSync('token', res.data.data.token)
+      wx.setStorageSync('phone', phoneNumber)
+      wx.switchTab({
+        url: '/pages/list/index',
+      })
+    }).catch(err=>{
+      console.log('ERROR')
+    });
+  }
+})

+ 4 - 0
erp2/pages/submitPhone/index.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "提交手机号码"
+}

+ 6 - 0
erp2/pages/submitPhone/index.wxml

@@ -0,0 +1,6 @@
+<view class="container">
+    <input class="input_style" type="number" bindinput='getInputName' placeholder="请输入手机号码" />
+    <view class="tips">请输入已报备到物业公司的手机号码</view>
+    <view class="btn_box" bindtap="toSubmit">提交</view>
+    
+</view>

+ 31 - 0
erp2/pages/submitPhone/index.wxss

@@ -0,0 +1,31 @@
+.container{
+  width: 100%;
+}
+.input_style{
+  width: 300px;
+  height: 35px;
+  margin: 0 auto;
+  background: #efefef;
+  border-radius: 3px;
+  box-sizing: border-box;
+  padding: 2px 5px;
+  margin-top: 10px;
+}
+.tips{
+  width: 300px;
+  margin-bottom: 100px;
+  color: #1296db;
+  font-size: 14px;
+  margin-top: 5px;
+}
+.btn_box{
+  width: 300px;
+  margin: 0 auto;
+  background: #1296db;
+  color: #ffffff;
+  font-size: 14px;
+  text-align: center;
+  height: 35px;
+  border-radius: 3px;
+  line-height: 35px;
+}

+ 55 - 0
erp2/project.config.json

@@ -0,0 +1,55 @@
+{
+  "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
+  "setting": {
+    "bundle": false,
+    "userConfirmedBundleSwitch": false,
+    "urlCheck": true,
+    "scopeDataCheck": false,
+    "coverView": true,
+    "es6": false,
+    "postcss": true,
+    "compileHotReLoad": false,
+    "lazyloadPlaceholderEnable": false,
+    "preloadBackgroundData": false,
+    "minified": true,
+    "autoAudits": false,
+    "newFeature": false,
+    "uglifyFileName": false,
+    "uploadWithSourceMap": true,
+    "useIsolateContext": true,
+    "nodeModules": false,
+    "enhance": true,
+    "useMultiFrameRuntime": true,
+    "showShadowRootInWxmlPanel": true,
+    "packNpmManually": false,
+    "enableEngineNative": false,
+    "packNpmRelationList": [],
+    "minifyWXSS": true,
+    "showES6CompileOption": false,
+    "minifyWXML": true,
+    "useStaticServer": true,
+    "checkInvalidKey": true,
+    "babelSetting": {
+      "ignore": [],
+      "disablePlugins": [],
+      "outputPath": ""
+    },
+    "disableUseStrict": false,
+    "useCompilerPlugins": false,
+    "ignoreUploadUnusedFiles": true
+  },
+  "compileType": "miniprogram",
+  "condition": {},
+  "editorSetting": {
+    "tabIndent": "insertSpaces",
+    "tabSize": 2
+  },
+  "libVersion": "2.24.6",
+  "packOptions": {
+    "ignore": [],
+    "include": []
+  },
+  "appid": "wxa45d4802fe405832",
+  "simulatorPluginLibVersion": {},
+  "projectname": "dghd_miniapp"
+}

+ 7 - 0
erp2/project.private.config.json

@@ -0,0 +1,7 @@
+{
+  "projectname": "erp2",
+  "setting": {
+    "compileHotReLoad": true
+  },
+  "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html"
+}

+ 7 - 0
erp2/sitemap.json

@@ -0,0 +1,7 @@
+{
+  "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
+  "rules": [{
+  "action": "allow",
+  "page": "*"
+  }]
+}

二進制
erp2/utils/.DS_Store


+ 65 - 0
erp2/utils/http.js

@@ -0,0 +1,65 @@
+const ui = require('./ui');
+ const BASE_URL = 'https://www.szkis.cn/monitor'
+  // const BASE_URL = 'http://119.29.97.109:8080/monitor' 
+ 
+function request(obj) {
+    return new Promise(function(resolve, reject) {
+      if(obj.showLoading){
+        ui.showLoading(obj.message? obj.message : '加载中...');
+      } 
+      var data = {};
+      if(obj.data) {
+        data = obj.data;
+      }
+      var contentType = 'application/json';
+      if(obj.contentType){
+        contentType = obj.contentType;
+      } 
+  
+      var method = 'post';
+      if(obj.method){
+        method = obj.method;
+      }
+  
+      wx.request({
+        url: BASE_URL + obj.url,
+        data: data,
+        method: method,
+        //添加请求头
+        // header: {
+        //   'Content-Type': contentType ,
+        //   'token': wx.getStorageSync('token') //获取保存的token
+        // },
+        //请求成功
+        success: function(res) {
+          if (res.statusCode == 200) {
+            resolve(res);
+          } else if (res.statusCode == 500) {//授权失效
+            reject("登录已过期");
+            jumpToLogin();//跳转到登录页
+          } else {
+            //请求失败
+            reject("请求失败:" + res.statusCode)
+          }
+        },
+        fail: function(err) {
+          reject("服务器连接异常,请检查网络再试");
+        },
+        complete: function() {
+          ui.hideLoading();
+        }
+      })
+    });
+  }
+  
+ 
+  //跳转到登录页
+  function jumpToLogin(){
+    wx.reLaunch({
+      url: '/pages/index/index',
+    })
+  }
+  
+  module.exports = {
+    request,
+  }

二進制
erp2/utils/images/.DS_Store


二進制
erp2/utils/images/home-1.png


二進制
erp2/utils/images/home-img1.jpeg


二進制
erp2/utils/images/home-img2.jpeg


二進制
erp2/utils/images/home.png


二進制
erp2/utils/images/jiantou.png


二進制
erp2/utils/images/list-1.png


二進制
erp2/utils/images/list.png


+ 26 - 0
erp2/utils/ui.js

@@ -0,0 +1,26 @@
+export const showToast = function(content,duration) {
+  if(!duration) duration = 2000
+  wx.showToast({
+      title: content,
+      icon: 'none',
+      duration: duration,
+  })
+}
+
+var isShowLoading = false
+export const showLoading = function(title) {
+  if(isShowLoading) return
+  wx.showLoading({
+      title: title?title:'',
+      mask:true,
+      success:()=>{
+          isShowLoading = true
+      }
+  })
+}
+
+export const hideLoading = function() {
+  if(!isShowLoading) return
+  isShowLoading = false
+  wx.hideLoading()
+}

+ 19 - 0
lt/app.js

@@ -0,0 +1,19 @@
+// app.js
+App({
+  onLaunch() {
+    // 展示本地存储能力
+    const logs = wx.getStorageSync('logs') || []
+    logs.unshift(Date.now())
+    wx.setStorageSync('logs', logs)
+
+    // 登录
+    wx.login({
+      success: res => {
+        // 发送 res.code 到后台换取 openId, sessionKey, unionId
+      }
+    })
+  },
+  globalData: {
+    userInfo: null
+  }
+})

+ 37 - 0
lt/app.json

@@ -0,0 +1,37 @@
+{
+  "pages":[
+    "pages/index/index",
+    "pages/submitPhone/index",
+    "pages/list/index",
+    "pages/record/index",
+    "pages/recharge/index",
+    "pages/bill/index"
+  ],
+  "tabBar": {
+    "color": "#2c2c2c",
+    "selectedColor": "#1296db",
+    "borderStyle": "black",
+    "list": [
+      {
+        "selectedIconPath": "./utils/images/home.png",
+        "iconPath": "./utils/images/home-1.png",
+        "pagePath": "pages/index/index",
+        "text": "首页"
+      },
+      {
+        "selectedIconPath": "./utils/images/list.png",
+        "iconPath": "./utils/images/list-1.png",
+        "pagePath": "pages/list/index",
+        "text": "列表"
+      }
+    ]
+  },
+  "window":{
+    "backgroundTextStyle":"light",
+    "navigationBarBackgroundColor": "#fff",
+    "navigationBarTitleText": "电费",
+    "navigationBarTextStyle":"black"
+  },
+  "style": "v2",
+  "sitemapLocation": "sitemap.json"
+}

+ 10 - 0
lt/app.wxss

@@ -0,0 +1,10 @@
+/**app.wxss**/
+.container {
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: space-between;
+  padding: 200rpx 0;
+  box-sizing: border-box;
+} 

二進制
lt/pages/.DS_Store


+ 56 - 0
lt/pages/bill/index.js

@@ -0,0 +1,56 @@
+const app = getApp()
+const httpUtils = require('../../utils/http.js')
+const ui = require('../../utils/ui.js')
+Page({
+  data: {
+    list: [],
+    deviceid: '',
+    roomName: '',
+    deviceCode: ''
+  },
+  deviceid: '',
+  roomName: '',
+  deviceCode: '',
+  balance: '',
+  onLoad(options) {
+    this.deviceid = options.deviceid
+    this.roomName = options.roomName
+    this.deviceCode = options.deviceCode
+    this.balance = options.balance
+    this.setData({
+      deviceid: options.deviceid,
+      roomName: options.roomName,
+      deviceCode: options.deviceCode,
+      balance: options.balance
+    })
+    this.getList(options.deviceid)
+  },
+  historyUrl(){
+    console.log(this)
+    wx.navigateTo({
+      url: '/pages/record/index?deviceid=' + this.deviceid + '&roomName=' + this.roomName + '&deviceCode=' + this.deviceCode
+    })
+  },
+  toRecharge(){
+    wx.navigateTo({
+      url: '/pages/recharge/index?deviceid=' + this.deviceid + '&roomName=' + this.roomName + '&deviceCode=' + this.deviceCode + '&balance=' + this.balance
+    })
+  },
+  getList(id){
+    let obj = {
+      url: '/api/erp/we/monthBill',
+      data: {
+        deviceId: id,
+        token: wx.getStorageSync('token'),
+      }
+    }
+    httpUtils.request(obj).then(res=>{
+      console.log(res)
+      this.setData({
+        list: res.data.data
+      })
+    }).catch(err=>{
+      console.log('ERROR')
+    });
+  }
+})

+ 4 - 0
lt/pages/bill/index.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "月账单"
+}

+ 28 - 0
lt/pages/bill/index.wxml

@@ -0,0 +1,28 @@
+<view class="container_bill">
+  <view class="bill_top">
+    <p class="top_style">房号:{{roomName}}</p>
+    <p class="top_style">表号:{{deviceCode}}</p>
+  </view>
+  <view class="bill_btn">
+    <button class="btn_style1" bindtap="historyUrl">历史充值</button>
+    <button class="btn_style2" bindtap="toRecharge">充值</button>
+  </view>
+  <view class="list" wx:for="{{list}}" wx:key="index">
+    <view class="list-inner">
+      <p class="days">{{index + 1}}.月份:<span class="normal">{{item.month}}</span></p>
+      <p class="days">期末余额:<span class="blod red">{{item.balance}}</span></p>
+    </view>
+    <view class="list-inner">
+      <p class="days">期初读数: <span class="normal">{{item.prevValue}}</span></p>
+      <p class="days">期末读数: <span class="normal">{{item.currentValue}}</span></p>
+    </view>
+    <view class="list-inner">
+      <p class="days">倍率:<span class="normal">{{item.rate}}</span></p>
+      <p class="days">电量: <span class="normal">{{item.currentUse}}</span></p>
+    </view>
+    <view class="list-inner">
+      <p class="days">电价: <span class="normal">{{item.price}}</span></p>
+      <p class="days">电费: <span class="normal">{{item.amount}}</span></p>
+    </view>
+  </view>
+</view>

+ 69 - 0
lt/pages/bill/index.wxss

@@ -0,0 +1,69 @@
+.container_bill{
+  background: #efefef;
+  padding: 5px 0;
+}
+.bill_top{
+  width: 96%;
+  margin: 0 auto;
+  font-size: 14px;
+  color: #222;
+  display: flex;
+}
+.bill_top .top_style{
+  width: 50%;
+  text-align: center;
+}
+.bill_btn{
+  display: flex;
+  margin: 10px 0;
+}
+.bill_btn .btn_style2{
+  width: 45%;
+  margin: 0 auto;
+  font-size: 14px;
+  background: #1296db;
+  color: #fff;
+}
+.bill_btn .btn_style1{
+  width: 45%;
+  margin: 0 auto;
+  font-size: 14px;
+  background: #7dc5eb;
+  color: #fff;
+}
+.container_bill .list{
+  width: 96%;
+  margin: 0 auto;
+  border-radius: 3px;
+  padding: 10px;
+  box-sizing: border-box;
+  background: #ffffff;
+  border-bottom:1px solid #e6e6e6;
+  margin-bottom: 10px;
+}
+.container_bill .list .list-inner{
+  display: flex;
+  margin-bottom: 10px;
+}
+.container_bill .list .list-inner .days{
+  width: 60%;
+  display: block;
+  color: #999;
+  font-size: 14px;
+}
+.container_bill .list .list-inner .days{
+  color: #999;
+}
+.container_bill .list .arrow{
+  width: 20px;
+  height: 15px;
+}
+.red{
+  color: red;
+}
+.blod{
+  font-weight: bold;
+}
+.normal{
+  color: #222;
+}

+ 55 - 0
lt/pages/index/index.js

@@ -0,0 +1,55 @@
+const app = getApp()
+const httpUtils = require('../../utils/http.js')
+const ui = require('../../utils/ui.js')
+Page({
+  data: {
+    tab: 1
+  },
+  onShow(){
+    if(wx.getStorageSync('token')){
+      this.setData({
+        tab: 2
+      })
+    }else{
+      this.setData({
+        tab: 1
+      })
+    }
+  },
+  toOut(){
+    wx.removeStorageSync('token')
+    wx.removeStorageSync('phone')
+    wx.removeStorageSync('openId')
+    wx.removeStorageSync('code')
+    this.setData({
+      tab: 1
+    })
+  },
+  toLogin(){
+    wx.login({
+      success (res) {
+        if (res.code) {
+          console.log("code",res)
+          let code = res.code
+          wx.setStorageSync('code', res.code)
+          // 调userinfo接口
+          let obj = {
+            url: '/api/erp/we/userInfo',   
+            data: {
+              code: code
+            }
+          }
+          httpUtils.request(obj).then(res1=>{
+            console.log("userInfo",res1)
+            wx.setStorageSync('openId', res1.data.data)
+            wx.navigateTo({
+              url: '/pages/submitPhone/index',
+            })
+          }).catch(err=>{
+            console.log('ERROR',err)
+          });
+        }
+      }
+    })
+  }
+})

+ 4 - 0
lt/pages/index/index.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "首页"
+}

+ 9 - 0
lt/pages/index/index.wxml

@@ -0,0 +1,9 @@
+<view class="container">
+  <view class="title">电费充值系统</view>
+  <image class="img-style" src="/utils/images/home-img1.jpeg"></image>
+  <image class="img-style" src="/utils/images/home-img2.jpeg"></image>
+  <button class="btn_box" wx-if="{{tab == 1}}" bindtap="toLogin">微信授权登陆</button>
+  <button class="btn_box" wx-if="{{tab == 2}}" bindtap="toOut">更换账号登陆</button>
+  <!-- <view  class="btn_box" wx-if="{{tab == 1}}" bindtap="toLogin">微信授权登陆</view> -->
+  <!-- <view class="btn_box" wx-if="{{tab == 2}}" bindtap="toOut">更换账号登陆</view> -->
+</view>

+ 29 - 0
lt/pages/index/index.wxss

@@ -0,0 +1,29 @@
+.container{
+  padding: 0;
+}
+.title{
+  text-align: center;
+  font-size: 18px;
+  font-weight: bold;
+  color: #222;
+  margin-top: 30px;
+}
+.img-style{
+  width: 100%;
+  height: 150px;
+  display: block;
+  margin-bottom: 10px;
+}
+.btn_box{
+  width: 300px !important;
+  margin: 0 auto;
+  background: #1296db;
+  color: #ffffff;
+  font-size: 14px;
+  text-align: center;
+  height: 35px;
+  border-radius: 3px;
+  line-height: 20px;
+  position: absolute;
+  bottom: 50px;
+}

+ 45 - 0
lt/pages/list/index.js

@@ -0,0 +1,45 @@
+const app = getApp()
+const httpUtils = require('../../utils/http.js')
+const ui = require('../../utils/ui.js')
+Page({
+  data: {
+   list: []
+  },
+  onShow(){
+    if(wx.getStorageSync('token')){
+      this.getList()
+    }else{
+      wx.switchTab({
+        url: '/pages/index/index',
+      })
+    }
+  },
+  toUrl(e){
+    console.log(e)
+    let deviceid = e.currentTarget.dataset.deviceid
+    let roomName = e.currentTarget.dataset.roomname
+    let deviceCode = e.currentTarget.dataset.devicecode
+    let balance = e.currentTarget.dataset.balance
+    wx.navigateTo({
+      url: '/pages/bill/index?deviceid=' + deviceid + '&roomName=' + roomName + '&deviceCode=' + deviceCode + '&balance=' + balance
+    })
+  },
+  getList(){
+    let obj = {
+      url: '/api/erp/we/roomList',
+      data: {
+        phone: wx.getStorageSync('phone'),
+        token: wx.getStorageSync('token'),
+      }
+    }
+    httpUtils.request(obj).then(res=>{
+      console.log(res)
+      this.setData({
+        list: res.data.data
+      })
+    }).catch(err=>{
+      console.log('ERROR')
+    });
+  }
+  
+})

+ 4 - 0
lt/pages/list/index.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "我的电表"
+}

+ 15 - 0
lt/pages/list/index.wxml

@@ -0,0 +1,15 @@
+<view class="container_list">
+  <view class="list" bindtap="toUrl" wx:for="{{list}}" wx:key="index" data-deviceId="{{item.deviceId}}" data-roomName="{{item.roomName}}" data-deviceCode="{{item.deviceCode}}" data-balance = "{{item.balance}}">
+    <view class="list-left">
+      <view class="list-inner">
+        <p class="house">{{index + 1}}.{{item.roomName}}</p>
+        <p class="days">余额:<span class="blod red">{{item.balance}}</span></p>
+      </view>
+      <view class="list-inner">
+        <p class="elId">电表:{{item.deviceCode}}</p>
+        <p class="days">预计可用 <span class="normal">{{item.canUse}}</span> 天</p>
+      </view>
+    </view>
+    <image class="arrow" src="../../utils/images/jiantou.png"></image>
+  </view>
+</view>

+ 50 - 0
lt/pages/list/index.wxss

@@ -0,0 +1,50 @@
+.container_list{
+  background: #efefef;
+  padding: 10px 0;
+}
+.container_list .list{
+  width: 96%;
+  margin: 0 auto;
+  border-radius: 3px;
+  padding: 10px;
+  box-sizing: border-box;
+  background: #ffffff;
+  border-bottom:1px solid #e6e6e6;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  margin-bottom: 10px;
+}
+.container_list .list .list-left{
+  width: 95%;
+}
+.container_list .list .list-left .list-inner{
+  display: flex;
+  margin-bottom: 10px;
+}
+.container_list .list .list-left .list-inner p:first-child{
+  width: 60%;
+  display: block;
+  color: #222;
+  font-size: 14px;
+}
+.container_list .list .list-left .list-inner .house{
+  font-weight: bold;
+}
+.container_list .list .list-left .list-inner .days{
+  font-size: 14px;
+  color: #999;
+}
+.container_list .list .arrow{
+  width: 20px;
+  height: 15px;
+}
+.red{
+  color: red;
+}
+.blod{
+  font-weight: bold;
+}
+.normal{
+  color: #222;
+}

+ 103 - 0
lt/pages/recharge/index.js

@@ -0,0 +1,103 @@
+const app = getApp()
+const httpUtils = require('../../utils/http.js')
+const ui = require('../../utils/ui.js')
+Page({
+  data: {
+    tab: 1,
+    money: 100,
+    deviceid: '',
+    roomName: '',
+    deviceCode: '',
+    balance: ''
+  },
+  deviceid: '',
+  roomName: '',
+  deviceCode: '',
+  balance: '',
+  onLoad(options) {
+    this.setData({
+      deviceid: options.deviceid,
+      roomName: options.roomName,
+      deviceCode: options.deviceCode,
+      balance: options.balance
+    })
+    this.deviceid = options.deviceid
+    this.roomName = options.roomName
+    this.deviceCode = options.deviceCode
+    this.balance = options.balance
+  },
+  getInputName(e){
+    this.setData({
+      money: e.detail.value
+    })
+  },
+  changeTab(e){
+    console.log(e)
+    this.setData({
+      tab: e.target.dataset.info
+    })
+    if(e.target.dataset.info == 1){
+      this.setData({
+        money: 100
+      })
+    }else if(e.target.dataset.info == 2){
+      this.setData({
+        money: 200
+      })
+    }else if(e.target.dataset.info == 3){
+      this.setData({
+        money: 500
+      })
+    }
+  },
+  toRecharge(){
+    let that = this
+    let obj = {
+      url: '/api/erp/we/wePhoneCharge',
+      data: {
+        deviceId: that.deviceid,
+        deposit: that.data.money,
+        token: wx.getStorageSync('token'),
+      }
+    }
+    httpUtils.request(obj).then(res=>{
+      console.log("pay",res)
+      let payInfo = res.data.data
+      // 调取后端接口后微信下单
+      wx.requestPayment({
+        timeStamp:payInfo.timeStamp,
+        nonceStr:payInfo.nonceStr,
+        package:payInfo.package,
+        signType:payInfo.signType,
+        paySign:payInfo.paySign,
+        success (res1) {
+          console.log("支付",res1)
+          if(res1.errMsg == 'requestPayment:ok'){
+            wx.showToast({
+              title: '支付成功!',
+              icon: 'success',
+              duration: 2000
+            })
+            wx.navigateTo({
+              url: '/pages/record/index?deviceid=' + that.deviceid + '&roomName=' + that.roomName + '&deviceCode=' + that.deviceCode
+            })
+          }
+        },
+        fail (res1) { 
+          wx.showToast({
+            title: '支付失败!',
+            icon: 'error',
+            duration: 2000
+          })
+        }
+      })
+    }).catch(err=>{
+      console.log(err)
+      wx.showToast({
+        title: "创建订单失败!",
+        icon: 'error',
+        duration: 2000
+      })
+    });
+  }
+})

+ 4 - 0
lt/pages/recharge/index.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "充值"
+}

+ 19 - 0
lt/pages/recharge/index.wxml

@@ -0,0 +1,19 @@
+<view class="container_bill">
+  <view class="bill_top">
+    <p class="top_style">房号:{{roomName}}</p>
+    <p class="top_style">表号:{{deviceCode}}</p>
+  </view>
+  <view class="bill_top">
+    <p class="top_style">余额:{{balance}}</p>
+  </view>
+  <view class="input_box">
+    <input class="input_style" bindinput='getInputName' type="digit" placeholder="请输入充值金额"/>
+  </view>
+  <view class="money_num">
+    <view class="num_inner {{ tab == 1? 'blue_style':'' }}" data-info="{{1}}" bindtap="changeTab">100</view>
+    <view class="num_inner {{ tab == 2? 'blue_style':'' }}" data-info="{{2}}" bindtap="changeTab">200</view>
+    <view class="num_inner {{ tab == 3? 'blue_style':'' }}" data-info="{{3}}" bindtap="changeTab">500</view>
+  </view>
+  <view class="btn_box" bindtap="toRecharge">充值</view>
+  
+</view>

+ 56 - 0
lt/pages/recharge/index.wxss

@@ -0,0 +1,56 @@
+.container_bill{
+  padding: 5px 0;
+}
+.bill_top{
+  width: 90%;
+  margin: 0 auto;
+  font-size: 14px;
+  color: #222;
+  display: flex;
+  margin-bottom: 10px;
+}
+.bill_top .top_style{
+  width: 50%;
+}
+.input_style{
+  width: 90%;
+  height: 35px;
+  margin: 0 auto;
+  background: #efefef;
+  border-radius: 3px;
+  box-sizing: border-box;
+  padding: 2px 5px;
+  margin-top: 30px;
+}
+.money_num{
+  width: 90%;
+  margin: 0 auto;
+  margin-top: 25px;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  margin-bottom: 100px;
+}
+.num_inner{
+  width: 60px;
+  height: 35px;
+  line-height: 35px;
+  background: #ebebeb;
+  color: #ffffff;
+  text-align: center;
+  border-radius: 3px;
+}
+.blue_style{
+  background: #7dc5eb;
+}
+.btn_box{
+  width: 90%;
+  margin: 0 auto;
+  background: #1296db;
+  color: #ffffff;
+  font-size: 14px;
+  text-align: center;
+  height: 35px;
+  border-radius: 3px;
+  line-height: 35px;
+}

+ 38 - 0
lt/pages/record/index.js

@@ -0,0 +1,38 @@
+const app = getApp()
+const httpUtils = require('../../utils/http.js')
+const ui = require('../../utils/ui.js')
+Page({
+  data: {
+   list: [],
+   deviceid: '',
+   roomName: '',
+   deviceCode: ''
+  },
+  onLoad(options) {
+    console.log(options)
+    this.setData({
+      deviceid: options.deviceid,
+      roomName: options.roomName,
+      deviceCode: options.deviceCode
+    })
+    this.getList(options.deviceid)
+  },
+  getList(id){
+    let obj = {
+      url: '/api/erp/we/chargeRecords',
+      data: {
+        deviceId: id,
+        token: wx.getStorageSync('token'),
+      }
+    }
+    httpUtils.request(obj).then(res=>{
+      console.log(res)
+      this.setData({
+        list: res.data.data
+      })
+    }).catch(err=>{
+      console.log('ERROR')
+    });
+  }
+  
+})

+ 4 - 0
lt/pages/record/index.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "充值记录"
+}

+ 16 - 0
lt/pages/record/index.wxml

@@ -0,0 +1,16 @@
+<view class="container_bill">
+  <view class="bill_top">
+    <p class="top_style">房号:{{roomName}}</p>
+    <p class="top_style">表号:{{deviceCode}}</p>
+  </view>
+  <view class="list" wx:for="{{list}}" wx:key="index">
+    <view class="list-inner">
+      <p class="days">{{index + 1}}.日期:<span class="normal">{{item.createTime}}</span></p>
+    </view>
+    <view class="list-inner">
+      <p class="days">充值方式: <span class="normal">{{item.paywayName}}</span></p>
+      <p class="days">充值金额: <span class="blod red">{{item.amount}}</span></p>
+    </view>
+  </view>
+</view>
+

+ 69 - 0
lt/pages/record/index.wxss

@@ -0,0 +1,69 @@
+.container_bill{
+  background: #efefef;
+  padding: 5px 0;
+}
+.bill_top{
+  width: 96%;
+  margin: 0 auto;
+  font-size: 14px;
+  color: #222;
+  display: flex;
+  margin-bottom: 10px;
+}
+.bill_top .top_style{
+  width: 50%;
+}
+.bill_btn{
+  display: flex;
+  margin: 10px 0;
+}
+.bill_btn .btn_style2{
+  width: 45%;
+  margin: 0 auto;
+  font-size: 14px;
+  background: #1296db;
+  color: #fff;
+}
+.bill_btn .btn_style1{
+  width: 45%;
+  margin: 0 auto;
+  font-size: 14px;
+  background: #7dc5eb;
+  color: #fff;
+}
+.container_bill .list{
+  width: 96%;
+  margin: 0 auto;
+  border-radius: 3px;
+  padding: 10px;
+  box-sizing: border-box;
+  background: #ffffff;
+  border-bottom:1px solid #e6e6e6;
+  margin-bottom: 10px;
+}
+.container_bill .list .list-inner{
+  display: flex;
+  margin-bottom: 10px;
+}
+.container_bill .list .list-inner .days{
+  width: 60%;
+  display: block;
+  color: #999;
+  font-size: 14px;
+}
+.container_bill .list .list-inner .days{
+  color: #999;
+}
+.container_bill .list .arrow{
+  width: 20px;
+  height: 15px;
+}
+.red{
+  color: red;
+}
+.blod{
+  font-weight: bold;
+}
+.normal{
+  color: #222;
+}

+ 33 - 0
lt/pages/submitPhone/index.js

@@ -0,0 +1,33 @@
+const app = getApp()
+const httpUtils = require('../../utils/http.js')
+const ui = require('../../utils/ui.js')
+Page({
+  data: {
+    phone: ''
+  },
+  getInputName(e){
+    this.setData({
+      phone: e.detail.value
+    })
+  },
+  toSubmit() {
+    let phoneNumber = this.data.phone;
+    let obj = {
+      url: '/api/erp/we/phoneInfo',   
+      data: {
+        phone: phoneNumber,
+        openId: wx.getStorageSync('openId')
+      }
+    }
+    httpUtils.request(obj).then(res=>{
+      console.log(res)
+      wx.setStorageSync('token', res.data.data.token)
+      wx.setStorageSync('phone', phoneNumber)
+      wx.switchTab({
+        url: '/pages/list/index',
+      })
+    }).catch(err=>{
+      console.log('ERROR')
+    });
+  }
+})

+ 4 - 0
lt/pages/submitPhone/index.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "提交手机号码"
+}

+ 6 - 0
lt/pages/submitPhone/index.wxml

@@ -0,0 +1,6 @@
+<view class="container">
+    <input class="input_style" type="number" bindinput='getInputName' placeholder="请输入手机号码" />
+    <view class="tips">请输入已报备到物业公司的手机号码</view>
+    <view class="btn_box" bindtap="toSubmit">提交</view>
+    
+</view>

+ 31 - 0
lt/pages/submitPhone/index.wxss

@@ -0,0 +1,31 @@
+.container{
+  width: 100%;
+}
+.input_style{
+  width: 300px;
+  height: 35px;
+  margin: 0 auto;
+  background: #efefef;
+  border-radius: 3px;
+  box-sizing: border-box;
+  padding: 2px 5px;
+  margin-top: 10px;
+}
+.tips{
+  width: 300px;
+  margin-bottom: 100px;
+  color: #1296db;
+  font-size: 14px;
+  margin-top: 5px;
+}
+.btn_box{
+  width: 300px;
+  margin: 0 auto;
+  background: #1296db;
+  color: #ffffff;
+  font-size: 14px;
+  text-align: center;
+  height: 35px;
+  border-radius: 3px;
+  line-height: 35px;
+}

+ 55 - 0
lt/project.config.json

@@ -0,0 +1,55 @@
+{
+  "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
+  "setting": {
+    "bundle": false,
+    "userConfirmedBundleSwitch": false,
+    "urlCheck": true,
+    "scopeDataCheck": false,
+    "coverView": true,
+    "es6": false,
+    "postcss": true,
+    "compileHotReLoad": false,
+    "lazyloadPlaceholderEnable": false,
+    "preloadBackgroundData": false,
+    "minified": true,
+    "autoAudits": false,
+    "newFeature": false,
+    "uglifyFileName": false,
+    "uploadWithSourceMap": true,
+    "useIsolateContext": true,
+    "nodeModules": false,
+    "enhance": true,
+    "useMultiFrameRuntime": true,
+    "showShadowRootInWxmlPanel": true,
+    "packNpmManually": false,
+    "enableEngineNative": false,
+    "packNpmRelationList": [],
+    "minifyWXSS": true,
+    "showES6CompileOption": false,
+    "minifyWXML": true,
+    "useStaticServer": true,
+    "checkInvalidKey": true,
+    "babelSetting": {
+      "ignore": [],
+      "disablePlugins": [],
+      "outputPath": ""
+    },
+    "disableUseStrict": false,
+    "useCompilerPlugins": false,
+    "ignoreUploadUnusedFiles": true
+  },
+  "compileType": "miniprogram",
+  "condition": {},
+  "editorSetting": {
+    "tabIndent": "insertSpaces",
+    "tabSize": 2
+  },
+  "libVersion": "2.24.6",
+  "packOptions": {
+    "ignore": [],
+    "include": []
+  },
+  "appid": "wx41a3edbdfa02e6dd",
+  "simulatorPluginLibVersion": {},
+  "projectname": "dghd_miniapp"
+}

+ 7 - 0
lt/project.private.config.json

@@ -0,0 +1,7 @@
+{
+  "projectname": "It",
+  "setting": {
+    "compileHotReLoad": true
+  },
+  "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html"
+}

+ 7 - 0
lt/sitemap.json

@@ -0,0 +1,7 @@
+{
+  "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
+  "rules": [{
+  "action": "allow",
+  "page": "*"
+  }]
+}

二進制
lt/utils/.DS_Store


+ 65 - 0
lt/utils/http.js

@@ -0,0 +1,65 @@
+const ui = require('./ui');
+ const BASE_URL = 'https://www.szkis.cn/monitor'
+  // const BASE_URL = 'http://119.29.97.109:8080/monitor' 
+ 
+function request(obj) {
+    return new Promise(function(resolve, reject) {
+      if(obj.showLoading){
+        ui.showLoading(obj.message? obj.message : '加载中...');
+      } 
+      var data = {};
+      if(obj.data) {
+        data = obj.data;
+      }
+      var contentType = 'application/json';
+      if(obj.contentType){
+        contentType = obj.contentType;
+      } 
+  
+      var method = 'post';
+      if(obj.method){
+        method = obj.method;
+      }
+  
+      wx.request({
+        url: BASE_URL + obj.url,
+        data: data,
+        method: method,
+        //添加请求头
+        // header: {
+        //   'Content-Type': contentType ,
+        //   'token': wx.getStorageSync('token') //获取保存的token
+        // },
+        //请求成功
+        success: function(res) {
+          if (res.statusCode == 200) {
+            resolve(res);
+          } else if (res.statusCode == 500) {//授权失效
+            reject("登录已过期");
+            jumpToLogin();//跳转到登录页
+          } else {
+            //请求失败
+            reject("请求失败:" + res.statusCode)
+          }
+        },
+        fail: function(err) {
+          reject("服务器连接异常,请检查网络再试");
+        },
+        complete: function() {
+          ui.hideLoading();
+        }
+      })
+    });
+  }
+  
+ 
+  //跳转到登录页
+  function jumpToLogin(){
+    wx.reLaunch({
+      url: '/pages/index/index',
+    })
+  }
+  
+  module.exports = {
+    request,
+  }

二進制
lt/utils/images/.DS_Store


二進制
lt/utils/images/home-1.png


二進制
lt/utils/images/home-img1.jpeg


二進制
lt/utils/images/home-img2.jpeg


二進制
lt/utils/images/home.png


二進制
lt/utils/images/jiantou.png


二進制
lt/utils/images/list-1.png


二進制
lt/utils/images/list.png


+ 26 - 0
lt/utils/ui.js

@@ -0,0 +1,26 @@
+export const showToast = function(content,duration) {
+  if(!duration) duration = 2000
+  wx.showToast({
+      title: content,
+      icon: 'none',
+      duration: duration,
+  })
+}
+
+var isShowLoading = false
+export const showLoading = function(title) {
+  if(isShowLoading) return
+  wx.showLoading({
+      title: title?title:'',
+      mask:true,
+      success:()=>{
+          isShowLoading = true
+      }
+  })
+}
+
+export const hideLoading = function() {
+  if(!isShowLoading) return
+  isShowLoading = false
+  wx.hideLoading()
+}