feat: 教育管理员订阅计划展示
This commit is contained in:
@@ -91,7 +91,7 @@
|
|||||||
<a-select
|
<a-select
|
||||||
v-model:value="subscriptionPlanId"
|
v-model:value="subscriptionPlanId"
|
||||||
style="width: 250px"
|
style="width: 250px"
|
||||||
:options="planOptions"
|
:options="activePlanOptions"
|
||||||
:field-names="{ label: 'name', value: 'id' }"
|
:field-names="{ label: 'name', value: 'id' }"
|
||||||
:placeholder="$t('admin.SelectPlan')"
|
:placeholder="$t('admin.SelectPlan')"
|
||||||
></a-select>
|
></a-select>
|
||||||
@@ -106,7 +106,7 @@
|
|||||||
<a-spin size="large" />
|
<a-spin size="large" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script lang="ts">
|
||||||
import {
|
import {
|
||||||
defineComponent,
|
defineComponent,
|
||||||
ref,
|
ref,
|
||||||
@@ -115,6 +115,7 @@ import {
|
|||||||
onMounted,
|
onMounted,
|
||||||
nextTick,
|
nextTick,
|
||||||
toRefs,
|
toRefs,
|
||||||
|
computed,
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import { Https } from "@/tool/https";
|
import { Https } from "@/tool/https";
|
||||||
import { Modal, message } from "ant-design-vue";
|
import { Modal, message } from "ant-design-vue";
|
||||||
@@ -134,6 +135,13 @@ export default defineComponent({
|
|||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
const {t} = useI18n()
|
const {t} = useI18n()
|
||||||
const { planOptions } = toRefs(props)
|
const { planOptions } = toRefs(props)
|
||||||
|
// 筛选出状态为 ACTIVE 的订阅计划
|
||||||
|
const activePlanOptions = computed(() => {
|
||||||
|
if (!planOptions.value || !Array.isArray(planOptions.value)) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
return planOptions.value.filter((plan: any) => plan.status === 'ACTIVE')
|
||||||
|
})
|
||||||
let operations = reactive({
|
let operations = reactive({
|
||||||
operationsModal: false,
|
operationsModal: false,
|
||||||
operationsEdit: false,
|
operationsEdit: false,
|
||||||
@@ -303,6 +311,7 @@ export default defineComponent({
|
|||||||
blur,
|
blur,
|
||||||
setOk,
|
setOk,
|
||||||
planOptions,
|
planOptions,
|
||||||
|
activePlanOptions
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -85,11 +85,17 @@
|
|||||||
v-for="plan in planFilterOptions"
|
v-for="plan in planFilterOptions"
|
||||||
:key="plan.id"
|
:key="plan.id"
|
||||||
class="plan_item"
|
class="plan_item"
|
||||||
:class="{ active: subscriptionPlanId === plan.id }"
|
:class="{
|
||||||
@click="selectPlanFilter(plan.id)"
|
active: subscriptionPlanId === plan.id,
|
||||||
|
disabled: plan.status === 'PENDING'
|
||||||
|
}"
|
||||||
|
@click="plan.status !== 'PENDING' && selectPlanFilter(plan.id)"
|
||||||
>
|
>
|
||||||
<span class="plan_name">{{ plan.name }}</span>
|
<span class="plan_name">{{ plan.name }}</span>
|
||||||
<MoreOutlined class="plan_more_icon" @click.stop="openPlanRenameModal(plan)" />
|
<MoreOutlined
|
||||||
|
class="plan_more_icon"
|
||||||
|
@click.stop="plan.status !== 'PENDING' && openPlanRenameModal(plan)"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a-table
|
<a-table
|
||||||
@@ -430,7 +436,7 @@ export default defineComponent({
|
|||||||
if (!orgId) return
|
if (!orgId) return
|
||||||
Https.axiosPost(Https.httpUrls.searchSubscribeByOrg, {
|
Https.axiosPost(Https.httpUrls.searchSubscribeByOrg, {
|
||||||
organizationId: orgId,
|
organizationId: orgId,
|
||||||
status: ['ACTIVE']
|
status: ['ACTIVE','PENDING']
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
// 将与当前用户 subscriptionPlanId 相同的订阅计划放到第一个
|
// 将与当前用户 subscriptionPlanId 相同的订阅计划放到第一个
|
||||||
const userSubscriptionPlanId = store.state.UserHabit.userDetail.subscriptionPlanId
|
const userSubscriptionPlanId = store.state.UserHabit.userDetail.subscriptionPlanId
|
||||||
@@ -698,6 +704,19 @@ export default defineComponent({
|
|||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
background-color: #d9d9d9;
|
||||||
|
border-color: #d9d9d9;
|
||||||
|
color: #999;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #d9d9d9;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.plan_item {
|
.plan_item {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
@change="handleOrganizationChange"
|
@change="handleOrganizationChange"
|
||||||
>
|
>
|
||||||
<a-select-option value="ADD_ORGANIZATION" class="add-organization-option">
|
<a-select-option value="ADD_ORGANIZATION" class="add-organization-option">
|
||||||
+ 添加组织
|
+ Create Organization
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
<a-select-option
|
<a-select-option
|
||||||
v-for="item in organizationOptions"
|
v-for="item in organizationOptions"
|
||||||
@@ -213,7 +213,7 @@
|
|||||||
@change="handleOrganizationChange"
|
@change="handleOrganizationChange"
|
||||||
>
|
>
|
||||||
<a-select-option value="ADD_ORGANIZATION" class="add-organization-option">
|
<a-select-option value="ADD_ORGANIZATION" class="add-organization-option">
|
||||||
+ 添加组织
|
+ Create Organization
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
<a-select-option
|
<a-select-option
|
||||||
v-for="item in organizationOptions"
|
v-for="item in organizationOptions"
|
||||||
@@ -248,6 +248,7 @@
|
|||||||
v-model:value="formState.currentPeriodStart"
|
v-model:value="formState.currentPeriodStart"
|
||||||
value-format="X"
|
value-format="X"
|
||||||
style="width: 250px"
|
style="width: 250px"
|
||||||
|
:disabledDate="disabledDate"
|
||||||
class="range_picker"
|
class="range_picker"
|
||||||
placeholder="Select the start time"
|
placeholder="Select the start time"
|
||||||
>
|
>
|
||||||
@@ -373,13 +374,22 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive, ref, onMounted, onBeforeUnmount, computed, nextTick, useTemplateRef } from 'vue'
|
import {
|
||||||
|
reactive,
|
||||||
|
ref,
|
||||||
|
onMounted,
|
||||||
|
onBeforeUnmount,
|
||||||
|
computed,
|
||||||
|
nextTick,
|
||||||
|
useTemplateRef
|
||||||
|
} from 'vue'
|
||||||
import { message } from 'ant-design-vue'
|
import { message } from 'ant-design-vue'
|
||||||
import { Https } from '@/tool/https'
|
import { Https } from '@/tool/https'
|
||||||
import { formatTime } from '@/tool/util'
|
import { formatTime } from '@/tool/util'
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
import type { FormInstance, Rule } from 'ant-design-vue/es/form'
|
import type { FormInstance, Rule } from 'ant-design-vue/es/form'
|
||||||
import { debounce } from 'lodash-es'
|
import { debounce } from 'lodash-es'
|
||||||
|
import dayjs, { Dayjs } from 'dayjs'
|
||||||
|
|
||||||
type PlanStatus = 'PENDING' | 'ACTIVE' | 'EXPIRED'
|
type PlanStatus = 'PENDING' | 'ACTIVE' | 'EXPIRED'
|
||||||
interface SubscriptionPlan {
|
interface SubscriptionPlan {
|
||||||
@@ -396,6 +406,10 @@ interface SubscriptionPlan {
|
|||||||
endStamp: number
|
endStamp: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const disabledDate = (current: Dayjs) => {
|
||||||
|
return current && current < dayjs().subtract(1, 'days').endOf('day')
|
||||||
|
}
|
||||||
|
|
||||||
const searchForm = reactive({
|
const searchForm = reactive({
|
||||||
name: '',
|
name: '',
|
||||||
startTime: '',
|
startTime: '',
|
||||||
@@ -470,8 +484,8 @@ const getStatusColor = (status?: string) =>
|
|||||||
statusColorMap[normalizeStatus(status) as PlanStatus] || 'default'
|
statusColorMap[normalizeStatus(status) as PlanStatus] || 'default'
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{ title: 'Name', dataIndex: 'name', key: 'name', align: 'center',width: 180 },
|
{ title: 'Name', dataIndex: 'name', key: 'name', align: 'center', width: 180 },
|
||||||
{ title: 'ID', dataIndex: 'id', key: 'id', align: 'center' ,width: 80},
|
{ title: 'ID', dataIndex: 'id', key: 'id', align: 'center', width: 80 },
|
||||||
{
|
{
|
||||||
title: 'Organization',
|
title: 'Organization',
|
||||||
dataIndex: 'organizationName',
|
dataIndex: 'organizationName',
|
||||||
@@ -479,23 +493,35 @@ const columns = [
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
width: 180
|
width: 180
|
||||||
},
|
},
|
||||||
{ title: 'Admin Account', dataIndex: 'adminAccId', key: 'adminAccId', align: 'center' ,width: 180},
|
{
|
||||||
{ title: 'Account Num', dataIndex: 'accountNum', key: 'accountNum', align: 'center' ,width: 120},
|
title: 'Admin Account',
|
||||||
|
dataIndex: 'adminAccId',
|
||||||
|
key: 'adminAccId',
|
||||||
|
align: 'center',
|
||||||
|
width: 180
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Account Num',
|
||||||
|
dataIndex: 'accountNum',
|
||||||
|
key: 'accountNum',
|
||||||
|
align: 'center',
|
||||||
|
width: 120
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: 'Start Time',
|
title: 'Start Time',
|
||||||
dataIndex: 'currentPeriodStart',
|
dataIndex: 'currentPeriodStart',
|
||||||
key: 'currentPeriodStart',
|
key: 'currentPeriodStart',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width:200
|
width: 200
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'End Time',
|
title: 'End Time',
|
||||||
dataIndex: 'currentPeriodEnd',
|
dataIndex: 'currentPeriodEnd',
|
||||||
key: 'currentPeriodEnd',
|
key: 'currentPeriodEnd',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width:200
|
width: 200
|
||||||
},
|
},
|
||||||
{ title: 'Status', dataIndex: 'status', key: 'status', align: 'center' ,width: 100},
|
{ title: 'Status', dataIndex: 'status', key: 'status', align: 'center', width: 100 },
|
||||||
{
|
{
|
||||||
title: 'Credit Limit',
|
title: 'Credit Limit',
|
||||||
dataIndex: 'creditLimit',
|
dataIndex: 'creditLimit',
|
||||||
|
|||||||
Reference in New Issue
Block a user