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

206 lines
5.1 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. name: '已出库',
  68. list: [],
  69. ..._public
  70. }],
  71. page_size: 10,
  72. windowHeight: 0,
  73. stateText: ''
  74. }
  75. },
  76. computed: {
  77. stateClass(){
  78. return function(val){
  79. let class_name = {
  80. '待确认': 'quoted-price',
  81. '已确认': 'wait',
  82. '申请中': 'wait',
  83. '已完成': 'passed',
  84. '已退单': 'refuse'
  85. }
  86. return class_name[val];
  87. }
  88. }
  89. },
  90. onLoad(){
  91. this.windowHeight = uni.getSystemInfoSync().windowHeight;
  92. this.getData();
  93. },
  94. methods: {
  95. // 获取数据
  96. getData(options){
  97. let item = this.tab_list[this.current];
  98. this.$http(this.API.API_CANTEEN_WAREHOUSEOUTLIST,{
  99. page: item.page,
  100. pagesize: this.page_size,
  101. state: this.current
  102. }).then(res => {
  103. let list = res.data.list || [];
  104. let isPage = res.data.hasmore;
  105. item.isPage = isPage;
  106. if(!isPage){
  107. item.loading_class = false;
  108. item.loading_text = '已加载全部数据~';
  109. }
  110. if(options && options.refresh){
  111. item.isRefresher = false;
  112. }
  113. if(item.page == 1){
  114. item.list = list;
  115. }else{
  116. item.list.push(...list);
  117. }
  118. }).catch(err => {
  119. if(options && options.refresh){
  120. item.isRefresher = false;
  121. }
  122. })
  123. },
  124. // tabs切换
  125. tabsChange(current){
  126. this.current = current;
  127. if(this.tab_list[this.current].list.length <= 0){
  128. this.getData({type: this.current});
  129. }
  130. },
  131. // swiper页面切换
  132. swiperChange(event){
  133. this.current = event.detail.current;
  134. if(event.detail.source == '') return; // 如果是被动出发,没有事件类型则不做处理
  135. if(this.tab_list[this.current].list.length <= 0){
  136. this.getData({type: this.current});
  137. }
  138. },
  139. // 页面触底
  140. scrolltolower(){
  141. let item = this.tab_list[this.current];
  142. if(item.isPage){
  143. item.page++;
  144. this.getData({type: this.current});
  145. }
  146. },
  147. // 下拉刷新
  148. onRefresherrefresh(){
  149. this.$u.throttle(() => {
  150. let item = this.tab_list[this.current];
  151. item.isRefresher = true;
  152. item.page = 1;
  153. item.isPage = true;
  154. item.loading_class = true;
  155. item.loading_text = '正在加载中...';
  156. item.list = [];
  157. this.getData({refresh: true,type: this.current});
  158. }, 200);
  159. }
  160. }
  161. }
  162. </script>
  163. <style>
  164. page{
  165. background-color: #f6f6f6;
  166. }
  167. </style>
  168. <style lang="scss" scoped="scoped">
  169. .card{
  170. width: 100%;
  171. height: max-content;
  172. background-color: #FFFFFF;
  173. border-radius: 20rpx;
  174. padding: 10rpx 30rpx;
  175. box-sizing: border-box;
  176. margin-bottom: 30rpx;
  177. .item{
  178. padding: 20rpx 0;
  179. box-sizing: border-box;
  180. width: 100%;
  181. // border-bottom: 1rpx solid #E5E5E5;
  182. font-size: 28rpx;
  183. &:last-child{
  184. border-bottom: none;
  185. }
  186. }
  187. // 已报价,等待审核
  188. .quoted-price{
  189. color: #777777;
  190. }
  191. // 等待报价
  192. .wait{
  193. color: #1833F2;
  194. }
  195. // 已通过审核
  196. .passed{
  197. color: #0BCE5F;
  198. }
  199. // 报价被拒绝
  200. .refuse{
  201. color: #FF0000;
  202. }
  203. }
  204. </style>