index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. <!-- 购卡订单 -->
  2. <template>
  3. <div class="silent-expire-alarm">
  4. <!-- 搜索条件区 -->
  5. <div class="search-section">
  6. <Search />
  7. </div>
  8. <div class="audit-btn" v-if="userType == 2">
  9. <a-button @click="showAudit = true" type="text">
  10. <template #icon>
  11. <icon-plus-circle />
  12. </template>
  13. <template #default>{{ $t('order.CardPurchase') }}</template>
  14. </a-button>
  15. </div>
  16. <!-- 数据表格 -->
  17. <a-table :data="tableData" :pagination="pageData" :columns="columns" @page-change="evChangePage"
  18. :scroll="{ x: 'auto' }">
  19. <template #image="{ record }">
  20. <a-image width="60" height="60" :src="record.contractImg" :preview-props="{
  21. actionsLayout: ['rotateRight', 'zoomIn', 'zoomOut'],
  22. }" style="cursor: pointer;">
  23. </a-image>
  24. </template>
  25. <template #id="{ record }">
  26. <div class="line_heis" @click="openDetail(record)">{{ record.id }}</div>
  27. </template>
  28. <template #statusType="{ record }">
  29. <a-tag color="#ff7d00" v-if="record.moderationStatus == 1">{{$t('order.TobeReviewed')}}</a-tag>
  30. <a-tag color="#00b42a" v-if="record.moderationStatus == 2">{{ $t('order.PassTheExamination') }}</a-tag>
  31. <a-tag color="#f53f3f" v-if="record.moderationStatus == 3">{{$t('order.rejected')}}</a-tag>
  32. </template>
  33. <template #LogisticsStatus="{ record }">
  34. <a-tag color="#168cff" v-if="record.tmsStatus == 1">{{$t('order.unshipped')}}</a-tag>
  35. <a-tag color="#00b42a" v-if="record.tmsStatus == 2">{{$t('order.shipped')}}</a-tag>
  36. </template>
  37. <template #operate="{ record }">
  38. <div class="setting">
  39. <div v-if="userType == 1">
  40. <a-button type="text" v-if="record.moderationStatus == 1 && record.status == 1"
  41. @click="statusOrder(record)">{{$t('order.examine')}}</a-button>
  42. <a-button @click="uploadModal(record)" type="text">{{ record.contractImg == '' ? $t('order.UploadContract') : $t('order.ViewTheContract')
  43. }}</a-button>
  44. </div>
  45. <div v-if="userType == 2">
  46. <a-button type="text" @click="adminCancel(record)"
  47. v-if="record.moderationStatus == 2 && userType !== 1">{{ $t('order.unsubscribe') }}</a-button>
  48. </div>
  49. <a-button @click="openPriceing(record)" type="text"
  50. v-if="record.moderationStatus == 2 && userType == 1 ">{{ $t('order.UploadAmount') }}</a-button>
  51. <!-- <a-button @click="openDetail(record)" type="text" v-if="userType !== 1">套餐</a-button>
  52. <a-button @click="openDetail(record)" type="text" v-if="userType !== 1">资费</a-button> -->
  53. <a-button @click="openEndDate(record)" type="text" v-if="userType==1 && record.moderationStatus == 2">{{ $t('order.ChangeValidity') }}</a-button>
  54. <a-button @click="openDetail(record)" type="text">{{ $t('order.view') }}</a-button>
  55. </div>
  56. </template>
  57. </a-table>
  58. <a-modal v-model:visible="uploadContract" width="600px" :title="$t('order.UploadContract')"
  59. @cancel="closeModal(uploadContract, formContract)" @ok="handleBeforeOk" :okText="$t('form.Confirm')" :cancelText="$t('form.Cancel')">
  60. <a-form :model="formContract" auto-label-width>
  61. <a-form-item field="customerName" :label="$t('lotCard.userName')">
  62. <div class="audit-txt" style="color:#418035;">{{ FormDataList.userName }}</div>
  63. </a-form-item>
  64. <a-form-item field="orderNumber" :label="$t('order.OrderNum')">
  65. <div class="audit-txt">{{ FormDataList.id }}</div>
  66. </a-form-item>
  67. <a-form-item field="contractImg" :label="$t('order.SalesContract')">
  68. <Upload v-model:model-value="formContract.contractImg" />
  69. </a-form-item>
  70. </a-form>
  71. </a-modal>
  72. <a-modal v-model:visible="showPrning" :title="$t('order.UploadAmount')" @cancel="closeModal(showPrning, formPreing)" @ok="handelPriceing"
  73. :okText="$t('form.Confirm')" :cancelText="$t('form.Cancel')">
  74. <a-form :model="formPreing" auto-label-width>
  75. <a-form-item :label="$t('order.PurchaseAmount')">
  76. <a-input v-model="formPreing.amount" :placeholder="$t('form.datapoolForm.pleaseSelect')+$t('order.PurchaseAmount')" />
  77. </a-form-item>
  78. </a-form>
  79. </a-modal>
  80. <a-modal v-model:visible="showEndDate" :title="$t('order.ChangeValidity')" @cancel="closeModal(showEndDate, formEndDate)"
  81. @ok="handelEndDate" :okText="$t('form.Confirm')" :cancelText="$t('form.Cancel')">
  82. <a-form :model="formEndDate" auto-label-width>
  83. <a-form-item :label="$t('lotCard.validity')">
  84. <a-date-picker v-model="formEndDate.endDate" style="width: 100%;" />
  85. </a-form-item>
  86. </a-form>
  87. </a-modal>
  88. <Card v-model:modelValue="showAudit" @submit="intData()" />
  89. <Status v-model:modelValue="showStatus" @submit="intData()" :FormDataList="FormDataList" />
  90. <Detaile v-model:modelValue="showDetail" @submit="intData()" :FormDataList="FormDataList" />
  91. <returnCard v-model:modelValue="showReturn" :ReturnData="ReturnData" :id="id" @submit="intData()"></returnCard>
  92. </div>
  93. </template>
  94. <script setup>
  95. import { ref, onMounted, toRefs } from 'vue';
  96. import { Message } from '@arco-design/web-vue';
  97. import { purchaseOrderList } from '@/api/path/purchase';
  98. import {tariiffManageDate} from '@/api/path/tariffManagement.api'
  99. import { UploadOrderCardContract, TariffOrderCard, SettingPricing } from '@/api/path/order'
  100. import { Getdictionary } from '@/mixins/index.js'
  101. import Upload from "@/components/upload/index.vue";
  102. import Card from './Card.vue'
  103. import Status from './status.vue'
  104. import Detaile from './detaile.vue'
  105. import Search from '@/components/Search/index.vue'
  106. import returnCard from './returnCard.vue'
  107. import {useI18n} from 'vue-i18n'
  108. const {t} = useI18n();
  109. // 数据层
  110. const state = ref({
  111. userName: localStorage.getItem('user_login_information')?.username,
  112. userType: JSON.parse(localStorage.getItem('user_login_information'))?.userType, // 1平台 2用户
  113. tableData: [],
  114. currentIndex: null,
  115. FormDataList: {},
  116. pageData: {
  117. total: 0,
  118. size: 10,
  119. current: 1,
  120. },
  121. showAudit: false,
  122. showStatus: false,
  123. formContract: {
  124. id: null,
  125. contractImg: []
  126. }, // 文件上传列表
  127. showDetail: false,
  128. uploadContract: false,
  129. showReturn: false,
  130. ReturnData: [],
  131. id: null,
  132. showPrning: false,
  133. formPreing: {
  134. id: '',
  135. amount: ''
  136. },
  137. showEndDate: false,
  138. formEndDate: {
  139. id: '',
  140. endDate: ''
  141. }
  142. });
  143. const {
  144. userType,
  145. tableData,
  146. FormDataList,
  147. pageData,
  148. showAudit,
  149. showStatus,
  150. formContract,
  151. showDetail,
  152. uploadContract,
  153. showReturn,
  154. ReturnData,
  155. id,
  156. showPrning,
  157. formPreing,
  158. showEndDate,
  159. formEndDate
  160. } = toRefs(state.value);
  161. const columns = [
  162. { title: t('order.SerialNumber'), dataIndex: 'index', align: 'center', ellipsis: true },
  163. { title: t('order.OrderNum'), slotName: 'id', align: 'center', ellipsis: true },
  164. { title: t('order.AuditStatus'), slotName: 'statusType', align: 'center', ellipsis: true },
  165. { title: t('order.LogisticsStatus'), slotName: 'LogisticsStatus', align: 'center', ellipsis: true },
  166. { title: t('lotCard.userName'), dataIndex: 'userName', align: 'center', ellipsis: true },
  167. { title: t('order.NumberCardsPurchased'), dataIndex: 'quantity', align: 'center', ellipsis: true },
  168. { title: t('order.SilentPeriod')+(t('lotCard.month')), dataIndex: 'periodOfSilence', align: 'center', ellipsis: true },
  169. { title: t('order.CardType'), dataIndex: 'cardType', align: 'center', ellipsis: true },
  170. { title: t('order.CarrierName'), dataIndex: 'sourceName', align: 'center', ellipsis: true },
  171. { title: t('order.tariff'), dataIndex: 'trafficName', align: 'center', ellipsis: true },
  172. { title: t('order.PurchaseAmount'), dataIndex: 'amount', align: 'center', ellipsis: true },
  173. { title: t('order.ContractPhoto'), slotName: 'image', align: 'center', ellipsis: true },
  174. { title: t('order.OrderTime'), dataIndex: 'createdAt', align: 'center', ellipsis: true },
  175. { title: t('lotCard.validity'), dataIndex: 'endDate', align: 'center', ellipsis: true },
  176. { title: t('lotCard.Controls'), slotName: 'operate', align: 'center', ellipsis: true }
  177. ];
  178. // 订单列表
  179. const intData = async () => {
  180. const param = {
  181. current: pageData.value.current,
  182. size: pageData.value.size,
  183. }
  184. const simTypeList = await Getdictionary('cardType')
  185. let sourceList = await Getdictionary('source')
  186. purchaseOrderList(param).then(res => {
  187. tableData.value = (res.data.records || []).map((item, key) => {
  188. const sourceName = sourceList.find(val => val.value == item.source)?.label
  189. const cardType = simTypeList.find(val => val.value == item.simType)?.label
  190. return {
  191. ...item,
  192. index: key + 1,
  193. sourceName,
  194. cardType
  195. }
  196. });
  197. pageData.value.total = res.data.total;
  198. })
  199. }
  200. // 用户退订
  201. const adminCancel = (data) => {
  202. TariffOrderCard({ id: data.trafficId }).then(res => {
  203. ReturnData.value = res.data || []
  204. })
  205. id.value = data.id
  206. showReturn.value = true
  207. }
  208. // 分页
  209. const evChangePage = (page) => {
  210. pageData.value.current = page
  211. intData()
  212. }
  213. // 订单审核
  214. const statusOrder = (items) => {
  215. FormDataList.value = items
  216. showStatus.value = true
  217. }
  218. // 上传合同
  219. const uploadModal = (item) => {
  220. uploadContract.value = true;
  221. FormDataList.value = item
  222. formContract.value = {
  223. id: item.id,
  224. contractImg: item.contractImg
  225. }
  226. };
  227. // 查看订单详情
  228. const openDetail = async (item) => {
  229. FormDataList.value = item
  230. showDetail.value = true;
  231. }
  232. // 上传合同
  233. const handleBeforeOk = () => {
  234. new Promise((resolve, reject) => {
  235. formContract.value.id = FormDataList.value.id;
  236. UploadOrderCardContract(formContract.value).then(res => {
  237. resolve(res)
  238. Message.success(res.message)
  239. intData();
  240. }).catch(error => {
  241. reject(error)
  242. })
  243. })
  244. };
  245. // 模态框取消
  246. const closeModal = (items, obj) => {
  247. items = false
  248. Object.keys(obj).forEach(key => {
  249. if (obj.key) {
  250. obj[key] = '';
  251. }
  252. })
  253. }
  254. const openPriceing = (data) => {
  255. showPrning.value = true;
  256. formPreing.value.id = data.id
  257. }
  258. const handelPriceing = async () => {
  259. if (formPreing.value.amount == '' || formPreing.value.amount == 0) {
  260. return Message.error(t('order.IncorrectInput'))
  261. }
  262. formPreing.value.amount = Number(formPreing.value.amount)
  263. let res = await SettingPricing(formPreing.value)
  264. if (res.code === 200) {
  265. Message.success(res.message)
  266. closeModal(showPrning.value, formPreing.value)
  267. }
  268. }
  269. const openEndDate = (data) => {
  270. formEndDate.value.id = data.trafficId
  271. formEndDate.value.endDate = data.endDate
  272. showEndDate.value = true;
  273. }
  274. const handelEndDate = async()=>{
  275. let res = await tariiffManageDate(formEndDate.value)
  276. if(res.code === 200) {
  277. Message.success(res.message)
  278. closeModal(showEndDate.value, formEndDate.value)
  279. intData();
  280. }
  281. }
  282. onMounted(() => {
  283. intData();
  284. })
  285. </script>
  286. <style scoped lang="less">
  287. .silent-expire-alarm {
  288. padding: 20px !important;
  289. // background: #fcf;
  290. }
  291. .setting {
  292. display: flex;
  293. align-items: center;
  294. justify-content: center;
  295. }
  296. .search-section {
  297. margin-bottom: 20px;
  298. }
  299. .arco-table-th {
  300. white-space: nowrap;
  301. }
  302. .audit-txt {
  303. display: flex;
  304. flex-wrap: wrap;
  305. .audit-tag {
  306. width: 180px;
  307. color: #b2b2b2;
  308. margin-right: 20px;
  309. span {
  310. color: #000;
  311. margin-left: 20px;
  312. }
  313. }
  314. }
  315. .audit-btn {
  316. margin-bottom: 10px;
  317. }
  318. .detail-table {
  319. margin-top: 20px;
  320. }
  321. .line_heis {
  322. color: #FF8839;
  323. cursor: pointer;
  324. display: inline-block;
  325. }
  326. .line_heis:hover {
  327. color: #168cff;
  328. }
  329. </style>