Sfoglia il codice sorgente

购卡订单增加套餐计划 去掉资费id

吴sir 2 mesi fa
parent
commit
3eed2da2d3

+ 74 - 47
src/views/order/BuyCard/Card.vue

@@ -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>

+ 5 - 3
src/views/order/BuyCard/detaile.vue

@@ -20,8 +20,8 @@
                     <div class="item-content">{{ FormDataList.sourceName }}</div>
                 </div>
                 <div class="detail-item">
-                    <div class="item-label">{{ $t('order.TariffName') }}</div>
-                    <div class="item-content">{{ tariffForm.label }}</div>
+                    <div class="item-label">套餐计划名称</div>
+                    <div class="item-content">{{ tariffForm.terminalName }}</div>
                 </div>
             </div>
             <div class="detail-item-box">
@@ -195,7 +195,9 @@ const handleProgressResponse = (progressRes) => {
         if (progressRes.data === 100) {
             clearInterval(timer);
             getICCIDDetaile();
-        } else {
+        } else if(progressRes.data==0){
+            clearInterval(timer);
+        }else{
             startProgressMonitor(progressRes.data);
         }
     }

+ 10 - 6
src/views/order/BuyCard/index.vue

@@ -150,7 +150,8 @@ const state = ref({
     endDate: ''
   },
   orderTypeStatus: [],
-  CardType:[]
+  CardType: [],
+  PackagePlanType: []
 });
 
 const {
@@ -169,7 +170,8 @@ const {
   showEndDate,
   formEndDate,
   CardType,
-  orderTypeStatus
+  orderTypeStatus,
+  PackagePlanType
 } = toRefs(state.value);
 
 const processData = async (data) => {
@@ -179,7 +181,8 @@ const processData = async (data) => {
       ...item,
       index: key + 1,
       sourceName: item.source,
-      cardType: filterDict(CardType.value, item.simType)
+      cardType: filterDict(CardType.value, item.simType),
+      type: filterDict(PackagePlanType.value, item.isRecharge)
     }
   })
 }
@@ -270,10 +273,11 @@ const handelEndDate = async () => {
 }
 
 onMounted(async () => {
-  let dict = await Getdictionary(['cardType', 'orderType'])
-  orderTypeStatus.value = dict[1]
+  let dict = await Getdictionary(['cardType', 'orderType', 'setMeal'])
   CardType.value = dict[0]
-  initData();
+  orderTypeStatus.value = dict[1]
+  PackagePlanType.value = dict[2]
+  await initData();
 })
 </script>
 

+ 2 - 1
src/views/order/config.js

@@ -74,7 +74,8 @@ export const BuyOrdercolumns = [
   { title:  window.$t('order.SilentPeriod') + ( window.$t('lotCard.month')), dataIndex: 'periodOfSilence', align: 'center', ellipsis: true },
   { title:  window.$t('order.CardType'), dataIndex: 'cardType', align: 'center', ellipsis: true },
   { title:  window.$t('order.CarrierName'), dataIndex: 'sourceName', align: 'center', ellipsis: true },
-  { title:  window.$t('order.tariff'), dataIndex: 'trafficName', align: 'center', ellipsis: true },
+  { title:  '套餐计划名称', dataIndex: 'terminalName', align: 'center', ellipsis: true },
+  { title:  '套餐计划类型', dataIndex: 'type', align: 'center', ellipsis: true },
   { title:  window.$t('order.PurchaseAmount'), dataIndex: 'amount', align: 'center', ellipsis: true },
   { title:  window.$t('order.ContractPhoto'), slotName: 'image', align: 'center', ellipsis: true },
   { title:  window.$t('order.OrderTime'), dataIndex: 'createdAt', align: 'center', ellipsis: true },

+ 1 - 1
src/views/tariffManagement/SetMeal/index.vue

@@ -105,7 +105,7 @@ const state = ref({
   Form: {
     userId: null,
     label: null,
-    isRecharge: null,
+    isRecharge: '1',
     defaultTrafficId: null
   },
   userList: [],

+ 1 - 1
src/views/tariffManagement/config.js

@@ -343,7 +343,7 @@ export const columnsSetMeal = [
     ellipsis: true,
   },
   {
-    title: "绑定资费",
+    title: "默认绑定资费",
     dataIndex: "defaultTrafficName",
     align: "center",
     ellipsis: true,