index.vue 27.5 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
<!-- 店面配置 -->

<template>
  <div>
    <d2-container>
      <div class="header" slot="header" style="padding: 10px 20px">
        <d2-search
          ref="showSearch"
          class="show-search"
          label-width="100px"
          :search-form="searchForm"
          :form-data="showFormData"
        />
        <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 class="d2-container-content">
        <d2-table-header>
          <auth-button category="Button" />
        </d2-table-header>
        <d2-table
          ref="recordTable"
          :get-list-api="getListApi"
          :search-form="searchFormSearch"
          :table-params="tableParams"
          :before-search-fn="beforeSearchFn"
        >
          <auth-button
            slot="auth-button"
            slot-scope="scope"
            :data="scope.scope"
          />
        </d2-table>
      </div>
    </d2-container>
    <!-- 导入门店设置 -->
    <d2-dialog
      :title="'上传文件'"
      :is-visible="fileVisible"
      @closeDialog="handleImport"
      @confirmDialog="handleConfirmImport"
      width="600px"
    >
      <slot>
        <div>
          <el-form
            :model="fileForm"
            :rules="fileRules"
            ref="fileRuleForm"
            label-width="120px"
          >
            <el-form-item label="导入文件:" prop="fileName">
              <el-col :span="16">
                <el-input readonly v-model="fileForm.fileName" />
              </el-col>
              <el-col :span="4" class="m-l-md">
                <el-button class="import-btn">
                  导入文件
                  <input
                    type="file"
                    id="fileUpload"
                    class="import-input"
                    accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
                    @change="importFile($event)"
                  />
                  <el-link
                    type="primary"
                    class="import-template"
                    @click="downLoadTemplate"
                    icon="el-icon-link"
                  >
                    文件下载
                  </el-link>
                </el-button>
              </el-col>
            </el-form-item>
          </el-form>
          <span v-show="showNum">
            <div class="upload-statistics">
              <div class="quantity">
                <div class="success">{{ importNum.successCount }}</div>
                <div>有效数据</div>
              </div>
              <div class="line"></div>
              <div class="quantity">
                <div class="err">{{ importNum.failCount }}</div>
                <div>异常数据</div>
              </div>
            </div>
            <div class="abnormal">
              <p>数据异常的可能原因:</p>
              <p class="color-33">1. 订单编号不匹配</p>
            </div>
          </span>
        </div>
      </slot>
    </d2-dialog>

    <!-- 收款码 -->
    <qrcode-dialog
      :q-rcode-visible="qRcodeVisible"
      :info="recordInfo"
      v-if="qRcodeVisible"
      @dialogClose="dialogClose"
    />
    <employee-dialog
      :employee-visible="employeeVisible"
      :info="recordInfo"
      v-if="employeeVisible"
      @dialogClose="employeeDialogClose"
    />
    <!-- 门店标签 -->
    <flag-dialog
      :flag-visible="flagVisible"
      :info="recordInfo"
      v-if="flagVisible"
      @dialogClose="flagDialogClose"
    />
    <!-- 积分归属 -->
    <!-- <d2-dialog
      :title="'提示'"
      :is-visible="setPointsVisible"
      @closeDialog="handleCancel"
      @confirmDialog="handleConfirmSet"
      width="576px"
    >
      <el-form :model="pointSetObj" ref="ruleForm" class="points-set-form">
        <el-form-item label-width="120px" label="门店积分归属:" prop="type">
          <el-radio-group v-model="pointSetObj.type">
            <el-radio :label="0">门店员工</el-radio>
            <el-radio :label="1">驻店员工</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-form>
    </d2-dialog> -->
    <!-- 标记退款 -->
    <!-- <d2-dialog
      :title="'请选择该门店标记退款功能是否打开'"
      v-if="signVisible"
      :is-visible="signVisible"
      @closeDialog="handleSignClose"
      @confirmDialog="handleConfirmSign"
    >
      <slot>
        <el-radio-group v-model="refundForm.pointsRefundAvailable">
          <template v-for="item in refundForm.rList">
            <el-radio :label="item.confId" :key="item.confId">{{
              item.confLabel
            }}</el-radio>
          </template>
        </el-radio-group>
      </slot>
    </d2-dialog> -->

    <d2-dialog
      title="阳光激励配置"
      v-if="signVisible"
      :is-visible="signVisible"
      @closeDialog="handleSignClose"
      @confirmDialog="handleConfirmSign"
    >
      <glsx-combi-form
        :isBlock="true"
        class="edit-form-container"
        ref="editFormRef"
        label-width="220px"
        default-width="400px"
        :form-obj="integralForm"
        :form-data="integralFormData"
      >
      </glsx-combi-form>
    </d2-dialog>
  </div>
</template>

<script>
import { Util, deepClone, downLoadFile } from "@/common/util"
import { mapActions, mapState, mapMutations } from "vuex"
import dayjs from "dayjs"
import {
  shopSettingList,
  listYqRef,
  getBrandList,
  setIntegralBelongApi,
  getIntegralBelongApi,
  getShopMerchantConfig,
  switchPointSign
} from "@/api/shopConfig.js"
import {
  merchantOutputValueTargetExport,
  merchantOutputValueTargetImport
} from "@api/index"
import { businessNature, storeType } from "@/common/constants.js"
import qrcodeDialog from "./components/qRcodeDialog"
import employeeDialog from "./components/employeeDialog"
import flagDialog from "./components/flagDialog"
export default {
  name: "ShopConfigIndex",
  components: {
    qrcodeDialog,
    flagDialog,
    employeeDialog
  },
  data() {
    return {
      userInfo: this.$store.state.d2admin.user.info,
      nowMonth: dayjs()
        .subtract(0, "months")
        .startOf("month")
        .format("YYYY-MM"),
      searchForm: {
        areaCode: "",
        merchantName: "",
        merchantId: "",
        orderTime: "",
        areaSupervision: "",
        residentManager: "",
        shopLabelFlag: "",
        brandIdList: []
      },
      searchFormSearch: {},
      showFormData: [
        {
          label: "区域",
          name: "areaCode",
          type: "select",
          optionList: [],
          optionId: "adcode",
          optionLabel: "name",
          optionsName: "provinceInfoList"
        },
        {
          label: "4S店",
          name: "merchantName",
          type: "input",
          maxlength: "20",
          isClear: true
        },
        {
          label: "商户号",
          name: "merchantId",
          type: "input",
          inputType: "number",
          maxlength: "20",
          isClear: true
        },
        {
          label: "订单日期",
          name: "orderTime",
          type: "datePicker",
          isClear: true,
          pickerOptions: "rangePickerOptions"
        },
        {
          label: "区域督导",
          name: "areaSupervision",
          type: "input",
          maxlength: "20",
          isClear: true
        },
        {
          label: "门店标签",
          name: "shopLabelFlag",
          type: "select",
          isClear: true,
          optionList: [],
          optionId: "confId",
          optionLabel: "confValue",
          optionsName: "shopLabelFlagList"
        },
        {
          label: "主营品牌",
          name: "brandIdList",
          type: "select",
          multiple: true,
          multipleLimit: 5,
          collapseTags: true,
          optionList: [],
          optionId: "id",
          optionLabel: "label",
          optionsName: "brandList",
          changeAttr: (value, targetItem) => {}
        }
      ],
      getListApi: shopSettingList,
      tableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: "list",
        tableOption: true,
        tableColumns: [
          {
            label: "区域",
            prop: "area"
          },
          {
            label: "4S店",
            prop: "merchantName",
            width: "200px",
            formatter: (cellValue) => {
              return cellValue.merchantName + cellValue.merchantId
            }
          },
          {
            label: "门店类型",
            prop: "channelType",
            formatter: (cellValue) => {
              return this.baseData.storeType.find(
                (item) => item.confId === cellValue.channelType
              )?.confName
            }
          },
          {
            label: "业务性质",
            prop: "businessType",
            formatter: (cellValue) => {
              return this.baseData.businessNature.find(
                (item) => item.confId === cellValue.businessType
              )?.confName
            }
          },
          {
            label: "主营品牌",
            prop: "brandName",
            width: "200px"
          },
          {
            label: "区域督导",
            prop: "areaSupervisionList",
            width: "200px",
            formatter: (cellValue) => {
              let areaSuper =
                cellValue.areaSupervisionList &&
                cellValue.areaSupervisionList.length
                  ? cellValue.areaSupervisionList
                      .map((item) => item.userName)
                      .join("/")
                  : "-"
              return areaSuper
            }
          },
          {
            label: "门店标签",
            prop: "shopLabelFlag",
            formatter: (cellValue) => {
              return cellValue.shopLabelFlag == "Y" ? "有" : "无"
            }
          },
          {
            label: "部署状态",
            prop: "deployScene",
            width: "150px"
          },
          {
            label: "下级商户",
            prop: "list",
            width: "200",
            html: true,
            formatter: (cellValue) => {
              var html = ""
              var list = []
              if (cellValue.list && cellValue.list.length > 0) {
                cellValue.list.map((item) => {
                  list.push(item.idAndName)
                })
                html = list.join("<br>")
              }
              return html
            }
          },
          {
            label: "最新订单日期",
            prop: "orderTime",
            width: "120px",
            formatter: (cellValue) => {
              return cellValue.orderTime
                ? Util.dateFormate(cellValue.orderTime, "YYYY-MM-DD")
                : ""
            }
          }
        ]
      },
      baseData: {
        areaList: [],
        businessNature: businessNature,
        storeType: storeType,
        provinceInfoList: [],
        shopLabelFlagList: [
          { confId: "Y", confValue: "有" },
          { confId: "N", confValue: "无" }
        ],
        brandList: []
      },
      recordInfo: null,
      fileVisible: false,
      signVisible: false,
      showNum: false,
      importNum: {
        succNum: 0,
        failNum: 0
      },
      fileForm: {},
      fileRules: {
        fileName: [{ required: true, message: "请上传文件", trigger: "change" }]
      },
      qRcodeVisible: false,
      employeeVisible: false,
      flagVisible: false,
      pointSetObj: {
        type: null
      },
      setPointsVisible: false,
      integralForm: {
        pointsRefundAvailable: "N",
        pointsWechatWithdrawal: "N",
        pointsAudit: "N",
        pointsAllocate: 0
      },
      integralFormData: [
        {
          label: "门店标记退款功能",
          name: "pointsRefundAvailable",
          type: "radio",
          optionId: "confId",
          optionLabel: "confName",
          tips: "打开后积分管理模块可以对订单进行退款标记",
          optionList: [
            { confId: "Y", confName: "开" },
            { confId: "N", confName: "关" }
          ],
          handleRadioChange: (val) => {
          }
        },
        {
          label: "门店积分归属",
          name: "pointsAllocate",
          type: "radio",
          optionId: "confId",
          optionLabel: "confName",
          tips: "可选择门店积分是归属门店员工还是驻店员工",
          optionList: [
            { confId: 0, confName: "门店员工" },
            { confId: 1, confName: "驻店员工" }
          ],
          handleRadioChange: (val) => {
           
          }
        },
        {
          label: "门店积分支持微信提现功能",
          name: "pointsWechatWithdrawal",
          type: "radio",
          optionId: "confId",
          optionLabel: "confName",
          tips: "打开后门店员工或者驻店员工可以使用微信提现",
          optionList: [
            { confId: "Y", confName: "开" },
            { confId: "N", confName: "关" }
          ],
          handleRadioChange: (val) => {
           
          }
        },
        {
          label: "门店订单审批功能",
          name: "pointsAudit",
          type: "radio",
          optionId: "confId",
          optionLabel: "confName",
          tips: "打开后门店收款的积分订单需要走审批流程",
          optionList: [
            { confId: "Y", confName: "开" },
            { confId: "N", confName: "关" }
          ],
           handleRadioChange: (val) => {
           
          }
        }
      ]
    }
  },
  computed: {
    ...mapState({
      dowloadList: (state) => state.d2admin.user.dowloadList,
      updateList: (state) => state.d2admin.user.updateList,
      updateRefesh: (state) => state.d2admin.user.updateRefesh
    })
  },
  watch: {
    updateRefesh(val) {
      if (val == true) {
        this.handleSearch()
        this.setUpdateRefesh("false")
      }
    }
  },
  mounted() {
    this.getBaseData()
    this.getProvinceList()
    this.getBrandList()
  },

  methods: {
    ...mapActions({
      get: "d2admin/base/get",
      close: "d2admin/page/close"
    }),
    ...mapActions("d2admin/user", ["actionSetDownloadList"]),
    ...mapMutations("d2admin/user", ["setUpdateRefesh"]),
    async getBaseData() {
      this.getOptionsList()
    },
    //员工注册码
    employeeRegistrationCode(row) {
      this.recordInfo = row
      this.employeeVisible = !this.employeeVisible
    },
    //获取店铺阳光激励积分配置
    markRefundHandle(row) {
      try {
        getShopMerchantConfig({ merchantId: row.merchantId }).then((res) => {
          if (res) {
            this.integralForm = {
              pointsRefundAvailable: res.pointsRefundAvailable,
              pointsAllocate: res.pointsAllocate,
              pointsAudit: res.pointsAudit,
              pointsWechatWithdrawal: res.pointsWechatWithdrawal
            }
          } else {
            this.integralForm = {
              pointsWechatWithdrawal: "N",
              pointsAudit: "N",
              pointsRefundAvailable: "N",
              pointsAllocate: 0
            }
          }
          this.integralForm.merchantId = row.merchantId
          this.signVisible = true
        })
      } catch (err) {
        return new Error(err)
      }
    },
    beforeSearchFn() {
      return new Promise((resolve) => {
        this.searchFormSearch = deepClone(this.searchForm)
        if (this.searchFormSearch.orderTime) {
          this.searchFormSearch.orderStartTime = Util.dateFormate(
            this.searchFormSearch.orderTime[0],
            "YYYY-MM-DD 00:00:00"
          )
          this.searchFormSearch.orderEndTime = Util.dateFormate(
            this.searchFormSearch.orderTime[1],
            "YYYY-MM-DD 23:59:59"
          )
          delete this.searchFormSearch.orderTime
        }
        resolve()
      })
    },

    // 积分归属
    setPointsAttribution(row) {
      let params = { merchantId: row.merchantId }
      this.pointSetObj.merchantId = row.merchantId
      getIntegralBelongApi(params).then((res) => {
        this.pointSetObj.type = res?.scoreSource || 0
        this.setPointsVisible = true
      })
    },
    handleCancel() {
      this.setPointsVisible = false
    },
    handleConfirmSet() {
      let { type, merchantId } = this.pointSetObj
      let params = {
        scoreSource: type,
        merchantId
      }
      setIntegralBelongApi(params).then((res) => {
        this.handleCancel()
        this.showSuccessMsgbox()
      })
    },
    showSuccessMsgbox() {
      let text = "门店积分归属已配置成功"
      this.$confirm(text, "提示", {
        confirmButtonText: "知道了",
        showCancelButton: false,
        type: "success"
      }).then(() => {})
    },

    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
            ] !== "全部"
          ) {
            if (item.optionsName != "brandList") {
              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]
          )
        }
      })
    },

    // 省市区
    getProvinceList() {
      var map = new AMap.Map("district", {
        resizeEnable: true
      })
      AMap.plugin(["AMap.DistrictSearch"], () => {
        var opts = {
          subdistrict: 1, // 返回下一级行政区
          level: "city", // 查询的范围
          showbiz: true // 查询行政级别为 市
        }
        var districtSearch = new AMap.DistrictSearch(opts)
        districtSearch.search("中国", (status, result) => {
          this.baseData.provinceInfoList = result.districtList[0].districtList
          console.log(this.baseData.provinceInfoList)
          this.getOptionsList()
          // com.getSelect({
          //   id: 'startp',
          //   name: 'provinceName',
          //   url: '/area/list',
          //   // value: 'provinceId',
          //   data: provinceInfoList,
          //   value: 'name',
          //   text: 'name',
          //   param: {},
          //   select: function (data) {
          //     const { value } = data
          //     if (value) {
          //       // var province = provinceInfoList.find(item => item.provinceId == value)
          //       var province = provinceInfoList.find(item => item.name == value)
          //       cityInfo = province.districtList
          //       merchantForm.provinceCode = province.adcode
          //       merchantForm.provinceName = province.name
          //       $('#addrEl').val('')
          //     } else {
          //       cityInfo = []
          //       merchantForm.provinceCode = ''
          //       merchantForm.provinceName = ''
          //     }
          //     merchantForm.cityCode = ''
          //     merchantForm.cityName = ''
          //     com.getSelect({
          //       id: 'startc',
          //       name: 'cityName',
          //       url: '/area/list',
          //       value: 'name',
          //       text: 'name',
          //       data: cityInfo,
          //       link: 'startp',
          //       select: function (data) {
          //         const { value } = data
          //         if (value) {
          //           // var city = cityInfo.find(item => item.cityId == value)
          //           var city = cityInfo.find(item => item.name == value)
          //           merchantForm.cityCode = city.adcode
          //           merchantForm.cityName = city.name
          //         } else {
          //           merchantForm.cityCode = ''
          //           merchantForm.cityName = ''
          //         }
          //       }
          //     })
          //   }
          // })
        })
      })
    },

    handleSearch() {
      this.$refs.recordTable.refreshTable()
    },
    handleReset() {
      this.searchForm = {
        areaCode: "",
        merchantName: "",
        merchantId: "",
        orderTime: "",
        areaSupervision: "",
        residentManager: "",
        shopLabelFlag: "",
        brandIdList: []
      }
      this.$refs.recordTable.refreshTable()
    },

    handleExport() {
      var params = deepClone(this.searchFormSearch)
      // debugger
      params.method =
        "dj.api.smarcarlife.serviceMerchant.shopSettingList.export.async"
      if (params.brandIdList && params.brandIdList.length > 0) {
        params.brandIdList.forEach((item, index) => {
          const name = `brandIdList[${index}]`
          params[name] = item
        })
      }
      delete params.brandIdList
      console.log(params, "params")
      const list = [
        ...this.dowloadList,
        {
          name: "店面配置列表",
          exportParam: JSON.stringify(params),
          status: "waiting",
          timeid: new Date().getTime()
        }
      ]
      this.actionSetDownloadList({ list, type: "dowloadList" })
    },

    downLoadTemplate() {
      merchantOutputValueTargetExport({ targetDate: this.nowMonth }).then(
        (result) => {
          result && downLoadFile(result)
        }
      )
    },
    // 上传文件,转码为base64
    importFile(e) {
      const size = e.target.files[0].size / 1024 / 1024
      console.log(e)
      if (size < 9) {
        this.$set(this.fileForm, "fileName", e.target.files[0].name)
        // // 转码base64
        const reader = new FileReader()
        reader.readAsDataURL(e.target.files[0])
        reader.onload = (event) => {
          const imgFile = event.target.result
          const arrBase64 = imgFile.split(",")
          this.fileInfo =
            e.target.files[0].name.split(".")[1] + "@" + arrBase64[1]
          document.getElementById("fileUpload").value = ""
        }
      } else {
        this.notice.errorTips("上传文件不可超过9M")
      }
    },
    handleImport() {
      this.fileVisible = !this.fileVisible
      this.$refs.fileRuleForm && this.$refs.fileRuleForm.resetFields()
    },
    handleConfirmImport() {
      const that = this
      this.$refs.fileRuleForm.validate((valid) => {
        if (valid) {
          merchantOutputValueTargetImport({ file: this.fileInfo }).then(
            (result) => {
              console.log(result, "result")
              if (result) {
                // debugger
                // 异步处理文件上传 把id传入处理轮询
                const list = [
                  ...that.updateList,
                  {
                    name: that.fileForm.fileName,
                    ifSuccess: false,
                    uuid: result,
                    type: "upload"
                    // labelText: ''
                  }
                ]
                console.log(list, "list")
                that.actionSetDownloadList({ list, type: "updateList" })
                that.notice.okTips("上传成功")
                that.handleImport()
              }
            }
          )
        }
      })
    },

    // 收款二维码按钮
    collectionQRcode(row) {
      this.recordInfo = row
      this.qRcodeVisible = !this.qRcodeVisible
    },
    dialogClose() {
      this.qRcodeVisible = !this.qRcodeVisible
    },
    employeeDialogClose() {
      this.employeeVisible = !this.employeeVisible
    },
    handleSignClose() {
      this.signVisible = false
    },
    handleConfirmSign() {
      switchPointSign({
        ...this.integralForm
      })
        .then((result) => {
          if (result) {
            this.signVisible = false
            this.$message.success("阳光激励配置已配置成功")
          }
        })
        .catch((err) => {
          new Error(err)
        })
    },
    // 工单配置
    handleSet(row) {
      this.close({ tagName: "/shopConfig" })
      this.$router.push({
        name: "setWorkorderDetail",
        query: {
          info: JSON.stringify(row)
        }
      })
    },

    // 人员管理
    handlePersonnelManage(row) {
      listYqRef({ merchantId: row.merchantId }).then((result) => {
        this.close({ tagName: "/shopConfig" })
        this.$router.push({
          name: "personnelManagementIndex",
          params: {
            merchants: result,
            info: row
          }
        })
      })
    },
    // 店铺配置
    handleShopSet(row) {
      this.close({ tagName: "/shopConfig" })
      this.$router.push({
        name: "shopSet",
        params: {
          info: row
        }
      })
    },
    // 门店标签
    handleShopLabelFlag(row) {
      console.log(row)
      this.recordInfo = row
      this.flagVisible = !this.flagVisible
    },
    flagDialogClose(obj) {
      this[obj.attrName] = !this[obj.attrName]
      if (obj.flag) {
        this.$refs.recordTable.refreshTable()
      }
    },

    //导出标签
    handleExportLabel() {
      var params = this.searchFormSearch
      // 去除为null的值
      for (const key in params) {
        if (
          params[key] === null ||
          params[key] === "" ||
          params[key].length == 0
        ) {
          delete params[key]
        }
      }
      params.method = "dj.api.smartcarlife.serviceMerchant.label.export.async"
      if (params.brandIdList && params.brandIdList.length > 0) {
        params.brandIdList.forEach((item, index) => {
          const name = `brandIdList[${index}]`
          params[name] = item
        })
      }
      delete params.brandIdList
      const list = [
        ...this.dowloadList,
        {
          name: "店面配置标签",
          exportParam: JSON.stringify(params),
          status: "waiting",
          timeid: new Date().getTime()
        }
      ]
      this.actionSetDownloadList({ list, type: "dowloadList" })
    },

    getBrandList() {
      getBrandList({}).then((res) => {
        this.baseData.brandList = res
        this.getOptionsList()
      })
    }
  }
}
</script>

<style lang="scss" scoped>
::v-deep.edit-form-container {
  .tips-icon {
    border: none;
  }
}
::v-deep.yqdTableContainer {
  .el-table .cell {
    padding: 0 10px;
  }

  // padding-right: 3px;
  .el-table__body-wrapper {
    .el-table__row td:nth-child(1) {
      border-left: 1px solid #ebeef5;
    }

    .el-table__row td:nth-last-child(1) {
      border-right: 1px solid #ebeef5;
    }
  }

  .select {
    .el-tag {
      width: auto;
    }
  }
}

.upload-wrap {
  display: flex;
}

.import-btn {
  position: relative;
}

.import-input {
  opacity: 0;
  position: absolute;
  right: 0;
  top: 0;
  width: 98px;
  height: 36px;
  cursor: pointer;
  font-size: 0;
}

.import-template {
  position: absolute;
  height: 20px;
  top: 50px;
  left: 0;
}

.m-l-md {
  margin-left: 20px;
}

.upload-statistics {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 30px 70px;

  .quantity {
    font-size: 14px;
    color: #333333;
    text-align: center;

    .success {
      font-size: 26px;
      color: #2cca74;
      text-align: center;
      margin-bottom: 4px;
    }

    .err {
      font-size: 26px;
      color: #eb4e4e;
      text-align: center;
      margin-bottom: 4px;
    }
  }

  .line {
    width: 1px;
    height: 56px;
    background: #e8e8ea;
  }
}
.points-set-form {
  display: flex;
  align-items: center;
  justify-content: center;
}
</style>