|
|
@@ -18,7 +18,7 @@
|
|
|
<text class="currency">¥</text>
|
|
|
<input
|
|
|
class="min-input"
|
|
|
- type="digit"
|
|
|
+ type="number"
|
|
|
v-model="form.minAmount"
|
|
|
:placeholder="String(lowestTierAmount || '')"
|
|
|
placeholder-class="placeholder"
|
|
|
@@ -350,13 +350,8 @@
|
|
|
},
|
|
|
methods: {
|
|
|
onMinAmountInput(e) {
|
|
|
- let val = String((e && e.detail && e.detail.value) || this.form.minAmount || '');
|
|
|
- // 允许小数:只保留数字和第一个小数点,最多两位小数
|
|
|
- val = val.replace(/[^\d.]/g, '');
|
|
|
- const parts = val.split('.');
|
|
|
- if (parts.length > 1) {
|
|
|
- val = parts[0] + '.' + parts.slice(1).join('').slice(0, 2);
|
|
|
- }
|
|
|
+ const val = String((e && e.detail && e.detail.value) || this.form.minAmount || '')
|
|
|
+ .replace(/[^\d]/g, '');
|
|
|
this.$nextTick(() => {
|
|
|
this.form.minAmount = val;
|
|
|
});
|
|
|
@@ -401,7 +396,7 @@
|
|
|
acceptShare: data.acceptSharedPrepaid !== false,
|
|
|
minAmount:
|
|
|
data.customMinAmount != null && data.customMinAmount !== ''
|
|
|
- ? String(data.customMinAmount)
|
|
|
+ ? String(Math.floor(Number(data.customMinAmount)) || '')
|
|
|
: String(defaultMin),
|
|
|
tiers: mappedTiers
|
|
|
};
|
|
|
@@ -612,8 +607,8 @@
|
|
|
const lowest = this.lowestTierAmount;
|
|
|
let customMinAmount = lowest || 0;
|
|
|
if (minRaw !== '') {
|
|
|
- if (!/^\d+(\.\d{1,2})?$/.test(minRaw) || Number(minRaw) <= 0) {
|
|
|
- uni.showToast({ title: '自定义最低金额须大于0,最多两位小数', icon: 'none' });
|
|
|
+ if (!/^\d+$/.test(minRaw) || Number(minRaw) <= 0) {
|
|
|
+ uni.showToast({ title: '自定义最低金额须为正整数', icon: 'none' });
|
|
|
return;
|
|
|
}
|
|
|
customMinAmount = Number(minRaw);
|