开始做用电查询
This commit is contained in:
		
							
								
								
									
										7
									
								
								app.json
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								app.json
									
									
									
									
									
								
							| @@ -1,5 +1,7 @@ | |||||||
| { | { | ||||||
|   "pages": [ |   "pages": [ | ||||||
|  |     "pages/electricQuery/index", | ||||||
|  |     "pages/billList/index", | ||||||
|     "pages/home/index", |     "pages/home/index", | ||||||
|     "pages/rechargeRecord/index", |     "pages/rechargeRecord/index", | ||||||
|     "pages/invoiceList/index", |     "pages/invoiceList/index", | ||||||
| @@ -13,13 +15,14 @@ | |||||||
|     "pages/waitApprove/index", |     "pages/waitApprove/index", | ||||||
|     "pages/apply/index", |     "pages/apply/index", | ||||||
|     "pages/qrCode/index", |     "pages/qrCode/index", | ||||||
|     "pages/meterList/index", |  | ||||||
|     "pages/recharge/index", |     "pages/recharge/index", | ||||||
|     "pages/questions/index", |     "pages/questions/index", | ||||||
|     "pages/editInvoice/index", |     "pages/editInvoice/index", | ||||||
|     "pages/rechargeDetail/index", |     "pages/rechargeDetail/index", | ||||||
|     "pages/agreements/index", |     "pages/agreements/index", | ||||||
|     "pages/updateInvoice/index" |     "pages/updateInvoice/index", | ||||||
|  |     "pages/billDetail/index" | ||||||
|  |  | ||||||
|   ], |   ], | ||||||
|   "tabBar": { |   "tabBar": { | ||||||
|     "list": [ |     "list": [ | ||||||
|   | |||||||
							
								
								
									
										249
									
								
								components/echarts/ec-canvas.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										249
									
								
								components/echarts/ec-canvas.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,249 @@ | |||||||
|  | import WxCanvas from './wx-canvas'; | ||||||
|  | import * as echarts from './echarts'; | ||||||
|  |  | ||||||
|  | let ctx; | ||||||
|  |  | ||||||
|  | function compareVersion(v1, v2) { | ||||||
|  |   v1 = v1.split('.') | ||||||
|  |   v2 = v2.split('.') | ||||||
|  |   const len = Math.max(v1.length, v2.length) | ||||||
|  |  | ||||||
|  |   while (v1.length < len) { | ||||||
|  |     v1.push('0') | ||||||
|  |   } | ||||||
|  |   while (v2.length < len) { | ||||||
|  |     v2.push('0') | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   for (let i = 0; i < len; i++) { | ||||||
|  |     const num1 = parseInt(v1[i]) | ||||||
|  |     const num2 = parseInt(v2[i]) | ||||||
|  |  | ||||||
|  |     if (num1 > num2) { | ||||||
|  |       return 1 | ||||||
|  |     } else if (num1 < num2) { | ||||||
|  |       return -1 | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   return 0 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | Component({ | ||||||
|  |   properties: { | ||||||
|  |     canvasId: { | ||||||
|  |       type: String, | ||||||
|  |       value: 'ec-canvas' | ||||||
|  |     }, | ||||||
|  |  | ||||||
|  |     ec: { | ||||||
|  |       type: Object | ||||||
|  |     }, | ||||||
|  |  | ||||||
|  |     forceUseOldCanvas: { | ||||||
|  |       type: Boolean, | ||||||
|  |       value: false | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   data: { | ||||||
|  |     isUseNewCanvas: false | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   ready: function () { | ||||||
|  |     // Disable prograssive because drawImage doesn't support DOM as parameter | ||||||
|  |     // See https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html | ||||||
|  |     echarts.registerPreprocessor(option => { | ||||||
|  |       if (option && option.series) { | ||||||
|  |         if (option.series.length > 0) { | ||||||
|  |           option.series.forEach(series => { | ||||||
|  |             series.progressive = 0; | ||||||
|  |           }); | ||||||
|  |         } | ||||||
|  |         else if (typeof option.series === 'object') { | ||||||
|  |           option.series.progressive = 0; | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |     if (!this.data.ec) { | ||||||
|  |       console.warn('组件需绑定 ec 变量,例:<ec-canvas id="mychart-dom-bar" ' | ||||||
|  |         + 'canvas-id="mychart-bar" ec="{{ ec }}"></ec-canvas>'); | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     if (!this.data.ec.lazyLoad) { | ||||||
|  |       this.init(); | ||||||
|  |     } | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   methods: { | ||||||
|  |     init: function (callback) { | ||||||
|  |       const version = wx.getSystemInfoSync().SDKVersion | ||||||
|  |  | ||||||
|  |       const canUseNewCanvas = compareVersion(version, '2.9.0') >= 0; | ||||||
|  |       const forceUseOldCanvas = this.data.forceUseOldCanvas; | ||||||
|  |       const isUseNewCanvas = canUseNewCanvas && !forceUseOldCanvas; | ||||||
|  |       this.setData({ isUseNewCanvas }); | ||||||
|  |  | ||||||
|  |       if (forceUseOldCanvas && canUseNewCanvas) { | ||||||
|  |         console.warn('开发者强制使用旧canvas,建议关闭'); | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       if (isUseNewCanvas) { | ||||||
|  |         // 2.9.0 可以使用 <canvas type="2d"></canvas> | ||||||
|  |         this.initByNewWay(callback); | ||||||
|  |       } else { | ||||||
|  |         const isValid = compareVersion(version, '1.9.91') >= 0 | ||||||
|  |         if (!isValid) { | ||||||
|  |           console.error('微信基础库版本过低,需大于等于 1.9.91。' | ||||||
|  |             + '参见:https://github.com/ecomfe/echarts-for-weixin' | ||||||
|  |             + '#%E5%BE%AE%E4%BF%A1%E7%89%88%E6%9C%AC%E8%A6%81%E6%B1%82'); | ||||||
|  |           return; | ||||||
|  |         } else { | ||||||
|  |           console.warn('建议将微信基础库调整大于等于2.9.0版本。升级后绘图将有更好性能'); | ||||||
|  |           this.initByOldWay(callback); | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |  | ||||||
|  |     initByOldWay(callback) { | ||||||
|  |       // 1.9.91 <= version < 2.9.0:原来的方式初始化 | ||||||
|  |       ctx = wx.createCanvasContext(this.data.canvasId, this); | ||||||
|  |       const canvas = new WxCanvas(ctx, this.data.canvasId, false); | ||||||
|  |  | ||||||
|  |       echarts.setCanvasCreator(() => { | ||||||
|  |         return canvas; | ||||||
|  |       }); | ||||||
|  |       // const canvasDpr = wx.getSystemInfoSync().pixelRatio // 微信旧的canvas不能传入dpr | ||||||
|  |       const canvasDpr = 1 | ||||||
|  |       var query = wx.createSelectorQuery().in(this); | ||||||
|  |       query.select('.ec-canvas').boundingClientRect(res => { | ||||||
|  |         if (typeof callback === 'function') { | ||||||
|  |           this.chart = callback(canvas, res.width, res.height, canvasDpr); | ||||||
|  |         } | ||||||
|  |         else if (this.data.ec && typeof this.data.ec.onInit === 'function') { | ||||||
|  |           this.chart = this.data.ec.onInit(canvas, res.width, res.height, canvasDpr); | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  |           this.triggerEvent('init', { | ||||||
|  |             canvas: canvas, | ||||||
|  |             width: res.width, | ||||||
|  |             height: res.height, | ||||||
|  |             canvasDpr: canvasDpr // 增加了dpr,可方便外面echarts.init | ||||||
|  |           }); | ||||||
|  |         } | ||||||
|  |       }).exec(); | ||||||
|  |     }, | ||||||
|  |  | ||||||
|  |     initByNewWay(callback) { | ||||||
|  |       // version >= 2.9.0:使用新的方式初始化 | ||||||
|  |       const query = wx.createSelectorQuery().in(this) | ||||||
|  |       query | ||||||
|  |         .select('.ec-canvas') | ||||||
|  |         .fields({ node: true, size: true }) | ||||||
|  |         .exec(res => { | ||||||
|  |           const canvasNode = res[0].node | ||||||
|  |           this.canvasNode = canvasNode | ||||||
|  |  | ||||||
|  |           const canvasDpr = wx.getSystemInfoSync().pixelRatio | ||||||
|  |           const canvasWidth = res[0].width | ||||||
|  |           const canvasHeight = res[0].height | ||||||
|  |  | ||||||
|  |           const ctx = canvasNode.getContext('2d') | ||||||
|  |  | ||||||
|  |           const canvas = new WxCanvas(ctx, this.data.canvasId, true, canvasNode) | ||||||
|  |           echarts.setCanvasCreator(() => { | ||||||
|  |             return canvas | ||||||
|  |           }) | ||||||
|  |  | ||||||
|  |           if (typeof callback === 'function') { | ||||||
|  |             this.chart = callback(canvas, canvasWidth, canvasHeight, canvasDpr) | ||||||
|  |           } else if (this.data.ec && typeof this.data.ec.onInit === 'function') { | ||||||
|  |             this.chart = this.data.ec.onInit(canvas, canvasWidth, canvasHeight, canvasDpr) | ||||||
|  |           } else { | ||||||
|  |             this.triggerEvent('init', { | ||||||
|  |               canvas: canvas, | ||||||
|  |               width: canvasWidth, | ||||||
|  |               height: canvasHeight, | ||||||
|  |               dpr: canvasDpr | ||||||
|  |             }) | ||||||
|  |           } | ||||||
|  |         }) | ||||||
|  |     }, | ||||||
|  |     canvasToTempFilePath(opt) { | ||||||
|  |       if (this.data.isUseNewCanvas) { | ||||||
|  |         // 新版 | ||||||
|  |         const query = wx.createSelectorQuery().in(this) | ||||||
|  |         query | ||||||
|  |           .select('.ec-canvas') | ||||||
|  |           .fields({ node: true, size: true }) | ||||||
|  |           .exec(res => { | ||||||
|  |             const canvasNode = res[0].node | ||||||
|  |             opt.canvas = canvasNode | ||||||
|  |             wx.canvasToTempFilePath(opt) | ||||||
|  |           }) | ||||||
|  |       } else { | ||||||
|  |         // 旧的 | ||||||
|  |         if (!opt.canvasId) { | ||||||
|  |           opt.canvasId = this.data.canvasId; | ||||||
|  |         } | ||||||
|  |         ctx.draw(true, () => { | ||||||
|  |           wx.canvasToTempFilePath(opt, this); | ||||||
|  |         }); | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |  | ||||||
|  |     touchStart(e) { | ||||||
|  |       if (this.chart && e.touches.length > 0) { | ||||||
|  |         var touch = e.touches[0]; | ||||||
|  |         var handler = this.chart.getZr().handler; | ||||||
|  |         handler.dispatch('mousedown', { | ||||||
|  |           zrX: touch.x, | ||||||
|  |           zrY: touch.y | ||||||
|  |         }); | ||||||
|  |         handler.dispatch('mousemove', { | ||||||
|  |           zrX: touch.x, | ||||||
|  |           zrY: touch.y | ||||||
|  |         }); | ||||||
|  |         handler.processGesture(wrapTouch(e), 'start'); | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |  | ||||||
|  |     touchMove(e) { | ||||||
|  |       if (this.chart && e.touches.length > 0) { | ||||||
|  |         var touch = e.touches[0]; | ||||||
|  |         var handler = this.chart.getZr().handler; | ||||||
|  |         handler.dispatch('mousemove', { | ||||||
|  |           zrX: touch.x, | ||||||
|  |           zrY: touch.y | ||||||
|  |         }); | ||||||
|  |         handler.processGesture(wrapTouch(e), 'change'); | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |  | ||||||
|  |     touchEnd(e) { | ||||||
|  |       if (this.chart) { | ||||||
|  |         const touch = e.changedTouches ? e.changedTouches[0] : {}; | ||||||
|  |         var handler = this.chart.getZr().handler; | ||||||
|  |         handler.dispatch('mouseup', { | ||||||
|  |           zrX: touch.x, | ||||||
|  |           zrY: touch.y | ||||||
|  |         }); | ||||||
|  |         handler.dispatch('click', { | ||||||
|  |           zrX: touch.x, | ||||||
|  |           zrY: touch.y | ||||||
|  |         }); | ||||||
|  |         handler.processGesture(wrapTouch(e), 'end'); | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | }); | ||||||
|  |  | ||||||
|  | function wrapTouch(event) { | ||||||
|  |   for (let i = 0; i < event.touches.length; ++i) { | ||||||
|  |     const touch = event.touches[i]; | ||||||
|  |     touch.offsetX = touch.x; | ||||||
|  |     touch.offsetY = touch.y; | ||||||
|  |   } | ||||||
|  |   return event; | ||||||
|  | } | ||||||
							
								
								
									
										4
									
								
								components/echarts/ec-canvas.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								components/echarts/ec-canvas.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | { | ||||||
|  |   "component": true, | ||||||
|  |   "usingComponents": {} | ||||||
|  | } | ||||||
							
								
								
									
										4
									
								
								components/echarts/ec-canvas.wxml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								components/echarts/ec-canvas.wxml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | <!-- 新的:接口对其了H5 --> | ||||||
|  | <canvas wx:if="{{isUseNewCanvas}}" type="2d" class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas> | ||||||
|  | <!-- 旧的 --> | ||||||
|  | <canvas wx:else class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas> | ||||||
							
								
								
									
										6
									
								
								components/echarts/ec-canvas.wxss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								components/echarts/ec-canvas.wxss
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | |||||||
|  | .ec-canvas { | ||||||
|  |   position: static !important; | ||||||
|  |   float: none; | ||||||
|  |   width: 700rpx; | ||||||
|  |   height: 700rpx; | ||||||
|  | } | ||||||
							
								
								
									
										1
									
								
								components/echarts/echarts.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								components/echarts/echarts.js
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										121
									
								
								components/echarts/wx-canvas.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										121
									
								
								components/echarts/wx-canvas.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,121 @@ | |||||||
|  | export default class WxCanvas { | ||||||
|  |   constructor(ctx, canvasId, isNew, canvasNode) { | ||||||
|  |     this.ctx = ctx; | ||||||
|  |     this.canvasId = canvasId; | ||||||
|  |     this.chart = null; | ||||||
|  |     this.isNew = isNew | ||||||
|  |     if (isNew) { | ||||||
|  |       this.canvasNode = canvasNode; | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |       this._initStyle(ctx); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     // this._initCanvas(zrender, ctx); | ||||||
|  |  | ||||||
|  |     this._initEvent(); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   getContext(contextType) { | ||||||
|  |     if (contextType === '2d') { | ||||||
|  |       return this.ctx; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   // canvasToTempFilePath(opt) { | ||||||
|  |   //   if (!opt.canvasId) { | ||||||
|  |   //     opt.canvasId = this.canvasId; | ||||||
|  |   //   } | ||||||
|  |   //   return wx.canvasToTempFilePath(opt, this); | ||||||
|  |   // } | ||||||
|  |  | ||||||
|  |   setChart(chart) { | ||||||
|  |     this.chart = chart; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   attachEvent() { | ||||||
|  |     // noop | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   detachEvent() { | ||||||
|  |     // noop | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   _initCanvas(zrender, ctx) { | ||||||
|  |     zrender.util.getContext = function () { | ||||||
|  |       return ctx; | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     zrender.util.$override('measureText', function (text, font) { | ||||||
|  |       ctx.font = font || '12px sans-serif'; | ||||||
|  |       return ctx.measureText(text); | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   _initStyle(ctx) { | ||||||
|  |     var styles = ['fillStyle', 'strokeStyle', 'globalAlpha', | ||||||
|  |       'textAlign', 'textBaseAlign', 'shadow', 'lineWidth', | ||||||
|  |       'lineCap', 'lineJoin', 'lineDash', 'miterLimit', 'fontSize']; | ||||||
|  |  | ||||||
|  |     styles.forEach(style => { | ||||||
|  |       Object.defineProperty(ctx, style, { | ||||||
|  |         set: value => { | ||||||
|  |           if (style !== 'fillStyle' && style !== 'strokeStyle' | ||||||
|  |             || value !== 'none' && value !== null | ||||||
|  |           ) { | ||||||
|  |             ctx['set' + style.charAt(0).toUpperCase() + style.slice(1)](value); | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       }); | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |     ctx.createRadialGradient = () => { | ||||||
|  |       return ctx.createCircularGradient(arguments); | ||||||
|  |     }; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   _initEvent() { | ||||||
|  |     this.event = {}; | ||||||
|  |     const eventNames = [{ | ||||||
|  |       wxName: 'touchStart', | ||||||
|  |       ecName: 'mousedown' | ||||||
|  |     }, { | ||||||
|  |       wxName: 'touchMove', | ||||||
|  |       ecName: 'mousemove' | ||||||
|  |     }, { | ||||||
|  |       wxName: 'touchEnd', | ||||||
|  |       ecName: 'mouseup' | ||||||
|  |     }, { | ||||||
|  |       wxName: 'touchEnd', | ||||||
|  |       ecName: 'click' | ||||||
|  |     }]; | ||||||
|  |  | ||||||
|  |     eventNames.forEach(name => { | ||||||
|  |       this.event[name.wxName] = e => { | ||||||
|  |         const touch = e.touches[0]; | ||||||
|  |         this.chart.getZr().handler.dispatch(name.ecName, { | ||||||
|  |           zrX: name.wxName === 'tap' ? touch.clientX : touch.x, | ||||||
|  |           zrY: name.wxName === 'tap' ? touch.clientY : touch.y | ||||||
|  |         }); | ||||||
|  |       }; | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   set width(w) { | ||||||
|  |     if (this.canvasNode) this.canvasNode.width = w | ||||||
|  |   } | ||||||
|  |   set height(h) { | ||||||
|  |     if (this.canvasNode) this.canvasNode.height = h | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   get width() { | ||||||
|  |     if (this.canvasNode) | ||||||
|  |       return this.canvasNode.width | ||||||
|  |     return 0 | ||||||
|  |   } | ||||||
|  |   get height() { | ||||||
|  |     if (this.canvasNode) | ||||||
|  |       return this.canvasNode.height | ||||||
|  |     return 0 | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -1,35 +1,20 @@ | |||||||
| import { getMeterList } from "../../service/meter"; | // pages/billDetail/index.js
 | ||||||
| 
 |  | ||||||
| // pages/meterList/index.js
 |  | ||||||
| Page({ | Page({ | ||||||
| 
 | 
 | ||||||
|   /** |   /** | ||||||
|    * 页面的初始数据 |    * 页面的初始数据 | ||||||
|    */ |    */ | ||||||
|   data: { |   data: { | ||||||
|     list: [ |  | ||||||
| 
 | 
 | ||||||
|     ] |  | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   /** |   /** | ||||||
|    * 生命周期函数--监听页面加载 |    * 生命周期函数--监听页面加载 | ||||||
|    */ |    */ | ||||||
|   onLoad(options) { |   onLoad(options) { | ||||||
|     this.getList(); | 
 | ||||||
|   }, |  | ||||||
|   async getList() { |  | ||||||
|     const { code, message, data = [] } = await getMeterList() |  | ||||||
|     this.setData({ |  | ||||||
|       list: data |  | ||||||
|     }) |  | ||||||
|   }, |  | ||||||
|   jumpToRecharge(e) { |  | ||||||
|     const { code, tenement } = e.currentTarget.dataset; |  | ||||||
|     wx.navigateTo({ |  | ||||||
|       url: `/pages/recharge/index?code=${code}&tenement=${tenement}`, |  | ||||||
|     }) |  | ||||||
|   }, |   }, | ||||||
|  | 
 | ||||||
|   /** |   /** | ||||||
|    * 生命周期函数--监听页面初次渲染完成 |    * 生命周期函数--监听页面初次渲染完成 | ||||||
|    */ |    */ | ||||||
							
								
								
									
										3
									
								
								pages/billDetail/index.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								pages/billDetail/index.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | |||||||
|  | { | ||||||
|  |   "usingComponents": {} | ||||||
|  | } | ||||||
							
								
								
									
										2
									
								
								pages/billDetail/index.wxml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								pages/billDetail/index.wxml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | |||||||
|  | <!--pages/billDetail/index.wxml--> | ||||||
|  | <web-view src="http://localhost:3000/userReport/1/1"/> | ||||||
							
								
								
									
										1
									
								
								pages/billDetail/index.wxss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								pages/billDetail/index.wxss
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | /* pages/billDetail/index.wxss */ | ||||||
							
								
								
									
										87
									
								
								pages/billList/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								pages/billList/index.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,87 @@ | |||||||
|  | import { getBillList } from "../../service/accounting" | ||||||
|  | import { alertInfo } from "../../utils/index"; | ||||||
|  | import request from '../../utils/request' | ||||||
|  | const { OK } = request; | ||||||
|  | // pages/billList/index.js | ||||||
|  | Page({ | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 页面的初始数据 | ||||||
|  |    */ | ||||||
|  |   data: { | ||||||
|  |     page: 1, | ||||||
|  |     list: [] | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 生命周期函数--监听页面加载 | ||||||
|  |    */ | ||||||
|  |   onLoad(options) { | ||||||
|  |     this.init(); | ||||||
|  |   }, | ||||||
|  |   async init() { | ||||||
|  |     const { page, list } = this.data; | ||||||
|  |     const { code, data, message } = await getBillList(page) | ||||||
|  |     if (!data?.length) { | ||||||
|  |       alertInfo("没用更多了") | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|  |     this.setData({ | ||||||
|  |       list: [...list, ...data], | ||||||
|  |       page: page + 1, | ||||||
|  |     }) | ||||||
|  |   }, | ||||||
|  |   jumpToDetail() { | ||||||
|  |     wx.navigateTo({ | ||||||
|  |       url: '/pages/billDetail/index', | ||||||
|  |     }) | ||||||
|  |   }, | ||||||
|  |   /** | ||||||
|  |    * 生命周期函数--监听页面初次渲染完成 | ||||||
|  |    */ | ||||||
|  |   onReady() { | ||||||
|  |  | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 生命周期函数--监听页面显示 | ||||||
|  |    */ | ||||||
|  |   onShow() { | ||||||
|  |  | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 生命周期函数--监听页面隐藏 | ||||||
|  |    */ | ||||||
|  |   onHide() { | ||||||
|  |  | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 生命周期函数--监听页面卸载 | ||||||
|  |    */ | ||||||
|  |   onUnload() { | ||||||
|  |  | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 页面相关事件处理函数--监听用户下拉动作 | ||||||
|  |    */ | ||||||
|  |   onPullDownRefresh() { | ||||||
|  |  | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 页面上拉触底事件的处理函数 | ||||||
|  |    */ | ||||||
|  |   onReachBottom() { | ||||||
|  |  | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 用户点击右上角分享 | ||||||
|  |    */ | ||||||
|  |   onShareAppMessage() { | ||||||
|  |  | ||||||
|  |   } | ||||||
|  | }) | ||||||
							
								
								
									
										7
									
								
								pages/billList/index.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								pages/billList/index.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | |||||||
|  | { | ||||||
|  |   "usingComponents": { | ||||||
|  |     "navigator": "/components/navigator/index", | ||||||
|  |     "van-icon": "@vant/weapp/icon/index" | ||||||
|  |   }, | ||||||
|  |   "navigationStyle": "custom" | ||||||
|  | } | ||||||
							
								
								
									
										8
									
								
								pages/billList/index.wxml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								pages/billList/index.wxml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | <!--pages/billList/index.wxml--> | ||||||
|  | <navigator title="电费账单" canBack="{{true}}" /> | ||||||
|  |  | ||||||
|  | <view class="itemWrapper" wx:for="{{list}}" wx:key="index"> | ||||||
|  |   <van-icon name="balance-list-o" /> | ||||||
|  |   <view class="time"> {{ item.time }} </view> | ||||||
|  |   <view class="operate" bind:tap="jumpToDetail"> 查看详细 </view> | ||||||
|  | </view> | ||||||
							
								
								
									
										23
									
								
								pages/billList/index.wxss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								pages/billList/index.wxss
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | |||||||
|  | /* pages/billList/index.wxss */ | ||||||
|  | page { | ||||||
|  |   background-color: var(--transparent-green); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .itemWrapper { | ||||||
|  |   margin: 20rpx 30rpx 20rpx 30rpx; | ||||||
|  |   background-color: #fff; | ||||||
|  |   border-radius: 20rpx; | ||||||
|  |   box-sizing: border-box; | ||||||
|  |   padding: 30rpx; | ||||||
|  |   display: flex; | ||||||
|  |   align-items: center; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .time { | ||||||
|  |   flex: 1; | ||||||
|  |   text-indent: 40rpx; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .operate { | ||||||
|  |    | ||||||
|  | } | ||||||
| @@ -1,28 +1,20 @@ | |||||||
| import { getInvoiceInfoDetail } from "../../service/invoice"; | // pages/editInvoice/index.js | ||||||
|  |  | ||||||
| // pages/invoiceInfo/index.js |  | ||||||
| Page({ | Page({ | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * 页面的初始数据 |    * 页面的初始数据 | ||||||
|    */ |    */ | ||||||
|   data: { |   data: { | ||||||
|     detail: {} |  | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * 生命周期函数--监听页面加载 |    * 生命周期函数--监听页面加载 | ||||||
|    */ |    */ | ||||||
|   onLoad(options) { |   onLoad(options) { | ||||||
|     const { id } = options; |  | ||||||
|     if (id !== "-1") { |  | ||||||
|       this.init(id); |  | ||||||
|     } |  | ||||||
|   }, |  | ||||||
|   async init(id) { |  | ||||||
|     const { code, message, data } = await getInvoiceInfoDetail(id) |  | ||||||
|     this.setData({ detail: data }); |  | ||||||
|   }, |   }, | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * 生命周期函数--监听页面初次渲染完成 |    * 生命周期函数--监听页面初次渲染完成 | ||||||
|    */ |    */ | ||||||
|   | |||||||
| @@ -1,6 +0,0 @@ | |||||||
| { |  | ||||||
|   "usingComponents": { |  | ||||||
|     "van-field": "@vant/weapp/field/index", |  | ||||||
|     "van-button": "@vant/weapp/button/index" |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| @@ -1,50 +1,2 @@ | |||||||
| <van-cell-group> | <!--pages/editInvoice/index.wxml--> | ||||||
|   <van-field | <text>pages/editInvoice/index.wxml</text> | ||||||
|     value="{{ detail.name }}" |  | ||||||
|     label="公司名称" |  | ||||||
|     border="{{ false }}" |  | ||||||
|     placeholder="请选择公司名称" |  | ||||||
|     required |  | ||||||
|   /> |  | ||||||
|   <van-field |  | ||||||
|     value="{{ detail.tin }}" |  | ||||||
|     label="税号" |  | ||||||
|     border="{{ false }}" |  | ||||||
|     placeholder="请输入税号" |  | ||||||
|     required |  | ||||||
|   /> |  | ||||||
|   <van-field |  | ||||||
|     value="{{ detail.address }}" |  | ||||||
|     label="单位地址" |  | ||||||
|     border="{{ false }}" |  | ||||||
|     placeholder="请输入单位地址" |  | ||||||
|   /> |  | ||||||
|   <van-field |  | ||||||
|     value="{{ detail.phone }}" |  | ||||||
|     label="电话" |  | ||||||
|     border="{{ false }}" |  | ||||||
|     placeholder="请输入电话" |  | ||||||
|   /> |  | ||||||
|   <van-field |  | ||||||
|     value="{{ detail.bank }}" |  | ||||||
|     label="开户银行" |  | ||||||
|     border="{{ false }}" |  | ||||||
|     placeholder="请输入开户银行" |  | ||||||
|   /> |  | ||||||
|   <van-field |  | ||||||
|     value="{{ detail.account }}" |  | ||||||
|     label="开户账号" |  | ||||||
|     border="{{ false }}" |  | ||||||
|     placeholder="请输入开户账号" |  | ||||||
|   /> |  | ||||||
|   <van-field |  | ||||||
|     value="{{ detail.email }}" |  | ||||||
|     label="邮箱" |  | ||||||
|     border="{{ false }}" |  | ||||||
|     placeholder="请输入邮箱" |  | ||||||
|   /> |  | ||||||
| </van-cell-group> |  | ||||||
|  |  | ||||||
| <view class="wrapper operate"> |  | ||||||
|   <van-button type="info" block style="margin-left: 30rpx;flex: 1;">保存</van-button> |  | ||||||
| </view> |  | ||||||
| @@ -1,6 +0,0 @@ | |||||||
| /* pages/editInvoice/index.wxss */ |  | ||||||
| .operate { |  | ||||||
|   display: flex; |  | ||||||
|   align-items: center; |  | ||||||
|   margin-top: 50rpx; |  | ||||||
| } |  | ||||||
							
								
								
									
										150
									
								
								pages/electricQuery/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										150
									
								
								pages/electricQuery/index.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,150 @@ | |||||||
|  | // pages/electricQuery/index.js | ||||||
|  | import { getElectricityList } from "../../service/accounting"; | ||||||
|  | import { getTenementMeterList } from "../../service/meter"; | ||||||
|  | import dayjs from "../../utils/dayjs"; | ||||||
|  | import request from '../../utils/request'; | ||||||
|  | import * as echarts from '../..//components/echarts/echarts'; | ||||||
|  | const { OK } = request; | ||||||
|  | const piedata = [1,2,3,4,5] | ||||||
|  | Page({ | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 页面的初始数据 | ||||||
|  |    */ | ||||||
|  |   data: { | ||||||
|  |     queryType: 0, | ||||||
|  |     timeType: 0, | ||||||
|  |     show: false, | ||||||
|  |     columns: [], | ||||||
|  |     meterList: [], | ||||||
|  |     meterCode: "", | ||||||
|  |     meterId: "", | ||||||
|  |     year: dayjs().format('YYYY'), | ||||||
|  |     yearMonth: dayjs().format("YYYY-MM"), | ||||||
|  |     yearMonthDay: dayjs().format("YYYY-MM-DD"), | ||||||
|  |     header: [ | ||||||
|  |       { key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address }, | ||||||
|  |       { title: '时间',renderBody: (item) => { return item.time } }, | ||||||
|  |       { key: 'number', title: '耗量' }, | ||||||
|  |     ], | ||||||
|  |     list: [] | ||||||
|  |   }, | ||||||
|  |   changeQueryType(e) { | ||||||
|  |     const { type } = e.currentTarget.dataset | ||||||
|  |     this.setData({ queryType: type },() => { | ||||||
|  |       this.init() | ||||||
|  |     }) | ||||||
|  |   }, | ||||||
|  |   changeTimeType(e) { | ||||||
|  |     const { type } = e.currentTarget.dataset | ||||||
|  |     this.setData({ timeType: type }, () => { | ||||||
|  |       this.init() | ||||||
|  |     }) | ||||||
|  |   }, | ||||||
|  |    | ||||||
|  |   /** | ||||||
|  |    * 生命周期函数--监听页面加载 | ||||||
|  |    */ | ||||||
|  |   onLoad(options) { | ||||||
|  |     this.init() | ||||||
|  |   }, | ||||||
|  |   async init() { | ||||||
|  |     const { queryType, timeType, meterId } = this.data; | ||||||
|  |     const { code, message, data } = await getElectricityList({ type: queryType, meter: meterId, time: timeType }) | ||||||
|  |     console.log('data', data) | ||||||
|  |     this.setData({ list: data }) | ||||||
|  |   }, | ||||||
|  |   async getMeters() { | ||||||
|  |     const { id } = wx.getStorageSync('tenement') | ||||||
|  |     const { code, message, data } = await getTenementMeterList(id); | ||||||
|  |     // if (code !== OK) { | ||||||
|  |     //   alertInfo(message) | ||||||
|  |     //   return; | ||||||
|  |     // } | ||||||
|  |      | ||||||
|  |     this.setData({ | ||||||
|  |       meterList: data || [], | ||||||
|  |     }) | ||||||
|  |   }, | ||||||
|  |   clickMeter() { | ||||||
|  |     this.setData({ | ||||||
|  |       type: "meter", | ||||||
|  |       columns: [{ id: "", name: "全部", code: "" }, ...this.data.meterList.map(item => ({ id: item.id, name: `${item.code}-${item.address}`, code: item.code }))], | ||||||
|  |       show: true, | ||||||
|  |       title: "表计" | ||||||
|  |     }) | ||||||
|  |   }, | ||||||
|  |   onCancel() { | ||||||
|  |     this.setData({ | ||||||
|  |       type: "meter", | ||||||
|  |       columns: [], | ||||||
|  |       show: false, | ||||||
|  |       title: "", | ||||||
|  |     }) | ||||||
|  |   }, | ||||||
|  |   onOk(e) { | ||||||
|  |     const { type, value = {} } = e.detail; | ||||||
|  |     const { id, code } = e; | ||||||
|  |     console.log('e', e) | ||||||
|  |     const { year } = this.data; | ||||||
|  |     // const currentYear = years[Number(e)] | ||||||
|  |     this.setData({ | ||||||
|  |       // year: currentYear, | ||||||
|  |       codeId: id, | ||||||
|  |       meterCode: code,  | ||||||
|  |       type: "", | ||||||
|  |       show: false, | ||||||
|  |       title: "" | ||||||
|  |     }, () => { | ||||||
|  |       this.init(); | ||||||
|  |     }) | ||||||
|  |   }, | ||||||
|  |   /** | ||||||
|  |    * 生命周期函数--监听页面初次渲染完成 | ||||||
|  |    */ | ||||||
|  |   onReady() { | ||||||
|  |  | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 生命周期函数--监听页面显示 | ||||||
|  |    */ | ||||||
|  |   onShow() { | ||||||
|  |     this.getMeters() | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 生命周期函数--监听页面隐藏 | ||||||
|  |    */ | ||||||
|  |   onHide() { | ||||||
|  |  | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 生命周期函数--监听页面卸载 | ||||||
|  |    */ | ||||||
|  |   onUnload() { | ||||||
|  |  | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 页面相关事件处理函数--监听用户下拉动作 | ||||||
|  |    */ | ||||||
|  |   onPullDownRefresh() { | ||||||
|  |  | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 页面上拉触底事件的处理函数 | ||||||
|  |    */ | ||||||
|  |   onReachBottom() { | ||||||
|  |  | ||||||
|  |   }, | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 用户点击右上角分享 | ||||||
|  |    */ | ||||||
|  |   onShareAppMessage() { | ||||||
|  |  | ||||||
|  |   } | ||||||
|  | }) | ||||||
							
								
								
									
										13
									
								
								pages/electricQuery/index.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								pages/electricQuery/index.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | |||||||
|  | { | ||||||
|  |   "usingComponents": { | ||||||
|  |     "navigator": "/components/navigator/index", | ||||||
|  |     "van-icon": "@vant/weapp/icon/index", | ||||||
|  |     "custom-picker": "/components/picker/index", | ||||||
|  |     "van-row": "@vant/weapp/row/index", | ||||||
|  |     "van-col": "@vant/weapp/col/index", | ||||||
|  |     "van-button": "@vant/weapp/button/index", | ||||||
|  |     "table": "/components/table/table", | ||||||
|  |     "empty": "/components/empty/index" | ||||||
|  |   }, | ||||||
|  |   "navigationStyle": "custom" | ||||||
|  | } | ||||||
							
								
								
									
										81
									
								
								pages/electricQuery/index.wxml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								pages/electricQuery/index.wxml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,81 @@ | |||||||
|  | <!--pages/electricQuery/index.wxml--> | ||||||
|  | <navigator title="用电查询" canBack="{{true}}" /> | ||||||
|  | <view class="wrapper"> | ||||||
|  |   <view class="queryWrapper"> | ||||||
|  |     <view class="label"> | ||||||
|  |       选择电表 | ||||||
|  |     </view> | ||||||
|  |     <view class="select" bind:tap="clickMeter"> | ||||||
|  |       <view class="selectContent"> | ||||||
|  |         {{ meterCode === "" ? '全部' : meterCode  }} | ||||||
|  |       </view> | ||||||
|  |       <van-icon name="arrow-down" /> | ||||||
|  |     </view> | ||||||
|  |   </view> | ||||||
|  |  | ||||||
|  |   <view class="query"> | ||||||
|  |     <view class="typeQuery"> | ||||||
|  |       <van-row> | ||||||
|  |         <van-col span="8"> | ||||||
|  |           <view class="typeQueryText" style="color: {{queryType === 0 ? '#0958d9' : '#000'}}" bind:tap="changeQueryType" data-type="{{0}}"> 电量查询 </view> | ||||||
|  |         </van-col> | ||||||
|  |         <van-col span="8"> | ||||||
|  |           <view class="typeQueryText" style="color: {{queryType === 1 ? '#0958d9' : '#000'}}" bind:tap="changeQueryType" data-type="{{1}}"> 抄表记录 </view> | ||||||
|  |         </van-col> | ||||||
|  |         <van-col span="8"> | ||||||
|  |           <view class="typeQueryText" style="color: {{queryType === 2 ? '#0958d9' : '#000'}}" bind:tap="changeQueryType" data-type="{{2}}"> 账务余额 </view> | ||||||
|  |         </van-col> | ||||||
|  |       </van-row> | ||||||
|  |     </view> | ||||||
|  |     <view class="timeQuery" wx:if="{{queryType === 0}}"> | ||||||
|  |       <van-row> | ||||||
|  |         <van-col span="8"> | ||||||
|  |           <view class="timeQueryText" style="color: {{timeType === 0 ? '#0958d9' : '#000'}}" bind:tap="changeTimeType" data-type="{{0}}"> 日耗量 </view> | ||||||
|  |         </van-col> | ||||||
|  |         <van-col span="8"> | ||||||
|  |           <view class="timeQueryText" style="color: {{timeType === 1 ? '#0958d9' : '#000'}}" bind:tap="changeTimeType" data-type="{{1}}"> 月耗量 </view> | ||||||
|  |         </van-col> | ||||||
|  |         <van-col span="8"> | ||||||
|  |           <view class="timeQueryText" style="color: {{timeType === 2 ? '#0958d9' : '#000'}}" bind:tap="changeTimeType" data-type="{{2}}"> 年耗量 </view> | ||||||
|  |         </van-col> | ||||||
|  |       </van-row> | ||||||
|  |     </view> | ||||||
|  |   </view> | ||||||
|  |   <view class="tooltip"> | ||||||
|  |     不包括线损电量,显示为电表实际消耗电量。仅供参考,实际能耗电量以电费账单为主。如有疑问,请联系客服。 | ||||||
|  |   </view> | ||||||
|  |   <view class="timeChooseWrapper"> | ||||||
|  |     <view> 选择时间 </view> | ||||||
|  |     <view class="time"> | ||||||
|  |       <view class="timeText"> {{yearMonthDay}} </view> | ||||||
|  |       <van-icon name="arrow-down" /> | ||||||
|  |     </view> | ||||||
|  |     <van-button type="info" size="small"> 导出 </van-button> | ||||||
|  |   </view> | ||||||
|  |   | ||||||
|  |    | ||||||
|  | </view> | ||||||
|  | <view style="margin: 30rpx;"> | ||||||
|  |     <table header="{{header}}" list="{{list}}" wx:if="{{list.length}}" /> | ||||||
|  |     <empty bind:refresh="init" wx:else /> | ||||||
|  |   </view> | ||||||
|  |   <view class="sum"> | ||||||
|  |     合计:表计数量:10,耗电量100 | ||||||
|  |   </view> | ||||||
|  |   <!-- <echarts  | ||||||
|  |     style="width:200rpx;height:200rpx;position:relative"  | ||||||
|  |     id="echarts"  | ||||||
|  |     class='mychart-bar'  | ||||||
|  |     canvas-id="mychart-bar"  | ||||||
|  |     ec="{{ ec }}"     | ||||||
|  |   > | ||||||
|  |   </echarts> --> | ||||||
|  | <custom-picker  | ||||||
|  |   title="{{title}}"  | ||||||
|  |   show="{{show}}"  | ||||||
|  |   valueKey="name"  | ||||||
|  |   columns="{{columns}}"  | ||||||
|  |   bind:ok="onOk"  | ||||||
|  |   bind:cancel="onCancel"  | ||||||
|  |   type="{{type}}"  | ||||||
|  | /> | ||||||
							
								
								
									
										89
									
								
								pages/electricQuery/index.wxss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								pages/electricQuery/index.wxss
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,89 @@ | |||||||
|  | /* pages/electricQuery/index.wxss */ | ||||||
|  | page { | ||||||
|  |   background-color: var(--transparent-green); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .queryWrapper { | ||||||
|  |   margin: 20rpx 0rpx; | ||||||
|  |   background-color: #fff; | ||||||
|  |   padding: 30rpx; | ||||||
|  |   box-sizing: border-box; | ||||||
|  |   border-radius: 20rpx; | ||||||
|  |   display: flex; | ||||||
|  |   align-items: center; | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .label { | ||||||
|  |   width: 180rpx; | ||||||
|  |   font-size: 34rpx; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .sum { | ||||||
|  |   margin-bottom: 30rpx; | ||||||
|  |   margin-left: 30rpx; | ||||||
|  |   margin-right: 30rpx; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .query { | ||||||
|  |   margin: 20rpx 0rpx; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .typeQueryText { | ||||||
|  |   text-align: center; | ||||||
|  |   padding: 30rpx; | ||||||
|  |   background-color: var(--light-green); | ||||||
|  |   font-size: 34rpx; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .select { | ||||||
|  |   border: 1rpx solid #ccc; | ||||||
|  |   padding: 12rpx; | ||||||
|  |   border-radius: 12rpx; | ||||||
|  |   flex: 1; | ||||||
|  |   display: flex; | ||||||
|  |   justify-content: space-between; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .timeQueryText { | ||||||
|  |   text-align: center; | ||||||
|  |   padding: 30rpx; | ||||||
|  |   background-color: rgb(242,248,246); | ||||||
|  |   font-size: 34rpx; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .wrapper { | ||||||
|  |   margin-left: 30rpx; | ||||||
|  |   margin-right: 30rpx; | ||||||
|  |   padding: 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .tooltip { | ||||||
|  |   margin: 20rpx 0; | ||||||
|  |   font-size: 32rpx; | ||||||
|  | } | ||||||
|  | .timeChooseWrapper { | ||||||
|  |   display: flex; | ||||||
|  |   align-items: center; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .time { | ||||||
|  |   flex: 1; | ||||||
|  |   margin-left: 30rpx; | ||||||
|  |   margin-right: 30rpx; | ||||||
|  |   display: flex; | ||||||
|  |   padding: 10rpx 20rpx; | ||||||
|  |   border-radius: 12rpx; | ||||||
|  |   border: 1rpx solid #ccc; | ||||||
|  |   background-color: #fff; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .timeText { | ||||||
|  |   flex: 1; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | .mychart-bar::after{ | ||||||
|  |   content:"";    | ||||||
|  |   display:block;  | ||||||
|  |   clear:both | ||||||
|  | } | ||||||
| @@ -314,7 +314,10 @@ Page({ | |||||||
|     }) |     }) | ||||||
|   }, |   }, | ||||||
|   jumpToOrder() { |   jumpToOrder() { | ||||||
|     alertInfo("尚未完成") |     // alertInfo("尚未完成") | ||||||
|  |     wx.navigateTo({ | ||||||
|  |       url: '/pages/billList/index', | ||||||
|  |     }) | ||||||
|   }, |   }, | ||||||
|   /** |   /** | ||||||
|    * 生命周期函数--监听页面隐藏 |    * 生命周期函数--监听页面隐藏 | ||||||
|   | |||||||
| @@ -1,7 +0,0 @@ | |||||||
| { |  | ||||||
|   "usingComponents": { |  | ||||||
|     "navigator": "/components/navigator/index", |  | ||||||
|     "scrollPageWrapper": "/components/scrollPageWrapper/index" |  | ||||||
|   }, |  | ||||||
|   "navigationBarTitleText": "表计列表" |  | ||||||
| } |  | ||||||
| @@ -1,24 +0,0 @@ | |||||||
| <!--pages/meterList/index.wxml--> |  | ||||||
| <view class="wrapper"> |  | ||||||
|   <view wx:for="{{list}}" wx:key="index"  class="listItem"> |  | ||||||
|     <view class="tenementName"> {{ item.tenement.name }} :</view> |  | ||||||
|     <view class="meter"  wx:for="{{item.meter}}" wx:for-item="ele" wx:key="code"> |  | ||||||
|       <view class="content"> |  | ||||||
|         <view class="code"> 表{{ ele.code }}:余额为  </view> |  | ||||||
|         <view class="money"> {{ ele.money }} </view> |  | ||||||
|         <view  |  | ||||||
|           class="primaryTextBtn"  |  | ||||||
|           bind:tap="jumpToRecharge"  |  | ||||||
|           data-tenement="{{item.tenement.id}}"  |  | ||||||
|           data-code="{{ele.code}}" |  | ||||||
|         > 充值 </view> |  | ||||||
|       </view> |  | ||||||
|       <view class="address"> |  | ||||||
|         表计地址: {{ ele.address }} |  | ||||||
|       </view> |  | ||||||
|     </view> |  | ||||||
|   </view> |  | ||||||
| </view> |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -1,40 +0,0 @@ | |||||||
| /* pages/meterList/index.wxss */ |  | ||||||
| /* .content { |  | ||||||
|   flex: 1; |  | ||||||
|   padding: 16rpx 24rpx 20rpx; |  | ||||||
|   box-sizing: border-box; |  | ||||||
|   display: flex; |  | ||||||
|   overflow: hidden; |  | ||||||
| } */ |  | ||||||
|  |  | ||||||
| .listItem { |  | ||||||
|   /* display: flex; |  | ||||||
|   align-items: center; |  | ||||||
|   justify-content: space-between; */ |  | ||||||
|   margin: 12rpx 0; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .money { |  | ||||||
|   font-size: 36rpx; |  | ||||||
|   font-weight: 600; |  | ||||||
|   margin-left: 20rpx; |  | ||||||
|   flex: 1; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .content { |  | ||||||
|   display: flex; |  | ||||||
|   align-items: center; |  | ||||||
|   margin-left: 30rpx; |  | ||||||
|   margin-right: 20rpx; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .address { |  | ||||||
|   margin-left: 30rpx; |  | ||||||
|   margin-right: 20rpx; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .tenementName { |  | ||||||
|   font-size: 42rpx; |  | ||||||
|   font-weight: 600; |  | ||||||
|   margin-bottom: 20rpx; |  | ||||||
| } |  | ||||||
| @@ -46,7 +46,6 @@ | |||||||
|     "tabIndent": "insertSpaces", |     "tabIndent": "insertSpaces", | ||||||
|     "tabSize": 2 |     "tabSize": 2 | ||||||
|   }, |   }, | ||||||
|   "libVersion": "2.12.3", |  | ||||||
|   "packOptions": { |   "packOptions": { | ||||||
|     "ignore": [], |     "ignore": [], | ||||||
|     "include": [] |     "include": [] | ||||||
|   | |||||||
							
								
								
									
										14
									
								
								service/accounting.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								service/accounting.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | |||||||
|  | import apis from '../utils/request'; | ||||||
|  | const { GET, POST, PUT, DELETE } = apis | ||||||
|  |  | ||||||
|  | // 获取电费账单列表 | ||||||
|  | export const getBillList = async function(page) { | ||||||
|  |   const tenement = wx.getStorageSync('tenement')?.id || "" | ||||||
|  |   return await GET(`/wx/getBillList?tenement=${tenement}&page=${page}`); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // 电量查询 | ||||||
|  | export const getElectricityList = async function({ meter, type, time }) { | ||||||
|  |   const tenement = wx.getStorageSync('tenement')?.id || "" | ||||||
|  |   return await GET(`/wx/getElectricityList?tenement=${tenement}&meter=${meter}&type=${type}&time=${time}`); | ||||||
|  | } | ||||||
							
								
								
									
										120
									
								
								utils/dayjs.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										120
									
								
								utils/dayjs.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,120 @@ | |||||||
|  | !(function (t, e) { | ||||||
|  |   'object' === typeof exports && 'undefined' !== typeof module ? module.exports = e() : 'function' === typeof define && define.amd ? define(e) : (t = 'undefined' !== typeof globalThis ? globalThis : t || self).dayjs = e(); | ||||||
|  | }(this, (() => { | ||||||
|  |   'use strict';const t = 1e3; const e = 6e4; const n = 36e5; const r = 'millisecond'; const i = 'second'; const s = 'minute'; const u = 'hour'; const a = 'day'; const o = 'week'; const f = 'month'; const h = 'quarter'; const c = 'year'; const d = 'date'; const $ = 'Invalid Date'; const l = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/; const y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g; const M = { name: 'en', weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_') }; const m = function (t, e, n) { | ||||||
|  |     const r = String(t);return !r || r.length >= e ? t : `${Array(e + 1 - r.length).join(n)}${t}`; | ||||||
|  |   }; const g = { s: m, z(t) { | ||||||
|  |     const e = -t.utcOffset(); const n = Math.abs(e); const r = Math.floor(n / 60); const i = n % 60;return `${(e <= 0 ? '+' : '-') + m(r, 2, '0')}:${m(i, 2, '0')}`; | ||||||
|  |   }, m: function t(e, n) { | ||||||
|  |     if (e.date() < n.date()) return -t(n, e);const r = 12 * (n.year() - e.year()) + (n.month() - e.month()); const i = e.clone().add(r, f); const s = n - i < 0; const u = e.clone().add(r + (s ? -1 : 1), f);return +(-(r + (n - i) / (s ? i - u : u - i)) || 0); | ||||||
|  |   }, a(t) { | ||||||
|  |     return t < 0 ? Math.ceil(t) || 0 : Math.floor(t); | ||||||
|  |   }, p(t) { | ||||||
|  |     return { M: f, y: c, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: h }[t] || String(t || '').toLowerCase() | ||||||
|  |       .replace(/s$/, ''); | ||||||
|  |   }, u(t) { | ||||||
|  |     return void 0 === t; | ||||||
|  |   } }; let D = 'en'; const v = {};v[D] = M;const p = function (t) { | ||||||
|  |     return t instanceof _; | ||||||
|  |   }; const S = function (t, e, n) { | ||||||
|  |     let r;if (!t) return D;if ('string' === typeof t)v[t] && (r = t), e && (v[t] = e, r = t);else { | ||||||
|  |       const i = t.name;v[i] = t, r = i; | ||||||
|  |     } return !n && r && (D = r), r || !n && D; | ||||||
|  |   }; const w = function (t, e) { | ||||||
|  |     if (p(t)) return t.clone();const n = 'object' === typeof e ? e : {};return n.date = t, n.args = arguments, new _(n); | ||||||
|  |   }; const O = g;O.l = S, O.i = p, O.w = function (t, e) { | ||||||
|  |     return w(t, { locale: e.$L, utc: e.$u, x: e.$x, $offset: e.$offset }); | ||||||
|  |   }; | ||||||
|  |   var _ = (function () { | ||||||
|  |     function M(t) { | ||||||
|  |       this.$L = S(t.locale, null, !0), this.parse(t); | ||||||
|  |     } const m = M.prototype;return m.parse = function (t) { | ||||||
|  |       this.$d = (function (t) { | ||||||
|  |         const e = t.date; const n = t.utc;if (null === e) return new Date(NaN);if (O.u(e)) return new Date;if (e instanceof Date) return new Date(e);if ('string' === typeof e && !/Z$/i.test(e)) { | ||||||
|  |           const r = e.match(l);if (r) { | ||||||
|  |             const i = r[2] - 1 || 0; const s = (r[7] || '0').substring(0, 3);return n ? new Date(Date.UTC(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s)) : new Date(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s); | ||||||
|  |           } | ||||||
|  |         } return new Date(e); | ||||||
|  |       }(t)), this.$x = t.x || {}, this.init(); | ||||||
|  |     }, m.init = function () { | ||||||
|  |       const t = this.$d;this.$y = t.getFullYear(), this.$M = t.getMonth(), this.$D = t.getDate(), this.$W = t.getDay(), this.$H = t.getHours(), this.$m = t.getMinutes(), this.$s = t.getSeconds(), this.$ms = t.getMilliseconds(); | ||||||
|  |     }, m.$utils = function () { | ||||||
|  |       return O; | ||||||
|  |     }, m.isValid = function () { | ||||||
|  |       return !(this.$d.toString() === $); | ||||||
|  |     }, m.isSame = function (t, e) { | ||||||
|  |       const n = w(t);return this.startOf(e) <= n && n <= this.endOf(e); | ||||||
|  |     }, m.isAfter = function (t, e) { | ||||||
|  |       return w(t) < this.startOf(e); | ||||||
|  |     }, m.isBefore = function (t, e) { | ||||||
|  |       return this.endOf(e) < w(t); | ||||||
|  |     }, m.$g = function (t, e, n) { | ||||||
|  |       return O.u(t) ? this[e] : this.set(n, t); | ||||||
|  |     }, m.unix = function () { | ||||||
|  |       return Math.floor(this.valueOf() / 1e3); | ||||||
|  |     }, m.valueOf = function () { | ||||||
|  |       return this.$d.getTime(); | ||||||
|  |     }, m.startOf = function (t, e) { | ||||||
|  |       const n = this; const r = !!O.u(e) || e; const h = O.p(t); const $ = function (t, e) { | ||||||
|  |         const i = O.w(n.$u ? Date.UTC(n.$y, e, t) : new Date(n.$y, e, t), n);return r ? i : i.endOf(a); | ||||||
|  |       }; const l = function (t, e) { | ||||||
|  |         return O.w(n.toDate()[t].apply(n.toDate('s'), (r ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e)), n); | ||||||
|  |       }; const y = this.$W; const M = this.$M; const m = this.$D; const g = `set${this.$u ? 'UTC' : ''}`;switch (h) { | ||||||
|  |         // eslint-disable-next-line no-var | ||||||
|  |         case c:return r ? $(1, 0) : $(31, 11);case f:return r ? $(1, M) : $(0, M + 1);case o:var D = this.$locale().weekStart || 0; var v = (y < D ? y + 7 : y) - D;return $(r ? m - v : m + (6 - v), M);case a:case d:return l(`${g}Hours`, 0);case u:return l(`${g}Minutes`, 1);case s:return l(`${g}Seconds`, 2);case i:return l(`${g}Milliseconds`, 3);default:return this.clone(); | ||||||
|  |       } | ||||||
|  |     }, m.endOf = function (t) { | ||||||
|  |       return this.startOf(t, !1); | ||||||
|  |     }, m.$set = function (t, e) { | ||||||
|  |       let n; const o = O.p(t); const h = `set${this.$u ? 'UTC' : ''}`; const $ = (n = {}, n[a] = `${h}Date`, n[d] = `${h}Date`, n[f] = `${h}Month`, n[c] = `${h}FullYear`, n[u] = `${h}Hours`, n[s] = `${h}Minutes`, n[i] = `${h}Seconds`, n[r] = `${h}Milliseconds`, n)[o]; const l = o === a ? this.$D + (e - this.$W) : e;if (o === f || o === c) { | ||||||
|  |         const y = this.clone().set(d, 1);y.$d[$](l), y.init(), this.$d = y.set(d, Math.min(this.$D, y.daysInMonth())).$d; | ||||||
|  |       } else $ && this.$d[$](l);return this.init(), this; | ||||||
|  |     }, m.set = function (t, e) { | ||||||
|  |       return this.clone().$set(t, e); | ||||||
|  |     }, m.get = function (t) { | ||||||
|  |       return this[O.p(t)](); | ||||||
|  |     }, m.add = function (r, h) { | ||||||
|  |       let d; const $ = this;r = Number(r);const l = O.p(h); const y = function (t) { | ||||||
|  |         const e = w($);return O.w(e.date(e.date() + Math.round(t * r)), $); | ||||||
|  |       };if (l === f) return this.set(f, this.$M + r);if (l === c) return this.set(c, this.$y + r);if (l === a) return y(1);if (l === o) return y(7);const M = (d = {}, d[s] = e, d[u] = n, d[i] = t, d)[l] || 1; const m = this.$d.getTime() + r * M;return O.w(m, this); | ||||||
|  |     }, m.subtract = function (t, e) { | ||||||
|  |       return this.add(-1 * t, e); | ||||||
|  |     }, m.format = function (t) { | ||||||
|  |       const e = this; const n = this.$locale();if (!this.isValid()) return n.invalidDate || $;const r = t || 'YYYY-MM-DDTHH:mm:ssZ'; const i = O.z(this); const s = this.$H; const u = this.$m; const a = this.$M; const o = n.weekdays; const f = n.months; const h = function (t, n, i, s) { | ||||||
|  |         return t && (t[n] || t(e, r)) || i[n].substr(0, s); | ||||||
|  |       }; const c = function (t) { | ||||||
|  |         return O.s(s % 12 || 12, t, '0'); | ||||||
|  |       }; const d = n.meridiem || function (t, _e, n) { | ||||||
|  |         const r = t < 12 ? 'AM' : 'PM';return n ? r.toLowerCase() : r; | ||||||
|  |       }; const l = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: a + 1, MM: O.s(a + 1, 2, '0'), MMM: h(n.monthsShort, a, f, 3), MMMM: h(f, a), D: this.$D, DD: O.s(this.$D, 2, '0'), d: String(this.$W), dd: h(n.weekdaysMin, this.$W, o, 2), ddd: h(n.weekdaysShort, this.$W, o, 3), dddd: o[this.$W], H: String(s), HH: O.s(s, 2, '0'), h: c(1), hh: c(2), a: d(s, u, !0), A: d(s, u, !1), m: String(u), mm: O.s(u, 2, '0'), s: String(this.$s), ss: O.s(this.$s, 2, '0'), SSS: O.s(this.$ms, 3, '0'), Z: i };return r.replace(y, ((t, e) => e || l[t] || i.replace(':', ''))); | ||||||
|  |     }, m.utcOffset = function () { | ||||||
|  |       return 15 * -Math.round(this.$d.getTimezoneOffset() / 15); | ||||||
|  |     }, m.diff = function (r, d, $) { | ||||||
|  |       let l; const y = O.p(d); const M = w(r); const m = (M.utcOffset() - this.utcOffset()) * e; const g = this - M; let D = O.m(this, M);return D = (l = {}, l[c] = D / 12, l[f] = D, l[h] = D / 3, l[o] = (g - m) / 6048e5, l[a] = (g - m) / 864e5, l[u] = g / n, l[s] = g / e, l[i] = g / t, l)[y] || g, $ ? D : O.a(D); | ||||||
|  |     }, m.daysInMonth = function () { | ||||||
|  |       return this.endOf(f).$D; | ||||||
|  |     }, m.$locale = function () { | ||||||
|  |       return v[this.$L]; | ||||||
|  |     }, m.locale = function (t, e) { | ||||||
|  |       if (!t) return this.$L;const n = this.clone(); const r = S(t, e, !0);return r && (n.$L = r), n; | ||||||
|  |     }, m.clone = function () { | ||||||
|  |       return O.w(this.$d, this); | ||||||
|  |     }, m.toDate = function () { | ||||||
|  |       return new Date(this.valueOf()); | ||||||
|  |     }, m.toJSON = function () { | ||||||
|  |       return this.isValid() ? this.toISOString() : null; | ||||||
|  |     }, m.toISOString = function () { | ||||||
|  |       return this.$d.toISOString(); | ||||||
|  |     }, m.toString = function () { | ||||||
|  |       return this.$d.toUTCString(); | ||||||
|  |     }, M; | ||||||
|  |   }()); const b = _.prototype;return w.prototype = b, [['$ms', r], ['$s', i], ['$m', s], ['$H', u], ['$W', a], ['$M', f], ['$y', c], ['$D', d]].forEach(((t) => { | ||||||
|  |     b[t[1]] = function (e) { | ||||||
|  |       return this.$g(e, t[0], t[1]); | ||||||
|  |     }; | ||||||
|  |   })), w.extend = function (t, e) { | ||||||
|  |     return t.$i || (t(e, _, w), t.$i = !0), w; | ||||||
|  |   }, w.locale = S, w.isDayjs = p, w.unix = function (t) { | ||||||
|  |     return w(1e3 * t); | ||||||
|  |   }, w.en = v[D], w.Ls = v, w.p = {}, w; | ||||||
|  | }))); | ||||||
| @@ -45,8 +45,8 @@ export function getConfigByEnv() { | |||||||
|   switch (envVersion) { |   switch (envVersion) { | ||||||
|     // 开发版 |     // 开发版 | ||||||
|     case 'develop': |     case 'develop': | ||||||
|       api = "http://localhost:8000" |       // api = "http://localhost:8000" | ||||||
|       // api = "http://127.0.0.1:4523/m1/4143821-0-default" |       api = "http://127.0.0.1:4523/m1/4143821-0-default" | ||||||
|       break; |       break; | ||||||
|     // 体验版 |     // 体验版 | ||||||
|     case 'trial': |     case 'trial': | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user