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

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