Pārlūkot izejas kodu

feat(store): 添加门店授权功能

- 在门店列表表格中新增是否授权列,显示授权状态标签
- 添加授权操作按钮,支持开启和关闭门店授权
- 实现handleAuthorization方法处理授权逻辑
- 更新StoreVO和StoreForm类型定义,添加isAuthorization字段
- 修改storePromotionImage类型从string为string[]数组类型
- 添加授权确认弹窗和操作成功提示
- 授权操作后刷新门店列表数据
fugui001 3 dienas atpakaļ
vecāks
revīzija
99c8c00c09

+ 4 - 2
src/api/system/physical/store/types.ts

@@ -73,8 +73,9 @@ export interface StoreVO {
 
   mainTitle?: string;
   storeDescription?: string;
-  storePromotionImage?: string;
+  storePromotionImage?: string[];
   storeAppIds?: string;
+  isAuthorization: boolean; // 是否授权 true 1  false 0
 }
 
 export interface StoreForm extends BaseEntity {
@@ -158,6 +159,7 @@ export interface StoreForm extends BaseEntity {
   storeAppIds?: string;
   storePromotionImage?: string[];
   storePromotionImageOsId?: string | string[];
+  isAuthorization: boolean;
 }
 
 export interface StoreQuery extends PageQuery {
@@ -232,6 +234,6 @@ export interface StoreQuery extends PageQuery {
   params?: any;
   mainTitle?: string;
   storeDescription?: string;
-  storePromotionImage?: string;
+  storePromotionImage?: string[];
   storeAppIds?: string;
 }

+ 29 - 2
src/views/system/physical/store/index.vue

@@ -51,6 +51,13 @@
         <el-table-column label="门店名称" align="center" prop="name" />
         <el-table-column label="门店类型" align="center" prop="storeTypeName" />
         <el-table-column label="详细地址" align="center" prop="address" />
+        <el-table-column label="是否授权" align="center" prop="isAuthorization">
+          <template #default="scope">
+            <el-tag :type="scope.row.isAuthorization ? 'success' : 'info'">
+              {{ scope.row.isAuthorization ? '已授权' : '未授权' }}
+            </el-tag>
+          </template>
+        </el-table-column>
         <el-table-column label="兑换开始时间" align="center" prop="businessStartTime" width="180">
           <template #default="scope">
             <span>{{ parseTime(scope.row.businessStartTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
@@ -77,6 +84,16 @@
             <el-tooltip content="删除" placement="top">
               <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['physical:store:remove']"></el-button>
             </el-tooltip>
+            <el-tooltip :content="scope.row.isAuthorization ? '关闭授权' : '点击授权'" placement="top">
+              <el-button
+                link
+                :type="scope.row.isAuthorization ? 'warning' : 'success'"
+                @click="handleAuthorization(scope.row)"
+                style="text-decoration: underline"
+              >
+                {{ scope.row.isAuthorization ? '关闭授权' : '点击授权' }}
+              </el-button>
+            </el-tooltip>
           </template>
         </el-table-column>
       </el-table>
@@ -861,9 +878,19 @@ const getCurrentLocation = () => {
     }
   );
 };
-// ... existing code ...
+const handleAuthorization = async (row: StoreVO) => {
+  const action = row.isAuthorization ? '关闭' : '授权';
+  await proxy?.$modal.confirm(`确认要${action}门店"${row.name}"吗?`);
+  const updateData: StoreForm = {
+    ...row,
+    isAuthorization: !row.isAuthorization,
+    storePromotionImage: row.storePromotionImage || []
+  };
 
-// ... existing code ...
+  await updateStore(updateData);
+  proxy?.$modal.msgSuccess('授权成功');
+  await getList();
+};
 </script>
 
 <style scoped>