自主产品,供应链食堂系统。将两个端拆开了。
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
4.8 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/order/detail?q_sn='+ item.q_sn)">
  16. <view class="lf-row-between upper">
  17. <view class="lf-font-28 lf-color-333">订单状态</view>
  18. <view class="order-btn" :class="stateClass(item.state)">{{ item.state }}</view>
  19. </view>
  20. <view class="lf-row-between lower">
  21. <view>报价单号 {{ item.q_sn }}</view>
  22. <view>{{ item.deadline }}</view>
  23. </view>
  24. </view>
  25. <view class="loading-more">
  26. <text v-if="tabItem.list.length" :class="{'loading-more-text': tabItem.loading_class}">{{ tabItem.loading_text }}</text>
  27. <lf-nocontent v-else class="lf-m-t-50"></lf-nocontent>
  28. </view>
  29. </scroll-view>
  30. </swiper-item>
  31. </swiper>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data(){
  37. let _public = {
  38. loading_class: true,
  39. loading_text: '正在加载中...',
  40. page: 1,
  41. isPage: true,
  42. isRefresher: false, // scroll-view下拉刷新状态,当前默认没有触发
  43. }
  44. return {
  45. current: 0,
  46. tab_list: [{
  47. name: '全部',
  48. state_name: '',
  49. list: [],
  50. ..._public
  51. },{
  52. name: '审核中',
  53. state_name: '待审核',
  54. list: [],
  55. ..._public
  56. },{
  57. name: '已完成',
  58. state_name: '已通过',
  59. list: [],
  60. ..._public
  61. }],
  62. page_size: 10,
  63. windowHeight: 0,
  64. }
  65. },
  66. computed: {
  67. stateClass(){
  68. return function(val){
  69. let class_name = {
  70. '已通过': 'passed',
  71. '待发起': 'wait',
  72. '待审核': 'quoted-price',
  73. '未通过': 'refuse'
  74. }
  75. return class_name[val];
  76. }
  77. }
  78. },
  79. onLoad(){
  80. this.windowHeight = uni.getSystemInfoSync().windowHeight;
  81. this.getData();
  82. },
  83. methods: {
  84. getData(options){
  85. let item = this.tab_list[this.current];
  86. this.$http(this.API.API_SUPPLIER_QUOTATIONORDERLIST, {
  87. state: this.current,
  88. page: item.page,
  89. page_size: this.page_size
  90. }).then(res => {
  91. let list = res.data.list || {};
  92. if(options && options.refresh){
  93. item.isRefresher = false;
  94. }
  95. item.isPage = this.$isRight(list.next_page_url); // 是否有下一页
  96. if(!item.isPage){
  97. item.loading_class = false;
  98. item.loading_text = '已加载全部数据~'
  99. }
  100. if(item.page == 1){
  101. item.list = list.data;
  102. }else{
  103. item.list.push(...list.data);
  104. }
  105. })
  106. },
  107. tabsChange(current){
  108. this.current = current;
  109. if(this.tab_list[this.current].list.length <= 0){
  110. this.getData();
  111. }
  112. },
  113. swiperChange(event){
  114. this.current = event.detail.current;
  115. if(event.detail.source == '') return; // 如果是被动出发,没有事件类型则不做处理
  116. if(this.tab_list[this.current].list.length <= 0){
  117. this.getData();
  118. }
  119. },
  120. // 滚动到底部
  121. scrolltolower(){
  122. let item = this.tab_list[this.current];
  123. if(item.isPage){
  124. item.page++;
  125. this.getData();
  126. }
  127. },
  128. // 下拉刷新
  129. onRefresherrefresh(){
  130. this.$u.throttle(() => {
  131. let item = this.tab_list[this.current];
  132. item.isRefresher = true;
  133. item.page = 1;
  134. item.isPage = true;
  135. item.loading_class = true;
  136. item.loading_text = '正在加载中...';
  137. item.list = [];
  138. this.getData({refresh: true});
  139. }, 200);
  140. }
  141. }
  142. }
  143. </script>
  144. <style>
  145. page{
  146. background-color: #f6f6f6;
  147. }
  148. </style>
  149. <style lang="scss" scoped="scoped">
  150. .card{
  151. width: 100%;
  152. height: max-content;
  153. background-color: #FFFFFF;
  154. border-radius: 20rpx;
  155. padding: 0 20rpx;
  156. box-sizing: border-box;
  157. margin-bottom: 30rpx;
  158. .upper{
  159. width: 100%;
  160. padding: 20rpx 0;
  161. border-bottom: 1rpx solid #e5e5e5;
  162. box-sizing: border-box;
  163. .order-btn{
  164. width: max-content;
  165. height: 62rpx;
  166. border-radius: 32rpx;
  167. // border: 2rpx solid #777777;
  168. // padding: 0 20rpx;
  169. line-height: 60rpx;
  170. font-size: 28rpx;
  171. }
  172. // 已通过
  173. .quoted-price{
  174. color: #777777;
  175. }
  176. // 待发起
  177. .wait{
  178. color: #1833F2;
  179. }
  180. // 待审核
  181. .passed{
  182. color: #0BCE5F;
  183. }
  184. // 未通过
  185. .refuse{
  186. color: #FF0000;
  187. }
  188. }
  189. .lower{
  190. padding: 20rpx 0;
  191. font-size: 24rpx;
  192. color: #777777;
  193. }
  194. }
  195. </style>