index.vue 9.4 KB

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