businessNew.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <view>
  3. <u-navbar back-text="" title="交易" title-size='36' back-icon-name='search' :title-bold='true'
  4. :border-bottom='false' back-icon-color='#333333' title-color='#000000'>
  5. <view class="slot-wrap" slot="right">
  6. 我的关注
  7. </view>
  8. </u-navbar>
  9. <view class="top-warp">
  10. <me-tabs v-model="tabIndex" :tabs="tabs" @change="tabChange"></me-tabs>
  11. </view>
  12. <mescroll-body ref="mescrollRef" @init="mescrollInit" top="80" @down="downCallback" :up="upOption"
  13. @up="upCallback" @emptyclick="emptyClick">
  14. <!-- 数据列表 -->
  15. <view class="list" v-if="goods.length!=0">
  16. <view class="list-item" v-for="(item,index) in goods">
  17. <view class="row1 flex jcsb alc">
  18. <view class="left flex alc">
  19. <image src="../../static/img/face/27.png" mode="widthFix" class="head-img"></image>
  20. <view class="">
  21. <view class="title">
  22. 中天昊元粮库
  23. </view>
  24. <view class="bottom">
  25. <text class="color1">采购</text>
  26. <text class="color2">销售</text>
  27. <text class="color3">5分钟前</text>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="right">
  32. <u-icon name="plus" color="#333333" size="17"></u-icon><text class="case">关注</text>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <!-- <good-list :list="goods"></good-list> -->
  38. </mescroll-body>
  39. </view>
  40. </template>
  41. <script>
  42. import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
  43. import {
  44. apiGoods
  45. } from "@/api/mock.js"
  46. export default {
  47. mixins: [MescrollMixin], // 使用mixin
  48. data() {
  49. return {
  50. upOption: {
  51. // page: {
  52. // num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  53. // size: 10 // 每页数据的数量
  54. // },
  55. noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
  56. empty: {
  57. tip: '~ 搜索无数据 ~', // 提示
  58. btnText: '去看看'
  59. }
  60. },
  61. goods: [], //列表数据
  62. tabs: [{
  63. name: '全部',
  64. type: 'xx'
  65. }, {
  66. name: '采购',
  67. type: 'xx'
  68. }, {
  69. name: '销售',
  70. type: 'xx'
  71. }, {
  72. name: '关注',
  73. type: 'xx'
  74. }],
  75. tabIndex: 0 // tab下标
  76. }
  77. },
  78. onShow() {
  79. uni.showTabBar()
  80. uni.hideKeyboard()
  81. var userInfo = uni.getStorageSync("userInfo")
  82. var that = this
  83. console.log("userInfo", userInfo)
  84. // setTimeout(function() {
  85. // that.$api.doRequest('get', '/appVersion/test', {
  86. // userId: "7e83070d05fc4d50aaa46e00a3ee03d8"
  87. // }).then(res => {
  88. // })
  89. // }, 500);
  90. uni.removeTabBarBadge({
  91. index: 4
  92. })
  93. this.$api.doRequest('get', '/newNoticeTask/query/noticeTasks').then(res => {
  94. if (res.data.data) {
  95. let name = 'myTip';
  96. let value = res.data.data.total;
  97. that.$store.commit('$uStore', {
  98. name,
  99. value
  100. });
  101. if (value != 0 && value) {
  102. uni.setTabBarBadge({
  103. index: 4,
  104. text: value + ""
  105. })
  106. }
  107. name = 'taskTip';
  108. value = res.data.data.total;
  109. that.$store.commit('$uStore', {
  110. name,
  111. value
  112. });
  113. }
  114. })
  115. },
  116. onLoad(options) {
  117. },
  118. methods: {
  119. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  120. upCallback(page) {
  121. //联网加载数据
  122. let curTab = this.tabs[this.tabIndex]
  123. let keyword = curTab.name // 具体项目中,您可能取的是tab中的type,status等字段
  124. apiGoods(page.num, page.size, keyword).then(res => {
  125. //联网成功的回调,隐藏下拉刷新和上拉加载的状态;
  126. this.mescroll.endSuccess(res.list.length);
  127. //设置列表数据
  128. if (page.num == 1) this.goods = []; //如果是第一页需手动制空列表
  129. this.goods = this.goods.concat(res.list); //追加新数据
  130. }).catch(() => {
  131. //联网失败, 结束加载
  132. this.mescroll.endErr();
  133. })
  134. },
  135. //点击空布局按钮的回调
  136. emptyClick() {
  137. uni.showToast({
  138. title: '点击了按钮,具体逻辑自行实现'
  139. })
  140. },
  141. // 切换菜单
  142. tabChange() {
  143. this.goods = [] // 先置空列表,显示加载进度
  144. this.mescroll.resetUpScroll() // 再刷新列表数据
  145. }
  146. }
  147. }
  148. </script>
  149. <style lang='scss'>
  150. page,
  151. .content {
  152. background: #F5F6FA;
  153. }
  154. .flex {
  155. display: flex;
  156. }
  157. .alc {
  158. align-items: center;
  159. }
  160. .jcse {
  161. justify-content: space-evenly;
  162. }
  163. .jcsb {
  164. justify-content: space-between;
  165. }
  166. .top-warp {
  167. z-index: 9990;
  168. position: fixed;
  169. top: --window-top;
  170. /* css变量 */
  171. left: 0;
  172. width: 100%;
  173. /* height: 120upx; */
  174. background-color: white;
  175. }
  176. .top-warp .tip {
  177. font-size: 28upx;
  178. height: 60upx;
  179. line-height: 60upx;
  180. text-align: center;
  181. }
  182. .slot-wrap {
  183. margin-right: 45rpx;
  184. font-size: 32rpx;
  185. }
  186. .list {
  187. margin: 0 20rpx;
  188. .list-item {
  189. padding: 26rpx 17rpx;
  190. background: #fff;
  191. margin-bottom: 20rpx;
  192. border-radius: 20rpx;
  193. .row1 {
  194. .head-img {
  195. width: 72rpx;
  196. background-color: red;
  197. border-radius: 8rpx;
  198. margin-right: 22rpx;
  199. }
  200. .left {
  201. .title {
  202. font-weight: 700;
  203. color: #333333;
  204. }
  205. .bottom {
  206. .color1 {
  207. font-size: 24rpx;
  208. padding: 4rpx 10rpx;
  209. color: #fff;
  210. display: inline-block;
  211. background: linear-gradient(180deg, #607AE0 0%, #516CDC 100%);
  212. border-radius: 4rpx;
  213. }
  214. .color2 {
  215. font-size: 24rpx;
  216. padding: 4rpx 10rpx;
  217. color: #fff;
  218. display: inline-block;
  219. background: linear-gradient(180deg, #FD714F 0%, #FD613C 100%);
  220. border-radius: 4rpx;
  221. }
  222. .color3 {
  223. font-size: 24rpx;
  224. color: #AFB3BF;
  225. margin-left: 14rpx;
  226. }
  227. }
  228. }
  229. .right {
  230. border: 1px solid #CDCDCD;
  231. }
  232. }
  233. }
  234. }
  235. </style>