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

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