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

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