|
@@ -14,8 +14,8 @@ const allowMaximum = ref('') // 允许最大份额
|
|
|
const cardNo = ref('')
|
|
|
const buyPriorityRank = ref('') // 买卖优先级/奋斗贡献值,文字
|
|
|
const level = ref('') // 买卖优先级/奋斗贡献值,值
|
|
|
-const initStockNum = ref('') // 初始股票份额
|
|
|
-const initStockPrice = ref('') // 历史股票均价
|
|
|
+const initStockNum = ref(0) // 初始股票份额
|
|
|
+const initStockPrice = ref(0) // 历史股票均价
|
|
|
const applyId = ref('');
|
|
|
|
|
|
const userStore = useUserStore();
|
|
@@ -68,20 +68,34 @@ onBeforeUnmount(() => {
|
|
|
userStore.clearUserInfo();
|
|
|
});
|
|
|
|
|
|
+const isNumberVaild = (val, regex) => {
|
|
|
+ return regex.test(val) || val === '';
|
|
|
+}
|
|
|
+
|
|
|
const validateStockNum = (val) => {
|
|
|
const regex = /^([1-9]\d{0,4}|100000|0)$/;
|
|
|
- return regex.test(val) || val === '' ? true : '请输入[0,100000]范围内整数';
|
|
|
+ if (!isNumberVaild(val, regex)) {
|
|
|
+ return '请输入[0,100000]范围内整数';
|
|
|
+ }
|
|
|
+ const initStocks = parseInt(val, 10);
|
|
|
+ const maxStocks = parseInt(allowMaximum.value, 10);
|
|
|
+ if (initStocks > maxStocks) {
|
|
|
+ return '初始份额不能大于最大份额'
|
|
|
+ }
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
const validateHisAverage = (val) => {
|
|
|
const regex = /^(0|[1-9][0-9]{0,5})(\.[0-9]{1,2})?$/;
|
|
|
- return regex.test(val) || val === '' ? true : '请输入有效数字,最多保留2位小数';
|
|
|
+ // if (initStockNum.value != 0 && val === 0) {
|
|
|
+ // return '初始股票分额不为0时,历史均价不能为0'
|
|
|
+ // }
|
|
|
+ if (!isNumberVaild(val, regex)) {
|
|
|
+ return '请输入有效数字,最多保留2位小数'
|
|
|
+ }
|
|
|
+ return true;
|
|
|
};
|
|
|
|
|
|
-// const showHisAverage = computed(() => {
|
|
|
-// return stockNum.value > 0;
|
|
|
-// });
|
|
|
-
|
|
|
// 拒绝
|
|
|
const rejectApply = async () => {
|
|
|
const userCheck = {
|
|
@@ -111,7 +125,13 @@ const approveApply = async () => {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- console.log("allowMaximum >>>", allowMaximum.value);
|
|
|
+ // 再次打印以确保在条件判断前查看值
|
|
|
+ if (initStockNum.value !== 0 && initStockPrice.value == 0) {
|
|
|
+ showFailToast('初始股票分额不为0时,历史均价不能为0');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // console.log("allowMaximum >>>", allowMaximum.value);
|
|
|
const userCheck = {
|
|
|
allowMaximum: allowMaximum.value,
|
|
|
level: level.value,
|