|
@@ -1,28 +1,36 @@
|
|
|
<template>
|
|
|
<!-- 创建 -->
|
|
|
- <a-modal v-model:visible="modelValue" :title="$t('order.CardPurchase')" width="600px" @cancel="closeModal(showAudit, formState)" centered
|
|
|
- :maskClosable="false" :okText="$t('form.Confirm')" :cancelText="$t('form.Cancel')" :footer="null">
|
|
|
+ <a-modal v-model:visible="modelValue" :title="$t('order.CardPurchase')" width="600px"
|
|
|
+ @cancel="closeModal(showAudit, formState)" centered :maskClosable="false" :okText="$t('form.Confirm')"
|
|
|
+ :cancelText="$t('form.Cancel')" :footer="null">
|
|
|
<a-form ref="formRef" :rules="rules" :model="formState" @submit="submitPurchase">
|
|
|
<a-form-item field="customerName" :label="$t('lotCard.userName')">
|
|
|
<div class="audit-txt">{{ userName }}</div>
|
|
|
</a-form-item>
|
|
|
- <a-form-item :label="$t('lotCard.operator')" field="source">
|
|
|
- <a-select v-model="formState.source" :style="{ width: '380px' }" :placeholder="$t('form.datapoolForm.pleaseSelect')+$t('lotCard.operator')">
|
|
|
- <a-option v-for="item of sourceList" :value="item.value" :label="item.label" />
|
|
|
+ <a-form-item label="运营商" field="source">
|
|
|
+ <a-select v-model="formState.source" :style="{ width: '380px' }"
|
|
|
+ :placeholder="$t('form.datapoolForm.pleaseSelect') + '运营商'">
|
|
|
+ <a-option v-for="item in sourceList" :value="item.value" :label="item.label" />
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
- <a-form-item :label="$t('lotCard.TariffName')" field="tariffId">
|
|
|
- <a-select v-model="formState.trafficId" :style="{ width: '380px' }" :placeholder="$t('form.datapoolForm.pleaseSelect')+$t('lotCard.TariffName')">
|
|
|
- <a-option v-for="item of tariffData" :value="item.value" :label="item.label" />
|
|
|
+ <a-form-item label="套餐计划类型" field="isRecharge">
|
|
|
+ <a-radio-group v-model="formState.isRecharge" :options="optionsType" />
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item label="套餐计划名称" field="SimTerminalId">
|
|
|
+ <a-select v-model="formState.SimTerminalId" :style="{ width: '380px' }"
|
|
|
+ :placeholder="$t('form.datapoolForm.pleaseSelect') + '套餐计划名称'">
|
|
|
+ <a-option v-for="item in PackagePlan" :value="item.id" :label="item.label" />
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
<a-form-item :label="$t('lotCard.CardType')" field="cardType">
|
|
|
- <a-select v-model="formState.simType" :style="{ width: '380px' }" :placeholder="$t('form.datapoolForm.pleaseSelect')+$t('lotCard.CardType')">
|
|
|
+ <a-select v-model="formState.simType" :style="{ width: '380px' }"
|
|
|
+ :placeholder="$t('form.datapoolForm.pleaseSelect') + $t('lotCard.CardType')">
|
|
|
<a-option v-for="item of orderType" :value="item.value" :label="item.label" />
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
<a-form-item :label="$t('lotCard.SilentPeriod')">
|
|
|
- <a-select v-model="formState.periodOfSilence" :style="{ width: '380px' }" :placeholder="$t('form.datapoolForm.pleaseSelect')+$t('lotCard.SilentPeriod')">
|
|
|
+ <a-select v-model="formState.periodOfSilence" :style="{ width: '380px' }"
|
|
|
+ :placeholder="$t('form.datapoolForm.pleaseSelect') + $t('lotCard.SilentPeriod')">
|
|
|
<a-option v-for="item of silenceOptions" :value="item.value" :label="item.label" />
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
@@ -34,15 +42,18 @@
|
|
|
</a-radio-group>
|
|
|
</a-form-item>
|
|
|
<a-form-item :label="$t('lotCard.FlowPool')" v-if="formState.isTrafficPool == 1" field="poolId">
|
|
|
- <a-select v-model="formState.poolId" :style="{ width: '380px' }" :placeholder="$t('form.datapoolForm.pleaseSelect')+$t('lotCard.FlowPool')">
|
|
|
+ <a-select v-model="formState.poolId" :style="{ width: '380px' }"
|
|
|
+ :placeholder="$t('form.datapoolForm.pleaseSelect') + $t('lotCard.FlowPool')">
|
|
|
<a-option v-for="item of FlowPool" :value="item.id" :label="item.label" />
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
<a-form-item :label="$t('lotCard.QuantityCardsPurchased')" field="num">
|
|
|
- <a-input v-model="formState.quantity" :placeholder="$t('form.datapoolForm.pleaseSelect')+$t('lotCard.QuantityCardsPurchased')" />
|
|
|
+ <a-input v-model="formState.quantity"
|
|
|
+ :placeholder="$t('form.datapoolForm.pleaseSelect') + $t('lotCard.QuantityCardsPurchased')" />
|
|
|
</a-form-item>
|
|
|
<a-form-item>
|
|
|
- <a-button type="primary" html-type="submit" style="margin-right: 10px;">{{ $t('form.Confirm') }}</a-button>
|
|
|
+ <a-button type="primary" html-type="submit" style="margin-right: 10px;">{{ $t('form.Confirm')
|
|
|
+ }}</a-button>
|
|
|
<a-button @click="closeModal(formState)">{{ $t('form.Cancel') }}</a-button>
|
|
|
</a-form-item>
|
|
|
</a-form>
|
|
@@ -51,12 +62,12 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { ref, toRefs, defineProps, watch, toRef } from 'vue';
|
|
|
-import { tariffList, ExampleQueryTrafficPool } from "@/api/path/tariffManagement.api";
|
|
|
+import { tariffList, ExampleQueryTrafficPool, PackageSchedule } from "@/api/path/tariffManagement.api";
|
|
|
import { Getdictionary } from '@/mixins/index.js'
|
|
|
import { CardPurchase } from '@/api/path/order'
|
|
|
import { Message } from '@arco-design/web-vue';
|
|
|
-import {useI18n} from 'vue-i18n'
|
|
|
-const {t} = useI18n();
|
|
|
+import { useI18n } from 'vue-i18n'
|
|
|
+const { t } = useI18n();
|
|
|
const props = defineProps({
|
|
|
modelValue: {
|
|
|
type: Boolean,
|
|
@@ -68,17 +79,17 @@ const modelValue = toRef(props, 'modelValue')
|
|
|
const emit = defineEmits(['update:modelValue', 'submit'])
|
|
|
const state = ref({
|
|
|
userName: JSON.parse(localStorage.getItem('user_login_information'))?.username,
|
|
|
- userType: JSON.parse(localStorage.getItem('user_login_information'))?.userType, // 1平台 2用户
|
|
|
showAudit: false,
|
|
|
formRef: null,
|
|
|
formState: {
|
|
|
source: null, // 来源
|
|
|
- trafficId: "", // 资费Id
|
|
|
periodOfSilence: "", // 静默期
|
|
|
isTrafficPool: "1", // 是否是流量池 1:是 2:否
|
|
|
quantity: null, // 采购数量
|
|
|
- simType: "" ,// 卡类型
|
|
|
+ simType: "",// 卡类型
|
|
|
poolId: null,
|
|
|
+ isRecharge: '1',
|
|
|
+ SimTerminalId: null
|
|
|
},
|
|
|
sourceList: [],
|
|
|
silenceOptions: [], // 沉默期
|
|
@@ -86,13 +97,15 @@ const state = ref({
|
|
|
flowPoolData: [], // 组池
|
|
|
tariffData: [],
|
|
|
FlowPool: [], // 流量池
|
|
|
+ optionsType: [],
|
|
|
+ PackagePlan: []
|
|
|
})
|
|
|
|
|
|
-const { showAudit, formState, sourceList, silenceOptions, orderType, flowPoolData, userName, userType, tariffData, formRef, FlowPool } = toRefs(state.value)
|
|
|
+const { showAudit, formState, sourceList, silenceOptions, orderType, flowPoolData, userName, optionsType, tariffData, formRef, FlowPool, PackagePlan } = toRefs(state.value)
|
|
|
|
|
|
const rules = {
|
|
|
source: [{ required: true, trigger: 'change', }],
|
|
|
- trafficId: [
|
|
|
+ SimTerminalId: [
|
|
|
{
|
|
|
required: true,
|
|
|
trigger: 'change',
|
|
@@ -128,33 +141,26 @@ const rules = {
|
|
|
trigger: 'change',
|
|
|
},
|
|
|
],
|
|
|
+ source: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ trigger: 'change',
|
|
|
+ },
|
|
|
+ ],
|
|
|
};
|
|
|
|
|
|
const handleDictValue = async () => {
|
|
|
- // 使用 Promise.all 并行获取字典数据
|
|
|
- const [sourceRes, cardTypeRes, silenceOfRes, groupPoolRes] = await Promise.all([
|
|
|
- Getdictionary('source'),
|
|
|
- Getdictionary('cardType'),
|
|
|
- Getdictionary('silenceOf'),
|
|
|
- Getdictionary('groupPool')
|
|
|
- ]);
|
|
|
+
|
|
|
+ const dict = await Getdictionary(['source', 'cardType', 'silenceOf', 'groupPool', 'setMeal'])
|
|
|
|
|
|
// 分别将返回的数据保存到响应的 ref 变量中
|
|
|
- sourceList.value = sourceRes;
|
|
|
- orderType.value = cardTypeRes;
|
|
|
- silenceOptions.value = silenceOfRes;
|
|
|
- flowPoolData.value = groupPoolRes;
|
|
|
- const param = {
|
|
|
- current: 1,
|
|
|
- size: 999,
|
|
|
- }
|
|
|
- tariffList(param).then(res => {
|
|
|
- tariffData.value = res.data.records.map(item => ({
|
|
|
- label: item.label,
|
|
|
- value: item.id,
|
|
|
- ...item
|
|
|
- }));
|
|
|
- })
|
|
|
+ sourceList.value = dict[0];
|
|
|
+ orderType.value = dict[1];
|
|
|
+ silenceOptions.value = dict[2];
|
|
|
+ flowPoolData.value = dict[3];
|
|
|
+ optionsType.value = dict[4];
|
|
|
+ getList(formState.value.isRecharge)
|
|
|
+
|
|
|
}
|
|
|
// 确认购卡
|
|
|
const submitPurchase = ({ values, errors }) => {
|
|
@@ -162,17 +168,18 @@ const submitPurchase = ({ values, errors }) => {
|
|
|
if (!errors) {
|
|
|
const data = {
|
|
|
source: String(formState.value.source),
|
|
|
- trafficId: formState.value.trafficId,
|
|
|
+ SimTerminalId: formState.value.SimTerminalId,
|
|
|
quantity: Number(formState.value.quantity),
|
|
|
simType: formState.value.simType,
|
|
|
periodOfSilence: String(formState.value.periodOfSilence),
|
|
|
isTrafficPool: formState.value.isTrafficPool,
|
|
|
poolId: formState.value.poolId,
|
|
|
+ isRecharge: Number(formState.value.isRecharge)
|
|
|
}
|
|
|
CardPurchase(data).then(res => {
|
|
|
Message.success(res.message)
|
|
|
- emit('update:modelValue', false)
|
|
|
emit('submit', true)
|
|
|
+ closeModal()
|
|
|
})
|
|
|
}
|
|
|
})
|
|
@@ -183,7 +190,23 @@ const closeModal = (val) => {
|
|
|
Object.keys(formState.value).forEach(key => {
|
|
|
formState.value[key] = ''
|
|
|
})
|
|
|
+ formState.value.isRecharge = '1'
|
|
|
+ formState.value.isTrafficPool = '1'
|
|
|
+}
|
|
|
+
|
|
|
+// 套餐计划
|
|
|
+const getList = async (val) => {
|
|
|
+ const param = {
|
|
|
+ current: 1,
|
|
|
+ size: 999,
|
|
|
+ isRecharge: Number(val)
|
|
|
+ }
|
|
|
+ let res = await PackageSchedule(param)
|
|
|
+ if (res.code === 200) {
|
|
|
+ PackagePlan.value = res.data.records;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
// 流量池
|
|
|
watch(() => formState.value?.isTrafficPool, val => {
|
|
|
if (val == 1) {
|
|
@@ -191,11 +214,15 @@ watch(() => formState.value?.isTrafficPool, val => {
|
|
|
FlowPool.value = res.data
|
|
|
})
|
|
|
}
|
|
|
-},{immediate:true})
|
|
|
+}, { immediate: true })
|
|
|
watch(() => modelValue.value, val => {
|
|
|
if (val) {
|
|
|
handleDictValue()
|
|
|
}
|
|
|
})
|
|
|
+watch(() => formState.value.isRecharge, async val => {
|
|
|
+ formState.value.SimTerminalId = null
|
|
|
+ getList(val)
|
|
|
+}, { deep: true })
|
|
|
</script>
|
|
|
-<style scoped></style>
|
|
|
+<style scoped></style>
|