orderDialog copy.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <a-modal width="70%" :visible="visible" :title="$t('lotCard.titleOrder')" :hide-cancel='true'
  3. :ok-text="$t('lotCard.close')" @ok="handleSubmit" @cancel="handleCancel">
  4. <!-- 搜索条件区 -->
  5. <div class="search-section">
  6. <a-form :model="formData" ref="formRef" layout="inline">
  7. <a-form-item field="iccid" :label="$t('lotCard.iccid')" :validate-trigger="['change', 'input', 'blur']"
  8. :rules="[{ required: true, message: $t('lotCard.please') + $t('lotCard.iccid') }]">
  9. <a-input v-model="formData.iccid" :placeholder="$t('lotCard.please') + $t('lotCard.iccid')"
  10. allow-clear />
  11. </a-form-item>
  12. <a-form-item field="hImsi" :label="$t('lotCard.himsi')">
  13. <a-input v-model="formData.hImsi" :placeholder="$t('lotCard.please') + $t('lotCard.himsi')"
  14. allow-clear />
  15. </a-form-item>
  16. <a-form-item>
  17. <a-space>
  18. <a-button type="primary" @click="handleSearch">{{ $t('form.Search') }}</a-button>
  19. <a-button @click="resetSearch">{{ $t('form.Reset') }}</a-button>
  20. </a-space>
  21. </a-form-item>
  22. </a-form>
  23. </div>
  24. <a-table :data="dataSource" :columns="columns" :scroll="{ x: 'auto' }" @page-change="evChangePage"
  25. @page-size-change="evChangePageSize">
  26. <template #roleList="{ record }">
  27. <a-tag v-for="item in record.roleList" :key="item.id" style="margin:0 0 2px 4px;">{{ item.name
  28. }}</a-tag>
  29. </template>
  30. <template #state="{ record }">
  31. <a-switch v-model="record.state" disabled style="pointer-events: none" checked-value="1"
  32. unchecked-value="0" />
  33. </template>
  34. <template #id="{ record }">
  35. <a-popconfirm :content="$t('lotCard.confirmTitleOrder')" :ok-text="$t('form.Confirm')"
  36. :cancel-text="$t('form.Cancel')" @ok="evOrderDialog(record)">
  37. <a href="javascript:;" class="a-link">{{ $t('lotCard.titleOrder') }}</a>
  38. </a-popconfirm>
  39. </template>
  40. </a-table>
  41. </a-modal>
  42. </template>
  43. <script setup>
  44. import { onMounted, ref, getCurrentInstance } from "vue";
  45. import { columns } from "../trafficList/config";
  46. import { Message, Notification } from '@arco-design/web-vue'
  47. import { packageInfo, orderSync } from '@/api/path/lotCard.api'
  48. import { useRouter, useRoute } from 'vue-router'
  49. const props = defineProps({
  50. });
  51. const router = useRouter()
  52. const route = useRoute();
  53. const emit = defineEmits(['submit']);
  54. const { proxy } = getCurrentInstance()
  55. const formRef = ref()
  56. const formData = ref({
  57. "iccid": "",
  58. "imsi": "454120387374989",
  59. });
  60. const tableObj = ref({})
  61. const dataSource = ref([]);
  62. const pagination = ref({
  63. total: 0,
  64. pageSize: 10,
  65. current: 1,
  66. })
  67. const visible = ref(false)
  68. const open = (data) => {
  69. if (data.length == 0) {
  70. return
  71. }
  72. visible.value = true
  73. tableObj.value = data
  74. intData()
  75. }
  76. const intData = async () => {
  77. const param = {
  78. current: pagination.value.current,
  79. size: pagination.value.pageSize,
  80. ...formData.value
  81. }
  82. const { data } = await packageInfo(param)
  83. dataSource.value = data || []
  84. pagination.value.total = dataSource.value.length
  85. }
  86. const evChangePage = (page) => {
  87. pagination.value.current = page
  88. }
  89. const evChangePageSize = (pageSize) => {
  90. pagination.value.pageSize = pageSize
  91. }
  92. const resetSearch = () => {
  93. proxy.$refs.formRef.resetFields()
  94. }
  95. const handleSearch = () => {
  96. formRef.value.validate((errors) => {
  97. if (!errors) {
  98. intData()
  99. }
  100. });
  101. }
  102. const handleSubmit = () => {
  103. emit('submit', { ...formData });
  104. visible.value = false
  105. };
  106. const handleCancel = () => {
  107. visible.value = false
  108. };
  109. // 下发用户
  110. const evOrderDialog = async (record) => {
  111. const param = {
  112. "includeCard": 1,
  113. "is_Refuel": "1",//是否为附加包
  114. refuelingId: "",//is_Refuel为0需要附加包
  115. "dataBundleId": record.id,// 流量包id
  116. "quantity": 1, // 采购数量
  117. "ICCID": tableObj.value.iccid,
  118. "sendLang": "3", // 发送购买短信语言
  119. }
  120. const { code, data, message } = await orderSync(param)
  121. if (code == 200) {
  122. Message.success({
  123. content: message,
  124. duration: 2000,
  125. })
  126. const queryData = {
  127. ...data,
  128. ...param,
  129. }
  130. const timter = setTimeout(() => {
  131. router.push({
  132. name: "lotCard-packageMange",
  133. query: queryData
  134. }, 2000)
  135. clearTimeout(timter)
  136. })
  137. }
  138. };
  139. defineExpose({ open })
  140. </script>