|
@@ -1,7 +1,8 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <AddModal @register="registerAddModal" @update="reload" />
|
|
|
- <BasicModal
|
|
|
+ <AddModal @register="registerAddModal" @update="reload" />
|
|
|
+ <AddSnModal @register="registerAddSnModal" @update="reload" />
|
|
|
+ <BasicModal
|
|
|
v-bind="$attrs"
|
|
|
@register="register"
|
|
|
title="权益详情"
|
|
@@ -11,7 +12,7 @@
|
|
|
>
|
|
|
<div class="pt-3px pr-3px">
|
|
|
<div class="table_list">
|
|
|
- <BasicTable @register="registerSubtable" >
|
|
|
+ <BasicTable @register="registerSubtable">
|
|
|
<template #action="{ record }">
|
|
|
<TableAction
|
|
|
:actions="[
|
|
@@ -19,6 +20,10 @@
|
|
|
label: '续费',
|
|
|
onClick: handleDelete.bind(null, record, 'edit'),
|
|
|
},
|
|
|
+ {
|
|
|
+ label: record.snCode ? '解除' : '授权',
|
|
|
+ onClick: handleSnCode.bind(null, record, 'edit'),
|
|
|
+ },
|
|
|
]"
|
|
|
/>
|
|
|
</template>
|
|
@@ -29,23 +34,24 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
- import { defineComponent, nextTick, onMounted, reactive, computed,h } from 'vue';
|
|
|
- import { BasicTable, useTable, BasicColumn,TableAction } from '/@/components/Table';
|
|
|
+ import { defineComponent, nextTick, onMounted, reactive, computed, h } from 'vue';
|
|
|
+ import { BasicTable, useTable, BasicColumn, TableAction } from '/@/components/Table';
|
|
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
|
|
import { BasicForm } from '/@/components/Form/index';
|
|
|
import { Time } from '/@/components/Time';
|
|
|
import AddModal from './AddModal.vue';
|
|
|
+ import AddSnModal from './AddSnModal.vue';
|
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
- import { GetCameraDetailApi,UnbindCameraApi } from '/@/api/account';
|
|
|
- import { otherInfoStore } from '/@/store/modules/other'
|
|
|
- import { DetailsApi,IncrementDelayApi } from '/@/api/account';
|
|
|
+ import { GetCameraDetailApi, UnbindCameraApi, incrementUnBindCamera} from '/@/api/account';
|
|
|
+ import { otherInfoStore } from '/@/store/modules/other';
|
|
|
+ import { DetailsApi, IncrementDelayApi } from '/@/api/account';
|
|
|
import { usePermissionStore } from '/@/store/modules/permission';
|
|
|
import { useModal } from '/@/components/Modal';
|
|
|
|
|
|
const { t } = useI18n();
|
|
|
export default defineComponent({
|
|
|
- components: { BasicModal, BasicForm, BasicTable,TableAction, AddModal },
|
|
|
+ components: { BasicModal, BasicForm, AddSnModal, BasicTable, TableAction, AddModal },
|
|
|
props: {
|
|
|
userData: { type: Object },
|
|
|
},
|
|
@@ -55,22 +61,23 @@
|
|
|
const overviewInfo = computed(() => otherInfo.getOverviewInfo);
|
|
|
const { createMessage, createConfirm } = useMessage();
|
|
|
const [registerAddModal, { openModal: openAddModal }] = useModal();
|
|
|
+ const [registerAddSnModal, { openModal: openAddSnModal }] = useModal();
|
|
|
const permissionStore = usePermissionStore();
|
|
|
const { getCheckPerm } = permissionStore;
|
|
|
- console.log('overviewInfo',overviewInfo)
|
|
|
+ console.log('overviewInfo', overviewInfo);
|
|
|
// const overviewInfo = getOverviewInfo() || {}
|
|
|
const fileFlow = reactive({
|
|
|
- file:null,
|
|
|
- id:'',
|
|
|
- type:'down',//down-下载,equity-权益
|
|
|
- })
|
|
|
- const columns: BasicColumn[] = [
|
|
|
+ file: null,
|
|
|
+ id: '',
|
|
|
+ type: 'down', //down-下载,equity-权益
|
|
|
+ });
|
|
|
+ const columns: BasicColumn[] = [
|
|
|
{
|
|
|
title: '会员权益ID',
|
|
|
dataIndex: 'id',
|
|
|
width: 100,
|
|
|
customRender: ({ record }) => {
|
|
|
- return record.memberLevels? (record.memberLevels +' '+ record.id): record.id;
|
|
|
+ return record.memberLevels ? record.memberLevels + ' ' + record.id : record.id;
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -79,9 +86,9 @@
|
|
|
dataIndex: 'memberLevels',
|
|
|
customRender: ({ record }) => {
|
|
|
let obj = {
|
|
|
- 'PR': '专业会员',
|
|
|
- 'SE': '高级会员',
|
|
|
- }
|
|
|
+ PR: '专业会员',
|
|
|
+ SE: '高级会员',
|
|
|
+ };
|
|
|
return obj[record.memberLevels] || '';
|
|
|
},
|
|
|
},
|
|
@@ -133,23 +140,18 @@
|
|
|
// },
|
|
|
{
|
|
|
title: t('common.operating'),
|
|
|
- ifShow:getCheckPerm('account-equityRenew'),
|
|
|
+ ifShow: getCheckPerm('account-equityRenew'),
|
|
|
dataIndex: '',
|
|
|
slots: { customRender: 'action' },
|
|
|
- width: 60,
|
|
|
+ width: 100,
|
|
|
},
|
|
|
];
|
|
|
- const [
|
|
|
- registerSubtable,
|
|
|
- {
|
|
|
- reload,
|
|
|
- },
|
|
|
- ] = useTable({
|
|
|
+ const [registerSubtable, { reload }] = useTable({
|
|
|
// title: `查看相机详情`,
|
|
|
- searchInfo:{
|
|
|
- id:overviewInfo.value?.id
|
|
|
+ searchInfo: {
|
|
|
+ id: overviewInfo.value?.id,
|
|
|
},
|
|
|
- api: DetailsApi,
|
|
|
+ api: DetailsApi,
|
|
|
rowKey: 'id',
|
|
|
fetchSetting: {
|
|
|
pageField: 'pageNum',
|
|
@@ -167,22 +169,38 @@
|
|
|
onMounted(() => {});
|
|
|
let addListFunc = () => {};
|
|
|
const [register, { closeModal }] = useModalInner((data) => {
|
|
|
- reload()
|
|
|
+ reload();
|
|
|
data && onDataReceive(data);
|
|
|
});
|
|
|
function onDataReceive(data) {
|
|
|
- console.log('onDataReceive',data)
|
|
|
- fileFlow.id = data.id
|
|
|
+ console.log('onDataReceive', data);
|
|
|
+ fileFlow.id = data.id;
|
|
|
+ }
|
|
|
+ function handleSnCode(record) {
|
|
|
+ if (record.snCode) {
|
|
|
+ createConfirm({
|
|
|
+ title: '删除',
|
|
|
+ content: '确定要解除该相机的权益吗?',
|
|
|
+ onOk: async () => {
|
|
|
+ incrementUnBindCamera({ snCode: record.snCode, incrementId: record.id }).then(() => {
|
|
|
+ createMessage.success('操作成功');
|
|
|
+ reload();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ openAddSnModal(true, record);
|
|
|
+ }
|
|
|
}
|
|
|
- async function handleDelete (record: Recordable) {
|
|
|
+ async function handleDelete(record: Recordable) {
|
|
|
openAddModal(true, {
|
|
|
userId: overviewInfo.value && overviewInfo.value.id,
|
|
|
...record,
|
|
|
});
|
|
|
}
|
|
|
const handleSubmit = async () => {
|
|
|
- closeModal();
|
|
|
- emit('update');
|
|
|
+ closeModal();
|
|
|
+ emit('update');
|
|
|
};
|
|
|
function handleVisibleChange(v) {
|
|
|
v && props.userData && nextTick(() => onDataReceive(props.userData));
|
|
@@ -196,7 +214,9 @@
|
|
|
registerSubtable,
|
|
|
reload,
|
|
|
registerAddModal,
|
|
|
+ registerAddSnModal,
|
|
|
handleDelete,
|
|
|
+ handleSnCode,
|
|
|
t,
|
|
|
};
|
|
|
},
|