feat: 教育管理员订阅计划展示
This commit is contained in:
@@ -91,7 +91,7 @@
|
||||
<a-select
|
||||
v-model:value="subscriptionPlanId"
|
||||
style="width: 250px"
|
||||
:options="planOptions"
|
||||
:options="activePlanOptions"
|
||||
:field-names="{ label: 'name', value: 'id' }"
|
||||
:placeholder="$t('admin.SelectPlan')"
|
||||
></a-select>
|
||||
@@ -106,7 +106,7 @@
|
||||
<a-spin size="large" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import {
|
||||
defineComponent,
|
||||
ref,
|
||||
@@ -115,6 +115,7 @@ import {
|
||||
onMounted,
|
||||
nextTick,
|
||||
toRefs,
|
||||
computed,
|
||||
} from "vue";
|
||||
import { Https } from "@/tool/https";
|
||||
import { Modal, message } from "ant-design-vue";
|
||||
@@ -134,6 +135,13 @@ export default defineComponent({
|
||||
setup(props, { emit }) {
|
||||
const {t} = useI18n()
|
||||
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({
|
||||
operationsModal: false,
|
||||
operationsEdit: false,
|
||||
@@ -303,6 +311,7 @@ export default defineComponent({
|
||||
blur,
|
||||
setOk,
|
||||
planOptions,
|
||||
activePlanOptions
|
||||
};
|
||||
},
|
||||
data() {
|
||||
|
||||
@@ -85,11 +85,17 @@
|
||||
v-for="plan in planFilterOptions"
|
||||
:key="plan.id"
|
||||
class="plan_item"
|
||||
:class="{ active: subscriptionPlanId === plan.id }"
|
||||
@click="selectPlanFilter(plan.id)"
|
||||
:class="{
|
||||
active: subscriptionPlanId === plan.id,
|
||||
disabled: plan.status === 'PENDING'
|
||||
}"
|
||||
@click="plan.status !== 'PENDING' && selectPlanFilter(plan.id)"
|
||||
>
|
||||
<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>
|
||||
<a-table
|
||||
@@ -430,7 +436,7 @@ export default defineComponent({
|
||||
if (!orgId) return
|
||||
Https.axiosPost(Https.httpUrls.searchSubscribeByOrg, {
|
||||
organizationId: orgId,
|
||||
status: ['ACTIVE']
|
||||
status: ['ACTIVE','PENDING']
|
||||
}).then(res => {
|
||||
// 将与当前用户 subscriptionPlanId 相同的订阅计划放到第一个
|
||||
const userSubscriptionPlanId = store.state.UserHabit.userDetail.subscriptionPlanId
|
||||
@@ -698,6 +704,19 @@ export default defineComponent({
|
||||
background: #ffffff;
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user