浏览代码

:ghost: 增加历史股票均值

Ritchie 1 年之前
父节点
当前提交
64f44ebbec
共有 1 个文件被更改,包括 29 次插入12 次删除
  1. 29 12
      src/views/taskMessage/TaskAccount.vue

+ 29 - 12
src/views/taskMessage/TaskAccount.vue

@@ -10,11 +10,12 @@ const userName = ref('')
 const phone = ref('')
 const identityCard = ref('')
 const payeeCode = ref('')
-const allowMaximum = ref('') // 允许最大份额
+const allowMaximum = ref('')  // 允许最大份额
 const cardNo = ref('')
-const buyPriorityRank = ref('') // 买卖优先级/奋斗贡献值,文字
-const level = ref('') // 买卖优先级/奋斗贡献值,值
-const stockNum = ref('') // 初始股票份额
+const buyPriorityRank = ref('')  // 买卖优先级/奋斗贡献值,文字
+const level = ref('')  // 买卖优先级/奋斗贡献值,值
+const stockNum = ref('')  // 初始股票份额
+const hisAverage = ref('')  // 历史股票均价
 const applyId = ref('');
 
 const userStore = useUserStore();
@@ -67,6 +68,20 @@ onBeforeUnmount(() => {
   userStore.clearUserInfo();
 });
 
+const validateStockNum = (val) => {
+  const regex = /^([1-9]\d{0,4}|100000|0)$/;
+  return regex.test(val) || val === '' ? true : '请输入[0,100000]范围内整数';
+}
+
+const validateHisAverage = (val) => {
+  const regex = /^(0|[1-9][0-9]{0,5}\.[0-9]{0,2})$/;
+  return regex.test(val) || val === '' ? true : '请输入有效数字,最多保留2位小数';
+};
+
+// const showHisAverage = computed(() => {
+//   return stockNum.value > 0;
+// });
+
 // 拒绝
 const rejectApply = async () => {
   const userCheck = {
@@ -91,8 +106,8 @@ const rejectApply = async () => {
 // 同意
 const approveApply = async () => {
 
-  if (!buyPriorityRank.value || !allowMaximum.value || !stockNum.value) {
-    showFailToast('最大额度和奋斗值是必填项');
+  if (!buyPriorityRank.value || !allowMaximum.value) {
+    showFailToast('奋斗值和最大分额是必填项');
     return;
   }
 
@@ -100,8 +115,9 @@ const approveApply = async () => {
   const userCheck = {
     allowMaximum: allowMaximum.value,
     level: level.value,
-    applyId: applyId.value,
     stockNum: stockNum.value,
+    hisAverage: hisAverage.value,
+    applyId: applyId.value,
     pass: true
   }
   const { data } = await auditUserApply(userCheck);
@@ -138,11 +154,12 @@ const approveApply = async () => {
         <van-popup v-model:show="showPicker" position="bottom">
           <van-picker :columns="columns" @confirm="onConfirm" @cancel="showPicker = false" />
         </van-popup>
-        <van-field v-model="allowMaximum" name="允许最大份额" label="允许最大份额" placeholder="允许最大份额" left-icon="points"
-          :rules="[{ required: true, message: '允许最大份额不能为空' }]" />
-        <van-field v-model="stockNum" name="初始股票份额" label="初始股票份额" placeholder="初始股票份额" left-icon="points"
-          :rules="[{ required: true, message: '初始股票份额不能为空' }]" />
-
+        <van-field v-model="allowMaximum" name="允许买入的最大份额" label="最大买入份额" placeholder="允许买入的最大份额" left-icon="points"
+          :rules="[{ required: true, message: '最大份额不能为空' }]" />
+        <van-field v-model="stockNum" name="初始股票份额" label="初始股票份额" placeholder="初始股票份额(默认为0)" left-icon="balance-o"
+          :rules="[{ validator: validateStockNum }]" />
+        <van-field v-model="hisAverage" name="历史股票均价" label="历史股票均价" placeholder="历史股票均价(默认为0)"
+          left-icon="gold-coin-o" :rules="[{ validator: validateHisAverage }]" />
       </van-cell-group>
       <div style="margin: 20px 30px; display: flex; justify-content: center; align-items: center; gap: 50px;">
         <van-button round class="custom-button" type="danger" size="small" @click="rejectApply" block>拒绝</van-button>