onlineAccountList.vue 17.7 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 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521
<!-- 线上分账 -->
<template>
  <div class="purchase">
    <div class="container">
      <GLCombiForm ref="showSearch"
                   :rowNumber="1"
                   :formObj="searchForm"
                   :formData="showFormData"
                   :search-select-obj="searchSelectObj"
                   @handleOk="handleSearch"
                   @handleRest="handleReset"></GLCombiForm>
      <div class="table-header">
        <span class="priceSpan">共<span
                class="count-txt">{{ countObj.orderCount }}</span>笔订单,累计分账金额<span
                class="count-txt">{{ countObj.divisionMoneyCount }}</span>元,分账成功金额<span
                class="count-txt">{{ countObj.divisionSuccessMoneyCount }}</span>元,分账中金额<span
                class="count-txt">{{ countObj.inDivisionMoneyCount }}</span>元,分账失败金额<span
                class="count-txt">{{ countObj.divisionFailureMoneyCount }}</span>元,异常分账金额<span
                class="count-txt">{{ countObj.divisionExceptionMoneyCount }}</span>元。</span>
        <el-button type="primary"
                   class="btn"
                   size="small"
                   @click="exportExcel">导出</el-button>
      </div>

      <!-- 表格区域 开始 -->
      <el-table :data="tableList">
        <el-table-column label="序号"
                         type="index"
                         width="60px"
                         :index="index=>index+(page.currentPage - 1) * page.pageSize + 1"
                         align="center" />
        <el-table-column label="主订单编号"
                         prop="orderCode"
                         align="center"
                         width="150px">
          <template slot-scope="scope">
            <span>{{ scope.row.orderCode || '-' }}</span>
          </template>
        </el-table-column>
        <el-table-column label="交易参考号"
                         prop="tradeNo"
                         align="center"
                         width="150px">
          <span
                slot-scope="scope">{{ scope.row.payOrder ? scope.row.payOrder.tradeNo : '-' }}</span>
        </el-table-column>
        <el-table-column label="分账类型"
                         width="90px"
                         align="center">
          <span>线上分账</span>
        </el-table-column>
        <!-- <el-table-column label="园区店名" -->
        <el-table-column label="服务对接"
                         prop="yqMerchantName"
                         align="center"
                         width="170">
          <span
                slot-scope="scope">{{ scope.row.yqMerchantName ? scope.row.yqMerchantName : '-' }}</span>
        </el-table-column>
        <el-table-column label="支付金额"
                         prop="payMoney"
                         width="90px"
                         align="center">
          <template slot-scope="scope">
            <span>{{ scope.row.payMoney ? ('¥' + scope.row.payMoney) : '-' }}</span>
          </template>
        </el-table-column>
        <el-table-column label="总分账金额"
                         prop=""
                         width="110px"
                         align="center">
          <span slot-scope="scope">{{ '¥' + scope.row.divisionMoney }}</span>
        </el-table-column>
        <el-table-column prop="actualIncomeMoney "
                         label="实收金额"
                         width="90px"
                         align="center">
          <template slot-scope="scope">
            <span>{{ scope.row.actualIncomeMoney ? ('¥' + scope.row.actualIncomeMoney) : '-' }}</span>
          </template>
        </el-table-column>
        <!-- <el-table-column label="嘀加智慧云实际分账金额"
                         prop="glActualDivisionMoney"
                         align="center"
                         width="100px">
          <template slot-scope="scope">
            {{scope.row.glActualDivisionMoney ? ('¥' + scope.row.glActualDivisionMoney) : '-'}}
          </template>
        </el-table-column> -->
        <el-table-column label="平台方"
                         align="center">
          <el-table-column label="名称"
                           prop="actualDivisionPlatform"
                           align="center"
                           width="100px">
            <!-- <span slot-scope="scope">{{scope.row.partnerMerchantName}}</span> -->
          </el-table-column>
          <el-table-column label="实际分账金额"
                           prop="glActualDivisionMoney"
                           width="120px"
                           align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.glActualDivisionMoney ? ('¥' + scope.row.glActualDivisionMoney) : '-' }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="服务商"
                         align="center">
          <el-table-column label="名称"
                           prop="partnerMerchantName1"
                           align="center"
                           width="100px">
            <template slot-scope="scope">
              <span>{{ scope.row.serviceInfos[0] ? scope.row.serviceInfos[0].merchantName : '-' }}</span>
            </template>
          </el-table-column>
          <el-table-column label="实际分账金额"
                           prop="partnerDivisionMoney1"
                           width="120px"
                           align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.serviceInfos[0] ? ('¥' + scope.row.serviceInfos[0].divisionMoney) : '-' }}</span>
            </template>
          </el-table-column>
          <el-table-column label="名称"
                           prop="partnerMerchantName2"
                           align="center"
                           width="100px">
            <template slot-scope="scope">
              <span>{{ scope.row.serviceInfos[1] ? scope.row.serviceInfos[1].merchantName : '-' }}</span>
            </template>
          </el-table-column>
          <el-table-column label="实际分账金额"
                           prop="partnerDivisionMoney2"
                           width="120px"
                           align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.serviceInfos[1] ? ('¥' + scope.row.serviceInfos[1].divisionMoney) : '-' }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="流量方"
                         align="center">
          <el-table-column label="名称"
                           prop="realityShopMerchantName"
                           align="center"
                           width="100px">
            <template slot-scope="scope">
              <span>{{ scope.row.realityShopMerchantName || '-' }}</span>
            </template>
          </el-table-column>
          <el-table-column label="实际分账金额"
                           prop="shopDivisionMoney"
                           width="120px"
                           align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.shopDivisionMoney ? ('¥' + scope.row.shopDivisionMoney) : '-' }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <!-- </el-table-column> -->
        <el-table-column label="分账状态"
                         prop="divisionStatus"
                         width="90px"
                         align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.divisionStatus"
                  :style="{ 'color': [4, 5].includes(+scope.row.divisionStatus) ? 'red' : '#606266' }">{{ baseData.divisionStatusList.find(item => +item.confId === scope.row.divisionStatus).confLabel }}</span>
            <span v-else>-</span>
          </template>
        </el-table-column>
        <el-table-column label="分账时间"
                         prop="divisionDateStr"
                         align="center"
                         width="180px" />
        <el-table-column label="订单支付时间"
                         prop="successDateStr"
                         align="center"
                         width="180px" />
        <el-table-column label="订单类型"
                         prop="orderType"
                         width="90px"
                         align="center">
          <span
                slot-scope="scope">{{ scope.row.goodsOrder ? baseData.orderTypeList.find(item => +item.confId === scope.row.goodsOrder.orderType).confLabel : '无' }}</span>
        </el-table-column>
      </el-table>
      <el-pagination background
                     @size-change="handleSizeChange"
                     @current-change="handleCurrentChange"
                     :current-page="page.currentPage"
                     :page-sizes="[10,20,30,40]"
                     :page-size="page.pageSize"
                     :total="total"
                     layout="sizes,total,->,prev,pager,next,jumper" />
      <!-- 表格区域 end -->
    </div>
  </div>
</template>

<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import { Util } from '@/common/util'
import { orderTypeList, divisionStatusList, exportFn } from '@/common/constant.js'
export default {
  name: 'OnlineAccountList',
  data() {
    return {
      sessionInfo: this.$globalState.session,
      size: 'small',
      url: url,
      searchForm: {
        // 线上
        divisionType: '2',
        divisionDate: '',
        successDate: '',
        divisionStatus: '',
        yqMerchantId: '',
        orderType: ''
      },
      searchSelectObj: {
        orderOrTrade: {
          attr: 'orderCode',
          value: ''
        },
        // divisionOrPayDate: {
        //   attr: 'divisionDate',
        //   value: ''
        // }
      },
      // tableData: tableData,
      showFormData: [
        {
          label: '支付时间',
          name: 'successDate',
          type: 'datePicker',
          isClear: true,
          pickerOptions: 'beforeRangePickerOptions'
        }, {
          label: '分账时间',
          name: 'divisionDate',
          type: 'datePicker',
          isClear: true,
          pickerOptions: 'beforeRangePickerOptions'
        },
        {
          type: 'selectInput',
          selectName: 'orderOrTrade',
          isClear: true,
          selectOption: [{
            label: '主订单编号',
            name: 'orderCode'
          }, {
            label: '交易参考号',
            name: 'tradeNo'
          }],
          handleSelectChange: (value) => {
            this.searchSelectObj.orderOrTrade.value = ''
          }
        },
        {
          label: '分账状态',
          name: 'divisionStatus',
          type: 'select',
          optionList: [],
          optionId: 'confId',
          optionLabel: 'confLabel',
          optionsName: 'divisionStatusList'
        },
        {
          label: '服务对接',
          name: 'yqMerchantId',
          type: 'select',
          optionList: [],
          optionId: 'merchantId',
          optionLabel: 'merchantName',
          optionsName: 'parkServiceList'
        }, {
          label: '商户名称',
          name: 'merchantNameKeyWord',
          type: 'input',
          placeholder: '请输入服务对接/服务商/导流方名称',
          isClear: true
        }, {
          label: '订单类型',
          name: 'orderType',
          type: 'select',
          optionList: [],
          optionId: 'confId',
          optionLabel: 'confLabel',
          optionsName: 'orderTypeList'
        }
      ],
      // 表格
      getListApi: this.$apis.account.getSeviceList,
      // 表格
      tableList: [],
      // 基本数据
      baseData: {
        parkServiceList: [],
        divisionStatusList: Util.deepClone(divisionStatusList),
        orderTypeList: Util.deepClone(orderTypeList),
      },
      countObj: {},
      page: {
        pageSize: 10,
        currentPage: 1
      },
      total: 0,
    }
  },

  created() {

  },

  mounted() {

    this.$apis.public.getyqMerchantList({}).then(res => {
      res.forEach(item => {
        item.merchantId = item.merchantNo
      })
      this.baseData.parkServiceList = res
      this.getOptionsList()
    })
    this.getOptionsList()
    this.getList()
  },

  methods: {

    getList() {
      var params = this.getParams()
      this.getCount()
      this.$apis.account.getListApi({
        ...params,
        ...this.page
      }).then(res => {
        // console.log(res)
        this.tableList = res.list
        this.total = res.total
        this.tableList.forEach(item => {
          item.divisionDateStr = item.divisionDate ? Util.dateFormate(item.divisionDate, 'YYYY-MM-DD HH:mm:ss') : ''
          item.successDateStr = item.payOrder?.successDate ? Util.dateFormate(item.payOrder.successDate, 'YYYY-MM-DD HH:mm:ss') : '-'
          let serviceInfos = []
          if (item.merchantDistributions && item.merchantDistributions.length > 0) {
            item.merchantDistributions.forEach(obj => {
              if (obj.targetMerchantType == 2) {
                if (serviceInfos.length < 2) {
                  serviceInfos.push(obj)
                }
              }
            })
          }
          item.serviceInfos = serviceInfos
        })
      })
    },

    getCount() {
      var params = this.getParams()
      this.$apis.account.getCountApi(params).then(res => {
        this.countObj = res
      })
    },

    handleSearch() {
      this.page.currentPage = 1
      this.getList()
    },
    getSelectInputParams() {
      const list = Object.keys(this.searchSelectObj)
      var params = {}
      list.forEach(i => {
        const item = this.searchSelectObj[i]
        item.value && (params[item.attr] = item.value)
      })
      return params
    },
    getParams() {
      var params = Util.deepClone(this.searchForm)
      const tempParams = this.getSelectInputParams()
      params = {
        ...params,
        ...tempParams
      }
      if (params.successDate && params.successDate.length) {
        params.successDateStartDate = Util.dateFormate(this.searchForm.successDate[0], 'YYYY-MM-DD HH:mm:ss')
        params.successDateEndDate = Util.dateFormate(this.searchForm.successDate[1], 'YYYY-MM-DD') + ' 23:59:59'
        delete params.successDate
      }

      if (params.divisionDate && params.divisionDate.length) {
        params.divisionStartDate = Util.dateFormate(this.searchForm.divisionDate[0], 'YYYY-MM-DD HH:mm:ss')
        params.divisionEndDate = Util.dateFormate(this.searchForm.divisionDate[1], 'YYYY-MM-DD') + ' 23:59:59'
        delete params.divisionDate
      }
      return params
    },

    getOptionsList(formName = 'showFormData', hasAll = true, refreshSigle) {
      if (refreshSigle) {
        var item = this[formName].find(k => k.name == refreshSigle)
        var index = this[formName].findIndex(k => k.name == refreshSigle)
        this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
        if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
          const temp = {}
          temp[this[formName][index].optionId] = ''
          temp[this[formName][index].optionLabel] = '全部'
          this[formName][index].optionList.unshift(temp)
        }
      } else {
        this[formName].forEach((item, index) => {
          if (item.type === 'select' && this.baseData[item.optionsName].length) {
            this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
            if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
              const temp = {}
              temp[this[formName][index].optionId] = ''
              temp[this[formName][index].optionLabel] = '全部'
              this[formName][index].optionList.unshift(temp)
            }
          }
        })
      }
    },
    exportExcel() {
      var params = this.getParams()
      this.$apis.account.exportExcel(params).then(res => {
        // window.location.href = res
        exportFn(res)
      })
    },

    handleReset() {
      this.searchForm = {
        // 线上
        divisionType: '2',
        divisionDate: '',
        divisionStatus: '',
        yqMerchantId: '',
      }
      this.searchSelectObj = {
        orderOrTrade: {
          attr: 'orderCode',
          value: ''
        },
        // divisionOrPayDate: {
        //   attr: 'divisionDate',
        //   value: ''
        // }
      }
      this.handleSearch()
    },

    // 每页条数
    handleSizeChange(value) {
      this.page.pageSize = value
      this.getList()
    },

    // 页码
    handleCurrentChange(value) {
      this.page.currentPage = value
      this.getList()
    },
  }
}
</script>

<style scoped lang="scss">
@import '@/assets/css/mixin.scss';
.purchase {
  .table-header {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    margin-top: 20px;
    h2 {
      font-weight: 600;
      font-size: 16px;
      color: #333;
    }
    .glbtn {
      left: 46px;
      position: absolute;
    }
    .btn {
      right: 47px;
      position: absolute;
    }
  }
  .greenSpot {
    @include dot;
    background: $color-green;
  }
  .yellowSpot {
    @include dot;
    background: $color-yellow;
  }
  .ashSpot {
    @include dot;
    background: $color-gray;
  }
  .table-btns /deep/.el-button--text {
    min-width: 0 !important;
    padding: 0;
  }

  .priceSpan {
    font-size: 14px;
    color: #909399;
  }
  .count-txt {
    font-weight: 700;
    color: #2a58ad;
    margin: 0 2px;
  }
}
</style>