cert_count.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. <template>
  2. <div>
  3. <el-row :gutter="15">
  4. <el-form ref="modalForm" :model="modalFormData" :rules="rules" size="medium" label-width="110px" label-position="left">
  5. <el-col :span="5">
  6. <el-form-item label-width="40px" label="uid" prop="uid">
  7. <el-input v-model="modalFormData.uid" placeholder="请输入uid" clearable :style="{ width: '100%' }">
  8. </el-input>
  9. </el-form-item>
  10. </el-col>
  11. <el-col :span="5">
  12. <el-form-item label-width="70px" label="技术栈" prop="field102">
  13. <el-cascader v-model="modalFormData.field102" :options="field102Options" :props="field102Props" :style="{ width: '100%' }" placeholder="请选择技术栈" clearable></el-cascader>
  14. </el-form-item>
  15. </el-col>
  16. <el-col :span="5">
  17. <el-form-item label-width="60px" label="状态" prop="dev_status">
  18. <el-select v-model="modalFormData.dev_status" placeholder="请选择状态" clearable :style="{ width: '100%' }">
  19. <el-option v-for="(item, index) in dev_statusOptions" :key="index" :label="item.label" :value="item.value" :disabled="item.disabled"></el-option>
  20. </el-select>
  21. </el-form-item>
  22. </el-col>
  23. <el-col :span="5">
  24. <el-form-item label="先认证后付款" prop="cert_type">
  25. <el-select v-model="modalFormData.cert_type" placeholder="请选择先认证后付款" clearable :style="{ width: '100%' }">
  26. <el-option v-for="(item, index) in cert_typeOptions" :key="index" :label="item.label" :value="item.value" :disabled="item.disabled"></el-option>
  27. </el-select>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :span="4">
  31. <el-form-item label-width="0">
  32. <el-button type="primary" @click="submitForm">提交</el-button>
  33. <el-button @click="resetForm">重置</el-button>
  34. </el-form-item>
  35. </el-col>
  36. </el-form>
  37. </el-row>
  38. <el-table v-loading="loading" :border="true" :data="table" style="width: 100%">
  39. <el-table-column label="真名+昵称" width="190">
  40. <template slot-scope="scope">
  41. <div>昵称:{{ scope.row.user_info.nickname }}</div>
  42. <div>真名:{{ scope.row.user_info.realname }}</div>
  43. </template>
  44. </el-table-column>
  45. <el-table-column prop="uid" label="uid" width="80"> </el-table-column>
  46. <el-table-column label="技术栈" width="120">
  47. <template slot-scope="scope">
  48. <div>{{ scope.row.user_info.direction_name }}</div>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="技能" width="180">
  52. <template slot-scope="scope">
  53. <div>{{ scope.row.user_info.skill_description }}</div>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="作品" width="200">
  57. <template slot-scope="scope">
  58. <div>
  59. <el-popover placement="top-start" title="作品介绍" trigger="hover" width="600" :content="scope.row.user_info.work_description">
  60. <div class="text-line-1" slot="reference">
  61. {{ scope.row.user_info.work_description }}
  62. </div>
  63. </el-popover>
  64. </div>
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="状态" width="120">
  68. <template slot-scope="scope">
  69. <div>
  70. {{ dev_statusMap[scope.row.dev_status] }}
  71. </div>
  72. </template>
  73. </el-table-column>
  74. <el-table-column prop="checktime" label="认证完成时间" width="190">
  75. </el-table-column>
  76. <el-table-column label="先认证后付款" width="120">
  77. <template slot-scope="scope">
  78. <div>
  79. <el-tag v-if="scope.row.cert_type == 1">直接付费</el-tag>
  80. <el-tag v-if="scope.row.cert_type == 2" type="warning">预付</el-tag>
  81. </div>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="退款" width="190">
  85. <template slot-scope="scope">
  86. <div>
  87. <template v-if="scope.row.refundState == 1">
  88. <el-button type="danger" plain size="small" @click="applyRefund(scope.row)">申请退款</el-button>
  89. </template>
  90. <template v-if="scope.row.refundState == 2">
  91. <el-tag type="info">已提交</el-tag>
  92. <el-button type="danger" plain size="small" @click="refund(scope.row)">确认退款</el-button>
  93. </template>
  94. <el-tag v-if="scope.row.refundState == 3" type="success">退款完成</el-tag>
  95. <el-tag v-if="scope.row.refundState == 4" type="warning">无法退款</el-tag>
  96. </div>
  97. </template>
  98. </el-table-column>
  99. <!-- <el-table-column label="操作" fixed="right">
  100. <template slot-scope="scope">
  101. <template v-if="scope.row.status == 1">
  102. <el-button type="success" size="mini" @click="setDynamicPass(scope.row.comId)">通过</el-button>
  103. <el-button type="warning" size="mini" @click="callDynamicReject(scope.row.comId)">拒绝</el-button>
  104. </template>
  105. <template v-if="scope.row.status == 2">
  106. <el-button type="primary" size="mini" @click="setDynamicRecommend(scope.row.comId)">神评</el-button>
  107. <el-button type="warning" size="mini" @click="callDynamicReject(scope.row.comId,scope.row)">拒绝</el-button>
  108. </template>
  109. <template v-if="scope.row.status == 3">
  110. <el-button type="success" size="mini" @click="setDynamicPass(scope.row.comId)">通过</el-button>
  111. </template>
  112. <el-button type="danger" size="mini" @click="delDynamic(scope.row.comId)">删除</el-button>
  113. </template>
  114. </el-table-column> -->
  115. </el-table>
  116. <el-row :gutter="24">
  117. <el-col :span="23" :offset="1">
  118. <div class="mt-20 mb-20">
  119. <el-pagination :page-size="page_size" :current-page="page" @current-change="pageChange" @size-change="handleSizeChange" background :page-sizes="[10, 30, 50]" layout="total,sizes,prev, pager, next,jumper" :total="total">
  120. </el-pagination>
  121. </div>
  122. </el-col>
  123. </el-row>
  124. </div>
  125. </template>
  126. <script>
  127. export default {
  128. components: {},
  129. props: [],
  130. data() {
  131. return {
  132. modalFormData: {
  133. uid: undefined,
  134. field102: [null, null],
  135. dev_status: 0,
  136. cert_type: 0,
  137. },
  138. rules: {
  139. uid: [{
  140. required: false,
  141. message: "请输入uid",
  142. trigger: "blur",
  143. }, ],
  144. field102: [{
  145. required: false,
  146. type: "array",
  147. message: "请至少选择一个技术栈",
  148. trigger: "change",
  149. }, ],
  150. dev_status: [{
  151. required: false,
  152. message: "请选择状态",
  153. trigger: "change",
  154. }, ],
  155. cert_type: [{
  156. required: false,
  157. message: "请选择先认证后付款",
  158. trigger: "change",
  159. }, ],
  160. },
  161. field102Options: [],
  162. order_statusOptions: [{
  163. label: "全部",
  164. value: 0,
  165. },
  166. {
  167. label: "完善基础信,待支付",
  168. value: 1,
  169. },
  170. {
  171. label: "已经支付,待完善简历",
  172. value: 2,
  173. },
  174. {
  175. label: "完善简历结束,等待后台审核",
  176. value: 3,
  177. },
  178. {
  179. label: "后台审核成功,分配面试官",
  180. value: 4,
  181. },
  182. {
  183. label: "面试官分配结束,待面试",
  184. value: 5,
  185. },
  186. {
  187. label: "已拒绝",
  188. value: 6,
  189. },
  190. {
  191. label: "面试结束",
  192. value: 7,
  193. },
  194. {
  195. label: "已打款",
  196. value: 8,
  197. },
  198. ],
  199. dev_statusOptions: [{
  200. label: "全部",
  201. value: 0,
  202. },
  203. {
  204. label: "未接单",
  205. value: 1,
  206. },
  207. {
  208. label: "正在对接",
  209. value: 2,
  210. },
  211. {
  212. label: "开发中",
  213. value: 3,
  214. },
  215. {
  216. label: "已完成订单",
  217. value: 4,
  218. },
  219. {
  220. label: "已退款",
  221. value: 5,
  222. },
  223. ],
  224. cert_typeOptions: [{
  225. label: "全部",
  226. value: 0,
  227. },
  228. {
  229. label: "直接付费",
  230. value: 1,
  231. },
  232. {
  233. label: "预付",
  234. value: 2,
  235. },
  236. ],
  237. field102Props: {
  238. multiple: false,
  239. label: "label",
  240. value: "value",
  241. children: "children",
  242. },
  243. table: [],
  244. page: 1,
  245. page_size: 10,
  246. total: 0,
  247. loading: false,
  248. };
  249. },
  250. computed: {
  251. dev_statusMap() {
  252. return {
  253. 1: "未接单",
  254. 2: "正在对接",
  255. 3: "开发中",
  256. 4: "已完成订单",
  257. 5: "已退款",
  258. };
  259. },
  260. },
  261. watch: {},
  262. created() {
  263. this.getField102Options();
  264. },
  265. mounted() {
  266. this.fetchData();
  267. },
  268. methods: {
  269. canRefund(row) {
  270. return row.dev_status == 1 || row.dev_status == 2;
  271. },
  272. submitForm() {
  273. this.$refs["modalForm"].validate((valid) => {
  274. if (!valid) return;
  275. this.page = 1;
  276. this.fetchData();
  277. // TODO 提交表单
  278. });
  279. },
  280. resetForm() {
  281. this.$refs["modalForm"].resetFields();
  282. },
  283. getField102Options() {
  284. this.$post("/api/direction/get_all_data")
  285. .then((res) => {
  286. if (res.status == 1) {
  287. let aa = directionDataParse(res.data);
  288. this.field102Options = [...aa];
  289. }
  290. })
  291. .catch(() => {
  292. this.$message({
  293. type: "info",
  294. message: "操作失败",
  295. });
  296. });
  297. },
  298. pageChange(val) {
  299. this.page = val;
  300. this.fetchData();
  301. },
  302. handleSizeChange(e) {
  303. this.page_size = e;
  304. this.fetchData();
  305. },
  306. async fetchData() {
  307. this.loading = true;
  308. let params = {};
  309. if (this.modalFormData.uid) {
  310. params.uid = this.modalFormData.uid;
  311. }
  312. if (this.modalFormData.field102[1]) {
  313. params.occupation_id = this.modalFormData.field102[0];
  314. params.direction_id = this.modalFormData.field102[1];
  315. }
  316. params.dev_status = this.modalFormData.dev_status;
  317. params.cert_type = this.modalFormData.cert_type;
  318. let res = await this.$post("/uapi/cert/order", {
  319. ...params,
  320. page: this.page,
  321. page_size: this.page_size,
  322. });
  323. this.loading = false;
  324. if (res && res.status === 1) {
  325. let list = res.data.list.map(this.getRefundState);
  326. this.table = [...list];
  327. this.total = res.data.total;
  328. }
  329. },
  330. getRefundState(item) {
  331. // refundState
  332. // 1 正常
  333. // 2 退款中
  334. // 3 退款完成
  335. // 4 无法退款
  336. let refundState = 1;
  337. if (item.dev_status == 1 || item.dev_status == 2) {
  338. refundState = item.tk_status;
  339. } else {
  340. refundState = 4;
  341. }
  342. return {
  343. ...item,
  344. refundState,
  345. };
  346. },
  347. // 申请退款
  348. async applyRefund(row) {
  349. this.loading = true;
  350. debugger
  351. let res = await this.$post("/uapi/cert/tk", {
  352. id: row.id,
  353. });
  354. this.loading = false;
  355. if (res && res.status === 1) {
  356. this.$message({
  357. type: "success",
  358. message: "退款成功",
  359. });
  360. this.fetchData();
  361. } else {
  362. this.$message({
  363. type: "error",
  364. message: "退款失败",
  365. });
  366. }
  367. },
  368. // 确认退款
  369. async refund(row) {
  370. this.loading = true;
  371. let res = await this.$post("/uapi/cert/confirm_tk", {
  372. id: row.id,
  373. });
  374. this.loading = false;
  375. if (res && res.status === 1) {
  376. this.$message({
  377. type: "success",
  378. message: "退款成功",
  379. });
  380. this.fetchData();
  381. } else {
  382. this.$message({
  383. type: "error",
  384. message: "退款失败",
  385. });
  386. }
  387. },
  388. },
  389. };
  390. function directionDataParse(arr) {
  391. arr = arr.sort(function (a, b) {
  392. return Number(a.display_order) - Number(b.display_order) > 0;
  393. });
  394. let result = [];
  395. let len = arr.length;
  396. for (let i = 0; i < len; i++) {
  397. let {
  398. children,
  399. ...other
  400. } = arr[i];
  401. let label = arr[i].occupation_name || arr[i].direction_name;
  402. let value = arr[i].occupation_id || arr[i].direction_id;
  403. let item;
  404. if (children) {
  405. children = directionDataParse(children);
  406. item = {
  407. ...other,
  408. label,
  409. value,
  410. children,
  411. };
  412. } else {
  413. item = {
  414. ...other,
  415. label,
  416. value,
  417. };
  418. }
  419. result.push(item);
  420. }
  421. return result;
  422. }
  423. </script>
  424. <style>
  425. .text-line-1 {
  426. white-space: nowrap;
  427. overflow: hidden;
  428. text-overflow: ellipsis;
  429. }
  430. </style>