tangning 1 год назад
Родитель
Сommit
14018c7d7e

+ 59 - 62
src/api/account/index.ts

@@ -1,8 +1,5 @@
 import { defHttp } from '/@/utils/http/axios';
-import {
-  PageParams,
-  userList,
-} from './model';
+import { PageParams, userList } from './model';
 import { Result } from '/#/axios';
 
 enum Api {
@@ -12,7 +9,7 @@ enum Api {
   addUserIncrement = '/service/manage/user/addUserIncrement',
   addDownNum = '/service/manage/user/addDownNum',
   getCameraDetail = '/service/manage/user/getCameraDetail',
-  unbindCamera = '/service/manage/user/unbindCamera',
+  unbindCamera = '/service/agent/camera/unBindCamera',
   allList = '/service/manage/incrementType/allList',
 }
 
@@ -33,78 +30,78 @@ export const ListApi = (params: PageParams) =>
 
 //权益详情
 export const DetailsApi = (params: PageParams) =>
-defHttp.post<userList>({
-  url: Api.getIncrementListByUserId,
-  params: params,
-  // data: params,
-  headers: {
-    // @ts-ignore
-    ignoreCancelToken: true,
-  },
-});
+  defHttp.post<userList>({
+    url: Api.getIncrementListByUserId,
+    params: params,
+    // data: params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });
 
 //权益延期
 export const IncrementDelayApi = (params: PageParams) =>
-defHttp.post<userList>({
-  url: Api.IncrementDelay,
-  params: params,
-  headers: {
-    // @ts-ignore
-    ignoreCancelToken: true,
-  },
-});
+  defHttp.post<userList>({
+    url: Api.IncrementDelay,
+    params: params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });
 
 //权益延期
 export const dincrementList = (params: PageParams) =>
-defHttp.get<userList>({
-  url: Api.allList,
-  params: params,
-  headers: {
-    // @ts-ignore
-    ignoreCancelToken: true,
-  },
-});
+  defHttp.get<userList>({
+    url: Api.allList,
+    params: params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });
 
 //添加用户权益
 export const AddUserIncrementApi = (params: PageParams) =>
-defHttp.post<userList>({
-  url: Api.addUserIncrement,
-  params: params,
-  headers: {
-    // @ts-ignore
-    ignoreCancelToken: true,
-  },
-});
+  defHttp.post<userList>({
+    url: Api.addUserIncrement,
+    params: params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });
 
 //加用户下载次数
 export const AddDownNumApi = (params: PageParams) =>
-defHttp.post<userList>({
-  url: Api.addDownNum,
-  params: params,
-  headers: {
-    // @ts-ignore
-    ignoreCancelToken: true,
-  },
-});
+  defHttp.post<userList>({
+    url: Api.addDownNum,
+    params: params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });
 
 //获取相机详情
 export const GetCameraDetailApi = (params: PageParams) =>
-defHttp.post<userList>({
-  url: Api.getCameraDetail,
-  params: params,
-  headers: {
-    // @ts-ignore
-    ignoreCancelToken: true,
-  },
-});
+  defHttp.post<userList>({
+    url: Api.getCameraDetail,
+    params: params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });
 
 //相机解绑
 export const UnbindCameraApi = (params: PageParams) =>
-defHttp.get<userList>({
-  url: Api.unbindCamera,
-  params: params,
-  headers: {
-    // @ts-ignore
-    ignoreCancelToken: true,
-  },
-});
+  defHttp.post<userList>({
+    url: Api.unbindCamera,
+    params: params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });

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

@@ -23,4 +23,5 @@ export default {
   reminder: 'reminder',
   operating: 'Operation',
   uploadMessge: 'Please select the upload file',
+  optSuccess: 'The operation was successful.',
 };

+ 1 - 1
src/locales/lang/en/routes/equity.ts

@@ -38,7 +38,7 @@ export default {
   CardMajorNum: "Last Month's Premium Membership Sales (Yearly)",
   CardHighNum: "Last Month's Senior Membership Sales (Monthly)",
   CardDownNum: "Last Month's Download Sales",
-  syks: 'Available for sale',
+  syks: 'surplus',
   addcount: ' Quantity',
   rules: {
     userName: 'Please enter the user account',

+ 5 - 0
src/locales/lang/en/routes/retailer.ts

@@ -12,12 +12,16 @@ export default {
   highAddNum: 'Senior Membership (Monthly):  {value} months available for sale,  newly added:',
   downAddNum: 'Project Downloads (Times):  {value} times available for sale, newly added:',
   ff: 'Distribute',
+  Unbind: 'Unbind',
+  UnbindTips: 'Are you sure you want to unbind it?',
   allff: 'Device Bulk Distribution',
   majorTotalNum: 'Remaining Years of Premium Membership',
   highTotalNum: 'Remaining Months of Senior Membership',
   downTotalNum: 'Remaining Project Downloads',
   createName: 'Creator',
   createTime: 'Create Time',
+  addjxs: 'Add Dealer',
+  editjxs: 'Edit Dealer',
   form: {
     name: 'Distributor Name',
     nickName: 'Contact',
@@ -26,6 +30,7 @@ export default {
     tips: 'This account does not exist',
     enable: 'Enable',
     stopUsing: 'Deactivate',
+    dqname: 'Reseller',
     d1name: 'Distributor Name',
   },
   exportText: 'Successfully imported {value} pieces of data',

+ 4 - 0
src/locales/lang/zh-CN/routes/retailer.ts

@@ -12,12 +12,16 @@ export default {
   highAddNum: '高级会员(月):剩余可售 {value} 月,本次新增 (月数)',
   downAddNum: '场景下载(次):剩余可售 {value} 次,本次新增 (次数)',
   ff: '分发',
+  Unbind: '解绑',
+  UnbindTips: '确定解绑吗?',
   allff: '设备批量分发',
   majorTotalNum: '剩余专业会员年数',
   highTotalNum: '剩余高级会员月数',
   downTotalNum: '剩余场景下载次数',
   createName: '创建人',
   createTime: '创建时间',
+  addjxs: '新增经销商',
+  editjxs: '编辑经销商',
   form: {
     name: '分销商名称',
     nickName: '联系人',

+ 25 - 10
src/views/device/index.vue

@@ -3,7 +3,7 @@
     <div class="desc-wrap-BasicTable">
       <BasicTable @register="registerTable">
         <template #toolbar>
-          <a-button type="primary" @click="handleAdd"> {{t('routes.retailer.allff')}}</a-button>
+          <a-button type="primary" v-if="hasPermission([RoleEnum.SUPER])" @click="handleAdd"> {{t('routes.retailer.allff')}}</a-button>
         </template>
         <template #action="{ record }">
           <TableAction
@@ -11,9 +11,16 @@
             :actions="[
               {
                 label: t('routes.retailer.ff'),
+                ifShow: !record.subAgentName,
                 //icon: 'la:file-invoice-dollar',
                 onClick: headleDetails.bind(null, record),
               },
+              {
+                label: t('routes.retailer.Unbind'),
+                ifShow: !!record.subAgentName,
+                //icon: 'la:file-invoice-dollar',
+                onClick: headleUnbind.bind(null, record),
+              },
             ]"
           />
         </template>
@@ -32,6 +39,8 @@
     TableImg,
     FormProps,
   } from '/@/components/Table';
+  import { usePermission } from '/@/hooks/web/usePermission';
+  import { RoleEnum } from '/@/enums/roleEnum';
   import { PageWrapper } from '/@/components/Page';
   import { Descriptions } from 'ant-design-vue';
   import { useI18n } from '/@/hooks/web/useI18n';
@@ -61,7 +70,7 @@
       const { t } = useI18n();
       const userStore = useUserStore();
       const getUserInfo = userStore.getUserInfo;
-      console.log('getUserInfo', getUserInfo);
+      const { hasPermission } = usePermission();
       const { createMessage, createConfirm } = useMessage();
       const permissionStore = usePermissionStore();
       const { getCheckPerm } = permissionStore;
@@ -110,7 +119,9 @@
         {
           title: t('routes.retailer.fxs'),
           dataIndex: 'subAgentName',
-          width: 120,
+          ellipsis: true,
+          width: 160,
+          ifShow: hasPermission([RoleEnum.SUPER]),
           customRender({ record }) {
             return record.subAgentName || '-';
           }
@@ -286,6 +297,7 @@
           {
             field: 'subAgentId',
             component: 'ApiSelect',
+            ifShow: hasPermission([RoleEnum.SUPER]),
             label: t('routes.device.subAgentName'),
             componentProps: {
               maxLength: 50,
@@ -325,20 +337,21 @@
           totalField: 'total',
         },
         actionColumn: {
-          width: 100,
+          width: 150,
           title: t('common.operating'),
+          ifShow: hasPermission([RoleEnum.SUPER]),
           dataIndex: 'action',
           slots: { customRender: 'action' },
         },
         canResize: false,
       });
-      async function handleUnbind(record: Recordable) {
+      async function headleUnbind(record: Recordable) {
         createConfirm({
           iconType: 'warning',
-          title: () => h('span', t('common.optSuccess')),
-          content: '解绑后用户将看不到该相机拍摄的场景。<br/>确定解绑吗?',
+          title: () => h('span', t('common.reminder')),
+          content: t('routes.retailer.UnbindTips'),
           onOk: async () => {
-            await UnbindCameraApi({ cameraId: record.id });
+            await UnbindCameraApi({ id: record.id });
             createMessage.success(t('common.optSuccess'));
             reload();
           },
@@ -347,7 +360,7 @@
       async function handleDelete(record: Recordable) {
         createConfirm({
           iconType: 'warning',
-          title: () => h('span', t('common.optSuccess')),
+          title: () => h('span', t('common.reminder')),
           content: '删除设备后需要重新入库<br/>确定删除吗?',
           onOk: async () => {
             await cameraDelete({ id: record.id });
@@ -364,13 +377,15 @@
       }
       return {
         registerTable,
-        handleUnbind,
+        headleUnbind,
         reload,
         handleDelete,
         getCheckPerm,
         handleAdd,
         headleDetails,
         registerAddModal,
+        hasPermission,
+        RoleEnum,
         t,
       };
     },

+ 2 - 1
src/views/equity/EditModal.vue

@@ -4,6 +4,7 @@
     @register="register"
     :title="t('routes.equity.renew')"
     height="500"
+    width="600"
     @visible-change="handleVisibleChange"
     @cancel="resetFields"
     @ok="handleSubmit"
@@ -98,7 +99,7 @@
             },
           },
           colProps: {
-            span: 19,
+            span: 18,
           },
         },
         {

+ 1 - 1
src/views/retailer/AddModal.vue

@@ -193,7 +193,7 @@
       function onDataReceive(data) {
         modelRef.value = data
         console.log('renderOwnTypeLabel',data)
-        fileFlow.title = data.id?'编辑分销商':'新增分销商';
+        fileFlow.title = data.id?t('routes.retailer.editjxs'):('routes.retailer.addjxs');
         resetFields();
         updateSchema({
           field: 'userName',