dev_check_detail.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <section id="dev_check_detail">
  3. <template v-if="detail">
  4. <section class="title-box" style="border-top: 0; margin-top: 0;padding-top: 0;">
  5. <h1>{{detail.name}}-认证审核</h1>
  6. <el-button :type="btnStatus">{{detail.status_name}}</el-button>
  7. </section>
  8. <section v-if="detail" class="info-box">
  9. <section class="info-left" @click="goUser">
  10. <img class="avator" :src="userinfo.icon_url" alt="icon_url" />
  11. <span>{{userinfo.nickname}}</span>
  12. <a :href="`${host}/wo/${detail.uid}`" style="margin-top: 20px;" target="_blank">个人主页</a>
  13. </section>
  14. <section class="info-right">
  15. <div>职业方向:{{userinfo.occupation_name}}</div>
  16. <div>手机号码:{{userinfo.login_mobile}}</div>
  17. <div>微信账号:{{userinfo.weixin}}</div>
  18. <div style="margin-top: 20px;">审核费用:{{detail.cert_fee}}{{detail.cert_fee_name}}</div>
  19. <div>
  20. 证书情况:{{detail.cert_no ? `${detail.cert_status_name}(${detail.cert_name})` : '无'}}
  21. <a
  22. v-if="detail.cert_no"
  23. :href="`${host}/cert/no/${detail.cert_no}`"
  24. target="_blank"
  25. >查看证书</a>
  26. </div>
  27. </section>
  28. </section>
  29. <section class="pass-ctrl">
  30. <el-input placeholder="输入备注" style="width: 200px;" v-model="remind"></el-input>
  31. <el-button @click="clickSave">保存</el-button>
  32. <el-button v-if="detail.status === '2'" type="danger" @click="clickCancel">撤销证书</el-button>
  33. </section>
  34. <section class="email-box">
  35. <h2>邮件内容</h2>
  36. <section class="email">
  37. <section v-html="email"></section>
  38. <section style="margin: 10px 0;" @change="changeStatus">
  39. <el-radio v-model="radio" :label="3">拒绝</el-radio>
  40. <el-radio v-model="radio" :label="2">通过</el-radio>
  41. </section>
  42. <el-button type="primary" @click="sendEmail">确认并发送邮件</el-button>
  43. </section>
  44. </section>
  45. <section class="log-box">
  46. <h2>审核记录</h2>
  47. <section v-for="log of logs" :key="log.id" class="log">
  48. <template v-if="log.content">
  49. <h4>备注</h4>
  50. <div>{{log.content}}</div>
  51. </template>
  52. <template v-else>
  53. <div class="log-status">
  54. <span>{{log.status_name}}</span>
  55. <span class="log-date">{{log.audit_date}}</span>
  56. </div>
  57. <h4>邮件内容</h4>
  58. <div v-html="(log.audit_data || {}).email"></div>
  59. </template>
  60. </section>
  61. </section>
  62. </template>
  63. </section>
  64. </template>
  65. <script>
  66. export default {
  67. data() {
  68. return {
  69. email: "",
  70. remind: "",
  71. // 3是拒绝, 2是通过
  72. radio: 3,
  73. detail: null
  74. };
  75. },
  76. computed: {
  77. btnStatus() {
  78. let status = "info";
  79. switch (this.detail.status) {
  80. case "2":
  81. status = "success";
  82. break;
  83. case "3":
  84. status = "danger";
  85. break;
  86. }
  87. return status;
  88. },
  89. host() {
  90. return `https://${
  91. this.detail.current_env === "test" ? "dev.test" : "www"
  92. }.proginn.com`;
  93. },
  94. userinfo() {
  95. return (this.detail || {}).user_info;
  96. },
  97. logs() {
  98. return this.detail.cert_audit_log;
  99. }
  100. },
  101. mounted() {
  102. this.getDetail();
  103. },
  104. methods: {
  105. goUser() {
  106. location.href = `${this.host}/rooter/user/${this.detail.uid}`;
  107. },
  108. async updateEmail() {
  109. let { audit_type, uid } = this.detail,
  110. res = await this.$post("/api/admin/audit/getEmail", {
  111. audit_type,
  112. audit_status: this.radio,
  113. uid
  114. });
  115. this.email = res.data.replace(
  116. /\<input/,
  117. '<input style="height: 40px; width: 200px;"'
  118. );
  119. },
  120. changeStatus() {
  121. console.log(this.radio);
  122. this.updateEmail();
  123. },
  124. reload() {
  125. setTimeout(() => {
  126. location.reload();
  127. }, 1000);
  128. },
  129. async sendEmail() {
  130. let status = this.radio,
  131. ctrl = "rejectCert",
  132. body = { user_cert_id: this.detail.id },
  133. input = document.querySelector('[name="reason"]');
  134. if (status === 3 && !input.value) {
  135. this.$message("请输入备注信息");
  136. return;
  137. }
  138. if (status === 2) ctrl = "approveCert";
  139. else body.reason = input.value;
  140. let res = await this.$post(`/api/admin/audit/${ctrl}`, body);
  141. console.log(res);
  142. if (res.status > 0)
  143. this.$message({
  144. message: res.info,
  145. type: "success"
  146. });
  147. this.reload();
  148. },
  149. async clickCancel() {
  150. let res = await this.$post("/api/admin/audit/cancelCert", {
  151. user_cert_id: this.detail.id
  152. });
  153. if (res.status > 0)
  154. this.$message({
  155. message: res.info,
  156. type: "success"
  157. });
  158. this.reload();
  159. },
  160. async clickSave() {
  161. let detail = this.detail,
  162. res = await this.$post("/api/admin/common/add_note", {
  163. object_type: detail.admin_note_type,
  164. object_id: detail.uid,
  165. content: this.remind
  166. });
  167. if (res.status > 0)
  168. this.$message({
  169. message: res.info,
  170. type: "success"
  171. });
  172. this.reload();
  173. },
  174. async getDetail() {
  175. let res = await this.$post(
  176. "/api/admin/cert/getUserDetail",
  177. this.$route.query
  178. );
  179. this.detail = res.data;
  180. this.updateEmail();
  181. }
  182. }
  183. };
  184. </script>
  185. <style scoped>
  186. #dev_check_detail {
  187. padding: 20px;
  188. }
  189. #dev_check_detail > section {
  190. border-top: 2px solid #d8d8d8;
  191. margin-top: 20px;
  192. padding-top: 20px;
  193. }
  194. .avator {
  195. width: 120px;
  196. height: 120px;
  197. margin-right: 20px;
  198. }
  199. .title-box {
  200. display: flex;
  201. align-items: center;
  202. }
  203. .info-box {
  204. display: flex;
  205. }
  206. .info-left,
  207. .info-right {
  208. display: flex;
  209. flex-direction: column;
  210. }
  211. .info-left {
  212. cursor: pointer;
  213. }
  214. .log {
  215. position: relative;
  216. border: 1px solid #d8d8d8;
  217. margin-top: 10px;
  218. padding: 10px;
  219. }
  220. .log-status {
  221. display: flex;
  222. justify-content: space-between;
  223. align-items: center;
  224. margin-bottom: 10px;
  225. border: 1px dashed #d8d8d8;
  226. }
  227. </style>