followList.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <view class="content">
  3. <view class="top-fixed">
  4. <u-tabs
  5. :scrollable="false"
  6. :list="tabs"
  7. lineColor="#C39A58"
  8. @change="statusChange">
  9. </u-tabs>
  10. </view>
  11. <mescroll-body top="88rpx" bottom="0" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback">
  12. <view class="order-list">
  13. <view class="order-item" v-for="(item) in dataList" @click="navTo('./inquiryOrderDetails?orderId='+item.orderId)">
  14. <view class="order-top" >
  15. <view class="left" >
  16. <view class="title" >
  17. {{item.tempName}}
  18. </view>
  19. </view>
  20. <view class="status red" v-if="item.writeStatus==0">
  21. 未完成
  22. </view>
  23. <view class="status green" v-if="item.writeStatus==1">
  24. 已完成
  25. </view>
  26. </view>
  27. <view class="order-cont">
  28. <view class="order-time-box">
  29. <view class="order-time">
  30. <view class="time">{{item.planTime}} </view>
  31. <view class="count"> {{item.num}}/{{item.totalNum}}期</view>
  32. </view>
  33. <view class="right">
  34. <view class="btn red" v-if="item.writeStatus==0" @click.stop="doFoloow(item)">去填写</view>
  35. <view class="btn green" v-if="item.writeStatus==1" @click.stop="showDetails(item)">查看</view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </mescroll-body>
  42. </view>
  43. </template>
  44. <script>
  45. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  46. import {getFollowList} from '@/api/follow.js'
  47. export default {
  48. mixins: [MescrollMixin], // 使用mixin
  49. data() {
  50. return {
  51. tabs:[
  52. {
  53. id:-1,
  54. name:'全部'
  55. },
  56. {
  57. id:0,
  58. name:'未完成'
  59. },
  60. {
  61. id:1,
  62. name:'已完成'
  63. }
  64. ],
  65. writeStatus:-1,
  66. mescroll:null,
  67. downOption: { //下拉刷新
  68. use:true,
  69. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  70. },
  71. upOption: {
  72. onScroll:false,
  73. use: true, // 是否启用上拉加载; 默认true
  74. page: {
  75. pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  76. size: 10 // 每页数据的数量,默认10
  77. },
  78. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  79. textNoMore:"已经到底了",
  80. empty: {
  81. icon:'https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png',
  82. tip: '暂无数据'
  83. }
  84. },
  85. dataList: []
  86. }
  87. },
  88. onLoad() {
  89. var that=this;
  90. uni.$on('refreshFollowList', () => {
  91. that.mescroll.resetUpScroll()
  92. })
  93. },
  94. onShow() {
  95. },
  96. methods: {
  97. doFoloow(item){
  98. uni.navigateTo({
  99. url: "./doFollow?followId="+item.followId
  100. })
  101. },
  102. showDetails(item){
  103. uni.navigateTo({
  104. url: "./followDetails?followId="+item.followId
  105. })
  106. },
  107. statusChange(item){
  108. this.writeStatus=item.id
  109. console.log(item)
  110. this.mescroll.resetUpScroll()
  111. },
  112. navTo(url){
  113. uni.navigateTo({
  114. url: url
  115. })
  116. },
  117. mescrollInit(mescroll) {
  118. this.mescroll = mescroll;
  119. },
  120. /*下拉刷新的回调 */
  121. downCallback() {
  122. this.mescroll.resetUpScroll()
  123. },
  124. /*上拉加载的回调*/
  125. upCallback(page) {
  126. //联网加载数据
  127. var that = this;
  128. var data = {
  129. pageNum: page.num,
  130. pageSize: page.size
  131. };
  132. if(this.writeStatus!=-1){
  133. data.writeStatus=this.writeStatus
  134. }
  135. getFollowList(data).then(res => {
  136. if(res.code==200){
  137. if (page.num == 1) {
  138. that.dataList = res.data.list;
  139. } else {
  140. that.dataList = that.dataList.concat(res.data.list);
  141. }
  142. that.mescroll.endBySize(res.data.list.length, res.data.total);
  143. }else{
  144. uni.showToast({
  145. icon:'none',
  146. title: "请求失败",
  147. });
  148. that.dataList = null;
  149. that.mescroll.endErr();
  150. }
  151. });
  152. },
  153. }
  154. }
  155. </script>
  156. <style lang="scss">
  157. page{
  158. height: 100%;
  159. background: #f6f6f6;
  160. }
  161. </style>
  162. <style scoped lang="scss">
  163. .content{
  164. height: 100%;
  165. .top-fixed{
  166. width: 100%;
  167. position: fixed;
  168. top: 0;
  169. left: 0;
  170. z-index: 10;
  171. height: 88upx;
  172. background-color: #fff;
  173. }
  174. .order-list{
  175. width: 100%;
  176. padding: 15rpx;
  177. display: flex;
  178. flex-direction: column;
  179. align-items: flex-start;
  180. justify-content: flex-start;
  181. .order-item{
  182. margin-bottom: 20rpx;
  183. width: 100%;
  184. padding: 20rpx;
  185. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  186. background-color: #fff;
  187. border-radius: 15rpx;
  188. display: flex;
  189. flex-direction: column;
  190. align-items: flex-start;
  191. justify-content: flex-start;
  192. .order-top{
  193. display: flex;
  194. align-items: center;
  195. justify-content: space-between;
  196. width: 100%;
  197. padding-bottom: 15rpx;
  198. border-bottom: 1px solid #efefef;
  199. .left{
  200. display: flex;
  201. align-items: center;
  202. justify-content: flex-start;
  203. .title{
  204. font-size: 32upx;
  205. font-family: PingFang SC;
  206. font-weight: bold;
  207. color: #111111;
  208. }
  209. }
  210. .status{
  211. font-size: 28upx;
  212. font-family: PingFang SC;
  213. }
  214. .red{
  215. color: #db5053;
  216. }
  217. .green{
  218. color: #C39A58;
  219. }
  220. }
  221. .order-cont{
  222. width: 100%;
  223. margin-top: 20rpx;
  224. .order-time-box{
  225. width: 100%;
  226. display: flex;
  227. align-items: center;
  228. justify-content: space-between;
  229. .order-time{
  230. display: flex;
  231. align-items: center;
  232. justify-content: flex-start;
  233. .time{
  234. font-size: 28upx;
  235. font-family: PingFang SC;
  236. color: #9a9a9c;
  237. }
  238. .count{
  239. margin-left: 10rpx;
  240. font-size: 28upx;
  241. font-family: PingFang SC;
  242. color: #111;
  243. }
  244. }
  245. .right{
  246. .btn{
  247. padding: 10rpx 30rpx;
  248. font-size: 28rpx;
  249. border-radius: 30rpx;
  250. }
  251. .red{
  252. background-color: #C39A58;
  253. color: #fff;
  254. }
  255. .green{
  256. border: 1rpx solid #C39A58;
  257. color: #C39A58;
  258. }
  259. }
  260. }
  261. }
  262. }
  263. }
  264. }
  265. </style>