Browse Source

供应商管理新增设置结算账户信息

1004749546@qq.com 4 years ago
parent
commit
88d6907aee

+ 16 - 0
src/api/supplierManagement.js

@@ -43,3 +43,19 @@ export const supplierView = params => {
     method: 'post'
   })
 }
+// 根据供应商SN查询可用账户信息
+export const supplierBankQuery = params => {
+  return axios.request({
+    url: `/supplierBankAccount/queryEnableBySupplierSn`,
+    data: params,
+    method: 'post'
+  })
+}
+// 保存结算账户信息
+export const supplierBankSave = params => {
+  return axios.request({
+    url: `/supplierBankAccount/save`,
+    data: params,
+    method: 'post'
+  })
+}

+ 156 - 0
src/views/supplierManagement/SupplierBankModal.vue

@@ -0,0 +1,156 @@
+<template>
+  <div>
+    <a-modal
+      class="modalBox"
+      title="结算账户信息"
+      v-model="isshow"
+      @cancle="cancel"
+      :footer="null"
+      :width="600"
+      :centered="true">
+      <a-form-model ref="ruleForm" :model="form" :rules="rules" :labelCol="{span:5}" :wrapperCol="{span:15}">
+        <a-form-model-item required label="平台商户号" prop="merchantNo">
+          <a-input v-model="form.merchantNo" :maxLength="30" placeholder="请输入平台商户号" allowClear id="supplierBankModal-merchantNo" />
+        </a-form-model-item>
+        <a-form-model-item required label="结算账户名" prop="bankAccount">
+          <a-input v-model="form.bankAccount" :maxLength="30" placeholder="请输入结算账户名" allowClear id="supplierBankModal-bankAccount" />
+        </a-form-model-item>
+        <a-form-model-item required label="结算账户号" prop="bankCard">
+          <a-input v-model="form.bankCard" :maxLength="30" placeholder="请输入结算银行卡号" allowClear id="supplierBankModal-bankCard" />
+        </a-form-model-item>
+        <a-form-model-item required label="开户银行" prop="bankName">
+          <a-input v-model="form.bankName" :maxLength="30" placeholder="请输入开户银行名称" allowClear id="supplierBankModal-bankName" />
+        </a-form-model-item>
+        <a-form-model-item label="说明">
+          <span>结算账户信息需要同进件时填写的资料保持一致,否则将无法提现成功</span>
+        </a-form-model-item>
+        <a-form-model-item class="submit-cont" :wrapper-col="{ span: 14, offset: 9 }">
+          <a-button type="primary" id="supplierBankModal-submit" @click="submitForm('ruleForm')">
+            确定
+          </a-button>
+          <a-button id="supplierBankModal-cancle" style="margin-left: 20px" @click="cancel">
+            取消
+          </a-button>
+        </a-form-model-item>
+      </a-form-model>
+    </a-modal>
+  </div>
+</template>
+
+<script>
+import { supplierBankQuery, supplierBankSave } from '@/api/supplierManagement.js'
+export default {
+  name: 'SupplierBankModal',
+  props: {
+    openSettingModal: {
+      type: Boolean,
+      default: false
+    },
+    // 供应商编码
+    supplierSn: {
+      type: String,
+      default: ''
+    }
+  },
+  watch: {
+    openSettingModal (newValue, oldValue) {
+      this.isshow = newValue
+    },
+    isshow (val) {
+      if (!val) {
+        this.$refs['ruleForm'].resetFields()
+        this.$emit('close')
+      } else {
+        if (this.supplierSn) {
+          this.getSupplierBankAccount()
+        }
+      }
+    }
+  },
+  data () {
+    return {
+      isshow: this.openSettingModal,
+      form: {
+        merchantNo: '', // 平台商户号
+        bankAccount: '', // 结算账户名
+        bankCard: '', // 结算账户号
+        bankName: '', // 开户银行
+        supplierBankAccountSn: '' // 序列号
+      },
+      rules: {
+        merchantNo: [{
+          required: true,
+          message: '请输入平台商户号',
+          trigger: ['change', 'blur']
+        }],
+        bankAccount: [{
+          required: true,
+          message: '请输入结算账户名',
+          trigger: ['change', 'blur']
+        }],
+        bankCard: [{
+          required: true,
+          message: '请输入结算银行卡号',
+          trigger: ['change', 'blur']
+        }],
+        bankName: [{
+          required: true,
+          message: '请输入开户银行名称',
+          trigger: ['change', 'blur']
+        }]
+      }
+    }
+  },
+  methods: {
+    // 根据供应商SN查询可用账户信息
+    getSupplierBankAccount () {
+      supplierBankQuery({ supplierSn: this.supplierSn }).then(res => {
+        if (res.status == 200) {
+          if (res.data) {
+            this.form = Object.assign(res.data, {})
+          }
+        }
+      })
+    },
+    // 提交
+    submitForm (formName) {
+      this.$refs[formName].validate(valid => {
+        if (valid) {
+          const params = {
+            supplierBankAccountSn: this.form.supplierBankAccountSn,
+            supplierSn: this.supplierSn,
+            merchantNo: this.form.merchantNo, // 平台商户号
+            bankAccount: this.form.bankAccount, // 结算账户名
+            bankCard: this.form.bankCard, // 结算账户号
+            bankName: this.form.bankName // 开户银行
+          }
+          supplierBankSave(params).then(res => {
+            if (res.status == 200) {
+              this.$message.success(res.message)
+              this.$emit('refresh')
+              setTimeout(() => {
+                this.cancel()
+              }, 300)
+            }
+          })
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    },
+    // 关闭弹窗
+    cancel () {
+      this.$refs['ruleForm'].resetFields()
+      this.$emit('close')
+    }
+  }
+
+}
+</script>
+
+<style scoped="scoped">
+  .submit-cont {
+    padding-top: 50px;
+  }
+</style>

+ 110 - 23
src/views/supplierManagement/SupplierList.vue

@@ -60,39 +60,115 @@
           v-if="$hasPermissions('B_supplier_edit')"
           id="supplier-edit"
           @click="handleEdit(record)"
-          class="actionBtn icon-blues"
-        />
-        <span v-else>--</span>
+          class="actionBtn icon-blues" />
+        <a-icon
+          type="setting"
+          v-if="$hasPermissions('B_supplier_setting')"
+          title="设置账户信息"
+          id="supplier-setting"
+          @click="handleSet(record)"
+          class="actionBtn icon-orange" />
+        <span v-if="!$hasPermissions('B_supplier_edit') && !$hasPermissions('B_supplier_setting')">--</span>
       </template>
     </s-table>
 
     <!-- 编辑 门店所属组织 -->
     <supplier-modal :openModal="openModal" :supplierSn="supplierSn" @success="storeSubmit" @close="openModal=false" />
+    <!-- 编辑结算信息 -->
+    <supplierBank-modal :openSettingModal="openSettingModal" :supplierSn="supplierSn" @refresh="handleSetSubmit" @close="openSettingModal=false" />
   </a-card>
 </template>
 
 <script>
-import { STable, VSelect } from '@/components'
+import {
+  STable,
+  VSelect
+} from '@/components'
 import SupplierModal from './SupplierModal.vue'
-import { findOrgTree } from '@/api/atorg.js'
-import { supplierListQuery } from '@/api/supplierManagement.js'
+import SupplierBankModal from './SupplierBankModal.vue'
+import {
+  findOrgTree
+} from '@/api/atorg.js'
+import {
+  supplierListQuery
+} from '@/api/supplierManagement.js'
 export default {
   name: 'StoreManagement',
-  components: { STable, VSelect, SupplierModal },
+  components: {
+    STable,
+    VSelect,
+    SupplierModal,
+    SupplierBankModal
+  },
   data () {
     return {
       queryParam: {
         name: '', //  供应商名称
         orgCode: null //  组织机构
       },
-      columns: [
-        { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
-        { title: '组织机构', scopedSlots: { customRender: 'orgCode' }, width: 150, align: 'center' },
-        { title: '供应商名称', dataIndex: 'name', width: 120, align: 'center' },
-        { title: '联系人', dataIndex: 'manager', width: 100, align: 'center', customRender: (text, record, index) => { return text || '--' } },
-        { title: '手机号码', dataIndex: 'managerMobile', width: 100, align: 'center' },
-        { title: '座机号码', dataIndex: 'tel', customRender: (text, record, index) => { return text || '--' }, width: 80, align: 'center' },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 120, align: 'center' }
+      columns: [{
+        title: '序号',
+        dataIndex: 'no',
+        width: 60,
+        align: 'center'
+      },
+      {
+        title: '组织机构',
+        scopedSlots: {
+          customRender: 'orgCode'
+        },
+        width: 150,
+        align: 'center'
+      },
+      {
+        title: '供应商名称',
+        dataIndex: 'name',
+        width: 120,
+        align: 'center'
+      },
+      {
+        title: '联系人',
+        dataIndex: 'manager',
+        width: 100,
+        align: 'center',
+        customRender: (text, record, index) => {
+          return text || '--'
+        }
+      },
+      {
+        title: '手机号码',
+        dataIndex: 'managerMobile',
+        width: 100,
+        align: 'center',
+        customRender: (text, record, index) => {
+          return text || '--'
+        }
+      },
+      {
+        title: '座机号码',
+        dataIndex: 'tel',
+        width: 80,
+        align: 'center',
+        customRender: (text, record, index) => {
+          return text || '--'
+        }
+      },
+      {
+        title: '平台商户号',
+        width: 100,
+        align: 'center',
+        customRender: (text, record, index) => {
+          return record.supplierBankAccountEntity ? record.supplierBankAccountEntity.merchantNo : '--'
+        }
+      },
+      {
+        title: '操作',
+        width: 100,
+        align: 'center',
+        scopedSlots: {
+          customRender: 'action'
+        }
+      }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -118,6 +194,7 @@ export default {
         })
       },
       openModal: false, //  编辑 门店所属组织  弹框展示状态
+      openSettingModal: false, // 编辑结算信息弹窗
       supplierSn: '', // 供应商信息
       supplierName: '', // 供应商名称
       treeData: [] //  组织机构
@@ -140,11 +217,21 @@ export default {
       this.supplierSn = item.supplierSn
       this.openModal = true
     },
-    // 编辑  提交成功
+    // 编辑供应商  提交成功
     storeSubmit () {
       this.$refs.table.refresh()
       this.openModal = false
     },
+    // 编辑结算账户信息
+    handleSet (item) {
+      this.supplierSn = item.supplierSn
+      this.openSettingModal = true
+    },
+    // 编辑结算账户信息  提交成功
+    handleSetSubmit () {
+      this.$refs.table.refresh()
+      this.openSettingModal = false
+    },
     //  重置
     reset () {
       this.$refs.queryForm.resetFields()
@@ -162,11 +249,11 @@ export default {
 </script>
 
 <style lang="less">
-.StoreManagement {
-	.table-page-search-wrapper {
-		.search-btn {
-			margin-right: 10px;
-		}
-	}
-}
+  .StoreManagement {
+    .table-page-search-wrapper {
+      .search-btn {
+        margin-right: 10px;
+      }
+    }
+  }
 </style>