Преглед изворни кода

Merge branch 'feature/mockApi' of http://face3d.4dage.com:7005/zhangyupeng/zfb_mp into feature/mockApi

tangning пре 3 година
родитељ
комит
8626060647

+ 1 - 1
src/api/device/list.ts

@@ -10,7 +10,7 @@ enum Api {
  */
 
 export const ListApi = (params: PageParams) =>
-  defHttp.get<RentListGetResultModel>({
+  defHttp.post<RentListGetResultModel>({
     url: Api.pageList,
     params,
     headers: {

+ 2 - 2
src/api/member/list.ts

@@ -2,7 +2,7 @@ import { defHttp } from '/@/utils/http/axios';
 import { PageParams, MemberListGetResultModel } from './model';
 
 enum Api {
-  pageList = '/basic-api/member/list',
+  pageList = '/basic-api/user/list',
 }
 
 /**
@@ -10,7 +10,7 @@ enum Api {
  */
 
 export const ListApi = (params: PageParams) =>
-  defHttp.get<MemberListGetResultModel>({
+  defHttp.post<MemberListGetResultModel>({
     url: Api.pageList,
     params,
     headers: {

+ 2 - 2
src/api/product/category.ts

@@ -2,7 +2,7 @@ import { defHttp } from '/@/utils/http/axios';
 import { PageParams, RentListGetResultModel } from './model';
 
 enum Api {
-  category = '/zfb/product/category',
+  category = '/basic-api/category/queryAll',
 }
 
 /**
@@ -10,7 +10,7 @@ enum Api {
  */
 
 export const categoryApi = (params: PageParams) =>
-  defHttp.get<RentListGetResultModel>({
+  defHttp.post<RentListGetResultModel>({
     url: Api.category,
     params,
     headers: {

+ 35 - 3
src/api/product/list.ts

@@ -1,9 +1,13 @@
 import { defHttp } from '/@/utils/http/axios';
 import { PageParams, RentListGetResultModel } from './model';
+import { Result } from '/#/axios';
 
 enum Api {
-  pageList = '/basic-api/product/list',
-  category = '/basic-api/product/category',
+  pageList = '/basic-api/goods/list',
+  ref = '/basic-api/specification/list',
+  unSale = '/basic-api/goods/unSale',
+  enSale = '/basic-api/goods/enSale',
+  delete = '/basic-api/goods/delete',
 }
 
 /**
@@ -11,7 +15,7 @@ enum Api {
  */
 
 export const ListApi = (params: PageParams) =>
-  defHttp.get<RentListGetResultModel>({
+  defHttp.post<RentListGetResultModel>({
     url: Api.pageList,
     params,
     headers: {
@@ -19,3 +23,31 @@ export const ListApi = (params: PageParams) =>
       ignoreCancelToken: true,
     },
   });
+export const UnSaleApi = (params: string[]) =>
+  defHttp.post<Result>({
+    url: Api.unSale,
+    data: params.join(','),
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });
+
+export const EnSaleApi = (params: string[]) =>
+  defHttp.post<Result>({
+    url: Api.enSale,
+    data: params.join(','),
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });
+export const DeleteApi = (params: string[]) =>
+  defHttp.post<Result>({
+    url: Api.delete,
+    params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });

+ 1 - 1
src/api/scene/live.ts

@@ -2,7 +2,7 @@ import { defHttp } from '/@/utils/http/axios';
 import { PageParams, RentListGetResultModel } from './model';
 
 enum Api {
-  pageList = '/zfb/scene/live',
+  pageList = '/basic-api/brand/brandBindList',
 }
 
 /**

+ 23 - 0
src/api/sys/model/userModel.ts

@@ -8,8 +8,31 @@ export interface LoginParams {
 }
 
 export interface RoleInfo {
+  userID: string;
   roleName: string;
   value: string;
+  brandList: string[] | any;
+  canShow: string;
+  createTime: number;
+  createUserId: number;
+  deptExpirationDate: number;
+  deptId: number;
+  deptManagerPhoneNum: string;
+  deptName: string;
+  email: string;
+  fdkkPassword: string;
+  fdkkUser: string;
+  isPlatformStreamer: false;
+  mobile: string;
+  parentDeptId: number;
+  parentDeptName: number;
+  password: string;
+  roleId: number;
+  roleIdList: any[];
+  roleList: number;
+  status: number;
+  userId: number;
+  username: string;
 }
 
 /**

+ 6 - 3
src/api/sys/user.ts

@@ -6,7 +6,7 @@ import { ErrorMessageMode } from '/#/axios';
 enum Api {
   Login = '/basic-api/sys/login',
   Logout = '/logout',
-  GetUserInfo = '/basic-api/getUserInfo',
+  GetUserInfo = '/basic-api/sys/user/infoAnon',
   GetPermCode = '/getPermCode',
 }
 
@@ -35,8 +35,11 @@ export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal')
 /**
  * @description: getUserInfo
  */
-export function getUserInfo() {
-  return defHttp.get<GetUserInfoModel>({ url: Api.GetUserInfo }, { errorMessageMode: 'none' });
+export function getUserInfo(id: number) {
+  return defHttp.get<GetUserInfoModel>(
+    { url: `${Api.GetUserInfo}/${id}` },
+    { errorMessageMode: 'none' },
+  );
 }
 
 export function getPermCode() {

+ 5 - 5
src/api/system/system.ts

@@ -19,15 +19,15 @@ import { defHttp } from '/@/utils/http/axios';
 enum Api {
   AccountList = '/basic-api/system/getAccountList',
   IsAccountExist = '/basic-api/system/accountExist',
-  DeptList = '/basic-api/system/getDeptList',
+  DeptList = '/basic-api/sys/dept/list',
   setRoleStatus = '/basic-api/system/setRoleStatus',
   MenuList = '/basic-api/sys/menu/queryAll',
-  RolePageList = '/basic-api/system/getRoleListByPage',
+  RolePageList = '/basic-api/sys/role/list',
   GetAllRoleList = '/basic-api/system/getAllRoleList',
 }
 
 export const getAccountList = (params: AccountParams) =>
-  defHttp.get<AccountListGetResultModel>({ url: Api.AccountList, params });
+  defHttp.post<AccountListGetResultModel>({ url: Api.AccountList, params });
 
 export const getDeptList = (params?: DeptListItem) =>
   defHttp.get<DeptListGetResultModel>({ url: Api.DeptList, params });
@@ -39,10 +39,10 @@ export const getMenuList = (params?: MenuParams) =>
   });
 
 export const getRoleListByPage = (params?: RolePageParams) =>
-  defHttp.get<RolePageListGetResultModel>({ url: Api.RolePageList, params });
+  defHttp.post<RolePageListGetResultModel>({ url: Api.RolePageList, params });
 
 export const getAllRoleList = (params?: RoleParams) =>
-  defHttp.get<RoleListGetResultModel>({ url: Api.GetAllRoleList, params });
+  defHttp.post<RoleListGetResultModel>({ url: Api.GetAllRoleList, params });
 
 export const setRoleStatus = (id: number, status: string) =>
   defHttp.post({ url: Api.setRoleStatus, params: { id, status } });

+ 4 - 1
src/locales/lang/en/common.ts

@@ -19,5 +19,8 @@ export default {
   dark: 'Dark',
 
   yes: 'yes',
-  no: 'yes',
+  no: 'no',
+
+  optSuccess: 'opt success',
+  optFail: 'opt fail',
 };

+ 2 - 0
src/locales/lang/zh-CN/common.ts

@@ -20,4 +20,6 @@ export default {
 
   yes: '是',
   no: '否',
+  optSuccess: '操作成功',
+  optFail: '操作失败',
 };

+ 1 - 0
src/router/guard/permissionGuard.ts

@@ -83,6 +83,7 @@ export function createPermissionGuard(router: Router) {
     // get userinfo while last fetch time is empty
     if (userStore.getLastUpdateTime === 0) {
       try {
+        // debugger;
         await userStore.getUserInfoAction();
       } catch (err) {
         next();

+ 1 - 0
src/store/modules/permission.ts

@@ -124,6 +124,7 @@ export const usePermissionStore = defineStore({
       const patchHomeAffix = (routes: AppRouteRecordRaw[]) => {
         if (!routes || routes.length === 0) return;
         let homePath: string = userStore.getUserInfo.homePath || PageEnum.BASE_HOME;
+
         function patcher(routes: AppRouteRecordRaw[], parentPath = '') {
           if (parentPath) parentPath = parentPath + '/';
           routes.forEach((route: AppRouteRecordRaw) => {

+ 11 - 5
src/store/modules/user.ts

@@ -40,6 +40,9 @@ export const useUserStore = defineStore({
     lastUpdateTime: 0,
   }),
   getters: {
+    getUserInfoCache(): UserInfo {
+      return getAuthCache<UserInfo>(USER_INFO_KEY) || {};
+    },
     getUserInfo(): UserInfo {
       return this.userInfo || getAuthCache<UserInfo>(USER_INFO_KEY) || {};
     },
@@ -94,18 +97,19 @@ export const useUserStore = defineStore({
         const { token, user } = data;
 
         console.log('user', user);
+        const userID: number = user.userId;
 
         // save token
         this.setToken(token);
-        return this.afterLoginAction(goHome);
+        return this.afterLoginAction(userID, goHome);
       } catch (error) {
         return Promise.reject(error);
       }
     },
-    async afterLoginAction(goHome?: boolean): Promise<GetUserInfoModel | null> {
+    async afterLoginAction(id: number, goHome?: boolean): Promise<GetUserInfoModel | null> {
       if (!this.getToken) return null;
       // get user info
-      const userInfo = await this.getUserInfoAction();
+      const userInfo = await this.getUserInfoAction(id);
 
       const sessionTimeout = this.sessionTimeout;
       if (sessionTimeout) {
@@ -124,9 +128,11 @@ export const useUserStore = defineStore({
       }
       return userInfo;
     },
-    async getUserInfoAction(): Promise<UserInfo | null> {
+    async getUserInfoAction(id?: number): Promise<UserInfo | null> {
       if (!this.getToken) return null;
-      const userInfo = await getUserInfo();
+      const userId: number = id || Number(this.getUserInfoCache.userId);
+      // debugger;
+      const userInfo = await getUserInfo(userId);
       const { roles = [] } = userInfo;
       if (isArray(roles)) {
         const roleList = roles.map((item) => item.value) as RoleEnum[];

+ 6 - 1
src/utils/http/axios/index.ts

@@ -57,6 +57,7 @@ const transform: AxiosTransform = {
       data &&
       Reflect.has(data, 'code') &&
       (code === ResultEnum.SUCCESS || code === ResultEnum.NORMAL);
+
     if (hasSuccess) {
       const converterResult = data.message;
       const converterMessage = error;
@@ -81,6 +82,10 @@ const transform: AxiosTransform = {
         if (message) {
           timeoutMsg = message;
         }
+        //TODO 由于后端HACKCODE error当信息string
+        if (error) {
+          timeoutMsg = error;
+        }
     }
 
     // errorMessageMode=‘modal’的时候会显示modal错误弹窗,而不是消息提示,用于一些比较重要的错误
@@ -90,7 +95,7 @@ const transform: AxiosTransform = {
     } else if (options.errorMessageMode === 'message') {
       createMessage.error(timeoutMsg);
     }
-
+    console.log('timeoutMsg', timeoutMsg);
     throw new Error(timeoutMsg || t('sys.api.apiRequestFailed'));
   },
 

+ 28 - 15
src/views/dashboard/feedback/list.vue

@@ -2,9 +2,14 @@
   <div class="p-4">
     <BasicTable @register="registerTable">
       <template #toolbar> </template>
-      <template #feedbackType="{ record }">
-        {{ renderFeedbackType(record.feedbackType) }}
+      <template #feedType="{ record }">
+        {{ renderFeedbackType(record.feedType) }}
       </template>
+
+      <template #addTime="{ record }">
+        <Time :value="record.addTime" mode="datetime" />
+      </template>
+
       <template #action="{ record }">
         <TableAction
           :actions="[
@@ -40,23 +45,24 @@
   import { useI18n } from '/@/hooks/web/useI18n';
   // import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
   import { useGo } from '/@/hooks/web/usePage';
+  import { Time } from '/@/components/Time';
 
   export default defineComponent({
-    components: { BasicTable, TableAction },
+    components: { BasicTable, TableAction, Time },
     setup() {
       const { createMessage } = useMessage();
       const go = useGo();
       const { t } = useI18n();
       const columns: BasicColumn[] = [
-        {
-          title: 'ID',
-          dataIndex: 'id',
-          fixed: 'left',
-          width: 60,
-        },
+        // {
+        //   title: 'ID',
+        //   dataIndex: 'userId',
+        //   fixed: 'left',
+        //   width: 60,
+        // },
         {
           title: '会员名称',
-          dataIndex: 'name',
+          dataIndex: 'userName',
           width: 160,
         },
         {
@@ -66,13 +72,13 @@
         },
         {
           title: '手机',
-          dataIndex: 'phone',
+          dataIndex: 'mobile',
           width: 80,
         },
         {
           title: '反馈类型',
-          dataIndex: 'feedbackType',
-          slots: { customRender: 'feedbackType' },
+          dataIndex: 'feedType',
+          slots: { customRender: 'feedType' },
           sorter: true,
           width: 80,
         },
@@ -83,7 +89,8 @@
         },
         {
           title: '反馈时间',
-          dataIndex: 'createTime',
+          dataIndex: 'addTime',
+          slots: { customRender: 'addTime' },
           width: 130,
         },
         // {
@@ -119,9 +126,15 @@
         showTableSetting: true,
         tableSetting: { fullScreen: true },
         showIndexColumn: false,
-        rowKey: 'id',
+        // rowKey: 'userId',
         pagination: { pageSize: 20 },
         bordered: true,
+        fetchSetting: {
+          pageField: 'page',
+          sizeField: 'limit',
+          listField: 'list',
+          totalField: 'totalCount',
+        },
       });
 
       function renderFeedbackType(type: number): string {

+ 49 - 9
src/views/dashboard/member/list.vue

@@ -1,15 +1,46 @@
+<!-- 
+avatar: "https://thirdwx.qlogo.cn/mmopen/vi_32/dTbT3X0Fm7BnUA4DoQhBy14smppF5eBibqPSOib3ou5elGuJ1eYZ9sib2ZALDMs1icYupWIxiaJwWETTV8we9brCHhQ/132"
+bindBrandId: null
+bindBrandName: null
+birthday: 631123200000
+brandId: null
+brandName: null
+city: ""
+gender: 1
+id: 25
+isAdmin: 0
+lastLoginIp: "117.136.32.65"
+lastLoginTime: 1631504271000
+levelName: null
+mobile: "13536501128"
+nickname: "波仔"
+password: "oeADe5U9uLeMYsNigq98zdu8J96A"
+registerIp: "117.136.32.65"
+registerTime: 1631504271000
+userLevelId: null
+username: "微信用户f8f4igi4j9ks"
+weixinOpenid: "oeADe5U9uLeMYsNigq98zdu8J96A" 
+-->
 <template>
   <div class="p-4">
     <BasicTable @register="registerTable">
       <template #toolbar> </template>
-      <template #avatarUrl="{ record }">
-        <Avatar :size="80" :src="record.avatarUrl" />
+      <template #avatar="{ record }">
+        <Avatar :size="80" :src="record.avatar" />
       </template>
 
       <template #gender="{ record }">
         {{ renderGenderLabel(record.gender) }}
       </template>
 
+      <template #birthday="{ record }">
+        <Time :value="record.birthday" mode="datetime" />
+      </template>
+
+      <template #lastLoginTime="{ record }">
+        <Time :value="record.lastLoginTime" mode="datetime" />
+      </template>
+
       <template #action="{ record }">
         <TableAction
           :actions="[
@@ -45,9 +76,10 @@
   // import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
   import { useGo } from '/@/hooks/web/usePage';
   import { Avatar } from 'ant-design-vue';
+  import { Time } from '/@/components/Time';
 
   export default defineComponent({
-    components: { BasicTable, TableAction, Avatar },
+    components: { BasicTable, TableAction, Avatar, Time },
     setup() {
       const { createMessage } = useMessage();
       const go = useGo();
@@ -61,14 +93,14 @@
         },
         {
           title: '会员名称',
-          dataIndex: 'name',
+          dataIndex: 'username',
           sorter: true,
           width: 160,
         },
         {
           title: '头像',
-          dataIndex: 'avatarUrl',
-          slots: { customRender: 'avatarUrl' },
+          dataIndex: 'avatar',
+          slots: { customRender: 'avatar' },
           width: 120,
         },
         {
@@ -81,22 +113,24 @@
         {
           title: '出生日期',
           dataIndex: 'birthday',
+          slots: { customRender: 'birthday' },
           width: 120,
         },
         {
           title: '最后登录时间',
-          dataIndex: 'lastLogin',
+          dataIndex: 'lastLoginTime',
+          slots: { customRender: 'lastLoginTime' },
           sorter: true,
           width: 120,
         },
         {
           title: '微信名',
-          dataIndex: 'nickName',
+          dataIndex: 'nickname',
           width: 120,
         },
         {
           title: '手机号',
-          dataIndex: 'phone',
+          dataIndex: 'mobile',
           width: 120,
         },
       ];
@@ -128,6 +162,12 @@
         rowKey: 'id',
         pagination: { pageSize: 20 },
         bordered: true,
+        fetchSetting: {
+          pageField: 'page',
+          sizeField: 'limit',
+          listField: 'list',
+          totalField: 'totalCount',
+        },
       });
 
       function renderGenderLabel(gender: number): string {

+ 99 - 28
src/views/dashboard/order/list.vue

@@ -1,7 +1,55 @@
+<!-- 
+actualPrice: 50
+addTime: 1631094304000
+address: "港湾一号港11"
+brandId: 1046508
+brandName: "一楼展厅-多点位"
+callbackStatus: null
+city: "珠海市"
+confirmTime: null
+consignee: "cy"
+country: null
+couponId: ""
+couponPrice: 0
+district: "香洲区"
+freightPrice: 0
+goodsList: null
+goodsPrice: 50
+id: 676
+integral: 0
+integralMoney: 0
+logistics: null
+mobile: "15975119071"
+newId: "6761046508"
+nickName: "sousya"
+orderPrice: 50
+orderSn: "20210908174503807397842"
+orderStatus: 0
+orderType: "4"
+parentId: null
+payId: "wx0817450412422539ab24fc31729b920000"
+payName: null
+payStatus: 0
+payTime: null
+postscript: null
+province: "广东省"
+shippingFee: 0
+shippingId: 0
+shippingName: null
+shippingNo: null
+shippingStatus: 0
+userId: 17
+userName: "微信用户q0zj95zuo4pv" -->
 <template>
   <div class="p-4">
-    <BasicTable @register="registerTable">
-      <template #toolbar> </template>
+    <BasicTable
+      @register="registerTable"
+      :rowSelection="{ type: 'checkbox', onChange: onSelectChange }"
+    >
+      <template #toolbar>
+        <a-button type="primary" @click="sendPackage"> 发货</a-button>
+        <!-- dashed  link  text-->
+      </template>
       <template #cover="{ record }">
         <TableImg :size="150" :simpleShow="true" :imgList="[record.cover]" />
       </template>
@@ -9,11 +57,14 @@
       <template #orderStatus="{ record }">
         {{ renderOrderStatusLabel(record.orderStatus) }}
       </template>
-      <template #shipingStatus="{ record }">
-        {{ renderShipingStatusLabel(record.shipingStatus) }}
+      <template #shippingStatus="{ record }">
+        {{ rendershippingStatusLabel(record.shippingStatus) }}
+      </template>
+      <template #payStatus="{ record }">
+        {{ renderpayStatusLabel(record.payStatus) }}
       </template>
-      <template #paymentStatus="{ record }">
-        {{ renderPaymentStatusLabel(record.paymentStatus) }}
+      <template #addTime="{ record }">
+        <Time :value="record.addTime" mode="datetime" />
       </template>
       <template #action="{ record }">
         <TableAction
@@ -22,7 +73,7 @@
               icon: 'mdi:information-outline',
               label: '详情',
               onClick: () => {
-                go(`/order/list/detail/${record.orderNo}`);
+                go(`/order/list/detail/${record.orderSn}`);
               },
             },
             {
@@ -57,9 +108,10 @@
   import { useI18n } from '/@/hooks/web/useI18n';
   // import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
   import { useGo } from '/@/hooks/web/usePage';
+  import { Time } from '/@/components/Time';
 
   export default defineComponent({
-    components: { BasicTable, TableAction, TableImg },
+    components: { BasicTable, TableAction, TableImg, Time },
     setup() {
       const { createMessage } = useMessage();
       const go = useGo();
@@ -73,18 +125,18 @@
         },
         {
           title: '订单号',
-          dataIndex: 'orderNo',
+          dataIndex: 'orderSn',
 
           width: 160,
         },
         {
           title: '会员昵称',
-          dataIndex: 'name',
+          dataIndex: 'nickName',
           width: 80,
         },
         {
           title: 'VR场景',
-          dataIndex: 'scene.name',
+          dataIndex: 'brandName',
           width: 80,
         },
         {
@@ -103,36 +155,37 @@
         },
         {
           title: '发货状态',
-          dataIndex: 'shipingStatus',
+          dataIndex: 'shippingStatus',
           sorter: true,
-          slots: { customRender: 'shipingStatus' },
+          slots: { customRender: 'shippingStatus' },
           width: 80,
         },
         {
           title: '付款状态',
-          dataIndex: 'paymentStatus',
-          slots: { customRender: 'paymentStatus' },
+          dataIndex: 'payStatus',
+          slots: { customRender: 'payStatus' },
           width: 60,
         },
         {
           title: '快递公司',
-          dataIndex: 'shipingCompany',
+          dataIndex: 'shipingName',
           width: 60,
         },
         {
           title: '快递单号',
-          dataIndex: 'shipingNo',
+          dataIndex: 'shippingNo',
           width: 80,
         },
         {
           title: '实际支付金额',
-          dataIndex: 'shipingAmount',
+          dataIndex: 'actualPrice',
           width: 80,
         },
         {
           title: '下单时间',
-          dataIndex: 'createTime',
+          dataIndex: 'addTime',
           width: 120,
+          slots: { customRender: 'addTime' },
         },
         {
           title: '操作',
@@ -169,6 +222,12 @@
         showIndexColumn: false,
         rowKey: 'id',
         pagination: { pageSize: 20 },
+        fetchSetting: {
+          pageField: 'page',
+          sizeField: 'limit',
+          listField: 'list',
+          totalField: 'totalCount',
+        },
         bordered: true,
       });
 
@@ -185,20 +244,22 @@
       function renderOrderStatusLabel(type: number): string {
         switch (type) {
           case 0:
-            return '已取消';
-          case 1:
             return '待付款';
-          case 2:
+          case 101:
+            return '已取消';
+          case 201:
             return '已付款';
-          case 3:
+          case 1:
             return '已发货';
-          case 4:
+          case 2:
             return '已收货';
+          case 501:
+            return '完成';
           default:
             return '';
         }
       }
-      function renderShipingStatusLabel(type: number): string {
+      function rendershippingStatusLabel(type: number): string {
         switch (type) {
           case 0:
             return '未发货';
@@ -208,7 +269,7 @@
             return '';
         }
       }
-      function renderPaymentStatusLabel(type: number): string {
+      function renderpayStatusLabel(type: number): string {
         switch (type) {
           case 0:
             return '未付款';
@@ -219,6 +280,14 @@
         }
       }
 
+      function sendPackage() {
+        console.log('sendPackage');
+      }
+      function onSelectChange(selectedRowKeys: (string | number)[]) {
+        console.log(selectedRowKeys);
+        // checkedKeys.value = selectedRowKeys;
+      }
+
       return {
         registerTable,
         createMessage,
@@ -226,8 +295,10 @@
         go,
         renderOrderTypeLabel,
         renderOrderStatusLabel,
-        renderShipingStatusLabel,
-        renderPaymentStatusLabel,
+        rendershippingStatusLabel,
+        renderpayStatusLabel,
+        sendPackage,
+        onSelectChange,
         uploadApi: uploadApi as any,
       };
     },

+ 8 - 4
src/views/dashboard/product/category.vue

@@ -1,9 +1,9 @@
 <template>
   <BasicTable @register="registerTable">
     <template #toolbar>
-      <a-button type="primary" @click="handleCreate"> 新增商品分类</a-button>
-      <a-button type="warning" @click="expandAll">展开全部</a-button>
-      <a-button type="error" @click="collapseAll">折叠全部</a-button>
+      <a-button primary color="error" @click="handleCreate"> 新增商品分类</a-button>
+      <a-button ghost color="warning" @click="expandAll">展开全部</a-button>
+      <a-button type="primary" @click="collapseAll">折叠全部</a-button>
     </template>
     <template #action="{ record }">
       <TableAction
@@ -83,11 +83,11 @@
         title: '商品分类',
         api: categoryApi,
         columns: columns,
+        isTreeTable: true,
         useSearchForm: true,
         showTableSetting: true,
         tableSetting: { fullScreen: true },
         showIndexColumn: false,
-        isTreeTable: true,
         rowKey: 'id',
         bordered: true,
         actionColumn: {
@@ -97,6 +97,10 @@
           slots: { customRender: 'action' },
           fixed: undefined,
         },
+        afterFetch(data) {
+          console.log('11', data);
+          // return [];
+        },
       });
       function handleCreate() {}
       function handleEdit() {}

+ 38 - 26
src/views/dashboard/product/list.data.ts

@@ -1,14 +1,16 @@
 import { BasicColumn, FormProps } from '/@/components/Table';
 
+import { UnSaleApi, EnSaleApi } from '/@/api/product/list';
 import { h } from 'vue';
 import { Switch } from 'ant-design-vue';
 import { useMessage } from '/@/hooks/web/useMessage';
+import { useI18n } from '/@/hooks/web/useI18n';
 
 export const searchForm: Partial<FormProps> = {
   labelWidth: 100,
   schemas: [
     {
-      field: 'orderNo',
+      field: 'name',
       label: '商品名称',
       component: 'Input',
       colProps: {
@@ -19,87 +21,97 @@ export const searchForm: Partial<FormProps> = {
   ],
 };
 export const columns: BasicColumn[] = [
-  {
-    title: 'ID',
-    dataIndex: 'id',
-    fixed: 'left',
-    width: 60,
-  },
+  // {
+  //   title: 'ID',
+  //   dataIndex: 'id',
+  //   fixed: 'left',
+  //   width: 60,
+  // },
   {
     title: '商品名称',
     dataIndex: 'name',
-
     width: 160,
   },
   {
     title: '商品描述',
-    dataIndex: 'desc',
+    dataIndex: 'goodsSimpleDesc',
     width: 150,
   },
   {
     title: '购买链接',
-    dataIndex: 'link',
-    slots: { customRender: 'link' },
+    dataIndex: 'realShopUrl',
+    slots: { customRender: 'realShopUrl' },
     width: 150,
   },
   {
     title: '商品分类',
-    dataIndex: 'productType',
-    slots: { customRender: 'productType' },
+    dataIndex: 'categoryName',
+    // slots: { customRender: 'productType' },
     sorter: true,
     width: 120,
   },
   {
     title: '直播间名称',
-    dataIndex: 'steamRoom',
-    customRender: ({ record }) => {
-      return record.steamRoom.name as unknown as {};
-    },
+    dataIndex: 'brandName',
+    // customRender: ({ record }) => {
+    //   return record.steamRoom.name as unknown as {};
+    // },
     sorter: true,
     width: 120,
   },
   {
     title: '零售价格',
-    dataIndex: 'unit',
+    dataIndex: 'retailPrice',
     sorter: true,
     width: 80,
   },
   {
     title: '销售量',
-    dataIndex: 'amount',
+    dataIndex: 'sellVolume',
     sorter: true,
     width: 80,
   },
   {
     title: '市场价',
-    dataIndex: 'marketingUnit',
+    dataIndex: 'marketPrice',
     sorter: true,
     width: 80,
   },
   {
     title: '下单时间',
-    dataIndex: 'createTime',
+    dataIndex: 'addTime',
+    slots: { customRender: 'addTime' },
     sorter: true,
     width: 140,
   },
   {
     title: '上架状态',
-    dataIndex: 'isLaunched',
+    dataIndex: 'isOnSale',
     width: 180,
     customRender: ({ record }) => {
       if (!Reflect.has(record, 'pendingStatus')) {
         record.pendingStatus = false;
       }
       return h(Switch, {
-        checked: record.isLaunched,
+        checked: record.isOnSale === 1,
         checkedChildren: '上架',
         unCheckedChildren: '下架',
         loading: false,
-        onChange(checked: boolean) {
+        onChange: async (checked: boolean) => {
           record.pendingStatus = true;
-          const newStatus = checked ? '1' : '0';
+          const id: string = record.id || '';
+          const newStatus = checked ? 1 : 0;
           const { createMessage } = useMessage();
-          createMessage.info(`暂未接入` + newStatus);
+          const { t } = useI18n();
+          if (checked) {
+            Reflect.set(record, 'isOnSale', newStatus);
+            await EnSaleApi([id]);
+          } else {
+            Reflect.set(record, 'isOnSale', newStatus);
+            await UnSaleApi([id]);
+          }
+          createMessage.success(t('common.optSuccess'));
+          // createMessage.info(`暂未接入` + newStatus);
         },
       });
     },

+ 147 - 22
src/views/dashboard/product/list.vue

@@ -1,14 +1,91 @@
+<!-- 
+ddTime: 1631589637000
+appExclusivePrice: null
+attributeCategory: null
+attributeCategoryName: null
+attributeEntityList: []
+brandId: 1046505
+brandName: "0907更新部署直播间"
+categoryId: 1036110
+categoryName: "6041分类"
+counterPrice: null
+createUserDeptId: 176
+createUserId: 247
+extraPrice: null
+ggContent: "[{\"value\":\"32\",\"picUrl\":\"https://4dkk.4dage.com/shop/huafa/20210914/11201310556ed1.png\",\"uuid\":\"1-1\",\"specificationId\":50,\"inputVal\":{\"goodsNumber\":\"\",\"goodsSn\":\"\",\"retailPrice\":\"\",\"marketPrice\":\"\"}}]"
+goodsBrief: null
+goodsDesc: ""
+goodsImgList: []
+goodsNumber: 45
+goodsSimpleDesc: "1234"
+goodsSn: "2314"
+goodsSpecificationList: []
+goodsUnit: null
+guigeArr: "[{\"name\":\"test数据\",\"val\":[{\"name\":\"32\",\"picUrl\":\"https://4dkk.4dage.com/shop/huafa/20210914/11201310556ed1.png\",\"uuid\":\"1-1\"}],\"show\":false,\"picUrl\":\"\",\"specificationId\":50}]"
+id: 77006332
+isAppExclusive: 0
+isDelete: 0
+isHot: 0
+isLimited: 0
+isNew: 1
+isOnSale: 0
+keywords: null
+listPicUrl: "https://4dkk.4dage.com/shop/huafa/20210914/11203269611dc.png?x-oss-process=image/resize,m_fixed,w_400,h_400"
+marketPrice: 1233
+name: "3214"
+primaryPicUrl: "https://4dkk.4dage.com/shop/huafa/20210914/112028835f7db0.png?x-oss-process=image/resize,m_fixed,w_300,h_300"
+primaryProductId: null
+productList: []
+promotionDesc: null
+promotionTag: null
+realShopUrl: null
+retailPrice: 1233
+sellVolume: null
+sortOrder: null
+unitPrice: null
+updateTime: 1631589637000
+updateUserId: 247 
+-->
 <template>
   <div>
-    <BasicTable @register="registerTable">
+    <BasicTable
+      @register="registerTable"
+      :rowSelection="{ type: 'checkbox', onChange: onSelectChange }"
+    >
       <template #toolbar>
         <a-button type="primary" @click="handleCreate"> 新增商品</a-button>
+        <PopConfirmButton
+          title="是否确定批量删除?"
+          primary
+          color="error"
+          @confirm="handlePatchDelete"
+        >
+          批量删除</PopConfirmButton
+        >
+        <PopConfirmButton
+          title="是否确定批量上架?"
+          primary
+          color="warning"
+          @confirm="handlePatchEnSale"
+        >
+          批量上架</PopConfirmButton
+        >
+        <PopConfirmButton
+          title="是否确定批量下架?"
+          ghost
+          color="error"
+          @confirm="handlePatchUnSale"
+        >
+          批量下架</PopConfirmButton
+        >
       </template>
-      <template #link="{ record }">
-        <a :href="record.link" target="_blank">{{ record.link }}</a>
+      <template #realShopUrl="{ record }">
+        <a :href="record.realShopUrl" target="_blank">{{ record.realShopUrl }}</a>
       </template>
-      <template #orderType="{ record }"> {{ renderProductTypeLabel(record.orderType) }} </template>
 
+      <template #addTime="{ record }">
+        <Time :value="record.addTime" mode="datetime" />
+      </template>
       <template #action="{ record }">
         <TableAction
           :actions="[
@@ -24,7 +101,7 @@
               popConfirm: {
                 title: '是否确认删除',
                 confirm: () => {
-                  createMessage.info(`暂未接入`);
+                  handleSingleDelete(record.id);
                 },
               },
             },
@@ -36,14 +113,15 @@
   </div>
 </template>
 <script lang="ts">
-  import { defineComponent } from 'vue';
+  import { defineComponent, nextTick } from 'vue';
   import { BasicTable, useTable, TableAction } from '/@/components/Table';
-
+  import { PopConfirmButton } from '/@/components/Button';
   import { useMessage } from '/@/hooks/web/useMessage';
   import { uploadApi } from '/@/api/sys/upload';
   // import { Switch } from 'ant-design-vue';
   // import { h } from 'vue';
-  import { ListApi } from '/@/api/product/list';
+  // UnSaleApi EnSaleApi
+  import { ListApi, DeleteApi, EnSaleApi, UnSaleApi } from '/@/api/product/list';
   import { useI18n } from '/@/hooks/web/useI18n';
   // import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
   import { useGo } from '/@/hooks/web/usePage';
@@ -51,16 +129,17 @@
   import ProductDrawer from './productDrawer.vue';
   // import { PageWrapper } from '/@/components/Page';
   import { columns, searchForm } from './list.data';
+  import { Time } from '/@/components/Time';
 
   export default defineComponent({
-    components: { BasicTable, TableAction, ProductDrawer },
+    components: { BasicTable, TableAction, ProductDrawer, Time, PopConfirmButton },
     setup() {
       const { createMessage } = useMessage();
       const go = useGo();
       const { t } = useI18n();
       const [registerDrawer, { openDrawer }] = useDrawer();
 
-      const [registerTable] = useTable({
+      const [registerTable, { reload, getSelectRowKeys }] = useTable({
         title: '商品列表',
         api: ListApi,
         columns: columns,
@@ -68,22 +147,19 @@
         formConfig: searchForm,
         showTableSetting: true,
         tableSetting: { fullScreen: true },
-        showIndexColumn: false,
+        showIndexColumn: true,
         rowKey: 'id',
         pagination: { pageSize: 20 },
+        clickToRowSelect: false,
         bordered: true,
+        fetchSetting: {
+          pageField: 'page',
+          sizeField: 'limit',
+          listField: 'list',
+          totalField: 'totalCount',
+        },
       });
 
-      function renderProductTypeLabel(type: number): string {
-        switch (type) {
-          case 0:
-            return '立即购买';
-          case 1:
-            return '延后购买';
-          default:
-            return '立即购买';
-        }
-      }
       function handleEdit(record: Recordable) {
         openDrawer(true, {
           record,
@@ -95,16 +171,65 @@
           isUpdate: false,
         });
       }
+      function onSelectChange(): void {}
+      async function handleDelete(ids: string[]) {
+        await DeleteApi(ids);
+        nextTick(reload);
+      }
+      function handleSingleDelete(id: string) {
+        handleDelete([id]);
+      }
 
+      function handlePatchDelete() {
+        const keys = getSelectRowKeys();
+        console.log('key', keys);
+        if (keys.length === 0) {
+          createMessage.info('请至少选择一项');
+          return;
+        }
+        handleDelete(keys);
+      }
+      async function handlePatchEnSale() {
+        try {
+          const keys = getSelectRowKeys();
+          console.log('key', keys);
+          if (keys.length === 0) {
+            createMessage.info('请至少选择一项');
+            return;
+          }
+          await EnSaleApi(keys);
+          nextTick(reload);
+        } catch (error) {
+          nextTick(reload);
+        }
+      }
+      async function handlePatchUnSale() {
+        try {
+          const keys = getSelectRowKeys();
+          console.log('key', keys);
+          if (keys.length === 0) {
+            createMessage.info('请至少选择一项');
+            return;
+          }
+          await UnSaleApi(keys);
+          nextTick(reload);
+        } catch (error) {
+          nextTick(reload);
+        }
+      }
       return {
         registerTable,
         createMessage,
         t,
         go,
-        renderProductTypeLabel,
         registerDrawer,
         handleEdit,
         handleCreate,
+        onSelectChange,
+        handleSingleDelete,
+        handlePatchDelete,
+        handlePatchEnSale,
+        handlePatchUnSale,
         uploadApi: uploadApi as any,
       };
     },

+ 41 - 4
src/views/dashboard/scenes/live.vue

@@ -1,9 +1,40 @@
+<!-- address: "浙江省,杭州市,萧山区 山阴路688号恒隆广场B座1217"
+adminId: null
+appListPicUrl: null
+bindShowerId: null
+bindShowerName: null
+bindShowerNameList: null
+city: null
+contractPhone: "18819272208"
+createTime: null
+createUserDeptId: 208
+createUserId: 367
+deleted: 0
+id: 1046543
+introduceVideo: null
+introduceVideoCover: null
+latitude: 30.178317
+liveRoomUrl: "https://test.4dkankan.com/shop.html?m=t-CUsa1i2"
+livestreamStatus: 0
+longitude: 120.262421
+name: "自动hdr室外"
+picList: null
+sceneName: "自动hdr室外"
+sceneNum: "t-CUsa1i2"
+sceneUrl: "https://test.4dkankan.com/smobile.html?m=t-CUsa1i2"
+shareWxQrCode: "https://houseoss.4dkankan.com/domain/shop/image/t-CUsa1i21637049206783_QRCode.png"
+simpleDesc: "自动hdr室外"
+sortOrder: 100
+token: null
+type: 0
+updateTime: null
+updateUserId: null -->
 <template>
   <div class="p-4">
     <BasicTable @register="registerTable">
       <template #toolbar> </template>
       <template #cover="{ record }">
-        <TableImg :size="150" :simpleShow="true" :imgList="[record.cover]" />
+        <TableImg :size="150" :simpleShow="true" :imgList="[record.appListPicUrl]" />
       </template>
       <template #houseType="{ record }">
         {{ renderHouseType(record.houseType) }}
@@ -78,19 +109,19 @@
         },
         {
           title: '直播间封面',
-          dataIndex: 'cover',
+          dataIndex: 'appListPicUrl',
           slots: { customRender: 'cover' },
           width: 150,
         },
         {
           title: '排序',
-          dataIndex: 'order',
+          dataIndex: 'sortOrder',
           width: 150,
           sorter: true,
         },
         {
           title: '场景链接',
-          dataIndex: 'link',
+          dataIndex: 'liveRoomUrl',
           slots: { customRender: 'link' },
           width: 180,
         },
@@ -185,6 +216,12 @@
         showIndexColumn: false,
         rowKey: 'id',
         pagination: { pageSize: 20 },
+        fetchSetting: {
+          pageField: 'page',
+          sizeField: 'limit',
+          listField: 'list',
+          totalField: 'totalCount',
+        },
         defSort: {
           field: 'order',
           order: 'asc',

+ 6 - 0
src/views/dashboard/staff/list.vue

@@ -128,6 +128,12 @@
         rowKey: 'id',
         pagination: { pageSize: 20 },
         bordered: true,
+        fetchSetting: {
+          pageField: 'pageSize',
+          sizeField: 'pageNum',
+          // listField: 'list',
+          // totalField: 'totalCount',
+        },
       });
 
       function renderRoleType(type: number): string {

+ 5 - 2
src/views/dashboard/system/dept/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <BasicTable @register="registerTable">
+    <BasicTable @register="registerTable" :searchInfo="searchInfo">
       <template #toolbar>
         <a-button type="primary" @click="handleCreate"> 新增部门 </a-button>
       </template>
@@ -27,7 +27,7 @@
   </div>
 </template>
 <script lang="ts">
-  import { defineComponent } from 'vue';
+  import { defineComponent, reactive } from 'vue';
 
   import { BasicTable, useTable, TableAction } from '/@/components/Table';
   import { getDeptList } from '/@/api/system/system';
@@ -41,6 +41,8 @@
     name: 'DeptManagement',
     components: { BasicTable, DeptModal, TableAction },
     setup() {
+      const searchInfo = reactive<Recordable>({});
+      searchInfo.name = '';
       const [registerModal, { openModal }] = useModal();
       const [registerTable, { reload }] = useTable({
         title: '部门列表',
@@ -94,6 +96,7 @@
         handleEdit,
         handleDelete,
         handleSuccess,
+        searchInfo,
       };
     },
   });

+ 7 - 4
src/views/dashboard/system/menu/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <BasicTable @register="registerTable" @fetch-success="onFetchSuccess">
+    <BasicTable @register="registerTable" @fetch-success="onFetchSuccess" :searchInfo="searchInfo">
       <template #toolbar>
         <a-button type="primary" @click="handleCreate"> 新增菜单 </a-button>
       </template>
@@ -27,7 +27,7 @@
   </div>
 </template>
 <script lang="ts">
-  import { defineComponent, nextTick } from 'vue';
+  import { defineComponent, reactive } from 'vue';
 
   import { BasicTable, useTable, TableAction } from '/@/components/Table';
   import { getMenuList } from '/@/api/system/system';
@@ -42,8 +42,10 @@
     components: { BasicTable, MenuDrawer, TableAction },
     setup() {
       // collapseAll
+      const searchInfo = reactive<Recordable>({});
+      searchInfo.order = 'asc';
       const [registerDrawer, { openDrawer }] = useDrawer();
-      const [registerTable, { reload, expandAll }] = useTable({
+      const [registerTable, { reload }] = useTable({
         title: '菜单列表',
         api: getMenuList,
         columns,
@@ -91,7 +93,7 @@
 
       function onFetchSuccess() {
         // 演示默认展开所有表项
-        nextTick(expandAll);
+        // nextTick();
       }
 
       return {
@@ -102,6 +104,7 @@
         handleDelete,
         handleSuccess,
         onFetchSuccess,
+        searchInfo,
       };
     },
   });