detaile.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <a-modal v-model:visible="modelValue" width="800px" :title="$t('order.OrderDetails')" :closable="false">
  3. <div class="detail-box">
  4. <div class="detail-item-box">
  5. <div class="detail-item">
  6. <div class="item-label">{{ $t('order.OrderNum') }}</div>
  7. <div class="item-content">{{ FormDataList.id }}</div>
  8. </div>
  9. <div class="detail-item">
  10. <div class="item-label">{{ $t('lotCard.orderType') }}</div>
  11. <div class="item-content">
  12. <a-tag color="#168cff" v-if="FormDataList.tmsStatus == 1">{{ $t('order.unshipped') }}</a-tag>
  13. <a-tag color="#00b42a" v-if="FormDataList.tmsStatus == 2">{{ $t('order.shipped') }}</a-tag>
  14. </div>
  15. </div>
  16. </div>
  17. <div class="detail-item-box">
  18. <div class="detail-item">
  19. <div class="item-label">{{ $t('lotCard.operator') }}</div>
  20. <div class="item-content">{{ FormDataList.sourceName }}</div>
  21. </div>
  22. <div class="detail-item">
  23. <div class="item-label">{{ $t('order.TariffName') }}</div>
  24. <div class="item-content">{{ tariffForm.label }}</div>
  25. </div>
  26. </div>
  27. <div class="detail-item-box">
  28. <div class="detail-item">
  29. <div class="item-label">{{ $t('order.MinimumSubscriptionPeriod') }}</div>
  30. <div class="item-content">{{ tariffForm.settlementCycle?.split('~')[0] }} {{ $t('order.Months') }}</div>
  31. </div>
  32. <div class="detail-item">
  33. <div class="item-label">{{ $t('order.MaximumSubscriptionPeriod') }}</div>
  34. <div class="item-content">{{ tariffForm.settlementCycle?.split('~')[1] }} {{ $t('order.Months') }}</div>
  35. </div>
  36. </div>
  37. <div class="detail-item-box">
  38. <div class="detail-item">
  39. <div class="item-label">{{ $t('order.BillingMode') }}</div>
  40. <div class="item-content">{{ tariffForm.billingMethodName }}</div>
  41. </div>
  42. <div class="detail-item">
  43. <div class="item-label">{{ $t('order.SettlementCycle') }}</div>
  44. <div class="item-content">{{ tariffForm.billingcycleName }}</div>
  45. </div>
  46. </div>
  47. <div class="detail-item-box">
  48. <div class="detail-item">
  49. <div class="item-label">{{ $t('order.CardType') }}</div>
  50. <div class="item-content">{{ FormDataList.cardType }}</div>
  51. </div>
  52. <div class="detail-item">
  53. <div class="item-label">{{ $t('order.StandardPrice') }}</div>
  54. <div class="item-content">{{ tariffForm.pricingName }}</div>
  55. </div>
  56. </div>
  57. <div class="detail-item-box">
  58. <div class="detail-item">
  59. <div class="item-label">{{ $t('order.FlowPool') }}</div>
  60. <div class="item-content">{{ FormDataList.isTrafficPool == 1 ? $t('lotCard.Yes') : $t('lotCard.No') }}</div>
  61. </div>
  62. </div>
  63. <div class="detail-item-box">
  64. <div class="detail-item">
  65. <div class="item-label">{{ $t('order.CardNum') }}</div>
  66. <div class="item-content">{{ dataDetail.length }}
  67. <a-button type="primary" @click="showCard = true" style="margin-left:10px;"
  68. v-if="userType == 1 && FormDataList.moderationStatus == 2">{{ $t('order.AllocationCardNumber') }}</a-button>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. <div class="detail-table">
  74. <a-table :columns="columnsDetail" :data="dataDetail" />
  75. </div>
  76. <template #footer>
  77. <a-button @click="cancel">{{ $t('form.Cancel')}}</a-button>
  78. </template>
  79. </a-modal>
  80. <!-- 分配卡号 -->
  81. <a-modal v-model:visible="showCard" :title="$t('order.AllocationCardNumber')" @cancel="closeModal(showCard, FormDataList)"
  82. @before-ok="showCard = false" :okText="$t('form.Confirm')" :cancelText="$t('form.Cancel')">
  83. <Upload listType="" minx="1" accept=".xlsx" :handelUpload="customRequest" :showRemoveButton="false">
  84. </Upload>
  85. </a-modal>
  86. </template>
  87. <script setup>
  88. import { ref, onMounted, toRefs, toRef ,watch} from 'vue';
  89. import { AcquireOrdertariff, DistributionCard,ReturntheOrderCard } from '@/api/path/order'
  90. import { Message } from '@arco-design/web-vue';
  91. import Upload from "@/components/upload/index.vue";
  92. import { Getdictionary } from '@/mixins/index.js'
  93. import {useI18n} from 'vue-i18n'
  94. const {t} = useI18n();
  95. const props = defineProps({
  96. modelValue: {
  97. type: Boolean,
  98. default: false
  99. },
  100. FormDataList: {
  101. type: Object,
  102. default: () => ({})
  103. }
  104. })
  105. const modelValue = toRef(props, 'modelValue')
  106. const FormDataList = toRef(props, 'FormDataList')
  107. const emit = defineEmits(['update:modelValue', 'submit'])
  108. const state = ref({
  109. tariffForm: {},
  110. showCard: false,
  111. res1:[],
  112. res2:[],
  113. res3:[],
  114. userType: JSON.parse(localStorage.getItem('user_login_information'))?.userType, // 1平台 2用户
  115. })
  116. const { tariffForm, showCard,res1,res2,res3,userType } = toRefs(state.value)
  117. const columnsDetail = [{ title: 'ICCID', dataIndex: 'iccid' },{ title: t('order.CardStatus'), dataIndex: 'status' },{ title: t('order.CreationTime'), dataIndex: 'createdAt' }
  118. ]
  119. const dataDetail = ref([])
  120. // 分配卡号
  121. const customRequest = (options) => {
  122. const formData = new FormData();
  123. formData.append('file', options.fileItem.file); // 这里将文件添加到 FormDataList 中
  124. formData.append('orderId', FormDataList.value.id);
  125. DistributionCard(formData).then(res => {
  126. Message.success(res.message)
  127. res.data[0].forEach(val=>[
  128. dataDetail.value.push({iccid:val})
  129. ])
  130. })
  131. }
  132. const cancel = () => {
  133. emit('update:modelValue', false)
  134. }
  135. const closeModal = ()=>{
  136. showCard.value = false
  137. }
  138. watch(() => FormDataList.value, val => {
  139. if (Object.keys(val).length === 0) return
  140. AcquireOrdertariff({ id: val.trafficId }).then(res => {
  141. tariffForm.value = res.data
  142. tariffForm.value.billingcycleName = res1.value.filter(val => val.value == res.data.billingCycle)[0]?.label;
  143. tariffForm.value.billingMethodName = res2.value.filter(val => val.value == res.data.billingMethod)[0]?.label;
  144. tariffForm.value.TariffInfomr = res.data.trafficBilling + '/' + res.data.trafficBillingType
  145. tariffForm.value.pricingName = tariffForm.value.pricing !== '' ? tariffForm.value.pricing + '/' + res3.value.filter(val => val.value == res.data.currency)[0]?.label : '';
  146. })
  147. dataDetail.value = []
  148. ReturntheOrderCard({id:val.id}).then(res=>{
  149. dataDetail.value = res.data.map(val=>({...val,status:val.status==1?t('order.normal'):t('order.unsubscribe')}))
  150. })
  151. },{deep: true})
  152. onMounted(async () => {
  153. res1.value = await Getdictionary('Billingcycle')
  154. res2.value = await Getdictionary('billingMethod')
  155. res3.value = await Getdictionary('currencyType')
  156. })
  157. </script>
  158. <style scoped lang="less">
  159. .detail-box {
  160. .detail-item-box {
  161. display: flex;
  162. justify-content: space-between;
  163. align-items: center;
  164. margin-bottom: 10px;
  165. .detail-item {
  166. //styleName: Body/Medium;
  167. font-family: PingFang SC;
  168. font-size: 14px;
  169. font-weight: 400;
  170. line-height: 22px;
  171. text-align: left;
  172. display: flex;
  173. align-items: center;
  174. min-width: 350px;
  175. .item-label {
  176. color: rgba(0, 0, 0, 0.4);
  177. width: 120px;
  178. text-align: right;
  179. margin-right: 10px;
  180. }
  181. .item-content {
  182. color: rgba(51, 51, 51, 1);
  183. }
  184. }
  185. }
  186. }
  187. </style>