upgradeOrder.vue 34.1 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 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126
<template>
  <div ref="orderContainer" class="order-container">
    <div class="pannel">
      <GLCombiForm :key="refreshKey" ref="showSearch" :rowNumber="rowNumber" :formObj="searchForm" :formData="searchFormData" @handleOk="handleOkFn" @handleRest="handleRestFn"></GLCombiForm>
    </div>
    <div v-if="accountLevel == 1 && !isAdmin" style="height: 18px"></div>
    <div class="tipper flex_scb">
      <div class="tip_text">
        <span>共</span>
        <sapn style="color: #5850ff">{{ tableCountInfo.orderCount }}</sapn>
        <span>笔主订单</span>
        <span style="color: #5850ff">{{ tableCountInfo.nums || 0 }}</span>
        <span>笔子订单</span>
        <span>,累计订单支付金额:</span>
        <span style="color: #5850ff">¥{{ tableCountInfo.totalPrice || 0 }}</span>
        <span>元,累计导流方利润:</span>
        <span style="color: #5850ff">{{ tableCountInfo.totalShopGrossProfit || 0 }}</span>
        <span>元</span>
      </div>
      <div class="right_select">
        <el-select class="myfindWidth" size="small" collapse-tags multiple @removeTag="removeTag" v-model="tableCoulumList" @change="changTableCoulum" placeholder="请选择要展示的字段">
          <el-option v-for="item in fieldList" :disabled="item.disabled" :key="item.value" :label="item.label" :value="item"></el-option>
        </el-select>
        <GLButton style="margin-left: 8px;" size="small" fn="导出精品升级订单" @click="toExport">导出数据</GLButton>
      </div>
    </div>

    <div class="table_wrap">
      <GLTable v-if="dynamicTableShow" ref="subTable" :tableData="tableData" :tableTotal="tableTotal" :tableParams="newTableParams" @refreshTable="toGetCouponsList">
        <div class="table-btns" slot="table-btns" slot-scope="scope">
          <GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
        </div>
      </GLTable>
    </div>

    <GLDialog bigTitle="订单详情" mode="big" :visible.sync="dialogVisible">
      <div v-if="orderDetail" class="dialog_content">
        <div class="wrapper">
          <div class="title h18_title">
            <div class="title_icon"></div>
            <span>订单详情</span>
          </div>
          <div class="message_wrap flex_scb" :class="orderDetail.payOrder.payVoucher ? 'maxHeight' : ''">
            <div class="box_info">
              <div class="info_text">
                <span>订单单号:</span>
                <span class="h19_title">{{ orderDetail.orderCode }}</span>
              </div>
              <div class="info_text">
                <span>交易流水:</span>
                <span class="h19_title">{{ orderDetail.payOrder.outTradeNo || '--' }}</span>
              </div>
            </div>
            <div class="box_info">
              <div class="info_text">
                <span>订单状态:</span>
                <span class="h19_title">{{ orderStatusList[orderDetail.status - 1] }}</span>
              </div>
              <div class="info_text">
                <span>支付状态:</span>
                <span class="h19_title">{{ orderDetail.payOrder.payStatus == 1 ? '未支付' : '已支付' }}</span>
              </div>
            </div>
            <div class="box_info">
              <div class="info_text">
                <span>支付方式:</span>
                <span v-if="orderDetail.payOrder.payType == 1" class="h19_title">微信支付</span>
                <span v-if="orderDetail.payOrder.payType == 2" class="h19_title">线下支付</span>
                <span v-if="orderDetail.payOrder.payType == 3" class="h19_title">POS机收款</span>
              </div>
              <div class="info_text flex_img">
                <span>收款凭证:</span>
                <span v-if="!orderDetail.payOrder.payVoucher" class="h19_title">--</span>
                <template v-else>
                  <el-image style="width: 100px; height: 100px" @error.once="reloadImg(detailImage)" :src="detailImage" :preview-src-list="detailImageList"></el-image>
                </template>
              </div>
            </div>
          </div>
        </div>
        <div class="wrapper">
          <div class="title h18_title">
            <div class="title_icon"></div>
            <span>用户信息</span>
          </div>
          <div class="message_wrap flex_scb">
            <div class="box_info">
              <div class="info_text">
                <span>用户姓名:</span>
                <span class="h19_title">{{ orderDetail.customer.customerName || '--' }}</span>
              </div>
              <div class="info_text">
                <span>评价:{{ orderDetail.comment ? '' : '--' }}</span>
                <span class="h19_title"></span>
              </div>
            </div>
            <div class="box_info">
              <div class="info_text">
                <span>车架号:</span>
                <span class="h19_title">{{ orderDetail.customer.standNo || '--' }}</span>
              </div>
              <div class="info_text"></div>
            </div>
            <div class="box_info"></div>
          </div>
          <div v-if="orderDetail.comment" class="comment_wrap">
            <div class="comment_rate">
              <div class="comment_line h20_title">
                <span>产品与描述相符:</span>
                <el-rate disabled :colors="['#5850FF', '#5850FF', '#5850FF']" text-color="#5850FF" :value="orderDetail.comment.customerScore"></el-rate>
                <span v-if="orderDetail.comment.customerScore == 5">非常好</span>
                <span v-else-if="orderDetail.comment.customerScore == 4">好</span>
                <span v-else-if="orderDetail.comment.customerScore == 3">一般</span>
                <span v-else-if="orderDetail.comment.customerScore == 2">差</span>
                <span v-else-if="orderDetail.comment.customerScore == 1">非常差</span>
                <span v-else>--</span>
              </div>
              <div style="width: 110px; height: 1"></div>
              <div class="comment_line h20_title">
                <span>服务态度:</span>
                <el-rate disabled :colors="['#5850FF', '#5850FF', '#5850FF']" text-color="#5850FF" :value="orderDetail.comment.serviceScore"></el-rate>
                <span v-if="orderDetail.comment.serviceScore == 5">非常好</span>
                <span v-else-if="orderDetail.comment.serviceScore == 4">好</span>
                <span v-else-if="orderDetail.comment.serviceScore == 3">一般</span>
                <span v-else-if="orderDetail.comment.serviceScore == 2">差</span>
                <span v-else-if="orderDetail.comment.serviceScore == 1">非常差</span>
                <span v-else>--</span>
              </div>
            </div>
            <div class="comment_line nocenter h20_title">
              <span>评价:</span>
              <div class="textarea_con">{{ orderDetail.comment.customerComment }}</div>
            </div>
          </div>
        </div>
        <div class="wrapper">
          <div class="title h18_title">
            <div class="title_icon"></div>
            <span>关联信息</span>
          </div>
          <div class="message_wrap flex_scb">
            <div class="box_info">
              <div class="info_text">
                <span>流量来源:</span>
                <span class="h19_title">{{ orderDetail.merchantName || '--' }}</span>
              </div>
              <div class="info_text">
                <span>转化员:</span>
                <span class="h19_title">{{ orderDetail.sellerName || '--' }}</span>
              </div>
            </div>
            <div class="box_info">
              <div class="info_text">
                <span>推荐人:</span>
                <span class="h19_title">{{ orderDetail.employeeName || '--' }}</span>
              </div>
              <div class="info_text">
                <span>门店地址:</span>
                <span v-if="orderDetail.yqMerchantInfo" class="h19_title">{{ orderDetail.yqMerchantInfo.address }}</span>
                <span v-else class="h19_title">--</span>
              </div>
            </div>
            <div class="box_info">
              <div class="info_text">
                <span>园区店:</span>
                <span class="h19_title">{{ orderDetail.sellerMerchantName || '--' }}</span>
              </div>
              <div class="info_text"></div>
            </div>
          </div>
        </div>
        <div class="wrapper">
          <div class="title h18_title">
            <div class="title_icon"></div>
            <span>订单商品</span>
          </div>
          <div class="dialog_table_wrap">
            <GLTable ref="dialogTable" :hasPage="false" :hasNum="false" :tableData="dialogTableData" :tableParams="dialogTableParams"></GLTable>
          </div>
        </div>
        <div class="wrapper noBorder">
          <div class="title h18_title">
            <div class="title_icon"></div>
            <span>订单进度</span>
          </div>
          <div class="dialog_table_wrap">
            <GLTable ref="dialogTable2" :hasPage="false" :hasNum="false" :tableData="dialogTableData2" :tableParams="dialogTableParams2"></GLTable>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" type="primary" @click="dialogVisible = false">返回</el-button>
      </span>
    </GLDialog>
  </div>
</template>

<script>
import { findupGradeOrder, exportUpgrade, checkDetail, orderTotalNumOfJT, getMerchantList } from '../../api/modules/rules'
import { converterApi } from '../../api/modules/converter'
import utils from '../../util/util'
const logTypeList = ['预录用户', '用户下单', '用户付款', '完成服务']
const orderStatusList = ['待升级', '未升级', '待支付', '已支付', '已退款', '已完成']

export default {
  name: '',
  props: {
    list: Array
  },
  data() {
    return {
      dynamicTableShow: true,
      rowNumber: 2,
      refreshKey: Date.now(),
      /**新版搜索栏组件 */
      searchForm: {
        dateBetween: '',
        payType: '',
        divisionType: '',
        orderNum: '',
        tradeNum: '',
        goodsName: '',
        merchantIds: '',
        merchantIdss: '',
        merchantIdsss: ''
      },
      searchFormData: [
        {
          label: '支付时间',
          name: 'dateBetween',
          type: 'datePicker',
          isClear: true
        },
        {
          label: '支付方式',
          name: 'payType',
          type: 'select',
          optionId: 'confId',
          optionLabel: 'confName',
          isClear: true,
          noFilter: true,
          optionList: [
            {
              confId: 0,
              confName: '不升级'
            },
            {
              confId: 1,
              confName: '微信支付'
            },
            {
              confId: 2,
              confName: '线下收款'
            },
            {
              confId: 3,
              confName: 'POS机'
            }
          ]
        },
        {
          label: '分账类型',
          name: 'divisionType',
          type: 'select',
          optionId: 'confId',
          optionLabel: 'confName',
          isClear: true,
          noFilter: true,
          optionList: [
            {
              confId: 1,
              confName: '线下对账'
            },
            {
              confId: 2,
              confName: '线上分账'
            }
          ]
        },
        {
          label: '主订单编号',
          name: 'orderNum',
          type: 'input',
          isClear: true
        },
        {
          label: '交易参考号',
          name: 'tradeNum',
          type: 'input',
          isClear: true
        },
        {
          label: '商品名称',
          name: 'goodsName',
          type: 'input',
          isClear: true
        }
      ],
      orderStatusList,
      tableData: [],
      tableTotal: 0,
      currentPage: 1,
      pageSize: 10,
      payTypeChange: 1,
      // 查询参数
      dateBetween: '',
      payType: '',
      divisionType: '',
      orderNumType: 1,
      orderNum: '',
      tradeNum: '',
      goodsName: '',
      dialogVisible: false,
      // 弹框表格
      dialogTableData: [],
      dialogTableData2: [],
      dialogTableParams: {
        tableOption: false,
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        tableColumns: [
          {
            label: '商品ID',
            prop: 'codeId',
            width: 150,
            line: 1
          },
          {
            label: '商品名称',
            prop: 'goodsName',
            width: 150,
            line: 1
          },
          {
            label: '商品分类',
            prop: 'goodsClass'
          },
          {
            label: '品牌商',
            prop: 'plateName',
            width: 150,
            line: 1
          },
          {
            label: '商品售价/元',
            prop: 'saleprice',
            align: 'right'
          },
          {
            label: '质保年限',
            prop: 'upgradeWarrantyPeriodName'
          },
          {
            label: '数量/件',
            prop: 'number'
          },
          {
            label: '支付金额/元',
            prop: 'totalPrice',
            align: 'right'
          }
        ]
      },
      dialogTableParams2: {
        tableOption: false,
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        tableColumns: [
          {
            label: '时间',
            prop: 'createdDate'
          },
          {
            label: '当前进度',
            prop: 'logTypeName'
          },
          {
            label: '关联操作员',
            prop: 'userName'
          }
        ]
      },
      orderDetail: null,
      fieldList: [
        {
          value: 'orderCode',
          label: '主订单编号',
          level: 1,
          width: '200',
          disabled: true
        },
        {
          value: 'tradeNo',
          label: '交易参考号',
          level: 1,
          width: '200',
          disabled: true
        },
        {
          value: 'subOrderCode',
          label: '子订单编号',
          level: 1,
          width: '200',
          disabled: true
        },
        {
          value: 'upgradeGoodsName',
          label: '商品名称',
          level: 1,
          width: '200',
          disabled: false
        },
        {
          value: 'upgradeGoodsCommodityCode',
          label: '商品编号',
          level: 1,
          width: '200',
          disabled: false
        },
        {
          value: 'goodsCost',
          label: '商品成本',
          level: 1,
          width: '110',
          align: 'right',
          disabled: false
        },
        {
          value: 'customerName',
          label: '客户姓名',
          level: 1,
          width: '200',
          disabled: false
        },
        // {
        //   value: 'customerPhone',
        //   label: '客户手机号',
        //   level: 2,
        //   width: '200',
        //   disabled: false
        // },
        {
          value: 'sellerName',
          label: '转化员姓名',
          level: 2,
          width: '200',
          disabled: false
        },
        {
          value: 'employeeName',
          label: '销售顾问',
          level: 2,
          width: '200',
          disabled: false
        },
        {
          value: 'paySuccessDate',
          label: '支付时间',
          level: 2,
          width: '200',
          disabled: false
        },
        {
          value: 'payTypeName',
          label: '支付方式',
          level: 3,
          width: '200',
          disabled: false
        },
        {
          value: 'subTotalPrice',
          label: '支付金额/元',
          level: 3,
          width: '110',
          align: 'right',
          disabled: true
        },
        {
          value: 'actualIncomeMoney',
          label: '总分账金额/元',
          level: 3,
          width: '150',
          align: 'right',
          disabled: true
        },
        {
          value: 'shopMerchantName',
          label: '分账对象',
          level: 3,
          width: '200',
          disabled: false
        },
        {
          value: 'rule',
          label: '分账规则',
          level: 3,
          width: '200',
          disabled: false
        },
        {
          value: 'shopTrafficMoney',
          label: '分账金额/元',
          level: 3,
          width: '110',
          align: 'right',
          disabled: true
        },
        {
          value: 'divisionTypeName',
          label: '分账类型',
          level: 3,
          width: '200',
          disabled: false
        }
      ],
      tableCoulumList: [],
      openCount: 0,
      tableCountInfo: {
        nums: 0,
        totalPrice: 0,
        totalShopGrossProfit: 0
      },
      accountLevel: 1,
      isAdmin: false,
      curMerchantNo: '',
      detailImage: '',
      detailImageList: [],
      pickerOptions: {},
      screenWidth: document.body.clientWidth,
      /**新版表格组件传参 */
      newTableParams: {
        tableOption: false,
        tableColumns: [
          {
            label: '订单信息',
            align: 'center',
            children: [
              {
                label: '主订单编号',
                prop: 'orderCode',
                width: '200'
              },
              {
                label: '交易参考号',
                prop: 'tradeNo',
                width: '200'
              },
              {
                label: '子订单编号',
                prop: 'subOrderCode',
                width: '200'
              },
              {
                label: '商品名称',
                prop: 'upgradeGoodsName',
                width: '200'
              },
              {
                label: '商品编号',
                prop: 'upgradeGoodsCommodityCode',
                width: '200'
              },
              {
                label: '商品成本',
                prop: 'goodsCost',
                width: '110',
                align: 'right'
              },
              {
                label: '客户姓名',
                prop: 'customerName',
                width: '200'
              }
            ]
          },
          {
            label: '支付信息',
            align: 'center',
            children: [
              // {
              //   label: '客户手机号',
              //   prop: 'customerPhone',
              //   width: '200'
              // },
              {
                label: '转化员姓名',
                prop: 'sellerName',
                width: '200'
              },
              {
                label: '销售顾问',
                prop: 'employeeName',
                width: '200'
              },
              {
                label: '支付时间',
                prop: 'paySuccessDate',
                width: '200'
              }
            ]
          },
          {
            label: '导流方利润',
            align: 'center',
            children: [
              {
                label: '支付方式',
                prop: 'payTypeName',
                width: '200'
              },
              {
                label: '支付金额/元',
                prop: 'subTotalPrice',
                width: '110',
                align: 'right'
              },
              {
                label: '总分账金额/元',
                prop: 'actualIncomeMoney',
                width: '150',
                align: 'right'
              },
              {
                label: '分账对象',
                prop: 'shopMerchantName',
                width: '200'
              },
              {
                label: '分账规则',
                prop: 'rule',
                width: '200'
              },
              {
                label: '分账金额/元',
                prop: 'shopTrafficMoney',
                width: '110',
                align: 'right'
              },
              {
                label: '分账类型',
                prop: 'divisionTypeName',
                width: '200'
              }
            ]
          },
          {
            label: '操作',
            prop: '',
            width: '120px',
            fixed: 'right',
            addHtml: 'table-btns'
          }
        ]
      },
      buttonList: [
        {
          type: 'el-button',
          name: row => {
            return '查看明细'
          },
          attrs: {
            type: 'text'
          },
          listeners: {
            click: row => this.openDetail(row.scope)
          }
        }
      ]
    }
  },
  watch: {
    tableCoulumList: function(newvalue, oldvalue) {
      this.handlerNewTableCoulum(newvalue)
    }
  },
  created() {
    const { session } = this.$globalState
    this.accountLevel = session.accountLevel
    this.merchantId = session.merchantId
    this.isAdmin = session.admin
    let temp = JSON.parse(localStorage.getItem(`menuList${session.merchantId}`))
    if (temp) {
      this.tableCoulumList = temp
    } else {
      this.tableCoulumList = this.fieldList
    }
    // 1.工厂  2省代  3市代  4门店
    if (session.accountLevel < 4) {
      this.getMerchanListData(session.accountLevel)
    }
  },
  mounted() {
    let openInfo = JSON.parse(localStorage.getItem('openInfo'))
    let startDate = utils.dateFormat(openInfo.openDate)
    let endDate = utils.dateFormat(new Date())
    this.openCount = openInfo.openCount || 0
    let params = {
      payStartDateStr: utils.dateFormat(startDate, 'YYYY-MM-DD 00:00:00'),
      payEndDateStr: utils.dateFormat(endDate, 'YYYY-MM-DD 23:59:59')
    }
    this.defaultStart = utils.dateFormat(startDate, 'YYYY-MM-DD 00:00:00')
    this.defaultEnd = utils.dateFormat(endDate, 'YYYY-MM-DD 23:59:59')
    this.newHttpParam = params
    this.toGetCouponsList()
  },
  methods: {
    /**获取商户列表 */
    getMerchanListData(accountLevel) {
      let merchantForm = {}
      getMerchantList({}).then(res => {
        this.merchants = res
        const levelName = ['工厂商户号', '省代商户号', '市代商户号', '门店商户号']
        merchantForm = {
          label: levelName[accountLevel],
          name: 'merchantIds',
          type: 'select',
          optionList: res,
          optionId: 'id',
          optionLabel: 'merchantName',
          isClear: true
        }
        if (accountLevel < 3) {
          merchantForm.changeAttr = (val, targetItem) => {
            let child = targetItem.optionList.filter(item => item.id == val)
            let newForm = {
              label: levelName[accountLevel + 1],
              name: 'merchantIdss',
              type: 'select',
              optionList: child[0] && child[0].children ? child[0].children : [],
              optionId: 'id',
              optionLabel: 'merchantName',
              isClear: true
            }
            if (accountLevel == 1) {
              newForm.changeAttr = (va, targetIte) => {
                let child2 = targetIte.optionList.filter(item => item.id == va)
                let newForm2 = {
                  label: levelName[accountLevel + 2],
                  name: 'merchantIdsss',
                  type: 'select',
                  optionList: child2[0] && child2[0].children ? child2[0].children : [],
                  optionId: 'id',
                  optionLabel: 'merchantName',
                  isClear: true
                }
                const isAdd = this.judgeAdd(newForm2, this.searchFormData, 'name')
                if (!isAdd) {
                  this.searchFormData.push(newForm2)
                }
                this.refreshKey = Date.now()
              }
            }
            this.rowNumber = 3
            const isAdd = this.judgeAdd(newForm, this.searchFormData, 'name')
            if (!isAdd) {
              this.searchFormData.push(newForm)
            }
            this.refreshKey = Date.now()
          }
        }
        this.searchFormData.push(merchantForm)
        this.refreshKey = Date.now()
      })
    },
    // 判断是否需要添加下拉框
    judgeAdd(obj, objList, tag) {
      let flag = false
      objList.forEach(item => {
        if (item[tag] == obj[tag]) {
          flag = true
        }
      })
      return flag
    },
    /**处理新表格动态刷新列方法 */
    handlerNewTableCoulum(fieldList) {
      this.dynamicTableShow = false
      let newTableParams = {
        tableOption: false,
        tableColumns: [
          {
            label: '订单信息',
            align: 'center',
            children: []
          },
          {
            label: '支付信息',
            align: 'center',
            children: []
          },
          {
            label: '导流方利润',
            align: 'center',
            children: []
          },
          {
            label: '操作',
            prop: '',
            width: '120px',
            fixed: 'right',
            addHtml: 'table-btns'
          }
        ]
      }
      fieldList.forEach(item => {
        let obj = {
          label: item.label,
          prop: item.value,
          width: item.width
        }
        if (item.align) {
          obj.align = item.align
        }
        newTableParams.tableColumns[item.level - 1].children.push(obj)
      })
      this.newTableParams = newTableParams
      this.$refs.subTable.componentKey = Date.now()
      this.$nextTick(() => {
        this.dynamicTableShow = true
      })
    },
    handleOkFn() {
      this.handleParam()
    },
    handleRestFn() {
      this.searchForm = {
        dateBetween: '',
        payType: '',
        divisionType: '',
        orderNum: '',
        tradeNum: '',
        goodsName: '',
        merchantIds: '',
        merchantIdss: '',
        merchantIdsss: ''
      }
      this.newHttpParam = {}
      this.toGetCouponsList()
    },
    reloadImg(item) {
      let index = 0
      if (/^err/.test(this.detailImageList[index])) {
        this.$set(this.detailImageList, index, this.detailImageList[index].slice(3))
      } else {
        if (!this.errobj[item]) {
          this.errobj[item] = 1
        } else {
          if (this.errobj[item] > 2) {
            return
          } else {
            this.errobj[item] += 1
          }
        }
        this.$set(this.detailImageList, index, 'err' + item)
      }
    },
    selectCurMechant(e) {
      this.$refs.mySelectCon.selectCurMechant(e)
    },
    changTableCoulum(e) {
      const { session } = this.$globalState
      localStorage.setItem(`menuList${session.merchantId}`, JSON.stringify(e))
    },
    // 查看明细
    openDetail(item) {
      this.getDetailInfo(item.orderCode)
    },
    handleParam() {
      let params = {}
      if (this.searchForm.dateBetween) {
        //支付时间
        let startDate = utils.dateFormat(this.searchForm.dateBetween[0], 'YYYY-MM-DD 00:00:00')
        let endDate = utils.dateFormat(this.searchForm.dateBetween[1], 'YYYY-MM-DD 23:59:59')
        params.payStartDateStr = startDate
        params.payEndDateStr = endDate
      } else {
        params.payStartDateStr = this.defaultStart
        params.payEndDateStr = this.defaultEnd
      }
      if (this.searchForm.payType || this.searchForm.payType === 0) {
        //支付方式
        params.payType = this.searchForm.payType
      }
      if (this.searchForm.divisionType) {
        //分账类型
        params.divisionType = this.searchForm.divisionType
      } else {
        delete params.divisionType
      }
      if (this.searchForm.orderNum) {
        params.orderCode = this.searchForm.orderNum
      } else {
        delete params.orderCode
      }
      if (this.searchForm.tradeNum) {
        params.tradeNo = this.searchForm.tradeNum
      } else {
        delete params.tradeNo
      }
      if (this.searchForm.goodsName) {
        params.upgradeGoodsName = this.searchForm.goodsName
      } else {
        delete params.upgradeGoodsName
      }
      if (this.searchForm.merchantIdsss || this.searchForm.merchantIdss || this.searchForm.merchantIds) {
        params['merchantIdList[0]'] = this.searchForm.merchantIdsss || this.searchForm.merchantIdss || this.searchForm.merchantIds
      } else {
        delete params['merchantIdList[0]']
      }
      this.newHttpParam = params
      this.$refs.subTable.page.pageNum = 1
      this.toGetCouponsList()
    },
    toGetCouponsList() {
      let method = findupGradeOrder()
      let para = {
        routerMethod: method,
        pageNum: this.$refs.subTable.page.pageNum,
        pageSize: this.$refs.subTable.page.pageSize,
        ...this.newHttpParam
      }
      converterApi(para).then(res => {
        this.tableData = res.list.map((item, index) => {
          const TYPELIST = ['--', '毛利', '收入', '固定']
          // let ruleType = item.shopProfitType == 1 ? '毛利' : '收入'
          // let ruleType = item.shopTrafficMoneyCalculateType == 1 ? '毛利' : '收入'
          let ruleType = TYPELIST[item.shopTrafficMoneyCalculateType]
          item.rule = `${ruleType}${item.shopTrafficMoneyCalculateType == 0 ? '' : item.shopTrafficMoneyCalculateValue}${item.shopTrafficMoneyCalculateType == 0 ? '' : '%'}`
          item.divisionTypeName = item.divisionType == 1 ? '线下对账' : '线上分账'
          item.paySuccessDate = utils.dateFormat(item.paySuccessDate, 'YYYY-MM-DD HH:mm:ss')
          item.payTypeName = item.payType == 1 ? '微信支付' : item.payType == 2 ? '线下收款' : 'POS机'
          return item
        })
        this.tableTotal = res.total
        this.httpParam = {
          pageNum: this.$refs.subTable.page.pageNum,
          pageSize: this.$refs.subTable.page.pageSize,
          ...this.newHttpParam
        }
        this.$refs.subTable.componentKey = Date.now()
        this.getTotalOfJT(this.httpParam)
      })
    },
    // 获取导流方利润统计---集团
    getTotalOfJT(params) {
      delete params.pageNum
      delete params.pageSize
      let method = orderTotalNumOfJT()
      let para = {
        routerMethod: method,
        ...params
      }
      converterApi(para).then(res => {
        if (res) {
          this.tableCountInfo = res
        }
      })
    },
    toExport() {
      let method = exportUpgrade()
      let para = {
        routerMethod: method,
        ...this.httpParam
      }
      converterApi(para).then(res => {
        let tempaa = utils.getExplorer()
        if (tempaa == 'QQ') {
          window.open(res)
        } else {
          let iframe = document.createElement('iframe')
          iframe.style.display = 'none'
          iframe.src = res
          document.body.appendChild(iframe)
        }
      })
    },
    // 获取明细信息
    getDetailInfo(orderCode) {
      let method = checkDetail()
      let para = {
        routerMethod: method,
        orderCode
      }
      converterApi(para).then(res => {
        this.orderDetail = res
        this.dialogTableData = res.subOrderList || []
        this.dialogTableData.map(item => {
          item.upgradeWarrantyPeriodName = `${item.upgradeWarrantyPeriod || '--'}` + `${item.upgradeWarrantyPeriod ? '年' : ''}`
          // 显示需要判断是否已升级
          item.codeId = item.upgradeGoodsCommodityCode || item.baseGoodsCommodityCode
          item.goodsName = item.upgradeGoodsName || item.baseGoodsName
          item.goodsClass = item.upgradeGoodsTypeName || item.baseGoodsTypeName
          item.plateName = item.upgradeGoodsName || item.baseBrandMerchantName
          item.saleprice = item.upgradePrice || item.baseShopPrice
          return item
        })
        this.dialogTableData2 = res.accessLogs || []
        this.dialogTableData2.map(item => {
          item.logTypeName = logTypeList[parseInt(item.logType)]
          item.createdDate = item.createdDate ? utils.dateFormat(item.createdDate, 'YYYY-MM-DD HH:mm') : '--'
          return item
        })
        this.detailImage = res.payOrder.payVoucher
        this.detailImageList = []
        this.detailImageList.push(this.detailImage)
        this.dialogVisible = true
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.tipper {
  width: 100%;
  box-sizing: border-box;
  padding: 0px 16px 10px 20px;
  .tip_text {
    font-size: 12px;
    font-weight: 400;
    color: #000000;
    display: flex;
    align-items: center;
  }
  .right_select {
    width: 286rpx;
    overflow: hidden;
  }
}
.pannel {
  padding: 0 15px;
}
.table_wrap {
  padding: 0 15px;
  padding-bottom: 10px;
}
.spanbtn {
  cursor: pointer;
}
.dialog_content {
  // height: 400px;
  overflow-y: scroll;
  .wrapper {
    width: 100%;
    box-sizing: border-box;
    padding-bottom: 20px;
    border-bottom: 1px solid #e6e6e6;
    margin-bottom: 20px;
    .title {
      display: flex;
      align-items: center;
      font-weight: bold;
    }
    .title_icon {
      width: 2px;
      height: 10px;
      background: #5850ff;
      margin-right: 5px;
    }
    .message_wrap {
      box-sizing: border-box;
      padding-top: 10px;
      padding-right: 10px;
      .box_info {
        width: 33.33%;
        overflow: hidden;
        > div:first-child {
          margin-bottom: 10px;
        }
        .info_text {
          min-height: 17px;
          font-size: 12px;
          font-weight: bold;
          color: #333333;
          line-height: 17px;
          .infoImg {
            width: 100px;
            height: 100px;
          }
        }
        .flex_img {
          display: flex;
          align-items: flex-start;
        }
      }
    }
    .maxHeight {
      min-height: 127px;
      align-items: flex-start;
    }
    .comment_wrap {
      margin-top: 10px;
      .comment_rate {
        display: flex;
        align-items: center;
      }
      .comment_line {
        display: flex;
        align-items: center;
        margin-bottom: 5px;
        .textarea_con {
          width: 60%;
          white-space: pre-wrap;
          word-spacing: 2;
        }
      }
      .nocenter {
        display: flex;
        align-items: flex-start;
      }
    }
    .dialog_table_wrap {
      margin-top: 5px;
    }
  }
  .noBorder {
    border: none;
  }
}
.right_select /deep/ .el-select .el-tag__close.el-icon-close {
  display: none;
}
.table_wrap /deep/ .el-table__row > td {
  border-right: none;
}
// .table_wrap /deep/ .el-table th.is-leaf:first-child {
//   border-right: none;
// }
</style>