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

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