sign.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. <template>
  2. <view class="container main">
  3. <view class="one">
  4. <view class="one_1">
  5. <input type="text" v-model="searchInfo.name" placeholder="请输入姓名">
  6. </view>
  7. <view class="one_2">
  8. <button size="mini" class="button" type="primary" @click="toInput">搜索</button>
  9. </view>
  10. </view>
  11. <view class="two">
  12. <scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-view" @scrolltolower="toPage"
  13. @scroll="toScroll">
  14. <view class="list-scroll-view">
  15. <view class="list" v-for="(item, index) in list" :key="index">
  16. <view class="value">
  17. <view class="title">姓名:</view>
  18. <view class="label">{{item.name||'暂无'}}</view>
  19. </view>
  20. <view class="value">
  21. <view class="title">手机号:</view>
  22. <view class="label">{{item.phone||'暂无'}}</view>
  23. </view>
  24. <view class="value">
  25. <view class="title">身份证号:</view>
  26. <view class="label">{{item.card||'暂无'}}</view>
  27. </view>
  28. <view class="value">
  29. <view class="title">电子邮箱:</view>
  30. <view class="label">{{item.email||'暂无'}}</view>
  31. </view>
  32. <view class="value">
  33. <view class="title">微信/QQ:</view>
  34. <view class="label">{{item.communication||'暂无'}}</view>
  35. </view>
  36. <view class="value">
  37. <view class="title">报名时间:</view>
  38. <view class="label">{{item.time||'暂无'}}</view>
  39. </view>
  40. <view class="bottom">
  41. <button v-if="item.status=='0'" class="button button_2" type="default" size="mini"
  42. @tap.stop="toExam(item)">审核</button>
  43. </view>
  44. </view>
  45. <view class="is_bottom" v-if="is_bottom">
  46. <text>{{config.bottom_title||'到底了!'}}</text>
  47. </view>
  48. </view>
  49. </scroll-view>
  50. </view>
  51. <uni-popup ref="popup" background-color="#fff" type="center" :is-mask-click="false" @change="change">
  52. <view class="popup">
  53. <view class="close">
  54. <text>审核信息</text>
  55. <text @click="toClose" class="t-icon t-icon-guanbi"></text>
  56. </view>
  57. <view class="info_1">
  58. <uni-forms ref="baseForm" :rules="rules" :modelValue="form" label-width="80px">
  59. <uni-forms-item label="审核状态" required name="status">
  60. <uni-data-select v-model="form.status" :localdata="statusList"
  61. @change="statusChange"></uni-data-select>
  62. </uni-forms-item>
  63. </uni-forms>
  64. <view class="button">
  65. <button type="primary" @click="submit('baseForm')">保存</button>
  66. </view>
  67. </view>
  68. </view>
  69. </uni-popup>
  70. </view>
  71. </template>
  72. <script>
  73. export default {
  74. data() {
  75. return {
  76. id: '',
  77. user: {},
  78. config: {},
  79. searchInfo: {},
  80. list: [],
  81. total: 0,
  82. skip: 0,
  83. limit: 5,
  84. page: 0,
  85. // 数据是否触底
  86. is_bottom: false,
  87. scrollTop: 0,
  88. statusList: [],
  89. // 禁止滚动穿透
  90. show: false,
  91. form: {
  92. status: "",
  93. },
  94. // 校验规则
  95. rules: {
  96. status: {
  97. rules: [{
  98. required: true,
  99. errorMessage: '状态不能为空'
  100. }]
  101. }
  102. }
  103. }
  104. },
  105. onLoad: async function(e) {
  106. const that = this;
  107. that.$set(that, `id`, e && e.id || '');
  108. await that.searchToken();
  109. await that.searchConfig();
  110. await that.searchOther();
  111. },
  112. onShow: async function() {
  113. const that = this;
  114. that.clearPage();
  115. await that.search();
  116. },
  117. onPullDownRefresh: async function() {
  118. const that = this;
  119. that.clearPage();
  120. await that.search();
  121. uni.stopPullDownRefresh();
  122. },
  123. methods: {
  124. // 禁止滚动穿透
  125. change(e) {
  126. const that = this;
  127. that.show = e.show
  128. },
  129. // 用户信息
  130. searchToken() {
  131. const that = this;
  132. try {
  133. const res = uni.getStorageSync('token');
  134. if (res) {
  135. const user = that.$jwt(res);
  136. that.$set(that, `user`, user);
  137. }
  138. } catch (e) {}
  139. },
  140. searchConfig() {
  141. const that = this;
  142. try {
  143. const res = uni.getStorageSync('config');
  144. if (res) that.$set(that, `config`, res);
  145. } catch (e) {}
  146. },
  147. async searchOther() {
  148. const that = this;
  149. let res;
  150. // 查询证件类型
  151. res = await that.$api(`/dictData`, 'GET', {
  152. code: 'examStatus',
  153. is_use: '0',
  154. })
  155. if (res.errcode == '0') {
  156. for (let val of res.data) {
  157. val.text = val.label
  158. val.value = val.value
  159. }
  160. that.$set(that, `statusList`, res.data)
  161. }
  162. },
  163. // 查询
  164. async search() {
  165. const that = this;
  166. let info = {
  167. skip: that.skip,
  168. limit: that.limit,
  169. match: that.id,
  170. }
  171. const res = await that.$api(`/sign`, 'GET', {
  172. ...info,
  173. ...that.searchInfo
  174. })
  175. if (res.errcode == '0') {
  176. let list = [...that.list, ...res.data];
  177. that.$set(that, `list`, list)
  178. that.$set(that, `total`, res.total)
  179. } else {
  180. uni.showToast({
  181. title: res.errmsg,
  182. icon: 'none'
  183. });
  184. }
  185. },
  186. // 输入框
  187. toInput() {
  188. const that = this;
  189. if (!that.searchInfo.name) that.$set(that, `searchInfo`, {})
  190. that.clearPage();
  191. that.search();
  192. },
  193. // 修改
  194. toView(item) {
  195. const that = this;
  196. console.log(item);
  197. },
  198. // 审核
  199. toExam(item) {
  200. const that = this;
  201. that.$set(that, `form`, item)
  202. that.$refs.popup.open('center')
  203. },
  204. // 选择状态
  205. statusChange(e) {
  206. const that = this;
  207. let data = that.statusList.find(i => i.value == e);;
  208. if (data) {
  209. that.$set(that.form, `status`, data.value)
  210. }
  211. },
  212. // 保存
  213. submit(ref) {
  214. const that = this;
  215. that.$refs[ref].validate().then(async res => {
  216. let arr = await that.$api(`/sign/${that.id}`, 'POST', res)
  217. if (arr.errcode == '0') {
  218. uni.showModal({
  219. content: "审核成功!",
  220. showCancel: false
  221. });
  222. that.toClose()
  223. } else {
  224. uni.showToast({
  225. title: arr.errmsg,
  226. });
  227. }
  228. }).catch(err => {
  229. console.log('err', err);
  230. })
  231. },
  232. // 关闭弹框
  233. toClose() {
  234. const that = this;
  235. that.$set(that, `form`, {});
  236. that.$refs.popup.close();
  237. },
  238. // 分页
  239. toPage(e) {
  240. const that = this;
  241. let list = that.list;
  242. let limit = that.limit;
  243. if (that.total > list.length) {
  244. uni.showLoading({
  245. title: '加载中',
  246. mask: true
  247. })
  248. let page = that.page + 1;
  249. that.$set(that, `page`, page)
  250. let skip = page * limit;
  251. that.$set(that, `skip`, skip)
  252. that.search();
  253. uni.hideLoading();
  254. } else that.$set(that, `is_bottom`, true)
  255. },
  256. toScroll(e) {
  257. const that = this;
  258. let up = that.scrollTop;
  259. let num = Math.sign(up - e.detail.scrollTop);
  260. if (num == 1) that.$set(that, `is_bottom`, false);
  261. // 检查滚动位置是否达到div显示的条件
  262. if (e.detail.scrollTop >= 300 && !that.showDiv) {
  263. that.showDiv = true;
  264. } else if (e.detail.scrollTop < 300 && that.showDiv) {
  265. that.showDiv = false;
  266. }
  267. },
  268. // 清空列表
  269. clearPage() {
  270. const that = this;
  271. that.$set(that, `list`, [])
  272. that.$set(that, `skip`, 0)
  273. that.$set(that, `limit`, 5)
  274. that.$set(that, `page`, 0)
  275. }
  276. }
  277. }
  278. </script>
  279. <style lang="scss" scoped>
  280. .main {
  281. .one {
  282. display: flex;
  283. justify-content: center;
  284. align-items: center;
  285. padding: 2vw;
  286. background-color: var(--mainColor);
  287. .one_1 {
  288. padding: 0 2vw;
  289. width: 75vw;
  290. input {
  291. padding: 2vw;
  292. background-color: var(--f1Color);
  293. font-size: var(--font14Size);
  294. border-radius: 5px;
  295. }
  296. }
  297. .one_2 {
  298. .button {
  299. background-color: var(--f3CColor);
  300. color: var(--mainColor);
  301. }
  302. }
  303. }
  304. .two {
  305. position: relative;
  306. flex-grow: 1;
  307. background-color: var(--f1Color);
  308. .list {
  309. background-color: var(--mainColor);
  310. border-bottom: 1px solid var(--f5Color);
  311. margin: 2vw 2vw 0 2vw;
  312. border-radius: 4px;
  313. padding: 3vw;
  314. .value {
  315. display: flex;
  316. align-items: center;
  317. .title {
  318. font-size: var(--font14Size);
  319. font-weight: bold;
  320. }
  321. .label {
  322. font-size: var(--font12Size);
  323. color: var(--f85Color);
  324. }
  325. }
  326. .bottom {
  327. margin: 2vw 0 0 0;
  328. text-align: center;
  329. .button {
  330. color: var(--mainColor);
  331. font-size: var(--font14Size);
  332. border-radius: 2vw;
  333. }
  334. .button_1 {
  335. margin: 0 2vw 0 0;
  336. background-color: var(--f3CColor);
  337. }
  338. .button_2 {
  339. background-color: var(--fF0Color);
  340. }
  341. }
  342. }
  343. }
  344. }
  345. .scroll-view {
  346. position: absolute;
  347. top: 0;
  348. left: 0;
  349. right: 0;
  350. bottom: 0;
  351. .list-scroll-view {
  352. display: flex;
  353. flex-direction: column;
  354. }
  355. }
  356. .is_bottom {
  357. width: 100%;
  358. text-align: center;
  359. text {
  360. padding: 2vw 0;
  361. display: inline-block;
  362. color: var(--f85Color);
  363. font-size: var(--font14Size);
  364. }
  365. }
  366. .uni-popup {
  367. z-index: 9999 !important;
  368. }
  369. .popup {
  370. display: flex;
  371. flex-direction: column;
  372. width: 90vw;
  373. height: 30vh;
  374. padding: 2vw;
  375. background-color: var(--mainColor);
  376. .close {
  377. display: flex;
  378. justify-content: space-between;
  379. padding: 2vw;
  380. text:first-child {
  381. font-size: var(--font16Size);
  382. font-weight: bold;
  383. }
  384. }
  385. .info_1 {
  386. position: relative;
  387. display: flex;
  388. flex-direction: column;
  389. height: 20vh;
  390. padding: 2vw;
  391. .button {
  392. margin: 2vw 0 0 0;
  393. button {
  394. background-color: var(--f3CColor);
  395. font-size: var(--font14Size);
  396. border-radius: 2vw;
  397. }
  398. }
  399. }
  400. }
  401. </style>