<template>
  <div class="app-container">
    <el-form :model="queryParams" :label-position="left" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item prop="phoneNumber">
        <el-input v-model="queryParams.phoneNumber" placeholder="请输入手机号" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item prop="nickName">
        <el-input v-model="queryParams.nickName" placeholder="请输入昵称" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item prop="realName">
        <el-input v-model="queryParams.realName" placeholder="请输入真实姓名" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" @click="handleAdd" v-hasPermi="['app:user:add']" v-if="userInfoVO.userType == '02'">新增
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <Page uri="/mapi/app/user/list" :request-params="queryParams" ref="pagination">
      <!--      <el-table-column type="selection" width="55" align="center" fixed="left"/>-->
      <!--      <el-table-column label="客户ID" align="center" prop="id" />-->
      <el-table-column label="昵称" align="center" prop="nickName" />
      <el-table-column label="真实姓名" align="center" prop="realName" />
      <el-table-column label="手机号" align="center" prop="phoneNumber" />
      <el-table-column label="头像" align="center" prop="avatarUrl">
        <template slot-scope="scope">
          <el-avatar shape="square" size="large" :src="scope.row.avatarUrl"></el-avatar>
        </template>
      </el-table-column>
      <el-table-column label="性别" align="center" prop="sex">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.sex" />
        </template>
      </el-table-column>
      <el-table-column label="生日" align="center" prop="birthday" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.birthday, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="客户等级" align="center" prop="level" />
      <!--      <el-table-column label="微信唯一标识" align="center" prop="unionId" />-->
      <!--      <el-table-column label="支付密码" align="center" prop="payPassword" />-->
      <!--      <el-table-column label="是否使用支付密码" align="center" prop="isUsePayPassword" />-->
      <!--      <el-table-column label="状态" align="center" prop="status">-->
      <!--        <template slot-scope="scope">-->
      <!--          <el-switch v-model="scope.row.status" active-value="0" inactive-value="1"-->
      <!--                     @change="handleStatusChange(scope.row)"></el-switch>-->
      <!--        </template>-->
      <!--      </el-table-column>-->

      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="150"
        v-if="userInfoVO.userType == '02' || userInfoVO.userType == '00'">
        <template slot-scope="scope">
          <el-button type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['app:user:edit']"
            v-if="userInfoVO.userType == '02'">修改</el-button>
          <!--          <el-button-->
          <!--             -->
          <!--            type="text"-->
          <!--            icon="el-icon-delete"-->
          <!--            @click="handleDelete(scope.row)"-->
          <!--            v-hasPermi="['app:user:remove']"-->
          <!--          >删除</el-button>-->
          <el-button type="text" icon="el-icon-view" @click="handleView(scope.row)">客户信息</el-button>
        </template>
      </el-table-column>
    </Page>
    <!-- 添加或修改用户对话框 -->
    <el-dialog :title="title" :visible.sync="open" size="80%" append-to-body destroy-on-close>
      <EditUser ref="editUser" :dataSource="form" :isDisabled="isDisabled" @onSubmit="submitForm" />
      <!--      <el-row :gutter="15" >-->
      <!--        <el-form ref="form" :model="form" :rules="rules" label-width="100px">-->
      <!--          <el-col :span="24">-->
      <!--            <el-form-item label="昵称" prop="nickName">-->
      <!--              <el-input v-model="form.nickName" placeholder="请输入昵称" maxlength="50" show-word-limit clearable :disabled="isDisabled"/>-->
      <!--            </el-form-item>-->
      <!--            <el-form-item label="真实姓名" prop="realName">-->
      <!--              <el-input v-model="form.realName" placeholder="请输入真实姓名" maxlength="5" show-word-limit clearable :disabled="isDisabled"/>-->
      <!--            </el-form-item>-->
      <!--            <el-form-item label="手机号" prop="phoneNumber">-->
      <!--              <el-input v-model="form.phoneNumber" placeholder="请输入手机号" maxlength="11" show-word-limit clearable :disabled="isDisabled"/>-->
      <!--            </el-form-item>-->
      <!--            <el-form-item label="性别" prop="sex">-->
      <!--              <el-select v-model="form.sex" placeholder="请选择性别" clearable :disabled="isDisabled">-->
      <!--                <el-option-->
      <!--                  v-for="dict in dict.type.sys_user_sex"-->
      <!--                  :key="dict.value"-->
      <!--                  :label="dict.label"-->
      <!--                  :value="dict.value"-->
      <!--                ></el-option>-->
      <!--              </el-select>-->
      <!--            </el-form-item>-->
      <!--            <el-form-item label="生日" prop="birthday" clearable >-->
      <!--              <el-date-picker clearable-->
      <!--                              v-model="form.birthday"-->
      <!--                              type="date"-->
      <!--                              value-format="yyyy-MM-dd"-->
      <!--                              placeholder="请选择生日"-->
      <!--                              :disabled="isDisabled">-->
      <!--              </el-date-picker>-->
      <!--            </el-form-item>-->
      <!--            <el-form-item label="头像地址" prop="avatarUrl" >-->
      <!--              <image-upload v-model="form.avatarUrl" :limit="1" :disabled="isDisabled"/>-->
      <!--            </el-form-item>-->
      <!--            <el-form-item label="客户等级" prop="level">-->
      <!--              <el-input-number v-model="form.level"  :min="1" :max="50" label="请输入客户等级" :disabled="isDisabled"></el-input-number>-->
      <!--            </el-form-item>-->
      <!--            <el-form-item label="备注" prop="remark">-->
      <!--              <el-input v-model="form.remark" placeholder="请输入备注" maxlength="50" show-word-limit />-->
      <!--            </el-form-item>-->
      <!--          </el-col>-->
      <!--        </el-form>-->
      <!--      </el-row>-->

      <!--      <div slot="footer" class="dialog-footer">-->
      <!--        <el-button type="primary" @click="submitForm" style="margin-left: 5%">提交</el-button>-->
      <!--        <el-button @click="cancel">取 消</el-button>-->
      <!--      </div>-->
    </el-dialog>

    <!-- 客户详情 -->
    <el-dialog title="客户详情" :visible.sync="userViewType" width="70%" append-to-body class="user_drawer">
      <div class="userContent">
        <el-descriptions :column="2" border>
          <el-descriptions-item label="用户名">{{userInfo?userInfo.realName:'- -'}}</el-descriptions-item>
          <el-descriptions-item label="手机号" style="width: 100px">{{userInfo?userInfo.phoneNumber:'- -'}}</el-descriptions-item>
          <el-descriptions-item label="等级">{{userInfo?userInfo.level:'- -'}}</el-descriptions-item>
          <el-descriptions-item label="性别">
            <dict-tag :options="dict.type.sys_user_sex" :value="userInfo.sex" />
          </el-descriptions-item>
          <el-descriptions-item label="生日">
            {{ parseTime(userInfo.birthday, '{y}-{m}-{d}') }}
          </el-descriptions-item>

          <el-descriptions-item label="充值余额">
            {{userInfo?userInfo.rechargeBalance : '- -'}}
          </el-descriptions-item>

          <el-descriptions-item label="赠送余额">
            {{userInfo?userInfo.giveBalance:'- -'}}
          </el-descriptions-item>
          <el-descriptions-item label="福利金余额">
            {{userInfo?userInfo.welfareBalance : '- -'}}
          </el-descriptions-item>
          <el-descriptions-item label="地址">
            {{ getAddress(userInfo) ? getAddress(userInfo) : '暂无地址' }}
          </el-descriptions-item>
        </el-descriptions>
        <br />

        <el-tabs type="border-card" v-model="activeValue" @tab-click="btn_chioc">
          <el-tab-pane name="1">
            <span slot="label"><i class="el-icon-s-ticket"></i> 优惠券</span>
            <el-table v-loading="userloading" :data="userinfoData"  fit highlight-current-row border stripe>
              <el-table-column label="编号" align="center" prop="id" />
              <el-table-column label="优惠券名称" align="center" prop="couponTypeTitle" width="120" :show-overflow-tooltip="true" />
              <el-table-column label="优惠券类型" align="center" prop="discountWay" width="120" :show-overflow-tooltip="true">
                <template slot-scope="scope">
                  <dict-tag :options="dict.type.coupon_type" :value="scope.row.discountWay" />
                </template>
              </el-table-column>
              <el-table-column label="券值" align="center" prop="deductAmount" width="150">
                <template slot-scope="scope">
                    <span v-if="scope.row.discountWay == 0">满{{ scope.row.minAmount }}元减{{ scope.row.deductAmount }}元</span>
                    <span v-if="scope.row.discountWay == 1">满{{ scope.row.minAmount }}件减{{ scope.row.deductAmount }}件</span>
                    <span v-if="scope.row.discountWay == 2">{{ scope.row.discountRate }}%折扣</span>
                </template>
            </el-table-column>
            <el-table-column label="有效期开始时间" align="center" prop="startDate" width="180"> </el-table-column>
              <el-table-column label="有效期结束时间" align="center" prop="endDate" width="180"> </el-table-column>
              <el-table-column label="是否核销" align="center" prop="isUsed" width="80">
                <template slot-scope="scope">
                  <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.isUsed" />
                </template>
              </el-table-column>

              <el-table-column label="核销门店" align="center" prop="usedOrgName" width="120" :show-overflow-tooltip="true" />

              <el-table-column label="核销时间" align="center" prop="usedTime" width="180"> </el-table-column>
              
              
            </el-table>
            <pagination v-show="usertotal > 0" :total="usertotal" :page.sync="userViewForm.pageNum" :limit.sync="userViewForm.pageSize"
              @pagination="getMemberCouponData" />
          </el-tab-pane>
          <el-tab-pane name="2">
            <span slot="label"><i class="el-icon-coin"></i> 消费明细</span>
            <el-table v-loading="userloading" :data="userinfoData" fit highlight-current-row border stripe>
              <el-table-column label="订单编号" align="center" prop="orderNo" min-width="200" />
              <el-table-column label="订单类型" align="center" prop="orderType" width="150">
                <template slot-scope="scope">
                  <dict-tag :options="dict.type.order_type" :value="scope.row.orderType" />
                </template>
              </el-table-column>
              <el-table-column label="账单标题" align="center" prop="title" width="100" />
              <el-table-column label="支付方式" align="center" prop="payType" width="100">
                <template slot-scope="scope">
                  <dict-tag :options="dict.type.recharge_pay_type" :value="scope.row.payType" />
                </template>
              </el-table-column>
              <el-table-column label="支付总金额" align="center" prop="payTotalAmount" width="100" />
              <el-table-column label="现金支付金额" align="center" prop="cashPayAmount" width="100" />
              <el-table-column label="充值余额支付金额" align="center" prop="rechargePayAmount" width="150" />
              <el-table-column label="赠送余额支付金额" align="center" prop="givePayAmount" width="150" />
              <el-table-column label="福利金余额支付金额" align="center" prop="welfarePayAmount" width="150" />
              <el-table-column label="消费积分" align="center" prop="usePoint" width="80" />
              <el-table-column label="获取积分" align="center" prop="receivePoint" width="80" />
              <el-table-column label="是否退款" align="center" prop="isRefund" width="80" />
            </el-table>
            <pagination v-show="usertotal > 0" :total="usertotal" :page.sync="userViewForm.pageNum" :limit.sync="userViewForm.pageSize"
              @pagination="getMemberBillMstrData" />
          </el-tab-pane>
          <el-tab-pane name="3">
            <span slot="label"><i class="el-icon-shopping-cart-1"></i> 商品订单</span>
            <el-table v-loading="userloading" :data="userinfoData" fit highlight-current-row border stripe>
              <el-table-column label="订单编号" align="center" prop="orderNo" width="150" />
              <el-table-column label="订单总价（元）" align="center" prop="totalPrice" width="150" />
              <el-table-column label="抵扣金额（元）" align="center" prop="deductAmount" width="150">
                <template slot-scope="scope">
                  {{ scope.row.deductAmount ? scope.row.deductAmount : '0' }}
                </template>
              </el-table-column>
              <el-table-column label="支付金额（元）" align="center" prop="payAmount" width="150" />
              <el-table-column label="订单状态" align="center" prop="orderStatus" width="150">
                <template slot-scope="scope">
                  <dict-tag :options="dict.type.order_goods_status" :value="scope.row.orderStatus" />
                </template>
              </el-table-column>
              <el-table-column label="支付方式" align="center" prop="payType">
                <template slot-scope="scope">
                  <dict-tag :options="dict.type.recharge_pay_type" :value="scope.row.payType" />
                </template>
              </el-table-column>
              <el-table-column label="下单时间" align="center" prop="createTime" width="150" />
              <el-table-column label="支付时间" align="center" prop="payTime" width="150" />
            </el-table>
            <pagination v-show="usertotal > 0" :total="usertotal" :page.sync="userViewForm.pageNum" :limit.sync="userViewForm.pageSize"
              @pagination="getMemberOrderGoodsData" />
          </el-tab-pane>
          <el-tab-pane name="4">
            <span slot="label"><i class="el-icon-orange"></i> 洗衣订单</span>
            <el-table v-loading="userloading" :data="userinfoData" fit highlight-current-row border stripe>
              <el-table-column label="订单编号" align="center" prop="orderNo" min-width="150" />
              <el-table-column label="门店/工厂名称" align="center" prop="sysOrg.name" width="150" />
              <el-table-column label="数量" align="center" prop="orderClothCount" width="100" />
              <el-table-column label="合计" align="center" prop="clothItemName" width="150">
                <template slot-scope="scope">
                  <span>合计：{{ scope.row.payAmount }}元</span>
                  <br />
                  <span v-if="scope.row.payType == '0'">支付方式：微信</span>
                  <span v-if="scope.row.payType == '1'">支付方式：支付宝</span>
                  <span v-if="scope.row.payType == '2'">支付方式：现金</span>
                  <span v-if="scope.row.payType == '3'">支付方式：余额</span>
                </template>
              </el-table-column>
              <el-table-column label="订单来源" align="center" width="150">
                <template slot-scope="scope">
                  <span v-if="scope.row.orderSource == 'OFFLINE'">线下</span>
                  <span v-else>线上</span>
                </template>
              </el-table-column>
              <el-table-column label="订单时间" align="center" prop="createTime" min-width="150" />
              <el-table-column label="状态" align="center" width="150">
                <template slot-scope="scope">
                  <dict-tag :options="dict.type.cloth_order_status" :value="scope.row.orderStatus" />
                </template>
              </el-table-column>
            </el-table>
            <pagination v-show="usertotal > 0" :total="usertotal" :page.sync="userViewForm.pageNum" :limit.sync="userViewForm.pageSize"
              @pagination="getMemberOrderClothData" />
          </el-tab-pane>
          <el-tab-pane name="5">
            <span slot="label"><i class="el-icon-bank-card"></i> 会员卡</span>
            <el-table v-loading="userloading" :data="userinfoData" fit highlight-current-row border stripe>
              <el-table-column label="卡号" align="center" prop="cardNo" width="150px"  />
              <el-table-column label="充值金额（元）" align="center" prop="rechargeAmount" width="150px" />
              <el-table-column label="赠送金额（元）" align="center" prop="giveAmount" width="150px" />
              <el-table-column label="充值余额（元）" align="center" prop="rechargeBalance" width="150px" />
              <el-table-column label="赠送余额（元）" align="center" prop="giveBalance" width="150px" />
              <el-table-column label="福利金额（元）" align="center" prop="welfareAmount" width="150px" />
              <el-table-column label="福利金余额（元）" align="center" prop="welfareBalance" width="150px" />
              <el-table-column label="赠送积分" align="center" prop="givePointAmount" width="150px" />
              <el-table-column label="使用状态" align="center" prop="rechargeStatus" width="150px">
                <template slot-scope="scope">
                  <el-tag v-if="scope.row.rechargeStatus == 1">已使用</el-tag>
                  <el-tag type="info" v-else>未使用</el-tag>
                </template>
              </el-table-column>
              <el-table-column label="充值门店" align="center" prop="rechargeStoreName" width="200px" />
              <el-table-column label="充值时间" align="center" prop="rechargeTime" width="150px" />
            </el-table>
            <pagination v-show="usertotal > 0" :total="usertotal" :page.sync="userViewForm.pageNum" :limit.sync="userViewForm.pageSize"
              @pagination="getMemberCardData" />
          </el-tab-pane>
        </el-tabs>
      </div>

      <div slot="footer" class="dialog-footer">
        <el-button @click="usercancel" style="margin-left: 5%">关 闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listUser, getUser, delUser, addUser, updateUser, updateUserStatus, getMemberInfoById, getMemberCouponInfo, getMemberBillMstrInfo, getMemberOrderGoodsInfo, getMemberOrderClothInfo, getMemberCardInfoList } from '@/api/app/user'
import EditUser from './component/editUser'

export default {
  name: 'User',
  components: {
    EditUser
  },
  dicts: ['sys_user_sex', 'coupon_type', 'sys_yes_no', 'cloth_order_status', 'order_type', 'recharge_pay_type', 'order_goods_status'],
  data() {
    return {
      userInfoVO: null,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 用户表格数据
      userList: [],
      // 弹出层标题
      title: '',
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        phoneNumber: null,
        nickName: null,
        realName: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        nickName: [
          {
            required: true,
            message: '昵称不能为空',
            trigger: 'blur'
          }
        ],
        realName: [
          {
            required: true,
            message: '真实姓名不能为空',
            trigger: 'blur'
          }
        ],
        phoneNumber: [
          {
            required: true,
            message: '手机号不能为空',
            trigger: 'blur'
          }
        ],
        sex: [
          {
            required: true,
            message: '性别不能为空',
            trigger: 'blur'
          }
        ]
      },
      isDisabled: true,
      userViewType: false,
      userInfo: {},
      userViewForm: {
        appUserId: 0,
        pageNum: 1,
        pageSize: 10
      },
      usertotal: 0,
      userloading: false,
      userinfoData: [],
      activeValue: '1'
    }
  },
  created() {
    this.handleUser()
    this.getList()
  },
  methods: {
    handleUser() {
      this.userInfoVO = this.getUserInfo()
    },
    /** 查询用户列表 */
    getList() {
      this.$nextTick(() => {
        this.$refs.pagination.handleSearch(true)
      })
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        phoneNumber: null,
        nickName: null,
        realName: null,
        sex: null,
        birthday: null,
        avatarUrl: null,
        unionId: null,
        createTime: null,
        payPassword: null,
        isUsePayPassword: null,
        status: '0',
        level: null
      }
      this.resetForm('form')
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm('queryForm')
      this.handleQuery()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      this.open = true
      this.isDisabled = false
      this.title = '添加用户'
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset()
      const id = row.id || this.ids
      getUser(id).then((response) => {
        this.form = response.data
        this.open = true
        this.isDisabled = true
        this.title = '修改用户'
      })
    },
    /** 提交按钮 */
    submitForm() {
      // this.$refs["form"].validate(valid => {
      //   if (valid) {
      //     if (this.form.id != null) {
      //       updateUser(this.form).then(response => {
      //         this.$modal.msgSuccess("修改成功");
      //         this.open = false;
      //         this.getList();
      //       });
      //     } else {
      //       addUser(this.form).then(response => {
      //         this.$modal.msgSuccess("新增成功");
      //         this.open = false;
      //         this.getList();
      //       });
      //     }
      //   }
      // });
      this.open = false
      this.getList()
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids
      this.$modal
        .confirm('是否确认删除用户编号为"' + ids + '"的数据项？')
        .then(function () {
          return delUser(ids)
        })
        .then(() => {
          this.getList()
          this.$modal.msgSuccess('删除成功')
        })
        .catch(() => { })
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        'mapi/app/user/export',
        {
          ...this.queryParams
        },
        `user_${new Date().getTime()}.xlsx`
      )
    },
    checkClose(done) {
      this.$confirm('是否关闭表单，关闭后数据将丢失？')
        .then(function () {
          done()
        })
        .then(() => { })
        .catch(() => { })
    },
    handleStatusChange(row) {
      let text = row.status === '0' ? '启用' : '停用'
      this.$confirm('确认要' + text + ' ' + row.name + ' 吗？')
        .then(function () {
          return updateUserStatus(row.id, row.status)
        })
        .then(() => {
          this.$modal.msgSuccess(text + '成功')
        })
        .catch(function () {
          row.status = row.status === '0' ? '1' : '0'
        })
    },
    //客户详情弹框
    handleView(row) {
      getMemberInfoById({
        appUserId: row.id
      }).then((response) => {
        this.userViewType = true
        this.userInfo = response.data
        this.userViewForm = {
          appUserId: row.id,
          pageNum: 1,
          pageSize: 15
        }
        this.activeValue = '1'
        this.getMemberCouponData()
      })
    },
    //获取会员优惠券列表
    getMemberCouponData() {
      this.userloading = true
      getMemberCouponInfo(this.userViewForm).then((response) => {
        this.userinfoData = response.rows
        this.usertotal = response.total
        this.userloading = false
      })
    },
    //获取会员消费明细
    getMemberBillMstrData() {
      this.userloading = true
      getMemberBillMstrInfo(this.userViewForm).then((response) => {
        this.userinfoData = response.data.records
        this.usertotal = response.data.total
        this.userloading = false
      })
    },
    //获取会员商品订单信息
    getMemberOrderGoodsData() {
      this.userloading = true
      getMemberOrderGoodsInfo(this.userViewForm).then((response) => {
        this.userinfoData = response.data.records
        this.usertotal = response.data.total
        this.userloading = false
      })
    },
    //获取会员洗衣订单信息
    getMemberOrderClothData() {
      this.userloading = true
      getMemberOrderClothInfo(this.userViewForm).then((response) => {
        this.userinfoData = response.data.records
        this.usertotal = response.data.total
        this.userloading = false
      })
    },
    //总部客户管理- 会员卡列表查询
    getMemberCardData() {
      this.userloading = true
      getMemberCardInfoList(this.userViewForm).then((response) => {
        this.userinfoData = response.data.records
        this.usertotal = response.data.total
        this.userloading = false
      })
    },
    getAddress(userInfo) {
      return userInfo.province + userInfo.city + userInfo.area + userInfo.address + userInfo.addressDetail
    },
    btn_chioc(tab, event) {
      console.log('tab.index', tab.index)
      this.userViewForm.pageNum = 1
      this.userinfoData = []
      if (tab.index === '0') {
        this.getMemberCouponData()
      } else if (tab.index === '1') {
        this.getMemberBillMstrData()
      } else if (tab.index === '2') {
        this.getMemberOrderGoodsData()
      } else if (tab.index === '3') {
        this.getMemberOrderClothData()
      } else {
        this.getMemberCardData()
      }
    },
    usercheckClose(done) {
      this.$confirm('是否关闭客户详情？')
        .then(function () {
          done()
        })
        .then(() => { })
        .catch(() => { })
    },
    // 取消按钮
    usercancel() {
      this.userViewType = false
      this.userInfo = {}
    },
    closeDialog() {
      this.open = false
    }
  }
}
</script>

<style lang="scss" scoped>
.user_drawer {
    ::v-deep.el-dialog__header {
        margin-bottom: 10px;
    }
    .userContent {
        padding: 20px;
        .title {
            margin-bottom: 20px;
        }
        .box-card {
            margin-bottom: 20px;
        }
        .userinfo {
            display: flex;
            .user_image {
                flex-shrink: 0;
            }
            .list_user {
                flex: 1;
                padding: 0 20px;
                display: flex;
                flex-wrap: wrap;
                align-items: center;
                justify-content: space-between;
                .item_user {
                    width: 80%;
                    display: flex;
                    align-items: center;
                    margin-bottom: 15px;
                    &:last-child {
                        margin-bottom: 0px;
                    }
                    .name {
                        flex-shrink: 0;
                        color: #bbb;
                        width: 100px;
                    }
                    .text {
                        flex: 1;
                    }
                }
            }
        }

        .el-tabs--border-card {
            border-radius: 4px;
        }
    }
}
</style>
