123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- <template>
- <div>
- <a-modal
- centered
- wrapClassName="addGoodsShelve-modal"
- :footer="null"
- :maskClosable="false"
- title="设置结算账户"
- v-model="isshow"
- @cancle="close"
- :width="450">
- <a-spin :spinning="spinning" tip="Loading...">
- <a-alert :message="message" type="info" />
- <a-form-model
- id="userEdit-form"
- ref="ruleForm"
- :model="form"
- :rules="rules"
- :label-col="formItemLayout.labelCol"
- :wrapper-col="formItemLayout.wrapperCol"
- >
- <a-row :gutter="24">
- <a-col :span="24">
- <a-form-model-item label="配件经销商" prop="shelfSn" >
- <span>{{ form.dealerEntity?form.dealerEntity.dealerName:'--' }}</span>
- </a-form-model-item>
- </a-col>
- <a-col :span="24">
- <a-form-model-item label="平台商户号" prop="merchantNo" >
- <a-input id="userList-name" allowClear v-model.trim="form.merchantNo" placeholder="请输入平台商户号"/>
- </a-form-model-item>
- </a-col>
- <a-col :span="24">
- <a-form-model-item label="结算账户名" prop="bankAccount">
- <a-input id="userList-name" allowClear v-model.trim="form.merchantBankAccountEntity.bankAccount" placeholder="请输入结算账户名"/>
- </a-form-model-item>
- </a-col>
- <a-col :span="24">
- <a-form-model-item label="结算账户号" prop="bankCard">
- <a-input id="userList-name" allowClear v-model.trim="form.merchantBankAccountEntity.bankCard" placeholder="请输入结算账户号"/>
- </a-form-model-item>
- </a-col>
- <a-col :span="24">
- <a-form-model-item label="开户银行" prop="bankName">
- <a-input id="userList-name" allowClear v-model.trim="form.merchantBankAccountEntity.bankName" placeholder="请输入开户银行"/>
- </a-form-model-item>
- </a-col>
- </a-row>
- <a-form-model-item :label-col="{span: 0}" :wrapper-col="{span: 24}" style="text-align: center;">
- <a-button type="primary" @click="handleSubmit()" :style="{ marginRight: '8px' }">保存</a-button>
- <a-button :style="{ marginLeft: '8px' }" @click="close">取消</a-button>
- </a-form-model-item>
- </a-form-model>
- </a-spin>
- </a-modal>
- </div>
- </template>
- <script>
- import { saveMerchantAccount, merchantAccountDetail } from '@/api/merchantAccount.js'
- export default {
- name: 'AddGoodsShelve',
- props: {
- visible: {
- type: Boolean,
- default: false
- },
- nowData: {
- type: Object,
- default: function () {
- return null
- }
- }
- },
- data () {
- return {
- spinning: false,
- isshow: this.visible,
- message: '以下结算账户信息需要与进件时填写的资料保持一直否则将无法体现成功',
- pageInfo: null,
- formItemLayout: {
- labelCol: { span: 6 },
- wrapperCol: { span: 16 }
- },
- form: {
- dealerEntity: {
- dealerName: ''
- },
- merchantBankAccountEntity: {
- bankName: '', // 开户行
- bankAccount: '', // 账户名
- bankCard: '' // 账户号
- },
- merchantNo: '' // 保证金金额
- },
- rules: {
- merchantNo: [ { required: true, message: '请输入保证金金额', trigger: 'blur' } ],
- bankName: [ { required: true, message: '请输入开户银行', trigger: 'blur' } ],
- bankAccount: [ { required: true, message: '请输入结算账户名', trigger: 'blur' } ],
- bankCard: [ { required: true, message: '请输入结算账户号', trigger: 'blur' } ]
- }
- }
- },
- methods: {
- close (e) {
- this.form = {
- dealerEntity: {
- dealerName: ''
- },
- merchantBankAccountEntity: {
- bankName: '', // 开户行
- bankAccount: '', // 账户名
- bankCard: '' // 账户号
- },
- merchantNo: '' // 保证金金额
- }
- this.$refs.ruleForm.resetFields()
- this.$emit('close')
- },
- // 详情
- getMerchantAccountDetail () {
- this.spinning = true
- merchantAccountDetail({ merchantSn: this.nowData.merchantSn, merchantType: this.nowData.merchantType }).then(res => {
- if (res.status == 200) {
- this.form = Object.assign({}, res.data)
- } else {
- }
- this.spinning = false
- })
- },
- // 保存提交
- handleSubmit () {
- const _this = this
- this.$refs.ruleForm.validate(valid => {
- if (valid) {
- const params = JSON.parse(JSON.stringify(_this.form))
- params.id = _this.nowData && _this.nowData.id ? _this.nowData.id : null
- _this.spinning = true
- saveMerchantAccount(params).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.$emit('refresh')
- setTimeout(function () {
- _this.isshow = false
- _this.spinning = false
- }, 300)
- } else {
- _this.spinning = false
- }
- })
- } else {
- console.log('error submit!!')
- return false
- }
- })
- }
- },
- watch: {
- visible (newValue, oldValue) {
- this.isshow = newValue
- },
- isshow (newValue, oldValue) {
- if (!newValue) {
- this.form = {}
- this.close()
- this.$refs.ruleForm.resetFields()
- }
- },
- nowData: {
- handler (newValue, oldValue) {
- if (this.isshow && newValue) {
- if (this.nowData.id) { // 编辑
- this.getMerchantAccountDetail()
- }
- }
- },
- deep: true
- }
- }
- }
- </script>
- <style lang="less">
- .addGoodsShelve-modal{
- .ant-select-disabled .ant-select-selection{
- background-color: none !important;
- }
- }
- </style>
|