UserAddressList.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
  3. <el-table-column label="地址编号" align="center" prop="id" width="150px" />
  4. <el-table-column label="收件人名称" align="center" prop="name" width="150px" />
  5. <el-table-column label="手机号" align="center" prop="mobile" width="150px" />
  6. <el-table-column label="地区编码" align="center" prop="areaId" width="150px" />
  7. <el-table-column label="收件详细地址" align="center" prop="detailAddress" />
  8. <el-table-column label="是否默认" align="center" prop="defaultStatus" width="150px">
  9. <template #default="scope">
  10. <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="Number(scope.row.defaultStatus)" />
  11. </template>
  12. </el-table-column>
  13. <el-table-column
  14. label="创建时间"
  15. align="center"
  16. prop="createTime"
  17. :formatter="dateFormatter"
  18. width="180px"
  19. />
  20. </el-table>
  21. </template>
  22. <script lang="ts" setup>
  23. import { DICT_TYPE } from '@/utils/dict'
  24. import { dateFormatter } from '@/utils/formatTime'
  25. import * as AddressApi from '@/api/member/address'
  26. const { userId }: { userId: number } = defineProps({
  27. userId: {
  28. type: Number,
  29. required: true
  30. }
  31. })
  32. const loading = ref(true) // 列表的加载中
  33. const total = ref(0) // 列表的总页数
  34. const list = ref([]) // 列表的数据
  35. /** 查询列表 */
  36. const getList = async () => {
  37. loading.value = true
  38. try {
  39. list.value = await AddressApi.getAddressList({ userId })
  40. } finally {
  41. loading.value = false
  42. }
  43. }
  44. /** 初始化 **/
  45. onMounted(() => {
  46. getList()
  47. })
  48. </script>
  49. <style scoped lang="scss"></style>