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

201 lines
5.0 KiB

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