فهرست منبع

仓单预售 贸易圈

huangbin 4 سال پیش
والد
کامیت
953d7ba352

+ 0 - 238
src/views/market/spot_trade/warehouse_pre_sale/warehouse_pre_sale_blocs/components/post-buying/addPermance.vue

@@ -1,238 +0,0 @@
-<template>
-    <!--新增履约模板-->
-    <Drawer
-        :title="'新增履约模板'"
-        :placement="'right'"
-        :visible="visible"
-        @cancel="cancel"
-        class="top600"
-    >
-        <a-spin :spinning="loading">
-            <div class="listed">
-                <a-form class="inlineForm dialogForm">
-                    <div class="formBar">
-                        <a-row :gutter="24">
-                            <a-col :span="24">
-                                <a-form-item label="模版名称">
-                                    <a-input
-                                        class="commonInput"
-                                        value="30天账期"
-                                        style="width: 260px"
-                                    />
-                                </a-form-item>
-                            </a-col>
-                        </a-row>
-                        <a-row class="tableTitle">
-                            <a-col :span="7">步骤类型</a-col>
-                            <a-col :span="6">步骤值(%)</a-col>
-                            <a-col :span="7">距离上一步天数</a-col>
-                            <a-col :span="4">操作</a-col>
-                        </a-row>
-                        <a-row class="tableContent">
-                            <a-col :span="7">
-                                <a-select
-                                    class="inlineFormSelect dialogTableSelect"
-                                    style="width: 158px"
-                                    placeholder="请选择"
-                                    v-model:value="form.pay"
-                                >
-                                    <a-select-option key="1" value="1">买方支付</a-select-option>
-                                </a-select>
-                            </a-col>
-                            <a-col :span="6">
-                                <a-input
-                                    class="commonInput dialogTableInput"
-                                    style="width: 135px"
-                                    v-model:value="step1"
-                                ></a-input>
-                            </a-col>
-                            <a-col :span="7">
-                                <a-input
-                                    class="commonInput dialogTableInput"
-                                    style="width: 157px"
-                                    v-model:value="day1"
-                                ></a-input>
-                            </a-col>
-                            <a-col :span="4">
-                                <svg class="icon svg-icon" aria-hidden="true">
-                                    <use xlink:href="#icon-shanchu" />
-                                </svg>
-                                <PlusCircleOutlined />
-                            </a-col>
-                        </a-row>
-                        <div class="noticeTip">
-                            <div>注意事项:</div>
-                            <div>1、买方支付汇总值必须为100%;</div>
-                            <div>2、卖方收款汇总值必须为100%;</div>
-                            <div>3、配置卖方收款之前要有买方支付,且其值不能多于买方支付的值。</div>
-                        </div>
-                    </div>
-                    <a-row :gutter="24">
-                        <a-col :span="24" class="fixedBtns">
-                            <a-form-item class="btnCenter">
-                                <a-button class="listedBtn">确定</a-button>
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                </a-form>
-            </div>
-        </a-spin>
-    </Drawer>
-</template>
-
-<script lang="ts">
-import { defineComponent, PropType, ref } from 'vue';
-import { Des } from '@/common/components/commonDes';
-import { _closeModal } from '@/common/setup/modal/modal';
-import Drawer from '@/common/components/drawer/index.vue';
-import { PlusOutlined, MinusOutlined, SearchOutlined } from '@ant-design/icons-vue';
-import { QueryWrFriendApplyRsp } from '@/services/go/wrtrade/interface';
-import { TempWrOrderQuoteDetail } from '@/views/market/spot_trade/components/post_buying/interface';
-import { queryQueryWrFriend } from '@/services/go/wrtrade';
-import { message } from 'ant-design-vue';
-
-interface FriendList extends QueryWrFriendApplyRsp {
-    checked: boolean;
-}
-
-export default defineComponent({
-    emits: ['cancel', 'update'],
-    name: 'warehouse_receipt_trade_blocs_delisting',
-    components: { Des, Drawer, PlusOutlined, MinusOutlined, SearchOutlined },
-    setup(props, context) {
-        const { visible, cancel } = _closeModal(context);
-        const loading = ref<boolean>(false);
-        const searchValue = ref<string>('');
-        const myFriends = ref<FriendList[]>([]);
-        // 查询好友列表
-        function queryMyFriend(value?: string) {
-            loading.value = true;
-            queryQueryWrFriend(value)
-                .then((res) => {
-                    if (res) {
-                        myFriends.value = [];
-                        res.forEach((el) => {
-                            myFriends.value.push({ ...el, checked: false });
-                        });
-                    }
-                })
-                .catch((err: string) => message.error(err))
-                .finally(() => {
-                    loading.value = false;
-                });
-        }
-        queryMyFriend();
-        function getViewFriends() {
-            if (searchValue.value) {
-                return myFriends.value.filter((el) => String(el.frienduserid).includes(searchValue.value));
-            } else {
-                return myFriends.value;
-            }
-        }
-        function submit() {
-            const result: string[] = [];
-            myFriends.value.forEach((el) => {
-                if (el.checked) {
-                    result.push(el.frienduserid);
-                }
-            });
-            if (result.length) {
-                context.emit('update', result);
-            } else {
-                message.warn('请选择朋友');
-            }
-        }
-        function handleSearch(value: string) {
-            // const findResult = myFriends.value.find((e) => String(e.frienduserid).includes(value));
-            // if (findResult) {
-            //     searchFriend.value = [findResult];
-            // } else {
-            //     queryMyFriend(value);
-            // }
-        }
-        return {
-            loading,
-            myFriends,
-            cancel,
-            visible,
-            submit,
-            searchValue,
-            getViewFriends,
-        };
-    },
-});
-</script>
-
-<style lang="less" scoped>
-.listed {
-    padding: 18px 10px 0;
-    .formBar {
-        height: calc(100% - 70px);
-        padding: 0;
-        .ant-row.tableTitle {
-            .ant-col {
-                height: 40px;
-                line-height: 40px;
-                white-space: nowrap;
-                text-align: center;
-                color: @m-grey1;
-                font-size: 14px;
-                border-right: 1px solid @m-black6;
-                border-top: 1px solid @m-black6;
-                border-bottom: 1px solid @m-black6;
-            }
-            .ant-col:first-child {
-                border-left: 1px solid @m-black6;
-            }
-        }
-        .ant-row.tableContent {
-            .ant-col {
-                // height: 40px;
-                line-height: 40px;
-                text-align: center;
-                border-right: 1px solid @m-black6;
-                border-bottom: 1px solid @m-black6;
-                .icon {
-                    color: @m-yellow8;
-                    font-size: 20px;
-                    cursor: pointer;
-                }
-                .anticon {
-                    font-size: 20px;
-                    color: @m-blue0;
-                    margin-left: 14px;
-                    cursor: pointer;
-                }
-            }
-            .ant-col:first-child {
-                border-left: 1px solid @m-black6;
-            }
-        }
-        .noticeTip {
-            width: 100%;
-            margin-top: 15px;
-            .flex;
-            flex-direction: column;
-            > div {
-                height: 30px;
-                line-height: 30px;
-                font-size: 14px;
-                color: @m-grey1;
-            }
-        }
-    }
-    .ant-form.inlineForm {
-        .ant-row.ant-form-item {
-            margin-bottom: 5px;
-        }
-        .ant-row.ant-form-item.ant-form-item-with-help {
-            white-space: nowrap;
-            margin-left: 2px;
-        }
-    }
-    .dialogTableSelect,
-    .dialogTableInput {
-        margin-left: 2px;
-    }
-}
-</style>

+ 44 - 49
src/views/market/spot_trade/warehouse_pre_sale/warehouse_pre_sale_blocs/components/post-buying/friend.vue

@@ -1,46 +1,48 @@
 <template>
-    <!--选择朋友-->
-    <Drawer :title="'选择朋友'" :placement="'right'" :visible="visible" @cancel="cancel" class="top486">
-        <a-spin :spinning="loading">
-            <div class="listed">
-                <a-form class="inlineForm dialogForm">
-                    <a-input-search
-                        placeholder="搜索朋友编码或名称"
-                        class="searchFriendInput noSuffixInput"
-                        enter-button
-                        v-model:value="searchValue"
-                        @search="handleSearch"
-                    >
-                        <template #prefix>
-                            <SearchOutlined />
-                        </template>
-                    </a-input-search>
-                    <div class="formBar ant-checkbox-group commonCheckboxGroup whitebgCheckbox">
-                        <!-- <a-checkbox-group class="commonCheckboxGroup"> -->
-                        <div class="ant-checkbox-wrapper" style="width: 100%">
-                            <div
-                                class="item"
-                                v-for="(item, index) in getViewFriends()"
-                                :key="index + '11'"
-                            >
-                                <a-checkbox v-model:checked="item.checked">
-                                    <span class="txt">{{item.frienduserid}} {{ item.friendname }}</span>
-                                </a-checkbox>
-                            </div>
-                        </div>
-                        <!-- </a-checkbox-group> -->
-                    </div>
-                    <a-row :gutter="24">
-                        <a-col :span="24" class="fixedBtns">
-                            <a-form-item class="btnCenter">
-                                <a-button class="listedBtn" @click="submit">确定</a-button>
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                </a-form>
+  <!--选择朋友-->
+  <Drawer :title="'选择朋友'"
+          :placement="'right'"
+          :visible="visible"
+          @cancel="cancel"
+          class="top486">
+    <a-spin :spinning="loading">
+      <div class="listed">
+        <a-form class="inlineForm dialogForm">
+          <a-input-search placeholder="搜索朋友编码或名称"
+                          class="searchFriendInput noSuffixInput"
+                          enter-button
+                          v-model:value="searchValue">
+            <template #prefix>
+              <SearchOutlined />
+            </template>
+          </a-input-search>
+          <div class="formBar ant-checkbox-group commonCheckboxGroup whitebgCheckbox">
+            <!-- <a-checkbox-group class="commonCheckboxGroup"> -->
+            <div class="ant-checkbox-wrapper"
+                 style="width: 100%">
+              <div class="item"
+                   v-for="(item, index) in getViewFriends()"
+                   :key="index + '11'">
+                <a-checkbox v-model:checked="item.checked">
+                  <span class="txt">{{item.frienduserid}} {{ item.friendname }}</span>
+                </a-checkbox>
+              </div>
             </div>
-        </a-spin>
-    </Drawer>
+            <!-- </a-checkbox-group> -->
+          </div>
+          <a-row :gutter="24">
+            <a-col :span="24"
+                   class="fixedBtns">
+              <a-form-item class="btnCenter">
+                <a-button class="listedBtn"
+                          @click="submit">确定</a-button>
+              </a-form-item>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+    </a-spin>
+  </Drawer>
 </template>
 
 <script lang="ts">
@@ -105,14 +107,7 @@ export default defineComponent({
                 message.warn('请选择朋友');
             }
         }
-        function handleSearch(value: string) {
-            // const findResult = myFriends.value.find((e) => String(e.frienduserid).includes(value));
-            // if (findResult) {
-            //     searchFriend.value = [findResult];
-            // } else {
-            //     queryMyFriend(value);
-            // }
-        }
+
         return {
             loading,
             myFriends,

+ 358 - 214
src/views/market/spot_trade/warehouse_pre_sale/warehouse_pre_sale_blocs/components/post-buying/index.vue

@@ -1,141 +1,168 @@
 <template>
-    <!--仓单贸易 贸易圈挂牌 挂牌求购 -->
-    <Drawer :title="'挂牌求购'" :placement="'right'" :visible="visible" @cancel="cancel" class="top486">
-        <div class="post_buying">
-            <a-form class="inlineForm dialogForm" ref="formRef" :model="formState" :rules="rules">
-                <div class="formBar">
-                    <a-row :gutter="24">
-                        <a-col :span="24">
-                            <a-form-item label="交易账户" name="accountid">
-                                <a-select
-                                    class="inlineFormSelect"
-                                    style="width: 260px"
-                                    v-model:value="formState.accountid"
-                                    placeholder="请选择"
-                                >
-                                    <a-select-option
-                                        v-for="item in accountList"
-                                        :value="item.accountid"
-                                        :key="item.accountid"
-                                    >{{item.accountid}}</a-select-option>
-                                </a-select>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-item label="挂牌价格" name="FixedPrice" class="inputIconBox">
-                                <a-input-number
-                                    class="commonInput"
-                                    style="width: 260px"
-                                    :min="0"
-                                    v-model:value="formState.FixedPrice"
-                                />
+  <!--仓单贸易 贸易圈挂牌 挂牌求购 -->
+  <Drawer :title="'挂牌求购'"
+          :placement="'right'"
+          :visible="visible"
+          @cancel="cancel"
+          class="top486">
+    <div class="post_buying">
+      <a-form class="inlineForm dialogForm"
+              ref="formRef"
+              :model="formState"
+              :rules="rules">
+        <div class="formBar">
+          <a-row :gutter="24">
+            <a-col :span="24">
+              <a-form-item label="交易账户"
+                           name="accountid">
+                <a-select class="inlineFormSelect"
+                          style="width: 260px"
+                          v-model:value="formState.accountid"
+                          placeholder="请选择">
+                  <a-select-option v-for="item in accountList"
+                                   :value="item.accountid"
+                                   :key="item.accountid">{{item.accountid}}</a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-item label="挂牌价格"
+                           name="FixedPrice"
+                           class="inputIconBox">
+                <a-input-number class="commonInput"
+                                style="width: 260px"
+                                :min="0"
+                                v-model:value="formState.FixedPrice" />
+                <MinusOutlined @click="decreasePrice" />
+                <PlusOutlined @click="increasePrice" />
+                <a-checkbox class="commonCheckbox"
+                            v-model:checked="priceCheck">可议价</a-checkbox>
+              </a-form-item>
+              <!-- <a-form-item label="挂牌价格" name="FixedPrice" class="inputIconBox">
+                                <a-input-number class="commonInput" style="width: 260px" :min="0" v-model:value="formState.FixedPrice" />
                                 <MinusOutlined />
-                                <PlusOutlined />
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-item label="挂牌数量" name="OrderQty" class="inputIconBox">
-                                <a-input-number
-                                    class="commonInput"
-                                    style="width: 260px"
-                                    :min="0"
-                                    v-model:value="formState.OrderQty"
-                                />
-                                <MinusOutlined />
-                                <PlusOutlined />
-                                <span class="input-enumdicname">{{selectedRow.enumdicname}}</span>
-                            </a-form-item>
-                        </a-col>
+                                <PlusOutlined  />
+                                <a-checkbox v-model:checked="priceCheck" class="commonCheckbox">可议价</a-checkbox>
+                            </a-form-item>-->
+            </a-col>
+            <a-col :span="24">
+              <a-form-item label="挂牌数量"
+                           name="OrderQty"
+                           class="inputIconBox">
+                <a-input-number class="commonInput"
+                                style="width: 260px"
+                                :min="0"
+                                v-model:value="formState.OrderQty" />
+                <MinusOutlined @click="decreaseNumber" />
+                <PlusOutlined @click="increaseNumber" />
+                <span class="input-enumdicname">{{selectedRow.enumdicname}}</span>
+                <a-checkbox v-model:checked="numCheck"
+                            class="commonCheckbox">整单</a-checkbox>
+              </a-form-item>
+            </a-col>
 
-                        <a-col :span="24">
-                            <a-form-item label="起摘数量" name="delistingQty">
-                                <a-input-number
-                                    class="commonInput"
-                                    v-model:value="formState.delistingQty"
-                                    :min="0"
-                                    style="width: 260px"
-                                />
-                                <span class="input-enumdicname">{{selectedRow.enumdicname}}</span>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-item label="履约保证金" name="margin">
-                                <a-input-number
-                                    class="commonInput"
-                                    v-model:value="formState.margin"
-                                    :min="0"
-                                    style="width: 260px"
-                                />
-                                <span class="input-enumdicname">%</span>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-item label="挂牌有效期" name="DeliveryMonth" class="inputIconBox">
-                                <a-date-picker
-                                    style="width: 260px"
-                                    v-model:value="formState.DeliveryMonth"
-                                    :allowClear="false"
-                                    class="commonDatePicker dialogDatePicker"
-                                />
-                            </a-form-item>
-                        </a-col>
+            <a-col :span="24"
+                   v-if="!numCheck">
+              <a-form-item label="起摘数量"
+                           name="delistingQty">
+                <a-input-number class="commonInput"
+                                v-model:value="formState.delistingQty"
+                                :min="0"
+                                style="width: 260px" />
+                <span class="input-enumdicname">{{selectedRow.enumdicname}}</span>
+              </a-form-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-item label="履约保证金"
+                           name="margin">
+                <a-input-number class="commonInput"
+                                v-model:value="formState.margin"
+                                :min="0"
+                                style="width: 260px" />
+                <span class="input-enumdicname">%</span>
+              </a-form-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-item label="挂牌有效期"
+                           name="DeliveryMonth"
+                           class="inputIconBox">
+                <a-date-picker style="width: 260px"
+                               v-model:value="formState.DeliveryMonth"
+                               :allowClear="false"
+                               class="commonDatePicker dialogDatePicker" />
+              </a-form-item>
+            </a-col>
 
-                        <a-col :span="24" @click="openPermance">
-                            <a-form-item label="履约方式" class="inputIconBox">
-                                <span class="clickBox">选择履约模板</span>
-                                <svg
-                                    class="icon svg-icon"
-                                    aria-hidden="true"
-                                    @click="openPermance"
-                                >
-                                    <use xlink:href="#icon-moban" />
-                                </svg>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="24" @click="openFriend">
-                            <a-form-item label="指定朋友" class="inputIconBox">
-                                <span class="clickBox">选择朋友</span>
-                                <svg class="icon svg-icon" aria-hidden="true" @click="openFriend">
-                                    <use xlink:href="#icon-pengyou1" />
-                                </svg>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-item label="挂牌金额">
-                                <span class="white ml8">55555</span>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-item label="履约保证金">
-                                <span class="white ml8">55555</span>
-                            </a-form-item>
-                        </a-col>
-                        <a-col :span="24">
-                            <a-form-item label="可用资金">
-                                <span class="white ml8">55555</span>
-                            </a-form-item>
-                        </a-col>
-                    </a-row>
-                </div>
-                <a-row :gutter="24">
-                    <a-col :span="24" class="fixedBtns">
-                        <a-form-item class="btnCenter">
-                            <a-button class="listedBtn" @click="submit">买入</a-button>
-                            <a-button class="ml10 cancelBtn" @click="cancel">取消</a-button>
-                        </a-form-item>
-                    </a-col>
-                </a-row>
-            </a-form>
+            <a-col :span="24">
+              <a-form-item label="履约方式"
+                           class="inputIconBox">
+                <span class="clickBox"
+                      @click="openPermance">{{formState.permanceTempName ? formState.permanceTempName  : '选择履约模板'}}</span>
+                <svg class="icon svg-icon"
+                     aria-hidden="true"
+                     @click="openPermance">
+                  <use xlink:href="#icon-moban" />
+                </svg>
+              </a-form-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-item label="指定朋友"
+                           class="inputIconBox">
+                <span class="clickBox"
+                      @click="openFriend">{{getFriendLength() ? `已选${getFriendLength() }人` : '选择朋友'}}</span>
+                <svg class="icon svg-icon"
+                     aria-hidden="true"
+                     @click="openFriend">
+                  <use xlink:href="#icon-pengyou1" />
+                </svg>
+                <a-checkbox class="commonCheckbox"
+                            v-model:checked="friendCheck"
+                            @change="limiteFriends">不限</a-checkbox>
+              </a-form-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-item label="挂牌金额">
+                <span class="white ml8">{{getMoney()}}</span>
+              </a-form-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-item label="履约保证金">
+                <span class="white ml8">{{getMargin()}}</span>
+              </a-form-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-item label="可用资金">
+                <span class="white ml8">{{getCanUseMoney(getSelectedAccount())}}</span>
+              </a-form-item>
+            </a-col>
+          </a-row>
         </div>
-    </Drawer>
-    <!-- 选择朋友 -->
-    <Friend v-if="showFriend" @cancel="chooseFriend" @update="chooseFriend" />
-    <!-- 选择履约模板 -->
-    <Permance v-if="showPermance" @cancel="choosePermance" @update="choosePermance" />
+        <a-row :gutter="24">
+          <a-col :span="24"
+                 class="fixedBtns">
+            <a-form-item class="btnCenter">
+              <a-button class="listedBtn"
+                        @click="submit">买入</a-button>
+              <a-button class="ml10 cancelBtn"
+                        @click="cancel">取消</a-button>
+            </a-form-item>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+  </Drawer>
+  <!-- 选择朋友 -->
+  <Friend v-if="showFriend"
+          @cancel="chooseFriend"
+          @update="chooseFriend" />
+  <!-- 选择履约模板 -->
+  <Permance v-if="showPermance"
+            @cancel="choosePermance"
+            @update="choosePermance" />
 </template>
 
 <script lang="ts">
-import { defineComponent, PropType, ref } from 'vue';
+import { defineComponent, PropType, ref, UnwrapRef } from 'vue';
 import { Des } from '@/common/components/commonDes';
 import { _closeModal } from '@/common/setup/modal/modal';
 import { ModalEnum } from '@/common/constants/modalNameEnum';
@@ -145,10 +172,10 @@ import { hdWROrder } from '@/services/proto/warehousetrade';
 import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import { DGFactoryItems, WRGoodsInfo } from '@/services/proto/warehousetrade/interface';
 import { getAccountTypeList, getUserId } from '@/services/bus/account';
-import { v4 as uuidv4 } from 'uuid';
+import { v3, v4 as uuidv4 } from 'uuid';
 import moment, { Moment } from 'moment';
 import { getMarketRunByTradeMode } from '@/services/bus/market';
-import { QueryOrderQuoteMyqQsp, WrOrderQuote } from '@/services/go/wrtrade/interface';
+import { QueryOrderQuoteMyqQsp, QueryPermancePlanTmpRsp, WrOrderQuote } from '@/services/go/wrtrade/interface';
 import { handleForm, hanldeOpenAndCloseComponent } from './setup';
 import { validateAction } from '@/common/setup/form';
 import { FormParam } from './interface';
@@ -159,6 +186,113 @@ import { getCanUseMoney } from '@/services/bus/account';
 import { TempWrOrderQuoteDetail } from '@/views/market/spot_trade/components/post_buying/interface';
 import Friend from './friend.vue';
 import Permance from './permancePlanTmp.vue';
+import { message } from 'ant-design-vue';
+import { computed } from '@vue/runtime-core';
+
+// 价格
+const usePrice = (formState: UnwrapRef<FormParam>) => {
+    const priceCheck = ref<boolean>(false); // 是否可议价
+    function increasePrice() {
+        formState.FixedPrice++;
+    }
+    function decreasePrice() {
+        if (formState.FixedPrice) {
+            formState.FixedPrice--;
+        }
+    }
+    return { priceCheck, increasePrice, decreasePrice };
+};
+
+// 数量
+const useNumber = (formState: UnwrapRef<FormParam>) => {
+    const numCheck = ref<boolean>(false); // 是否整单
+    function increaseNumber() {
+        formState.OrderQty++;
+    }
+    function decreaseNumber() {
+        if (formState.OrderQty) {
+            formState.OrderQty--;
+        }
+    }
+    return { numCheck, increaseNumber, decreaseNumber };
+};
+
+// 交易账号
+const useAccount = (formState: UnwrapRef<FormParam>) => {
+    // 资金账号
+    const accountList = getAccountTypeList([2]);
+    if (accountList.length) {
+        formState.accountid = accountList[0].accountid;
+    }
+    function getSelectedAccount() {
+        return accountList.find((e) => e.accountid === formState.accountid);
+    }
+    return { getSelectedAccount, accountList };
+};
+
+// 金额
+const useMoney = (formState: UnwrapRef<FormParam>) => {
+    // 挂牌金额
+    function getMoney() {
+        let result = 0;
+        const { FixedPrice, OrderQty } = formState;
+        if (FixedPrice && OrderQty) {
+            result = FixedPrice * OrderQty;
+        }
+        return result ? result.toFixed(2) : '--';
+    }
+    // 履约保证金
+    function getMargin() {
+        let result = 0;
+        const { FixedPrice, OrderQty, margin } = formState;
+        if (FixedPrice && OrderQty && margin) {
+            result = (FixedPrice * OrderQty * margin) / 100;
+        }
+        return result ? result.toFixed(2) : '--';
+    }
+    return { getMoney, getMargin };
+};
+
+// 选择朋友
+const useFriends = (formState: UnwrapRef<FormParam>) => {
+    const friendCheck = ref<boolean>(false); // 是否不限好友
+    const showFriend = ref<boolean>(false);
+    function chooseFriend(value: number[] | false) {
+        if (value) {
+            formState.friends = value;
+        }
+        showFriend.value = false;
+    }
+    function openFriend() {
+        showFriend.value = true;
+    }
+    function getFriendLength() {
+        return formState.friends.length;
+    }
+    // 是否 不限好友
+    function limiteFriends() {
+        if (friendCheck.value) {
+            formState.friends.length = 0;
+        }
+    }
+    return { friendCheck, showFriend, chooseFriend, openFriend, getFriendLength, limiteFriends };
+};
+
+// 履约模板
+const usePermaceTemp = (formState: UnwrapRef<FormParam>) => {
+    const showPermance = ref<boolean>(false);
+    function choosePermance(value: QueryPermancePlanTmpRsp | false) {
+        if (value) {
+            formState.permanceTempName = value.templatename;
+            formState.permaceTempId = value.autoid;
+        }
+        showPermance.value = false;
+    }
+    function openPermance() {
+        showPermance.value = true;
+    }
+    return { showPermance, choosePermance, openPermance };
+};
 
 export default defineComponent({
     emits: ['cancel', 'update'],
@@ -172,105 +306,115 @@ export default defineComponent({
     },
     setup(props, context) {
         const { visible, cancel } = _closeModal(context);
+        // 表单
         const { rules, formState, formRef } = handleForm();
         // 选择朋友
-        const { show: showFriend, selected: frineds, close: chooseFriend, open: openFriend } = hanldeOpenAndCloseComponent<number[]>();
+        const { friendCheck, showFriend, chooseFriend, openFriend, getFriendLength, limiteFriends } = useFriends(formState);
         // 履约模板
-        const { show: showPermance, selected: selectedPermance, close: choosePermance, open: openPermance } = hanldeOpenAndCloseComponent<number>();
+        const { showPermance, choosePermance, openPermance } = usePermaceTemp(formState);
         const loading = ref<boolean>(false);
-        const accountList = getAccountTypeList([2]);
-        if (accountList.length) {
-            formState.accountid = accountList[0].accountid;
-        }
-        function getSelectedAccount() {
-            return accountList.find((e) => e.accountid === formState.accountid);
-        }
-
+        // 摘牌数量
+        const { numCheck, increaseNumber, decreaseNumber } = useNumber(formState);
         function submit() {
-            // const marketInfo = getMarketRunByTradeMode(17);
-            // if (marketInfo) {
-            //     validateAction<FormParam>(formRef, formState).then((res) => {
-            //         // 现在增加一种挂牌求购的情况
-            //         // 这种求购模式会生成一种仓单贸易商品
-            //         const wrGoodsInfo: WRGoodsInfo = {
-            //             GoodsID: props.selectedRow.goodsid, // uint32 配置商品ID
-            //             GoodsCode: props.selectedRow.goodscode, // string 配置商品代码
-            //             PriceFactor: 1, // double 商品价格系数
-            //             PriceMove: 0, // double 商品升贴水值
-            //             WeightRatio: 1, // double 商品重量系数
-            //         };
-            //         const param = {
-            //             AccountID: res.accountid, // 默认内部资金账号第一个
-            //             ClientSerialNo: uuidv4(), // 客户端流水号
-            //             // OperateSrc: 2,
-            //             ClientType: 4,
-            //             // MarketID: marketInfo.marketid,
-            //             LadingBillId: 0, // 提单id(wrholdlb的LadingBillId字段),卖的时候填写 uint64
-            //             // LadingBillId: 'uint642081626946446000001', // 提单id(wrholdlb的LadingBillId字段),卖的时候填写 uint64
-            //             TradeDate: moment(marketInfo.tradedate).format('YYYYMMDD'), // 交易日 string
-            //             // SubNum: '0', // 提单子单号
-            //             SubNum: 0,
-            //             // WRFactorTypeId: '2121626946446000001', // 仓单要素ID(wrholdlb的WRFactorTypeId字段),卖的时候填写 uint64
-            //             WRFactorTypeId: props.selectedRow.wrfactortypeid ? props.selectedRow.wrfactortypeid : 0, // 仓单要素ID(wrholdlb的WRFactorTypeId字段),卖的时候填写 uint64
-            //             IsSpecified: 0, // 是否指定对手 0:不指定 1:指定 uint32
-            //             // MatchUserIDs: 0, // 仓单贸易对手资金账号ID集合(指定对手时填写) uint32
-            //             OrderQty: res.OrderQty, // 委托数量(可挂部分数据量) ======
-            //             DeliveryGoodsID: props.selectedRow.deliverygoodsid, // 交割商品商品ID  // 有仓单求购
-            //             WRPriceType: isFloat() ? 2 : 1, // 价格方式 1:固定价 2:浮动价
-            //             FixedPrice: res.FixedPrice, // 固定价格
-            //             PriceFactor: 1, // 价格系数(浮动价时填写)
-            //             PriceMove: res.PriceMove, // 升贴水(浮动价时填写)
-            //             TimevalidType: 4, // 时间有效类型 1:当日有效 2:本周有效 3:指定时间有效 4:一直有效
-            //             // ValidTime: moment('2021-08-25 00:00:00').format('YYYY-MM-DD HH:mm:ss'), // 有效期限
-            //             ClientOrderTime: moment().format('YYYY-MM-DD HH:mm:ss'),
-            //             FirstRatio: 0, // 首付比例
-            //             PerformanceTemplateID: 0, // 履约计划模板ID
-            //             UserID: getUserId(),
-            //             OperatorID: getUserId(), // 操作员账号ID
-            //             BuyOrSell: 0, // 买卖方向 0买1卖
-            //             PriceDisplayMode: 1, // 浮动价显示方式 1:合并显示 2:分开显示
-            //             CanBargain: 0, // 挂牌是否可议价0:不可1:可-摘牌是否议价
-            //             Attachment1: '', // 附件1
-            //             Attachment2: '', // 附件2
-            //             Remark: '', // 备注
-            //             ApplyID: 0, // 申请ID
-            //             WRTradeGoods: isFloat() ? [wrGoodsInfo] : [],
-            //             CanPart: 1, // 是否允许部份摘牌0:不允许;1:允许
-            //             WRStandardID: props.selectedRow.wrstandardid,
-            //             HasWr: isWR(), // 无仓单挂牌  是否有无仓单
-            //             DeliveryMonth: isWR() ? '' : moment(res.DeliveryMonth).format('YYYY-MM'),
-            //             FactoryItems: props.selectedRow.wrResult != undefined ? props.selectedRow.wrResult.flatMap((it) => {
-            //                 return {
-            //                     DGFactoryItemTypeID: it.dgfactoryitemtypeid, // uint64 要素项类型ID
-            //                     DGFactoryItemID: it.dgfactoryitemid, // uint64 预约要素项类型值
-            //                     ItemTypeMode: 1, // uint32 要素项类型模式
-            //                 };
-            //             }): [], // DGFactoryItems 要素类型明细集合(没有仓单要素ID填写)
-            //         };
-            //         requestResultLoadingAndInfo(hdWROrder, param, loading, ['求购成功', '求购失败:']).then(() => {
-            //             cancel(true);
-            //         });
-            //     });
-            // }
+            if (!formState.permanceTempName) {
+                message.error('请选择履约模板');
+                return;
+            }
+            if (!friendCheck.value) {
+                if (formState.friends.length === 0) {
+                    message.error('请选择朋友');
+                    return;
+                }
+            }
+
+            const marketInfo = getMarketRunByTradeMode(17);
+            if (marketInfo) {
+                validateAction<FormParam>(formRef, formState).then((res) => {
+                    const param = {
+                        AccountID: res.accountid, // 默认内部资金账号第一个
+                        ClientSerialNo: uuidv4(), // 客户端流水号
+                        // OperateSrc: 2,
+                        ClientType: 4,
+                        // MarketID: marketInfo.marketid,
+                        LadingBillId: 0, // 提单id(wrholdlb的LadingBillId字段),卖的时候填写 uint64
+                        // LadingBillId: 'uint642081626946446000001', // 提单id(wrholdlb的LadingBillId字段),卖的时候填写 uint64
+                        TradeDate: moment(marketInfo.tradedate).format('YYYYMMDD'), // 交易日 string
+                        // SubNum: '0', // 提单子单号
+                        SubNum: 0,
+                        // WRFactorTypeId: '2121626946446000001', // 仓单要素ID(wrholdlb的WRFactorTypeId字段),卖的时候填写 uint64
+                        WRFactorTypeId: props.selectedRow.wrfactortypeid ? props.selectedRow.wrfactortypeid : 0, // 仓单要素ID(wrholdlb的WRFactorTypeId字段),卖的时候填写 uint64
+                        IsSpecified: 1, // 是否指定对手 0:不指定 1:指定 uint32
+                        MatchUserIDs: res.friends, // 仓单贸易对手资金账号ID集合(指定对手时填写) uint32
+                        OrderQty: res.OrderQty, // 委托数量(可挂部分数据量) ======
+                        DeliveryGoodsID: props.selectedRow.deliverygoodsid, // 交割商品商品ID  // 有仓单求购
+                        WRPriceType: 1, // 价格方式 1:固定价 2:浮动价
+                        FixedPrice: res.FixedPrice, // 固定价格
+                        PriceFactor: 1, // 价格系数(浮动价时填写)
+                        PriceMove: 0, // 升贴水(浮动价时填写)
+                        TimevalidType: 4, // 时间有效类型 1:当日有效 2:本周有效 3:指定时间有效 4:一直有效
+                        ValidTime: moment(formState.vidaliteTime).format('YYYY-MM-DD HH:mm:ss'), // 有效期限
+                        ClientOrderTime: moment().format('YYYY-MM-DD HH:mm:ss'),
+                        FirstRatio: 0, // 首付比例
+                        PerformanceTemplateID: res.permaceTempId, // 履约计划模板ID
+                        UserID: getUserId(),
+                        OperatorID: getUserId(), // 操作员账号ID
+                        BuyOrSell: 0, // 买卖方向 0买1卖
+                        PriceDisplayMode: 1, // 浮动价显示方式 1:合并显示 2:分开显示
+                        CanBargain: 0, // 挂牌是否可议价0:不可1:可-摘牌是否议价
+                        Attachment1: '', // 附件1
+                        Attachment2: '', // 附件2
+                        Remark: '', // 备注
+                        ApplyID: 0, // 申请ID
+                        WRTradeGoods: [],
+                        CanPart: numCheck.value ? 0 : 1, // 是否允许部份摘牌0:不允许;1:允许
+                        WRStandardID: props.selectedRow.wrstandardid,
+                        HasWr: 1, // 无仓单挂牌  是否有无仓单
+                        DeliveryMonth: '',
+                        DelistMinQty: numCheck.value ? formState.delistingQty : 0, // 起摘数量
+                        MarginFlag: 1, // 挂牌是否指定保证金 0:否 1:是
+                        MarginAlgorithm: 1, // 指定保证金方式 1:比率 2:固定
+                        MarginValue: formState.margin, // 指定保证金设置值
+                        AllFriendsFlag: friendCheck.value ? 1 : 0, //是否全好友可见 0:否 1:是
+                        FactoryItems:
+                            props.selectedRow.wrResult != undefined
+                                ? props.selectedRow.wrResult.map((it) => {
+                                      return {
+                                          DGFactoryItemTypeID: it.dgfactoryitemtypeid, // uint64 要素项类型ID
+                                          DGFactoryItemID: it.dgfactoryitemid, // uint64 预约要素项类型值
+                                          ItemTypeMode: 1, // uint32 要素项类型模式
+                                      };
+                                  })
+                                : [], // DGFactoryItems 要素类型明细集合(没有仓单要素ID填写)
+                    };
+                    requestResultLoadingAndInfo(hdWROrder, param, loading, ['求购成功', '求购失败:']).then(() => {
+                        cancel(true);
+                    });
+                });
+            }
         }
         return {
             submit,
             cancel,
             visible,
-            accountList,
             rules,
             formState,
             formRef,
-            getSelectedAccount,
             getCanUseMoney,
-
-            showFriend,
-            chooseFriend,
-            openFriend,
-
+            ...usePrice(formState),
+            ...useAccount(formState),
+            ...useMoney(formState),
             showPermance,
             choosePermance,
             openPermance,
+            numCheck,
+            increaseNumber,
+            decreaseNumber,
+            friendCheck,
+            showFriend,
+            chooseFriend,
+            openFriend,
+            getFriendLength,
+            limiteFriends,
         };
     },
 });

+ 17 - 0
src/views/market/spot_trade/warehouse_pre_sale/warehouse_pre_sale_blocs/components/post-buying/interface.ts

@@ -8,5 +8,22 @@ export interface FormParam {
     margin: number,
     DeliveryMonth: Moment,
     vidaliteTime: Moment,
+    friends: number[],
+    permanceTempName: string,
+    permaceTempId: number,
 }
 
+export interface PermanceTemp {
+    steptypeid: number | undefined;
+    stepvalue: number | null;
+    stepdays: number | null;
+    isauto: number; // 是否自动是否自动 - 0:不自动 1:自动
+    remark: string; // 备注
+    stepindex: number; //步骤序号
+    steptypename: string; //步骤名
+}
+
+export interface PermanceTempForm {
+    domains: PermanceTemp[],
+    name: string,
+}

+ 56 - 40
src/views/market/spot_trade/warehouse_pre_sale/warehouse_pre_sale_blocs/components/post-buying/permancePlanTmp.vue

@@ -1,36 +1,43 @@
 <template>
-    <!--选择履约模板-->
-    <Drawer
-        :title="'选择履约模板'"
-        :placement="'right'"
-        :visible="visible"
-        @cancel="cancel"
-        class="top486"
-    >
-        <span class="add-permance" @click="open">
-            <svg class="icon svg-icon" aria-hidden="true">
-                <use xlink:href="#icon-xinjianzengjiaxinzeng-20" />
-            </svg>
-        </span>
-        <a-spin :spinning="loading">
-            <div class="moduleContent">
-                <div class="itemBar" v-for="item in tableList" :key="item.autoid">
-                    <div class="itemName">{{item.templatename}}</div>
-                    <div class="rulesCont">
-                        <a-row>
-                            <a-col :span="24" class="ruleCol">
-                                <div class="line" v-for="sub in item.LstStep" :key="sub.autoid">
-                                    <div class="name">{{sub.steptypename}}</div>
-                                    <div class="time">{{sub.stepdate}}</div>
-                                </div>
-                            </a-col>
-                        </a-row>
-                    </div>
+  <!--选择履约模板-->
+  <Drawer :title="'选择履约模板'"
+          :placement="'right'"
+          :visible="visible"
+          @cancel="cancel"
+          class="top486">
+    <span class="add-permance"
+          @click="open">
+      <svg class="icon svg-icon"
+           aria-hidden="true">
+        <use xlink:href="#icon-xinjianzengjiaxinzeng-20" />
+      </svg>
+    </span>
+    <a-spin :spinning="loading">
+      <div class="moduleContent">
+        <div class="itemBar"
+             v-for="item in tableList"
+             :key="item.autoid"
+             @click="chooseTemp(item)">
+          <div class="itemName">{{item.templatename}}</div>
+          <div class="rulesCont">
+            <a-row>
+              <a-col :span="24"
+                     class="ruleCol">
+                <div class="line"
+                     v-for="sub in item.LstStep"
+                     :key="sub.autoid">
+                  <div class="name">{{sub.steptypename}}</div>
+                  <div class="time">{{sub.stepdate}}</div>
                 </div>
-            </div>
-        </a-spin>
-    </Drawer>
-    <Add v-if="show" @cancel="close" @update="close" />
+              </a-col>
+            </a-row>
+          </div>
+        </div>
+      </div>
+    </a-spin>
+  </Drawer>
+  <Add v-if="show"
+       @cancel="closeAddTemp" />
 </template>
 
 <script lang="ts">
@@ -38,15 +45,11 @@ import { defineComponent, PropType, ref } from 'vue';
 import { Des } from '@/common/components/commonDes';
 import { _closeModal } from '@/common/setup/modal/modal';
 import Drawer from '@/common/components/drawer/index.vue';
-import { PlusOutlined, MinusOutlined, SearchOutlined } from '@ant-design/icons-vue';
-import { QueryPermancePlanTmpReq, QueryPermancePlanTmpRsp, QueryWrFriendApplyRsp } from '@/services/go/wrtrade/interface';
-import { TempWrOrderQuoteDetail } from '@/views/market/spot_trade/components/post_buying/interface';
-import { queryQueryPermancePlanTmp, queryQueryWrFriend } from '@/services/go/wrtrade';
-import { message } from 'ant-design-vue';
+import { QueryPermancePlanTmpReq, QueryPermancePlanTmpRsp } from '@/services/go/wrtrade/interface';
+import { queryQueryPermancePlanTmp } from '@/services/go/wrtrade';
 import { getUsrId } from '@/services/bus/user';
-import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import { queryTableList } from '@/common/setup/table';
-import Add from './addPermance.vue';
+import Add from '@/common/components/addPermanceTemp/index.vue';
 import { hanldeOpenAndCloseComponent } from './setup';
 
 export default defineComponent({
@@ -60,11 +63,22 @@ export default defineComponent({
 
         const param: QueryPermancePlanTmpReq = {
             userid: getUsrId(),
-            tmptype: '2',
+            tmptype: '0,2',
         };
         const { loading, tableList, queryTable } = queryTableList<QueryPermancePlanTmpRsp>();
         queryTable(queryQueryPermancePlanTmp, param);
 
+        function closeAddTemp(isRefresh: boolean) {
+            if (isRefresh) {
+                queryTable(queryQueryPermancePlanTmp, param);
+            }
+            close(null);
+        }
+        // 选择履约模板
+        function chooseTemp(item: QueryPermancePlanTmpRsp) {
+            context.emit('update', item);
+            cancel();
+        }
         return {
             loading,
             cancel,
@@ -73,6 +87,8 @@ export default defineComponent({
             show,
             close,
             open,
+            chooseTemp,
+            closeAddTemp,
         };
     },
 });
@@ -108,7 +124,7 @@ export default defineComponent({
             line-height: 40px;
             border-bottom: 1px solid @m-blue20;
             color: @m-white11;
-            font-size: 14px;
+            font-size: 16px;
         }
     }
 }

+ 11 - 3
src/views/market/spot_trade/warehouse_pre_sale/warehouse_pre_sale_blocs/components/post-buying/setup.ts

@@ -10,6 +10,9 @@ const formState: UnwrapRef<FormParam> = reactive({
     margin: 0,
     DeliveryMonth: moment(),
     vidaliteTime: moment(),
+    friends: [],
+    permanceTempName: '',
+    permaceTempId: 0,
 })
 export function handleForm() {
     function validateMargin(value: any, errInfo: string) {
@@ -24,15 +27,15 @@ export function handleForm() {
         FixedPrice: [{ required: true, message: '请输入挂牌价格', trigger: 'blur', type: 'number', }],
         OrderQty: [
             { required: true, message: '请输入挂牌数量', trigger: 'blur', type: 'number' },
-            { min: 1, message: '挂牌挂牌数量不能小于1', }
+            { min: 1, message: '挂牌挂牌数量不能小于1', type: 'number' }
         ],
         delistingQty: [
             { required: true, message: '请输入起摘数量', trigger: 'blur', type: 'number' },
-            { min: 1, message: '起摘数量不能小于1', }
+            { min: 1, message: '起摘数量不能小于1', type: 'number' }
         ],
         margin: [
             { required: true, message: '请输入履约保证金', trigger: 'blur', type: 'number' },
-            { validator: validateMargin, trigger: 'blur' }
+            { validator: validateMargin, trigger: 'blur', type: 'number' }
         ],
         accountid: [{ required: true, message: '请输入交易账号' }],
     }
@@ -54,3 +57,8 @@ export function hanldeOpenAndCloseComponent<T>() {
     }
     return { show, selected, close, open }
 }
+
+
+export function handlePermanceTemp() {
+
+}

+ 0 - 1
src/views/market/spot_trade/warehouse_pre_sale/warehouse_pre_sale_blocs/index.vue

@@ -43,7 +43,6 @@ export default defineComponent({
         function buyOpen(value: any) {
             componentId.value = 'postBuying';
             selectedRow.value = value;
-            console.log(value);
         }
         return {
             isBottom,

+ 0 - 346
src/views/market/spot_trade/warehouse_receipt_trade/warehouse_receipt_trade_blocs/components/post-buying/addPermance.vue

@@ -1,346 +0,0 @@
-<template>
-  <!--新增履约模板-->
-  <Drawer :title="'新增履约模板'"
-          :placement="'right'"
-          :visible="visible"
-          @cancel="cancel"
-          class="top600">
-    <a-spin :spinning="loading">
-      <div class="listed">
-        <a-form class="inlineForm dialogForm"
-                ref="formRef"
-                :model="formState"
-                :rules="rules">
-          <div class="formBar">
-            <a-row :gutter="24">
-              <a-col :span="24">
-                <a-form-item label="模版名称"
-                             name="name">
-                  <a-input class="commonInput"
-                           v-model:value="formState.name"
-                           placeholder="30天账期"
-                           style="width: 260px" />
-                </a-form-item>
-              </a-col>
-            </a-row>
-            <a-row class="tableTitle">
-              <a-col :span="7">步骤类型</a-col>
-              <a-col :span="6">步骤值(%)</a-col>
-              <a-col :span="7">距离上一步天数</a-col>
-              <a-col :span="4">操作</a-col>
-            </a-row>
-            <a-row class="tableContent"
-                   v-for="(parent, index) in formState.domains"
-                   :key="parent">
-              <a-col :span="7">
-                <a-form-item :name="['domains',index, 'steptypeid']"
-                             :rules="rules.domains.steptypeid">
-                  <a-select class="inlineFormSelect dialogTableSelect"
-                            style="width: 158px"
-                            placeholder="请选择"
-                            @change="stepTypeChange(parent)"
-                            v-model:value="parent.steptypeid">
-                    <a-select-option v-for="item in list"
-                                     :key="item.steptypeid"
-                                     :value="item.steptypeid">{{item.steptypename}}
-                    </a-select-option>
-                  </a-select>
-                </a-form-item>
-              </a-col>
-              <a-col :span="6">
-                <a-form-item :name="['domains',index, 'stepvalue']"
-                             :rules="rules.domains.stepvalue">
-                  <a-input-number class="commonInput dialogTableInput"
-                                  :disabled="isSummary(parent)"
-                                  style="width: 135px"
-                                  type="number"
-                                  v-model:value="parent.stepvalue"></a-input-number>
-                </a-form-item>
-              </a-col>
-              <a-col :span="7">
-                <a-form-item :name="['domains',index, 'stepdays']"
-                             :rules="rules.domains.stepdays">
-                  <a-input-number class="commonInput dialogTableInput"
-                                  style="width: 157px"
-                                  type="number"
-                                  v-model:value="parent.stepdays"></a-input-number>
-                </a-form-item>
-              </a-col>
-              <a-col :span="4">
-                <svg class="icon svg-icon"
-                     @click="deleteTemp(index)"
-                     v-if="showDeleteTemp(index)"
-                     aria-hidden="true">
-                  <use xlink:href="#icon-shanchu" />
-                </svg>
-                <PlusCircleOutlined v-if="showAddTempBtn(index)"
-                                    @click="addTemp()" />
-              </a-col>
-            </a-row>
-            <div class="noticeTip">
-              <div>注意事项:</div>
-              <div>1、买方支付汇总值必须为100%;</div>
-              <div>2、卖方收款汇总值必须为100%;</div>
-              <div>3、配置卖方收款之前要有买方支付,且其值不能多于买方支付的值。</div>
-            </div>
-          </div>
-          <a-row :gutter="24">
-            <a-col :span="24"
-                   class="fixedBtns">
-              <a-form-item class="btnCenter">
-                <a-button class="listedBtn"
-                          @click="submit">确定</a-button>
-              </a-form-item>
-            </a-col>
-          </a-row>
-        </a-form>
-      </div>
-    </a-spin>
-  </Drawer>
-</template>
-
-<script lang="ts">
-import { defineComponent, PropType, reactive, Ref, ref, UnwrapRef } from 'vue';
-import { Des } from '@/common/components/commonDes';
-import { _closeModal } from '@/common/setup/modal/modal';
-import Drawer from '@/common/components/drawer/index.vue';
-import { PlusOutlined, MinusOutlined, SearchOutlined, PlusCircleOutlined } from '@ant-design/icons-vue';
-import { QueryWrFriendApplyRsp, QueryWrPerformanceStepTypeRsp } from '@/services/go/wrtrade/interface';
-import { TempWrOrderQuoteDetail } from '@/views/market/spot_trade/components/post_buying/interface';
-import { queryQueryWrFriend, queryWrPerformanceStepType } from '@/services/go/wrtrade';
-import { message } from 'ant-design-vue';
-import { useQueryData } from '@/common/setup/request';
-import { AddPerformanceTemp, PerfomanceStempTempInfo } from '@/services/proto/performance/interface';
-import { validateAction } from '@/common/setup/form';
-import { PermanceTemp, PermanceTempForm } from './interface';
-import { getUserId } from '@/services/bus/account';
-import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
-import { addPerformanceTemp } from '@/services/proto/performance';
-import { geLoginID_number } from '@/services/bus/login';
-
-// 初始化 模板
-const initTemp = (): PermanceTemp => {
-    return { steptypeid: undefined, stepindex: 1, stepvalue: null, isauto: 0, remark: '', stepdays: null, steptypename: '' };
-};
-
-// 新增 模板
-const useAddTemp = (formState: UnwrapRef<PermanceTempForm>) => {
-    function addTemp() {
-        const temp = initTemp();
-        formState.domains.push(temp);
-    }
-    function showAddTempBtn(index: number) {
-        return index === formState.domains.length - 1;
-    }
-    return { addTemp, showAddTempBtn };
-};
-
-// 删除 模板
-const useDeleteTemp = (formState: UnwrapRef<PermanceTempForm>) => {
-    function deleteTemp(index: number) {
-        formState.domains.splice(index, 1);
-    }
-    function showDeleteTemp(index: number) {
-        return index !== 0;
-    }
-    return { deleteTemp, showDeleteTemp };
-};
-
-// 编辑 模板
-const useEditeTemp = (typeList: Ref<QueryWrPerformanceStepTypeRsp[]>) => {
-    function findTemp(item: PermanceTemp) {
-        return typeList.value.find((el) => el.steptypeid === item.steptypeid);
-    }
-    // 汇总
-    function isSummary({ steptypename }: PermanceTemp) {
-        return steptypename === '买方支付汇总' || steptypename === '卖方收款汇总' ? true : false;
-    }
-    // 切换步骤类型
-    function stepTypeChange(item: PermanceTemp) {
-        const stepType = findTemp(item)!;
-        item.steptypename = stepType.steptypename;
-        // 卖方收款汇总值必须为100%;
-        if (isSummary(item)) {
-            item.stepvalue = 100;
-        }
-    }
-    return { isSummary, stepTypeChange };
-};
-
-// 表单
-const userForm = () => {
-    const temp = initTemp();
-    const formRef = ref();
-    const formState: UnwrapRef<PermanceTempForm> = reactive({ domains: [temp], name: '' });
-    const findIndex = (name: string): number => formState.domains.findIndex((temp) => temp.steptypename === name);
-    const findItem = (name: string) => formState.domains.find((temp) => temp.steptypename === name);
-    const total = (name: string): number =>
-        formState.domains
-            .filter((temp) => temp.steptypename === name)
-            .reduce((acc, cur) => {
-                const { stepvalue } = cur;
-                return stepvalue ? acc + stepvalue : acc;
-            }, 0);
-    // 配置卖方收款之前要有买方支付
-    function validateSepeTypeId(value: any) {
-        const sellIndex = findIndex('卖方收款');
-        if (sellIndex !== -1) {
-            const buyIndex = findIndex('买方支付');
-            if (buyIndex > sellIndex) {
-                return Promise.reject('配置卖方收款之前要有买方支付');
-            }
-        }
-        return Promise.resolve();
-    }
-    function validateStepValue(value: any) {
-        const buyTotal = total('买方支付');
-        const sellTotal = total('卖方收款');
-        if (sellTotal > buyTotal) {
-            return Promise.reject('卖方收款不能多于买方付款');
-        }
-        return Promise.resolve();
-    }
-    const rules = {
-        name: { required: true, message: '请输入模版名称', trigger: 'blur' },
-        domains: {
-            steptypeid: [
-                { required: true, message: '请选择步骤类型' },
-                { required: true, validator: validateSepeTypeId },
-            ],
-            stepvalue: [
-                { required: true, message: '请输入步骤值', trigger: 'blur', type: 'number' },
-                { required: true, validator: validateStepValue },
-            ],
-            stepdays: { required: true, message: '请输入距离上一步天数', trigger: 'blur', type: 'number' },
-        },
-    };
-
-    return { formRef, formState, rules };
-};
-
-export default defineComponent({
-    emits: ['cancel', 'update'],
-    name: 'warehouse_receipt_trade_blocs_delisting',
-    components: { Des, Drawer, PlusOutlined, MinusOutlined, SearchOutlined, PlusCircleOutlined },
-    setup(props, context) {
-        const { visible, cancel } = _closeModal(context);
-        const loading = ref<boolean>(false);
-        // 步骤类型
-        const { list } = useQueryData<QueryWrPerformanceStepTypeRsp>(queryWrPerformanceStepType);
-        const { formRef, formState, rules } = userForm();
-
-        function submit() {
-            validateAction<PermanceTempForm>(formRef, formState).then((res) => {
-                const performancesteps: PerfomanceStempTempInfo[] = res.domains.map((el) => {
-                    const { steptypeid, stepvalue, stepdays, isauto, remark, stepindex } = el;
-                    return {
-                        steptypeid: steptypeid as number,
-                        stepvalue: stepvalue as number,
-                        stepdays: stepdays as number,
-                        isauto,
-                        remark,
-                        stepindex,
-                    };
-                });
-                const param: AddPerformanceTemp = {
-                    autoid: 0,
-                    templatename: res.name,
-                    userid: getUserId(),
-                    performancesteps,
-                    creatorid: geLoginID_number()!,
-                };
-                requestResultLoadingAndInfo(addPerformanceTemp, param, loading, ['新增履约模板成功', '新增履约模板失败:']).then(() => {
-                    cancel(true);
-                });
-            });
-        }
-        return {
-            loading,
-            list,
-            formRef,
-            formState,
-            rules,
-            submit,
-            ...useAddTemp(formState),
-            ...useDeleteTemp(formState),
-            ...useEditeTemp(list),
-            cancel,
-            visible,
-        };
-    },
-});
-</script>
-
-<style lang="less" scoped>
-.listed {
-    padding: 18px 10px 0;
-    .formBar {
-        height: calc(100% - 70px);
-        padding: 0;
-        .ant-row.tableTitle {
-            .ant-col {
-                height: 40px;
-                line-height: 40px;
-                white-space: nowrap;
-                text-align: center;
-                color: @m-grey1;
-                font-size: 14px;
-                border-right: 1px solid @m-black6;
-                border-top: 1px solid @m-black6;
-                border-bottom: 1px solid @m-black6;
-            }
-            .ant-col:first-child {
-                border-left: 1px solid @m-black6;
-            }
-        }
-        .ant-row.tableContent {
-            .ant-col {
-                // height: 40px;
-                line-height: 40px;
-                text-align: center;
-                border-right: 1px solid @m-black6;
-                border-bottom: 1px solid @m-black6;
-                .icon {
-                    color: @m-yellow8;
-                    font-size: 20px;
-                    cursor: pointer;
-                }
-                .anticon {
-                    font-size: 20px;
-                    color: @m-blue0;
-                    margin-left: 14px;
-                    cursor: pointer;
-                }
-            }
-            .ant-col:first-child {
-                border-left: 1px solid @m-black6;
-            }
-        }
-        .noticeTip {
-            width: 100%;
-            margin-top: 15px;
-            .flex;
-            flex-direction: column;
-            > div {
-                height: 30px;
-                line-height: 30px;
-                font-size: 14px;
-                color: @m-grey1;
-            }
-        }
-    }
-    .ant-form.inlineForm {
-        .ant-row.ant-form-item {
-            margin-bottom: 5px;
-        }
-        .ant-row.ant-form-item.ant-form-item-with-help {
-            white-space: nowrap;
-            margin-left: 2px;
-        }
-    }
-    .dialogTableSelect,
-    .dialogTableInput {
-        margin-left: 2px;
-    }
-}
-</style>

+ 3 - 7
src/views/market/spot_trade/warehouse_receipt_trade/warehouse_receipt_trade_blocs/components/post-buying/permancePlanTmp.vue

@@ -45,15 +45,11 @@ import { defineComponent, PropType, ref } from 'vue';
 import { Des } from '@/common/components/commonDes';
 import { _closeModal } from '@/common/setup/modal/modal';
 import Drawer from '@/common/components/drawer/index.vue';
-import { PlusOutlined, MinusOutlined, SearchOutlined } from '@ant-design/icons-vue';
-import { QueryPermancePlanTmpReq, QueryPermancePlanTmpRsp, QueryWrFriendApplyRsp } from '@/services/go/wrtrade/interface';
-import { TempWrOrderQuoteDetail } from '@/views/market/spot_trade/components/post_buying/interface';
-import { queryQueryPermancePlanTmp, queryQueryWrFriend } from '@/services/go/wrtrade';
-import { message } from 'ant-design-vue';
+import { QueryPermancePlanTmpReq, QueryPermancePlanTmpRsp } from '@/services/go/wrtrade/interface';
+import { queryQueryPermancePlanTmp } from '@/services/go/wrtrade';
 import { getUsrId } from '@/services/bus/user';
-import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import { queryTableList } from '@/common/setup/table';
-import Add from './addPermance.vue';
+import Add from '@/common/components/addPermanceTemp/index.vue';
 import { hanldeOpenAndCloseComponent } from './setup';
 
 export default defineComponent({

+ 0 - 1
src/views/market/spot_trade/warehouse_receipt_trade/warehouse_receipt_trade_blocs/index.vue

@@ -43,7 +43,6 @@ export default defineComponent({
         function buyOpen(value: any) {
             componentId.value = 'postBuying';
             selectedRow.value = value;
-            console.log(value);
         }
         return {
             isBottom,