This commit is contained in:
石磊 2020-01-08 12:05:05 +08:00
commit 679e1be439
4 changed files with 63 additions and 36 deletions

View File

@ -1,4 +1,9 @@
// pages/payParkingFee/payParkingFee.js
const context = require('../../context/Java110Context.js');
const constant = context.constant;
const util = context.util;
Page({
/**
@ -9,7 +14,9 @@ Page({
feeMonthList:['一个月','半年','一年','两年'],
feeMonthName:'一个月',
feeMonth:1,
endTime:'2020-01-07'
endTime:'2020-01-07',
amount:80,
receivableAmount:0.00
},
@ -17,7 +24,10 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let _receivableAmount = this.data.feeMonth * this.data.amount * 100;
this.setData({
receivableAmount: _receivableAmount
})
},
/**
@ -77,10 +87,30 @@ Page({
console.log("onConfirm", e);
let _feeMonthName = null;
_feeMonthName = e.detail.value;
let _feeMonth = 1;
if (_feeMonthName == '一个月'){
_feeMonth = 1;
} else if (_feeMonthName == '半年'){
_feeMonth = 6;
} else if (_feeMonthName == '一年') {
_feeMonth = 12;
} else if (_feeMonthName == '两年') {
_feeMonth = 24;
}else{
return ;
}
let _receivableAmount = _feeMonth * this.data.amount * 100;
// let _lastDate = util.date.getDate(this.data.endTime);
// let _newDate = util.date.addMonth(_lastDate, _feeMonth);
this.setData({
showFeeMonth: false,
feeMonthName: _feeMonthName
feeMonthName: _feeMonthName,
receivableAmount: _receivableAmount,
feeMonth: _feeMonth,
// endTime: util.date.formatTime(_newDate)
});
},
onFeeMonthChange: function (e) {

View File

@ -1,50 +1,26 @@
<view>
<view class="ppf_c">
<view class="block__title">车位信息</view>
<view class="ppf_item">
<van-cell-group>
<van-cell title="小区" value="格兰小镇" />
</van-cell-group>
</view>
<view class="ppf_item">
<van-cell-group>
<van-cell title="车位编号" value="6号车位" />
</van-cell-group>
</view>
<view class="ppf_item">
<van-cell-group>
<van-cell title="车位类型" value="地上停车位" />
</van-cell-group>
</view>
<view class="ppf_item">
<van-cell-group>
<van-cell title="车牌号" value="青AGK916" />
</van-cell-group>
</view>
<view class="block__title">费用信息</view>
<view class="ppf_item">
<van-cell-group>
<van-cell title="费用编号" value="902019103018590010" />
</van-cell-group>
</view>
<view class="ppf_item">
<van-cell-group>
<van-cell title="金额" value="80元/月" bind:click="chooseMonth" is-link/>
</van-cell-group>
</view>
<view class="ppf_item">
<van-cell-group>
<van-cell title="金额" value="{{amount}}元/月"/>
<van-cell title="周期" value="{{feeMonthName}}" bind:click="chooseMonth" is-link/>
</van-cell-group>
</view>
<view class="ppf_item">
<van-cell-group>
<van-cell title="到期时间" value="{{endTime}}" />
</van-cell-group>
</view>
</view>
<van-submit-bar price="{{ 3050 }}" button-text="提交订单" bind:submit="onPayFee" />
<van-submit-bar price="{{ receivableAmount }}" button-text="提交订单" bind:submit="onPayFee" />
<van-popup show="{{ showFeeMonth }}" position="bottom" custom-style="height: 40%;">

View File

@ -1,6 +1,16 @@
.ppf_c{
padding-top: 20rpx;
}
.ppf_item{
padding: 10rpx 0rpx 0rpx 0rpx;
padding: 0rpx 0rpx 0rpx 0rpx;
}
.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;
}

View File

@ -22,6 +22,16 @@ const formatTime = date => {
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}
//字符串转日期格式strDate要转为日期格式的字符串
const getDate = function getDate(strDate) {
var st = strDate;
var a = st.split(" "); //这个根据你的字符串决定如果中间为T则改T
var b = a[0].split("-");
var c = a[1].split(":");
var date = new Date(b[0], b[1], b[2], c[0], c[1], c[2]);
return date;
}
/**
* @desc: 格式化数字
@ -141,5 +151,6 @@ module.exports = {
addDay: addDay,
addHour: addHour,
addMinutes: addMinutes,
addSeconds: addSeconds
addSeconds: addSeconds,
getDate: getDate
}