virtualAccountManagement.vue 10.2 KB
<!-- 虚拟管理 -->
<template>
  <div>
    <div class="d2-container-content" style="padding: 10px 20px;">
      <div class=" header" slot="header">
        <d2-search ref="showSearch" :search-form="searchForm" :form-data="showFormData">
        </d2-search>
        <div class="up-btns">
          <el-button :id="tableParams.btnId" size="small" type="primary">
            查询
          </el-button>
          <el-button size="small" @click="handleReset">
            重置
          </el-button>
        </div>
      </div>
    </div>
    <div class="d2-container-content">
      <!-- <span slot="left">
        <auth-button category="Button" :show-btn-ids="['9061003']" />
      </span> -->
      <d2-table ref="merchantTable" :get-list-api="getListApi" :search-form="searchFormSearch" :table-params="tableParams"
                :before-search-fn="beforeSearchFn">
        <template slot="yqMerchantName" slot-scope="scope">
          <div v-if="scope.scope.yseMerchantRefs && scope.scope.yseMerchantRefs.length > 0">
            <!-- width="200" -->
            <el-popover placement="top" trigger="hover">
              <div class="merchant-name-box">
                <!-- <div class="title">关联门店</div> -->
                <div class="merchant-item" v-for="(subItem, subIndex) in scope.scope.yseMerchantRefs" :key="subIndex">
                  {{ subItem.merchantName }}( {{ subItem.merchantId }})
                </div>
              </div>
              <div slot="reference">
                <img style="width: 14px;height: 13px;" src="../images/merchant_icon.png">
                <span>x {{ scope.scope.yseMerchantRefs.length }}</span>
              </div>
            </el-popover>
          </div>
          <div v-else>
            <span style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{ '-' }}</span>
          </div>
        </template>
        <!-- <auth-button slot="auth-button" slot-scope="scope" :data="scope.scope" /> -->
        <div slot="auth-button" slot-scope="scope">
          <!--  <auth-button slot="auth-button" :show-btn-ids="['9061001']" :data="scope.scope" /> -->
          <auth-button slot="auth-button" :show-btn-ids="['9061004', '9061005', '9061006']" :data="scope.scope" />
        </div>
      </d2-table>
    </div>
    <subordinateMerchantDialog v-if="subordinateMerchantVisible"
                               :subordinate-merchant-visible="subordinateMerchantVisible" :sub-shop-merchant-info="merchantRow"
                               @dialogClose="colseSubordinateMerchant"></subordinateMerchantDialog>
    <virtualAccountManagementDetailDialog :account-detail-visible="accountDetailVisibleDialog" :merchant-row="merchantRow"
                                          @dialogClose="accountDetailVisibleDialog = false">
    </virtualAccountManagementDetailDialog>
    <baseDialog :is-show.sync="accountDetailVisible" :config="dialogConfig.setting" :dialog-config="dialogConfig.config"
                @closeDialog="handleDetailClose">
      <account-detail v-if="accountDetailVisible" :account-detail-visible="accountDetailVisible"
                      :merchant-row="merchantRow" />
    </baseDialog>
  </div>
</template>

<script>
import { Util, deepClone } from '@/common/util'
import { yseMerchantPage } from '@api/publicAccount'
import { mapActions } from 'vuex'
import { merchantClassifyList, receiptModeList } from '@/common/constants'
import subordinateMerchantDialog from './components/subordinateMerchantDialog'
import virtualAccountManagementDetailDialog from './components/virtualAccountManagementDetailDialog'
import accountDetail from './accountDetail'
export default {
  name: 'VirtualAccountManagement',
  components: {
    accountDetail,
    subordinateMerchantDialog,
    virtualAccountManagementDetailDialog
  },
  data() {
    return {
      merchantStoreServiceList: merchantClassifyList,
      subordinateMerchantVisible: false,
      accountDetailVisibleDialog: false,
      subShopMerchantInfo: {},
      subShopMerchantInfoLabelList: [{
        label: '企业信息',
        key: ''
      }, {
        label: '企业信息',
        key: ''
      }, {
        label: '企业信息',
        key: ''
      }, {
        label: '企业信息',
        key: ''
      }],
      // 账户详情
      accountDetailVisible: false,
      // settingDetailVisible: false,
      merchantRow: {},
      // 搜索
      searchForm: {
        yseUserCode: '',
        merchantName: '',
        merchantIdFuzzy: '',
        receiptMode: ''
      },
      searchFormSearch: {},
      showFormData: [
        {
          label: '虚账编码',
          name: 'yseUserCode',
          type: 'input',
          isClear: true,
          maxlength: '20',
          placeholder: '请输入虚账编码',
          keyFn: this.keyDowmGetList
        },
        {
          label: '商户名称',
          name: 'merchantName',
          type: 'input',
          maxlength: '50',
          isClear: true,
          placeholder: '请输入商户名称',
          keyFn: this.keyDowmGetList
        },
        {
          label: '商户号',
          name: 'merchantIdFuzzy',
          type: 'input',
          inputType: 'number',
          maxlength: '20',
          isClear: true,
          placeholder: '请输入商户号',
          keyFn: this.keyDowmGetList
        }, {
          label: '到账模式',
          name: "receiptMode",
          type: "select",
          optionList: [],
          optionId: "confId",
          optionLabel: "confValue",
          optionsName: "receiptModeList"
        }
      ],
      // 表格
      getListApi: yseMerchantPage,
      tableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: 'list',
        tableOption: true,
        tableColumns: [
          {
            label: '虚账编码',
            prop: 'yseUserCode'
          }, {
            label: '到账模式',
            prop: 'receiptMode',
            formatter: (cellValue) => {
              return cellValue.receiptMode == '1' ? 'T+1' : cellValue.receiptMode == '2' ? 'D+1' : '-'
            }
          }, {
            label: '关联商户数量',
            prop: 'yqMerchantName',
            type: 'slot',
            addHtml: 'yqMerchantName',
            width: 140
          },
          {
            label: '创建时间',
            prop: 'openedTime',
            formatter: (cellValue) => {
              return Util.dateFormate(cellValue.openedTime, 'YYYY-MM-DD HH:mm:ss')
            }
          }]
      },
      tableDetailParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: 'list',
        // tableOption: true,
        tableColumns: [
          {
            label: '商户名称',
            prop: 'merchantName'
          }, {
            label: '商户号',
            prop: 'merchantId'
          },
          {
            label: '商户分类',
            prop: 'merchantType',
            formatter: (cellValue) => {
              return cellValue.merchantType
                ? merchantStoreServiceList.find(item => item.confId ==
                  cellValue.merchantType).confLabel
                : ''
            }
          }]
      },
      baseData: {
        receiptModeList: JSON.parse(JSON.stringify(receiptModeList))
      },
      dialogConfig: {
        setting: {
          showClose: true,
          appendToBody: false,
          // width: '720px',
          btnList: [
          ]
        },
        config: {
          title: '账户详情',
          width: '720px'
        }
      }
    }
  },
  mounted() {
    this.getBaseData()
  },

  methods: {
    ...mapActions({
      get: 'd2admin/base/get',
      close: 'd2admin/page/close'
    }),
    handleOperationRecords(row) {
      this.merchantRow = row
      this.accountDetailVisibleDialog = true
    },
    handleDetail(row) {
      this.merchantRow = row
      this.merchantRow.merchantId = row.id
      this.accountDetailVisible = true
      // yseMerchantGetDetail({ merchantId: row.id }).then(res => {
      //   console.log(res, 'res')
      //   this.subShopMerchantInfo = res
      // }).catch((err) => {
      //   console.log(err)
      // })
    },
    // 关闭下级商户配置弹窗
    colseSubordinateMerchant(flag) {
      this.subordinateMerchantVisible = !this.subordinateMerchantVisible
      flag && this.$refs.merchantTable.refreshTable()
    },
    // associationSettings() {
    //   this.settingDetailVisible = true
    // },
    async getBaseData() {
      // this.baseData.channelTypeList = await this.get(BaseData.channelType)
      this.getOptionsList()
    },
    handleCustomerAssociation(row) {
      console.log(row, 'row')
      this.merchantRow = row
      this.subordinateMerchantVisible = true
    },
    getOptionsList() {
      this.showFormData.forEach((item, index) => {
        if (item.type === 'select') {
          if (this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this.showFormData[index].optionLabel] !== '全部') {
            const temp = {}
            temp[this.showFormData[index].optionId] = ''
            temp[this.showFormData[index].optionLabel] = '全部'
            this.baseData[item.optionsName].unshift(temp)
          }
          this.$set(this.showFormData[index], 'optionList', this.baseData[item.optionsName])
        }
      })
    },
    handleReset() {
      this.searchForm = {
        yseUserCode: '',
        merchantName: '',
        merchantIdFuzzy: '',
        receiptMode: ''
      }
      this.$refs.merchantTable.resetRefreshTable()
    },

    beforeSearchFn() {
      return new Promise(resolve => {
        this.searchFormSearch = deepClone(this.searchForm)
        resolve()
      })
    },

    keyDowmGetList() {
      this.$refs.merchantTable.refreshTable()
    },

    handleDetailClose() {
      // console.log('visible')
      this.accountDetailVisible = !this.accountDetailVisible
    }
  }
}

</script>
<style>
.header {
  background-color: #fff;
}

.el-cascader-panel .el-cascader-menu {
  width: 260px;
}
</style>