页面优化
This commit is contained in:
@@ -298,7 +298,7 @@ Page({
|
||||
|
||||
onAmountTap() {
|
||||
this.setData({
|
||||
'serviceFrom.amount.temp': priceFormat(this.data.serviceFrom.amount.current),
|
||||
'serviceFrom.amount.temp': priceFormat(this.data.serviceFrom.amount.current, 2),
|
||||
'serviceFrom.amount.focus': true,
|
||||
inputDialogVisible: true,
|
||||
});
|
||||
@@ -307,8 +307,13 @@ Page({
|
||||
confirmBtn: '确定',
|
||||
});
|
||||
this.inputDialog._onConfirm = () => {
|
||||
const max = Number(this.data.serviceFrom.amount.max) || 0;
|
||||
let amount = parseFloat(this.data.serviceFrom.amount.temp) || 0;
|
||||
if (amount > max) {
|
||||
amount = max;
|
||||
}
|
||||
this.setData({
|
||||
'serviceFrom.amount.current': this.data.serviceFrom.amount.temp * 100,
|
||||
'serviceFrom.amount.current': amount,
|
||||
});
|
||||
};
|
||||
this.inputDialog._onCancel = () => {};
|
||||
@@ -327,12 +332,13 @@ Page({
|
||||
let { value } = e.detail;
|
||||
const regRes = value.match(/\d+(\.?\d+)?/); // 失去焦点时,不允许末尾为小数点
|
||||
value = regRes ? regRes[0] : '0';
|
||||
value = parseFloat(value) * 100;
|
||||
if (value > this.data.serviceFrom.amount.max) {
|
||||
value = this.data.serviceFrom.amount.max;
|
||||
let amount = parseFloat(value) || 0;
|
||||
const max = Number(this.data.serviceFrom.amount.max) || 0;
|
||||
if (amount > max) {
|
||||
amount = max;
|
||||
}
|
||||
this.setData({
|
||||
'serviceFrom.amount.temp': priceFormat(value),
|
||||
'serviceFrom.amount.temp': priceFormat(amount, 2),
|
||||
'serviceFrom.amount.focus': false,
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user