addPayment.vue
6.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<template>
<div>
<el-form ref="addPaymentForm" :model="addPaymentForm" :rules="addPaymentRules" label-width="100px" class="addPaymentForm">
<h4>商户信息</h4>
<el-divider></el-divider>
<el-form-item label="滴加商户名" prop="merchantName">
<el-input v-model="addPaymentForm.merchantName" suffix-icon="el-icon-arrow-down" placeholder="请选择使用该支付方式的滴加商户" @click.native="openSelectMerchant" style="width: 400px"></el-input>
</el-form-item>
<h4>应用信息</h4>
<el-divider></el-divider>
<el-form-item label="业务应用" prop="application">
<el-input v-model="addPaymentForm.application" suffix-icon="el-icon-arrow-down" placeholder="请选择使用该支付方式的业务应用" @click.native="openSelectApplication" style="width: 400px">
</el-input>
</el-form-item>
<h4>账户信息</h4>
<el-divider></el-divider>
<el-form-item label="收款账户" prop="account">
<el-input v-model="addPaymentForm.account" suffix-icon="el-icon-arrow-down" placeholder="请选择支付方式的收款账户" @click.native="openSelectAccount" style="width: 400px"></el-input>
</el-form-item>
<el-form-item label="结算分账" prop="settlement">
<el-radio-group v-model="addPaymentForm.settlement">
<el-radio :label="0">关闭</el-radio>
<el-radio :label="1">开启</el-radio>
</el-radio-group>
</el-form-item>
<div v-show="addPaymentForm.settlement">
<div v-for="(item, index) in counter" :key="index">
<el-form-item label="分账账户" prop="accounting">
<el-select v-model="addPaymentForm.accounting" placeholder="请选择分账账户" style="width: 400px">
<el-option label="区域一" value="shanghai"></el-option>
</el-select>
<el-button type="text" class="delcount" v-show="counter.length != 1 && index != 0" @click="delCount(index)">删除</el-button>
</el-form-item>
<el-form-item label="分账比例" prop="accounting_ratio">
<el-input v-model="addPaymentForm.accounting_ratio" placeholder="请输入分账比例,不超过30%" style="width: 400px" suffix-icon="el-icon-arrow-down"></el-input>
</el-form-item>
</div>
<el-form-item>
<el-button type="text" class="addcount" @click="addcount">添加分账账户</el-button>
</el-form-item>
</div>
<el-divider></el-divider>
<el-form-item>
<div class="footer_btns">
<el-button type="info" @click="cancelAdd">取消</el-button>
<el-button type="primary" @click="submitForm">保存</el-button>
</div>
</el-form-item>
</el-form>
<SelectMerchant ref="merchantLabel" @selectMerchant="handleCurrentChange" :dialogVisible="merchantDialogVisible"></SelectMerchant>
<SelectApplication ref="applicationLabel" :dialogVisible="applicationDialogVisible" @selectApplication="selectApplication"></SelectApplication>
<glsx-dialog :title="'选择账户'" :isVisible.sync="accountDialogVisible" :width="'900px'" @confirmDialog="handleConfirm" @closeDialog="accountDialogVisible = !accountDialogVisible">
<SelectAccount ref="accountLabel" v-if="accountDialogVisible"></SelectAccount>
</glsx-dialog>
<glsx-dialog title="'保存提示'" :isVisible.sync="isSaveDialogvisible" width="'900px'" @confirmDialog="handleConfirm" @closeDialog="isSaveDialogvisible = !isSaveDialogvisible">
<span>支付方式保存后,线上购买行为将以当前支付方式进行收款。是否确定保存?</span>
</glsx-dialog>
</div>
</template>
<script>
import SelectMerchant from './components/selectMerchant'
import SelectApplication from './components/selectApplication.vue'
import SelectAccount from './components/selectAccount.vue'
export default {
name: 'AddPayment',
components: {
SelectMerchant,
SelectApplication,
SelectAccount
},
data() {
return {
addPaymentForm: {
merchantName: '',
application: [],
account: '',
settlement: 0,
accounting: '',
accounting_ratio: ''
},
addPaymentRules: {
merchantName: [{ required: true, message: '请选择滴加用户', trigger: 'change' }],
application: [{ required: true, message: '请选择业务应用', trigger: 'change' }],
account: [{ required: true, message: '请选择收款账户', trigger: 'change' }],
settlement: [{ required: true, message: '请选择结算分账', trigger: 'change' }],
accounting: [{ required: true, message: '请选择分账账户', trigger: 'change' }],
accounting_ratio: [{ required: true, message: '请输入分账比例', trigger: 'blur' }]
},
counter: [],
// 对话框显示
merchantDialogVisible: false,
applicationDialogVisible: false,
accountDialogVisible: false
}
},
mounted() {
// console.log(this.$route.query)
this.addPaymentForm = this.$route.query
},
methods: {
// 动态添加分账账户
addcount() {
this.counter.push({})
},
// 取消添加支付方式
cancelAdd() {
this.$router.push({
path: '/payment/index'
})
},
delCount(index) {
this.counter.splice(index, 1)
},
// 提交表单
submitForm() {
this.$refs.addPaymentForm.validate((valid) => {
if (valid) {
alert('submit!')
} else {
console.log('error submit!!')
return false
}
})
},
// 打开选择滴加商户对话框
openSelectMerchant() {
this.merchantDialogVisible = true
this.$refs.merchantLabel.init()
},
// 打开选择业务应用对话框
openSelectApplication() {
this.applicationDialogVisible = !this.applicationDialogVisible
this.$refs.applicationLabel.init()
},
// 打开选择账户对话框
openSelectAccount() {
this.accountDialogVisible = !this.accountDialogVisible
this.$refs.accountLabel.init()
},
// 选择滴加商户
selectMerchant(val) {
console.log(val, 'input')
},
// 选择业务应用
selectApplication(val) {
console.log(val, 'input')
this.addPaymentForm.application = val
console.log(this.addPaymentForm.application, 'application')
},
handleConfirm() {
}
}
}
</script>
<style lang="scss" scoped>
.delcount {
margin-left: 12px;
font-weight: bold;
color: red;
}
h4 {
margin-left: 20px;
&:first-child {
padding-top: 18px;
}
}
.el-form-item {
margin-left: 28px;
}
.addPaymentForm {
background-color: #fff;
margin: 20px;
}
.footer_btns {
text-align: center;
margin-bottom: 12px;
}
.footer_btns .el-button {
padding: 12px 50px;
}
.addcount {
color: rgb(5, 173, 252);
font-weight: bold;
}
</style>