自主产品,供应链食堂系统。将两个端拆开了。
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.

198 lines
5.0 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="#11D189" @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/delivery/detail?id='+ item.id)">
  16. <view class="lf-row-between item">
  17. <view class="lf-color-gray">申请人</view>
  18. <view class="lf-color-black">{{ item.o_name }}</view>
  19. </view>
  20. <view class="lf-row-between item">
  21. <view class="lf-color-gray">申请时间</view>
  22. <!-- todo 申请时间和种类 -->
  23. <view class="lf-color-black">{{ item.o_sn }}</view>
  24. </view>
  25. <view class="lf-row-between item">
  26. <view class="lf-color-gray">商品种类</view>
  27. <view class="lf-color-black">8</view>
  28. </view>
  29. <view class="lf-row-between item">
  30. <view class="lf-color-gray">订单状态</view>
  31. <view class="quoted-price">{{ item.state }}</view>
  32. </view>
  33. </view>
  34. <view class="loading-more">
  35. <text v-if="tabItem.list.length" :class="{'loading-more-text': tabItem.loading_class}">{{ tabItem.loading_text }}</text>
  36. <lf-nocontent v-else class="lf-m-t-50"></lf-nocontent>
  37. </view>
  38. </scroll-view>
  39. </swiper-item>
  40. </swiper>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. data(){
  46. let _public = {
  47. loading_class: true,
  48. loading_text: '正在加载中...',
  49. page: 1,
  50. isPage: true,
  51. isRefresher: false
  52. };
  53. return {
  54. current: 0,
  55. tab_list: [{
  56. name: '全部',
  57. list: [],
  58. ..._public
  59. },{
  60. name: '申请中',
  61. list: [],
  62. ..._public
  63. },{
  64. name: '已出库',
  65. list: [],
  66. ..._public
  67. }],
  68. page_size: 10,
  69. windowHeight: 0
  70. }
  71. },
  72. computed: {
  73. // TODO 动态设置class,对不同的状态设置不同的展示颜色
  74. stateClass(){
  75. return function(val){
  76. let class_name = {
  77. '等待接单': 'quoted-price',
  78. '等待发货': 'wait',
  79. '已完成': 'passed',
  80. '已退单': 'refuse'
  81. }
  82. return class_name[val];
  83. }
  84. }
  85. },
  86. onLoad(){
  87. this.windowHeight = uni.getSystemInfoSync().windowHeight;
  88. this.getData();
  89. },
  90. methods: {
  91. // 获取数据 TODO 目前接口还没有数据
  92. getData(options){
  93. let item = this.tab_list[this.current];
  94. this.$http(this.API.API_CANTEEN_WAREHOUSEOUTLIST).then(res => {
  95. console.log("getData", res);
  96. this.tab_list[this.current].list = res.data.list || [];
  97. let list = res.data.list || [];
  98. // let isPage res.data.isPage;
  99. // if(!isPage){
  100. // item.loading_class = false;
  101. // item.loading_text = '已加载全部数据~';
  102. // }
  103. // item.isPage = isPage;
  104. if(options && options.refresh){
  105. item.isRefresher = false;
  106. }
  107. if(item.page == 1){
  108. item.list = list;
  109. }else{
  110. item.list.push(...list);
  111. }
  112. });
  113. },
  114. // tabs切换
  115. tabsChange(current){
  116. this.current = current;
  117. if(this.tab_list[this.current].list.length <= 0){
  118. this.getData();
  119. }
  120. },
  121. // swiper页面切换
  122. swiperChange(event){
  123. this.current = event.detail.current;
  124. if(event.detail.source == '') return; // 如果是被动出发,没有事件类型则不做处理
  125. if(this.tab_list[this.current].list.length <= 0){
  126. this.getData();
  127. }
  128. },
  129. // 页面触底
  130. scrolltolower(){
  131. let item = this.tab_list[this.current];
  132. if(item.isPage){
  133. item.page++;
  134. this.getData();
  135. }
  136. },
  137. // 下拉刷新
  138. onRefresherrefresh(){
  139. this.$u.throttle(() => {
  140. let item = this.tab_list[this.current];
  141. item.isRefresher = true;
  142. item.page = 1;
  143. item.isPage = true;
  144. item.loading_class = true;
  145. item.loading_text = '正在加载中...';
  146. item.list = [];
  147. this.getData({refresh: true});
  148. }, 200);
  149. }
  150. }
  151. }
  152. </script>
  153. <style>
  154. page{
  155. background-color: #f6f6f6;
  156. }
  157. </style>
  158. <style lang="scss" scoped="scoped">
  159. .card{
  160. width: 100%;
  161. height: max-content;
  162. background-color: #FFFFFF;
  163. border-radius: 20rpx;
  164. padding: 0 20rpx;
  165. box-sizing: border-box;
  166. margin-bottom: 30rpx;
  167. .item{
  168. padding: 20rpx 0;
  169. box-sizing: border-box;
  170. width: 100%;
  171. border-bottom: 1rpx solid #E5E5E5;
  172. font-size: 28rpx;
  173. &:last-child{
  174. border-bottom: none;
  175. }
  176. }
  177. // 已报价,等待审核
  178. .quoted-price{
  179. color: #777777;
  180. }
  181. // 等待报价
  182. .wait{
  183. color: #1833F2;
  184. }
  185. // 已通过审核
  186. .passed{
  187. color: #0BCE5F;
  188. }
  189. // 报价被拒绝
  190. .refuse{
  191. color: #FF0000;
  192. }
  193. }
  194. </style>