sign.vue 9.7 KB

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