mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-06-12 10:00:57 +08:00
优化代码
This commit is contained in:
parent
e15bcdfb40
commit
27edc8e081
@ -109,7 +109,10 @@
|
|||||||
// pages/payParkingFee/payParkingFee.js
|
// pages/payParkingFee/payParkingFee.js
|
||||||
const context = require("../../context/Java110Context.js");
|
const context = require("../../context/Java110Context.js");
|
||||||
const constant = context.constant;
|
const constant = context.constant;
|
||||||
import {addMonth,formatDate} from '../../utils/DateUtil.js'
|
import {
|
||||||
|
addMonth,
|
||||||
|
formatDate
|
||||||
|
} from '../../utils/DateUtil.js'
|
||||||
|
|
||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
@ -130,16 +133,16 @@
|
|||||||
amount: 0,
|
amount: 0,
|
||||||
receivableAmount: 0.00,
|
receivableAmount: 0.00,
|
||||||
additionalAmount: 0,
|
additionalAmount: 0,
|
||||||
num:'',
|
num: '',
|
||||||
feeTypeCdName:'',
|
feeTypeCdName: '',
|
||||||
carNum:'',
|
carNum: '',
|
||||||
feePrice: 0.00,
|
feePrice: 0.00,
|
||||||
communityId: '',
|
communityId: '',
|
||||||
communityName: '',
|
communityName: '',
|
||||||
feeId: '',
|
feeId: '',
|
||||||
appId:'',
|
appId: '',
|
||||||
feeFlag:'',
|
feeFlag: '',
|
||||||
paymentCycle:1,
|
paymentCycle: 1,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -154,14 +157,14 @@
|
|||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
this.appId = uni.getStorageSync(constant.mapping.W_APP_ID)
|
this.appId = uni.getStorageSync(constant.mapping.W_APP_ID)
|
||||||
// #endif
|
// #endif
|
||||||
let _fee = JSON.parse(options.fee);
|
let _fee = JSON.parse(options.fee);
|
||||||
let _receivableAmount = _fee.paymentCycle * _fee.feePrice;
|
let _receivableAmount = _fee.paymentCycle * _fee.feePrice;
|
||||||
|
|
||||||
let _communityInfo = context.getCurrentCommunity();
|
let _communityInfo = context.getCurrentCommunity();
|
||||||
let _lastDate = new Date(_fee.endTime);
|
let _lastDate = new Date(_fee.endTime);
|
||||||
let _endTime = addMonth(_lastDate, this.feeMonth);
|
|
||||||
|
|
||||||
this.receivableAmount = _receivableAmount;
|
this.receivableAmount = _receivableAmount;
|
||||||
this.communityId = _communityInfo.communityId;
|
this.communityId = _communityInfo.communityId;
|
||||||
@ -171,10 +174,10 @@
|
|||||||
this.carNum = _fee.carNum;
|
this.carNum = _fee.carNum;
|
||||||
this.feeId = _fee.feeId;
|
this.feeId = _fee.feeId;
|
||||||
this.feePrice = _fee.feePrice;
|
this.feePrice = _fee.feePrice;
|
||||||
this.endTime = formatDate(_endTime);
|
|
||||||
this.ordEndTime = _fee.endTime;
|
this.ordEndTime = _fee.endTime;
|
||||||
this.feeFlag = _fee.feeFlag;
|
this.feeFlag = _fee.feeFlag;
|
||||||
if(this.feeFlag == '2006012'){
|
if (this.feeFlag == '2006012') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.paymentCycle = _fee.paymentCycle;
|
this.paymentCycle = _fee.paymentCycle;
|
||||||
@ -183,7 +186,8 @@
|
|||||||
this.feeMonthList.push(_index * this.paymentCycle + '个月')
|
this.feeMonthList.push(_index * this.paymentCycle + '个月')
|
||||||
}
|
}
|
||||||
this.feeMonthName = this.paymentCycle + '个月';
|
this.feeMonthName = this.paymentCycle + '个月';
|
||||||
|
let _endTime = addMonth(_lastDate, this.feeMonth);
|
||||||
|
this.endTime = formatDate(_endTime);
|
||||||
var pages = getCurrentPages();
|
var pages = getCurrentPages();
|
||||||
var prevPage = pages[pages.length - 2]; //上一个页面
|
var prevPage = pages[pages.length - 2]; //上一个页面
|
||||||
//直接调用上一个页面的setData()方法,把数据存到上一个页面中去
|
//直接调用上一个页面的setData()方法,把数据存到上一个页面中去
|
||||||
@ -200,9 +204,9 @@
|
|||||||
console.log("onConfirm", e);
|
console.log("onConfirm", e);
|
||||||
let _feeMonthName = null;
|
let _feeMonthName = null;
|
||||||
_feeMonthName = this.feeMonthList[e.detail.value];
|
_feeMonthName = this.feeMonthList[e.detail.value];
|
||||||
let _feeMonth = _feeMonthName.replace("个月","");;
|
let _feeMonth = _feeMonthName.replace("个月", "");;
|
||||||
|
|
||||||
let _receivableAmount = _feeMonth * this.feePrice ;
|
let _receivableAmount = _feeMonth * this.feePrice;
|
||||||
|
|
||||||
let _lastDate = new Date(this.ordEndTime);
|
let _lastDate = new Date(this.ordEndTime);
|
||||||
let _newDate = addMonth(_lastDate, _feeMonth);
|
let _newDate = addMonth(_lastDate, _feeMonth);
|
||||||
@ -216,8 +220,8 @@
|
|||||||
onFeeMonthCancel: function(e) {
|
onFeeMonthCancel: function(e) {
|
||||||
this.showFeeMonth = false;
|
this.showFeeMonth = false;
|
||||||
},
|
},
|
||||||
_payWxApp:function(_data){
|
_payWxApp: function(_data) {
|
||||||
let _receivedAmount = this.receivableAmount ;
|
let _receivedAmount = this.receivableAmount;
|
||||||
wx.showLoading({
|
wx.showLoading({
|
||||||
title: '支付中'
|
title: '支付中'
|
||||||
});
|
});
|
||||||
@ -228,7 +232,7 @@
|
|||||||
feeId: this.feeId,
|
feeId: this.feeId,
|
||||||
feeName: '停车费',
|
feeName: '停车费',
|
||||||
receivedAmount: _receivedAmount,
|
receivedAmount: _receivedAmount,
|
||||||
tradeType:_tradeType,
|
tradeType: _tradeType,
|
||||||
appId: this.appId
|
appId: this.appId
|
||||||
};
|
};
|
||||||
context.request({
|
context.request({
|
||||||
@ -253,18 +257,18 @@
|
|||||||
// 第二种写法,传对象字符串
|
// 第二种写法,传对象字符串
|
||||||
let orderInfo = JSON.stringify(obj)
|
let orderInfo = JSON.stringify(obj)
|
||||||
uni.requestPayment({
|
uni.requestPayment({
|
||||||
provider: 'wxpay',
|
provider: 'wxpay',
|
||||||
orderInfo: orderInfo, //微信、支付宝订单数据
|
orderInfo: orderInfo, //微信、支付宝订单数据
|
||||||
success: function (res) {
|
success: function(res) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "支付成功",
|
title: "支付成功",
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
uni.navigateBack({});
|
uni.navigateBack({});
|
||||||
},
|
},
|
||||||
fail: function (err) {
|
fail: function(err) {
|
||||||
console.log('fail:' + JSON.stringify(err));
|
console.log('fail:' + JSON.stringify(err));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
wx.hideLoading();
|
wx.hideLoading();
|
||||||
return;
|
return;
|
||||||
@ -299,7 +303,7 @@
|
|||||||
feeId: this.feeId,
|
feeId: this.feeId,
|
||||||
feeName: '停车费',
|
feeName: '停车费',
|
||||||
receivedAmount: _receivedAmount,
|
receivedAmount: _receivedAmount,
|
||||||
tradeType:_tradeType,
|
tradeType: _tradeType,
|
||||||
appId: this.appId
|
appId: this.appId
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,13 +336,13 @@
|
|||||||
});
|
});
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
WexinPayFactory.wexinPay(data,function(){
|
WexinPayFactory.wexinPay(data, function() {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "支付成功",
|
title: "支付成功",
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
|
||||||
uni.navigateBack({});
|
|
||||||
});
|
});
|
||||||
|
uni.navigateBack({});
|
||||||
|
});
|
||||||
// #endif
|
// #endif
|
||||||
wx.hideLoading();
|
wx.hideLoading();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -184,7 +184,6 @@
|
|||||||
let _receivableAmount = (_fee.paymentCycle * _amount).toFixed(2);
|
let _receivableAmount = (_fee.paymentCycle * _amount).toFixed(2);
|
||||||
let _communityInfo = context.getCurrentCommunity();
|
let _communityInfo = context.getCurrentCommunity();
|
||||||
let _lastDate = new Date(_fee.endTime);
|
let _lastDate = new Date(_fee.endTime);
|
||||||
let _endTime = addMonth(_lastDate, this.feeMonth);
|
|
||||||
this.receivableAmount = _receivableAmount;
|
this.receivableAmount = _receivableAmount;
|
||||||
this.communityId = _communityInfo.communityId;
|
this.communityId = _communityInfo.communityId;
|
||||||
this.communityName = _communityInfo.communityName;
|
this.communityName = _communityInfo.communityName;
|
||||||
@ -196,7 +195,6 @@
|
|||||||
this.feeId = _fee.feeId;
|
this.feeId = _fee.feeId;
|
||||||
this.amount = _amount;
|
this.amount = _amount;
|
||||||
this.additionalAmount = _fee.additionalAmount;
|
this.additionalAmount = _fee.additionalAmount;
|
||||||
this.endTime = formatDate(_endTime);
|
|
||||||
this.ordEndTime = _fee.endTime;
|
this.ordEndTime = _fee.endTime;
|
||||||
this.feeFlag = _fee.feeFlag;
|
this.feeFlag = _fee.feeFlag;
|
||||||
if(this.feeFlag == '2006012'){
|
if(this.feeFlag == '2006012'){
|
||||||
@ -208,6 +206,8 @@
|
|||||||
}
|
}
|
||||||
this.feeMonthName = this.paymentCycle + '个月';
|
this.feeMonthName = this.paymentCycle + '个月';
|
||||||
this.feeMonth = this.paymentCycle;
|
this.feeMonth = this.paymentCycle;
|
||||||
|
let _endTime = addMonth(_lastDate, this.feeMonth);
|
||||||
|
this.endTime = formatDate(_endTime);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
dateChange: function(e) {
|
dateChange: function(e) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user