自主项目,食堂系统,前端uniapp
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

204 lines
5.2 KiB

  1. <template>
  2. <view>
  3. <view class="tabs">
  4. <u-tabs :list="tab_list" :is-scroll="false" :current="current" bg-color="#f6f6f6" active-color="#1833F2" @change="tabsChange"></u-tabs>
  5. </view>
  6. <swiper :style="{height: 'calc('+ windowHeight +'px - 110rpx)', width: '750rpx'}"
  7. :current="current" @change="swiperChange">
  8. <swiper-item v-for="(tabItem, tabIndex) in tab_list" :key="tabIndex">
  9. <scroll-view class="lf-w-100 lf-h-100 lf-p-l-32 lf-p-r-32 lf-border-box"
  10. :scroll-y="true" :refresher-enabled="true"
  11. refresher-background="#f6f6f6"
  12. @scrolltolower="scrolltolower"
  13. :refresher-triggered="tabItem.isRefresher"
  14. @refresherrefresh="onRefresherrefresh">
  15. <view class="card" v-for="(item, index) in tabItem.list" :key="item.id" @click="$url('/pages/supply/gonghuo/detail?p_sn='+ item.p_sn)">
  16. <view class="lf-row-between item">
  17. <view class="lf-color-gray">采购方</view>
  18. <view class="lf-color-black">{{ item.contact_name }}</view>
  19. </view>
  20. <view class="lf-row-between item">
  21. <view class="lf-color-gray">发单时间</view>
  22. <view class="lf-color-black">{{ item.receiving_start }}</view>
  23. </view>
  24. <view class="lf-row-between item">
  25. <view class="lf-color-gray">送达时间</view>
  26. <view class="lf-color-black">{{ item.receiving_end }}</view>
  27. </view>
  28. <view class="lf-row-between item">
  29. <view class="lf-color-gray">商品种类</view>
  30. <view class="lf-color-black">8</view>
  31. </view>
  32. <view class="lf-row-between item">
  33. <view class="lf-color-gray">订单状态</view>
  34. <view class="quoted-price">{{ item.state }}</view>
  35. </view>
  36. </view>
  37. <view class="loading-more">
  38. <text v-if="tabItem.list.length" :class="{'loading-more-text': tabItem.loading_class}">{{ tabItem.loading_text }}</text>
  39. <lf-nocontent v-else class="lf-m-t-50"></lf-nocontent>
  40. </view>
  41. </scroll-view>
  42. </swiper-item>
  43. </swiper>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. data(){
  49. return {
  50. current: 0,
  51. tab_list: [{
  52. name: '全部',
  53. loading_class: true,
  54. loading_text: '正在加载中...',
  55. page: 1,
  56. isPage: true,
  57. state_name: '',
  58. list: []
  59. },{
  60. name: '待接单',
  61. loading_class: true,
  62. loading_text: '正在加载中...',
  63. page: 1,
  64. isPage: true,
  65. state_name: '待接单',
  66. list: []
  67. },{
  68. name: '待发货',
  69. loading_class: true,
  70. loading_text: '正在加载中...',
  71. page: 1,
  72. isPage: true,
  73. state_name: '待发货',
  74. list: []
  75. },{
  76. name: '已完成',
  77. loading_class: true,
  78. loading_text: '正在加载中...',
  79. page: 1,
  80. isPage: true,
  81. state_name: '已完成',
  82. list: []
  83. },{
  84. name: '已退单',
  85. loading_class: true,
  86. loading_text: '正在加载中...',
  87. page: 1,
  88. isPage: true,
  89. state_name: '已退单',
  90. list: []
  91. }],
  92. page_size: 10,
  93. windowHeight: 0
  94. }
  95. },
  96. onLoad(){
  97. this.windowHeight = uni.getSystemInfoSync().windowHeight;
  98. this.getData();
  99. },
  100. methods: {
  101. getData(options){
  102. let item = this.tab_list[this.current];
  103. this.$http(this.API.API_SUPPLIER_PURCHASEORDERLIST, {
  104. state: item.state_name,
  105. page: item.page,
  106. page_size: this.page_size
  107. }).then(res => {
  108. console.log("res", res);
  109. if(options && options.refresh){
  110. item.isRefresher = false;
  111. }
  112. // item.isPage = res.isPage; // 是否有下一页
  113. if(!item.isPage){
  114. item.loading_class = false;
  115. item.loading_text = '已加载全部数据~'
  116. }
  117. if(item.page == 1){
  118. item.list = res.data.list;
  119. }else{
  120. item.list.push(...res.data.list);
  121. }
  122. })
  123. },
  124. tabsChange(current){
  125. this.current = current;
  126. if(this.tab_list[this.current].list.length <= 0){
  127. this.getData();
  128. }
  129. },
  130. swiperChange(event){
  131. this.current = event.detail.current;
  132. if(event.detail.source == '') return; // 如果是被动出发,没有事件类型则不做处理
  133. if(this.tab_list[this.current].list.length <= 0){
  134. this.getData();
  135. }
  136. },
  137. // 滚动到底部
  138. scrolltolower(){
  139. let item = this.tab_list[this.current];
  140. if(item.isPage){
  141. item.page++;
  142. this.getData();
  143. }
  144. },
  145. // 下拉刷新
  146. onRefresherrefresh(){
  147. this.$u.throttle(() => {
  148. let item = this.tab_list[this.current];
  149. item.isRefresher = true;
  150. item.page = 1;
  151. item.isPage = true;
  152. item.loading_class = true;
  153. item.loading_text = '正在加载中...';
  154. item.list = [];
  155. this.getData({refresh: true});
  156. }, 200);
  157. }
  158. }
  159. }
  160. </script>
  161. <style>
  162. page{
  163. background-color: #f6f6f6;
  164. }
  165. </style>
  166. <style lang="scss" scoped="scoped">
  167. .card{
  168. width: 100%;
  169. height: max-content;
  170. background-color: #FFFFFF;
  171. border-radius: 20rpx;
  172. padding: 0 20rpx;
  173. box-sizing: border-box;
  174. margin-bottom: 30rpx;
  175. .item{
  176. padding: 20rpx 0;
  177. box-sizing: border-box;
  178. width: 100%;
  179. border-bottom: 1rpx solid #E5E5E5;
  180. font-size: 28rpx;
  181. &:last-child{
  182. border-bottom: none;
  183. }
  184. }
  185. // 已报价,等待审核
  186. .quoted-price{
  187. color: #777777;
  188. }
  189. // 等待报价
  190. .wait{
  191. color: #1833F2;
  192. }
  193. // 已通过审核
  194. .passed{
  195. color: #0BCE5F;
  196. }
  197. // 报价被拒绝
  198. .refuse{
  199. color: #FF0000;
  200. }
  201. }
  202. </style>