feat: 教育管理员操作订阅计划& 刷新页面保持当前页面
This commit is contained in:
@@ -86,6 +86,16 @@
|
||||
style="width: 250px"
|
||||
/>
|
||||
</div>
|
||||
<div class="admin_state_item" v-if="title?.value == 'Edit'">
|
||||
<span>{{ $t('admin.SubscribePlan') }}: <span>*</span></span>
|
||||
<a-select
|
||||
v-model:value="subscriptionPlanId"
|
||||
style="width: 250px"
|
||||
:options="planOptions"
|
||||
:field-names="{ label: 'name', value: 'id' }"
|
||||
:placeholder="$t('admin.SelectPlan')"
|
||||
></a-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="allUserPoeration_btn admin_page">
|
||||
<div class="admin_search_item" @click="cancelDsign">{{ $t('admin.Close') }}</div>
|
||||
@@ -114,9 +124,16 @@ import md5 from "md5";
|
||||
import { useI18n } from 'vue-i18n'
|
||||
export default defineComponent({
|
||||
components: {},
|
||||
props: {
|
||||
planOptions: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
emits: ["searchHistoryList"],
|
||||
setup(props, { emit }) {
|
||||
const {t} = useI18n()
|
||||
const { planOptions } = toRefs(props)
|
||||
let operations = reactive({
|
||||
operationsModal: false,
|
||||
operationsEdit: false,
|
||||
@@ -130,6 +147,8 @@ export default defineComponent({
|
||||
password: "",
|
||||
oldPassword: "",
|
||||
credits: "",
|
||||
subscriptionPlanId: "",
|
||||
oldSubscriptionPlanId: ""
|
||||
});
|
||||
let state = ref([
|
||||
{
|
||||
@@ -163,12 +182,18 @@ export default defineComponent({
|
||||
// operationsData.validStartTime='2024-08-05T00:00:06'
|
||||
// operationsData.validEndTime='2024-08-05T00:00:06'
|
||||
operationsData.credits = data.creditsUsageLimit;
|
||||
operationsData.subscriptionPlanId = data.subscriptionPlanId || "";
|
||||
operationsData.oldSubscriptionPlanId = data.subscriptionPlanId || "";
|
||||
// operationsData.accountId = data.accountId
|
||||
// operationsData.userName = data.userName
|
||||
// operationsData.userEmail = data.userEmail
|
||||
// operationsData.validStartTime = formatTime(data.validStartTime)
|
||||
// operationsData.validEndTime = formatTime(data.validEndTime)
|
||||
}
|
||||
if (funStr.value == "Add") {
|
||||
operationsData.subscriptionPlanId = "";
|
||||
operationsData.oldSubscriptionPlanId = "";
|
||||
}
|
||||
};
|
||||
let focus = (event) => {
|
||||
if (operationsData.password == operationsData.oldPassword) {
|
||||
@@ -187,6 +212,7 @@ export default defineComponent({
|
||||
userEmail: operationsData.userEmail,
|
||||
userPassword: operationsData.password?md5(operationsData.password + "abc"):'',
|
||||
userName: operationsData.userName,
|
||||
subscriptionPlanId: operationsData.subscriptionPlanId
|
||||
};
|
||||
};
|
||||
let setEditData = () => {
|
||||
@@ -199,6 +225,7 @@ export default defineComponent({
|
||||
operationsData.password == operationsData.oldPassword
|
||||
? null
|
||||
: md5(operationsData.password + "abc"),
|
||||
subscriptionPlanId: operationsData.subscriptionPlanId
|
||||
};
|
||||
};
|
||||
let cancelDsign = () => {
|
||||
@@ -207,6 +234,8 @@ export default defineComponent({
|
||||
operationsData.userEmail = "";
|
||||
operationsData.password = "";
|
||||
operationsData.credits = "";
|
||||
operationsData.subscriptionPlanId = "";
|
||||
operationsData.oldSubscriptionPlanId = "";
|
||||
operations.operationsModal = false;
|
||||
};
|
||||
let setOk = () => {
|
||||
@@ -237,11 +266,26 @@ export default defineComponent({
|
||||
message.info("The email format is incorrect");
|
||||
return;
|
||||
}
|
||||
if (!data.userName || !data.userEmail)
|
||||
if (!data.userName || !data.userEmail || !data.subscriptionPlanId)
|
||||
return message.warning("Please check the input box marked with *");
|
||||
const needSwitchPlan =
|
||||
operationsData.subscriptionPlanId &&
|
||||
operationsData.subscriptionPlanId !==
|
||||
operationsData.oldSubscriptionPlanId;
|
||||
Https.axiosPost(Https.httpUrls.addOrUpdateSubAccount, data).then(
|
||||
(rv) => {
|
||||
if (rv) {
|
||||
if (needSwitchPlan) {
|
||||
Https.axiosGet(
|
||||
Https.httpUrls.switchSubAccountSubscribePlan,
|
||||
{
|
||||
params: {
|
||||
targetSubscriptionPlanId: operationsData.subscriptionPlanId,
|
||||
subAccId: operationsData.accountId,
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
cancelDsign();
|
||||
emit("searchHistoryList");
|
||||
}
|
||||
@@ -258,6 +302,7 @@ export default defineComponent({
|
||||
focus,
|
||||
blur,
|
||||
setOk,
|
||||
planOptions,
|
||||
};
|
||||
},
|
||||
data() {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user