mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-02-23 21:36:38 +08:00
优化代码
This commit is contained in:
parent
8497799861
commit
00637f2393
@ -104,4 +104,30 @@ export function getRoomOweFees(_objData) {
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询优惠信息
|
||||
* @param {Object} _objData 费用
|
||||
*/
|
||||
export function getFeeDiscounts(_objData) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: url.computeFeeDiscount,
|
||||
method: "GET",
|
||||
data: _objData, //动态数据
|
||||
success: function(res) {
|
||||
if (res.statusCode == 200) {
|
||||
//成功情况下跳转
|
||||
let _feeDiscounts = res.data.data;
|
||||
resolve(_feeDiscounts);
|
||||
return;
|
||||
}
|
||||
reject();
|
||||
},
|
||||
fail: function(e) {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
@ -48,7 +48,7 @@ export function getCategoryList() {
|
||||
pageone: [{
|
||||
name: "物业费",
|
||||
src: "/static/images/index_property.png",
|
||||
href: "/pages/roomFeeList/roomFeeList"
|
||||
href: "/pages/roomFeeListNew/roomFeeListNew"
|
||||
}, {
|
||||
name: "停车费",
|
||||
src: "/static/images/index_park.png",
|
||||
|
||||
82
components/vc-discount/vc-discount.vue
Normal file
82
components/vc-discount/vc-discount.vue
Normal file
@ -0,0 +1,82 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="cu-list menu" v-if="discounts.length > 0" v-for="(discount, idx) in discounts" :key="idx" :data-item="discount"
|
||||
@click="_viewDiscountDetail(discount)">
|
||||
<view class="cu-item arrow">
|
||||
<view class="content padding-tb-sm">
|
||||
<view>
|
||||
<view class="text-cut" style="width:220px">{{discount.discountName}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="action">
|
||||
<text class="text-grey text-sm">{{discount.discountPrice}}元</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getFeeDiscounts
|
||||
} from '../../api/fee/feeApi.js'
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
discounts: []
|
||||
};
|
||||
},
|
||||
props: {
|
||||
feeId: {
|
||||
//是否开启绝对定位。
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
communityId: {
|
||||
//是否开启绝对定位。
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
cycles: {
|
||||
type: String,
|
||||
default: 1
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
_loadFeeDiscount: function(_feeId, _communityId, _feeMonth) {
|
||||
let _that = this;
|
||||
getFeeDiscounts({
|
||||
page: 1,
|
||||
row: 20,
|
||||
feeId: _feeId,
|
||||
communityId: _communityId,
|
||||
cycles: _feeMonth
|
||||
}).then((data) => {
|
||||
_that.discounts = data;
|
||||
|
||||
let _totalDiscountMoney = 0.0;
|
||||
let _selectDiscount = [];
|
||||
_that.discounts.forEach(disItem => {
|
||||
//disItem.discountPrice = Math.floor(disItem.discountPrice);
|
||||
_totalDiscountMoney += parseFloat(disItem.discountPrice);
|
||||
_selectDiscount.push(disItem);
|
||||
})
|
||||
|
||||
if(_totalDiscountMoney > 0){
|
||||
_that.$emit('computeFeeDiscount',_totalDiscountMoney)
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
_viewDiscountDetail: function(_discount) {
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
||||
@ -80,7 +80,7 @@
|
||||
<script>
|
||||
var timer = null;
|
||||
export default {
|
||||
name: 'shPrice',
|
||||
name: 'vcPrice',
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
|
||||
@ -101,6 +101,7 @@ export default {
|
||||
deleteUserAddress: baseUrl + 'app/userAddress/deleteUserAddress',
|
||||
goodsUnifieldOrder: baseUrl + 'goods/unifieldOrder',
|
||||
deleteOwner: baseUrl + "/app/owner.deleteOwner",
|
||||
computeFeeDiscount: baseUrl + "/app/feeDiscount/computeFeeDiscount",
|
||||
|
||||
NEED_NOT_LOGIN_PAGE: [
|
||||
'/pages/login/login',
|
||||
|
||||
@ -195,6 +195,12 @@
|
||||
"navigationBarTitleText": "物业费"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/roomFeeListNew/roomFeeListNew",
|
||||
"style": {
|
||||
"navigationBarTitleText": "物业费"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/roomFee/roomFee",
|
||||
"style": {
|
||||
|
||||
@ -13,34 +13,10 @@
|
||||
</view>
|
||||
<view class="cu-item">
|
||||
<view class="content">
|
||||
<text class="text-grey">楼栋编号</text>
|
||||
<text class="text-grey">房屋</text>
|
||||
</view>
|
||||
<view class="action">
|
||||
<text class="text-grey text-sm">{{floorNum + '号楼'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-item">
|
||||
<view class="content">
|
||||
<text class="text-grey">单元编号</text>
|
||||
</view>
|
||||
<view class="action">
|
||||
<text class="text-grey text-sm">{{unitNum + '单元'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-item">
|
||||
<view class="content">
|
||||
<text class="text-grey">房屋编号</text>
|
||||
</view>
|
||||
<view class="action">
|
||||
<text class="text-grey text-sm">{{roomNum + '室'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-item">
|
||||
<view class="content">
|
||||
<text class="text-grey">房屋楼层</text>
|
||||
</view>
|
||||
<view class="action">
|
||||
<text class="text-grey text-sm">{{layer + '层'}}</text>
|
||||
<text class="text-grey text-sm">{{floorNum + '号楼'+unitNum+ '单元'+roomNum + '室'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-item">
|
||||
@ -98,8 +74,9 @@
|
||||
<text class="text-grey text-sm">{{endTime }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<vc-discount ref="vcDiscountRef" @computeFeeDiscount="computeFeeDiscount" :feeId="feeId" :cycles="feeMonth" :communityId="communityId"></vc-discount>
|
||||
</view>
|
||||
|
||||
</scroll-view>
|
||||
<view class=" bg-white border flex justify-end" style="position: fixed;width: 100%;bottom: 0;">
|
||||
|
||||
@ -126,6 +103,8 @@
|
||||
// pages/payParkingFee/payParkingFee.js
|
||||
const context = require("../../context/Java110Context.js");
|
||||
const constant = context.constant;
|
||||
|
||||
import vcDiscount from '@/components/vc-discount/vc-discount.vue'
|
||||
|
||||
|
||||
// #ifdef H5
|
||||
@ -140,6 +119,9 @@
|
||||
|
||||
import {addMonth,formatDate} from '../../utils/DateUtil.js'
|
||||
export default {
|
||||
components:{
|
||||
vcDiscount
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
date: '2018-12-25',
|
||||
@ -171,6 +153,7 @@
|
||||
paymentCycle:1,
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
@ -212,8 +195,13 @@
|
||||
this.feeMonth = this.paymentCycle;
|
||||
let _endTime = addMonth(_lastDate, parseInt(this.feeMonth));
|
||||
this.endTime = formatDate(_endTime);
|
||||
|
||||
this.$refs.vcDiscountRef._loadFeeDiscount(this.feeId,this.communityId,this.feeMonth);
|
||||
},
|
||||
methods: {
|
||||
computeFeeDiscount:function(_price){
|
||||
this.receivableAmount = this.receivableAmount - _price;
|
||||
},
|
||||
dateChange: function(e) {
|
||||
console.log("onConfirm", e);
|
||||
let _feeMonthName = null;
|
||||
@ -227,6 +215,7 @@
|
||||
this.receivableAmount = _receivableAmount;
|
||||
this.feeMonth = _feeMonth;
|
||||
this.endTime = formatDate(_newDate);
|
||||
this.$refs.vcDiscountRef._loadFeeDiscount(this.feeId,this.communityId,this.feeMonth);
|
||||
},
|
||||
onFeeMonthChange: function(e) {
|
||||
console.log(e);
|
||||
|
||||
33
pages/roomFeeListNew/roomFeeListNew.css
Normal file
33
pages/roomFeeListNew/roomFeeListNew.css
Normal file
@ -0,0 +1,33 @@
|
||||
.ppfl_footer{
|
||||
text-align: right;
|
||||
}
|
||||
.ppfl_footer .ppfl_footer_his{
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.ppfl_c{
|
||||
padding: 0rpx 20rpx 20rpx 20rpx;
|
||||
}
|
||||
|
||||
.block__title {
|
||||
margin: 0;
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
color: rgba(69,90,100,.6);
|
||||
padding: 40rpx 30rpx 20rpx;
|
||||
}
|
||||
|
||||
.ppfl_context{
|
||||
padding: 20rpx 40rpx 40rpx 40rpx;
|
||||
font-size: 28rpx;
|
||||
color: #8a8a8a;
|
||||
}
|
||||
|
||||
.ppfl_context .ppfl_context_row{
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
|
||||
.button_up_blank{
|
||||
height: 40rpx;
|
||||
}
|
||||
207
pages/roomFeeListNew/roomFeeListNew.vue
Normal file
207
pages/roomFeeListNew/roomFeeListNew.vue
Normal file
@ -0,0 +1,207 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="header_fixed">
|
||||
<scroll-view v-if="rooms.length <5 && rooms.length >1" class="bg-white nav">
|
||||
<view class="flex text-center">
|
||||
<view class="cu-item flex-sub" :class="item.roomId==curRoom.roomId?'text-green cur':''" v-for="(item,index) in rooms"
|
||||
:key="index" @tap="switchRoom(item)" :data-id="index">
|
||||
{{item.floorNum}}栋{{item.roomNum}}室
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<scroll-view v-if="rooms.length >4" scroll-x class="bg-white nav" scroll-with-animation scroll-left="true">
|
||||
<view class="cu-item flex-sub" :class="item.roomId==curRoom.roomId?'text-green cur':''" v-for="(item,index) in rooms"
|
||||
:key="index" @tap="switchRoom(item)" :data-id="index">
|
||||
{{item.floorNum}}栋{{item.roomNum}}室
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view v-if="rooms.length == 1" class="block__title">{{rooms[0].floorNum}}栋{{rooms[0].roomNum}}室</view>
|
||||
<view v-if="rooms.length > 1" class="margin-header-top"></view>
|
||||
<view v-if="noData == false">
|
||||
<view class="cu-list menu" v-if="moreRooms.length > 0" v-for="(fee, idx) in moreRooms" :key="idx" :data-item="fee"
|
||||
@click="payFee(fee)">
|
||||
<view class="cu-item arrow">
|
||||
<view class="content padding-tb-sm">
|
||||
<view>
|
||||
<view class="text-cut" style="width:220px">{{fee.feeName}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<no-data-page></no-data-page>
|
||||
</view>
|
||||
<view class=" bg-white border flex justify-end" style="position: fixed;width: 100%; bottom: 0;">
|
||||
<view class="btn-group line-height">
|
||||
<button class="cu-btn bg-red shadow-blur lgplus sharp" @click="toRoomOweFee()">欠费缴费</button>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// pages/payParkingFeeList/payParkingFeeList.js
|
||||
const context = require("../../context/Java110Context.js");
|
||||
const constant = context.constant;
|
||||
import noDataPage from '@/components/no-data-page/no-data-page.vue'
|
||||
|
||||
import {
|
||||
getRooms
|
||||
} from '../../api/room/roomApi.js'
|
||||
|
||||
import {
|
||||
getRoomFees
|
||||
} from '../../api/fee/feeApi.js'
|
||||
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
rooms: [],
|
||||
curRoom: {},
|
||||
moreRooms: [],
|
||||
needFefresh: true,
|
||||
noData: false
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
noDataPage
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function(options) {
|
||||
context.onLoad(options);
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function() {
|
||||
let _that = this;
|
||||
if (!this.needFefresh) {
|
||||
this.needFefresh = true;
|
||||
return;
|
||||
}
|
||||
this.noData = false;
|
||||
getRooms().then(data => {
|
||||
let _rooms = data.rooms;
|
||||
this.rooms = _rooms;
|
||||
let _owner = data.owner;
|
||||
_that.moreRooms = [];
|
||||
if (_rooms.length == 0) {
|
||||
_that.noData = true;
|
||||
return;
|
||||
}
|
||||
_rooms.forEach(function(_room) {
|
||||
_room.communityId = _owner.communityId;
|
||||
_room.communityName = _owner.communityName;
|
||||
});
|
||||
_that.curRoom = _rooms[0];
|
||||
_that._loadRoomFee();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
payFee: function(_item) {
|
||||
wx.navigateTo({
|
||||
url: '/pages/roomFee/roomFee?fee=' + JSON.stringify(_item),
|
||||
})
|
||||
},
|
||||
_loadRoomFee: function() {
|
||||
let _that = this;
|
||||
let _room = this.curRoom;
|
||||
let _objData = {
|
||||
page: 1,
|
||||
row: 30,
|
||||
payerObjId: _room.roomId,
|
||||
communityId: _room.communityId,
|
||||
state: '2008001'
|
||||
}
|
||||
_that.moreRooms = [];
|
||||
getRoomFees(_objData, _room)
|
||||
.then((moreRooms) => {
|
||||
_that.moreRooms = moreRooms;
|
||||
_that.noData = false;
|
||||
}, () => {
|
||||
_that.noData = true;
|
||||
})
|
||||
|
||||
},
|
||||
payFeeDetail: function(_item) {
|
||||
wx.navigateTo({
|
||||
url: '/pages/payFeeDetail/payFeeDetail?fee=' + JSON.stringify(_item),
|
||||
});
|
||||
},
|
||||
switchRoom: function(_room) {
|
||||
this.curRoom = _room;
|
||||
this.noData = false;
|
||||
this._loadRoomFee();
|
||||
},
|
||||
toRoomOweFee:function(){
|
||||
if(this.vc.isEmpty(this.curRoom.roomId)){
|
||||
uni.showToast({
|
||||
icon:'none',
|
||||
title:'没有房屋'
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.vc.navigateTo({
|
||||
url:'/pages/roomOweFee/roomOweFee?roomId='+this.curRoom.roomId
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import "./roomFeeListNew.css";
|
||||
|
||||
.solid-bottom::after {
|
||||
border-bottom: 2upx solid rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.solid-top::after {
|
||||
border-top: 2upx solid rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.margin-header-top {
|
||||
height: 100upx;
|
||||
}
|
||||
|
||||
/* #ifdef APP-PLUS || MP-WEIXIN */
|
||||
.header_fixed {
|
||||
position: fixed;
|
||||
top: 0upx;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
/* #ifdef H5 */
|
||||
.header_fixed {
|
||||
position: fixed;
|
||||
top: 80upx;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
.cu-btn.lgplus {
|
||||
padding: 0 20px;
|
||||
font-size: 18px;
|
||||
height: 100upx;
|
||||
|
||||
}
|
||||
|
||||
.cu-btn.sharp {
|
||||
border-radius: 0upx;
|
||||
}
|
||||
|
||||
.line-height {
|
||||
line-height: 100upx;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user