Compare commits

..

52 Commits

Author SHA1 Message Date
c266572022 修改商城和充费跳转 2024-08-14 09:07:37 +08:00
0b568a81e5 暂存商城修改 2024-07-17 17:05:58 +08:00
765b3ad111 缴费新增对公支付(但是功能不可操作),开始调整首页 2024-07-16 08:52:36 +08:00
e4a22af891 完成充值改造 2024-07-15 14:16:06 +08:00
8e1ed62bd7 调整跳转h5链接 2024-07-10 08:28:53 +08:00
14dad0a506 修改发票详情样式错误 2024-06-26 17:15:37 +08:00
e6edf6e3d1 修改首页样式和手动绑定字段名 2024-06-25 11:16:38 +08:00
9ca94479fa 修改手动绑定不能返回的问题,修改发票类型字段,修改首页样式 2024-06-24 15:06:24 +08:00
31870c0222 优化跳转登录逻辑,退出登录,修改收据复制错误 2024-06-19 17:17:30 +08:00
4963d4f8a6 修改充值类型错误 2024-06-19 09:28:37 +08:00
e3ad9ea30a 调整样式,新增发票打印复制链接 2024-06-18 17:34:17 +08:00
75713f1e97 修改样式 2024-06-17 17:36:07 +08:00
56e08863de 修改了发票详细样式,新增发票审核状态,发票新增全选 2024-06-12 14:09:17 +08:00
8b970f2b8f 修改发票下载查询和发票信息修改 2024-06-05 16:16:21 +08:00
8ecb1e5977 修改开票编辑后详情错位的bug 2024-06-04 19:25:44 +08:00
60fcd5f8e2 修改退出登录逻辑,新增访问接口退出 2024-05-30 17:21:30 +08:00
7ac104d1b8 登录页不判断用户登录跳转首页逻辑 2024-05-30 16:40:24 +08:00
8f83197c02 修改导出xlsx的时候手机端异常的问题 2024-05-15 15:22:30 +08:00
ada2d71136 修改顶部navigator样式 2024-05-09 16:29:45 +08:00
05853b819f 修改首页顺序 2024-05-09 11:14:14 +08:00
e730e66c7c 新增用电查询echarts和导出功能 2024-05-09 11:02:40 +08:00
6d35c78da9 修复发票编辑时候异常 2024-05-08 17:18:11 +08:00
b673d0c994 修改返回首页报错 2024-05-08 16:05:08 +08:00
2d59d0eb8c 修改缴费记录按年查询错误的问题 2024-05-08 15:32:50 +08:00
aab3819a9d 初步完成电费账单列表 2024-05-08 14:25:49 +08:00
6ad47c47ac 修改用电查询切换电表数据不更新的问题 2024-05-07 14:34:00 +08:00
1e92bb8bcf 修改用电查询电表选择问题 2024-05-07 13:50:33 +08:00
19ba67134f 小程序完成下载 2024-05-07 10:04:51 +08:00
d7a31af5d5 修改用电查询接口参数错误 2024-05-07 09:41:58 +08:00
355778d068 修改发票文件引入错误 2024-05-07 09:23:43 +08:00
91eeeabf94 修改电量查询存在查询问题 2024-05-07 09:18:01 +08:00
9fddb955ce 首页新增跳转用电查询 2024-05-07 08:45:49 +08:00
63cb2f8250 修改发票详情参数undefined的问题 2024-05-06 17:57:06 +08:00
f8115cf724 对接发票 2024-05-06 17:48:21 +08:00
45cb065d6f 调试申请开票的时候开票信息不存在的情况 2024-05-06 17:27:21 +08:00
2a6447e292 修改发票信息 2024-05-06 17:09:34 +08:00
3d13c3003a 调整发票编辑和详情错误 2024-05-06 15:48:44 +08:00
5885281810 修改开票时确认信息的错误,,调整电费账单查看 2024-05-06 14:13:53 +08:00
ce81f9fe0a Merge branch 'dev' of https://git.archgrid.xyz/zly/electricity_bill_calc_wx into dev 2024-05-06 10:16:08 +08:00
dcff32cd1f 修改发票信息 2024-05-06 10:15:58 +08:00
qiaomu
369faf6b92 修改未开发票列表商户未传的问题 2024-05-06 09:50:26 +08:00
9c717eeb80 完成账单用电初始版本(未联调) 2024-04-29 17:26:51 +08:00
8d0f1931a9 开始做用电查询 2024-04-28 17:33:16 +08:00
72c8af7abd 修改发票明细id为undefined的问题 2024-04-26 10:58:47 +08:00
571373c33c 发票信息简单联调 2024-04-26 09:45:59 +08:00
cbe7db0ac1 修改发票信息联调错误,修改充值记录按表计查询,我的新增发票抬头 2024-04-26 09:20:44 +08:00
b7e831662e 完成发票初始版本 2024-04-25 16:53:38 +08:00
d1b2c89b1c 修改二维码园区错误 2024-04-25 08:56:51 +08:00
994d6155a2 修改二维码 2024-04-25 08:51:18 +08:00
ff36356543 开始做开票信息编辑 2024-04-24 16:54:11 +08:00
d41978e2e8 恢复主页 2024-04-23 09:22:06 +08:00
11f208a513 开始做发票 2024-04-22 17:37:07 +08:00
132 changed files with 4798 additions and 937 deletions

View File

@@ -1,9 +1,14 @@
{
"pages": [
"pages/home/index",
"pages/invoicing/index",
"pages/invoiceList/index",
"pages/electricQuery/index",
"pages/billDetail/index",
"pages/billList/index",
"pages/rechargeRecord/index",
"pages/invoiceList/index",
"pages/invoiceDetail/index",
"pages/invoiceDetailContent/index",
"pages/invoicing/index",
"pages/member/index",
"pages/login/index",
"pages/handleLogin/index",
@@ -11,13 +16,12 @@
"pages/waitApprove/index",
"pages/apply/index",
"pages/qrCode/index",
"pages/meterList/index",
"pages/recharge/index",
"pages/questions/index",
"pages/invoiceDetail/index",
"pages/editInvoice/index",
"pages/rechargeDetail/index",
"pages/agreements/index"
"pages/agreements/index",
"pages/updateInvoice/index",
"pages/rechargeWay/index"
],
"tabBar": {
"list": [

View File

@@ -8,7 +8,7 @@ page {
}
.border {
border: 0.5rpx solid #f0f0f0;
border: 0.5rpx solid #cfc9c9;
}
.radius12 {

View File

@@ -1,7 +1,7 @@
/* components/avatar/index.wxss */
.wrapper {
width: 150rpx;
height: 150rpx;
width: 120rpx;
height: 120rpx;
border-radius: 50%;
background: radial-gradient(circle, var(--light-green), var(--middle-green),var(--deep-green) );
display: flex;
@@ -14,4 +14,5 @@
max-width: 100rpx;
overflow: hidden;
white-space: nowrap;
font-size: 30rpx;
}

27
components/card/index.js Normal file
View File

@@ -0,0 +1,27 @@
// pages/invoicing/components/card/index.js
Component({
/**
* 组件的属性列表
*/
options: {
multipleSlots: true // 在组件定义时的选项中启用多slot支持
},
properties: {
title: String,
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})

View File

@@ -0,0 +1,10 @@
<!--pages/invoicing/components/card/index.wxml-->
<view class="cardBox">
<view class="title">
<view class="titleText"> {{ title }} </view>
<slot name="operate" />
</view>
<view class="content">
<slot name="content" />
</view>
</view>

View File

@@ -0,0 +1,24 @@
/* pages/invoicing/components/card/index.wxss */
.cardBox {
margin-left: 32rpx;
margin-right: 32rpx;
padding: 2rpx 24rpx 24rpx;
background-color: #fff;
border-radius: 20rpx;
}
.title {
font-size: 38rpx;
font-weight: 600;
border-bottom: 1rpx solid #ccc;
height: 80rpx;
line-height: 80rpx;
margin-bottom: 24rpx;
display: flex;
justify-content: space-between;
}
.titleText {
flex: 1;
}

View File

@@ -1,10 +1,13 @@
/* components/dot/index.wxss */
.dot {
background-color: #ee0a24;
width: 56rpx;
height: 56rpx;
width: 52rpx;
height: 52rpx;
border-radius: 50%;
text-align: center;
color: #fff;
font-size: 28rpx;
font-size: 26rpx;
display: flex;
justify-content: center;
align-items: center;
}

View 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;
}

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View 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>

View File

@@ -0,0 +1,7 @@
.ec-canvas {
position: relative !important;
float: none;
width: 700rpx;
height: 700rpx;
z-index: 0 !important;
}

File diff suppressed because one or more lines are too long

View 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
}
}

29
components/empty/index.js Normal file
View File

@@ -0,0 +1,29 @@
// components/empty/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
text: {
type: String,
value: '暂无数据'
},
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
refresh() {
this.triggerEvent("refresh")
}
}
})

View File

@@ -1,6 +1,7 @@
{
"component": true,
"usingComponents": {
"van-field": "@vant/weapp/field/index",
"van-empty": "@vant/weapp/empty/index",
"van-button": "@vant/weapp/button/index"
}
}

View File

@@ -0,0 +1,4 @@
<!--components/empty/index.wxml-->
<van-empty description="{{text}}">
<van-button type="info" bind:click="refresh" custom-style="width: 300rpx; margin-top:60rpx;" > 刷 新 </van-button>
</van-empty>

View File

@@ -0,0 +1,5 @@
/* components/empty/index.wxss */
.bottom-button {
width: 320rpx;
height: 80rpx;
}

View File

@@ -3,13 +3,13 @@
overflow: hidden;
display: flex;
align-items: flex-end;
position: relative;
background-color: var(--deep-green);
color: #fff;
position: fixed;
left: 0;
right: 0;
top: 0;
z-index: 999;
}
.navigatorTitle {

104
components/table/table.js Normal file
View File

@@ -0,0 +1,104 @@
// components/table/table/table.js
Component({
/**
* 组件的属性列表
*/
externalClasses: ['table-class', 'tr-class', 'td-class', 'th-class', 'tr-class_even', 'tr-class_odd'],
properties: {
colWidth: Number,
isScroll: {
type: Boolean,
value: false
},
header: {
type: Array,
value: []
},
list: {
type: Array,
value: []
},
showActive: {
type: Boolean,
value: true
},
activeColor: {
type: String,
value: '#d6e8ff'
},
maxLine: {
type: Number,
value: 2
}
},
observers: {
'header,list': function (header, list) {
this.init();
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
setWidth (head) {
const colWidth = this.data.colWidth || head.length < 3 ? (730 / head.length) : 300;
const tableWidth = head.length >= 1 && this.data.isScroll ? head.length * colWidth : null;
this.setData({ tableWidth });
},
init () {
!this.data.tableWidth && this.setWidth(this.data.header);
const { list, header } = this.data;
let showHeader = JSON.parse(JSON.stringify(header));
let showList = JSON.parse(JSON.stringify(list));
showHeader.forEach((head, headIndex) => {
showList.forEach((item, index) => {
const body = header[headIndex].renderBody && header[headIndex].renderBody(item, index);
const color = header[headIndex].renderColor && header[headIndex].renderColor(item, index);
const bg = header[headIndex].renderBg && header[headIndex].renderBg(item, index);
if (body !== undefined) {
head.key = `col${headIndex}`;
item[`col${headIndex}`] = {};
item[`col${headIndex}`].text = body;
} else if (head.key) {
const text = item[head.key];
item[head.key] = { text };
}
if (color && head.key) {
item[head.key].color = color;
}
if (bg && head.key) {
item[head.key].bg = bg;
}
});
});
this.setData({ showHeader, showList });
},
checkRow (index) {
if (!this.data.showActive) {
return;
}
index = /\d+/.test(index) ? index : 0;
this.setData({ currentIndex: index });
},
onLongPress (e) {
const { index } = e.currentTarget.dataset;
this.checkRow(index);
const data = this.data.list[index];
this.triggerEvent('onLongPress', { index, data });
},
onTap (e) {
const { index } = e.currentTarget.dataset;
this.checkRow(index);
const data = this.data.list[index];
this.triggerEvent('onClick', { index, data });
}
}
});

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@@ -0,0 +1,69 @@
@display: table,
table-row,
table-cell;
each(@display, {
.d-@{value} {
display: @value !important;
}
}
) .d-table-cell {
padding: 10px 5px;
font-size: 14px;
word-break: break-all;
min-height: 42px;
max-width: 150px;
position: relative;
}
.d-table {
background-color: #fff;
.d-table-row.active {
background-color: #d6e8ff;
}
.d-table-row:not(:first-child) {
.d-table-cell {
&::before {
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 1px;
background-color: #ddd;
transform: scaleY(0.3);
}
}
}
}
.table {
position: relative;
background-color: #fff;
overflow: hidden;
font-size: 13px;
width: 100%;
}
.table1-view {
width: 100%;
}
.table1 {
width: var(--width, 100%);
min-width: auto;
}
.text {
font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: var(--max_line, 2)
}

View File

@@ -0,0 +1,22 @@
<wxs module="getTableWidth">
module.exports = function (tableWidth) {
if (!tableWidth) {
return;
}
return tableWidth + 'rpx'
}
</wxs>
<scroll-view hidden="{{!showList.length||!showHeader.length}}" scroll-x class="table1-view" style="--max_line:{{maxLine}};--width:{{getTableWidth(tableWidth)}}">
<view class="table1 d-table table-class">
<view class="d-table-row tr-class">
<view class="d-table-cell th-class" wx:for="{{showHeader}}" wx:key="index">{{item.title}}</view>
</view>
<view bindtap="onTap" data-index="{{index}}" bindlongpress="onLongPress" class="tr-class d-table-row {{currentIndex===index?'active':''}} {{index%2===0?'tr-class_even':'tr-class_odd'}}" wx:for="{{showList}}" wx:key="index">
<view class="d-table-cell td-class " wx:for="{{showHeader}}" wx:for-item="head" wx:for-index="hindex" wx:key="hindex" style="background-color: {{item[head.key].bg}};color:{{item[head.key].color}}">
<view class="text">
{{item[head.key].text}}
</view>
</view>
</view>
</view>
</scroll-view>

View File

@@ -0,0 +1,56 @@
.d-table {
display: table !important;
width: 100% !important;
}
.d-table-row {
display: table-row !important;
}
.d-table-cell {
display: table-cell !important;
}
.d-table-cell {
padding: 10px 5px;
font-size: 14px;
word-break: break-all;
min-height: 42px;
max-width: 150px;
position: relative;
}
.d-table {
background-color: #fff;
}
.d-table .d-table-row.active {
background-color: #d6e8ff;
}
.d-table .d-table-row:not(:first-child) .d-table-cell::before {
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 1px;
background-color: #ddd;
transform: scaleY(0.3);
}
.table {
position: relative;
background-color: #fff;
overflow: hidden;
font-size: 13px;
width: 100%;
}
.table1-view {
width: 100%;
}
.table1 {
width: var(--width, 100%);
min-width: auto;
}
.text {
font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: var(--max_line, 2);
}

View File

@@ -0,0 +1,77 @@
// components/timePicker/index.js
const dayjs = require("../../utils/dayjs");
function generateYearArray(startYear) {
const currentYear = new Date().getFullYear();
const years = [];
for (let i = startYear; i <= currentYear; i++) {
years.push(i);
}
return years;
}
Component({
/**
* 组件的属性列表
*/
properties: {
type: String,
value: Number,
show: Boolean,
year: String,
month: Number,
day: Number,
},
/**
* 组件的初始数据
*/
data: {
minDate: new Date(2024,0,1).getTime(),
maxDate: new Date().getTime(),
formatter(type, value) {
if (type === 'year') {
return `${value}`;
}
if (type === 'month') {
return `${value}`;
}
if (type === 'day') {
return `${value}`;
}
return value;
},
years: generateYearArray(2024)
},
/**
* 组件的方法列表
*/
methods: {
onInput(e) {
},
onClose() {
this.triggerEvent("close")
},
onCancel() {
this.triggerEvent("cancel")
},
onConfirm(e) {
const { type } = this.data;
let time;
switch(type) {
case "day":
time = dayjs(new Date(e.detail)).format('YYYY-MM-DD');
break;
case 'month':
time = dayjs(new Date(e.detail)).format('YYYY-MM');
break;
case 'year':
time = dayjs(new Date(e.detail.value, 0, 1)).format('YYYY');
break;
}
this.triggerEvent("confirm", { type, time })
}
}
})

View File

@@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
"van-popup": "@vant/weapp/popup/index",
"van-picker": "@vant/weapp/picker/index"
}
}

View File

@@ -0,0 +1,44 @@
<!--components/timePicker/index.wxml-->
<van-popup
show="{{ show }}"
position="bottom"
bind:close="onClose"
>
<van-datetime-picker
bind:confirm="onConfirm"
bind:cancel="onCancel"
wx:if="{{ type === 'day' }}"
type="date"
value="{{ day }}"
min-date="{{ minDate }}"
max-date="{{ maxDate }}"
bind:input="onInput"
formatter="{{formatter}}"
title="日期"
/>
<van-datetime-picker
bind:confirm="onConfirm"
bind:cancel="onCancel"
wx:if="{{ type === 'month' }}"
value="{{ month }}"
type="year-month"
value="{{ currentDate }}"
min-date="{{ minDate }}"
max-date="{{ maxDate }}"
bind:input="onInput"
formatter="{{formatter}}"
title="月份"
/>
<van-picker
bind:confirm="onConfirm"
bind:cancel="onCancel"
wx:if="{{ type === 'year' }}"
columns="{{ years }}"
bind:change="onChange"
title="年份"
show-toolbar="{{true}}"
cancel-button-text="取消"
confirm-button-text="确定"
/>
</van-popup>

View File

@@ -0,0 +1 @@
/* components/timePicker/index.wxss */

202
pages/billDetail/index.js Normal file
View File

@@ -0,0 +1,202 @@
import { getReportDetail } from "../../service/report";
import { alertInfo, getPixelRatio } from "../../utils/index";
import request from '../../utils/request'
import * as echarts from '../../components/echarts/echarts';
const { OK } = request
// pages/billDetail/index.js
Page({
/**
* 页面的初始数据
*/
data: {
id: "",
time: "",
detail: {},
meters: [],
header1: [
{ key: 'address', title: '电表地址' },
{ title: '起码',renderBody: (item) => { return item?.startNumber } },
{ title: '止码',renderBody: (item) => { return item?.endNumber } },
{ title: '倍率',renderBody: (item) => { return item?.displayRatio } },
],
header2: [
{ title: '用电量', renderBody: (item) => item?.overall?.amount },
{ title: '线损电量',renderBody: (item) => item?.loss?.amount },
{ title: '公摊电量',renderBody: (item) => item?.publicAmount },
{ title: '合计电量',renderBody: (item) => {
} },
]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const { id = "R00053677580943361", time = "2023-10" } = options;
this.init(id, time);
},
async init(id, time) {
const { code, message, detail } = await getReportDetail(id)
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({
id, time, detail, meters: detail?.meters?.map(item => {
const finalAmount = Number(item?.overall?.amount || 0) + Number(item?.loss?.amount || 0) + Number(item?.publicAmount || 0)
item.finalAmount = Number(finalAmount).toFixed(2)
return item;
})
})
const option = {
tooltip: {
trigger: 'item'
},
legend: {
top: 10,
left: 'center'
},
label: {
alignTo: 'edge',
formatter: '{name|{b}}\n{value|{c} }',
minMargin: 5,
edgeDistance: 10,
lineHeight: 15,
rich: {
time: {
fontSize: 10,
color: '#999'
}
}
},
series: [
{
type: 'pie',
radius: '50%',
data: [
{ value: 18.3, name: '本期线损电量', itemStyle: { color: 'rgb(104,187,196)' } },
{ value: 187.56, name: '本期用电量', itemStyle: { color: 'rgb(80,135,236)' } },
],
}
]
};
this.init_pieCharts(option);
const that = this;
wx.getSystemInfo({
success: function (res) {
that.setData({
statusBarHeight : res.statusBarHeight,
navBarHeight : res.statusBarHeight , // 顶部导航栏高度为 44px
jiaonangheight: wx.getMenuButtonBoundingClientRect().height, // 胶囊高度
jiaonangwidth:wx.getMenuButtonBoundingClientRect().width,
})
},
})
},
init_pieCharts: function(options) {
this.selectComponent('#echarts').init((canvas, width, height) => {
// 初始化图表
const pieChart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: getPixelRatio(),
});
pieChart.setOption(options);
// 注意这里一定要返回 chart 实例,否则会影响事件处理等
return pieChart;
});
},
download() {
const { id: tenement } = wx.getStorageSync('tenement')
const { id } = this.data;
wx.showModal({
title: '提示',
content: '为了您更好的体验,请复制链接,通过浏览器打开下载',
showCancel: true,
cancelText: '关闭',
confirmText: '复制链接',
complete: (res) => {
if (res.confirm) {
const result = wx.getAccountInfoSync();
const { envVersion } = result.miniProgram;
let api = ""
switch (envVersion) {
// 开发版
case 'develop':
wx.setClipboardData({
data: `https://zgd.hbhcbn.com/user-report/?report=${id}&tenement=${tenement}`,
})
break;
// 体验版
case 'trial':
wx.setClipboardData({
data: `https://zgd.hbhcbn.com/user-report/?report=${id}&tenement=${tenement}`,
})
break;
// 正式版
case 'release':
wx.setClipboardData({
data: `https://zgd.hbhcbn.com/user-report-h5/?report=${id}&tenement=${tenement}`,
})
break;
}
}
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@@ -0,0 +1,12 @@
{
"usingComponents": {
"navigator": "/components/navigator/index",
"avatar": "/components/avatar/index",
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index",
"echarts": "/components/echarts/ec-canvas",
"table": "/components/table/table",
"van-button": "@vant/weapp/button/index"
},
"navigationStyle": "custom"
}

109
pages/billDetail/index.wxml Normal file
View File

@@ -0,0 +1,109 @@
<!--pages/billDetail/index.wxml-->
<navigator title="{{ time }}电费账单" canBack="{{true}}" />
<view class="title" style="top: {{statusBarHeight + 46}}px">
<avatar text="{{detail.tenement.shortName}}" />
<view class="titleContent">
<view class="park">
<view class="label">
所属园区:
</view>
<view class="value"> {{ detail.park.name }} </view>
</view>
<view class="address">
<view class="label">
用电地址:
</view>
<view class="value"> {{ detail.tenement.address }} </view>
</view>
<view class="time">
<view class="label">
账单周期:
</view>
<view class="value"> {{ detail.comprehensive.startDate }} 至 {{ detail.comprehensive.endDate }} </view>
</view>
</view>
<van-button type="info" size="small" class="download" bind:click="download">下载</van-button>
</view>
<view class="wrapper">
<view class="line"></view>
<view class="contentTitle"> 本期账单 </view>
<van-row gutter="10">
<van-col span="8">
<view class="colContent">
<view class="colContentTitle">本期用电量</view>
<view class="colContentValue"> {{ detail.comprehensive.consumption }} 千瓦时 </view>
</view>
</van-col>
<van-col span="8">
<view class="colContent">
<view class="colContentTitle">本期电单价</view>
<view class="colContentValue"> {{ detail.comprehensive.price }} 元 </view>
</view>
</van-col>
<van-col span="8">
<view class="colContent">
<view class="colContentTitle">本期电费</view>
<view class="colContentValue"> {{ detail.comprehensive.total }} 元 </view>
</view>
</van-col>
</van-row>
<view class="line"></view>
<view class="contentTitle"> 电费构成 </view>
<echarts
style="width:200rpx;height:180rpx;"
id="echarts"
class='mychart-bar'
canvas-id="mychart-bar"
ec="{{ ec }}"
forceUseOldCanvas="{{false}}"
>
</echarts>
<view class="tooltip">
(本月电量+本月线损电量)*电单价+摊薄公摊电费+摊薄调整电费
</view>
<view class="line"></view>
<view class="contentTitle"> 电量明细 </view>
<view class="tableWrapper" wx:for="{{meters}}">
<view style="margin: 20rpx 0; background-color: #fff;">
<van-row custom-style="height: 100%;display: flex;flex-direction: column;overflow: hidden;">
<van-col span="6">
<view class="tableTitle"> 电表地址 </view>
<view class="tableContent"> {{item.address}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 起码 </view>
<view class="tableContent"> {{item.startNumber}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 止码 </view>
<view class="tableContent"> {{item.endNumber}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 倍率 </view>
<view class="tableContent"> {{item.displayRatio}} </view>
</van-col>
</van-row>
<van-row>
<van-col span="6">
<view class="tableTitle"> 用电量 </view>
<view class="tableContent"> {{item.overall.amount}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 线损电量 </view>
<view class="tableContent"> {{item.loss.amount}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 公摊电量 </view>
<view class="tableContent"> {{item.publicAmount}} </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 合计电量 </view>
<view class="tableContent"> {{item.finalAmount}} </view>
</van-col>
</van-row>
</view>
</view>
</view>
<view style="height: 20rpx;"></view>

View File

@@ -0,0 +1,96 @@
/* pages/billDetail/index.wxss */
.title {
padding: 30rpx;
box-sizing: border-box;
background: linear-gradient(to bottom, rgb(76,151,131), rgb(167,203,193) );
display: flex;
align-items: center;
position: sticky;
z-index: 99 !important;
}
.titleContent {
margin-left: 30rpx;
font-size: 32rpx;
}
.titleContent .park, .titleContent .address, .titleContent .time {
display: flex;
}
.titleContent .address, .titleContent .time {
margin-top: 20rpx;
}
.titleContent .label {
width: 170rpx;
}
.titleContent .value {
flex: 1;
}
.line {
height: 0.5rpx;
background-color: rgba(5, 5, 5, 0.06);
margin-top: 30rpx;
margin-bottom: 20rpx;
}
page {
background-color: var(--transparent-green);
}
.contentTitle {
font-size: 34rpx;
font-weight: 600;
margin-top: 10rpx;
margin-bottom: 30rpx;
}
.colContent {
background-color: #fff;
border-radius: 24rpx;
font-size: 30rpx;
}
.colContentTitle {
padding: 30rpx 0;
text-align: center;
font-weight: 500;
}
.colContentValue {
padding-bottom: 30rpx;
text-align: center;
overflow: hidden;
}
.tooltip {
font-size: 30rpx;
color: rgb(136, 132, 132);
}
.tableTitle {
background-color: rgb(242,242,242);
font-size: 30rpx;
text-align: center;
padding: 6rpx 0;
width: 100%;
box-sizing: border-box;
}
.tableContent {
font-size: 30rpx;
text-align: center;
padding: 6rpx 10rpx;
width: 100%;
background-color: #fff;
box-sizing: border-box;
flex: 1;
}
.download {
position: absolute;
top: 20rpx;
right: 20rpx;
}

View File

@@ -1,33 +1,40 @@
import { getMeterList } from "../../service/meter";
// pages/meterList/index.js
import { getBillList } from "../../service/accounting"
import { alertInfo } from "../../utils/index";
import request from '../../utils/request'
const { OK } = request;
// pages/billList/index.js
Page({
/**
* 页面的初始数据
*/
data: {
list: [
]
page: 1,
list: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getList();
this.init();
},
async getList() {
const { code, message, data = [] } = await getMeterList()
async init() {
const { page, list } = this.data;
const { code, data, message } = await getBillList(page)
if (!data?.length) {
alertInfo("没有更多了")
return;
}
this.setData({
list: data
list: [...list, ...data],
page: page + 1,
})
},
jumpToRecharge(e) {
const { code, tenement } = e.currentTarget.dataset;
jumpToDetail(e) {
const { id: report } = e.currentTarget.dataset
wx.navigateTo({
url: `/pages/recharge/index?code=${code}&tenement=${tenement}`,
url: '/pages/billDetail/index?id=' + report,
})
},
/**

View File

@@ -0,0 +1,8 @@
{
"usingComponents": {
"navigator": "/components/navigator/index",
"van-icon": "@vant/weapp/icon/index",
"empty": "/components/empty/index"
},
"navigationStyle": "custom"
}

12
pages/billList/index.wxml Normal file
View File

@@ -0,0 +1,12 @@
<!--pages/billList/index.wxml-->
<navigator title="电费账单" canBack="{{true}}" />
<view wx:if="{{!list.length}}">
<empty bind:refresh="init" />
</view>
<view wx:else>
<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" data-id="{{item.id}}"> 查看详细 </view>
</view>
</view>

23
pages/billList/index.wxss Normal file
View 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 {
}

View File

@@ -1,50 +0,0 @@
<van-cell-group>
<van-field
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>

View File

@@ -1,6 +0,0 @@
/* pages/editInvoice/index.wxss */
.operate {
display: flex;
align-items: center;
margin-top: 50rpx;
}

View File

@@ -0,0 +1,24 @@
// pages/electricQuery/components/accountingCard/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
data: Object
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})

View File

@@ -0,0 +1,7 @@
{
"component": true,
"usingComponents": {
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index"
}
}

View File

@@ -0,0 +1,33 @@
<!--pages/electricQuery/components/accountingCard/index.wxml-->
<view class="wrapper">
<view class="title">
{{data.meter.address}}
</view>
<van-row>
<van-col span="6">
<view class="tableTitle"> 初始余额 </view>
</van-col>
<van-col span="7">
<view class="tableTitle"> 储值累计金额 </view>
</van-col>
<van-col span="5">
<view class="tableTitle"> 电费 </view>
</van-col>
<van-col span="6">
<view class="tableTitle"> 账务余额 </view>
</van-col>
<van-col span="6">
<view class="tableContent"> {{data.startMoney}} </view>
</van-col>
<van-col span="7">
<view class="tableContent"> {{data.rechargeMoney}} </view>
</van-col>
<van-col span="5">
<view class="tableContent"> {{data.electricMoney}} </view>
</van-col>
<van-col span="6">
<view class="tableContent"> {{data.currentMoney}} </view>
</van-col>
</van-row>
</view>

View File

@@ -0,0 +1,24 @@
/* pages/electricQuery/components/accountingCard/index.wxss */
.wrapper {
background-color: #fff;
margin-top: 30rpx;
}
.title {
padding: 20rpx;
border-bottom: 1rpx solid #ccc;
font-size: 34rpx;
}
.tableTitle {
font-size: 32rpx;
margin: 20rpx 0 14rpx;
text-align: center;
}
.tableContent {
margin-top: 10rpx;
margin-bottom: 20rpx;
text-align: center;
font-size: 32rpx;
}

View File

@@ -0,0 +1,325 @@
// pages/electricQuery/index.js
import { exportElectricityList, getAccountingList, getElectricityList, getMeterReadingList } 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';
import { alertInfo, getPixelRatio, loadingFunc } from "../../utils/index";
const { OK } = request;
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"),
yearStamp: new Date().getTime(),
yearMonthStamp: new Date().getTime(),
yearMonthDayStamp: new Date().getTime(),
header: [
{ key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address },
{ title: '时间',renderBody: (item) => { return item.time } },
{ key: 'number', title: '耗量' },
],
meterReadingHeader: [
{ key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address },
{ title: '倍率', key: 'ratio' },
{ key: 'number', title: '抄表记录' },
],
list: [],
visible: false,
meterReadingList: [],
accountingList: [],
electricNumber: 0,
meterNumber: 0,
},
changeQueryType(e) {
const { type } = e.currentTarget.dataset
this.setData({ queryType: type },() => {
switch(type) {
case 0:
this.init()
break;
case 1:
this.getReadingList();
break;
case 2:
this.getAccountingBalanceList();
break;
}
})
},
clickTime() {
const { timeType } = this.data;
this.setData({
timePickerType: timeType === 0 ? "day" : (timeType === 1 ? 'month' : 'year'),
visible: true
})
},
changeTimeType(e) {
const { type } = e.currentTarget.dataset
this.setData({ timeType: type }, () => {
this.init()
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.init()
},
async init() {
const { queryType, timeType, meterId, year, yearMonth, yearMonthDay } = this.data;
let time;
switch(timeType) {
case 1:
time = yearMonth;
break;
case 2:
time = year;
break;
default:
time = yearMonthDay;
break;
}
const { code, message, data, electricNumber, meterNumber } = await getElectricityList({ type: timeType, meter: meterId, time: time })
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({ list: data, electricNumber, meterNumber })
if (!data?.length) {
return;
}
this.selectComponent('#echarts').init((canvas, width, height) => {
// 初始化图表
const pieChart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: getPixelRatio(),
});
const ids = [...new Set(data?.map(item => item?.meter?.id))]
const options = {
tooltip: {
trigger: 'axis'
},
legend: {
data: data?.map(item => item?.meter?.address),
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
boundaryGap: false,
data: [...new Set(data?.map(item => item.time))]
},
yAxis: {
type: 'value'
},
series: ids?.map(item => {
const element = data?.find(i => i?.meter?.id === item)
return {
name: element?.meter?.address,
type: 'line',
stack: 'Total',
data: data?.filter(ele => ele?.meter?.id === item).map(item => item.number)
}})
};
pieChart.setOption(options);
// 注意这里一定要返回 chart 实例,否则会影响事件处理等
return pieChart;
});
},
async getReadingList() {
const { meterId } = this.data;
const { code, message, data } = await getMeterReadingList(meterId)
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({ meterReadingList: data })
},
async export() {
loadingFunc(async () => {
const { queryType, timeType, meterId, year, yearMonth, yearMonthDay } = this.data;
let time;
switch(timeType) {
case 1:
time = yearMonth;
break;
case 2:
time = year;
break;
default:
time = yearMonthDay;
break;
}
const data = await exportElectricityList({ type: timeType, meter: meterId, time: time })
// if (code !== OK) {
// alertInfo(message)
// return;
// }
wx.openDocument({
filePath: data.tempFilePath,
fileType: ['xlsx'],
success() {
},
fail(err) {
}
})
})
},
async getAccountingBalanceList() {
const { meterId } = this.data;
const { code, message, data } = await getAccountingList(meterId)
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({ accountingList: 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 { id, code } = e.detail.value;
this.setData({
// year: currentYear,
meterId: id,
meterCode: code,
type: "",
show: false,
title: ""
}, () => {
const { queryType, } = this.data;
switch(queryType) {
case 1:
this.getReadingList();
break;
case 2:
this.getAccountingBalanceList();
break;
default:
this.init();
break;
}
})
},
onTimeClose() {
this.setData({ visible: false })
},
onTimeCancel() {
this.setData({ visible: false })
},
onTimeConfirm(e) {
const { type, time } = e.detail;
switch(type) {
case "year":
this.setData({ year: time, visible: false, }, () => {
this.init();
});
break;
case "month":
const [year, month] = time.split("-")
this.setData({ yearMonth: time, yearMonthStamp: new Date(Number(year), Number(month) - 1, 1).getTime(), visible: false }, () => {
this.init();
});
break;
case "day":
this.setData({ yearMonthDay: time, yearMonthDayStamp: new Date(time).getTime(), visible: false }, () => {
this.init();
})
break;
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.getMeters()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@@ -0,0 +1,16 @@
{
"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",
"timePicker": "/components/timePicker/index",
"accountingCard": "./components/accountingCard/index",
"echarts": "/components/echarts/ec-canvas"
},
"navigationStyle": "custom"
}

View File

@@ -0,0 +1,125 @@
<!--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 wx:if="{{queryType === 0}}">
<view class="tooltip">
不包括线损电量,显示为电表实际消耗电量。仅供参考,实际能耗电量以电费账单为主。如有疑问,请联系客服。
</view>
<view class="timeChooseWrapper">
<view> 选择时间 </view>
<view class="time" bind:tap="clickTime">
<view class="timeText" wx:if="{{timeType === 0}}"> {{yearMonthDay}} </view>
<view class="timeText" wx:elif="{{timeType === 1}}"> {{yearMonth}} </view>
<view class="timeText" wx:else> {{year}} </view>
<van-icon name="arrow-down" />
</view>
<van-button type="info" size="small" bind:click="export"> 导出 </van-button>
</view>
</view>
<view wx:elif="{{queryType === 1}}">
<view class="tooltip">
显示为最新的一条抄表记录。电表更新数据有延迟,仅供参考,实际以电表上显示为准。
</view>
</view>
<view wx:elif="{{queryType === 2}}">
<view class="tooltip">
账务余额更新时间为:每次预存电费后,每次账单发布后,剩余的实际金额。电表余额与账务余额相差较大的用户,每半年统一处理一次。
</view>
</view>
</view>
<view wx:if="{{queryType === 0}}">
<view style="margin: 30rpx;">
<table header="{{header}}" list="{{list}}" wx:if="{{list.length}}" />
<empty bind:refresh="init" wx:else />
</view>
<view class="sum">
合计:表计数量:{{meterNumber}},耗电量:{{electricNumber}}
</view>
</view>
<view wx:if="{{queryType === 1}}">
<view style="margin: 30rpx;">
<table header="{{meterReadingHeader}}" list="{{meterReadingList}}" wx:if="{{meterReadingList.length}}" />
<empty bind:refresh="getReadingList" wx:else />
</view>
</view>
<view wx:if="{{queryType === 2}}">
<view style="margin: 30rpx;">
<view wx:if="{{accountingList.length}}">
<accountingCard wx:for="{{accountingList}}" data="{{item}}" />
</view>
<!-- <table header="{{meterReadingHeader}}" list="{{accountingList}}" wx:if="{{accountingList.length}}" /> -->
<empty bind:refresh="getAccountingBalanceList" wx:else />
</view>
</view>
<echarts
style="width:200rpx;height:180rpx;"
id="echarts"
class='mychart-bar'
canvas-id="mychart-bar"
ec="{{ ec }}"
forceUseOldCanvas="{{false}}"
wx:if="{{list.length}}"
>
</echarts>
<custom-picker
title="{{title}}"
show="{{show}}"
valueKey="name"
columns="{{columns}}"
bind:ok="onOk"
bind:cancel="onCancel"
type="{{type}}"
/>
<timePicker
type="{{timePickerType}}"
year="{{year}}"
month="{{yearMonthStamp}}"
day="{{yearMonthDayStamp}}"
show="{{visible}}"
bind:cancel="onTimeCancel"
bind:close="onTimeClose"
bind:confirm="onTimeConfirm"
/>

View File

@@ -0,0 +1,93 @@
/* pages/electricQuery/index.wxss */
page {
background-color: var(--transparent-green);
}
.queryWrapper {
margin: 20rpx 0rpx;
background-color: #fff;
padding:15rpx 20rpx;
box-sizing: border-box;
border-radius: 20rpx;
display: flex;
align-items: center;
font-size: 32rpx;
}
.label {
width: 180rpx;
font-size: 32rpx;
}
.sum {
margin-bottom: 30rpx;
margin-left: 30rpx;
margin-right: 30rpx;
padding-bottom: 50rpx;
}
.query {
margin: 20rpx 0rpx;
}
.typeQueryText {
text-align: center;
padding: 20rpx;
background-color: var(--light-green);
font-size: 32rpx;
}
.select {
border: 1rpx solid #ccc;
padding: 12rpx;
border-radius: 12rpx;
flex: 1;
display: flex;
justify-content: space-between;
font-size: 30rpx;
}
.timeQueryText {
text-align: center;
padding: 20rpx;
background-color: rgb(242,248,246);
font-size: 30rpx;
}
.wrapper {
margin-left: 30rpx;
margin-right: 30rpx;
padding: 0;
}
.tooltip {
margin: 20rpx 0;
font-size: 28rpx;
color: rgb(97, 93, 93);
}
.timeChooseWrapper {
display: flex;
align-items: center;
font-size: 30rpx;
}
.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
}

View File

@@ -14,14 +14,18 @@ Page({
parkName: "",
park: "",
tenementName: "",
tenement: ""
tenement: "",
canBack: true,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const { canBack } = options
if (canBack === 'false') {
this.setData({ canBack: false })
}
},
onChangeName(e) {
this.setData({
@@ -64,7 +68,7 @@ Page({
return
}
if (!phone) {
alertInfo("请输入联系人手机号")
alertInfo("请输入预留手机号")
return
}
if (!name) {

View File

@@ -6,7 +6,8 @@
"van-field": "@vant/weapp/field/index",
"van-icon": "@vant/weapp/icon/index",
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index"
"van-tabs": "@vant/weapp/tabs/index",
"navigator": "/components/navigator/index"
},
"navigationBarTitleText": "绑定商户"
"navigationStyle": "custom"
}

View File

@@ -1,5 +1,6 @@
<!--pages/handleLogin/index.wxml-->
<!-- <topbar /> -->
<navigator title="绑定商户" canBack="{{canBack}}" />
<van-tabs>
<van-tab title="扫码绑定">
<view class="codeContent">
@@ -24,8 +25,8 @@
<van-field
required
value="{{ phone }}"
label="联系人手机号"
placeholder="请输入联系人手机号"
label="预留手机号"
placeholder="请输入预留手机号"
border="{{ true }}"
bind:change="onChangePhone"
/>
@@ -44,8 +45,8 @@
<view>
不知道预留的手机号?可联系后台管理员查询!
</view>
<view class="phone" bind:tap="callPhone" data-phone="13266911877">
<van-icon name="phone-o" class="phoneIcon" /> 13266911877
<view class="phone" bind:tap="callPhone" data-phone="0311-83864830">
<van-icon name="phone-o" class="phoneIcon" /> 0311-83864830
</view>
</view>
</view>

View File

@@ -1,10 +1,9 @@
import { getMeterDetail, getMeterList, getTenementMeterList } from "../../service/meter";
import { getOwnTenementList } from "../../service/tenement";
import { alertInfo } from "../../utils/index";
import { alertInfo, alertSuccess } from "../../utils/index";
import request from '../../utils/request';
import { getDot } from "../../utils/system";
import { getUserInfo } from "../../service/user"
import { requestRecharge } from "../../service/recharge";
const { OK } = request;
// pages/home/index.js
Page({
@@ -22,6 +21,8 @@ Page({
pickerType: "",
meterList: [],
meterIndex: 0,
rechargeVisible: false,
background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
},
/**
@@ -52,18 +53,29 @@ Page({
onReady() {
},
async changeMeter() {
const { meterList = [] } = this.data;
const newColumns = meterList.map(item => { item.id = item.code; item.name = `${item.code} - ${item.address}`; return item; })
this.setData({
columns: newColumns,
show: true,
pickerType: "meter"
jumpToRecharge() {
const { user } = this.data;
if (!user || !user?.id) {
alertInfo("请先登录")
return;
}
wx.navigateTo({
url: '/pages/recharge/index',
})
},
async refreshMeter() {
const { meter } = this.data;
this.handleGetMeterDetail(meter.code);
async setUser() {
const result = await getUserInfo();
if (result.code !== OK) {
// alertInfo(result.message)
const user = wx.getStorageSync('user')
this.setData({ user: user })
return;
}
this.setData({ user: result.data })
wx.setStorageSync('user', result.data)
// const user = wx.getStorageSync('user')
// this.setData({ user: user })
},
onOk(e) {
const { type, index, value } = e.detail;
@@ -79,6 +91,8 @@ Page({
park: value,
tenement: value.tenements?.[0]
})
wx.setStorageSync('park', value)
wx.setStorageSync('tenement', value.tenements?.[0])
break;
case "tenement":
// const currentTenement = this.data.tenement;
@@ -86,14 +100,13 @@ Page({
// this.setData({ show: false })
// return
// }
wx.setStorageSync('tenement', value)
// wx.setStorageSync('meter', null)
this.setData({
show: false,
tenement: value
})
break;
case "meter":
const { code, id } = e.detail.value;
this.handleGetMeterDetail(id)
break;
}
},
@@ -114,60 +127,9 @@ Page({
show: false,
})
},
changeMoney(e) {
const { money } = e.currentTarget.dataset;
this.setData({
money: money
})
},
onChangeMoney(e) {
this.setData({ money: e.detail })
},
async recharge() {
const { user, money, meter, tenement, park } = this.data;
if (!user || !user.id) {
alertInfo("请先登录")
return
}
if (!money) {
alertInfo("请先输入金额")
return;
}
if (!meter?.code) {
alertInfo("没有选择表计")
return;
}
const { code, message, data } = await requestRecharge({ money: Number(money), id: meter.id, tenement: tenement.id, park: park.id })
if (code !== OK) {
alertInfo(message)
return;
}
wx.requestPayment({
timeStamp: data?.time,
nonceStr: data?.nonceStr,
package: "prepay_id=" + data?.prepay_id,
paySign: data?.paySign,
signType: 'RSA',
success: (res) => {
console.log('success', res)
},
fail: (res) => {
console.log('fail', res)
alertInfo("请稍后重试")
},
complete: (res) => {
console.log('complete')
}
})
console.log('data', data)
},
jumpToInvoice() {
wx.navigateTo({
url: '/pages/invoiceList/index',
})
},
jumpToLogin() {
wx.navigateTo({
url: '/pages/login/index',
@@ -177,9 +139,9 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
this.setUser();
this.getAllList();
this.watchTenement();
this.watchPark();
getDot();
},
watchTenement() {
@@ -195,8 +157,46 @@ Page({
},
set: function (newVal) {
// const oldValue = value;
wx.setStorageSync('tenement', newVal)
that.setUser();
// that.getMeters(newVal);
value = newVal;
that.getMeters(newVal);
}
});
},
watchPark() {
const that = this;
let value = this.data.park; // 获取被监听属性的当前值
// 使用 Object.defineProperty 方法在数据对象上定义属性的 getter 和 setter
Object.defineProperty(this.data, 'park', {
configurable: true, // 可配置
enumerable: true, // 可枚举
get: function () {
return value; // 返回属性的当前值
},
set: function (newVal) {
// const oldValue = value;
value = newVal;
wx.setStorageSync('park', newVal)
}
});
},
watchMeter() {
const that = this;
let value = this.data.meter; // 获取被监听属性的当前值
// 使用 Object.defineProperty 方法在数据对象上定义属性的 getter 和 setter
Object.defineProperty(this.data, 'meter', {
configurable: true, // 可配置
enumerable: true, // 可枚举
get: function () {
return value; // 返回属性的当前值
},
set: function (newVal) {
// const oldValue = value;
value = newVal;
wx.setStorageSync('meter', newVal)
}
});
},
@@ -204,43 +204,45 @@ Page({
const { code, message, data } = await getTenementMeterList(id);
if (code !== OK) {
alertInfo(message)
this.setData({ meterList: [], meter: {} })
wx.setStorageSync('meter', {})
return;
}
this.setData({
meterList: data || [],
meter: data?.[0] || {}
meter: (data?.[0] || {})
})
// if (!storageMeter) {
wx.setStorageSync('meter', data?.[0] || {} )
// }
},
async setUser() {
const result = await getUserInfo();
if (result.code !== OK) {
// alertInfo(result.message)
const user = wx.getStorageSync('user')
this.setData({ user: user })
return;
}
this.setData({ user: result.data })
wx.setStorageSync('user', result.data)
// const user = wx.getStorageSync('user')
// this.setData({ user: user })
},
async getAllList() {
const { code, message, data } = await getOwnTenementList()
if (code !== OK) {
alertInfo(message)
return
}
if (!data?.length) {
alertInfo("尚无信息")
wx.redirectTo({
url: '/pages/handleLogin/index?back=false',
})
return;
}
const [firstPark = {}] = data;
const { park, tenement } = this.data;
const updateDatas = {}
if (!park || !park.id) {
updateDatas.park = firstPark
const storagePark = wx.getStorageSync('park')
updateDatas.park = storagePark || firstPark
}
if (!tenement || !tenement.id) {
const storageTenement = wx.getStorageSync('tenement')
if (!park || !park.id) {
updateDatas.tenement = firstPark.tenements?.[0]
updateDatas.tenement = storageTenement || firstPark.tenements?.[0]
} else {
updateDatas.tenement = park.tenements?.[0];
updateDatas.tenement = storageTenement || park.tenements?.[0];
}
}
updateDatas.all = data;
@@ -248,13 +250,9 @@ Page({
...updateDatas
})
},
jumpToRecord() {
wx.navigateTo({
url: '/pages/rechargeRecord/index',
})
},
jumpToOrder() {
alertInfo("尚未完成")
jumpToShop() {
alertInfo("开发中");
},
/**
* 生命周期函数--监听页面隐藏

View File

@@ -8,7 +8,8 @@
"van-field": "@vant/weapp/field/index",
"picker": "/components/picker/index",
"van-grid": "@vant/weapp/grid/index",
"van-grid-item": "@vant/weapp/grid-item/index"
"van-grid-item": "@vant/weapp/grid-item/index",
"van-action-sheet": "@vant/weapp/action-sheet/index"
},
"navigationStyle": "custom"
}

View File

@@ -1,7 +1,9 @@
<!--pages/home/index.wxml-->
<page-meta page-style="{{ show ? 'overflow: hidden;' : '' }}" />
<view>
<view class="top">
<custom-status-bar transparent="{{true}}" />
<view class="chooseParkWrapper">
用电管理服务 ·
@@ -24,80 +26,27 @@
<view class="logined" wx:else>
<avatar text="{{ user.nickName }}" />
<view>
<van-button type="info" size="small" plain="{{true}}" class="loginBtn" bind:click="chooseTenement">{{tenement.name}} <van-icon name="arrow-down" style="margin-left: 16rpx;" /></van-button>
<view class="company" bind:tap="chooseTenement">
<view class="companyName"> {{tenement.name}} </view>
<van-icon name="arrow-down" style="margin-left: 16rpx;" />
</view>
<view class="welcome"> 欢迎使用华昌宝能用电管理系统! </view>
</view>
</view>
<view class="rechargeWrapper">
<view class="card">
<view class="cardTop">
<view class="cardTopLeft">
<view wx:if="{{user.id}}"> {{ tenement.shortName}} - {{ meter.address }} </view>
<view wx:else> -- </view>
<swiper indicator-dots="{{true}}" autoplay="{{true}}" interval="{{8000}}" duration="{{300}}">
<block wx:for="{{background}}" wx:key="*this">
<swiper-item>
<view class="swiper-item {{item}}">
{{item}}
</view>
<van-button type="info" size="small" plain="{{true}}" class="loginBtn" bind:click="changeMeter" wx:if="{{user.id}}">
<van-icon name="exchange" />
切换电表
</van-button>
</view>
<view class="cardContent">
<view class="cardItem">
<view class="cardItemLabel"> 电表编号: </view>
<view class="cardItemValue" wx:if="{{user.id}}"> {{meter.code}} </view>
<view class="cardItemValue" wx:else> -- </view>
</view>
<view class="cardItem">
<view class="cardItemLabel"> 电表地址: </view>
<view class="cardItemValue" wx:if="{{user.id}}"> {{meter.address}} </view>
<view class="cardItemValue" wx:else> -- </view>
</view>
<view class="cardItem">
<view class="cardItemLabel"> 电表余额: </view>
<view class="cardItemValue">
<view class="text" wx:if="{{user.id}}"> {{meter.money}} </view>
<view class="text" wx:else> --- </view>
<van-button type="info" size="small" plain="{{true}}" bind:click="refreshMeter" wx:if="{{user.id}}">
<van-icon name="replay" />
刷新
</van-button>
</view>
</view>
</view>
</view>
<view class="recharge">
<view> 请输入金额: </view>
<view class="moneyBox">
<view class="money" bind:tap="changeMoney" data-money="30"> ¥30 </view>
<view class="money" bind:tap="changeMoney" data-money="50"> ¥50 </view>
<view class="money" bind:tap="changeMoney" data-money="100"> ¥100 </view>
<view class="money" style="margin-right: 0;" bind:tap="changeMoney" data-money="200"> ¥200 </view>
</view>
<view class="moneyInput">
<van-field
value="{{ money }}"
placeholder="请输入充值金额"
border="{{true}}"
bind:change="onChangeMoney"
size="large"
type="digit"
/>
</view>
</view>
<view class="operate">
<van-button color="rgb(88, 165, 141)" block bind:click="recharge">去缴费</van-button>
</view>
<view class="others">
<van-grid direction="horizontal" column-num="2">
<van-grid-item icon="balance-list-o" text="电费账单" bind:click="jumpToOrder">
<!-- <view slot="icon"> 111 </view> -->
<!-- <van-icon slot="icom" name="balance-list-o" /> -->
</van-grid-item>
<van-grid-item icon="after-sale" text="缴费记录" bind:click="jumpToRecord" />
<van-grid-item icon="bar-chart-o" text="用电查询" />
<van-grid-item icon="bill-o" text="去开票" bind:click="jumpToInvoice" />
</van-grid>
</view>
</view>
</swiper-item>
</block>
</swiper>
<van-grid column-num="2" direction="horizontal">
<van-grid-item icon="balance-list-o" text="充值" bind:tap="jumpToRecharge" />
<van-grid-item icon="shop-o" text="商城" bind:tap="jumpToShop" />
</van-grid>
</view>
<picker show="{{show}}" valueKey="name" columns="{{columns}}" bind:ok="onOk" bind:cancel="onCancel" type="{{pickerType}}" />

View File

@@ -21,118 +21,47 @@
.park {
margin-left: 20rpx;
max-width: 200rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.parkContent {
display: flex;
align-items: center;
font-size: 32rpx;
}
.notLoginWrapper, .logined {
padding: 30rpx 32rpx;
padding: 24rpx 32rpx;
padding-left: 50rpx;
background-color: var(--middle-green);
display: flex;
align-items: center;
}
.loginBtn {
.loginBtn, .company {
margin-left: 30rpx;
}
.rechargeWrapper {
background: linear-gradient(to bottom, var(--middle-green), #fff );
overflow: hidden;
}
.card {
margin-top: 1vh;
margin-left: 46rpx;
margin-right: 46rpx;
border-radius: 30rpx;
padding: 28rpx 30rpx;
/* background-color: rgb(173, 217, 203); */
background: linear-gradient(to bottom right, rgb(212, 240, 231), rgb(145, 206, 185));
}
.cardTop {
.company {
font-size: 32rpx;
display: flex;
align-items: center;
color: #fff;
}
.cardTopLeft {
display: flex;
align-items: center;
flex: 1;
}
.cardContent {
margin: 30rpx 20rpx 0;
}
.cardItem {
display: flex;
align-items: center;
margin-bottom: 30rpx;
font-size: 34rpx;
}
.cardItemValue {
display: flex;
flex: 1;
align-items: center;
}
.cardItemValue .text {
flex: 1;
}
.recharge {
background: #fff;
padding: 20rpx 30rpx;
margin-top: 30rpx;
margin-left: 46rpx;
margin-right: 46rpx;
margin-bottom: 40rpx;
border-radius: 30rpx;
}
.operate {
margin-left: 46rpx;
margin-right: 46rpx;
margin-bottom: 40rpx;
.companyName {
max-width:300rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.welcome {
margin-top: 20rpx;
margin-left: 30rpx;
font-size: 32rpx;
color: #fff;
}
.moneyBox {
display: flex;
justify-content: space-between;
margin-top: 30rpx;
}
.money {
flex: 1;
padding: 16rpx;
display: flex;
justify-content: center;
align-items: center;
border: 1rpx solid #ccc;
margin-right: 30rpx;
}
.moneyInput {
margin-top: 30rpx;
margin-bottom: 30rpx;
}
.others {
margin-left: 46rpx;
margin-right: 46rpx;
margin-top: 40rpx;
margin-bottom: 40rpx;
font-size: 30rpx;
color: rgba(255,255,255, .85);
}

View File

@@ -1,44 +0,0 @@
import { throttle } from "../../utils/index"
Page({
data: {
motto: 'Hello World',
num: 1,
staffA: {firstName: 'Hulk', lastName: 'Hu'},
staffB: {firstName: 'Shang', lastName: 'You'},
staffC: {firstName: 'Gideon', lastName: 'Lin'}
},
onLoad() {
},
onShow() {
},
test: throttle(function() {
}, 500),
payment: function() {
wx.requestPayment({
timeStamp: data?.time,
nonceStr: data?.nonceStr,
package: "prepay_id=" + data?.prepay_id,
paySign: data?.paySign,
signType: 'RSA',
success (res) {
console.log('success', res);
},
fail (res) {
console.log('res', res)
}
})
},
kefu(e) {
console.log('e', e);
},
increment() {
// this.data.num = this.data.num +=1 ;
this.setData({
num: this.data.num + 1
})
}
})

View File

@@ -1,5 +0,0 @@
{
"usingComponents": {
"navigator": "/components/navigator/index"
}
}

View File

@@ -1,11 +0,0 @@
<!--index.wxml-->
<!-- <scroll-view class="scrollarea" scroll-y type="list">
<view class="usermotto" bind:tap="payment">
支付
</view>
<button open-type="contact" bindcontact="kefu"> 客服 </button>
{{num}}
<button bindtap="increment"> 增加 </button>
</scroll-view> -->
<navigator title="充值" />

View File

@@ -1,12 +0,0 @@
/**index.wxss**/
page {
height: 100vh;
display: flex;
flex-direction: column;
overflow: hidden;
}
.usermotto {
margin-top: 200px;
text-align: center;
}

View File

@@ -1,5 +1,7 @@
import { getInvoiceInfoDetail } from "../../service/invoice";
import { getInvoiceInfoDetail, downloadInvoice } from "../../service/invoice";
import { alertError, alertInfo, loadingFunc } from "../../utils/index";
import request from '../../utils/request'
const { OK } = request;
// pages/invoiceInfo/index.js
Page({
@@ -7,7 +9,8 @@ Page({
* 页面的初始数据
*/
data: {
detail: {}
detail: {},
id: "",
},
/**
@@ -19,11 +22,76 @@ Page({
},
async init(id) {
const { code, message, data } = await getInvoiceInfoDetail(id)
this.setData({ detail: data });
this.setData({ detail: data, id });
},
handleBack() {
wx.navigateBack()
},
jumpToDetail() {
wx.redirectTo({
url: '/pages/invoiceDetailContent/index?id=' + this.data.id,
})
},
download() {
const that = this;
wx.showActionSheet({
itemList: ['发票XML文件下载', '发票PDF文件下载'],
async success(res) {
loadingFunc(async () => {
const { code, message, data } = await downloadInvoice(that.data.id, res.tapIndex);
if (code !== OK) {
alertInfo(message)
return;
}
if (!data) {
alertInfo("暂无文档信息")
return
}
wx.downloadFile({
url: data,
success(res) {
if (res.statusCode === 200) {
if (!res.tempFilePath) {
alertError("没有开票信息")
return;
}
wx.openDocument({
filePath: res.tempFilePath,
fileType: [res.tapIndex === 0 ? 'xml' : "pdf"], // 3. 这个必须写合法类型,不然下载不了
success: function (res) {
},
fail: function (e) {
alertError("打开失败")
console.log('打开失败错误为', e)
}
})
}
},
fail: (e) => {
console.log('e', e)
alertInfo("下载文件失败")
}
})
})
// console.log('data', data)
// const filePath = `${wx.env.USER_DATA_PATH}/发票/${that.data.id}.${res.tapIndex === 0 ? 'xml' : "pdf"}`;
// FileSystemManager.writeFile({
// filePath: filePath,
// data: res.data,
// encoding: 'base64', // 2. base64解密写入, 后台返回的byte[]数组是经过base64编码的其他方式写入文件打开格式不对
// success: function(res) {
// },
// fail: function (e) {
// console.log(e.errMsg);
// }
// });
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

View File

@@ -1,6 +1,8 @@
{
"usingComponents": {
"van-field": "@vant/weapp/field/index",
"van-button": "@vant/weapp/button/index"
}
"van-button": "@vant/weapp/button/index",
"navigator": "/components/navigator/index"
},
"navigationStyle": "custom"
}

View File

@@ -1,5 +1,5 @@
<!--pages/invoiceInfo/index.wxml-->
<van-cell-group>
<!-- <van-cell-group>
<van-field
value="{{ detail.name }}"
label="公司名称"
@@ -47,4 +47,28 @@
<view class="wrapper operate">
<van-button type="default" block style="flex: 1" bind:click="handleBack">返回</van-button>
<van-button type="info" block style="margin-left: 30rpx;flex: 1;">编辑</van-button>
</view> -->
<navigator title="发票详细" canBack="{{true}}" bind:back="back" />
<view wx:if="{{detail.status === 2}}">
<view class="wrapper">
<view style="margin-top: 40rpx;"> 尊敬的客户,您好: </view>
<view style="margin-top: 20rpx;"> 已经为您开具订单{{detail.id}}的发票发票数量共计1张如下 </view>
<view style="margin-top: 20rpx;"> 发票类型:数电发票(电子发票),发票号码:{{detail.number}}您可以点击“发票XML文件下载”获取该发票XML文件或者点击“发票PDF文件下载”获取该发票PDF文件 </view>
<view style="margin-top: 20rpx;"> 同时您也可以到预留的邮箱中查看下载发票。 </view>
</view>
<view class="operate">
<van-button type="info" style="flex: 1;" block bind:click="download"> 下载 </van-button>
<van-button type="info" style="flex: 1;margin-left: 40rpx;" block bind:click="jumpToDetail"> 发票明细 </van-button>
</view>
</view>
<view wx:if="{{detail.status === 1}}">
<view class="wrapper">
<view style="margin-top: 40rpx;"> 尊敬的客户,您好: </view>
<view style="margin-top: 20rpx;"> 开票申请已提交,系统正在开票中,请您稍后再查看。 </view>
</view>
<view class="operate">
<van-button type="info" style="flex: 1;" block bind:click="jumpToDetail"> 发票明细 </van-button>
</view>
</view>

View File

@@ -4,4 +4,16 @@
display: flex;
align-items: center;
margin-top: 50rpx;
}
page {
background-color: var(--transparent-green);
}
.operate {
margin-top: 80rpx;
display: flex;
align-items: center;
margin-left: 30rpx;
margin-right: 30rpx;
}

View File

@@ -1,13 +1,19 @@
import { getInvoiceInfoDetail } from "../../service/invoice";
// pages/invoiceInfo/index.js
// pages/invoiceDetailContent/index.js
Page({
/**
* 页面的初始数据
*/
data: {
detail: {}
detail: {},
id: "",
header: [
{ key: 'time', title: '月份' },
{ title: '电表地址',renderBody: (item) => item.meter.address },
{ key: 'money', title: '金额' },
]
},
/**
@@ -15,13 +21,19 @@ Page({
*/
onLoad(options) {
const { id } = options;
if (id !== "-1") {
this.init(id);
}
this.getDetail(id)
},
async init(id) {
const { code, message, data } = await getInvoiceInfoDetail(id)
this.setData({ detail: data });
async getDetail(id) {
const { code, message, data } = await getInvoiceInfoDetail(id);
this.setData({
detail: data,
id
})
},
jumpToInvoiceDetail() {
wx.redirectTo({
url: '/pages/invoiceDetail/index?id=' + this.data.id,
})
},
/**
* 生命周期函数--监听页面初次渲染完成

View File

@@ -0,0 +1,9 @@
{
"usingComponents": {
"van-field": "@vant/weapp/field/index",
"table": "/components/table/table",
"van-button": "@vant/weapp/button/index",
"navigator": "/components/navigator/index"
},
"navigationStyle": "custom"
}

View File

@@ -0,0 +1,80 @@
<!--pages/invoiceDetailContent/index.wxml-->
<navigator title="发票明细" canBack="{{true}}" />
<view class="wrapper">
<van-field
value="{{detail.tenement.name}}"
label="开票名称 :"
readonly
autosize="{{true}}"
type="textarea"
border="{{false}}"
title-width="160rpx"
/>
<van-field
value="{{detail.approveTime}}"
label="申请时间 :"
readonly
autosize="{{true}}"
type="textarea"
border="{{false}}"
title-width="160rpx"
/>
<van-field
value="{{detail.finishTime}}"
label="开票时间 :"
readonly
autosize="{{true}}"
type="textarea"
border="{{false}}"
title-width="160rpx"
/>
<van-field
value="{{detail.number}}"
label="发票编号 :"
readonly
autosize="{{true}}"
type="textarea"
border="{{false}}"
title-width="160rpx"
/>
<van-field
value="{{detail.money}}"
label="开票金额 :"
readonly
autosize="{{true}}"
type="textarea"
border="{{false}}"
title-width="160rpx"
/>
<van-field
value="{{detail.invoice.content}}"
label="开票内容 :"
readonly
autosize="{{true}}"
type="textarea"
border="{{false}}"
title-width="160rpx"
/>
<van-field
value="{{detail.invoice.type === 0 ? '普通发票' : '增值税专用发票'}}"
label="发票类型 :"
readonly
autosize="{{true}}"
type="textarea"
border="{{false}}"
title-width="160rpx"
/>
<van-field
label="电费情况 :"
readonly
autosize="{{true}}"
type="textarea"
border="{{false}}"
title-width="160rpx"
/>
<table header="{{header}}" list="{{detail.list}}" />
<view style="padding-top: 40rpx;padding-bottom: 40rpx;display: flex; justify-content: center;">
<van-button type="info" bind:click="jumpToInvoiceDetail">发票</van-button>
</view>
</view>
<view style="height: 50rpx;"></view>

View File

@@ -0,0 +1,10 @@
/* pages/invoiceDetailContent/index.wxss */
page {
background-color: var(--transparent-green);
}
.wrapper {
background-color: #fff;
margin: 30rpx;
border-radius: 24rpx;
}

View File

@@ -1,3 +1,7 @@
import { getAlreadyInvoiceList } from "../../../../service/invoice"
import { alertInfo, loadingFunc } from "../../../../utils/index";
import request from '../../../../utils/request'
const { OK } = request;
// pages/invoiceList/components/already/index.js
Component({
@@ -12,13 +16,50 @@ Component({
* 组件的初始数据
*/
data: {
page: 1,
list: []
},
onRefresh() {
this.getList();
},
lifetimes: {
attached() {
this.getList();
}
},
/**
* 组件的方法列表
*/
methods: {
async getList() {
const { page, list = [] } = this.data;
const { code, message, data } = await getAlreadyInvoiceList(page);
if (!data.length) {
alertInfo("没有更多数据了")
return
}
this.setData({
list: [...list, ...data, ],
page: page + 1,
})
},
onRefresh() {
loadingFunc(() => this.getList())
},
scrollToLower() {
loadingFunc(() => this.getList())
},
jumpToDetail(e) {
const { id } = e.currentTarget.dataset;
wx.navigateTo({
url: '/pages/invoiceDetail/index?id=' + id,
})
},
jumpToDetailContent(e) {
const { id } = e.currentTarget.dataset;
wx.navigateTo({
url: '/pages/invoiceDetailContent/index?id=' + id,
})
}
}
})

View File

@@ -1,4 +1,7 @@
{
"component": true,
"usingComponents": {}
"usingComponents": {
"van-button": "@vant/weapp/button/index",
"empty": "/components/empty/index"
}
}

View File

@@ -1,2 +1,39 @@
<!--pages/invoiceList/components/already/index.wxml-->
<text>pages/invoiceList/components/already/index.wxml</text>
<scroll-view wx:if="{{list.length}}" scroll-y lower-threshold="100px" bindscrolltolower="scrollToLower" style="height: 80vh;" scroll-top="{{topHeight}}px" class="scrView">
<view class="card" wx:for="{{list}}">
<view class="left">
<view class="title">
{{item.invoice.name}}
</view>
<view class="invoiceContent">
发票内容: {{item.invoice.content}}{{item.money}}元)
</view>
<view class="invoiceType">
发票类型:{{ item.invoice.type === 0 ? '普通发票' : '增值税专用发票' }}
</view>
<view class="time">
{{item.finishTime}}
</view>
</view>
<view class="right">
<view class="money"> </view>
<view class="operate">
<view style="margin-top: 20rpx; margin-bottom: 20rpx;">
<van-button type="info" class="invoiceBtn" bind:click="submit" size="small" bind:click="jumpToDetail" data-id="{{item.id}}">发票</van-button>
</view>
<van-button type="info" class="detailBtn" bind:click="submit" size="small" bind:click="jumpToDetailContent" data-id="{{item.id}}">明细</van-button>
</view>
</view>
<view class="{{item.status === 1 ? 'approving' : 'already'}}">
<view wx:if="{{item.status === 1}}"> 审核中 </view>
<view wx:else> 已开票 </view>
</view>
</view>
<view style="height: 50rpx;"></view>
</scroll-view>
<view wx:else>
<empty text="暂无数据" bind:refresh="onRefresh" />
</view>

View File

@@ -1 +1,63 @@
/* pages/invoiceList/components/already/index.wxss */
/* pages/invoiceList/components/already/index.wxss */
.card {
margin-top: 20rpx;
margin-bottom: 20rpx;
margin-left: 30rpx;
margin-right: 30rpx;
display: flex;
background-color: #fff;
border-radius: 26rpx;
padding: 20rpx;
box-sizing: border-box;
position: relative;
}
.left {
flex: 1;
}
.right {
display: flex;
flex-direction: column;
justify-content: flex-end;
}
.detailBtn {
margin-top: 20rpx;
}
.title {
font-size: 34rpx;
font-weight: 600;
}
.invoiceContent, .invoiceType, .time {
margin-top: 30rpx;
font-size: 32rpx;
}
.operate {
display: flex;
flex-direction: column;
justify-content: flex-end;
}
.approving {
position: absolute;
top: 0;
right: 0;
font-size: 30rpx;
background-color: rgb(239,227,227);
padding: 14rpx 24rpx;
border-radius: 18rpx;
color: rgb(224, 106, 106)
}
.already {
position: absolute;
top: 0;
right: 0;
font-size: 30rpx;
background-color: #0958d9;
padding: 14rpx 24rpx;
border-radius: 18rpx;
color: #fff;
/* color: var(--deep-green) */
}

View File

@@ -1,4 +1,8 @@
import { getInvoiceInfoList } from "../../../../service/invoice"
import { getInvoiceInfo, updateInvoiceInfo } from "../../../../service/invoice"
import { getUserInfo } from "../../../../service/user";
import { alertInfo, alertSuccess, isValidPhoneNumber } from "../../../../utils/index";
import request from '../../../../utils/request'
const { OK } = request
// pages/invoiceList/components/info/index.js
Component({
@@ -11,20 +15,104 @@ Component({
},
lifetimes: {
attached() {
getInvoiceInfoList()
this.getDetail();
this.getUser();
}
},
/**
* 组件的初始数据
*/
data: {
detail: { },
formData: {headerType: 0, name: wx.getStorageSync('tenement')?.name},
editType: "detail"
},
/**
* 组件的方法列表
*/
methods: {
async getDetail() {
const { code, message, data } = await getInvoiceInfo()
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({ detail: {...data,name: wx.getStorageSync('tenement')?.name, },editType: 'detail', })
},
async getUser() {
const { code, message, data } = await getUserInfo()
this.setData({ user: data });
},
changeEditType() {
this.setData({ editType: 'edit', formData: {...this.data.detail, tenement: wx.getStorageSync('tenement')?.id} })
},
cancelEdit() {
this.setData({ editType: 'detail', formData: {} })
},
onChangeType(e) {
const { formData } = this.data;
this.setData({ formData: {...formData, type: e.detail} })
},
onChangeHeaderType(e) {
const { formData } = this.data;
this.setData({ formData: {...formData, headerType: e.detail} })
},
onChangeText(e) {
const { name } = e.currentTarget.dataset;
const { formData } = this.data;
this.setData({ formData: {...formData, [name]: e.detail} })
},
async submit() {
const { formData } = this.data;
const { tin, address, phone, bank, account, email, type, headerType, name } = formData;
if (type !== 0 && type !== 1) {
alertInfo("请选择发票类型");
return;
}
if (headerType !== 0 && headerType !== 1) {
alertInfo("请选择抬头类型");
return;
}
if (headerType === 1) {
if (!name) {
alertInfo("请输入发票抬头")
return
}
}
if (!email || !/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test(email)) {
alertInfo("邮箱格式不正确")
return;
}
if (headerType === 0) {
if (!tin) {
alertInfo("请输入发票税号")
return;
}
// if (!address) {
// alertInfo("请输入地址")
// return;
// }
if (phone && !isValidPhoneNumber(phone)) {
alertInfo("手机号格式不正确")
return
}
if (!bank) {
alertInfo("请输入开户行")
return;
}
if (!account) {
alertInfo("请输入银行账号")
return;
}
}
const { code, message } = await updateInvoiceInfo(formData)
if (code !== OK) {
alertInfo(message)
return;
}
alertSuccess("编辑成功")
this.getDetail()
}
}
})

View File

@@ -1,4 +1,11 @@
{
"component": true,
"usingComponents": {}
"usingComponents": {
"card": "/components/card/index",
"van-icon": "@vant/weapp/icon/index",
"van-field": "@vant/weapp/field/index",
"van-radio": "@vant/weapp/radio/index",
"van-radio-group": "@vant/weapp/radio-group/index",
"van-button": "@vant/weapp/button/index"
}
}

View File

@@ -1,2 +1,355 @@
<!--pages/invoiceList/components/info/index.wxml-->
<text>pages/invoiceList/components/info/index.wxml</text>
<view class="cardWrapper">
<card title="发票详情">
<view
slot="operate"
class="cardOperate"
wx:if="{{editType === 'detail' && user.isAdmin}}"
bind:tap="changeEditType"
>
<van-icon name="edit" />
<view class="editContent">修改</view>
</view>
<view slot="content">
<view wx:if="{{editType === 'detail'}}">
<van-field
label="发票类型"
readonly="{{true}}"
autosize="{{true}}"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"
border="{{ false }}"
value="普通发票"
wx:if="{{detail.type === 0}}"
/>
<van-field
label="发票类型"
readonly="{{true}}"
autosize="{{true}}"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"
border="{{ false }}"
value="增值税专用发票"
wx:elif="{{detail.type === 1}}"
/>
<van-field
label="发票类型"
readonly="{{true}}"
autosize="{{true}}"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"
border="{{ false }}"
value="-"
wx:elif="{{detail.type === 1}}"
/>
<van-field
label="抬头类型"
readonly="{{true}}"
autosize="{{true}}"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"
border="{{ false }}"
value="企业单位"
wx:if="{{detail.headerType === 0}}"
>
<view
slot="input"
style="margin-top: -10rpx;"
>
<view wx:if="{{detail.headerType === 0}}"> 企业单位 </view>
<view wx:elif="{{detail.headerType === 1}}"> 个人/非企业单位 </view>
<view wx:else>-</view>
</view>
</van-field>
<van-field
label="抬头类型"
readonly="{{true}}"
autosize="{{true}}"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"
border="{{ false }}"
value="个人/非企业单位"
wx:elif="{{detail.headerType === 1}}"
/>
<van-field
label="抬头类型"
readonly="{{true}}"
autosize="{{true}}"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"
border="{{ false }}"
value="个人/非企业单位"
wx:else
/>
<van-field
value="{{detail.name || '-'}}"
label="发票抬头"
custom-style="padding-left: 0; padding-right: 0;"
readonly="{{true}}"
autosize="{{true}}"
title-width="132rpx"
border="{{ false }}"
>
</van-field>
<van-field
label="发票税号"
value="{{detail.tin || '-'}}"
wx:if="{{detail.headerType === 0}}"
custom-style="padding-left: 0; padding-right: 0;"
readonly="{{editType === 'detail'}}"
autosize="{{true}}"
title-width="132rpx"
border="{{ editType === 'detail' ? false : true }}"
>
</van-field>
<van-field
value="{{detail.bank || '-'}}"
label="开户行"
wx:if="{{detail.headerType === 0}}"
custom-style="padding-left: 0; padding-right: 0;"
readonly="{{editType === 'detail'}}"
autosize="{{true}}"
title-width="132rpx"
border="{{ editType === 'detail' ? false : true }}"
>
</van-field>
<van-field
label="银行账号"
value="{{detail.account || '-'}}"
wx:if="{{(detail.headerType === 0)}}"
placeholder="{{editType === 'edit' ? '请输入银行账号' : ''}}"
custom-style="padding-left: 0; padding-right: 0;"
readonly="{{editType === 'detail'}}"
autosize="{{true}}"
title-width="132rpx"
border="{{ editType === 'detail' ? false : true }}"
bind:change="onChangeText"
data-name="account"
>
</van-field>
<van-field
label="地址"
wx:if="{{(detail.headerType === 0)}}"
placeholder="{{editType === 'edit' ? '请输入地址' : ''}}"
custom-style="padding-left: 0; padding-right: 0; height: auto;"
readonly="{{editType === 'detail'}}"
autosize="{{true}}"
title-width="132rpx"
border="{{ editType === 'detail' ? false : true }}"
bind:change="onChangeText"
data-name="address"
value="{{detail.address || '-'}}"
>
</van-field>
<van-field
label="备注"
wx:if="{{editType === 'detail' }}"
custom-style="padding-left: 0; padding-right: 0;"
readonly="{{editType === 'detail'}}"
autosize="{{true}}"
title-width="132rpx"
border="{{ editType === 'detail' ? false : true }}"
bind:change="onChangeText"
data-name="remark"
value="{{detail.remark || '-'}}"
>
<!-- <view slot="input" style="margin-top: -10rpx;">
<view> {{detail.remark || '-'}} </view>
</view> -->
</van-field>
</view>
<view wx:else>
<van-field
label="发票类型"
autosize="{{true}}"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"
border="{{ true }}"
>
<view slot="input" style="margin-top: 16rpx;">
<van-radio-group direction="horizontal" value="{{formData.type}}" bind:change="onChangeType">
<van-radio name="{{0}}" icon-size="30rpx" style="font-size: 30rpx;margin-bottom: 20rpx;">普通发票</van-radio>
<van-radio name="{{1}}" icon-size="30rpx" style="font-size: 30rpx;">增值税专用发票</van-radio>
</van-radio-group>
</view>
</van-field>
<van-field
label="抬头类型"
autosize="{{true}}"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"
border="{{ true }}"
>
<view slot="input" style="margin-top: 16rpx;">
<van-radio-group direction="horizontal" bind:change="onChangeHeaderType" value="{{formData.headerType}}">
<van-radio name="{{0}}" icon-size="30rpx" style="font-size: 30rpx;margin-bottom: 20rpx;">企业单位</van-radio>
<van-radio name="{{1}}" icon-size="30rpx" style="font-size: 30rpx;">个人/非企业单位</van-radio>
</van-radio-group>
</view>
</van-field>
<van-field
wx:if="{{formData.headerType === 0 }}"
value="{{formData.name || '--'}}"
label="发票抬头"
custom-style="padding-left: 0; padding-right: 0;"
readonly="{{true}}"
disabled="{{true}}"
title-width="132rpx"
border="{{ true }}"
/>
<van-field
wx:else
value="{{formData.name}}"
label="发票抬头"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"
bind:change="onChangeText"
data-name="name"
bind:change="onChangeText"
border="{{ true }}"
/>
<van-field
value="{{formData.tin }}"
label="发票税号"
wx:if="{{formData.headerType === 0}}"
placeholder="{{'请输入发票税号'}}"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"
bind:change="onChangeText"
data-name="tin"
border="{{true }}"
/>
<van-field
value="{{formData.bank}}"
label="开户行"
wx:if="{{ formData.headerType === 0}}"
placeholder="{{'请输入开户行'}}"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"
border="{{ true }}"
bind:change="onChangeText"
data-name="bank"
/>
<van-field
value="{{formData.account}}"
label="银行账号"
wx:if="{{(formData.headerType === 0) }}"
placeholder="{{'请输入银行账号' }}"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"
border="{{true }}"
bind:change="onChangeText"
data-name="account"
/>
<van-field
value="{{formData.address}}"
label="地址"
wx:if="{{(formData.headerType === 0)}}"
placeholder="{{'请输入地址'}}"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"
border="{{ true }}"
bind:change="onChangeText"
data-name="address"
/>
<van-field
value="{{formData.remark}}"
label="备注"
placeholder="{{'请输入备注'}}"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"
border="{{true }}"
bind:change="onChangeText"
data-name="remark"
/>
</view>
</view>
</card>
</view>
<view class="cardWrapper" style="margin-bottom: 40rpx;">
<card title="接收信息">
<view slot="content">
<view wx:if="{{editType === 'detail'}}">
<van-field
label="手机号"
wx:if="{{(detail.headerType === 0)}}"
placeholder="{{editType === 'edit' ? '请输入手机号' : ''}}"
custom-style="padding-left: 0; padding-right: 0;"
readonly="{{editType === 'detail'}}"
autosize="{{true}}"
title-width="132rpx"
border="{{ editType === 'detail' ? false : true }}"
bind:change="onChangeText"
data-name="phone"
value="{{detail.phone || '-'}}"
>
</van-field>
</view>
<view wx:else>
<van-field
value="{{formData.phone }}"
label="手机号"
wx:if="{{(formData.headerType === 0) }}"
placeholder="{{ '请输入手机号' }}"
custom-style="padding-left: 0; padding-right: 0;"
title-width="132rpx"
border="{{ true }}"
bind:change="onChangeText"
data-name="phone"
/>
</view>
<van-field
value="{{detail.email || '--'}}"
wx:if="{{editType === 'detail'}}"
label="电子邮箱"
custom-style="padding-left: 0; padding-right: 0;"
readonly="{{editType === 'detail'}}"
autosize="{{true}}"
title-width="132rpx"
border="{{ editType === 'detail' ? false : true }}"
bind:change="onChangeText"
data-name="email"
value="{{detail.email || '-'}}"
>
</van-field>
<van-field
value="{{formData.email}}"
wx:else
label="电子邮箱"
custom-style="padding-left: 0; padding-right: 0;"
readonly="{{editType === 'detail'}}"
title-width="132rpx"
border="{{ editType === 'detail' ? false : true }}"
bind:change="onChangeText"
data-name="email"
placeholder="请输入电子邮箱"
/>
</view>
</card>
</view>
<view class="submit" wx:if="{{editType === 'edit'}}">
<van-button block class="cancelEdit" bind:click="cancelEdit">取消编辑</van-button>
<van-button type="info" block class="save" bind:click="submit">保存</van-button>
</view>

View File

@@ -1 +1,34 @@
/* pages/invoiceList/components/info/index.wxss */
/* pages/invoiceList/components/info/index.wxss */
.cardOperate {
display: flex;
align-items: center;
font-size: 32rpx;
}
.cardWrapper {
margin-top: 30rpx;
}
.editContent {
margin-left: 20rpx;
}
.van-cell {
padding-left: 0rpx !important;
padding-right: 0rpx !important;
}
.submit {
margin: 32rpx;
margin-bottom: 50rpx;
display: flex;
align-items: center;
}
.cancelEdit, .save {
flex: 1;
}
.cancelEdit {
margin-right: 40rpx;
}

View File

@@ -1,6 +1,6 @@
// pages/invoiceList/components/notyet/index.js
import { getInvoiceList } from '../../../../service/invoice';
import { alertInfo } from '../../../../utils/index';
import { alertInfo, loadingFunc } from '../../../../utils/index';
import request from '../../../../utils/request';
const { OK } = request;
@@ -34,11 +34,15 @@ Component({
methods: {
async init() {
const { code, message, data } = await getInvoiceList();
// if (code !== OK) {
// alertInfo(message)
// return;
// }
this.setData({ list: data, selectList: new Array(data?.length).map(() => false) })
if (code !== OK) {
alertInfo(message)
return;
}
this.setData({ list: data, selectList: new Array(data?.length).map(() => false), allChecked: false, })
},
onRefresh() {
loadingFunc(() => this.init())
},
onChange(e) {
const { id, index } = e.currentTarget.dataset;
@@ -64,13 +68,15 @@ Component({
this.setData({
// chooseList: newList,
selectList: newSelectList,
allChecked: selectCount === list.length,
selectCount,
selectMoney
selectMoney: Number(selectMoney.toFixed(2))
})
},
next() {
const { selectList, list, selectMoney, selectCount } = this.data;
let tenementID = "";
let tenementName = "";
let ids = [];
for(let i = 0; i < selectList.length; i ++) {
if (selectList[i]) {
@@ -78,6 +84,7 @@ Component({
ids.push(list[i]?.id);
if (!tenementID) {
tenementID = currentTenementID;
tenementName = list[i]?.tenement?.name;
} else if(tenementID !== currentTenementID) {
alertInfo("只能对一个公司开票")
return;
@@ -85,8 +92,18 @@ Component({
}
}
wx.navigateTo({
url: `/pages/invoicing/index?money=${selectMoney}&count=${selectCount}&tenement=${tenementID}&ids=${ids}`,
url: `/pages/invoicing/index?money=${selectMoney}&count=${selectCount}&tenement=${tenementID}&ids=${ids}&tenementName=${tenementName}`,
})
},
onAllChecked(e) {
const { list } = this.data;
if (e.detail) {
const newSelectList = Array.from({ length: list.length }, () => true)
this.setData({ selectList: newSelectList, selectCount: list.length, selectMoney: list.map(item => item.money).reduce((prev, next) => prev + next).toFixed(2), allChecked: true })
} else {
this.setData({ allChecked: false, selectMoney: 0, selectList: [], selectCount: 0 })
}
}
}
})

View File

@@ -2,6 +2,7 @@
"component": true,
"usingComponents": {
"van-checkbox": "@vant/weapp/checkbox/index",
"van-button": "@vant/weapp/button/index"
"van-button": "@vant/weapp/button/index",
"empty": "/components/empty/index"
}
}

View File

@@ -1,5 +1,6 @@
<view wx:if="{{list.length}}">
<van-checkbox-group value="{{ chooseList }}" bind:change="onChange" max="{{ 2 }}">
<van-checkbox-group value="{{ chooseList }}" bind:change="onChange" max="{{ 2 }}" >
<view class="cardWrapper" wx:for="{{list}}" wx:key="index">
<view class="content">
<view class="left">
@@ -24,10 +25,18 @@
</van-checkbox-group>
<view class="allSelect">
<view class="allNumber"> {{ selectCount }} </view>
笔订单,共
<view class="allMoney"> ¥ {{selectMoney}} </view>
<van-button size="small" type="info" bind:click="next" disabled="{{!selectCount}}"> 下一步 </van-button>
<van-checkbox value="{{ allChecked }}" bind:change="onAllChecked">
全选
</van-checkbox>
<view style="flex: 1; display: flex; align-items: center; justify-content: flex-end;">
<view class="allNumber"> {{ selectCount }} </view>
笔订单,共
<view class="allMoney"> ¥ {{selectMoney}} </view>
<van-button size="small" type="info" bind:click="next" disabled="{{!selectCount}}"> 下一步 </van-button>
</view>
</view>
</view>
<view wx:else>
<empty bind:refresh="onRefresh" />
</view>

View File

@@ -47,6 +47,7 @@
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
}
.allNumber {
@@ -56,8 +57,8 @@
}
.allMoney {
flex: 1;
margin-left: 20rpx;
margin-right: 20rpx;
color: var(--money-color);
}
@@ -75,7 +76,7 @@
}
.month {
width: 138rpx;
width: 190rpx;
white-space: nowrap;
overflow: hidden;

View File

@@ -16,14 +16,21 @@ Page({
{ name: '编辑', },
{ name: '删除', },
],
selectData: {}
selectData: {},
active: 0,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const { tab } = options;
if (isNaN(Number(tab))) {
return
}
this.setData({
active: Number(tab)
})
},
/**
@@ -68,6 +75,9 @@ Page({
break;
}
},
onChange(e) {
this.setData({ active: e.detail.index })
},
async handleDelete() {
const { id } = this.data.selectData;
await wxModal({ content: "确定要删除当前记录吗?" })

View File

@@ -1,13 +1,12 @@
<navigator canBack="{{true}}" title="发票管理" />
<van-tabs active="{{ active }}" bind:change="onChange">
<van-tab title="申请开票">
<notyet />
<notyet wx:if="{{active === 0}}" />
</van-tab>
<van-tab title="已开发票">
<already />
<already wx:if="{{active === 1}}" />
</van-tab>
<van-tab title="开票信息">
<info />
<info wx:if="{{active === 2}}" />
</van-tab>
</van-tabs>

View File

@@ -1,3 +1,8 @@
import { getInvoiceInfo, makeInvoice } from "../../service/invoice"
import { alertInfo, alertSuccess, loadingFunc } from "../../utils/index";
import request from '../../utils/request'
const { OK } = request
// pages/invoicing/index.js
Page({
@@ -7,33 +12,105 @@ Page({
data: {
money: 0,
tenement: "",
tenementName: "",
ids: [],
count: 0,
show: false,
remark: ""
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const { money = 10, tenement, ids = 'q', count = 10 } = options;
console.log('option', options)
this.setData({ money, tenement, ids: ids.split(","), count })
const { money = 0, tenement, ids = '', count = 0, tenementName } = options;
this.setData({ money, tenement, ids: ids.split(","), count, tenementName })
this.getDetail();
},
async getDetail() {
const { code, message, data } = await getInvoiceInfo()
if (code !== OK) {
alertInfo(message)
return;
}
if (!data?.tenement?.id || !data?.name) {
const user = wx.getStorageSync('user')
if (user.isAdmin) {
wx.showModal({
title: '提示',
content: '当前公司没有开票信息,请先前往开票信息页面编辑开票信息',
confirmText: '前往编辑',
cancelText: '取消',
complete: (res) => {
if (res.cancel) {
wx.navigateBack()
}
if (res.confirm) {
wx.redirectTo({
url: '/pages/invoiceList/index?tab=2',
})
}
}
})
return
} else {
wx.showModal({
title: '提示',
content: '当前公司没有开票信息,请联系管理员编辑完开票信息之后再开票',
showCancel: false,
confirmText: '返回',
complete: (res) => {
if (res.cancel) {
wx.navigateBack()
}
if (res.confirm) {
wx.navigateBack()
}
}
})
return
}
}
this.setData({ detail: {...data, }, remark: data.remark })
},
changeRemark(e) {
this.setData({ remark: e.detail })
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
async onSubmit() {
loadingFunc(async() => {
const {ids = [], remark } = this.data;
const tenement = wx.getStorageSync('tenement')
const { code, message, data } = await makeInvoice({ ids, tenement: tenement.id, remark })
if (code !== OK) {
alertInfo(message)
return;
}
alertSuccess("操作成功")
setTimeout(() => {
wx.redirectTo({
url: '/pages/invoiceList/index?tab=1',
})
}, 500)
})
},
changeShow() {
this.setData({ show: true })
},
/**
* 生命周期函数--监听页面隐藏
*/

View File

@@ -1,7 +1,12 @@
{
"usingComponents": {
"navigator": "/components/navigator/index",
"van-button": "@vant/weapp/button/index"
"van-button": "@vant/weapp/button/index",
"card": "/components/card/index",
"van-radio": "@vant/weapp/radio/index",
"van-radio-group": "@vant/weapp/radio-group/index",
"van-field": "@vant/weapp/field/index",
"van-dialog": "@vant/weapp/dialog/index"
},
"navigationStyle": "custom"
}

View File

@@ -1,14 +1,140 @@
<!--pages/invoicing/index.wxml-->
<navigator title="1111" canBack="{{true}}" />
<navigator title="发票开具" canBack="{{true}}" />
<view class="info">
<view class="money"> 发票金额:<text class="moneyNumber"> {{money}} </text> </view>
<view class="money"> 发票金额:<text class="moneyNumber"> {{money}} </text> </view>
<view class="content">发票内容:<text class="contentText">电费</text> </view>
</view>
<view class="type"></view>
<view>
<card title="发票类型">
<van-radio-group disabled="{{true}}" direction="horizontal" slot="content" value="{{detail.type}}">
<van-radio name="{{0}}" icon-size="30rpx" style="font-size: 32rpx;margin-bottom: 20rpx;">普通发票</van-radio>
<van-radio name="{{1}}" icon-size="30rpx" style="font-size: 32rpx;">增值税专用发票</van-radio>
</van-radio-group>
</card>
</view>
<view class="cardWrapper">
<card title="发票详情">
<view slot="content">
<van-field
value="{{ detail.name }}"
label="抬头类型"
border="{{ false }}"
readonly
title-width="132rpx"
>
<view slot="input" style="margin-top: 16rpx;">
<van-radio-group disabled="{{true}}" direction="horizontal" value="{{detail.headerType}}">
<van-radio name="{{0}}" icon-size="30rpx" style="font-size: 30rpx;margin-bottom: 20rpx;">企业单位</van-radio>
<van-radio name="{{1}}" icon-size="30rpx" style="font-size: 30rpx;">个人/非企业单位</van-radio>
</van-radio-group>
</view>
</van-field>
<van-field
wx:if="{{detail.headerType === 0}}"
value="{{ detail.name }}"
label="发票抬头"
readonly
title-width="132rpx"
disabled="{{true}}"
/>
<van-field
value="{{ detail.tin }}"
wx:if="{{detail.headerType === 0}}"
label="发票税号"
readonly
title-width="132rpx"
disabled="{{true}}"
/>
<van-field
value="{{ detail.bank }}"
wx:if="{{detail.headerType === 0}}"
label="开户行"
readonly
title-width="132rpx"
disabled="{{true}}"
/>
<van-field
value="{{ detail.account }}"
wx:if="{{detail.headerType === 0}}"
label="银行账号"
readonly
title-width="132rpx"
disabled="{{true}}"
/>
<van-field
value="{{ detail.address }}"
wx:if="{{detail.headerType === 0}}"
label="地址"
readonly
title-width="132rpx"
disabled="{{true}}"
/>
<van-field
value="{{ detail.phone }}"
wx:if="{{detail.headerType === 0}}"
label="电话"
readonly
title-width="132rpx"
disabled="{{true}}"
/>
<van-field
value="{{ detail.remark }}"
label="备注说明"
title-width="132rpx"
bind:change="changeRemark"
/>
</view>
</card>
</view>
<view class="content">
</view>
<view class="submit">
<van-button type="info" block> 提交 </van-button>
</view>
<van-button type="info" block bind:click="changeShow"> 立即申请 </van-button>
</view>
<van-dialog
use-slot
title="确认开具"
show="{{ show }}"
show-cancel-button
bind:confirm="onSubmit"
>
<view class="modalContentWrapper">
<van-field
value="{{ tenementName }}"
label="发票抬头"
readonly
type="textarea"
autosize="{{true}}"
title-width="132rpx"
border="{{false}}"
/>
<van-field
value="{{ money }}"
label="发票金额"
readonly
title-width="132rpx"
border="{{false}}"
/>
<van-field
value="{{ detail.type === 0 ? '普通发票' : '增值税专用发票' }}"
label="发票类型"
readonly
title-width="132rpx"
border="{{false}}"
/>
<van-field
value="{{ detail.email }}"
label="邮箱地址"
readonly
title-width="132rpx"
type="textarea"
autosize="{{true}}"
border="{{false}}"
/>
</view>
</van-dialog>

View File

@@ -4,6 +4,7 @@
margin-left: 32rpx;
margin-right: 32rpx;
margin-bottom: 40rpx;
padding-bottom: 40rpx;
}
.info {
@@ -29,3 +30,15 @@
page {
background-color: var(--transparent-green);
}
.cardWrapper {
margin-top: 30rpx;
}
.van-cell {
padding-left: 0rpx !important;
padding-right: 0rpx !important;
}
.modalContentWrapper{
margin: 20rpx 30rpx;
}

View File

@@ -20,19 +20,19 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad() {
const user = wx.getStorageSync('user')
if (!user || !user.id) {
return;
}
// const user = wx.getStorageSync('user')
// if (!user || !user.id) {
// return;
// }
// if (user.status === 0 || user.status === 2) {
// wx.redirectTo({
// url: '/pages/waitApprove/index',
// })
// return
// }
wx.switchTab({
url: '/pages/home/index',
})
// wx.switchTab({
// url: '/pages/home/index',
// })
},
/**

View File

@@ -1,63 +0,0 @@
import { approveUser, getApproveList } from "../../../../service/user"
import { alertInfo, alertSuccess, wxModal } from "../../../../utils/index";
import request from "../../../../utils/request"
const { OK } = request;
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
list: []
},
lifetimes: {
attached: function() {
// this.setData({
// list: []
// })
this.init();
}
},
/**
* 组件的方法列表
*/
methods: {
async init() {
const result = await getApproveList()
this.setData({
list: result.data
})
},
async agree(e) {
const { user } = e.currentTarget.dataset;
await wxModal({ content: `同意${user.nickName}的申请?` })
const { code, message } = await approveUser({ userId: user.id, type: 1 })
if (code !== OK) {
alertInfo(message)
return;
}
alertSuccess("已同意")
this.init()
},
async disAgree(e) {
const { user } = e.currentTarget.dataset;
await wxModal({ content: `拒绝${user.nickName}的申请?` })
const { code, message } = await approveUser({ userId: user.id, type: 0 })
if (code !== OK) {
alertInfo(message)
return;
}
alertSuccess("已拒绝")
this.init()
}
}
})

View File

@@ -1,8 +0,0 @@
<!--pages/member/components/approveMember/index.wxml-->
<view wx:for="{{list}}" wx:key="index" wx:for-item="item" class="item">
<view class="nickName"> {{ item.nickName }} </view>
<view class="operate">
<view class="primaryTextBtn" data-user="{{item}}" bind:tap="agree"> 同意 </view>
<view class="disAgree dangerTextBtn" data-user="{{item}}" bind:tap="disAgree"> 拒绝 </view>
</view>
</view>

View File

@@ -1,21 +0,0 @@
/* pages/member/components/approveMember/index.wxss */
.item {
display: flex;
align-items: center;
padding-top: 24rpx;
padding-bottom: 24rpx;
margin-left: 32rpx;
margin-right: 32rpx;
}
.nickName {
flex: 1;
}
.operate {
display: flex;
}
.disAgree {
margin-left: 24rpx;
}

View File

@@ -1,8 +1,6 @@
{
"component": true,
"usingComponents": {
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index",
"avatar": "/components/avatar/index",
"van-button": "@vant/weapp/button/index"
}

View File

@@ -1,15 +1,13 @@
<van-tabs active="{{ active }}" bind:change="onChange">
<van-tab wx:for="{{list}}" wx:key="index" title="{{item.name}}">
<view wx:for="{{item.users}}" wx:key="index" wx:for-item="ele" class="item">
<view wx:for="{{list}}" wx:key="index" wx:for-item="ele" class="item">
<avatar text="{{ele.name}}" />
<view class="info">
<view class="nickName"> {{ ele.name }} </view>
<view class="phone"> {{ ele.phone }} </view>
</view>
<view class="operate">
<view class="operate" wx:if="{{!ele.isAdmin}}">
<van-button type="info" size="small" data-user="{{ele}}" bind:click="setAdmin" data-tenement="{{item.id}}" style="margin-bottom: 16rpx;" class="admin">设为管理员</van-button>
<van-button type="danger" size="small" data-user="{{ele}}" bind:click="remove" data-tenement="{{item.id}}" class="remove">移除</van-button>
</view>
</view>
</van-tab>
</van-tabs>

View File

@@ -2,7 +2,6 @@
"usingComponents": {
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index",
"approve-member": "./components/approveMember/index",
"member-manage": "./components/memberManage/index",
"navigator": "/components/navigator/index"
},

View File

@@ -1,7 +0,0 @@
{
"usingComponents": {
"navigator": "/components/navigator/index",
"scrollPageWrapper": "/components/scrollPageWrapper/index"
},
"navigationBarTitleText": "表计列表"
}

View File

@@ -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>

View File

@@ -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;
}

View File

@@ -1,6 +1,6 @@
import { alertInfo } from "../../utils/index";
import { alertInfo, alertSuccess } from "../../utils/index";
import Dialog from '@vant/weapp/dialog/dialog';
import { getUserInfo } from "../../service/user";
import { getUserInfo, logout } from "../../service/user";
import { getDot } from "../../utils/system";
import request from "../../utils/request"
const { OK } = request;
@@ -67,16 +67,37 @@ Page({
this.setData({ user: result.data })
wx.setStorageSync('user', result.data)
},
jumpToUpdateInvoice() {
wx.navigateTo({
url: '/pages/invoiceList/index?tab=2',
})
},
async getUnReadNumber() {
const dot = await getDot();
this.setData({
dot
})
},
logout() {
wx.clearStorageSync()
wx.switchTab({
url: '/pages/home/index',
async logout() {
Dialog.alert({
title: '提示',
message: '确认退出登录?',
showCancelButton: true,
}).then(async () => {
const { code, message } = await logout()
if (code !== OK) {
alertInfo(message)
return;
}
wx.clearStorageSync()
wx.switchTab({
url: '/pages/home/index',
})
});
},
jumpToQuestions() {
wx.navigateTo({
url: '/pages/questions/index',
})
},
bindTenement() {

View File

@@ -4,7 +4,9 @@
"van-cell-group": "@vant/weapp/cell-group/index",
"cell": "/components/cell/index",
"van-dialog": "@vant/weapp/dialog/index",
"dot": "/components/dot/index"
"dot": "/components/dot/index",
"navigator": "/components/navigator/index"
},
"navigationBarTitleText": "我的"
"navigationBarTitleText": "我的",
"navigationStyle": "custom"
}

View File

@@ -4,19 +4,21 @@
<cell title="常见问题" bind:click="jumpToQuestions" /> -->
<!-- <van-cell-group title=" "> -->
<van-cell title="联系客服" value="" is-link bind:tap="connect" />
<van-cell wx:if="{{!!user.isAdmin}}" title="二维码" value="" is-link bind:click="jumpToQrCode" />
<van-cell wx:if="{{!!user.isAdmin}}" is-link bind:click="jumpToMember">
<view slot="title">
<view class="cellWrapper">
<view class="text"> 成员管理 </view>
<dot wx:if="{{dot > 0}}" number="{{dot}}" />
</view>
<navigator title="我的" />
<van-cell title="联系客服" value="" is-link bind:tap="connect" />
<van-cell wx:if="{{!!user.isAdmin}}" title="二维码" value="" is-link bind:click="jumpToQrCode" />
<van-cell wx:if="{{!!user.isAdmin}}" is-link bind:click="jumpToMember">
<view slot="title">
<view class="cellWrapper">
<view class="text"> 成员管理 </view>
<dot wx:if="{{dot > 0}}" number="{{dot}}" />
</view>
</van-cell>
<van-cell title="绑定企业" value="" is-link bind:tap="bindTenement" />
<van-cell title="退出登录" value="" is-link bind:tap="logout" />
</view>
</van-cell>
<van-cell title="发票抬头" value="" is-link bind:tap="jumpToUpdateInvoice" />
<van-cell title="绑定企业" value="" is-link bind:tap="bindTenement" />
<!-- <van-cell title="常见问题" value="" is-link bind:tap="jumpToQuestions" /> -->
<van-cell title="退出登录" value="" is-link bind:tap="logout" />
<!-- </van-cell-group> -->
<!-- <van-cell-group title=" ">
<van-cell title="单元格" value="内容" is-link />

View File

@@ -11,16 +11,21 @@ Page({
* 页面的初始数据
*/
data: {
list: [],
urls: [],
indexs: [],
// list: [],
// urls: [],
// indexs: [],
url: "",
tenement: ""
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getList()
// this.getList()
loadingFunc(async () => {
await this.getCode()
})
},
async getList() {
const { code, message, data } = await getOwnTenementList()
@@ -37,21 +42,26 @@ Page({
list: [...tenements]
})
},
async getCode(e, that) {
const { index, id } = e.currentTarget.dataset;
const { code, message, data } = await getWxCode(id)
async getCode() {
// const { index, id } = e.currentTarget.dataset;
const tenement = wx.getStorageSync('tenement');
const { code, message, data } = await getWxCode(tenement.id)
if (code !== OK) {
alertInfo(message)
return;
}
const newUrls = that.data.urls;
newUrls[index] = data;
const newIndexs = that.data.indexs;
newIndexs[index] = true;
that.setData({
urls: newUrls,
indexs: newIndexs,
this.setData({
url: data,
tenement: tenement
})
// const newUrls = that.data.urls;
// newUrls[index] = data;
// const newIndexs = that.data.indexs;
// newIndexs[index] = true;
// that.setData({
// urls: newUrls,
// indexs: newIndexs,
// })
},
look(e) {
const that = this;

View File

@@ -1,7 +1,9 @@
{
"usingComponents": {
"van-image": "@vant/weapp/image/index"
"van-image": "@vant/weapp/image/index",
"navigator": "/components/navigator/index"
},
"navigationBarTitleText": "二维码"
"navigationBarTitleText": "二维码",
"navigationStyle": "custom"
}

View File

@@ -1,12 +1,18 @@
<!--pages/qrCode/index.wxml-->
<view class="wrapper">
<!-- <view class="wrapper">
<view class="item" wx:for="{{list}}" wx:key="index">
<view class="tenement" >
<view class="name">{{item.name}}</view>
<view class="primaryTextBtn" data-index="{{index}}" data-id="{{item.id}}" bind:tap="look"> 查看二维码 </view>
</view>
<view class="image" wx:if="{{indexs[index] == true}}">
<van-image width="400rpx" height="400rpx" src="{{urls[index]}}" />
</view>
</view>
</view>
</view> -->
<navigator title="二维码" canBack="{{true}}" />
<view class="wrapper">
<view class="image">
<van-image width="400rpx" height="400rpx" src="{{url}}" />
</view>
<view style="padding-bottom: 100rpx;margin-left: 40rpx;margin-right: 40rpx;"> 扫描该二维码可进入{{tenement.name}} </view>
</view>

View File

@@ -1,12 +1,9 @@
/* pages/qrCode/index.wxss */
.wrapper {
/* width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column; */
/* margin-top: 20rpx; */
flex-direction: column;
margin-left: 32rpx;
margin-right: 32rpx;
}
@@ -23,7 +20,6 @@
.tenement {
display: flex;
align-items: center;
}
.name {
@@ -31,7 +27,8 @@
}
.image {
margin: 50rpx 0;
margin: 50rpx 40rpx;
display: flex;
justify-content: center;
margin-top: 10vh;
}

Some files were not shown because too many files have changed in this diff Show More