agencyExamine.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <template>
  2. <div class="full-container-p24">
  3. <div style="display: flex; justify-content: space-between">
  4. <div style="display: flex">
  5. <div class="df aic">
  6. <div
  7. @click="changeListType(1)"
  8. :class="
  9. type == 1
  10. ? 'currentbtn radio-btns left-radius'
  11. : 'radio-btns left-radius'
  12. "
  13. >
  14. 待审核
  15. </div>
  16. <div
  17. @click="changeListType(2)"
  18. :class="
  19. type == 2
  20. ? 'currentbtn radio-btns right-radius'
  21. : 'radio-btns right-radius '
  22. "
  23. style="margin-right: 40px; border-left: none"
  24. >
  25. 已审核
  26. </div>
  27. </div>
  28. <el-input
  29. placeholder="请输入代理名称/联系人/联系人手机号"
  30. prefix-icon="el-icon-search"
  31. v-model="term"
  32. clearable
  33. style="width: 330px"
  34. ></el-input>
  35. <div class="seach-btn" @click="getAgencyExamineList(1)">查询</div>
  36. </div>
  37. <!-- <div class="cargo-owner-add" @click="dialogFormVisible = true">
  38. 添加代理公司
  39. </div> -->
  40. <el-dialog title="添加代理公司" v-model="dialogFormVisible">
  41. <template v-slot:default>
  42. <el-form
  43. :model="ruleForm"
  44. :rules="rules"
  45. ref="form"
  46. label-width="110px"
  47. label-position="left"
  48. >
  49. <el-form-item prop="companyName" label="代理公司名称">
  50. <el-input
  51. style="width: 280px"
  52. v-model="ruleForm.companyName"
  53. ></el-input>
  54. </el-form-item>
  55. <el-form-item prop="contactName" label="联系人">
  56. <el-input
  57. style="width: 280px"
  58. v-model="ruleForm.contactName"
  59. ></el-input>
  60. </el-form-item>
  61. <el-form-item prop="contactPhone" label="联系人手机号">
  62. <el-input
  63. style="width: 280px"
  64. v-model="ruleForm.contactPhone"
  65. ></el-input>
  66. </el-form-item>
  67. </el-form>
  68. </template>
  69. <template v-slot:footer>
  70. <div class="dialog-footer">
  71. <el-button @click="resetForm">取 消</el-button>
  72. <el-button type="primary" @click="addAgencyCompany(ruleForm)">
  73. 确 定
  74. </el-button>
  75. </div>
  76. </template>
  77. </el-dialog>
  78. </div>
  79. <div style="margin-top: 24px">
  80. <el-table :data="tableData" stripe style="width: 100%">
  81. <el-table-column
  82. type="index"
  83. label="序号"
  84. min-width="80"
  85. align="center"
  86. ></el-table-column>
  87. <el-table-column
  88. prop="cargoOwnerName"
  89. label="申请货主"
  90. min-width="120"
  91. align="center"
  92. ></el-table-column>
  93. <el-table-column
  94. prop="cargoOwnerAccountName"
  95. label="申请人"
  96. min-width="80"
  97. align="center"
  98. ></el-table-column>
  99. <el-table-column
  100. prop="companyName"
  101. label="代理公司名称"
  102. min-width="120"
  103. align="center"
  104. ></el-table-column>
  105. <el-table-column
  106. prop="contactName"
  107. label="联系人"
  108. min-width="80"
  109. align="center"
  110. ></el-table-column>
  111. <el-table-column
  112. prop="contactPhone"
  113. label="联系人手机号"
  114. min-width="120"
  115. align="center"
  116. ></el-table-column>
  117. <el-table-column
  118. v-if="type == 1"
  119. label="操作"
  120. min-width="180"
  121. align="center"
  122. >
  123. <template v-slot="scope">
  124. <el-button
  125. @click="pass(scope.row.id, scope.row.companyName)"
  126. type="primary"
  127. size="small"
  128. >
  129. 通过
  130. </el-button>
  131. <el-button
  132. @click="reject(scope.row.id, scope.row.companyName)"
  133. type="danger"
  134. size="small"
  135. >
  136. 驳回
  137. </el-button>
  138. </template>
  139. </el-table-column>
  140. <el-table-column
  141. v-if="type == 2"
  142. label="审核结果"
  143. min-width="80"
  144. align="center"
  145. >
  146. <template v-slot="scope">
  147. <el-button
  148. @click="agencyCompanyDetail(scope.row.id, tableData)"
  149. type="text"
  150. size="small"
  151. v-if="scope.row.auditStatus == 1"
  152. >
  153. 已通过
  154. </el-button>
  155. <el-tooltip
  156. v-else
  157. class="box-item"
  158. effect="light"
  159. :content="scope.row.auditReason"
  160. placement="top"
  161. >
  162. <el-button style="color: grey" type="text" size="small">
  163. 已驳回
  164. </el-button>
  165. </el-tooltip>
  166. </template>
  167. </el-table-column>
  168. </el-table>
  169. <div style="width: 100%; text-align: right; margin-top: 43px">
  170. <el-pagination
  171. background
  172. layout="prev, pager, next"
  173. :current-page="currentPage"
  174. :total="total"
  175. @current-change="pageChange"
  176. ></el-pagination>
  177. </div>
  178. </div>
  179. </div>
  180. </template>
  181. <script setup>
  182. import { ref, h, reactive, toRefs, onMounted } from "vue";
  183. import { ElNotification, ElMessageBox, ElMessage } from "element-plus";
  184. import store from "../../store";
  185. import router from "../../router";
  186. import md5 from "md5";
  187. import api from "../../apis/fetch";
  188. import { subTimeStr } from "../../utils/utils";
  189. let currentPage = ref(1);
  190. let term = ref("");
  191. let tableData = ref([]);
  192. let total = ref(0);
  193. let dialogFormVisible = ref(false);
  194. let form = ref(null);
  195. const ruleForm = ref({
  196. companyName: "",
  197. contactName: "",
  198. contactPhone: "",
  199. });
  200. const rules = ref({
  201. companyName: [
  202. { required: true, message: "请填写代理公司名称", trigger: "blur" },
  203. ],
  204. contactName: [{ required: true, message: "请填写联系人", trigger: "blur" }],
  205. contactPhone: [
  206. { required: true, message: "请填写手机号", trigger: "blur" },
  207. { min: 11, max: 11, message: "请正确填写手机号", trigger: "blur" },
  208. ],
  209. });
  210. async function getAgencyExamineList(page) {
  211. currentPage.value = page || currentPage.value;
  212. let res = await api.getAgencyExamineList({
  213. currentPage: currentPage.value,
  214. size: 10,
  215. term: term.value,
  216. type: type.value,
  217. });
  218. if (res.data.status == 0) {
  219. tableData.value = res.data.result;
  220. total.value = res.data.total;
  221. } else {
  222. tableData.value = [];
  223. total.value = 0;
  224. }
  225. }
  226. function resetForm() {
  227. dialogFormVisible.value = false;
  228. form.value.resetFields();
  229. }
  230. async function addAgencyCompany() {
  231. form.value.validate(async (valid) => {
  232. if (valid) {
  233. let { companyName, contactName, contactPhone } = ruleForm.value;
  234. let res = await api.addAgencyCompany({
  235. companyName,
  236. contactName,
  237. contactPhone,
  238. });
  239. console.log(res);
  240. if (res.data.status == 0) {
  241. ElNotification.success({
  242. title: "添加成功",
  243. duration: 0,
  244. message: `${companyName}:${res.data.msg}`,
  245. type: "success",
  246. });
  247. resetForm();
  248. getAgencyExamineList();
  249. } else {
  250. // ElNotification.error({
  251. // title: "失败",
  252. // duration: 3000,
  253. // message: res.data.msg,
  254. // });
  255. }
  256. } else {
  257. return false;
  258. }
  259. });
  260. }
  261. async function agencyCompanyDetail(id) {
  262. router.push({
  263. path: "/agencyManage/agencyCompanyDetail",
  264. query: {
  265. id,
  266. },
  267. });
  268. }
  269. function pageChange(e) {
  270. currentPage.value = e;
  271. getAgencyExamineList();
  272. }
  273. let type = ref(1);
  274. function changeListType(t) {
  275. type.value = t;
  276. getAgencyExamineList();
  277. }
  278. async function pass(proxyAuditId, comp) {
  279. ElMessageBox.confirm(`是否确认通过: ${comp}?`, "确认", {
  280. confirmButtonText: "确认",
  281. cancelButtonText: "取消",
  282. type: "warning",
  283. })
  284. .then(async () => {
  285. let res = await api.examineAgency({
  286. proxyAuditId,
  287. auditStatus: 1,
  288. });
  289. console.log(res);
  290. ElNotification.success({
  291. title: "审核成功",
  292. duration: 0,
  293. message: res.data.msg,
  294. type: "success",
  295. });
  296. getAgencyExamineList();
  297. })
  298. .catch((e) => {
  299. console.log(e);
  300. });
  301. }
  302. async function reject(proxyAuditId, comp) {
  303. ElMessageBox.prompt(`请输入驳回 ${comp} 原因`, "驳回", {
  304. confirmButtonText: "提交",
  305. cancelButtonText: "取消",
  306. inputPattern: /\S/,
  307. inputErrorMessage: "请填写驳回原因",
  308. })
  309. .then(async ({ value: auditResaon }) => {
  310. let res = await api.examineAgency({
  311. proxyAuditId,
  312. auditStatus: 2,
  313. auditResaon,
  314. });
  315. ElNotification.success({
  316. title: "已驳回",
  317. duration: 3000,
  318. type: "success",
  319. });
  320. getAgencyExamineList();
  321. })
  322. .catch(() => {});
  323. }
  324. onMounted(() => {
  325. getAgencyExamineList();
  326. });
  327. </script>
  328. <style scoped>
  329. .seach-btn {
  330. display: inline-block;
  331. width: 60px;
  332. height: 38px;
  333. background: #0094fe;
  334. border-radius: 2px;
  335. font-size: 14px;
  336. font-family: PingFangSC-Regular, PingFang SC;
  337. font-weight: 400;
  338. color: #ffffff;
  339. text-align: center;
  340. line-height: 38px;
  341. margin-left: 15px;
  342. cursor: pointer;
  343. box-sizing: border-box;
  344. }
  345. .cargo-owner-add {
  346. width: 120px;
  347. height: 36px;
  348. border-radius: 2px;
  349. border: 1px solid #0094fe;
  350. font-size: 14px;
  351. font-family: PingFangSC-Regular, PingFang SC;
  352. font-weight: 400;
  353. color: #0094fe;
  354. line-height: 36px;
  355. text-align: center;
  356. cursor: pointer;
  357. margin-right: 20px;
  358. }
  359. :deep().el-dialog {
  360. width: 560px;
  361. padding: 20px 50px;
  362. border-radius: 6px;
  363. }
  364. :deep() .el-dialog__title {
  365. font-size: 18px;
  366. font-family: PingFangSC-Regular, PingFang SC;
  367. font-weight: 400;
  368. color: #0094fe;
  369. }
  370. .radio-btns {
  371. height: 38px;
  372. width: 70px;
  373. border: 1px solid #1486f9;
  374. line-height: 38px;
  375. text-align: center;
  376. font-size: 14px;
  377. font-family: PingFangSC-Regular, PingFang SC;
  378. font-weight: 400;
  379. color: #0094fe;
  380. cursor: pointer;
  381. }
  382. .left-radius {
  383. border-top-left-radius: 19px;
  384. border-bottom-left-radius: 19px;
  385. width: 80px;
  386. }
  387. .right-radius {
  388. border-top-right-radius: 19px;
  389. border-bottom-right-radius: 19px;
  390. width: 80px;
  391. }
  392. .currentbtn {
  393. background: #1486f9;
  394. color: #fff;
  395. }
  396. </style>