mirror of
https://gitee.com/java110/PropertyApp.git
synced 2026-02-23 21:36:39 +08:00
优化二维码抄表功能
This commit is contained in:
parent
2e2bc2e5eb
commit
40344013b3
@ -95,11 +95,16 @@ export function queryPreMeterWater(_that, _data){
|
||||
* 提交抄表
|
||||
*/
|
||||
export function saveMeterWater(_that, _data){
|
||||
uni.showLoading({
|
||||
title: '正在提交',
|
||||
mask: true // Set to true if you want to prevent user interactions while loading
|
||||
});
|
||||
return new Promise(function(reslove,reject){
|
||||
_that.context.post({
|
||||
url: url.saveMeterWater,
|
||||
data:_data,
|
||||
success: function(res) {
|
||||
uni.hideLoading();
|
||||
if(res.statusCode == 200){
|
||||
reslove(res.data);
|
||||
}else{
|
||||
@ -112,6 +117,7 @@ export function saveMeterWater(_that, _data){
|
||||
}
|
||||
},
|
||||
fail: function(e) {
|
||||
uni.hideLoading();
|
||||
_that.onoff = true;
|
||||
wx.showToast({
|
||||
title: "服务器异常了",
|
||||
|
||||
@ -87,12 +87,12 @@
|
||||
"disableHostCheck" : true,
|
||||
"proxy" : {
|
||||
"/app" : {
|
||||
"target" : "http://192.168.100.108:8088", //目标接口域名http://192.168.1.16:8012
|
||||
"target" : "http://127.0.0.1:8008", //目标接口域名http://192.168.1.16:8012
|
||||
"changeOrigin" : true, //是否跨域
|
||||
"secure" : true // 设置支持https协议的代理
|
||||
},
|
||||
"/callComponent" : {
|
||||
"target" : "http://192.168.100.108:8088", //目标接口域名http://192.168.1.16:8012
|
||||
"target" : "http://127.0.0.1:8008", //目标接口域名http://192.168.1.16:8012
|
||||
"changeOrigin" : true, //是否跨域
|
||||
"secure" : true // 设置支持https协议的代理
|
||||
}
|
||||
|
||||
11
pages.json
11
pages.json
@ -227,13 +227,13 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/meterReading/meterReading",
|
||||
"path": "pages/meter/meterReading",
|
||||
"style": {
|
||||
"navigationBarTitleText": "水电抄表"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/addmeter/addmeter",
|
||||
"path": "pages/meter/addmeter",
|
||||
"style": {
|
||||
"navigationBarTitleText": "抄表"
|
||||
}
|
||||
@ -891,6 +891,13 @@
|
||||
"navigationBarTitleText" : "",
|
||||
"enablePullDownRefresh" : false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/meter/qrcodeMeter",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "二维码抄表"
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
|
||||
@ -109,7 +109,7 @@
|
||||
},
|
||||
_addMeter:function(){
|
||||
uni.navigateTo({
|
||||
url:'/pages/addmeter/addmeter'
|
||||
url:'/pages/meter/addmeter'
|
||||
});
|
||||
}
|
||||
|
||||
@ -135,6 +135,6 @@
|
||||
margin-top: -14px;
|
||||
}
|
||||
.mytop{
|
||||
padding-top: 35px;
|
||||
padding-top: 45px;
|
||||
}
|
||||
</style>
|
||||
186
pages/meter/qrcodeMeter.vue
Normal file
186
pages/meter/qrcodeMeter.vue
Normal file
@ -0,0 +1,186 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
<view class="block__title">上期抄表</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="title">上期度数</view>
|
||||
<input placeholder="上期度数" v-model="preDegrees" ></input>
|
||||
</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="title">抄表时间</view>
|
||||
<uni-datetime-picker v-model="preReadingTime" :disabled="true"></uni-datetime-picker>
|
||||
</view>
|
||||
<view class="block__title">本期抄表</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="title">本期度数</view>
|
||||
<input placeholder="本期度数" v-model="curDegrees"></input>
|
||||
</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="title">抄表时间</view>
|
||||
<uni-datetime-picker v-model="curReadingTime"></uni-datetime-picker>
|
||||
</view>
|
||||
|
||||
<view class="cu-form-group align-start">
|
||||
<view class="title">备注</view>
|
||||
<textarea maxlength="-1" v-model="remark" placeholder="备注信息"></textarea>
|
||||
</view>
|
||||
|
||||
<view class=" flex flex-direction">
|
||||
<button class="cu-btn bg-red margin-tb-sm lg" @tap="$preventClick(submitMeter)">提交</button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {queryFeeTypesItems,queryPreMeterWater,saveMeterWater,listMeterType} from '../../api/meter/meter.js'
|
||||
import dateObj from '../../lib/java110/utils/date.js'
|
||||
import uniDatetimePicker from '../../components/uni-datetime-picker/uni-datetime-picker.vue'
|
||||
import {getCurrentCommunity} from '../../api/community/community.js'
|
||||
// 防止多次点击
|
||||
import {preventClick} from '../../lib/java110/utils/common.js';
|
||||
import Vue from 'vue'
|
||||
Vue.prototype.$preventClick = preventClick;
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
onoff: true,
|
||||
roomNum: '',
|
||||
communityId: '',
|
||||
objType: '3333',
|
||||
preDegrees: 0,
|
||||
preReadingTime: null,
|
||||
curDegrees: '',
|
||||
curReadingTime: null,
|
||||
remark: '',
|
||||
};
|
||||
},
|
||||
components:{
|
||||
uniDatetimePicker
|
||||
},
|
||||
|
||||
onLoad(options){
|
||||
this.configId = options.configId;
|
||||
this.meterType = options.meterType;
|
||||
this.roomId = options.roomId;
|
||||
this.communityId = options.communityId;
|
||||
this.java110Context.onLoad();
|
||||
this.preReadingTime = dateObj.getCurrentDateTime();
|
||||
this.curReadingTime = dateObj.getCurrentDateTime();
|
||||
|
||||
this._queryPreMeterWater();
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
// 查询上期缴费信息
|
||||
_queryPreMeterWater(){
|
||||
let _objData = {
|
||||
communityId: this.communityId,
|
||||
objId: this.roomId,
|
||||
objType: this.objType,
|
||||
meterType: this.meterType,
|
||||
};
|
||||
queryPreMeterWater(this,_objData)
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
if(res.total < 1){
|
||||
this.preDegrees = 0;
|
||||
return;
|
||||
}
|
||||
this.preDegrees = res.data[0].curDegrees;
|
||||
this.preReadingTime = res.data[0].curReadingTime;
|
||||
})
|
||||
},
|
||||
|
||||
submitMeter(){
|
||||
let msg = '';
|
||||
if(this.roomId == ''){
|
||||
msg = "请选择房屋";
|
||||
}else if(this.preDegrees === '' || this.preDegrees < 0){
|
||||
msg = "上期度数必填";
|
||||
}else if(this.preReadingTime == '' || this.preReadingTime == null){
|
||||
msg = "上期读表时间必填";
|
||||
}else if(this.curDegrees === '' || this.curDegrees < 0){
|
||||
msg = "本期度数必填";
|
||||
}else if(this.curReadingTime == '' || this.curReadingTime == null){
|
||||
msg = "本期读表时间必填";
|
||||
}else if(parseFloat(this.curDegrees) < parseFloat(this.preDegrees)){
|
||||
msg = "本期度数不能小于上期度数";
|
||||
}else{
|
||||
let start = Date.parse(new Date(this.preReadingTime.replace(/-/g, '/')))
|
||||
let end = Date.parse(new Date(this.curReadingTime.replace(/-/g, '/')))
|
||||
if (end == 0 || start - end > 0) {
|
||||
msg = "本期读表时间有误";
|
||||
}
|
||||
}
|
||||
|
||||
if(msg != ''){
|
||||
uni.showToast({
|
||||
title:msg,
|
||||
icon:'none'
|
||||
})
|
||||
this.onoff = true;
|
||||
return;
|
||||
}
|
||||
let _objData = {
|
||||
communityId: this.communityId,
|
||||
configId: this.configId,
|
||||
curDegrees: this.curDegrees,
|
||||
curReadingTime: this.curReadingTime,
|
||||
preDegrees: this.preDegrees,
|
||||
preReadingTime: this.preReadingTime,
|
||||
objId: this.roomId,
|
||||
roomId: this.roomId,
|
||||
objType: this.objType,
|
||||
remark: this.remark,
|
||||
meterType: this.meterType
|
||||
};
|
||||
saveMeterWater(this,_objData)
|
||||
.then((res) => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
duration: 1500
|
||||
})
|
||||
if(res.code == 0){
|
||||
setTimeout(() => {
|
||||
this.onoff = true;
|
||||
this.clearAddMeterWaterInfo();
|
||||
}, 1500)
|
||||
}else{
|
||||
this.onoff = true;
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 清空页面数据
|
||||
clearAddMeterWaterInfo(){
|
||||
uni.navigateTo({
|
||||
url:'/pages/meter/meterReading'
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.cu-form-group .title {
|
||||
min-width: calc(6em + 15px);
|
||||
}
|
||||
|
||||
.block__title {
|
||||
margin: 0;
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
color: rgba(69, 90, 100, .6);
|
||||
padding: 40rpx 30rpx 20rpx;
|
||||
}
|
||||
|
||||
.button_up_blank {
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.block__bottom {
|
||||
height: 180rpx;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user