sign.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  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. toExam(item) {
  196. const that = this;
  197. that.$set(that, `form`, item)
  198. that.$refs.popup.open('center')
  199. },
  200. // 选择状态
  201. statusChange(e) {
  202. const that = this;
  203. let data = that.statusList.find(i => i.value == e);;
  204. if (data) {
  205. that.$set(that.form, `status`, data.value)
  206. }
  207. },
  208. // 保存
  209. submit(ref) {
  210. const that = this;
  211. that.$refs[ref].validate().then(async res => {
  212. let arr = await that.$api(`/sign/${that.id}`, 'POST', res)
  213. if (arr.errcode == '0') {
  214. uni.showModal({
  215. content: "审核成功!",
  216. showCancel: false
  217. });
  218. that.toClose()
  219. } else {
  220. uni.showToast({
  221. title: arr.errmsg,
  222. });
  223. }
  224. }).catch(err => {
  225. console.log('err', err);
  226. })
  227. },
  228. // 关闭弹框
  229. toClose() {
  230. const that = this;
  231. that.$set(that, `form`, {});
  232. that.$refs.popup.close();
  233. },
  234. // 分页
  235. toPage(e) {
  236. const that = this;
  237. let list = that.list;
  238. let limit = that.limit;
  239. if (that.total > list.length) {
  240. uni.showLoading({
  241. title: '加载中',
  242. mask: true
  243. })
  244. let page = that.page + 1;
  245. that.$set(that, `page`, page)
  246. let skip = page * limit;
  247. that.$set(that, `skip`, skip)
  248. that.search();
  249. uni.hideLoading();
  250. } else that.$set(that, `is_bottom`, true)
  251. },
  252. toScroll(e) {
  253. const that = this;
  254. let up = that.scrollTop;
  255. let num = Math.sign(up - e.detail.scrollTop);
  256. if (num == 1) that.$set(that, `is_bottom`, false);
  257. // 检查滚动位置是否达到div显示的条件
  258. if (e.detail.scrollTop >= 300 && !that.showDiv) {
  259. that.showDiv = true;
  260. } else if (e.detail.scrollTop < 300 && that.showDiv) {
  261. that.showDiv = false;
  262. }
  263. },
  264. // 清空列表
  265. clearPage() {
  266. const that = this;
  267. that.$set(that, `list`, [])
  268. that.$set(that, `skip`, 0)
  269. that.$set(that, `limit`, 5)
  270. that.$set(that, `page`, 0)
  271. }
  272. }
  273. }
  274. </script>
  275. <style lang="scss" scoped>
  276. .main {
  277. .one {
  278. display: flex;
  279. justify-content: center;
  280. align-items: center;
  281. padding: 2vw;
  282. background-color: var(--mainColor);
  283. .one_1 {
  284. padding: 0 2vw;
  285. width: 75vw;
  286. input {
  287. padding: 2vw;
  288. background-color: var(--f1Color);
  289. font-size: var(--font14Size);
  290. border-radius: 5px;
  291. }
  292. }
  293. .one_2 {
  294. .button {
  295. background-color: var(--f3CColor);
  296. color: var(--mainColor);
  297. }
  298. }
  299. }
  300. .two {
  301. position: relative;
  302. flex-grow: 1;
  303. background-color: var(--f1Color);
  304. .list {
  305. background-color: var(--mainColor);
  306. border-bottom: 1px solid var(--f5Color);
  307. margin: 2vw 2vw 0 2vw;
  308. border-radius: 4px;
  309. padding: 3vw;
  310. .value {
  311. display: flex;
  312. align-items: center;
  313. .title {
  314. font-size: var(--font14Size);
  315. font-weight: bold;
  316. min-width: 70px;
  317. }
  318. .label {
  319. font-size: var(--font12Size);
  320. color: var(--f85Color);
  321. }
  322. }
  323. .bottom {
  324. margin: 2vw 0 0 0;
  325. text-align: center;
  326. .button {
  327. color: var(--mainColor);
  328. font-size: var(--font14Size);
  329. border-radius: 2vw;
  330. }
  331. .button_1 {
  332. margin: 0 2vw 0 0;
  333. background-color: var(--f3CColor);
  334. }
  335. .button_2 {
  336. background-color: var(--fF0Color);
  337. }
  338. }
  339. }
  340. }
  341. }
  342. .scroll-view {
  343. position: absolute;
  344. top: 0;
  345. left: 0;
  346. right: 0;
  347. bottom: 0;
  348. .list-scroll-view {
  349. display: flex;
  350. flex-direction: column;
  351. }
  352. }
  353. .is_bottom {
  354. width: 100%;
  355. text-align: center;
  356. text {
  357. padding: 2vw 0;
  358. display: inline-block;
  359. color: var(--f85Color);
  360. font-size: var(--font14Size);
  361. }
  362. }
  363. .uni-popup {
  364. z-index: 9999 !important;
  365. }
  366. .popup {
  367. display: flex;
  368. flex-direction: column;
  369. width: 90vw;
  370. height: 30vh;
  371. padding: 2vw;
  372. background-color: var(--mainColor);
  373. .close {
  374. display: flex;
  375. justify-content: space-between;
  376. padding: 2vw;
  377. text:first-child {
  378. font-size: var(--font16Size);
  379. font-weight: bold;
  380. }
  381. }
  382. .info_1 {
  383. position: relative;
  384. display: flex;
  385. flex-direction: column;
  386. height: 20vh;
  387. padding: 2vw;
  388. .button {
  389. margin: 2vw 0 0 0;
  390. button {
  391. background-color: var(--f3CColor);
  392. font-size: var(--font14Size);
  393. border-radius: 2vw;
  394. }
  395. }
  396. }
  397. }
  398. </style>