|
|
@@ -2,9 +2,7 @@
|
|
|
<template>
|
|
|
<app-table :data="dataList" v-model:columns="tableColumns" :loading="loading" :row-key="rowKey" :expand-row-keys="expandKeys" @row-click="rowClick">
|
|
|
<template #header>
|
|
|
- <div class="buttonbar">
|
|
|
- <el-button type="danger" size="small" @click="showComponent('edit')">新增收货地址</el-button>
|
|
|
- </div>
|
|
|
+ <el-button type="danger" size="small" @click="openComponent('edit')">新增收货地址</el-button>
|
|
|
</template>
|
|
|
<!-- 证件类型 -->
|
|
|
<template #cardtypeid="{ value }">
|
|
|
@@ -19,11 +17,11 @@
|
|
|
{{ value? '是': '否' }}
|
|
|
</template>
|
|
|
<!-- 操作 -->
|
|
|
- <template #expand="{ row }">
|
|
|
+ <template #expand>
|
|
|
<div class="buttonbar">
|
|
|
- <el-button type="primary" size="small" @click="showComponent('edit', row)">编辑</el-button>
|
|
|
- <el-button type="success" size="small" @click="showComponent('default', row)">设置默认</el-button>
|
|
|
- <el-button type="danger" size="small" @click="showComponent('delete', row)">删除</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="openComponent('edit')">编辑</el-button>
|
|
|
+ <el-button type="success" size="small" @click="openComponent('default')">设置默认</el-button>
|
|
|
+ <el-button type="danger" size="small" @click="openComponent('delete')">删除</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
</app-table>
|
|
|
@@ -33,8 +31,8 @@
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { shallowRef, defineAsyncComponent } from 'vue'
|
|
|
-import { ElMessage } from 'element-plus'
|
|
|
-import { useAddress } from '@/business/user/address'
|
|
|
+import { useRequest } from '@/hooks/request'
|
|
|
+import { queryUserReceiveInfo } from '@/services/api/user'
|
|
|
import { getCertificateTypeName } from '@/constants/certificate'
|
|
|
import { useComponent } from '@/hooks/component'
|
|
|
import { useComposeTable } from '@pc/components/base/table'
|
|
|
@@ -46,17 +44,12 @@ const componentMap = new Map<string, unknown>([
|
|
|
['delete', defineAsyncComponent(() => import('./components/delete/index.vue'))],
|
|
|
])
|
|
|
|
|
|
-const { rowKey, expandKeys, rowClick } = useComposeTable<Model.UserReceiveInfoRsp>({ rowKey: 'autoid' })
|
|
|
-const selectedRow = shallowRef<Model.UserReceiveInfoRsp>()
|
|
|
-
|
|
|
-defineProps({
|
|
|
- code: String
|
|
|
-})
|
|
|
+const { rowKey, expandKeys, selectedRow, rowClick } = useComposeTable<Model.UserReceiveInfoRsp>({ rowKey: 'autoid' })
|
|
|
|
|
|
-const { loading, dataList, getUserAddressList } = useAddress()
|
|
|
+const { loading, dataList, run } = useRequest(queryUserReceiveInfo, {})
|
|
|
|
|
|
const { componentRef, componentId, openComponent, closeComponent } = useComponent(() => {
|
|
|
- getUserAddressList()
|
|
|
+ run()
|
|
|
})
|
|
|
|
|
|
const tableColumns = shallowRef<Model.TableColumn[]>([
|
|
|
@@ -68,11 +61,4 @@ const tableColumns = shallowRef<Model.TableColumn[]>([
|
|
|
{ prop: 'isdefault', label: '是否默认' },
|
|
|
])
|
|
|
|
|
|
-getUserAddressList().catch((err) => ElMessage.error(err))
|
|
|
-
|
|
|
-const showComponent = (componentName: string, row?: Model.UserReceiveInfoRsp) => {
|
|
|
- selectedRow.value = row
|
|
|
- openComponent(componentName)
|
|
|
-}
|
|
|
-
|
|
|
</script>
|