<!--
 * @Descripttion: (小程序客户/tb_customer 详情弹窗)
 * @version: (1.0)
 * @Author: (lwh)
 * @Date: (2023-06-05)
 * @LastEditors: (lwh)
 * @LastEditTime: (2023-06-05)
-->
<template>
  <el-dialog v-model="props.modelValue" title="小程序客户信息详情" width="900px" @closed="closeDialog" @open="openDialog">
    <el-form ref="formRef" :model="formData" :disabled="true">

      <el-row :gutter="20">

        <el-col :lg="12">
          <el-form-item :label-width="labelWidth" label="openid">
            <el-input v-model="formData.customerXcxOpenid" />
          </el-form-item>
        </el-col>

        <el-col :lg="12">
          <el-form-item :label-width="labelWidth" label="昵称">
            <el-input v-model="formData.customerNickname" />
          </el-form-item>
        </el-col>

        <el-col :lg="12">
          <el-form-item :label-width="labelWidth" label="手机号">
            <el-input v-model="formData.customerMobilePhoneNumber" />
          </el-form-item>
        </el-col>

        <el-col :lg="12">
          <el-form-item :label-width="labelWidth" label="头像">
            <UploadImage ref="uploadRef" v-model="formData.customerAvatar" :limit="1" :fileSize="5" :drag="true"
              :isShowTip="false" :isDisabled="true" />
          </el-form-item>
        </el-col>

        <el-col :lg="12">
          <el-form-item :label-width="labelWidth" label="性别">
            <el-select v-model="formData.customerGender">
              <el-option v-for="item in  sys_user_sex " :key="item.dictValue" :label="item.dictLabel"
                :value="parseInt(item.dictValue)"></el-option>
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :lg="12">
          <el-form-item :label-width="labelWidth" label="可用余额">
            <el-input-number v-model.number="formData.customerAvailableBalance" controls-position="right"
              :precision="2" />
          </el-form-item>
        </el-col>

        <el-col :lg="12">
          <el-form-item :label-width="labelWidth" label="可用积分">
            <el-input-number v-model.number="formData.customerAvailablePoints" controls-position="right" :precision="2" />
          </el-form-item>
        </el-col>

        <el-col :lg="12">
          <el-form-item :label-width="labelWidth" label="总支付金额">
            <el-input-number v-model.number="formData.customerTotalPaymentAmount" controls-position="right"
              :precision="2" />
          </el-form-item>
        </el-col>

        <el-col :lg="12">
          <el-form-item :label-width="labelWidth" label="实际消费金额">
            <el-input-number v-model.number="formData.customerActualConsumptionAmount" controls-position="right"
              :precision="2" />
          </el-form-item>
        </el-col>

        <el-col :lg="12">
          <el-form-item :label-width="labelWidth" label="最后登录时间">
            <el-date-picker v-model="formData.customerLastLoginTime" type="datetime" :teleported="false"
              isabledStr></el-date-picker>
          </el-form-item>
        </el-col>






      </el-row>
    </el-form>
  </el-dialog>
</template>

<script setup>
import { ElMessage } from 'element-plus'
import { reactive, ref, watch } from "vue";


// 打开弹窗时回调
const openDialog = async () => {
  await getsys_user_sex()

}

const formData = ref({
  ...props.data,
});
watch(props, async (v) => {
  formData.value = v.data;
});

// -业务参数
// 性别字典选项列表
const sys_user_sex = ref([]);

// -业务方法
// 字典获取
async function getsys_user_sex() {
  await proxy.getDicts('sys_user_sex').then((res) => {
    sys_user_sex.value = res.data
  })
}



// 基础参数
const formRef = ref();
const labelWidth = 100;
const { proxy } = getCurrentInstance()
const props = defineProps({
  modelValue: Boolean,
  data: Object,
  done: Function,
});
const emits = defineEmits(["update:modelValue"]);


// -基础方法
const closeDialog = () => {
  emits("update:modelValue", false);
};

</script>
