li.shaoyi преди 3 години
родител
ревизия
ec5d9ec209

+ 110 - 132
src/views/order/swap_the_order/components/swap_commodity_contract_summary/components/swap_commodity_contract_summary_deal_closed/index.vue

@@ -1,81 +1,59 @@
 <template>
-    <!-- 协议平仓-->
-    <Drawer
-        :title="'协议平仓'"
-        :placement="'right'"
-        class="bottom486"
-        :visible="visible"
-        @cancel="cancel"
-    >
-        <div class="listed c_c_s_s">
-            <a-form class="inlineForm dialogForm" ref="formRef" :model="formState" :rules="rules">
-                <div class="formBar">
-                    <div class="formtop">
-                        <div class="firstTitle">
-                            <span>合约:{{ selectedRow.goodscode }}/{{ selectedRow.goodsname }}</span>
-                        </div>
-                        <div class="secondLine">
-                            <div class="left">持仓单号/方向</div>
-                            <div class="middle">数量/价格/金额</div>
-                            <div class="right">到期日/盈亏</div>
-                        </div>
+  <!-- 协议平仓-->
+  <Drawer :title="'协议平仓'" :placement="'right'" class="bottom486" :visible="visible" @cancel="cancel">
+    <div class="listed c_c_s_s">
+      <a-form class="inlineForm dialogForm" ref="formRef" :model="formState" :rules="rules">
+        <div class="formBar">
+          <div class="formtop">
+            <div class="firstTitle">
+              <span>合约:{{ selectedRow.goodscode }}/{{ selectedRow.goodsname }}</span>
+            </div>
+            <div class="secondLine">
+              <div class="left">持仓单号/方向</div>
+              <div class="middle">数量/价格/金额</div>
+              <div class="right">到期日/盈亏</div>
+            </div>
 
-                        <div class="lineBar">
-                            <div class="line1">
-                                <div class="name">{{ selectedRow.tradeid }}</div>
-                                <div class="date">{{ formatTime(selectedRow.expiredate, 'd') }}</div>
-                            </div>
-                            <div class="line2">
-                                <div
-                                    class="left"
-                                >{{ selectedRow.buyorsell === BuyOrSell.buy ? '买入' : '卖出' }}</div>
-                                <div class="middle">
-                                    <div>{{ selectedRow.holderqty }}</div>
-                                    <div>{{ selectedRow.holderprice }}</div>
-                                    <div>{{ selectedRow.holderamount }}</div>
-                                </div>
-                                <div class="right red">{{ useProfit(selectedRow, goodscode) }}</div>
-                            </div>
-                        </div>
-                    </div>
+            <div class="lineBar">
+              <div class="line1">
+                <div class="name">{{ selectedRow.tradeid }}</div>
+                <div class="date">{{ formatTime(selectedRow.expiredate, 'd') }}</div>
+              </div>
+              <div class="line2">
+                <div class="left">{{ selectedRow.buyorsell === BuyOrSell.buy ? '买入' : '卖出' }}</div>
+                <div class="middle">
+                  <div>{{ selectedRow.holderqty }}</div>
+                  <div>{{ selectedRow.holderprice }}</div>
+                  <div>{{ selectedRow.holderamount }}</div>
                 </div>
-                <div class="fixedBtns">
-                    <a-row :gutter="24">
-                        <a-col :span="24" class="mt12">
-                            <a-form-item
-                                label="协议价"
-                                name="price"
-                                class="inputIconBox mb10 not-copy"
-                            >
-                                <a-input-number
-                                    class="commonInput not-copy"
-                                    v-model:value="formState.price"
-                                    style="width: 200px"
-                                    :min="0"
-                                />
-                                <MinusOutlined @click="decreasePrice" />
-                                <PlusOutlined @click="increasePirce" />
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-item label="平仓金额" class="mb10 not-copy">
-                                <span class="white">{{ getMoney() }}</span>
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                    <a-form-item class="btnCenter mt10">
-                        <a-button
-                            class="listedBtn"
-                            :loading="loading"
-                            :disabled="loading"
-                            @click="submit"
-                        >提交</a-button>
-                        <a-button class="ml10 cancelBtn" @click="cancel">取消</a-button>
-                    </a-form-item>
-                </div>
-            </a-form>
+                <div class="right red">{{ useProfit(selectedRow, goodscode) }}</div>
+              </div>
+            </div>
+          </div>
+        </div>
+        <div class="fixedBtns">
+          <a-row :gutter="24">
+            <a-col :span="24" class="mt12">
+              <a-form-item label="协议价" name="price" class="inputIconBox mb10 not-copy">
+                <a-input-number class="commonInput not-copy" v-model:value="formState.price" style="width: 200px" :min="0" />
+                <MinusOutlined @click="decreasePrice" />
+                <PlusOutlined @click="increasePirce" />
+              </a-form-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-item label="平仓金额" class="mb10 not-copy">
+                <span class="white">{{ getMoney() }}</span>
+              </a-form-item>
+            </a-col>
+          </a-row>
+          <a-form-item class="btnCenter mt10">
+            <a-button class="listedBtn" :loading="loading" :disabled="loading" @click="submit">提交</a-button>
+            <a-button class="ml10 cancelBtn" @click="cancel">取消</a-button>
+          </a-form-item>
         </div>
-    </Drawer>
+      </a-form>
+    </div>
+  </Drawer>
 </template>
 
 <script lang="ts">
@@ -100,69 +78,69 @@ import { FormState } from './interface';
 import { handleForm, usePrice } from './setup';
 
 export default defineComponent({
-    name: 'swap_commodity_contract_summary_deal_closed',
-    components: { Drawer, UploadImg, PlusOutlined, MinusOutlined },
-    emits: ['cancel', 'update'],
-    props: {
-        selectedRow: {
-            type: Object as PropType<QueryTradeHolderDetailRsp>,
-            default: {},
-        },
-        swapList: {
-            type: Array as PropType<QueryQuoteGoodsListRsp[]>,
-            default: [],
-        },
+  name: 'swap_commodity_contract_summary_deal_closed',
+  components: { Drawer, UploadImg, PlusOutlined, MinusOutlined },
+  emits: ['cancel', 'update'],
+  props: {
+    selectedRow: {
+      type: Object as PropType<QueryTradeHolderDetailRsp>,
+      default: {},
+    },
+    swapList: {
+      type: Array as PropType<QueryQuoteGoodsListRsp[]>,
+      default: [],
     },
-    setup(props, context) {
-        const { visible, cancel } = _closeModal(context);
-        const { rules, formState, formRef } = handleForm();
-        const goodscode = findGoodsCode(props.selectedRow.refgoodsid, props.selectedRow.goodscode, props.swapList);
-        const loading = ref<boolean>(false);
+  },
+  setup(props, context) {
+    const { visible, cancel } = _closeModal(context);
+    const { rules, formState, formRef } = handleForm();
+    const goodscode = findGoodsCode(props.selectedRow.goodsid, props.selectedRow.goodscode, props.swapList);
+    const loading = ref<boolean>(false);
 
-        // 平仓金额
-        function getMoney() {
-            let result = '--';
-            if (formState.price) {
-                const { holderqty, agreeunit, decimalplace } = props.selectedRow;
-                result = (+formState.price * holderqty * agreeunit).toFixed(decimalplace);
-            }
-            return result;
-        }
+    // 平仓金额
+    function getMoney() {
+      let result = '--';
+      if (formState.price) {
+        const { holderqty, agreeunit, decimalplace } = props.selectedRow;
+        result = (+formState.price * holderqty * agreeunit).toFixed(decimalplace);
+      }
+      return result;
+    }
 
-        const toFixed0 = (value: number) => +value.toFixed(0);
+    const toFixed0 = (value: number) => +value.toFixed(0);
 
-        function submit() {
-            validateAction<FormState>(formRef, formState).then((res) => {
-                const param: TradeHoldTransferApplyReq = {
-                    TradeID: Long.fromString(props.selectedRow.tradeid),
-                    BuyorSell: props.selectedRow.buyorsell,
-                    TransferPrice: res.price,
-                    ApplySrc: 2,
-                    ApplicantID: geLoginID_number()!,
-                    Remark: '',
-                };
-                requestResultLoadingAndInfo(tradeHoldTransferApply, param, loading, ['协议平仓成功', '协议平仓失败:']).then(() => {
-                    cancel(true);
-                });
-            });
-        }
-        return {
-            visible,
-            cancel,
-            submit,
-            loading,
-            toFixed0,
-            rules,
-            formState,
-            formRef,
-            ...usePrice(formState),
-            BuyOrSell,
-            formatTime,
-            useProfit,
-            goodscode,
-            getMoney,
+    function submit() {
+      validateAction<FormState>(formRef, formState).then((res) => {
+        const param: TradeHoldTransferApplyReq = {
+          TradeID: Long.fromString(props.selectedRow.tradeid),
+          BuyorSell: props.selectedRow.buyorsell,
+          TransferPrice: res.price,
+          ApplySrc: 2,
+          ApplicantID: geLoginID_number()!,
+          Remark: '',
         };
-    },
+        requestResultLoadingAndInfo(tradeHoldTransferApply, param, loading, ['协议平仓成功', '协议平仓失败:']).then(() => {
+          cancel(true);
+        });
+      });
+    }
+    return {
+      visible,
+      cancel,
+      submit,
+      loading,
+      toFixed0,
+      rules,
+      formState,
+      formRef,
+      ...usePrice(formState),
+      BuyOrSell,
+      formatTime,
+      useProfit,
+      goodscode,
+      getMoney,
+    };
+  },
 });
 </script>
 

+ 1 - 1
src/views/order/swap_the_order/components/swap_commodity_contract_summary/components/swap_commodity_contract_summary_order_closed/index.vue

@@ -98,7 +98,7 @@ export default defineComponent({
     },
   },
   setup(props, context) {
-    const goodscode = findGoodsCode(props.selectedRow.refgoodsid, props.selectedRow.goodscode, props.swapList);
+    const goodscode = findGoodsCode(props.selectedRow.goodsid, props.selectedRow.goodscode, props.swapList);
 
     const { visible, cancel } = _closeModal(context);
     const { rules, formState, formRef } = handleForm();