|
@@ -48,24 +48,31 @@
|
|
|
<div class="detail-item-box">
|
|
|
<div class="detail-item">
|
|
|
<div class="item-label">{{ $t('order.CardNum') }}</div>
|
|
|
- <div class="item-content">{{ tableDataList.length==0?dataDetail.length:tableDataList.length }}
|
|
|
- <a-button type="primary" @click="showCard = true" style="margin-left:10px;"
|
|
|
+ <div class="item-content">{{ tableDataList.length == 0 ? dataDetail.length : tableDataList.length }}
|
|
|
+ <a-button type="primary" :disabled="show" @click="showCard = true" style="margin-left:10px;"
|
|
|
v-if="userType == 1 && FormDataList.moderationStatus == 2">{{
|
|
|
$t('order.AllocationCardNumber') }}</a-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="detail-table">
|
|
|
+ <div class="detail-table" v-if="!show">
|
|
|
<a-table :columns="columnsDetail" @page-change="evChangePage" :data="dataDetail"
|
|
|
:pagination="dataDetail.length == 10 ? pagination : false" />
|
|
|
</div>
|
|
|
|
|
|
+ <div class="progress" v-if="show">
|
|
|
+ <div class="cusrte">
|
|
|
+ <a-progress type="circle" :percent="(schedule / 100)" size="large" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
<template #footer>
|
|
|
<a-button @click="cancel">{{ $t('form.Cancel') }}</a-button>
|
|
|
</template>
|
|
|
</a-modal>
|
|
|
|
|
|
+
|
|
|
<!-- 分配卡号 -->
|
|
|
<a-modal v-model:visible="showCard" :title="$t('order.AllocationCardNumber')"
|
|
|
@cancel="closeModal(showCard, FormDataList)" @before-ok="showCard = false" :okText="$t('form.Confirm')"
|
|
@@ -85,7 +92,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { ref, onMounted, toRefs, toRef, watch } from 'vue';
|
|
|
-import { AcquireOrdertariff, DistributionCard, ReturntheOrderCard } from '@/api/path/order'
|
|
|
+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'
|
|
@@ -112,8 +119,10 @@ const state = ref({
|
|
|
res2: [],
|
|
|
res3: [],
|
|
|
userType: JSON.parse(localStorage.getItem('user_login_information'))?.userType, // 1平台 2用户
|
|
|
+ show: false,
|
|
|
+ schedule: 0,// 进度
|
|
|
})
|
|
|
-const { tariffForm, showCard, res1, res2, res3, userType } = toRefs(state.value)
|
|
|
+const { tariffForm, showCard, res1, res2, res3, userType, show, schedule } = toRefs(state.value)
|
|
|
const columnsDetail = [{ title: 'ICCID', dataIndex: 'iccid' }, { title: t('order.CardStatus'), dataIndex: 'status' }, { title: t('order.CreationTime'), dataIndex: 'createdAt' }
|
|
|
]
|
|
|
// 初始数据
|
|
@@ -126,6 +135,9 @@ const pagination = ref({
|
|
|
total: 0
|
|
|
})
|
|
|
|
|
|
+// 定时器ID
|
|
|
+let timer;
|
|
|
+
|
|
|
// 分配卡号
|
|
|
const customRequest = (options) => {
|
|
|
const formData = new FormData();
|
|
@@ -134,19 +146,8 @@ const customRequest = (options) => {
|
|
|
DistributionCard(formData).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
Message.success(res.message)
|
|
|
- if (res.data[0].length <= 10) {
|
|
|
- res.data[0].forEach(val => {
|
|
|
- dataDetail.value.push({ iccid: val, status: val.status == 1 ? t('order.normal') : t('order.unsubscribe') })
|
|
|
- })
|
|
|
- } else {
|
|
|
- // 更新完整数据
|
|
|
- tableDataList.value = res.data[0];
|
|
|
-
|
|
|
- // 更新总条目数
|
|
|
- pagination.value.total = res.data[0].length;
|
|
|
-
|
|
|
- updatePageData();
|
|
|
- }
|
|
|
+ showCard.value = false
|
|
|
+ CardProgress()
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -175,7 +176,6 @@ watch(() => FormDataList.value, val => {
|
|
|
})
|
|
|
dataDetail.value = []
|
|
|
ReturntheOrderCard({ id: val.id }).then(res => {
|
|
|
- console.log(res);
|
|
|
if (res.data.length <= 10) {
|
|
|
dataDetail.value.push(...res.data.map(val => ({ ...val, status: val.status == 1 ? t('order.normal') : t('order.unsubscribe') })))
|
|
|
} else {
|
|
@@ -207,6 +207,36 @@ const DownloadSampleFile = () => {
|
|
|
downloadFile(['ICCID'], [['8968099000011939']])
|
|
|
}
|
|
|
|
|
|
+// 导卡进度
|
|
|
+const CardProgress = async () => {
|
|
|
+ let res = await GuideCardProgress({ id: FormDataList.value.id })
|
|
|
+ if (res.code === 200) {
|
|
|
+ show.value = res.data !== 0 && res.data !== 100;
|
|
|
+ schedule.value = res.data;
|
|
|
+ }
|
|
|
+}
|
|
|
+// 监听导卡进度
|
|
|
+watch(() => modelValue.value, val => {
|
|
|
+ if (val) {
|
|
|
+ CardProgress()
|
|
|
+ } else {
|
|
|
+ clearInterval(timer);
|
|
|
+ }
|
|
|
+}, { immediate: true })
|
|
|
+
|
|
|
+watch(() => schedule.value, val => {
|
|
|
+ // 清除旧的定时器(如果存在)
|
|
|
+ if (timer) {
|
|
|
+ clearInterval(timer);
|
|
|
+ }
|
|
|
+ timer = setInterval(() => {
|
|
|
+ CardProgress();
|
|
|
+ if (val === 100) {
|
|
|
+ clearInterval(timer);
|
|
|
+ }
|
|
|
+ }, 10000);
|
|
|
+})
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
res1.value = await Getdictionary('Billingcycle')
|
|
|
res2.value = await Getdictionary('billingMethod')
|
|
@@ -214,6 +244,12 @@ onMounted(async () => {
|
|
|
})
|
|
|
</script>
|
|
|
<style scoped lang="less">
|
|
|
+.progress {
|
|
|
+ margin: 30px auto;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+}
|
|
|
+
|
|
|
.detail-box {
|
|
|
.detail-item-box {
|
|
|
display: flex;
|