ソースを参照

feat(government): 新增政企管理模块及相关功能
- 添加了积分充值记录的列表展示与导入功能
- 实现了渠道列表的分页查询接口及页面展示
- 定义了政企管理相关类型声明 `PointsRecharge`
- 调整了基础模态框样式,使用 `maxWidth` 替代 `width`
- 优化了门店信息展示结构,使用折叠面板显示更多详情
- 修改了商品列表中价格字段的容错显示逻辑
- 调整了用户类型名称的排序顺序

zhangtao 3 週間 前
コミット
559cdc7229

+ 2 - 2
src/components/zt/Modal/basic-modal.vue

@@ -89,7 +89,7 @@ export default defineComponent({
   <NModal
     v-bind="getBindValue"
     v-model:show="isModal"
-    :style="{ width: getBindValue.width + 'px' }"
+    :style="{ maxWidth: getBindValue.width + 'px' }"
     @close="onCloseModal"
   >
     <template #header>
@@ -97,7 +97,7 @@ export default defineComponent({
     </template>
     <template #default>
       <NSpin :show="loading" content-style="--n-opacity-spinning:0">
-        <NScrollbar class="pr-20px" :style="{ height: getBindValue.height + 'px' }">
+        <NScrollbar class="px-20px" :style="{ height: getBindValue.height + 'px' }">
           <slot name="default"></slot>
         </NScrollbar>
       </NSpin>

+ 13 - 0
src/service/api/government/government-list/index.ts

@@ -0,0 +1,13 @@
+import { request } from '@/service/request';
+/**
+ * 分页获取渠道
+ * @param params
+ * @returns
+ */
+export function fetchGetChannelList(params: any) {
+  return request({
+    url: '/platform/channel/page',
+    method: 'get',
+    params
+  });
+}

+ 1 - 1
src/service/api/government/points/index.ts

@@ -6,7 +6,7 @@ import { request } from '@/service/request';
  * @returns
  */
 export function fetchGetPointsList(params: any) {
-  return request({
+  return request<Api.government.PointsRecharge[]>({
     url: '/platform/pointsRecharge/page',
     method: 'get',
     params

+ 73 - 0
src/typings/api.d.ts

@@ -527,4 +527,77 @@ declare namespace Api {
       [property: string]: any;
     }
   }
+  /**
+   * 政企管理模块
+   */
+  namespace government {
+    /**
+     * 积分充值实体类
+     *
+     * PointsRecharge
+     */
+    interface PointsRecharge {
+      /**
+       * 渠道(企业ID)
+       */
+      channelId?: number;
+      /**
+       * 渠道(企业)名称
+       */
+      channelName?: string;
+      /**
+       * 创建者
+       */
+      createBy?: string;
+      /**
+       * 创建时间
+       */
+      createTime?: string;
+      /**
+       * 过期日期
+       */
+      expiryDate?: string;
+      /**
+       * 主键
+       */
+      id?: number;
+      /**
+       * 充值积分
+       */
+      points?: number;
+      /**
+       * 充值单号
+       */
+      rechargeNumber?: string;
+      /**
+       * 积分状态(1-未过期,2-过期)
+       */
+      rechargeStatus?: number;
+      /**
+       * 备注
+       */
+      remark?: string;
+      /**
+       * 充值类型
+       */
+      type?: number;
+      /**
+       * 更新时间
+       */
+      updateTime?: string;
+      /**
+       * 用户ID
+       */
+      userId?: number;
+      /**
+       * 员工名称
+       */
+      userName?: string;
+      /**
+       * 电话号码
+       */
+      userPhone?: string;
+      [property: string]: any;
+    }
+  }
 }

+ 3 - 3
src/views/goods/store-goods/index.vue

@@ -17,7 +17,7 @@ import { useModal } from '@/components/zt/Modal/hooks/useModal';
 type Price = { channelId: number | undefined; channelProdPrice: number; id: number };
 const importTemplateRef = ref<ModalMethods>();
 const options = ref<Api.goods.Channel[]>([]);
-const TypeName = ['C端用户', '企业用户', 'B端用户'];
+const TypeName = ['企业用户', 'B端用户', 'C端用户'];
 
 const columns: NaiveUI.TableColumn<Api.goods.ShopSku>[] = [
   {
@@ -83,7 +83,7 @@ const columns: NaiveUI.TableColumn<Api.goods.ShopSku>[] = [
     width: 120,
     render: row => {
       if (!row.channelProdList?.length) return '--';
-      if (row.channelProdList) return <div>{row.channelProdList[0].purchasePrice}</div>;
+      if (row.channelProdList) return <div>{row.channelProdList[0].purchasePrice || '--'}</div>;
       return '--';
     }
   },
@@ -94,7 +94,7 @@ const columns: NaiveUI.TableColumn<Api.goods.ShopSku>[] = [
     width: 150,
     render: row => {
       if (!row.channelProdList?.length) return '--';
-      if (row.channelProdList) return <div>{row.channelProdList[0].deliveryPrice}</div>;
+      if (row.channelProdList) return <div>{row.channelProdList[0].deliveryPrice || '--'}</div>;
       return '--';
     }
   },

+ 34 - 8
src/views/government/government-list/index.vue

@@ -1,16 +1,40 @@
 <script setup lang="tsx">
 import { NButton, NPopconfirm } from 'naive-ui';
 import type { InternalRowData } from 'naive-ui/es/data-table/src/interface';
-import { fetchAddTag, fetchDeleteTag, fetchEditTag, fetchGetTagList } from '@/service/api/goods/tag';
+import { fetchGetChannelList } from '@/service/api/government/government-list';
 import { useTable } from '@/components/zt/Table/hooks/useTable';
 import { useModalFrom } from '@/components/zt/ModalForm/hooks/useModalForm';
 
 const columns: NaiveUI.TableColumn<InternalRowData>[] = [
   {
     key: 'name',
-    title: '标签名称',
-    align: 'center',
-    minWidth: 100
+    title: '企业编号',
+    align: 'center'
+  },
+  {
+    key: 'name',
+    title: '企业名称',
+    align: 'center'
+  },
+  {
+    key: 'name',
+    title: '总员工数',
+    align: 'center'
+  },
+  {
+    key: 'name',
+    title: '正常员工数',
+    align: 'center'
+  },
+  {
+    key: 'name',
+    title: '状态',
+    align: 'center'
+  },
+  {
+    key: 'name',
+    title: '创建时间',
+    align: 'center'
   }
 ];
 
@@ -37,7 +61,9 @@ const [registerTable, { refresh, setTableLoading }] = useTable({
 
 async function handleDelete(row: Recordable) {
   setTableLoading(true);
-  await fetchDeleteTag([row.id]);
+  // await fetchDeleteTag([row.id]);
+  console.log(row, 'row');
+
   refresh();
 }
 const [registerModalForm, { openModal, closeModal, getFieldsValue, setFieldsValue }] = useModalFrom({
@@ -71,9 +97,9 @@ const [registerModalForm, { openModal, closeModal, getFieldsValue, setFieldsValu
 async function handleSubmit() {
   const form = await getFieldsValue();
   if (form.id) {
-    await fetchEditTag(form);
+    // await fetchEditTag(form);
   } else {
-    await fetchAddTag(form);
+    // await fetchAddTag(form);
   }
   closeModal();
   refresh();
@@ -87,7 +113,7 @@ async function edit(row: Recordable) {
 
 <template>
   <LayoutTable>
-    <ZTable :columns="columns" :api="fetchGetTagList" @register="registerTable" @add="openModal">
+    <ZTable :columns="columns" :api="fetchGetChannelList" @register="registerTable" @add="openModal">
       <template #op="{ row }">
         <NButton size="small" ghost type="primary" @click="edit(row)">编辑</NButton>
         <NPopconfirm @positive-click="handleDelete(row)">

+ 58 - 19
src/views/government/points/index.vue

@@ -1,25 +1,53 @@
 <script setup lang="tsx">
 import { ref } from 'vue';
-import type { InternalRowData } from 'naive-ui/es/data-table/src/interface';
 import { fetchGetPointsList, fetchImportPoints } from '@/service/api/government/points';
 import { useTable } from '@/components/zt/Table/hooks/useTable';
 import { useModal } from '@/components/zt/Modal/hooks/useModal';
 import type { ModalMethods } from '@/components/zt/Modal/types';
 import type { FormSchema } from '@/components/zt/Form/types/form';
 const importTemplateRef = ref<ModalMethods>();
-const columns: NaiveUI.TableColumn<InternalRowData>[] = [
+const ModalColumns: NaiveUI.TableColumn<Api.government.PointsRecharge>[] = [
   {
-    key: 'name',
-    title: '标签名称',
-    align: 'center',
-    minWidth: 100
+    key: 'channelName',
+    title: '所属企业',
+    align: 'center'
+  },
+  {
+    key: 'userName',
+    title: '员工姓名',
+    align: 'center'
+  },
+  {
+    key: 'userPhone',
+    title: '员工手机号',
+    align: 'center'
+  },
+  {
+    key: 'points',
+    title: '充值积分',
+    align: 'center'
+  },
+  {
+    key: 'expiryDate',
+    title: '过期日期',
+    align: 'center'
+  },
+  {
+    key: 'createTime',
+    title: '创建时间',
+    align: 'center'
   }
 ];
 const searchSchemas: FormSchema[] = [
   {
-    field: 'name',
+    field: 'channelName',
     label: '企业名称',
     component: 'NInput'
+  },
+  {
+    field: 'userPhone',
+    label: '员工手机号',
+    component: 'NInput'
   }
 ];
 
@@ -33,11 +61,11 @@ const [registerTable] = useTable({
   },
   tableConfig: {
     keyField: 'id',
-    title: '标签列表',
+    title: '充值积分',
     showAddButton: false
   }
 });
-const [registerModalTable] = useTable({
+const [registerModalTable, { refresh: refreshModal }] = useTable({
   searchFormConfig: {
     schemas: searchSchemas,
     inline: false,
@@ -47,20 +75,23 @@ const [registerModalTable] = useTable({
   },
   tableConfig: {
     keyField: 'id',
-    title: '标签列表',
-    showAddButton: false
+    title: '积分列表',
+    showAddButton: false,
+    minHeight: 400
   }
 });
 
 const [registerModal, { openModal }] = useModal({
   title: '充值积分',
   height: 800,
-  showFooter: false
+  showFooter: false,
+  width: 1200
 });
 async function handleSubmitImport(file: File) {
   const { error } = await fetchImportPoints(file);
   if (!error) {
     importTemplateRef.value?.closeModal();
+    refreshModal();
   } else {
     importTemplateRef.value?.setSubLoading(false);
   }
@@ -72,19 +103,27 @@ function handleOpenPoints() {
 
 <template>
   <LayoutTable>
-    <ZTable :show-table-action="false" :columns="columns" :api="fetchGetPointsList" @register="registerTable">
+    <ZTable :show-table-action="false" :columns="ModalColumns" :api="fetchGetPointsList" @register="registerTable">
       <template #prefix>
         <NButton size="small" @click="openModal">充值积分</NButton>
       </template>
     </ZTable>
     <BasicModal @register="registerModal">
-      <ZTable :show-table-action="false" :columns="columns" :api="fetchGetPointsList" @register="registerModalTable">
-        <template #prefix>
-          <NButton size="small" @click="handleOpenPoints">导入积分</NButton>
-          <NButton size="small">导入记录</NButton>
-        </template>
-      </ZTable>
+      <LayoutTable>
+        <ZTable
+          :show-table-action="false"
+          :columns="ModalColumns"
+          :api="fetchGetPointsList"
+          @register="registerModalTable"
+        >
+          <template #prefix>
+            <NButton size="small" @click="handleOpenPoints">导入积分</NButton>
+            <NButton size="small">导入记录</NButton>
+          </template>
+        </ZTable>
+      </LayoutTable>
     </BasicModal>
+
     <ZImportTemplate
       ref="importTemplateRef"
       url="/platform/pointsRecharge/exportTemplate"

+ 32 - 20
src/views/store-management/store-info/index.vue

@@ -1,15 +1,37 @@
 <script setup lang="tsx">
-import { NTag } from 'naive-ui';
+import { NCollapse, NCollapseItem, NTag } from 'naive-ui';
 import { commonStatus } from '@/constants/business';
 import { fetchGetStoreList } from '@/service/api/store-management/store-info';
-import { fetchGetAllStoreList } from '@/service/api/goods/desk-category';
 import { useTable } from '@/components/zt/Table/hooks/useTable';
 import { $t } from '@/locales';
 const columns: NaiveUI.TableColumn<Api.Store.ShopDetail>[] = [
   {
     key: 'hbStationNo',
     title: '商家门店编码',
-    align: 'center'
+    width: 250,
+    render: row => {
+      return (
+        <NCollapse>
+          <NCollapseItem title={row.hbStationNo} name={`${row.hbStationId}hbStationNo`}>
+            <div class={'ml-6'}>
+              联系电话:<span class={'text-gray'}>{row.tel} </span>
+            </div>
+            <div class={'ml-6'}>
+              联系人:<span class={'text-gray'}>{row.shopOwner} </span>
+            </div>
+            <div class={'ml-6'}>
+              门店经度:<span class={'text-gray'}>{row.shopLng} </span>
+            </div>
+            <div class={'ml-6'}>
+              门店维度:<span class={'text-gray'}>{row.shopLat} </span>
+            </div>
+            {/* <div class={'ml-6'}>
+              时段接单量: <span class={'text-gray'}>{row.shopOwner} </span>
+            </div> */}
+          </NCollapseItem>
+        </NCollapse>
+      );
+    }
   },
   {
     key: 'shopName',
@@ -63,20 +85,15 @@ const columns: NaiveUI.TableColumn<Api.Store.ShopDetail>[] = [
     key: 'businessTime',
     title: '营业时间',
     align: 'center',
-    render: row => {
-      return row.businessTime?.map(it => {
-        return (
-          <div>
-            {it.startTime} - {it.endTime}
-          </div>
-        );
-      });
-    }
+    width: 200
   },
   {
     key: 'notice',
     title: '门店公告',
-    align: 'center'
+    align: 'center',
+    render: row => {
+      return <div>{row.notice || '--'}</div>;
+    }
   }
 ];
 
@@ -85,13 +102,8 @@ const [registerTable] = useTable({
     schemas: [
       {
         label: '门店名称',
-        component: 'ApiSelect',
-        field: 'shopId',
-        componentProps: {
-          api: fetchGetAllStoreList,
-          labelFeild: 'shopName',
-          valueFeild: 'hbStationId'
-        }
+        component: 'NInput',
+        field: 'shopName'
       },
       {
         field: 'hbStationNo',