index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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>购卡</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. }">
  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="orangered" v-if="record.moderationStatus == 1">待审核</a-tag>
  30. <a-tag color="arcoblue" v-if="record.moderationStatus == 2">审核通过</a-tag>
  31. <a-tag color="#f53f3f" v-if="record.moderationStatus == 3">已驳回</a-tag>
  32. </template>
  33. <template #LogisticsStatus="{ record }">
  34. <a-tag color="#168cff" v-if="record.tmsStatus == 1">未发货</a-tag>
  35. <a-tag color="#00b42a" v-if="record.tmsStatus == 2">已发货</a-tag>
  36. </template>
  37. <template #operate="{ record }">
  38. <div v-if="userType == 1">
  39. <a-button type="text" v-if="record.moderationStatus == 1" @click="statusOrder(record)">审核</a-button>
  40. <a-button @click="uploadModal(record)" type="text">{{ record.contractImg == '' ? '上传合同' : '查看合同' }}</a-button>
  41. </div>
  42. <div v-if="userType == 2">
  43. <a-popconfirm :content="`是否确认退订?`" type="warning" @ok="adminCancel(record)"
  44. v-if="record.moderationStatus != 3">
  45. <a-button type="text">退订</a-button>
  46. </a-popconfirm>
  47. <a-button @click="openDetail(record)" type="text">查看</a-button>
  48. </div>
  49. </template>
  50. </a-table>
  51. <a-modal v-model:visible="uploadContract" width="600px" title="上传合同"
  52. @cancel="closeModal(uploadContract, formContract)" @ok="handleBeforeOk" okText="保存" cancelText="关闭">
  53. <a-form :model="formContract" auto-label-width>
  54. <a-form-item field="customerName" label="客户名称">
  55. <div class="audit-txt" style="color:#418035;">{{ FormDataList.userName }}</div>
  56. </a-form-item>
  57. <a-form-item field="orderNumber" label="订单编号">
  58. <div class="audit-txt">{{ FormDataList.id }}</div>
  59. </a-form-item>
  60. <a-form-item field="contractImg" label="销售合同">
  61. <Upload v-model:model-value="formContract.contractImg" />
  62. </a-form-item>
  63. </a-form>
  64. </a-modal>
  65. <Card v-model:modelValue="showAudit" @submit="intData()"/>
  66. <Status v-model:modelValue="showStatus" @submit="intData()" :FormDataList="FormDataList"/>
  67. <Detaile v-model:modelValue="showDetail" @submit="intData()" :FormDataList="FormDataList"/>
  68. </div>
  69. </template>
  70. <script setup>
  71. import { ref, onMounted, toRefs } from 'vue';
  72. import { Message } from '@arco-design/web-vue';
  73. import { purchaseOrderList, platformUpdate, adminUpdate } from '@/api/path/purchase';
  74. import { UploadOrderCardContract } from '@/api/path/order'
  75. import { Getdictionary } from '@/mixins/index.js'
  76. import Upload from "@/components/upload/index.vue";
  77. import Card from './Card.vue'
  78. import Status from './status.vue'
  79. import Detaile from './detaile.vue'
  80. import Search from '@/components/Search/index.vue'
  81. // 数据层
  82. const state = ref({
  83. userName: localStorage.getItem('remember_user_name'),
  84. userType: JSON.parse(localStorage.getItem('user_login_information'))?.userType, // 1平台 2用户
  85. tableData: [],
  86. currentIndex: null,
  87. FormDataList: {},
  88. pageData: {
  89. total: 0,
  90. size: 10,
  91. current: 1,
  92. },
  93. showAudit: false,
  94. showStatus: false,
  95. formContract: {
  96. id: null,
  97. contractImg: []
  98. }, // 文件上传列表
  99. showDetail: false,
  100. uploadContract: false,
  101. });
  102. const {
  103. userType,
  104. tableData,
  105. FormDataList,
  106. pageData,
  107. showAudit,
  108. showStatus,
  109. formContract,
  110. showDetail,
  111. uploadContract,
  112. } = toRefs(state.value);
  113. const columns = [
  114. { title: '序号', dataIndex: 'index', align: 'center', ellipsis: true },
  115. { title: '订单编号', slotName: 'id', align: 'center', ellipsis: true },
  116. { title: '审核状态', slotName: 'statusType', align: 'center', ellipsis: true },
  117. { title: '物流状态', slotName: 'LogisticsStatus', align: 'center', ellipsis: true },
  118. { title: '客户名称', dataIndex: 'userName', align: 'center', ellipsis: true },
  119. { title: '采购数量', dataIndex: 'quantity', align: 'center', ellipsis: true },
  120. { title: '静默期(月)', dataIndex: 'periodOfSilence', align: 'center', ellipsis: true },
  121. { title: '卡类型', dataIndex: 'CardType', align: 'center', ellipsis: true },
  122. { title: '运营商名称', dataIndex: 'sourceName', align: 'center', ellipsis: true },
  123. { title: '资费', dataIndex: 'trafficName', align: 'center', ellipsis: true },
  124. { title: '支付金额', dataIndex: 'quantity', align: 'center', ellipsis: true },
  125. { title: '合同照片', slotName: 'image', align: 'center', ellipsis: true },
  126. { title: '下单时间', dataIndex: 'createdAt', align: 'center', ellipsis: true },
  127. { title: '操作', slotName: 'operate', align: 'center', ellipsis: true }
  128. ];
  129. // 订单列表
  130. const intData = async () => {
  131. const param = {
  132. current: pageData.value.current,
  133. size: pageData.value.size,
  134. }
  135. const res1 = await Getdictionary('cardType')
  136. let res3 = await Getdictionary('source')
  137. purchaseOrderList(param).then(res => {
  138. tableData.value = (res.data.records || []).map((item, key) => {
  139. const sourceName = res3.filter((item) => item.typeKey == 'source')?.find(val => item.source == val.value)?.label
  140. const CardType = res1.filter(val => val.typeKey == 'cardType')?.find(vals => vals.value == item.simType)?.label
  141. return {
  142. ...item,
  143. index: key + 1,
  144. sourceName,
  145. CardType
  146. }
  147. });
  148. pageData.value.total = res.data.total;
  149. })
  150. }
  151. // 用户退订
  152. const adminCancel = (data) => {
  153. const param = {
  154. id: data.id,
  155. status: data.status
  156. }
  157. adminUpdate(param).then(res => {
  158. intData();
  159. })
  160. }
  161. // 分页
  162. const evChangePage = (page) => {
  163. pageData.value.current = page
  164. intData()
  165. }
  166. // 订单审核
  167. const statusOrder = (items) => {
  168. FormDataList.value = items
  169. showStatus.value = true
  170. }
  171. // 上传合同
  172. const uploadModal = (item) => {
  173. uploadContract.value = true;
  174. FormDataList.value = item
  175. formContract.value = {
  176. id: item.id,
  177. contractImg: item.contractImg
  178. }
  179. };
  180. // 查看订单详情
  181. const openDetail = async (item) => {
  182. FormDataList.value = item
  183. showDetail.value = true;
  184. }
  185. // 上传合同
  186. const handleBeforeOk = () => {
  187. new Promise((resolve, reject) => {
  188. formContract.value.id = FormDataList.value.id;
  189. UploadOrderCardContract(formContract.value).then(res => {
  190. resolve(res)
  191. Message.success(res.message)
  192. intData();
  193. }).catch(error => {
  194. reject(error)
  195. })
  196. })
  197. };
  198. // 模态框取消
  199. const closeModal = (items, obj) => {
  200. items = false
  201. Object.keys(obj).forEach(key => {
  202. if (obj.key) {
  203. obj[key] = '';
  204. }
  205. })
  206. }
  207. onMounted(() => {
  208. intData();
  209. })
  210. </script>
  211. <style scoped lang="less">
  212. .silent-expire-alarm {
  213. padding: 20px !important;
  214. // background: #fcf;
  215. }
  216. .search-section {
  217. margin-bottom: 20px;
  218. }
  219. .arco-table-th {
  220. white-space: nowrap;
  221. }
  222. .audit-txt {
  223. display: flex;
  224. flex-wrap: wrap;
  225. .audit-tag {
  226. width: 180px;
  227. color: #b2b2b2;
  228. margin-right: 20px;
  229. span {
  230. color: #000;
  231. margin-left: 20px;
  232. }
  233. }
  234. }
  235. .audit-btn {
  236. margin-bottom: 10px;
  237. }
  238. .detail-table {
  239. margin-top: 20px;
  240. }
  241. .line_heis {
  242. color: #FF8839;
  243. cursor: pointer;
  244. display: inline-block;
  245. }
  246. .line_heis:hover {
  247. color: #168cff;
  248. }
  249. </style>