preliminary.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. <template>
  2. <view class="container main">
  3. <view class="one" v-if="total>0">
  4. <scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-view" @scrolltolower="toPage"
  5. @scroll="toScroll">
  6. <view class="list-scroll-view">
  7. <view class="list" v-for="(item, index) in list" :key="index">
  8. <view class="value">
  9. <view class="title">编号:</view>
  10. <view class="label"> <text :user-select="true">{{item.no||'暂无'}}</text> </view>
  11. </view>
  12. <view class="value">
  13. <view class="title">赛事名称:</view>
  14. <view class="label">{{item.match_name||'暂无'}}</view>
  15. </view>
  16. <view class="value">
  17. <view class="title">用户名称:</view>
  18. <view class="label">{{item.user_name||'暂无'}}</view>
  19. </view>
  20. <view class="value">
  21. <view class="title">报名时间:</view>
  22. <view class="label">{{item.time||'暂无'}}</view>
  23. </view>
  24. <view class="value" v-if="item.start_time">
  25. <view class="title">初审时间:</view>
  26. <view class="label">{{item.start_time||'暂无'}}</view>
  27. </view>
  28. <view class="value" v-if="item.score">
  29. <view class="title">初审分数:</view>
  30. <view class="label">{{item.score||'暂无'}}</view>
  31. </view>
  32. <view class="value" v-if="item.final_start_time">
  33. <view class="title">决赛时间:</view>
  34. <view class="label">{{item.final_start_time||'暂无'}}</view>
  35. </view>
  36. <view class="value" v-if="item.final_score">
  37. <view class="title">决赛分数:</view>
  38. <view class="label">{{item.final_score||'暂无'}}</view>
  39. </view>
  40. <view class="value">
  41. <view class="title">是否进入决赛:</view>
  42. <view class="label">{{getDict(item,'final_confirm')||'暂无'}}</view>
  43. </view>
  44. <view class="value">
  45. <view class="title">流程状态:</view>
  46. <view class="label">{{getDict(item,'ext_status')||'暂无'}}</view>
  47. </view>
  48. <view class="value" v-if="item.ext_status=='0'">
  49. <view class="title">状态:</view>
  50. <view class="label">{{getDict(item,'status')||'暂无'}}</view>
  51. </view>
  52. <view class="bottom">
  53. <button class="button button_3" type="default" size="mini"
  54. @tap.stop="toView(item)">查看详情</button>
  55. <button v-if="item.ext_status=='0'" class="button button_1" type="default" size="mini"
  56. @tap.stop="toStatus(item,'1')">已通过</button>
  57. <button v-if="item.ext_status=='0'" class="button button_2" type="primary" size="mini"
  58. @tap.stop="toStatus(item,'2')">已退回</button>
  59. </view>
  60. </view>
  61. <view class="is_bottom" v-if="is_bottom">
  62. <text>{{config.bottom_title||'到底了!'}}</text>
  63. </view>
  64. </view>
  65. </scroll-view>
  66. </view>
  67. <o-empty v-else />
  68. <uni-popup ref="alertDialog" type="dialog">
  69. <uni-popup-dialog type="warn" cancelText="关闭" confirmText="同意" title="提示" content="是否确定对该数据进行操作!"
  70. @confirm="dialogConfirm"></uni-popup-dialog>
  71. </uni-popup>
  72. </view>
  73. </template>
  74. <script>
  75. export default {
  76. data() {
  77. return {
  78. id: '',
  79. user: {},
  80. config: {},
  81. list: [],
  82. total: 0,
  83. skip: 0,
  84. limit: 5,
  85. page: 0,
  86. // 数据是否触底
  87. is_bottom: false,
  88. scrollTop: 0,
  89. // 禁止滚动穿透
  90. show: false,
  91. statusList: [{
  92. value: '0',
  93. label: '待审核'
  94. }, {
  95. value: '1',
  96. label: '已通过'
  97. },
  98. {
  99. value: '-1',
  100. label: '已退回'
  101. }
  102. ],
  103. isList: [{
  104. value: '0',
  105. label: '是'
  106. }, {
  107. value: '1',
  108. label: '否'
  109. }],
  110. extList: [],
  111. form: {},
  112. status: '',
  113. }
  114. },
  115. onLoad: async function(e) {
  116. const that = this;
  117. that.$set(that, `id`, e && e.id || '');
  118. await that.searchToken();
  119. await that.searchOther();
  120. await that.searchConfig();
  121. },
  122. onShow: async function() {
  123. const that = this;
  124. that.clearPage();
  125. await that.search();
  126. },
  127. onPullDownRefresh: async function() {
  128. const that = this;
  129. that.clearPage();
  130. await that.search();
  131. uni.stopPullDownRefresh();
  132. },
  133. methods: {
  134. // 禁止滚动穿透
  135. change(e) {
  136. const that = this;
  137. that.show = e.show
  138. },
  139. // 用户信息
  140. searchToken() {
  141. const that = this;
  142. try {
  143. const res = uni.getStorageSync('token');
  144. if (res) {
  145. const user = that.$jwt(res);
  146. that.$set(that, `user`, user);
  147. }
  148. } catch (e) {}
  149. },
  150. async searchOther() {
  151. const that = this;
  152. let res;
  153. // 查询证件类型
  154. res = await that.$api(`/dictData`, 'GET', {
  155. code: 'extStatus',
  156. is_use: '0',
  157. })
  158. if (res.errcode == '0') {
  159. that.$set(that, `extList`, res.data)
  160. }
  161. },
  162. searchConfig() {
  163. const that = this;
  164. try {
  165. const res = uni.getStorageSync('config');
  166. if (res) that.$set(that, `config`, res);
  167. } catch (e) {}
  168. },
  169. // 查询
  170. async search() {
  171. const that = this;
  172. let info = {
  173. skip: that.skip,
  174. limit: that.limit,
  175. match_id: that.id
  176. }
  177. const res = await that.$api(`/matchReg`, 'GET', info)
  178. if (res.errcode == '0') {
  179. let list = [...that.list, ...res.data];
  180. that.$set(that, `list`, list)
  181. that.$set(that, `total`, res.total)
  182. } else {
  183. uni.showToast({
  184. title: res.errmsg,
  185. icon: 'none'
  186. });
  187. }
  188. },
  189. // 处理字典表
  190. getDict(item, model) {
  191. if (item) {
  192. const that = this;
  193. let res;
  194. if (model == 'status') res = that.statusList.find(i => i.value == item.status)
  195. if (model == 'ext_status') res = that.extList.find(i => i.value == item.ext_status)
  196. if (model == 'final_confirm') res = that.isList.find(i => i.value == item.final_confirm)
  197. if (res) return res.label
  198. else return '暂无'
  199. }
  200. },
  201. async toView(item) {
  202. uni.navigateTo({
  203. url: `/pagesMy/preliminary/view?id=${item.id||item._id}`
  204. })
  205. },
  206. // 审核
  207. async toStatus(item, status) {
  208. const that = this;
  209. that.$set(that, `form`, item)
  210. that.$set(that, `status`, status)
  211. that.$refs.alertDialog.open()
  212. },
  213. async dialogConfirm() {
  214. const that = this;
  215. let arr = await that.$api(`/matchReg/${that.form.id}`, 'POST', {
  216. status: that.status
  217. })
  218. if (arr.errcode == '0') {
  219. uni.showModal({
  220. content: "操作成功!",
  221. showCancel: false
  222. });
  223. that.$set(that, `form`, {})
  224. that.$set(that, `status`, '')
  225. that.$refs.alertDialog.close()
  226. } else {
  227. uni.showToast({
  228. title: arr.errmsg,
  229. });
  230. }
  231. },
  232. // 分页
  233. toPage(e) {
  234. const that = this;
  235. let list = that.list;
  236. let limit = that.limit;
  237. if (that.total > list.length) {
  238. uni.showLoading({
  239. title: '加载中',
  240. mask: true
  241. })
  242. let page = that.page + 1;
  243. that.$set(that, `page`, page)
  244. let skip = page * limit;
  245. that.$set(that, `skip`, skip)
  246. that.search();
  247. uni.hideLoading();
  248. } else that.$set(that, `is_bottom`, true)
  249. },
  250. toScroll(e) {
  251. const that = this;
  252. let up = that.scrollTop;
  253. let num = Math.sign(up - e.detail.scrollTop);
  254. if (num == 1) that.$set(that, `is_bottom`, false);
  255. // 检查滚动位置是否达到div显示的条件
  256. if (e.detail.scrollTop >= 300 && !that.showDiv) {
  257. that.showDiv = true;
  258. } else if (e.detail.scrollTop < 300 && that.showDiv) {
  259. that.showDiv = false;
  260. }
  261. },
  262. // 清空列表
  263. clearPage() {
  264. const that = this;
  265. that.$set(that, `list`, [])
  266. that.$set(that, `skip`, 0)
  267. that.$set(that, `limit`, 5)
  268. that.$set(that, `page`, 0)
  269. }
  270. }
  271. }
  272. </script>
  273. <style lang="scss" scoped>
  274. .main {
  275. .one {
  276. position: relative;
  277. flex-grow: 1;
  278. background-color: var(--f1Color);
  279. .list {
  280. background-color: var(--mainColor);
  281. border-bottom: 1px solid var(--f5Color);
  282. margin: 2vw 2vw 0 2vw;
  283. border-radius: 4px;
  284. padding: 3vw;
  285. .value {
  286. display: flex;
  287. align-items: center;
  288. .title {
  289. min-width: 70px;
  290. font-size: var(--font14Size);
  291. font-weight: bold;
  292. }
  293. .label {
  294. font-size: var(--font12Size);
  295. color: var(--f85Color);
  296. }
  297. }
  298. .bottom {
  299. margin: 2vw 0 0 0;
  300. text-align: center;
  301. .button {
  302. color: var(--mainColor);
  303. font-size: var(--font14Size);
  304. border-radius: 2vw;
  305. }
  306. .button_1 {
  307. background-color: var(--f3CColor);
  308. }
  309. .button_2 {
  310. background-color: var(--fF0Color);
  311. }
  312. .button_3 {
  313. margin: 0 2vw 0 0;
  314. background-color: var(--f3CColor);
  315. }
  316. }
  317. }
  318. }
  319. }
  320. .scroll-view {
  321. position: absolute;
  322. top: 0;
  323. left: 0;
  324. right: 0;
  325. bottom: 0;
  326. .list-scroll-view {
  327. display: flex;
  328. flex-direction: column;
  329. }
  330. }
  331. .is_bottom {
  332. width: 100%;
  333. text-align: center;
  334. text {
  335. padding: 2vw 0;
  336. display: inline-block;
  337. color: var(--f85Color);
  338. font-size: var(--font14Size);
  339. }
  340. }
  341. </style>