Sfoglia il codice sorgente

修改获取 系统配置公共方法

huangbin 4 anni fa
parent
commit
47dd49d334

+ 0 - 1
src/common/setup/upload/index.ts

@@ -119,7 +119,6 @@ export function handlePreviewImg() {
     * 预览图片
     */
     async function previewImg(file: FileItem | string) {
-        debugger
         if (typeof file === 'string') {
             if (file && file !== '--') {
                 // 处理服务的脏数据,时而反而JSON格式,时而返回string格式,

+ 26 - 0
src/hooks/system/index.ts

@@ -0,0 +1,26 @@
+import APP from '@/services';
+import { Systemparam } from '@/services/go/useInfo/interface';
+
+// 获取全部系统配置
+export const getAllSystemParam = (): Systemparam[] => {
+    return APP.getRef('systemParams').value
+}
+
+// 通过 code 获取系统配置
+export const getSystemParamByCode = (paramcode: string): Systemparam | undefined => {
+    return getAllSystemParam().find(e => e.paramcode === paramcode)
+}
+// 通过 code 获取系统配置对应的值
+export const getSystemParamValueByCode = (paramcode: string) => {
+    return getSystemParamByCode(paramcode)?.paramvalue
+}
+
+/**
+ * 通过 code 查找 系统配置是否存在 value 值
+ * @param paramcode
+ * @param value
+ * @returns
+ */
+export const hasSystemParam = (paramcode: string, value: string) => {
+    return getSystemParamByCode(paramcode)?.paramvalue === value
+}

+ 0 - 1
src/views/order/commodity_contract/components/commodity_contract_bargain/components/commodity_contract_bargain_submit_order/index.vue

@@ -30,7 +30,6 @@ export default defineComponent({
 
         function submit() {
             console.log(geLoginID_number());
-            debugger;
             const param: TradeHoldTransferApplyAuditReqType = {
                 ApplyID: props.selectedRow.applyid,
                 ApplyStatus: 3, // 1:撤销2:拒绝3:通过

+ 19 - 2
src/views/order/funding_information/components/funding_information_funding_summary/components/funding_information_funding_summary_recharge/index.vue

@@ -11,7 +11,7 @@
               :rules="rules">
         <div class="formBar">
           <a-row :gutter="24">
-            <a-col :span="12">
+            <a-col :span="24">
               <a-form-item label="充值金额"
                            name="price">
                 <a-input-number class="commonInput"
@@ -19,6 +19,16 @@
                                 style="width: 100%" />
               </a-form-item>
             </a-col>
+            <a-col :span="24">
+              <a-form-item label="凭证"
+                           name="url">
+                <UploadImg :visible="visible"
+                           @upload="uploadImgAction"></UploadImg>
+              </a-form-item>
+            </a-col>
+            <a-col :span="24">
+              <span class="red">充值提现时间段:{{getApplyInOrOutTime()}}</span>
+            </a-col>
           </a-row>
         </div>
         <a-row :gutter="24">
@@ -31,7 +41,7 @@
                         @click="submit">提交
               </a-button>
               <a-button key="submit"
-                        class="cancelBtn"
+                        class="ml10 cancelBtn"
                         @click="cancel">取消</a-button>
             </a-form-item>
           </a-col>
@@ -65,6 +75,7 @@ import { geLoginID_number } from '@/services/bus/login';
 import { LongType } from '@/services/socket/login/interface';
 import { Order } from '@/services/socket/order';
 import { QueryTradePositionRsp } from '@/services/go/ermcp/order/interface';
+import { getApplyInOrOutTime } from '../setup';
 
 export default defineComponent({
     name: ModalEnum.commodity_contract_summary_transfer,
@@ -84,6 +95,9 @@ export default defineComponent({
         const { visible, cancel } = _closeModal(context);
         const loading = ref<boolean>(false);
         const { rules, formState, formRef } = handleForm();
+        // 附件
+        const { getFirstImg, uploadImgAction } = getUploadImg();
+        //
         function submit() {
             // 挂牌请求 通过合约汇总 挂牌转让
             // validateAction<FormState>(formRef, formState).then((res) => {
@@ -137,6 +151,9 @@ export default defineComponent({
             rules,
             formState,
             formRef,
+            getFirstImg,
+            uploadImgAction,
+            getApplyInOrOutTime,
         };
     },
 });

+ 12 - 0
src/views/order/funding_information/components/funding_information_funding_summary/components/setup.ts

@@ -0,0 +1,12 @@
+import { getSystemParamValueByCode } from "@/hooks/system";
+
+// 获取 充值提现时间段
+export const getApplyInOrOutTime = () => {
+    let result = '--';
+    const beginTime = getSystemParamValueByCode('012')
+    const endTime = getSystemParamValueByCode('013')
+    if (beginTime && endTime) {
+        result = beginTime + '~' + endTime
+    }
+    return result
+}

+ 6 - 8
src/views/order/funding_information/components/funding_information_funding_summary/setup.ts

@@ -1,9 +1,8 @@
-import APP from '@/services';
+import { hasSystemParam } from '@/hooks/system';
 import { useHolderprice, useProfitloss } from '@/services/bus/holdPosition';
 import { getMarketTradePropertyByGoodsId } from '@/services/bus/market';
 import { QueryTradePositionRsp } from '@/services/go/ermcp/order/interface';
 import { Taaccount } from '@/services/go/TaAccount/interface';
-import { Systemparam } from '@/services/go/useInfo/interface';
 import { Ref } from 'vue';
 
 export const tableColumns = [
@@ -105,8 +104,7 @@ export const useHazardRates = (positions: Ref<QueryTradePositionRsp[]>) => {
     function getDecimalplace() {
         return positions.value.length > 0 ? positions.value[0].decimalplace : 2
     }
-    // 获取系统参数
-    const getSystemParam = (paramcode: string, value: string) => APP.getRef('systemParams').value.find((param: Systemparam) => param.paramcode === paramcode)?.paramvalue === value
+
     // 获取当前资金账号对应的头寸
     function getTaaccountPosition(accountid: number) {
         return positions.value.filter(e => e.accountid === accountid)
@@ -141,7 +139,7 @@ export const useHazardRates = (positions: Ref<QueryTradePositionRsp[]>) => {
         const profitloss = handleProfitloss(taaccount, false) as number
 
         // 市值
-        const price = getSystemParam('087', '1') ? handleHoldPrice(accountid) : 0
+        const price = hasSystemParam('087', '1') ? handleHoldPrice(accountid) : 0
         // 风险净值	根据系统参数“087 风险净值是否加上市值 - 0:不加 1:加“
         // 0. 风险净值=期末余额+浮动盈亏(收益权)-其他冻结-出金冻结
         // 1. 风险净值=期末余额+市值+浮动盈亏(收益权)-其他冻结-出金冻结
@@ -154,7 +152,7 @@ export const useHazardRates = (positions: Ref<QueryTradePositionRsp[]>) => {
     function netWorth(taaccount: Taaccount) {
         const { accountid, currentbalance, otherfreezemargin, outamountfreeze } = taaccount
         // 浮动盈亏
-        const free = getSystemParam('037', '1') ? (otherfreezemargin + outamountfreeze) : 0
+        const free = hasSystemParam('037', '1') ? (otherfreezemargin + outamountfreeze) : 0
 
         const profitloss = handleProfitloss(taaccount, false) as number
         // 市值
@@ -171,7 +169,7 @@ export const useHazardRates = (positions: Ref<QueryTradePositionRsp[]>) => {
         //   风险率	根据系统参数“132   风险率计算公式”:
         // 1. 风险率=占用/风险净值
         // 2. 风险率=(占用-授信金额)/(风险净值-授信金额)
-        const credit = getSystemParam('132', '1') ? 0 : mortgagecredit
+        const credit = hasSystemParam('132', '1') ? 0 : mortgagecredit
         let result = 0
         if (riskValue && (riskValue - credit)) {
             result = (usedmargin - credit) / (riskValue - credit)
@@ -193,7 +191,7 @@ export const useHazardRates = (positions: Ref<QueryTradePositionRsp[]>) => {
             result = currentbalance + profitloss - freeze
         } else {
             // *系统参数”113“(当日浮动盈利是否可用) 0:不可用 1:可用
-            const isUse = getSystemParam('113', '1')
+            const isUse = hasSystemParam('113', '1')
             if (isUse) {
                 // 账户总浮动盈亏为正 且 113 = 1 :=期末余额+总浮动盈亏-占用-冻结-其它冻结-手续费冻结-出金冻结
                 result = currentbalance + profitloss - freeze