123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- <template>
- <div>
- <AddModal @register="registerAddModal" />
- <BasicModal
- v-bind="$attrs"
- @register="register"
- title="权益详情"
- :width="900"
- @visible-change="handleVisibleChange"
- @ok="handleSubmit"
- >
- <div class="pt-3px pr-3px">
- <div class="table_list">
- <BasicTable @register="registerSubtable" >
- <template #action="{ record }">
- <TableAction
- :actions="[
- {
- label: '续费',
- onClick: handleDelete.bind(null, record, 'edit'),
- },
- ]"
- />
- </template>
- </BasicTable>
- </div>
- </div>
- </BasicModal>
- </div>
- </template>
- <script lang="ts">
- 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 { 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 { usePermissionStore } from '/@/store/modules/permission';
- import { useModal } from '/@/components/Modal';
- const { t } = useI18n();
- export default defineComponent({
- components: { BasicModal, BasicForm, BasicTable,TableAction, AddModal },
- props: {
- userData: { type: Object },
- },
- emits: ['update', 'register'],
- setup(props, { emit }) {
- const otherInfo = otherInfoStore();
- const overviewInfo = computed(() => otherInfo.getOverviewInfo);
- const { createMessage, createConfirm } = useMessage();
- const [registerAddModal, { openModal: openAddModal }] = useModal();
- const permissionStore = usePermissionStore();
- const { getCheckPerm } = permissionStore;
- console.log('overviewInfo',overviewInfo)
- // const overviewInfo = getOverviewInfo() || {}
- const fileFlow = reactive({
- 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;
- },
- },
- {
- title: '权益类型',
- width: 100,
- dataIndex: 'memberLevels',
- customRender: ({ record }) => {
- let obj = {
- 'PR': '专业会员',
- 'SE': '高级会员',
- }
- return obj[record.memberLevels] || '';
- },
- },
- {
- title: '使用类型',
- width: 100,
- dataIndex: 'useTypeStr',
- },
- {
- title: '授权相机S/N吗',
- width: 160,
- dataIndex: 'snCode',
- },
- {
- title: '购买日期',
- dataIndex: 'incrementStartTime',
- width: 120,
- customRender: ({ record }) => {
- return record.incrementStartTime
- ? h(Time, {
- value: record.incrementStartTime,
- mode: 'date',
- })
- : '-';
- },
- },
- {
- title: '到期日期',
- dataIndex: 'incrementEndTime',
- width: 120,
- customRender: ({ record }) => {
- return record.incrementEndTime
- ? h(Time, {
- value: record.incrementEndTime,
- mode: 'date',
- })
- : '-';
- },
- },
- {
- title: '项目号',
- width: 100,
- dataIndex: 'projectNum',
- },
- {
- title: '备注',
- width: 100,
- dataIndex: 'remark',
- },
- {
- title: t('common.operating'),
- ifShow:getCheckPerm('account-equityRenew'),
- dataIndex: '',
- slots: { customRender: 'action' },
- width: 60,
- },
- ];
- const [
- registerSubtable,
- {
- reload,
- },
- ] = useTable({
- // title: `查看相机详情`,
- searchInfo:{
- id:overviewInfo.value?.id
- },
- api: DetailsApi,
- rowKey: 'id',
- fetchSetting: {
- pageField: 'pageNum',
- sizeField: 'pageSize',
- listField: 'list',
- totalField: 'total',
- },
- columns: columns,
- showIndexColumn: false,
- bordered: true,
- canResize: true,
- // pagination: false,
- });
- onMounted(() => {});
- let addListFunc = () => {};
- const [register, { closeModal }] = useModalInner((data) => {
- reload()
- data && onDataReceive(data);
- });
- function onDataReceive(data) {
- console.log('onDataReceive',data)
- fileFlow.id = data.id
- }
- async function handleDelete (record: Recordable) {
- openAddModal(true, {
- userId: overviewInfo.value && overviewInfo.value.id,
- ...record,
- });
- // createConfirm({
- // iconType: 'warning',
- // title: () => h('span', '续费提示'),
- // content: () => h('span', `您确定给权益ID${record.id}续期${record.validTimeType == 1?'1月':'1年'}!`),
- // onOk: async () => {
- // await await IncrementDelayApi({id:record.id,year:1})
- // createMessage.success(t('common.optSuccess'));
- // otherInfo.updateOverviewInfo()
- // reload()
- // },
- // });
- }
- const handleSubmit = async () => {
- closeModal();
- emit('update');
- };
- function handleVisibleChange(v) {
- v && props.userData && nextTick(() => onDataReceive(props.userData));
- }
- return {
- register,
- fileFlow,
- handleVisibleChange,
- handleSubmit,
- addListFunc,
- registerSubtable,
- reload,
- registerAddModal,
- handleDelete,
- t,
- };
- },
- });
- </script>
|