active.vue 10 KB

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