index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. <!-- 购卡订单 -->
  2. <template>
  3. <div class="silent-expire-alarm">
  4. <!-- 搜索条件区 -->
  5. <!-- <div class="search-section">
  6. <a-form :model="searchForm" layout="inline">
  7. <a-form-item field="cardNumber" label="订单编号">
  8. <a-input v-model="searchForm.orderNumber" placeholder="请输入订单编号" allow-clear />
  9. </a-form-item>
  10. <a-form-item field="customerName" label="客户">
  11. <a-input v-model="searchForm.customerName" placeholder="请输入客户名称" allow-clear />
  12. </a-form-item>
  13. <a-form-item>
  14. <a-space>
  15. <a-button type="primary" @click="handleSearch">搜索</a-button>
  16. <a-button @click="resetSearch">重置</a-button>
  17. </a-space>
  18. </a-form-item>
  19. </a-form>
  20. </div> -->
  21. <div class="audit-btn">
  22. <a-button @click="openAudit" type="text">
  23. <template #icon>
  24. <icon-plus-circle />
  25. </template>
  26. <template #default>购卡</template>
  27. </a-button>
  28. </div>
  29. <!-- 数据表格 -->
  30. <a-table :data="tableData" :pagination="pageData" :columns="columns" @page-change="evChangePage"
  31. :scroll="{ x: '100%', y: '800px' }">
  32. <template #status="{ record }">
  33. {{ record.status }}
  34. </template>
  35. <template #moderation_status="{ record }">
  36. {{ record.moderation_status }}
  37. </template>
  38. <template #operate="{ record }">
  39. <div v-if="userType == 1 && record.moderation_status == 1">
  40. <a-popconfirm :content="`是否通过?`" type="warning" @ok="platformCancel(record, 2)">
  41. <a-button type="text">通过</a-button>
  42. </a-popconfirm>
  43. <a-popconfirm :content="`是否驳回`" type="warning" @ok="platformCancel(record, 3)">
  44. <a-button type="text">驳回</a-button>
  45. </a-popconfirm>
  46. </div>
  47. <div v-if="userType == 2">
  48. <a-popconfirm :content="`是否确认退订?`" type="warning" @ok="adminCancel(record)">
  49. <a-button type="text">退订</a-button>
  50. </a-popconfirm>
  51. </div>
  52. <!-- <a-button @click="openDetail(record, 2)" type="text">查看</a-button> -->
  53. </template>
  54. </a-table>
  55. <a-modal v-model:visible="uploadContract" title="上传合同" @cancel="handleCancel" @before-ok="handleBeforeOk"
  56. okText="保存" cancelText="关闭">
  57. <a-form :model="formContract" auto-label-width>
  58. <a-form-item field="orderNumber" label="单号">
  59. <!-- <a-input v-model="formContract.orderNumber" disabled placeholder="请输入单号" /> -->
  60. <div class="audit-txt">{{ formContract.orderNumber }}</div>
  61. </a-form-item>
  62. <a-form-item field="customerName" label="客户">
  63. <!-- <a-input v-model="formContract.customerName" disabled placeholder="请输入客户" /> -->
  64. <div class="audit-txt" style="color:#418035;">{{ formContract.customerName }}</div>
  65. </a-form-item>
  66. <a-form-item field="fileList" label="销售合同">
  67. <a-upload action="/" :default-file-list="formContract.fileList" />
  68. </a-form-item>
  69. </a-form>
  70. </a-modal>
  71. <!-- 创建 -->
  72. <a-modal v-model:visible="showAudit" title="购卡" width="600px" @cancel="cancelPurchase" centered
  73. :maskClosable="false" okText="确定" cancelText="关闭" :footer="null">
  74. <a-form ref="formRef" :rules="rules" :model="formState" @submit="submitPurchase">
  75. <a-form-item field="customerName" label="客户名称">
  76. <!-- <a-input v-model="formAudit.customerName" placeholder="请输入客户" /> -->
  77. <div class="audit-txt">{{ userName }}</div>
  78. </a-form-item>
  79. <a-form-item label="运营商" field="source">
  80. <a-select v-model="formState.source" :style="{ width: '380px' }" placeholder="请选择运营商">
  81. <a-option v-for="item of sourceList" :value="item.id" :label="item.label" />
  82. </a-select>
  83. </a-form-item>
  84. <a-form-item label="资费名称" field="tariffId">
  85. <a-select v-model="formState.tariffId" :style="{ width: '380px' }" @change="tariffChange"
  86. placeholder="请选择资费ID">
  87. <a-option v-for="item of tariffData" :value="item.value" :label="item.label" />
  88. </a-select>
  89. </a-form-item>
  90. <!-- <a-form-item label="资费详情" v-if="formState.tariffId">
  91. <div class="audit-txt">
  92. <div class="audit-tag">套餐类型<span>流量</span></div>
  93. <div class="audit-tag">资费编码<span>流量</span></div>
  94. <div class="audit-tag">资费编码<span>流量</span></div>
  95. <div class="audit-tag">资费编码<span>流量</span></div>
  96. </div>
  97. </a-form-item>
  98. <a-form-item label="资费计费详情" v-if="formState.tariffId">
  99. <div class="audit-txt">
  100. <div class="audit-tag">套餐类型<span>流量</span></div>
  101. <div class="audit-tag">资费编码<span>流量</span></div>
  102. <div class="audit-tag">资费编码<span>流量</span></div>
  103. <div class="audit-tag">资费编码<span>流量</span></div>
  104. </div>
  105. </a-form-item> -->
  106. <a-form-item label="卡类型" field="cardType">
  107. <a-select v-model="formState.cardType" :style="{ width: '380px' }" placeholder="请选择卡类型">
  108. <a-option v-for="item of orderType" :value="item.value" :label="item.label" />
  109. </a-select>
  110. </a-form-item>
  111. <a-form-item label="沉默期">
  112. <a-select v-model="formState.silencePeriod" :style="{ width: '380px' }" placeholder="请选择沉默期">
  113. <a-option v-for="item of silenceOptions" :value="item.value" :label="item.label" />
  114. </a-select>
  115. </a-form-item>
  116. <a-form-item label="流量池" field="flowPool">
  117. <a-radio-group v-model="formState.flowPool" :options="flowPoolData">
  118. <template #label="{ data }">
  119. <a-tag>{{ data.label }}</a-tag>
  120. </template>
  121. </a-radio-group>
  122. </a-form-item>
  123. <a-form-item label="购卡数量" field="num">
  124. <a-input v-model="formState.num" placeholder="请输入购卡数量" />
  125. </a-form-item>
  126. <a-form-item>
  127. <a-button type="primary" html-type="submit" style="margin-right: 10px;">确定</a-button>
  128. <a-button @click="cancelPurchase">取消</a-button>
  129. </a-form-item>
  130. </a-form>
  131. </a-modal>
  132. <!-- 详情 -->
  133. <a-modal v-model:visible="showDetail" width="800px" :title="currentIndex == 1 ? '退卡详情' : '查看'"
  134. @cancel="showDetail = false" :footer="null">
  135. <div class="detail-box">
  136. <div class="detail-item-box">
  137. <div class="detail-item">
  138. <div class="item-label">订单编号</div>
  139. <div class="item-content">53357981207</div>
  140. </div>
  141. <div class="detail-item">
  142. <div class="item-label">订单状态</div>
  143. <div class="item-content">已发货</div>
  144. </div>
  145. </div>
  146. <div class="detail-item-box">
  147. <div class="detail-item">
  148. <div class="item-label">发货日期</div>
  149. <div class="item-content">2024-10-24 17:46:33</div>
  150. </div>
  151. </div>
  152. <div class="detail-item-box">
  153. <div class="detail-item">
  154. <div class="item-label">运营商</div>
  155. <div class="item-content">泰国AIS</div>
  156. </div>
  157. <div class="detail-item">
  158. <div class="item-label">资费信息</div>
  159. <div class="item-content">1.0G/月</div>
  160. </div>
  161. </div>
  162. <div class="detail-item-box">
  163. <div class="detail-item">
  164. <div class="item-label">最短订阅周期</div>
  165. <div class="item-content">3个月</div>
  166. </div>
  167. <div class="detail-item">
  168. <div class="item-label">最长订阅周期</div>
  169. <div class="item-content">--</div>
  170. </div>
  171. </div>
  172. <div class="detail-item-box">
  173. <div class="detail-item">
  174. <div class="item-label">计费方式</div>
  175. <div class="item-content">按单流量消耗计费</div>
  176. </div>
  177. <div class="detail-item">
  178. <div class="item-label">结算周期</div>
  179. <div class="item-content">月</div>
  180. </div>
  181. </div>
  182. <div class="detail-item-box">
  183. <div class="detail-item">
  184. <div class="item-label">流量资费计费</div>
  185. <div class="item-content">0.8美金/G;MRC:0元;网络接入0元</div>
  186. </div>
  187. </div>
  188. <div class="detail-item-box">
  189. <div class="detail-item">
  190. <div class="item-label">卡类型</div>
  191. <div class="item-content">工业级PlugIn</div>
  192. </div>
  193. <div class="detail-item">
  194. <div class="item-label">卡板费</div>
  195. <div class="item-content">1美金</div>
  196. </div>
  197. </div>
  198. <div class="detail-item-box">
  199. <div class="detail-item">
  200. <div class="item-label">流量池</div>
  201. <div class="item-content">组池</div>
  202. </div>
  203. <div class="detail-item">
  204. <div class="item-label">沉默期</div>
  205. <div class="item-content">6个月</div>
  206. </div>
  207. </div>
  208. <div class="detail-item-box">
  209. <div class="detail-item">
  210. <div class="item-label">卡数量</div>
  211. <div class="item-content">10000;已分配0,已退回0,已转移0
  212. <!-- <a-button type="primary" @click="showCard = true" style="margin-left:10px;">分配卡号</a-button> -->
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. <div class="detail-table">
  218. <a-table :columns="columnsDetail" :data="dataDetail" />
  219. </div>
  220. <div style="text-align: right;margin-top: 20px;">
  221. <a-button type="primary" html-type="submit" style="margin-right: 10px;" @click="operateHandle">确定</a-button>
  222. </div>
  223. </a-modal>
  224. <!-- <a-modal v-model:visible="showCard" width="800px" title="分配卡号" @cancel="showCard = false" @before-ok="submitCard"
  225. okText="确认" cancelText="取消">
  226. <a-textarea :auto-size="{
  227. minRows: 15,
  228. maxRows: 15
  229. }" v-model="cardNumber" max-length="1000" :show-word-limit="true" placeholder="请输入iccid,一行一个或者逗号分隔;不支持两种混合号码。"
  230. allow-clear />
  231. </a-modal> -->
  232. </div>
  233. </template>
  234. <script setup>
  235. import { ref, reactive, onMounted } from 'vue';
  236. import { Message } from '@arco-design/web-vue';
  237. import { enum_dict } from "@/hooks/enum";
  238. import { tariffList } from "@/api/path/tariffManagement.api";
  239. import { purchaseOrderList, addPurchaseOrder, platformUpdate, adminUpdate } from '@/api/path/purchase';
  240. const selectedKeys = ref([]);
  241. const rowSelection = reactive({
  242. type: 'checkbox',
  243. showCheckedAll: true,
  244. onlyCurrent: false,
  245. });
  246. const searchForm = reactive({
  247. cardNumber: '',
  248. customerName: '',
  249. });
  250. const columns = [
  251. { title: '订单编号', dataIndex: 'id', align: 'center', width: 300 },
  252. { title: '客户名称', dataIndex: 'user_id', align: 'center' },
  253. { title: '订阅状态', slotName: 'status', align: 'center' },
  254. { title: '审核状态', slotName: 'moderation_status', align: 'center' },
  255. { title: '采购数量', dataIndex: 'quantity', align: 'center' },
  256. { title: '支付金额', dataIndex: 'payment_amount', align: 'center' },
  257. { title: '下单时间', dataIndex: 'created_at', align: 'center' },
  258. { title: '操作', slotName: 'operate', align: 'center' }
  259. ];
  260. const columnsDetail = [{ title: 'ICCID', dataIndex: 'iccid' },
  261. { title: '池名称及编号', dataIndex: 'nameAndId' },
  262. { title: '卡状态', dataIndex: 'status' },
  263. ]
  264. const dataDetail = ref([{
  265. iccid: '8986061800002054589N',
  266. nameAndId: '泰国监控40G共享/53357981207',
  267. status: '沉默期'
  268. },
  269. {
  270. iccid: '8986061800002054588N',
  271. nameAndId: '泰国监控40G共享/53357981207',
  272. status: '沉默期'
  273. }, {
  274. iccid: '8986061800002054587N',
  275. nameAndId: '泰国监控40G共享/53357981207',
  276. status: '沉默期'
  277. }, {
  278. iccid: '8986061800002054586N',
  279. nameAndId: '泰国监控40G共享/53357981207',
  280. status: '沉默期'
  281. },])
  282. const userName = ref('')
  283. const userType = ref(''); // 1平台 2用户
  284. const tableData = ref([]);
  285. const formRef = ref(null);
  286. const currentIndex = ref(null);
  287. const rules = {
  288. source: [{ required: true, trigger: 'change', }],
  289. tariffId: [
  290. {
  291. required: true,
  292. trigger: 'change',
  293. },
  294. ],
  295. cardType: [
  296. {
  297. required: true,
  298. trigger: 'change',
  299. },
  300. ],
  301. flowPool: [
  302. {
  303. required: true,
  304. trigger: 'change',
  305. },
  306. ],
  307. num: [
  308. {
  309. required: true,
  310. trigger: 'change',
  311. },
  312. ],
  313. };
  314. const pageData = ref({
  315. total: 0,
  316. size: 10,
  317. current: 1,
  318. })
  319. const formState = ref({
  320. source: null,
  321. tariffId: null,
  322. cardType: null,
  323. silencePeriod: null,
  324. flowPool: null,
  325. num: null
  326. })
  327. const sourceList = ref([]) // 来源
  328. const tariffData = ref([]) // 自费
  329. const silenceOptions = ref([]); // 沉默期
  330. const orderType = ref([]); // 卡类型
  331. const flowPoolData = ref([]); // 组池
  332. const showAudit = ref(false);
  333. const handleDictValue = () => {
  334. const dictList = JSON.parse(window.localStorage.getItem('dictList')) ?? []
  335. sourceList.value = dictList.filter((item) => item.type_key == enum_dict.SOURCE)
  336. orderType.value = dictList.filter((item) => item.type_key == enum_dict.CARD_TYPE)
  337. flowPoolData.value = dictList.filter((item) => item.type_key == enum_dict.GROUP_POOL)
  338. silenceOptions.value = dictList.filter((item) => item.type_key == enum_dict.SILENCE)
  339. }
  340. // 订单列表
  341. const intData = () => {
  342. const param = {
  343. current: pageData.value.current,
  344. size: pageData.value.size,
  345. }
  346. purchaseOrderList(param).then(res => {
  347. tableData.value = res.data.records;
  348. pageData.value.total = res.data.total;
  349. })
  350. }
  351. // 资费
  352. const getTariff = () => {
  353. const param = {
  354. current: 1,
  355. size: 999,
  356. }
  357. tariffList(param).then(res => {
  358. tariffData.value = res.data.records.map(item => ({
  359. label: item.label,
  360. value: item.id,
  361. ...item
  362. }));
  363. })
  364. }
  365. // 确认购卡
  366. const submitPurchase = ({ values, errors }) => {
  367. formRef.value.validate(async (errors) => {
  368. if (!errors) {
  369. const data = {
  370. source: String(formState.value.source),
  371. tariff_id: formState.value.tariffId,
  372. quantity: Number(formState.value.num),
  373. card_type: formState.value.cardType,
  374. period_of_silence: String(formState.value.silencePeriod),
  375. is_traffic_pool: formState.value.flowPool
  376. }
  377. addPurchaseOrder(data).then(res => {
  378. intData();
  379. showAudit.value = false;
  380. })
  381. }
  382. })
  383. }
  384. // 取消
  385. const cancelPurchase = () => {
  386. showAudit.value = false;
  387. formRef.value.resetFields();
  388. Object.assign(formState, {
  389. source: null,
  390. tariffId: null,
  391. cardType: null,
  392. silencePeriod: null,
  393. flowPool: 0,
  394. num: null
  395. });
  396. }
  397. // 平台退订
  398. const platformCancel = (data, type) => {
  399. const param = {
  400. id: data.id,
  401. status: type
  402. }
  403. platformUpdate(param).then(res => {
  404. intData();
  405. })
  406. }
  407. // 用户退订
  408. const adminCancel = (data) => {
  409. const param = {
  410. id: data.id,
  411. status: data.status
  412. }
  413. adminUpdate(param).then(res => {
  414. intData();
  415. })
  416. }
  417. //
  418. const tariffChange = (e) => {
  419. formState.value.tariffId = e;
  420. // tariffObj.value = res.data.records.map(item=>{
  421. // })
  422. }
  423. //
  424. const operateHandle = () => {
  425. if (currentIndex.value == 1) {
  426. } else {
  427. showDetail.value = false;
  428. }
  429. }
  430. // 分页
  431. const evChangePage = (page) => {
  432. pageData.value.current = page
  433. intData()
  434. }
  435. onMounted(() => {
  436. intData();
  437. userName.value = localStorage.getItem('remember_user_name');
  438. userType.value = localStorage.getItem('role');
  439. })
  440. // 上传合同的弹框
  441. const uploadContract = ref(false);
  442. const openContract = (item) => {
  443. console.log(item, '???')
  444. uploadContract.value = true;
  445. formContract.customerName = item.customerName;
  446. formContract.orderNumber = item.cardNumber;
  447. };
  448. //订单详情的弹框
  449. const showDetail = ref(false);
  450. // 查看订单详情
  451. const openDetail = (item, current) => {
  452. currentIndex.value = current;
  453. showDetail.value = true;
  454. }
  455. const handleBeforeOk = (done) => {
  456. console.log(formContract)
  457. window.setTimeout(() => {
  458. done()
  459. // prevent close
  460. // done(false)
  461. }, 3000)
  462. };
  463. const handleCancel = () => {
  464. uploadContract.value = false;
  465. }
  466. const handleSearch = () => {
  467. console.log('Search form data:', searchForm);
  468. Message.success('执行搜索操作');
  469. };
  470. const resetSearch = () => {
  471. Object.keys(searchForm).forEach(key => {
  472. if (Array.isArray(searchForm[key])) {
  473. searchForm[key] = [];
  474. } else {
  475. searchForm[key] = null;
  476. }
  477. });
  478. Message.success('搜索条件已重置');
  479. };
  480. // 文件上传的列表
  481. const formContract = reactive({
  482. orderNumber: '',
  483. customerName: '',
  484. fileList: []
  485. })
  486. // 触发购卡弹框
  487. const openAudit = () => {
  488. showAudit.value = true;
  489. handleDictValue();
  490. getTariff();
  491. }
  492. // 分配卡号的值
  493. const cardNumber = ref('');
  494. const showCard = ref(false);
  495. const submitCard = () => {
  496. }
  497. </script>
  498. <style scoped lang="less">
  499. .silent-expire-alarm {
  500. padding: 20px !important;
  501. // background: #fcf;
  502. }
  503. .search-section {
  504. margin-bottom: 20px;
  505. }
  506. .arco-table-th {
  507. white-space: nowrap;
  508. }
  509. .audit-txt {
  510. display: flex;
  511. flex-wrap: wrap;
  512. .audit-tag {
  513. width: 180px;
  514. color: #b2b2b2;
  515. margin-right: 20px;
  516. span {
  517. color: #000;
  518. margin-left: 20px;
  519. }
  520. }
  521. }
  522. .audit-btn {
  523. margin-bottom: 10px;
  524. }
  525. .detail-box {
  526. .detail-item-box {
  527. display: flex;
  528. justify-content: space-between;
  529. align-items: center;
  530. margin-bottom: 10px;
  531. .detail-item {
  532. //styleName: Body/Medium;
  533. font-family: PingFang SC;
  534. font-size: 14px;
  535. font-weight: 400;
  536. line-height: 22px;
  537. text-align: left;
  538. display: flex;
  539. align-items: center;
  540. min-width: 350px;
  541. .item-label {
  542. color: rgba(0, 0, 0, 0.4);
  543. width: 120px;
  544. text-align: right;
  545. margin-right: 10px;
  546. }
  547. .item-content {
  548. color: rgba(51, 51, 51, 1);
  549. }
  550. }
  551. }
  552. }
  553. .detail-table {
  554. margin-top: 20px;
  555. }
  556. </style>