Handy_Cao пре 2 година
родитељ
комит
7322950f6b

+ 17 - 0
src/filters/index.ts

@@ -320,4 +320,21 @@ export function sortBy<T extends object, K extends keyof T>(arr: Array<T>, sortV
         // 如果a和b都不在sortBy中,它们的位置不应该改变
         return 0
     })
+}
+
+// 身份证号 获取对应的证件年龄
+export function getIdCardAge(cardnum: string) { 
+    // 根据身份证号提取出年 月 日 
+    const idYear = Number(cardnum.substring(6, 10) )
+    const idMonth = Number(cardnum.substring(10, 12)) 
+    const idDay = Number(cardnum.substring(12, 14))
+    // 获取当前日期的年 月 日 
+    const year = (new Date()).getFullYear() 
+    const month = (new Date()).getMonth() +1 
+    const day = (new Date()).getDate() 
+    // 计算年龄 
+    let age = year - idYear 
+    // 需要根据月份和具体日子判断下 
+    if((idMonth > month) || idMonth == month && idDay > day ){ age-- } 
+    return age 
 }

+ 3 - 2
src/packages/mobile/views/swap/detail/components/listing/Index.vue

@@ -29,7 +29,7 @@
             <Field name="MarketMaxSub" :rules="formRules.MarketMaxSub" label="点差" v-if="priceMove === 3">
                 <template #input>
                     <div class="g-qty-group__stepper">
-                        <Stepper v-model="formData.MarketMaxSub" theme="round" :max="maxspread" :min="minspread" button-size="22" :auto-fixed="false"
+                        <Stepper v-model="formData.MarketMaxSub" theme="round" :max="maxspread" :min="minspread" button-size="22" :auto-fixed="true"
                         :step="0.01" @change="calculateListingAmount"/>
                     </div>
                 </template>
@@ -50,7 +50,7 @@
             </Field>
             <Field label="估算价格" v-if="priceMove === 3">
                 <template #input>
-                    <span :class="quote?.lastColor">{{ estimateprice.toFixed(goods?.decimalplace) }}</span>
+                    <span :class="quote?.lastColor">{{ formatDecimal(estimateprice) }}</span>
                 </template>
             </Field>
             <Field label="参考价格" v-if="priceMove === 2">
@@ -95,6 +95,7 @@ import { queryTjmdTodayAccountMargin } from '@/services/api/swap'
 import { useAccountStore, useFuturesStore, useUserStore } from '@/stores'
 import { EPriceMode, EListingSelectType, EDelistingType, EBuildType, EValidType, EOrderOperateType } from '@/constants/client'
 import AppPopup from '@mobile/components/base/popup/index.vue'
+import { formatDecimal } from '@/filters'
 
 const props = defineProps({
     item: {

+ 4 - 2
src/packages/pc/views/market/trade/swap/detail/listing/index.vue

@@ -20,7 +20,7 @@
                     @change="calculateListingAmount" />
             </el-form-item>
             <el-form-item v-if="priceMove === 3" prop="MarketMaxSub" label="点差">
-                <el-input-number placeholder="请输入" :min="minspread" :maxBasis="maxspread" :precision="2"
+                <el-input-number placeholder="请输入" :min="minspread" :max="maxspread" :precision="2"
                     v-model="formData.MarketMaxSub" @change="calculateListingAmount" />
             </el-form-item>
             <el-form-item prop="OrderQty" label="挂牌数量">
@@ -92,7 +92,9 @@ const refresh = shallowRef(false)
 const formRef = shallowRef<FormInstance>()
 const qtyStepList = [1, 5, 10, 20, 30, 50] // 数量步长列表
 const qtyStep = shallowRef(qtyStepList[0]) // 数量步长
-const { maxspread = 1000, minspread = -1000, marketid, goodsid } = futuresStore.getGoods(props.quoteGoods.goodsid) ?? {}
+const { maxspread, minspread, marketid, goodsid } = futuresStore.getGoods(props.quoteGoods.goodsid) ?? {}
+
+console.log(maxspread, minspread)
 
 // 商品盘面
 const quote = futuresStore.getGoodsQuote(props.quoteGoods.refgoodsid) ?? {}

+ 4 - 1
src/packages/tjmd/views/account/certification/Index.vue

@@ -45,7 +45,7 @@
 import { shallowRef, onMounted } from 'vue'
 import { CellGroup, Button, Field, Form, FormInstance, showFailToast, FieldRule, Image } from 'vant'
 import { fullloading, dialog } from '@/utils/vant';
-import { getFileUrl } from '@/filters';
+import { getFileUrl, getIdCardAge } from '@/filters';
 import { getCerTypePersonList } from "@/constants/account";
 import { useRequest } from '@/hooks/request'
 import { queryTencentUsereSignRecords, requestCheckCardNum } from '@/services/api/account';
@@ -106,6 +106,9 @@ const formRules: { [key in keyof Model.AddAuthReq]?: FieldRule[] } = {
             if (validateRules.cardno.validate(val)) {
                 return true
             }
+            if ((getIdCardAge(val) < 18) || (getIdCardAge(val) > 65)) {
+                return '开户失败,您的年龄不符合开户要求'
+            }
             return validateRules.cardno.message
         }
     }],