index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <!-- 订单管理 -->
  3. <div class="container">
  4. <div class="head-title">
  5. <span>{{ route.meta.title }} </span>
  6. <span class="head-title-right">
  7. <a-button class="m-r-10" type="primary" @click="handleDialog({})"> {{ $t('lotCard.titleSim')
  8. }}</a-button>
  9. <a-button type="primary" @click="handleIssuedDialog({})">{{ $t('lotCard.titleOrder') }}</a-button>
  10. </span>
  11. </div>
  12. <!-- 搜索条件区 -->
  13. <div class="search-section">
  14. <a-form :model="searchForm" ref="formRef" layout="inline">
  15. <a-form-item field="ICCID" :label="$t('lotCard.iccid')" :validate-trigger="['change', 'input', 'blur']"
  16. :rules="[{ required: true, message: $t('lotCard.please') + $t('lotCard.iccid') }]">
  17. <a-input v-model="searchForm.ICCID" :placeholder="$t('lotCard.please') + $t('lotCard.iccid')"
  18. allow-clear />
  19. </a-form-item>
  20. <a-form-item field="dataBundleId" :label="$t('lotCard.dataBundleId')">
  21. <a-input v-model="searchForm.cardNumber"
  22. :placeholder="$t('lotCard.please') + $t('lotCard.dataBundleId')" allow-clear />
  23. </a-form-item>
  24. <a-form-item>
  25. <a-space>
  26. <a-button type="primary" @click="handleSearch">{{ $t('form.Search') }}</a-button>
  27. <a-button @click="resetSearch">{{ $t('form.Reset') }}</a-button>
  28. </a-space>
  29. </a-form-item>
  30. </a-form>
  31. </div>
  32. <a-table row-key="ICCID" :data="dataSource" :columns="columns" :pagination="pagination"
  33. :row-selection="rowSelection" v-model:selectedKeys="selectedKeys" :scroll="{ x: 'auto' }">
  34. <template #id="{ record }">
  35. <!-- 结束套餐 -->
  36. <a-popconfirm :content="$t('lotCard.confirmOrderEnd')" :ok-text="$t('form.Confirm')"
  37. :cancel-text="$t('form.Cancel')" @ok="handleUnsubscribeDialog(record)">
  38. <a class="a-link" href="javascript:;" style="margin-right: 1rem">{{ $t('lotCard.orderEnd') }}</a>
  39. </a-popconfirm>
  40. </template>
  41. </a-table>
  42. </div>
  43. </template>
  44. <script setup>
  45. import { onMounted, ref, reactive, getCurrentInstance } from "vue";
  46. import { useRoute } from "vue-router";
  47. import { columns } from "./config";
  48. import { Message, Notification } from '@arco-design/web-vue'
  49. import { orderList } from "@/api/path/lotCard.api"
  50. const { proxy } = getCurrentInstance()
  51. const formRef = ref()
  52. const searchForm = ref({
  53. "orderId": "",
  54. "is_Refuel": "",
  55. "refuelingId": "",
  56. "dataBundleId": "",
  57. "quantity": 0,
  58. "ICCID": "",
  59. "sendLang": "",
  60. "price": "",
  61. "totalAmount": "",
  62. "currency": "",
  63. "userId": 0,
  64. "current": 1,
  65. "size": 10
  66. });
  67. const dataSource = ref([]);
  68. const route = useRoute();
  69. const pagination = ref({
  70. total: 0,
  71. pageSize: 10,
  72. current: 1,
  73. })
  74. const rowSelection = reactive({
  75. type: 'checkbox',
  76. showCheckedAll: true,
  77. onlyCurrent: false,
  78. });
  79. const selectedKeys = ref([])
  80. const dialogRef = ref()
  81. const issuedDialogRef = ref()
  82. const orderDialogRef = ref()
  83. const intData = async () => {
  84. const param = {
  85. current: pagination.value.current,
  86. size: pagination.value.pageSize,
  87. ...searchForm.value,
  88. }
  89. const { data } = await orderList(param)
  90. dataSource.value = data.records || []
  91. pagination.value.total = data.total
  92. }
  93. const handleDialog = (data) => {
  94. if (selectedKeys.value.length > 0) {
  95. dialogRef.value.open(selectedKeys.value)
  96. return
  97. }
  98. dialogRef.value.open([data.ICCID])
  99. };
  100. const handleIssuedDialog = (data) => {
  101. if (selectedKeys.value.length > 0) {
  102. issuedDialogRef.value.open(selectedKeys.value)
  103. return
  104. }
  105. issuedDialogRef.value.open([data.ICCID])
  106. }
  107. const handleOrderDialog = (data) => {
  108. orderDialogRef.value.open(data)
  109. }
  110. const handleUnsubscribeDialog = async (data) => {
  111. // 订阅关系状态
  112. // 1:未激活
  113. // 2: 已过期
  114. // 3: 已激活99:已退款
  115. let info = {}
  116. let param = {}
  117. // TODO 入参获取不到,结束套餐可能位置存在错误
  118. if (data.status == 1) {
  119. param = {
  120. "orderId": "12410291340347056782",
  121. "thirdOrderId": "1848992146566851025"
  122. }
  123. info = await unsubscribe(param)
  124. }
  125. if (data.status == 3) {
  126. param = {
  127. "iccidPackageList": [
  128. {
  129. "iccid": "1845700383613420930",
  130. "imsi": "454120387374989",
  131. "packageid": "1851137028516811138"
  132. }
  133. ]
  134. }
  135. info = await release(param)
  136. }
  137. if (info.code == 200) {
  138. Message.success({
  139. content: data.msg,
  140. duration: 2000,
  141. });
  142. }
  143. };
  144. const handleSearch = () => {
  145. formRef.value.validate((errors) => {
  146. if (!errors) {
  147. intData()
  148. }
  149. });
  150. }
  151. const resetSearch = () => {
  152. proxy.$refs.formRef.resetFields()
  153. intData()
  154. }
  155. onMounted(() => {
  156. intData()
  157. })
  158. </script>
  159. <style scoped lang="less">
  160. .head-title-right {
  161. .m-r-10 {
  162. margin-right: 10px;
  163. }
  164. }
  165. .search-section {
  166. margin-top: 20px;
  167. margin-bottom: 20px;
  168. }
  169. .container {
  170. .head-title {
  171. display: flex;
  172. justify-content: space-between;
  173. }
  174. .form-row {
  175. display: flex;
  176. .form-row-col {
  177. width: 25%;
  178. display: flex;
  179. align-items: center;
  180. .form-row-label {
  181. width: 120px;
  182. text-align: right;
  183. }
  184. }
  185. }
  186. }
  187. </style>