index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <template>
  2. <view class="switchRecord-container">
  3. <!--顶部导航栏-->
  4. <scroll-view class="scroll-view" scroll-x="true" @scroll="scroll">
  5. <view class="scroll-view-item" v-for="(tab,index) in tabBars" :key="tab.id" :id="tab.id" :class="navIndex==index ? 'activite' : ''" @tap="checkIndex(index)">
  6. {{tab.name}}
  7. </view>
  8. </scroll-view>
  9. <!-- 内容 -->
  10. <swiper :current="navIndex" @change="tabChange" class="swiper_content">
  11. <swiper-item class="swiper_item">
  12. <FeedbackList :listArray="listArray" @click="onClick" @nextPage="onNextPage" />
  13. </swiper-item>
  14. <swiper-item class="swiper_item">
  15. <FeedbackList :listArray="listArray" @click="onClick" @nextPage="onNextPage" />
  16. </swiper-item>
  17. <swiper-item class="swiper_item">
  18. <FeedbackList :listArray="listArray" @click="onClick" @nextPage="onNextPage" />
  19. </swiper-item>
  20. <swiper-item class="swiper_item">
  21. <FeedbackList :listArray="listArray" @click="onClick" @nextPage="onNextPage" />
  22. </swiper-item>
  23. </swiper>
  24. <!-- 新增 -->
  25. <view class="feedback-add-icon" @click="onClickAdd">
  26. <image class="add-icon" src="/static/image/add-icon.svg" mode="aspectFit"></image>
  27. <view class="add-title">登记</view>
  28. </view>
  29. <!-- 脚注 -->
  30. <view class="footnote_content">
  31. <view>本服务由重庆两江新区社会发展局提供</view>
  32. <view class="footnote_phone">服务咨询热线:<view class="phone_text" @click="makeCall">023-67685085</view></view>
  33. </view>
  34. </view>
  35. </template>
  36. <script setup lang="ts">
  37. import { ref } from "vue"
  38. import * as link from '@/lib/link'
  39. import rest from '@/stores/rest'
  40. import { onLoad, onShow } from "@dcloudio/uni-app";
  41. import { aesEncrypt, aesDecrypt } from "@/lib/encryption";
  42. import { formatDate,userInfo } from '@/lib/util'
  43. import FeedbackList from './FeedbackList.vue'
  44. const queryParams = ref({
  45. pageNo: 1,
  46. pageSize: 10,
  47. fkzt: '',
  48. zjhm: '',
  49. })
  50. const scrollTop = ref(0)
  51. const navIndex = ref(0)
  52. const tabBars = ref([
  53. {
  54. name:'全部',
  55. id: 0
  56. },
  57. {
  58. name:'待受理',
  59. id: 1
  60. },
  61. {
  62. name:'受理中 ',
  63. id: 2
  64. },
  65. {
  66. name:'已办结 ',
  67. id: 3
  68. }
  69. ])
  70. const scroll = (e: any) => {
  71. console.log("scroll",e);
  72. scrollTop.value = e.detail.scrollTop;
  73. };
  74. const checkIndex = (idx:number) => {
  75. if (navIndex.value !== idx){
  76. navIndex.value = idx;
  77. switch (idx) {
  78. case 0:
  79. queryParams.value.fkzt = ''
  80. break;
  81. case 1:
  82. queryParams.value.fkzt = '1'
  83. break;
  84. case 2:
  85. queryParams.value.fkzt = '2'
  86. break;
  87. case 3:
  88. queryParams.value.fkzt = '3'
  89. break;
  90. }
  91. queryParams.value.pageNo = 1
  92. list.value = []
  93. getList()
  94. }
  95. }
  96. const tabChange = async(e:any) => {
  97. let _idx = e.detail.current
  98. checkIndex(_idx)
  99. }
  100. const listArray = ref([])
  101. const list = ref() //处方列表
  102. const total = ref(0)
  103. const status = ref('loading')
  104. const getList = async () => {
  105. try {
  106. console.log("此时的",queryParams.value)
  107. // loaded.value = true;
  108. let res = await rest.get('/admin-api/zyyp/feedback/page', queryParams.value)
  109. let _list = res.list
  110. if (queryParams.value.pageNo === 1) {
  111. list.value = _list;
  112. } else {
  113. list.value = list.value.concat(_list);
  114. }
  115. getFormattedData(list.value)
  116. total.value = res.total
  117. if (res.total && queryParams.value.pageNo >= total.value / queryParams.value.pageSize) {
  118. status.value = "noMore"
  119. }
  120. } catch (e) {
  121. } finally {
  122. }
  123. }
  124. const titleArray = [
  125. { title: '办件编号', key: 'id' },
  126. { title: '登记时间', key: 'createTime' },
  127. ];
  128. const getFormattedData = (listData) => {
  129. const formattedData = listData.map(item => {
  130. const formattedItem = titleArray.map(titleItem => {
  131. let value = item[titleItem.key];
  132. if (titleItem.key === 'createTime') {
  133. value = formatDate(item[titleItem.key], '{y}-{m}-{d} {h}:{i}:{s}');
  134. }
  135. return {
  136. title: titleItem.title,
  137. value: value
  138. };
  139. });
  140. return {
  141. ...item,
  142. formattedData: formattedItem ,
  143. };
  144. });
  145. listArray.value = formattedData;
  146. console.log("查询",listArray.value)
  147. };
  148. const onNextPage = ()=> {
  149. if (!list.value || queryParams.value.pageNo > (total.value / queryParams.value.pageSize)) {
  150. return false;
  151. }
  152. if (queryParams.value.pageNo < total.value / queryParams.value.pageSize) {
  153. status.value = "loading";
  154. } else {
  155. status.value = "noMore"
  156. return;
  157. }
  158. queryParams.value.pageNo++;
  159. getList();
  160. }
  161. const makeCall = ()=> {
  162. window.location.href = 'tel:023-67685085';
  163. }
  164. const onClick = (e)=> {
  165. link.goBJDetails(e.id)
  166. }
  167. const onClickAdd = ()=> {
  168. link.goBJDetails()
  169. }
  170. onLoad((data) => {
  171. queryParams.value.zjhm = aesDecrypt(data.hzsfzh)
  172. userInfo.zjhm = aesDecrypt(data.hzsfzh)
  173. userInfo.userName = aesDecrypt(data.hzxm)
  174. })
  175. onShow(() => {
  176. queryParams.value.pageNo = 1;
  177. getList()
  178. })
  179. </script>
  180. <style lang="scss">
  181. .switchRecord-container {
  182. display: flex;
  183. background-color: #f2f2f2;
  184. flex-direction: column;
  185. height: calc(100vh - 84rpx);
  186. position: relative;
  187. .scroll-view {
  188. background-color: #fff;
  189. color: #3D3D3D;
  190. display: flex;
  191. overflow-x: auto;
  192. white-space: nowrap;
  193. box-sizing: border-box;
  194. }
  195. .scroll-view-item {
  196. display: inline-block;
  197. width: calc(100% / 4);
  198. height: 88rpx;
  199. line-height: 88rpx;
  200. text-align: center;
  201. font-size: 24rpx;
  202. font-weight: 400;
  203. position: relative; /* 添加相对定位 */
  204. box-sizing: border-box; /* 确保边框在总宽度内计算 */
  205. &::after {
  206. content: '';
  207. display: inline-block;
  208. width: 50%; /* 默认宽度为50% */
  209. margin: 0 auto;
  210. position: absolute;
  211. bottom: 0;
  212. left: 25%; /* 使其居中 */
  213. height: 2rpx; /* 默认未选中的高度 */
  214. background: #fff; /* 默认未选中的颜色 */
  215. z-index: 1;
  216. }
  217. &.activite {
  218. font-weight: 600;
  219. color: #1E92F0;
  220. &::after {
  221. background: #1E92F0;
  222. height: 4rpx;
  223. width: 50%;
  224. }
  225. }
  226. }
  227. .swiper_content {
  228. background-color: #f2f2f2;
  229. flex: 1;
  230. }
  231. .feedback-add-icon {
  232. position: absolute;
  233. bottom: 300rpx;
  234. right: 32rpx;
  235. width: 120rpx;
  236. height: 120rpx;
  237. @include flex-center;
  238. flex-direction: column;
  239. border-radius: 50%;
  240. background-color: #fff;
  241. box-shadow: 0px 4px 10px 0px rgba(216, 216, 216, 0.8),inset 0px 4px 10px 0px rgba(216, 216, 216, 0.3);
  242. .add-icon {
  243. margin-top: 16rpx;
  244. width: 55rpx;
  245. height: 55rpx;
  246. }
  247. .add-title {
  248. color: #1E92F0;
  249. font-size: 24rpx;
  250. font-weight: 600;
  251. }
  252. }
  253. .footnote_content {
  254. background-color: #F6F7F8;
  255. @include flex-center;
  256. height: 136rpx;
  257. flex-direction: column;
  258. font-weight: 400;
  259. font-size: 24rpx;
  260. color: #B3B5B9;
  261. line-height: 40rpx;
  262. .footnote_phone {
  263. display: flex;
  264. .phone_text {
  265. color: #1E92F0;
  266. }
  267. }
  268. }
  269. }
  270. </style>