|
@@ -84,6 +84,7 @@ import {onLoad} from "@dcloudio/uni-app";
|
|
|
import {back, to} from "@/utils/navigate";
|
|
import {back, to} from "@/utils/navigate";
|
|
|
import { requireAuth } from "@/utils/auth";
|
|
import { requireAuth } from "@/utils/auth";
|
|
|
import {debounce} from "@/utils/util";
|
|
import {debounce} from "@/utils/util";
|
|
|
|
|
+import { fenToYuan } from "@/utils/money";
|
|
|
import StyleDialog from "@/components/style-dialog/style-dialog.vue";
|
|
import StyleDialog from "@/components/style-dialog/style-dialog.vue";
|
|
|
|
|
|
|
|
const balance = ref(0);
|
|
const balance = ref(0);
|
|
@@ -101,10 +102,8 @@ const stationVisible = ref(false)
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleShowActivityStationDialog = () => {
|
|
const handleShowActivityStationDialog = () => {
|
|
|
- console.log(stationVisible)
|
|
|
|
|
if(activityStationList.value&&activityStationList.value.length>0&&payOptionsDiscount.value[payOption.value]){
|
|
if(activityStationList.value&&activityStationList.value.length>0&&payOptionsDiscount.value[payOption.value]){
|
|
|
stationVisible.value = true;
|
|
stationVisible.value = true;
|
|
|
- console.log(stationVisible)
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -138,7 +137,7 @@ const confirm = () => {
|
|
|
const params = payValue.value
|
|
const params = payValue.value
|
|
|
? Number(payValue.value)
|
|
? Number(payValue.value)
|
|
|
: payOptions.value[payOption.value];
|
|
: payOptions.value[payOption.value];
|
|
|
- if (params > 10000 || params <= 0) {
|
|
|
|
|
|
|
+ if (!params || params <= 0 || params > 10000) {
|
|
|
uni.showModal({
|
|
uni.showModal({
|
|
|
title: "温馨提示",
|
|
title: "温馨提示",
|
|
|
content: "每次最大充值金额10000,请修改金额",
|
|
content: "每次最大充值金额10000,请修改金额",
|
|
@@ -185,19 +184,23 @@ onLoad((options: any) => {
|
|
|
if (!requireAuth()) {
|
|
if (!requireAuth()) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- console.log(options)
|
|
|
|
|
if (options.value) {
|
|
if (options.value) {
|
|
|
- payOption.value = payOptions.value.findIndex(
|
|
|
|
|
- (item) => item === Number((Number(options.value) / 100).toFixed(2))
|
|
|
|
|
|
|
+ const match = payOptions.value.findIndex(
|
|
|
|
|
+ (item) => item === Number(fenToYuan(options.value))
|
|
|
);
|
|
);
|
|
|
|
|
+ if (match >= 0) {
|
|
|
|
|
+ payOption.value = match;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 金额不匹配预设档位时,填入自定义金额,避免 payOption 落空导致校验穿透
|
|
|
|
|
+ payValue.value = Number(fenToYuan(options.value));
|
|
|
|
|
+ }
|
|
|
needBack.value = !!options.back;
|
|
needBack.value = !!options.back;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (options.discount) {
|
|
if (options.discount) {
|
|
|
- payValue.value = Number((Number(options.discount) / 100).toFixed(2));
|
|
|
|
|
|
|
+ payValue.value = Number(fenToYuan(options.discount));
|
|
|
}
|
|
}
|
|
|
fetchProfile().then((res) => {
|
|
fetchProfile().then((res) => {
|
|
|
- // console.log(res);
|
|
|
|
|
balance.value = res.balance;
|
|
balance.value = res.balance;
|
|
|
if (res && res.activityList && res.activityList.length) {
|
|
if (res && res.activityList && res.activityList.length) {
|
|
|
let stationList = res.activityList[0].stationList;
|
|
let stationList = res.activityList[0].stationList;
|
|
@@ -206,7 +209,7 @@ onLoad((options: any) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
res.activityList[0].rechargeRightsList.forEach((item: any) => {
|
|
res.activityList[0].rechargeRightsList.forEach((item: any) => {
|
|
|
- const val = Number((Number(item.amountMin) / 100).toFixed(2));
|
|
|
|
|
|
|
+ const val = Number(fenToYuan(item.amountMin));
|
|
|
const fi = payOptions.value.findIndex((o) => o === val);
|
|
const fi = payOptions.value.findIndex((o) => o === val);
|
|
|
if (fi >= 0) {
|
|
if (fi >= 0) {
|
|
|
payOptionsDiscount.value[fi] = ((item.discount || 0) / 10).toFixed(1);
|
|
payOptionsDiscount.value[fi] = ((item.discount || 0) / 10).toFixed(1);
|