<!-- 产品保证金详情/编辑 -->
|
<template>
|
<el-container>
|
<el-main :style="{ padding: 0 }">
|
<ScrollToTab
|
:tabId="`#${tabScroll}`"
|
:contentId="`#${contentScroll}`"
|
:tabIndex="tabIndex"
|
@changeTab="changeTab"
|
ref="scrollTab"
|
>
|
<div class="scroll-content">
|
<ul
|
class="tab-scroll"
|
:id="tabScroll"
|
:style="{
|
height: `${clientHeight}px`,
|
}"
|
>
|
<li class="back-section">
|
<el-button size="small" icon="el-icon-back" round @click="goBack"
|
>返回列表</el-button
|
>
|
</li>
|
<li
|
v-for="(item, index) in treeList"
|
:key="index"
|
@click="changeTab(index, true)"
|
class="tab-list"
|
:class="{ active: tabIndex === index }"
|
>
|
<a>{{ item.tabname }}</a>
|
</li>
|
</ul>
|
<ul
|
class="content-scroll"
|
:id="contentScroll"
|
:style="{
|
height: `${clientHeight}px`,
|
}"
|
>
|
<li
|
v-for="(item, index) in treeList"
|
:key="index"
|
class="content-list"
|
>
|
<div
|
class="scroll-inner"
|
:style="{
|
minHeight:
|
index === treeList.length - 1
|
? `${clientHeight + 40}px`
|
: 'auto',
|
}"
|
>
|
<p class="scroll-title">{{ item.tabname }}</p>
|
<div class="inner-content">
|
<div class="form-content">
|
<el-form
|
v-if="item.tabname == '保证金信息'"
|
:inline="true"
|
ref="editForm"
|
:label-width="'180px'"
|
size="small"
|
:model="formValues"
|
:class="`form-cols-3`"
|
>
|
<!-- <div class="flex-container"> -->
|
<el-form-item
|
v-for="(item, index) in computedFormList"
|
:prop="item.name"
|
:key="index"
|
:label="item.label"
|
:class="[
|
{
|
'textarea-item':
|
item.type === 'textarea' || item.isLong,
|
},
|
{ 'textarea-grid': item.multiRow },
|
]"
|
>
|
<CommInput
|
:class="{ 'percent-input': item.showPercent }"
|
:info="item"
|
@updateValue="updateValue"
|
:showList="computedFormList"
|
></CommInput>
|
</el-form-item>
|
</el-form>
|
</div>
|
<!-- 交易申请记录模块 -->
|
<TableList
|
v-if="item.tabname == '交易申请记录'"
|
:list="records"
|
:header="tableHeader"
|
@handleCurrentChange="handleCurrentChange"
|
@handleSizeChange="handleSizeChange"
|
title="交易申请记录"
|
:loading="loading"
|
:isAutoIndex="true"
|
:pageInfo="pageInfo"
|
></TableList>
|
</div>
|
<div
|
v-if="canEdit"
|
class="tab-form-buttons"
|
style="
|
display: flex;
|
flex-direction: row;
|
justify-content: center;
|
"
|
>
|
<p style="margin: 0 40px 0 0">
|
<el-button class="comm-button" @click="goBack"
|
>返回</el-button
|
>
|
</p>
|
<p style="margin: 0 0 0 40px">
|
<el-button
|
class="comm-button"
|
type="primary"
|
@click="mainSubmit"
|
:loading="mainSubmitLoading"
|
>提交</el-button
|
>
|
</p>
|
</div>
|
</div>
|
</li>
|
<Dialog
|
v-model="isShowDialog"
|
icon="succ"
|
iconText="提交成功"
|
:buttons="[{ text: '确定', type: 'primary' }]"
|
@handleClick="goBack"
|
></Dialog>
|
</ul>
|
</div>
|
</ScrollToTab>
|
</el-main>
|
</el-container>
|
</template>
|
<script>
|
import {
|
qryProdList,
|
queryDepositList,
|
queryBankWaterInfo,
|
depositClaim,
|
qryBaseDepositInfo,
|
qryBaseDepositInfoMap,
|
saveBaseDepositInfo,
|
prodQueryDepositTransactionList, //查询保证金交易列表
|
} from "@comprehensive/serve/public";
|
import { MalQueryAcctTransactionHeader } from "@comprehensive/utils/tableHeaders";
|
import ScrollToTab from "./components/ScrollToTab";
|
import FormList from "./components/FormList";
|
import TableList from "./components/TableList";
|
import Dialog from "./components/Dialog.vue";
|
import FormInfo from "./components/FormInfo.vue";
|
import CommInput from "./components/CommInput.vue";
|
import KeysTable from "./components/KeysTable.vue";
|
export default {
|
components: {
|
ScrollToTab,
|
FormList,
|
TableList,
|
Dialog,
|
FormInfo,
|
CommInput,
|
KeysTable,
|
},
|
computed: {},
|
data() {
|
return {
|
serialNo: this.$route.params.id,
|
canEdit: this.$route.query.type == "edit" ? true : false, //是编辑还是详情
|
tabScroll: "tab_scroll",
|
contentScroll: "content_scroll",
|
tabIndex: 0,
|
clientHeight: 800,
|
treeList: [],
|
formValues: {},
|
computedFormList: [],
|
records: [],
|
tableHeader: [...MalQueryAcctTransactionHeader],
|
pageInfo: {
|
currentPage: 1,
|
pageSize: 10,
|
total: 0,
|
},
|
tableHeight: "560px",
|
loading: false,
|
mainSubmitLoading: false,
|
isShowDialog: false,
|
};
|
},
|
created() {
|
this.init();
|
},
|
mounted() {
|
this.setEleHeight();
|
window.addEventListener("resize", this.setEleHeight);
|
},
|
beforeDestroy() {
|
window.removeEventListener("resize", this.setEleHeight);
|
},
|
methods: {
|
init() {
|
this.serialNo = this.$route.params.id;
|
this.tabIndex = 0;
|
const baseTabs = [
|
{
|
tabname: "保证金信息",
|
exist: "Y",
|
},
|
{
|
tabname: "交易申请记录",
|
exist: "Y",
|
},
|
];
|
this.treeList = baseTabs.filter(
|
(item) => !(item.tabname === "交易申请记录" && this.canEdit)
|
);
|
this.requestQryBaseDepositInfoMap();
|
this.qryProdList();
|
if (!this.canEdit) {
|
this.requestProdQueryDepositTransactionList();
|
}
|
},
|
setEleHeight() {
|
const clientHeight = document.documentElement.clientHeight;
|
this.clientHeight = clientHeight || 800;
|
},
|
// 返回列表
|
goBack() {
|
this.isShowDialog = false;
|
window.history.go(-1);
|
},
|
// 切换tab的处理
|
changeTab(index, flg = false) {
|
this.tabIndex = index;
|
this.$refs.scrollTab.setScrollTop(index, flg);
|
this.$nextTick(() => this.$refs.scrollTab.setTabScrollTop());
|
},
|
//获取产品保证金基础数据
|
async requestQryBaseDepositInfoMap() {
|
const resp = await qryBaseDepositInfoMap({
|
serialNo: this.serialNo,
|
opt: this.canEdit ? 1 : 0,
|
});
|
if (resp.code == "00") {
|
this.computedFormList = Object.values(resp.result)
|
.filter((item) => item.visible !== false)
|
.map((item) => {
|
// 基础结构
|
const formItem = {
|
label: item.filedDescription, // 使用字段描述或字段名作为label
|
value: item.value || "", // 值
|
name: item.name, // 字段名
|
options: [], // 默认空选项
|
};
|
if (item.writeAble === false) {
|
// 不可编辑的字段设为input并添加只读属性
|
formItem.attrs = ["readonly"];
|
formItem.disable = true;
|
} else {
|
// 可编辑字段默认为select
|
formItem.disable = false;
|
}
|
if (item.name === "productName") {
|
if (this.canEdit) {
|
// formItem.type = "select"; // 产品名称用下拉框
|
// formItem.attrs = ["readonly"];
|
// formItem.disable = true;
|
formItem.type = "input";
|
} else {
|
formItem.type = "input";
|
}
|
} else {
|
formItem.type = "input";
|
}
|
if (item.name === "depositRatio") {
|
formItem.showPercent = true;
|
}
|
this.formValues[item.name] = resp.result[item.name].value;
|
return formItem;
|
});
|
}
|
},
|
// 产品名称下拉列表
|
async qryProdList() {
|
const res = await qryProdList({ productTypeNo: "" });
|
const { result } = res;
|
const { computedFormList } = this;
|
computedFormList.map((item) => {
|
if (item.name == "productName") {
|
item.options = [
|
{ label: "", value: "" }, // 保留空选项
|
...result.map((product) => ({
|
label: product.productName, // 将productName赋值给label
|
value: product.productCode, // 将productCode赋值给value
|
})),
|
];
|
}
|
});
|
},
|
//查询保证金交易列表
|
async requestProdQueryDepositTransactionList() {
|
const { serialNo, pageInfo } = this;
|
const resp = await prodQueryDepositTransactionList({
|
serialNo,
|
...pageInfo,
|
});
|
if (resp.code === "00") {
|
this.records = resp.result;
|
}
|
},
|
//保证金新增/修改
|
async saveBaseDepositInfo() {
|
this.isShowSubmit = false;
|
this.mainSubmitLoading = true;
|
const { formValues, serialNo } = this;
|
try {
|
const resp = await saveBaseDepositInfo({
|
serialNo,
|
...formValues,
|
});
|
this.mainSubmitLoading = false;
|
// 提交成功后存储标记
|
localStorage.setItem("refreshProductMarginManagement", "true");
|
//成功后,调弹窗
|
this.isShowDialog = true;
|
} catch (error) {
|
this.mainSubmitLoading = false;
|
}
|
},
|
|
updateValue(index, info) {
|
const { computedFormList, formValues } = this;
|
computedFormList.map((item) => {
|
if (item.name == info.name) {
|
item.value = index;
|
formValues[item.name] = index;
|
}
|
});
|
// if (info.name == "productName") {
|
// //获取相关保证金信息
|
// this.qryBaseDepositInfo(info.value);
|
// }
|
},
|
// 修改翻页数
|
handleCurrentChange(val) {
|
this.pageInfo.currentPage = val;
|
this.requestProdQueryDepositTransactionList();
|
},
|
// 修改翻页条数
|
handleSizeChange(val) {
|
this.pageInfo.pageSize = val;
|
this.requestProdQueryDepositTransactionList();
|
},
|
mainSubmit() {
|
this.saveBaseDepositInfo();
|
},
|
},
|
};
|
</script>
|
|
<style lang="postcss" scoped>
|
.detail-header {
|
display: flex;
|
& .header-right {
|
flex: 1;
|
}
|
& .header-right-inner {
|
display: flex;
|
background: #f9f9f9;
|
align-items: center;
|
margin: 0 0 10px;
|
background: #fff;
|
padding: 20px 20px 20px 10px;
|
box-shadow: 0px 0px 10px 4px rgba(0, 0, 0, 0.03);
|
& .header-steps {
|
flex: 1;
|
}
|
& .detail-header-control {
|
margin-left: 30px;
|
& >>> .el-button {
|
padding: 4px 5px;
|
border-radius: 2px;
|
border: 1px solid rgba(238, 238, 238, 1);
|
font-size: 12px;
|
color: rgba(119, 119, 119, 1);
|
}
|
}
|
|
& >>> .el-button--text {
|
padding-top: 20px;
|
}
|
}
|
}
|
|
.el-container .el-main {
|
padding: 16px 0;
|
}
|
.el-container .el-header {
|
padding: 0;
|
}
|
.main-tab {
|
padding: 20px;
|
}
|
.main-buttons {
|
display: flex;
|
width: 100%;
|
justify-content: center;
|
padding-top: 80px;
|
& >>> .el-button {
|
padding: 8px 41px;
|
}
|
& >>> .el-button--default {
|
margin-right: 33px;
|
}
|
}
|
.empty-tab {
|
width: 100%;
|
min-height: 550px;
|
}
|
.flex-container {
|
display: flex;
|
flex-wrap: wrap; /* 允许多行布局 */
|
}
|
.form-content {
|
& >>> .el-form {
|
display: grid;
|
padding-bottom: 6px;
|
& .el-form-item {
|
display: flex;
|
align-items: center;
|
padding-right: 40px;
|
margin: 0 0 24px 0;
|
& label {
|
padding: 0;
|
text-align: right;
|
margin-right: 10px;
|
line-height: 16px;
|
}
|
& .el-form-item__content {
|
flex: 1;
|
margin: 0;
|
}
|
&.right-item {
|
justify-content: right;
|
grid-column-start: 3;
|
grid-column-end: 4;
|
}
|
& .el-date-editor {
|
width: 100%;
|
}
|
& .el-input--small {
|
font-size: 14px;
|
}
|
& .el-select {
|
width: 100%;
|
}
|
}
|
& .form-sign {
|
& label::after {
|
content: ":";
|
}
|
}
|
}
|
|
& >>> .el-tag--info {
|
max-width: 94%;
|
overflow: hidden;
|
}
|
& >>> .el-select__tags-text {
|
display: inline-block;
|
max-width: 110px;
|
overflow: hidden;
|
white-space: nowrap;
|
text-overflow: ellipsis;
|
}
|
& .from-buttons {
|
/* padding-left: 82px; */
|
display: flex;
|
justify-content: flex-end;
|
& p {
|
margin: 0;
|
padding: 0;
|
}
|
& >>> .el-button {
|
height: 32px;
|
font-size: 12px;
|
margin-left: 12px;
|
}
|
& .normal-button {
|
height: 32px;
|
font-size: 14px;
|
margin-left: 22px;
|
}
|
& .el-button--primary {
|
background-color: #0081f0;
|
border-color: #0081f0;
|
}
|
}
|
& >>> .el-tag__close {
|
top: -5px;
|
right: -6px;
|
}
|
& >>> .el-form-item__label {
|
color: #888888;
|
}
|
& >>> .el-input__inner {
|
border-color: #eeeeee;
|
color: #222222;
|
}
|
|
& .is-error >>> .el-input__inner {
|
border-color: #f56c6c;
|
}
|
|
& .long-lable >>> .el-form-item__label {
|
line-height: 1.3em;
|
padding-top: 0;
|
}
|
& .textarea {
|
width: 100%;
|
& >>> textarea {
|
height: 100%;
|
}
|
}
|
& .range-separato {
|
width: 10px;
|
display: inline-block;
|
text-align: center;
|
}
|
& .range-input-item {
|
display: inline-block;
|
}
|
|
& .form-cols-1 {
|
grid-template-columns: 1fr;
|
& .textarea-item {
|
grid-column-start: 1;
|
grid-column-end: 1;
|
}
|
& .form-right {
|
grid-column-start: 1;
|
grid-column-end: 1;
|
}
|
}
|
|
& .form-cols-2 {
|
grid-template-columns: repeat(2, 1fr);
|
& .textarea-item {
|
grid-column-start: 1;
|
grid-column-end: 3;
|
}
|
& .form-right {
|
grid-column-start: 2;
|
grid-column-end: 3;
|
}
|
}
|
& .form-cols-3 {
|
grid-template-columns: repeat(3, 1fr);
|
& .textarea-item {
|
grid-column-start: 1;
|
grid-column-end: 4;
|
}
|
& .form-right {
|
grid-column-start: 3;
|
grid-column-end: 4;
|
}
|
}
|
|
& .form-cols-4,
|
& .form-cols-5 {
|
grid-template-columns: repeat(4, 1fr);
|
|
& .textarea-item {
|
grid-column-start: 1;
|
grid-column-end: 5;
|
}
|
& .form-right {
|
grid-column-start: 4;
|
grid-column-end: 5;
|
}
|
& .textarea-grid {
|
grid-column-start: 1;
|
grid-column-end: 1;
|
grid-row-end: span 3;
|
align-self: start;
|
&:nth-child(2) {
|
grid-column-start: 2;
|
grid-column-end: 2;
|
}
|
}
|
& .textarea-grid {
|
& >>> .el-textarea__inner {
|
height: 88px;
|
}
|
}
|
& .textarea-grid1 {
|
& >>> .el-textarea__inner {
|
height: 88px;
|
}
|
}
|
}
|
& .form-cols-5 {
|
grid-template-columns: repeat(5, 1fr);
|
& .form-right {
|
grid-column-start: 5;
|
}
|
|
& >>> .el-range-editor {
|
width: 215px !important;
|
}
|
}
|
}
|
|
.scroll-content {
|
display: flex;
|
& .tab-scroll {
|
width: 128px;
|
padding: 0 16px;
|
overflow-y: auto;
|
list-style: none;
|
font-size: 14px;
|
background: #fff;
|
&::-webkit-scrollbar {
|
width: 0px;
|
height: 10px;
|
}
|
& .tab-list {
|
padding: 0 10px 34px 0;
|
& a {
|
cursor: pointer;
|
font-weight: 400;
|
color: #222222;
|
&:hover {
|
color: #409eff;
|
}
|
}
|
|
&.active {
|
& a {
|
color: #0081f0;
|
}
|
}
|
}
|
& .back-section {
|
background: #fff;
|
border-radius: 0px 4px 0px 0px;
|
padding: 16px 16px 30px 0;
|
& >>> .el-button {
|
padding: 5px 9.5px;
|
border: none;
|
background: rgba(238, 238, 238, 1);
|
border-radius: 12px;
|
font-weight: 400;
|
color: #333333;
|
}
|
& >>> .el-button span {
|
margin-left: 2px;
|
font-size: 12px;
|
}
|
& >>> .el-button i {
|
font-weight: bold;
|
}
|
}
|
}
|
& .content-scroll {
|
flex: 1;
|
overflow-y: auto;
|
position: relative;
|
margin: 0 0 0 20px;
|
& .scroll-inner {
|
background: #fff;
|
box-shadow: 0px 0px 10px 4px rgba(0, 0, 0, 0.03);
|
margin-bottom: 20px;
|
& .scroll-title {
|
font-size: 16px;
|
border-bottom: solid 2px #eeeeee;
|
color: #000;
|
padding: 16px 20px;
|
margin-bottom: 10px;
|
font-weight: 500;
|
}
|
& .inner-content {
|
padding: 0 0 20px 20px;
|
& >>> .el-tabs__header {
|
margin: 0;
|
}
|
}
|
& .tab-form-buttons {
|
display: flex;
|
justify-content: center;
|
padding: 60px 0 30px 0;
|
& p {
|
margin: 0 40px 0 0;
|
}
|
& p:last-child {
|
margin-right: 0;
|
}
|
}
|
}
|
&::-webkit-scrollbar {
|
width: 0;
|
height: 10px;
|
}
|
& .last-scroll-inner {
|
min-height: 620px;
|
}
|
}
|
}
|
.apply-top-button {
|
& >>> .el-button {
|
margin-left: 20px;
|
}
|
}
|
.apply-info {
|
& >>> .clearCheckAll {
|
.el-table__header-wrapper .el-checkbox {
|
display: none;
|
}
|
}
|
}
|
|
.qrcode-content {
|
text-align: center;
|
& .qrode-close {
|
margin: 0;
|
padding: 0;
|
margin-bottom: 10px;
|
& i {
|
cursor: pointer;
|
font-size: 18px;
|
}
|
/* text-align: right; */
|
}
|
}
|
.percent-input::after {
|
content: "%";
|
position: absolute;
|
right: 10px;
|
top: 50%;
|
transform: translateY(-50%);
|
}
|
</style>
|