Procházet zdrojové kódy

修改购卡订单

吴sir před 2 měsíci
rodič
revize
eef6f91847

+ 8 - 2
src/views/lotCard/cardList/config.js

@@ -68,8 +68,14 @@ export const columns = [
     ellipsis: true,
   },
   {
-    title: window.$t("lotCard.CardPackage"),
-    dataIndex: "tariffName",
+    title: '套餐计划名称',
+    dataIndex: "simTerminalName",
+    align: "center",
+    ellipsis: true,
+  },
+  {
+    title: '套餐计划类型',
+    dataIndex: "type",
     align: "center",
     ellipsis: true,
   },

+ 6 - 4
src/views/lotCard/cardList/index.vue

@@ -45,7 +45,7 @@ import { onMounted, ref, getCurrentInstance, h } from "vue";
 import { columns, SearchForm } from "./config";
 import { cardInfoList, syncFlowData } from "@/api/path/lotCard.api"
 import trafficUseDialog from "./trafficUseDialog.vue";
-import { Getdictionary, tableFunction } from '@/mixins/index.js'
+import { Getdictionary, tableFunction ,filterDict} from '@/mixins/index.js'
 import { sanitizeObject } from '@/utils/utils'
 import Add from './add.vue'
 import Search from '@/components/Search/index.vue'
@@ -65,7 +65,7 @@ const userType = ref(JSON.parse(localStorage.getItem('user_login_information'))?
 const showAdd = ref(false)
 const loading = ref(false)
 const trafficUseDialogRef = ref()
-
+const setMealList = ref([])
 
 const processData = (data) => {
   return (data.records || []).map((item, index) => {
@@ -79,7 +79,8 @@ const processData = (data) => {
       dataUsage: item.dataPackage[0]?.dataUsage ? item.dataPackage[0]?.dataUsage + '/MB' : '0' + '/MB',
       dataTotal: item.dataPackage[0]?.dataTotal ? item.dataPackage[0]?.dataTotal + '/MB' : '0' + '/MB',
       dataUsageTotal: item.dataUsageTotal ? item.dataUsageTotal + '/MB' : '---',
-      productName: item.dataPackage[0]?.productName
+      productName: item.dataPackage[0]?.productName,
+      type: filterDict(serviceList.value, item.isRecharge)
     }
   })
 }
@@ -100,9 +101,10 @@ const pagesChange = (size) => {
 
 // 获取字典
 const handleDictValue = async () => {
-  let dict = await Getdictionary(['mainCardStatus', 'activationPackageMethod'])
+  let dict = await Getdictionary(['mainCardStatus', 'activationPackageMethod', 'setMeal'])
   statusList.value = dict[0]
   serviceList.value = dict[1]
+  setMealList.value = dict[2]
 }
 
 // 同步数据

+ 2 - 2
src/views/lotCard/cardList/trafficUseDialog.vue

@@ -58,8 +58,8 @@
         <a-form :model="dataPackage" auto-label-width label-align="left">
           <a-row :gutter="10" wrap>
             <a-col :span="12">
-              <a-form-item :label="$t('lotCard.PackageName')">
-                {{ Card_info?.tariffName }}
+              <a-form-item label="套餐计划名称">
+                {{ Card_info?.simTerminalName }}
               </a-form-item>
             </a-col>
             <a-col :span="12">

+ 1 - 1
src/views/order/BuyCard/Card.vue

@@ -63,7 +63,7 @@
 <script setup>
 import { ref, toRefs, defineProps, watch, toRef } from 'vue';
 import { tariffList, ExampleQueryTrafficPool, PackageSchedule } from "@/api/path/tariffManagement.api";
-import { Getdictionary } from '@/mixins/index.js'
+import { Getdictionary ,} from '@/mixins/index.js'
 import { CardPurchase } from '@/api/path/order'
 import { Message } from '@arco-design/web-vue';
 import { useI18n } from 'vue-i18n'

+ 60 - 94
src/views/order/BuyCard/detaile.vue

@@ -24,16 +24,6 @@
                     <div class="item-content">{{ tariffForm.terminalName }}</div>
                 </div>
             </div>
-            <div class="detail-item-box">
-                <div class="detail-item">
-                    <div class="item-label">{{ $t('order.BillingMode') }}</div>
-                    <div class="item-content">{{ tariffForm.billingMethodName }}</div>
-                </div>
-                <div class="detail-item">
-                    <div class="item-label">{{ $t('order.SettlementCycle') }}</div>
-                    <div class="item-content">{{ tariffForm.billingcycleName }}</div>
-                </div>
-            </div>
             <div class="detail-item-box">
                 <div class="detail-item">
                     <div class="item-label">{{ $t('order.CardType') }}</div>
@@ -50,9 +40,9 @@
                     <div class="item-label">{{ $t('order.CardNum') }}</div>
                     <div class="item-content">{{ dataDetail.length }}
                         <template v-if="!show">
-                            <a-button type="primary"  @click="showCard = true" style="margin-left:10px;"
-                            v-if="userType == 1 && FormDataList.moderationStatus == 2">{{
-                                $t('order.AllocationCardNumber') }}</a-button>
+                            <a-button type="primary" @click="showCard = true" style="margin-left:10px;"
+                                v-if="userType == 1 && FormDataList.moderationStatus == 2">{{
+                                    $t('order.AllocationCardNumber') }}</a-button>
                         </template>
                     </div>
                 </div>
@@ -81,7 +71,8 @@
         :cancelText="$t('form.Cancel')" unmount-on-close>
         <div style="display: flex;justify-content: space-between;">
             <div>
-                <Upload listType="" minx="1" accept=".xlsx" :handelUpload="customRequest" :showRemoveButton="false" v-if="showCard">
+                <Upload listType="" minx="1" accept=".xlsx" :handelUpload="customRequest" :showRemoveButton="false"
+                    v-if="showCard">
                 </Upload>
                 <span style="color: #ccc;margin-top: 10px;display: inline-block;">请上传.xlsx文件</span>
             </div>
@@ -97,10 +88,11 @@ import { ref, onMounted, toRefs, toRef, watch } from 'vue';
 import { AcquireOrdertariff, DistributionCard, ReturntheOrderCard, GuideCardProgress } from '@/api/path/order'
 import { Message } from '@arco-design/web-vue';
 import Upload from "@/components/upload/index.vue";
-import { Getdictionary } from '@/mixins/index.js'
+import { Getdictionary, filterDict } from '@/mixins/index.js'
 import { downloadFile } from '@/utils/xlsx.js'
 import { useI18n } from 'vue-i18n'
 const { t } = useI18n();
+// 定义 props
 const props = defineProps({
     modelValue: {
         type: Boolean,
@@ -110,10 +102,12 @@ const props = defineProps({
         type: Object,
         default: () => ({})
     }
-})
-const modelValue = toRef(props, 'modelValue')
-const FormDataList = toRef(props, 'FormDataList')
-const emit = defineEmits(['update:modelValue', 'submit'])
+});
+
+// 将 props 转为 ref
+const modelValue = toRef(props, 'modelValue');
+const FormDataList = toRef(props, 'FormDataList');
+const emit = defineEmits(['update:modelValue', 'submit']);
 
 const state = ref({
     tariffForm: {},
@@ -124,20 +118,21 @@ const state = ref({
     userType: JSON.parse(localStorage.getItem('user_login_information'))?.userType, // 1平台 2用户
     show: false,
     schedule: 0, // 进度
-    ids: null
-})
+});
+const { tariffForm, showCard, res1, res2, res3, userType, show, schedule } = toRefs(state.value);
 
-const { tariffForm, showCard, res1, res2, res3, userType, show, schedule, ids } = toRefs(state.value)
+// 表格列定义
 const columnsDetail = [
     { title: 'ICCID', dataIndex: 'iccid' },
     { title: t('order.CardStatus'), dataIndex: 'status' },
     { title: t('order.CreationTime'), dataIndex: 'createdAt' }
-]
+];
+
+// 数据详情
+const dataDetail = ref([]);
 
-const dataDetail = ref([])
-let timer;
 
-// 分配卡号并开始进度监控
+// 分配卡号并处理进度
 const customRequest = async (options) => {
     const formData = new FormData();
     formData.append('file', options.fileItem.file); // 文件
@@ -147,107 +142,77 @@ const customRequest = async (options) => {
     if (res.code === 200) {
         Message.success(res.message);
         showCard.value = false;
-        
-        const progressRes = await GuideCardProgress({ id: FormDataList.value.id });
-        handleProgressResponse(progressRes);
+        await CardProgress();
     }
-}
+};
+
 
 // 关闭弹窗
 const cancel = () => emit('update:modelValue', false);
 const closeModal = () => showCard.value = false;
 
+
 // 监听 FormDataList 的变化
-watch(() => FormDataList.value, val => {
+watch(() => FormDataList.value, async (val) => {
     if (Object.keys(val).length === 0) return;
-
-    ids.value = val.id;
-    fetchTariffData(val.trafficId);
-    fetchOrderCardData(val.id);
+    tariffForm.value = val;
+    await fetchOrderCardData(val.id);
 }, { immediate: true });
 
+
 // 下载示例文件
 const DownloadSampleFile = () => downloadFile(['ICCID'], [['8968099000011939']]);
 
-// 获取和处理订单资费数据
-const fetchTariffData = async (trafficId) => {
-    const res = await AcquireOrdertariff({ id: trafficId });
-    tariffForm.value = res.data;
-    tariffForm.value.billingcycleName = res1.value.find(item => item.value === res.data.billingCycle)?.label;
-    tariffForm.value.billingMethodName = res2.value.find(item => item.value === res.data.billingMethod)?.label;
-    tariffForm.value.TariffInfomr = `${res.data.trafficBilling}/${res.data.trafficBillingType}`;
-    tariffForm.value.pricingName = res.data.pricing ? `${res.data.pricing}/${res3.value.find(item => item.value === res.data.currency)?.label}` : '';
-}
+
 
 // 获取和处理订单卡信息
 const fetchOrderCardData = async (orderId) => {
     const res = await ReturntheOrderCard({ id: orderId });
     dataDetail.value = res.data?.map(item => ({
-        ...item, status: item.status === 1 ? t('order.normal') : t('order.unsubscribe')
+        ...item,
+        status: item.status === 1 ? t('order.normal') : t('order.unsubscribe')
     })) || [];
-}
+};
 
-// 处理导卡进度响应
-const handleProgressResponse = (progressRes) => {
-    if (progressRes.code === 200) {
-        show.value = progressRes.data !== 0 && progressRes.data !== 100;
-        schedule.value = progressRes.data;
-        if (progressRes.data === 100) {
-            clearInterval(timer);
-            getICCIDDetaile();
-        } else if(progressRes.data==0){
-            clearInterval(timer);
-        }else{
-            startProgressMonitor(progressRes.data);
-        }
-    }
-}
 
-// 启动定时器监控导卡进度
-function startProgressMonitor(initialProgress) {
-    if (timer) clearInterval(timer);
-
-    timer = setInterval(async () => {
-        const progressRes = await GuideCardProgress({ id: FormDataList.value.id });
-        if (progressRes.code === 200) {
-            show.value = progressRes.data !== 0 && progressRes.data !== 100;
-            if (progressRes.data === 100) {
-                clearInterval(timer);
-                getICCIDDetaile();
-            }
-            schedule.value = progressRes.data;
-        }
-    }, 5000); // 每10秒检查一次
-}
 
 // 获取 ICCID 详情
-const getICCIDDetaile = () => {
-    ReturntheOrderCard({ id: ids.value }).then(res => {
-        dataDetail.value = res.data?.map(item => ({
-            ...item, status: item.status === 1 ? t('order.normal') : t('order.unsubscribe')
-        })) || [];
-    });
-}
+const getICCIDDetaile = async () => {
+    const res = await ReturntheOrderCard({ id: tariffForm.value.id });
+    dataDetail.value = res.data?.map(item => ({
+        ...item,
+        status: item.status === 1 ? t('order.normal') : t('order.unsubscribe')
+    })) || [];
+};
+
 
 // 监听导卡进度
-watch(() => modelValue.value, (val) => {
+watch(() => modelValue.value, async (val) => {
     if (val) {
-        CardProgress();
-    } else {
-        clearInterval(timer);
+        await CardProgress();
     }
 }, { immediate: true });
 
+
 // 卡进度检查
 const CardProgress = async () => {
     const res = await GuideCardProgress({ id: FormDataList.value.id });
-    handleProgressResponse(res);
-}
+    if (res.code === 200) {
+        show.value = res.data !== 0 && res.data != '\r总体进度:10/10 (100.00%)';
+        schedule.value = res.data;
+        if (res.data == '\r总体进度:10/10 (100.00%)') {
+            getICCIDDetaile();
+        }
+    }
+};
 
+
+// 组件挂载时获取字典数据
 onMounted(async () => {
-    res1.value = await Getdictionary('Billingcycle');
-    res2.value = await Getdictionary('billingMethod');
-    res3.value = await Getdictionary('currencyType');
+    const dict = await Getdictionary(['Billingcycle', 'billingMethod', 'currencyType']);
+    res1.value = dict[0];
+    res2.value = dict[1];
+    res3.value = dict[2];
 });
 
 </script>
@@ -256,7 +221,8 @@ onMounted(async () => {
     margin: 30px auto;
     display: flex;
     justify-content: center;
-    .title{
+
+    .title {
         text-align: center;
         font-size: 16px;
     }