permeation.vue 29.2 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 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011
<!-- 渗透率报表 -->
<template>
  <div>
    <d2-container>
      <div class="header" slot="header" style="background: #e7eaec">
        <el-tabs v-model="searchForm.sceneType">
          <el-tab-pane :label="sceneList['0']" name="0" />
          <el-tab-pane :label="sceneList['1']" name="1" />
        </el-tabs>
        <d2-search
          ref="showSearch"
          class="show-search"
          label-width="175px"
          :search-form="searchForm"
          :form-data="showFormData"
          style="background: #fff"
        >
          <div class="up-btns">
            <el-button size="small" type="primary" @click="handleSearch">
              查询
            </el-button>
            <el-button size="small" @click="handleReset"> 重置 </el-button>
          </div>
        </d2-search>
      </div>
      <div class="d2-container-content">
        <div class="date-container">
          <el-radio-group
            v-model="totalType"
            type="info"
            size="mini"
            @input="totalTypeInput"
          >
            <el-radio-button label="today"> 今日 </el-radio-button>
            <el-radio-button label="Week"> 本周 </el-radio-button>
            <el-radio-button label="Month"> 本月 </el-radio-button>
          </el-radio-group>
          <el-date-picker
            size="mini"
            v-model="dateValue"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            value-format="yyyy-MM-dd"
            :picker-options="pickerOptions"
            @change="dateValueChange"
          />
          <!-- <el-button
            size="small"
            class="default-blue-btn"
            type="primary"
            @click="handleExport"
            >导出</el-button
          > -->
          <span style="margin-left: auto">
            <span style="margin-right: 10px">
              <!-- v-if="searchForm.sceneType == '0'" -->
              <auth-button category="Button" :show-btn-ids="['9070401']" />
            </span>
            <auth-button category="Button" :show-btn-ids="['9070403']" />
          </span>
        </div>
        <d2-table
          :key="searchForm.sceneType"
          :has-num="false"
          :array-span-method="arraySpanMethod"
          :table-params="
            searchForm.sceneType == '0' ? tableParams : boutiqueTableParams
          "
          ref="table"
          @refreshTable="getList"
          :table-data="tableData"
          :table-total="tableTotal"
          :pageSize="5"
        >
          <div slot="newCar" slot-scope="scope">
            <span
              v-if="isShowJump(scope.scope)"
              @click="showDialog(scope.scope)"
              class="jump-a"
              >{{ scope.scope.deliveryCount || "--" }}</span
            >
            <span v-else>
              {{ scope.scope.deliveryCount || "--" }}
            </span>
          </div>

          <auth-button
            slot="auth-button"
            slot-scope="scope"
            :data="scope.scope"
          />
        </d2-table>
      </div>
    </d2-container>
    <!-- 查看 -->
    <car-dialog
      :detail-visible="detailVisible"
      :merchant-id="merchantId"
      :select-date="selectDate"
      :merchant-name="merchantName"
      :scene-type="searchForm.sceneType"
      v-if="detailVisible"
      @dialogClose="dialogClose"
    />
  </div>
</template>

<script>
import { Util, deepClone } from "@/common/util"
import { mapActions, mapState } from "vuex"
import dayjs from "dayjs"
import {
  permeabilityList,
  brandList,
  permeabilityExport,
  permeabilityBoutiqueList,
  listShop4sByRef
} from "@/api/permeation.js"
import carDialog from "./components/carDialog"
import { sceneList } from "@/common/constants"
const isSelect = [
  { label: "否", value: 0 },
  { label: "近两个月出单", value: 1 },
  { label: "近三个月出单", value: 2 }
]
export default {
  components: {
    carDialog
  },
  data() {
    let timeOptionRange = null
    return {
      sceneList,
      searchForm: {
        staffType: 0,
        brandIdList: [this.baseConfig.brandId],
        sceneType: "0",
        secondBrandIdList: []
      },
      search_num: 0,
      merchantId: "",
      merchantName: "",
      selectDate: "",
      tableTotal: 0,
      totalType: "today",
      dateValue: "",
      searchFormSearch: {},
      showFormData: [
        {
          label: "门店",
          name: "merchantNameList",
          type: "select",
          multiple: true,
          collapseTags: true,
          multipleLimit: 30,
          collapseTags: true,
          optionList: [],
          optionId: "merchantName",
          optionLabel: "merchantName",
          optionsName: "merchantName"
        },
        {
          label: "商户号",
          name: "merchantIdList",
          type: "select",
          multiple: true,
          multipleLimit: 30,
          collapseTags: true,
          optionList: [],
          optionId: "merchantId",
          optionLabel: "merchantId",
          optionsName: "merchantId"
        },
        {
          label: "主营品牌",
          name: "brandIdList",
          collapseTags: true,
          type: "select",
          multiple: true,
          multipleLimit: 5,
          optionList: [],
          optionId: "id",
          optionLabel: "label",
          optionsName: "brandIdList"
        },
        {
          label: "是否选择员工出单账号",
          name: "staffType",
          type: "select",
          optionList: isSelect,
          optionId: "value",
          optionLabel: "label"
        },
        {
          label: "子品牌",
          name: "secondBrandIdList",
          noDataText: "请先选择主营品牌",
          collapseTags: true,
          type: "select",
          multiple: true,
          multipleLimit: 5,
          optionList: [],
          optionId: "id",
          optionLabel: "label",
          optionsName: "secondBrandIdList"
        }
      ],
      tableData: [],
      // 会员权益表格
      tableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: "list",
        tableOption: false,
        tableColumns: [
          {
            label: "门店名称",
            prop: "merchantName",
            width: "200px"
          },
          {
            label: "商户号",
            prop: "merchantId",
            width: "150px"
          },
          {
            label: "日期",
            prop: "dateRange",
            width: "150px"
          },
          {
            label: "员工姓名",
            prop: "staffName",
            width: "120px"
          },
          {
            label: "车型",
            prop: "brandName"
            // width: "100px"
          },
          {
            label: "新车交付数",
            prop: "deliveryCount",
            width: "100px",
            addHtml: "newCar"
          },
          {
            label: "新车到店流量(会员权益/延保)",
            prop: "equityToShopCount",
            formatter: (cellValue) => {
              return (cellValue.equityToShopCount ?? "") === ""
                ? "-"
                : cellValue.equityToShopCount
            }
          },
          {
            label: "售后到店流量(会员权益/延保)",
            prop: "afterSaleEquityToShopCount",
            formatter: (cellValue) => {
              return (cellValue.afterSaleEquityToShopCount ?? "") === ""
                ? "-"
                : cellValue.afterSaleEquityToShopCount
            }
          },
          {
            label: "成交量(会员权益)",
            prop: "equityCount",
            formatter: (cellValue) => {
              return (cellValue.equityCount ?? "") === ""
                ? "-"
                : cellValue.equityCount
            }
          },
          {
            label: "成交量(延保)",
            prop: "warrantyInsuranceCount",
            width: "150px",
            formatter: (cellValue) => {
              return (cellValue.warrantyInsuranceCount ?? "") === ""
                ? "-"
                : cellValue.warrantyInsuranceCount
            }
          },
          {
            label: "转化率(会员权益/延保)",
            prop: "upgradeRate",
            width: "150px",
            formatter: (cellValue) => {
              return (cellValue.upgradeRate ?? "") === ""
                ? "-"
                : cellValue.upgradeRate
            }
          },
          {
            label: "是否分配平板",
            prop: "padPlatform",
            formatter: (cellValue) => {
              return (cellValue.padPlatform ?? "") === ""
                ? "-"
                : cellValue.padPlatform
            }
          },
          {
            label: "到店量",
            prop: "totalEquityToShopCount",
            formatter: (cellValue) => {
              return (cellValue.totalEquityToShopCount ?? "") === ""
                ? "-"
                : cellValue.totalEquityToShopCount
            }
          },
          {
            label: "APP接待数",
            prop: "receptionCount",
            formatter: (cellValue) => {
              return (cellValue.receptionCount ?? "") === ""
                ? "-"
                : cellValue.receptionCount
            }
          },
          {
            label: "质检进度",
            prop: "status",
            formatter: (cellValue) => {
              return (cellValue.status ?? "") === "" ? "-" : cellValue.status
            }
          },
          {
            label: "非真实接待数",
            prop: "inauthenticReceptionCount",
            formatter: (cellValue) => {
              return (cellValue.inauthenticReceptionCount ?? "") === ""
                ? "-"
                : cellValue.inauthenticReceptionCount
            }
          },
          {
            label: "质检平均分",
            prop: "averageScore",
            formatter: (cellValue) => {
              return (cellValue.averageScore ?? "") === ""
                ? "-"
                : cellValue.averageScore
            }
          },
          {
            label: "战败且低于平均分",
            prop: "unqualifiedCount",
            formatter: (cellValue) => {
              return (cellValue.unqualifiedCount ?? "") === ""
                ? "-"
                : cellValue.unqualifiedCount
            }
          },
          {
            label: "质检0分",
            prop: "zeroCount",
            formatter: (cellValue) => {
              return (cellValue.zeroCount ?? "") === ""
                ? "-"
                : cellValue.zeroCount
            }
          }
        ]
      },
      // 精品升级 表格
      boutiqueTableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: "list",
        tableOption: false,
        tableColumns: [
          {
            label: "门店名称",
            prop: "merchantName",
            width: "200px"
          },
          {
            label: "商户号",
            prop: "merchantId",
            width: "150px"
          },
          {
            label: "日期",
            prop: "dateRange"
          },
          {
            label: "员工姓名",
            prop: "staffName"
          },
          {
            label: "车型",
            prop: "brandName"
          },
          {
            label: "新车交付数",
            prop: "deliveryCount",
            addHtml: "newCar"
          },
          {
            label: "触客台次(轻改)",
            prop: "toShopFilmCount",
            formatter: (cellValue) => {
              return (cellValue.toShopFilmCount ?? "") === ""
                ? "-"
                : cellValue.toShopFilmCount
            }
          },
          // {
          //   label: "升级转化量(轻改)",
          //   prop: "upgradeCount",
          //   formatter: (cellValue) => {
          //     return (cellValue.upgradeCount ?? '') === '' ? '-' : cellValue.upgradeCount
          //   }
          // },
          // {
          //   label: "今日转化产值(轻改)/元",
          //   prop: "upgradeMoney",
          //   formatter: (cellValue) => {
          //     return (cellValue.upgradeMoney ?? '') === '' ? '-' : cellValue.upgradeMoney
          //   }
          // },
          {
            label: "成交量(轻改)",
            prop: "actualUpgradeCount",
            formatter: (cellValue) => {
              return (cellValue.actualUpgradeCount ?? "") === ""
                ? "-"
                : cellValue.actualUpgradeCount
            }
          }
        ]
      },
      baseData: {
        isSelect
      },
      page: {
        pageNum: 1,
        pageSize: 10
      },
      detailVisible: false,
      recordInfo: null,
      pickerOptions: {
        disabledDate: (time) => {
          // 可选范围是今天及之前且最大可选跨度是31天
          const secondNum = 30 * 24 * 60 * 60 * 1000
          const today = new Date()
          const [year, month, date] = [
            today.getFullYear(),
            today.getMonth(),
            today.getDate()
          ]
          const yesterdayStamp = new Date(year, month, date).getTime()
          if (timeOptionRange) {
            return (
              time.getTime() > timeOptionRange.getTime() + secondNum ||
              time.getTime() < timeOptionRange.getTime() - secondNum ||
              time.getTime() > yesterdayStamp
            )
          } else {
            return time.getTime() > yesterdayStamp
          }
        },
        onPick: (dateRange) => {
          if (dateRange.minDate && !dateRange.maxDate) {
            timeOptionRange = dateRange.minDate
          }
          if (dateRange.maxDate) {
            timeOptionRange = null
          }
        }
      }
    }
  },
  mounted() {
    // this.getBaseData()
    this.getList()
    this.getBrandList()
    this.getShop4sByRef()
  },
  computed: {
    ...mapState({
      dowloadList: (state) => state.d2admin.user.dowloadList
    })
  },
  watch: {
    // totalType(val) {
    //   if (!val) return
    //   this.dateValue = ""
    //   this.handleSearch()
    //   this.$forceUpdate()
    // },
    // dateValue(val) {
    //   if (!val) {
    //     this.totalType = "today"
    //     return
    //   }
    //   this.totalType = ""
    //   this.handleSearch()
    //   this.$forceUpdate()
    // },
    "searchForm.sceneType": {
      handler(val) {
        if (val) {
          this.search_num = 0
          this.handleReset()
          this.getShop4sByRef(val)
        }
      }
    },
    "searchForm.brandIdList": {
      handler(val) {
        if (val) {
          this.filterSecondBrandIdList()
          this.clearSecondBrandIdList()
        }
      },
      deep: true
    }
  },
  methods: {
    ...mapActions("d2admin/user", ["actionSetDownloadList"]),
    totalTypeInput(val) {
      // if (!val) return
      this.dateValue = ""
      this.handleSearch()
      this.$forceUpdate()
    },
    dateValueChange(val) {
      // if (!val) {
      //   this.totalType = "today"
      //   return
      // }
      this.totalType = ""
      this.handleSearch()
      this.$forceUpdate()
    },
    isShowJump(row) {
      return ["合计/最终"].includes(row.staffName) && row.deliveryCount
    },
    getList() {
      this.$nextTick(async () => {
        let params = this.getPramms()
        const page = this.$refs.table ? this.$refs.table.page : this.page
        params = {
          ...page,
          ...params
        }
        // 是否排除出单商户   0-不排除 1-排除
        if (this.search_num == 0) {
          params.excludeNoOrderMerchant = 1
        }
        this.search_num++
        this.tableData = []
        const res =
          this.searchForm?.sceneType == 0
            ? await permeabilityList(params)
            : await permeabilityBoutiqueList(params)
        // permeabilityList(params).then((res) => {
        const list = res?.list || []
        const arr = []
        list.forEach((i) => {
          i.staffList.forEach((j) => {
            // staffUuid 判断是不是员工行
            if (j.brandList && j.staffUuid) {
              j.brandList.forEach((k) => {
                arr.push({
                  ...i,
                  ...j,
                  ...k,
                  count: i.staffList.length,
                  brandCount: j.brandList.length
                })
              })
            } else {
              arr.push({ ...i, ...j, count: i.staffList.length })
            }
          })
        })
        this.tableData = arr
        this.tableTotal = res.total
        // })
      })
    },
    async getBaseData() {
      this.getOptionsList()
    },
    getShop4sByRef(num) {
      listShop4sByRef({ sceneList: [num || 0] }).then((res) => {
        this.addOptions("merchantId", res)
        this.addOptions("merchantName", res)
      })
    },
    addOptions(name, optionList) {
      const findData = this.showFormData.find(
        (item) => item.optionsName == name
      )
      if (findData) findData.optionList = optionList
    },
    getBrandList() {
      brandList({ containsChildren: true }).then((res) => {
        this.addOptions("brandIdList", res)
        this.filterSecondBrandIdList()
      })
    },
    // 处理子品牌选择项
    filterSecondBrandIdList() {
      let list = []
      const _brandIdList = this.searchForm.brandIdList
      const findData = this.showFormData.find(
        (item) => item.optionsName == "brandIdList"
      )
      _brandIdList?.forEach((val) => {
        const obj = findData?.optionList?.find((item) => val == item.id)
        list = list.concat(obj?.children || [])
      })
      this.addOptions("secondBrandIdList", list)
    },
    // 修改主营品牌 清空子品牌
    clearSecondBrandIdList() {
      const findData = this.showFormData.find(
        (item) => item.optionsName == "secondBrandIdList"
      )
      const secondBrandIdList = findData?.optionList || []
      const _secondBrandIdList = deepClone(this.searchForm.secondBrandIdList)
      const filSecondBrandIdList = _secondBrandIdList.filter((val) => {
        const index = secondBrandIdList.findIndex((subV) => subV.id == val)
        if (index > -1) return true
      })
      this.searchForm.secondBrandIdList = filSecondBrandIdList
    },
    showDialog(row) {
      this.merchantId = row.merchantId
      this.merchantName = row.merchantName
      this.detailVisible = true
      const { startDate, endDate } = this.getPramms()
      this.selectDate = [startDate, endDate]
    },
    arraySpanMethod({ row, column, rowIndex, columnIndex }) {
      // 前3列保留原有逻辑
      if (columnIndex < 3) {
        // 假设前3列的合并逻辑如下(根据实际情况调整)
        const mergeLength = 3 // 需要进行横纵合并的列
        if (columnIndex < mergeLength) {
          const finArray = [1, 1]
          // 处理行数据
          if (
            rowIndex === 0 ||
            row.merchantId !== this.tableData[rowIndex - 1].merchantId
          ) {
            let rowspan = 1
            // 计算需要进行合并操作的行
            for (let i = rowIndex; i < this.tableData.length - 1; i++) {
              // 只合并连续的
              if (
                this.tableData[i].merchantId === row.merchantId &&
                this.tableData[i + 1].merchantId === row.merchantId
              ) {
                rowspan++
              } else {
                break
              }
            }
            finArray[0] = rowspan
          } else {
            finArray[0] = 0
          }
          return finArray
        }
      }

      // 第4列(员工姓名列)根据 staffUuid 进行合并
      const columnNum = this.searchForm.sceneType == "0" ? 7 : 6
      if (columnIndex === 3 || columnIndex > columnNum) {
        console.log(rowIndex, row.staffUuid)
        console.log(row, column, rowIndex, columnIndex)

        let rowspan = 1
        for (let i = rowIndex + 1; i < this.tableData.length; i++) {
          if (this.tableData[i].staffUuid === row.staffUuid && row.staffUuid) {
            rowspan++
          } else {
            break
          }
        }

        if (rowIndex > 0) {
          const prevRow = this.tableData[rowIndex - 1]
          if (row.staffUuid === prevRow.staffUuid && row.staffUuid) {
            return {
              rowspan: 0,
              colspan: 0
            }
          }
        }

        return {
          rowspan: rowspan,
          colspan: 1
        }
      }
      // if (columnIndex === 3) {
      //   console.log(rowIndex, row.staffUuid)
      //   console.log(row, column, rowIndex, columnIndex)
      //   console.log(rowIndex === 0 || !row.brandCount)
      //   if (rowIndex === 0 || !row.brandCount) {
      //     return {
      //       rowspan: 1,
      //       colspan: 1
      //     }
      //   } else {
      //     const prevRow = this.tableData[rowIndex - 1]
      //     if (row.staffUuid === prevRow.staffUuid) {
      //       return {
      //         rowspan: 0,
      //         colspan: 0
      //       }
      //     } else {
      //       let rowspan = 1
      //       for (let i = rowIndex + 1; i < this.tableData.length; i++) {
      //         if (this.tableData[i].staffUuid === row.staffUuid) {
      //           rowspan++
      //         } else {
      //           break
      //         }
      //       }
      //       return {
      //         rowspan: rowspan,
      //         colspan: 1
      //       }
      //     }
      //   }
      // }

      // 其他列保持默认
      return {
        rowspan: 1,
        colspan: 1
      }
    },
    // arraySpanMethod({ row, column, rowIndex, columnIndex }) {
    //   // 合并行列产品名字相同合并(计算组长度以内的列,需要进行合并操作的列)
    //   const mergeLength = 4 // 需要进行横纵合并的列
    //   if (columnIndex < mergeLength) {
    //     const finArray = [1, 1]
    //     // 处理行数据
    //     // console.log(cgname);
    //     if (
    //       rowIndex === 0 ||
    //       row.merchantId !== this.tableData[rowIndex - 1].merchantId
    //     ) {
    //       let rowspan = 1
    //       // 计算需要进行合并操作的行
    //       for (let i = 0; i < this.tableData.length - 1; i++) {
    //         // 只合并连续的
    //         if (
    //           this.tableData[i].merchantId === row.merchantId &&
    //           this.tableData[i + 1].merchantId === row.merchantId
    //         ) {
    //           rowspan++
    //         }
    //       }
    //       finArray[0] = rowspan
    //     } else {
    //       finArray[0] = 0
    //     }
    //     return finArray
    //   }
    //   // if (columnIndex == 3) {
    //   //   const finArray = [1, 1]

    //   //   let rowspan = 1

    //   //   return finArray
    //   // }
    // },
    getPramms() {
      this.searchFormSearch = deepClone(this.searchForm)
      if (this.searchFormSearch.deliveryDate) {
        this.searchFormSearch.deliveryDateStart = Util.dateFormate(
          this.searchFormSearch.deliveryDate[0],
          "YYYY-MM-DD 00:00:00"
        )
        this.searchFormSearch.deliveryDateEnd = Util.dateFormate(
          this.searchFormSearch.deliveryDate[1],
          "YYYY-MM-DD 23:59:59"
        )
        delete this.searchFormSearch.deliveryDate
      }
      if (this.totalType) {
        let beginDateStr, endDateStr
        switch (this.totalType) {
          case "today":
            beginDateStr = dayjs().startOf("day").format("YYYY-MM-DD")
            endDateStr = dayjs().endOf("day").format("YYYY-MM-DD")
            break
          case "Week":
            // 0 - 周日,特殊处理
            beginDateStr = dayjs().day()
              ? dayjs().day(1).startOf("day").format("YYYY-MM-DD")
              : dayjs().subtract(6, "days").startOf("day").format("YYYY-MM-DD")
            endDateStr = dayjs().day()
              ? dayjs().day(1).add(6, "days").endOf("day").format("YYYY-MM-DD")
              : dayjs().endOf("day").format("YYYY-MM-DD")
            break
          case "Month":
            beginDateStr = dayjs().startOf("month").format("YYYY-MM-DD")
            endDateStr = dayjs().endOf("month").format("YYYY-MM-DD")
            break
        }
        this.searchFormSearch.startDate = beginDateStr
        this.searchFormSearch.endDate = endDateStr
      }
      if (this.dateValue) {
        this.searchFormSearch.startDate = dayjs(this.dateValue[0])
          .startOf(this.totalType)
          .format("YYYY-MM-DD")
        this.searchFormSearch.endDate = dayjs(this.dateValue[1])
          .endOf(this.totalType)
          .format("YYYY-MM-DD")
      }
      return this.searchFormSearch
    },
    beforeSearchFn() {
      return new Promise((resolve) => {
        this.searchFormSearch = this.getPramms()
        resolve()
      })
    },
    // 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]
    //       )
    //       console.log(this.showFormData)
    //     }
    //   })
    // },

    handleSearch() {
      // 重置分页页码
      if (this.$refs.table && this.$refs.table.page)
        this.$refs.table.page.currentPage = 1
      this.getList()
    },
    handleReset() {
      this.searchForm.staffType = 0
      this.searchForm.brandIdList = [this.baseConfig.brandId]
      this.searchForm.merchantNameList = []
      this.searchForm.merchantIdList = []
      this.searchForm.secondBrandIdList = []
      this.totalType = "today"
      this.dateValue = ""
      // 重置分页页码
      if (this.$refs.table && this.$refs.table.page)
        this.$refs.table.page.currentPage = 1
      this.getList()
    },
    // 导出
    handleExport() {
      var params = this.getPramms()
      for (const k in params) {
        if (params[k].length == 0) {
          delete params[k]
        }
        if (Array.isArray(params[k])) {
          params[k].forEach((item, index) => {
            const name = `${k}[${index}]`
            params[name] = item
          })
          delete params[k]
        }
      }
      if (this.search_num == 1) {
        params.excludeNoOrderMerchant = 1
      }
      this.search_num++
      if (this.searchForm.sceneType == "0") {
        params.method = "dj.api.smartcarlife.permeability.report.exportAsync"
      } else {
        params.method = "dj.api.smartcarlife.boutique.report.exportAsync"
      }
      const list = [
        ...this.dowloadList,
        {
          name: "渗透率报表",
          exportParam: JSON.stringify(params),
          status: "waiting",
          timeid: new Date().getTime()
        }
      ]
      this.actionSetDownloadList({ list, type: "dowloadList" })
    },
    // 日报导出
    handleDailyExport() {
      var params = this.getPramms()
      for (const k in params) {
        if (params[k].length == 0) {
          delete params[k]
        }
        if (Array.isArray(params[k])) {
          params[k].forEach((item, index) => {
            const name = `${k}[${index}]`
            params[name] = item
          })
          delete params[k]
        }
      }
      if (this.search_num == 1) {
        params.excludeNoOrderMerchant = 1
      }
      this.search_num++
      params.method =
        params.sceneType == "1"
          ? "dj.api.smartcarlife.boutique.permeability.report.daily.exportAsync"
          : "dj.api.smartcarlife.permeability.report.daily.exportAsync"
      const list = [
        ...this.dowloadList,
        {
          name: "每日数据报表",
          exportParam: JSON.stringify(params),
          status: "waiting",
          timeid: new Date().getTime()
        }
      ]
      this.actionSetDownloadList({ list, type: "dowloadList" })
    },
    dialogClose(flag) {
      this.detailVisible = !this.detailVisible
      // if (flag) {
      //   this.$refs.recordTable.refreshTable()
      // }
    },

    // 撤销
    handleRevoke(row) {
      this.$confirm(
        "发货单撤销后同步删除该发货记录,且无法撤回;是否确定撤销?",
        "提示",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }
      )
        .then(() => {
          purchaseOrderDeliveryWithdraw({ id: row.id }).then((res) => {
            this.notice.okTips()
            this.$refs.recordTable.refreshTable()
          })
        })
        .catch((err) => {
          console.log(err)
        })
    }
  }
}
</script>
<style scoped lang="scss">
.count-txt {
  font-weight: 700;
  color: #2a58ad;
  margin: 0 2px;
}

.jump-a {
  cursor: pointer;
  color: #185efe;
}

.leftSpan {
  display: inline-block;
  box-sizing: border-box;
  margin-right: 10px;
}

.date-container {
  margin-bottom: 10px;
  display: flex;

  .default-blue-btn {
    margin-left: auto;
  }

  ::v-deep {
    .el-date-editor {
      margin-left: 10px;
    }
  }
}
::v-deep {
  .el-tabs__header {
    margin: 0;
    padding: 0 20px;
  }
}
</style>