index.vue 7.1 KB

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