followList.vue 6.1 KB

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