Commit 22489d6455e588c5cc71070423c86a5867f755ef

Authored by shaofan
1 parent 9542b035

Refactor: 更新商家和店铺管理相关接口路径,优化店铺管理界面逻辑,完善角色权限支持,调整入驻申请页面交互,新增身份证号输入

src/api/index.ts
... ... @@ -102,18 +102,18 @@ export const merchantApi = {
102 102 enterList: (params: any) => request.get('/api/platform/merchant/enter/list', { params }),
103 103 handleEnter: (id: number, status: number) =>
104 104 request.post('/api/platform/merchant/enter/handle', null, { params: { id, status } }),
105   - storeList: (params: any) => request.get('/api/platform/merchant/store/list', { params }),
106   - addStore: (data: any) => request.post('/api/platform/merchant/store/add', data),
107   - editStore: (data: any) => request.put('/api/platform/merchant/store/edit', data),
108   - storeDetail: (storeId: number) => request.get('/api/platform/merchant/store/detail', { params: { storeId } }),
  105 + storeList: (params: any) => request.get('/api/admin/merchant/store/list', { params }),
  106 + addStore: (data: any) => request.post('/api/admin/merchant/store/add', data),
  107 + editStore: (data: any) => request.put('/api/admin/merchant/store/edit', data),
  108 + storeDetail: (storeId: number) => request.get('/api/admin/merchant/store/detail', { params: { storeId } }),
109 109 setOperatingState: (storeId: number, state: number) =>
110   - request.post('/api/platform/merchant/store/setOperatingState', null, { params: { storeId, state } }),
  110 + request.post('/api/admin/merchant/store/setOperatingState', null, { params: { storeId, state } }),
111 111 setAutoOrder: (storeId: number, auto: number) =>
112   - request.post('/api/platform/merchant/store/setAutoOrder', null, { params: { storeId, auto } }),
  112 + request.post('/api/admin/merchant/store/setAutoOrder', null, { params: { storeId, auto } }),
113 113 updateFeeConfig: (storeId: number, freeShipping: number, upToSend: number) =>
114   - request.post('/api/platform/merchant/store/updateFeeConfig', null,
  114 + request.post('/api/admin/merchant/store/updateFeeConfig', null,
115 115 { params: { storeId, freeShipping, upToSend } }),
116   - delStore: (storeId: number) => request.delete('/api/platform/merchant/store/del', { params: { storeId } }),
  116 + delStore: (storeId: number) => request.delete('/api/admin/merchant/store/del', { params: { storeId } }),
117 117 }
118 118  
119 119 // 骑手管理
... ...
src/views/merchant/EnterList.vue
1 1 <template>
2 2 <div>
3 3 <a-card title="入驻申请" :bordered="false" class="list-table-card">
4   - <div class="list-toolbar">
5   - <div class="list-toolbar-left">
6   - <a-select v-model:value="filterStatus" placeholder="状态" allowClear class="list-filter" @change="loadList">
7   - <a-select-option :value="0">未处理</a-select-option>
8   - <a-select-option :value="1">已通过</a-select-option>
9   - <a-select-option :value="-1">已拒绝</a-select-option>
10   - </a-select>
11   - <a-select v-model:value="filterType" placeholder="类型" allowClear class="list-filter" @change="loadList">
12   - <a-select-option :value="1">商家入驻</a-select-option>
13   - <a-select-option :value="2">骑手入驻</a-select-option>
14   - <a-select-option :value="3">商务合作</a-select-option>
15   - </a-select>
  4 + <div class="soft-page-stack">
  5 + <div class="soft-note-card">
  6 + <strong>功能暂未开放</strong>
  7 + <p>当前页面保留原有布局用于后续开放,暂不提供真实数据查询和审核操作。</p>
16 8 </div>
17   - </div>
18   - <a-table :dataSource="list" :columns="columns" :loading="loading" rowKey="id" :pagination="false">
19   - <template #bodyCell="{ column, record }">
20   - <template v-if="column.key === 'type'">
21   - <a-tag>{{ typeMap[record.type] }}</a-tag>
22   - </template>
23   - <template v-if="column.key === 'status'">
24   - <a-tag :color="record.status === 1 ? 'green' : record.status === -1 ? 'red' : 'orange'">
25   - {{ statusMap[record.status] }}
26   - </a-tag>
27   - </template>
28   - <template v-if="column.key === 'action'">
29   - <a-space v-if="record.status === 0">
30   - <a-popconfirm title="确认通过?" @confirm="handle(record.id, 1)">
31   - <a style="color:green">通过</a>
32   - </a-popconfirm>
33   - <a-popconfirm title="确认拒绝?" @confirm="handle(record.id, -1)">
34   - <a style="color:red">拒绝</a>
35   - </a-popconfirm>
36   - </a-space>
37   - <span v-else>-</span>
  9 +
  10 + <div class="list-toolbar">
  11 + <div class="list-toolbar-left">
  12 + <a-select v-model:value="filterStatus" placeholder="状态" allowClear class="list-filter" @change="loadList">
  13 + <a-select-option :value="0">未处理</a-select-option>
  14 + <a-select-option :value="1">已通过</a-select-option>
  15 + <a-select-option :value="-1">已拒绝</a-select-option>
  16 + </a-select>
  17 + <a-select v-model:value="filterType" placeholder="类型" allowClear class="list-filter" @change="loadList">
  18 + <a-select-option :value="1">商家入驻</a-select-option>
  19 + <a-select-option :value="2">骑手入驻</a-select-option>
  20 + <a-select-option :value="3">商务合作</a-select-option>
  21 + </a-select>
  22 + </div>
  23 + </div>
  24 +
  25 + <a-table :dataSource="list" :columns="columns" :loading="loading" rowKey="id" :pagination="false">
  26 + <template #bodyCell="{ column, record }">
  27 + <template v-if="column.key === 'type'">
  28 + <a-tag>{{ typeMap[record.type] }}</a-tag>
  29 + </template>
  30 + <template v-if="column.key === 'status'">
  31 + <a-tag :color="record.status === 1 ? 'green' : record.status === -1 ? 'red' : 'orange'">
  32 + {{ statusMap[record.status] }}
  33 + </a-tag>
  34 + </template>
  35 + <template v-if="column.key === 'action'">
  36 + <a-space v-if="record.status === 0">
  37 + <a-popconfirm title="确认通过?" @confirm="handle(record.id, 1)">
  38 + <a style="color:#bfbfbf">通过</a>
  39 + </a-popconfirm>
  40 + <a-popconfirm title="确认拒绝?" @confirm="handle(record.id, -1)">
  41 + <a style="color:#bfbfbf">拒绝</a>
  42 + </a-popconfirm>
  43 + </a-space>
  44 + <span v-else>-</span>
  45 + </template>
38 46 </template>
39   - </template>
40   - </a-table>
  47 + </a-table>
  48 + </div>
41 49 </a-card>
42 50 </div>
43 51 </template>
... ... @@ -45,7 +53,6 @@
45 53 <script setup lang="ts">
46 54 import { ref, onMounted } from 'vue'
47 55 import { message } from 'ant-design-vue'
48   -import { merchantApi } from '@/api'
49 56  
50 57 const loading = ref(false)
51 58 const list = ref<any[]>([])
... ... @@ -65,19 +72,16 @@ const columns = [
65 72 { title: '操作', key: 'action' },
66 73 ]
67 74  
68   -async function loadList() {
69   - loading.value = true
70   - try {
71   - const res: any = await merchantApi.enterList({ status: filterStatus.value, type: filterType.value, page: 1 })
72   - list.value = res.data
73   - } finally { loading.value = false }
  75 +function loadList() {
  76 + list.value = []
74 77 }
75 78  
76   -async function handle(id: number, status: number) {
77   - await merchantApi.handleEnter(id, status)
78   - message.success('操作成功')
79   - loadList()
  79 +function handle(_id: number, _status: number) {
  80 + message.warning('暂未开放')
80 81 }
81 82  
82   -onMounted(loadList)
  83 +onMounted(() => {
  84 + message.warning('暂未开放')
  85 + loadList()
  86 +})
83 87 </script>
... ...
src/views/merchant/StoreList.vue
... ... @@ -3,7 +3,14 @@
3 3 <a-card title="店铺管理" :bordered="false" class="list-table-card">
4 4 <div class="list-toolbar">
5 5 <div class="list-toolbar-left">
6   - <a-select v-model:value="filterCityId" placeholder="选择租户" allowClear class="list-filter" @change="loadList">
  6 + <a-select
  7 + v-if="isAdmin"
  8 + v-model:value="filterCityId"
  9 + placeholder="选择租户"
  10 + allowClear
  11 + class="list-filter"
  12 + @change="loadList"
  13 + >
7 14 <a-select-option v-for="c in cityList" :key="c.id" :value="c.id">{{ c.name }}</a-select-option>
8 15 </a-select>
9 16 <a-input-search v-model:value="keyword" placeholder="搜索店铺名" @search="loadList" class="list-search" />
... ... @@ -51,11 +58,14 @@
51 58 </div>
52 59 <a-form :model="form" layout="vertical">
53 60 <a-form-item label="店铺名称"><a-input v-model:value="form.name" /></a-form-item>
54   - <a-form-item label="所属租户">
  61 + <a-form-item v-if="isAdmin" label="所属租户">
55 62 <a-select v-model:value="form.cityId" placeholder="选择租户">
56 63 <a-select-option v-for="c in cityList" :key="c.id" :value="c.id">{{ c.name }}</a-select-option>
57 64 </a-select>
58 65 </a-form-item>
  66 + <a-form-item v-else label="所属租户">
  67 + <a-input :value="managedCityName || getCityName(form.cityId)" disabled />
  68 + </a-form-item>
59 69 <a-form-item label="外部门店编号(选填,接入方对账用)">
60 70 <a-input v-model:value="form.outStoreId" placeholder="接入方自己系统的门店ID" />
61 71 </a-form-item>
... ... @@ -121,7 +131,7 @@ const editingId = ref&lt;number | null&gt;(null)
121 131 const currentStoreId = ref(0)
122 132 const form = reactive<any>({ name: '', cityId: undefined, address: '', lng: '', lat: '', shippingType: 1, automaticOrder: 0, accountMobile: '', about: '', outStoreId: '' })
123 133 const feeForm = reactive({ freeShipping: 0, upToSend: 0 })
124   -const { cityList, loadCities, getCityName } = useRoleCityList()
  134 +const { isAdmin, managedCityId, managedCityName, cityList, loadCities, getCityName } = useRoleCityList()
125 135  
126 136 const columns = [
127 137 { title: 'ID', dataIndex: 'id', width: 80 },
... ... @@ -138,47 +148,75 @@ const columns = [
138 148 async function loadList() {
139 149 loading.value = true
140 150 try {
141   - const res: any = await merchantApi.storeList({ cityId: filterCityId.value, keyword: keyword.value, page: 1 })
  151 + const params = {
  152 + cityId: isAdmin.value ? filterCityId.value : managedCityId.value,
  153 + keyword: keyword.value,
  154 + page: 1,
  155 + }
  156 + const res: any = await merchantApi.storeList(params)
142 157 list.value = res.data
143   - } finally { loading.value = false }
  158 + } finally {
  159 + loading.value = false
  160 + }
  161 +}
  162 +
  163 +function resetForm() {
  164 + Object.assign(form, {
  165 + name: '',
  166 + cityId: isAdmin.value ? undefined : managedCityId.value,
  167 + address: '',
  168 + lng: '',
  169 + lat: '',
  170 + shippingType: 1,
  171 + automaticOrder: 0,
  172 + accountMobile: '',
  173 + about: '',
  174 + outStoreId: '',
  175 + })
144 176 }
145 177  
146 178 function openAdd() {
147 179 editingId.value = null
148   - Object.assign(form, { name: '', cityId: undefined, address: '', lng: '', lat: '', shippingType: 1, automaticOrder: 0, accountMobile: '', about: '', outStoreId: '' })
  180 + resetForm()
149 181 modalVisible.value = true
150 182 }
151 183  
152 184 function openEdit(record: any) {
153 185 editingId.value = record.id
154 186 Object.assign(form, record)
  187 + if (!isAdmin.value) {
  188 + form.cityId = managedCityId.value
  189 + }
155 190 modalVisible.value = true
156 191 }
157 192  
158 193 async function handleSave() {
159 194 saving.value = true
160 195 try {
  196 + const payload = { ...form, cityId: isAdmin.value ? form.cityId : managedCityId.value }
161 197 if (editingId.value) {
162   - await merchantApi.editStore({ ...form, id: editingId.value })
  198 + await merchantApi.editStore({ ...payload, id: editingId.value })
163 199 } else {
164   - await merchantApi.addStore(form)
  200 + await merchantApi.addStore(payload)
165 201 }
166 202 message.success('保存成功')
167 203 modalVisible.value = false
168   - loadList()
169   - } finally { saving.value = false }
  204 + await loadList()
  205 + } finally {
  206 + saving.value = false
  207 + }
170 208 }
171 209  
172 210 async function toggleState(record: any) {
173 211 await merchantApi.setOperatingState(record.id, record.operatingState === 1 ? 0 : 1)
174 212 message.success('操作成功')
175   - loadList()
  213 + await loadList()
176 214 }
177 215  
178 216 async function handleDel(id: number) {
179 217 await merchantApi.delStore(id)
180 218 message.success('删除成功')
181   - loadList()
  219 + await loadList()
182 220 }
183 221  
184 222 function openFeeConfig(record: any) {
... ... @@ -194,9 +232,18 @@ async function handleFeeSave() {
194 232 await merchantApi.updateFeeConfig(currentStoreId.value, feeForm.freeShipping, feeForm.upToSend)
195 233 message.success('保存成功')
196 234 feeVisible.value = false
197   - loadList()
198   - } finally { saving.value = false }
  235 + await loadList()
  236 + } finally {
  237 + saving.value = false
  238 + }
199 239 }
200 240  
201   -onMounted(() => { loadList(); loadCities() })
  241 +onMounted(async () => {
  242 + await loadCities()
  243 + if (!isAdmin.value) {
  244 + filterCityId.value = managedCityId.value
  245 + }
  246 + resetForm()
  247 + await loadList()
  248 +})
202 249 </script>
... ...
src/views/rider/RiderList.vue
... ... @@ -93,6 +93,9 @@
93 93 <a-form-item label="手机号">
94 94 <a-input v-model:value="form.mobile" placeholder="请输入手机号" />
95 95 </a-form-item>
  96 + <a-form-item label="身份证号">
  97 + <a-input v-model:value="form.idNo" placeholder="请输入身份证号(非必填)" />
  98 + </a-form-item>
96 99 <a-form-item label="密码">
97 100 <a-input-password v-model:value="form.password" placeholder="请输入登录密码" />
98 101 </a-form-item>
... ... @@ -160,6 +163,7 @@ const form = reactive({
160 163 cityId: undefined as number | undefined,
161 164 userNickname: '',
162 165 mobile: '',
  166 + idNo: '',
163 167 password: '',
164 168 })
165 169 const levelSaving = ref(false)
... ... @@ -217,6 +221,7 @@ function openAdd() {
217 221 cityId: undefined,
218 222 userNickname: '',
219 223 mobile: '',
  224 + idNo: '',
220 225 password: '',
221 226 })
222 227 modalVisible.value = true
... ...