shuntBackList.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <view class="pagesCons">
  3. <view class="utabs">
  4. <u-tabs-swiper ref="uTabs" :list="tabList" name="dispName" :current="current" @change="tabsChange" :is-scroll="false"
  5. swiperWidth="750"></u-tabs-swiper>
  6. </view>
  7. <swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
  8. <swiper-item class="swiper-item" v-for="(tabs, index) in tabList" :key="index">
  9. <scroll-view scroll-y class="scroll-view" @scrolltolower="onreachBottom">
  10. <view
  11. class="check-order-list"
  12. v-if="index==current"
  13. v-for="(item,sindex) in list"
  14. :key="item.id+'-'+sindex"
  15. @click="viewRow(item)"
  16. >
  17. <view class="check-row">
  18. <view>{{item.shelfName}}</view>
  19. <view>
  20. <text :style="{color:$config('errorColor')}">待退库</text>
  21. </view>
  22. </view>
  23. <view class="check-col">
  24. <view>调货单号:{{item.recallBillNo}}</view>
  25. <view>调回数量:{{item.totalConfirmQty}}</view>
  26. <view>{{item.createDate}}</view>
  27. </view>
  28. </view>
  29. <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="240" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
  30. <view v-if="index==current" style="padding: 20upx;">
  31. <u-loadmore :load-text="$config('loadText')" v-if="total>pageSize || status=='loading'" :status="status" />
  32. </view>
  33. </scroll-view>
  34. </swiper-item>
  35. </swiper>
  36. </view>
  37. </template>
  38. <script>
  39. import { queryStateCount, shelfRecallList } from '@/api/shelfRecall.js'
  40. export default {
  41. components: {
  42. },
  43. data() {
  44. return {
  45. status: 'loadmore',
  46. noDataText: '暂无数据',
  47. tabList: [
  48. {
  49. dispName: '全部',
  50. typeId: 0,
  51. status: ''
  52. },
  53. {
  54. dispName: '待退库',
  55. typeId: 1,
  56. status: '',
  57. count: 12
  58. },
  59. {
  60. dispName: '已完成',
  61. typeId: 2,
  62. status: ''
  63. },
  64. {
  65. dispName: '已取消',
  66. typeId: 3,
  67. status: ''
  68. },
  69. ],
  70. current: 0,
  71. swiperCurrent: 0,
  72. pageNo: 1,
  73. pageSize: 6,
  74. list: [],
  75. total: 0,
  76. action:'swiperChange', // 操作类型,上划分页,或左右滑动
  77. }
  78. },
  79. onLoad() {
  80. // 监听整改完成后刷新事件
  81. uni.$on('refreshBL',this.pageInit)
  82. this.pageInit()
  83. },
  84. onUnload() {
  85. uni.$off('refreshBL')
  86. },
  87. methods:{
  88. pageInit(){
  89. queryStateCount({billState:'待退货'}).then(res =>{
  90. this.tabList[1].count = res.data.totalConfirmQty
  91. this.getRow(1)
  92. })
  93. },
  94. // tabs通知swiper切换
  95. tabsChange(index) {
  96. this.swiperCurrent = index;
  97. },
  98. swiperChange(event){
  99. this.action = 'swiperChange'
  100. this.status = 'loading'
  101. },
  102. // swiper-item左右移动,通知tabs的滑块跟随移动
  103. transition(e) {
  104. let dx = e.detail.dx;
  105. this.$refs.uTabs.setDx(dx);
  106. },
  107. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  108. // swiper滑动结束,分别设置tabs和swiper的状态
  109. animationfinish(e) {
  110. let current = e.detail.current;
  111. let isCurtab = this.current == current
  112. if(this.status!="nomore"){
  113. let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab;
  114. if(loadData){
  115. this.$refs.uTabs.setFinishCurrent(current);
  116. this.swiperCurrent = current;
  117. this.current = current;
  118. this.resetPage();
  119. }
  120. }
  121. },
  122. // scroll-view到底部加载更多
  123. onreachBottom() {
  124. this.action = 'onreachBottom'
  125. if(this.list.length < this.total){
  126. this.resetPage()
  127. }else{
  128. this.status = "nomore"
  129. }
  130. },
  131. // 查询列表
  132. getRow (pageNo) {
  133. if (pageNo) {
  134. this.pageNo = pageNo
  135. }
  136. let params = {
  137. pageNo: this.pageNo,
  138. pageSize: this.pageSize,
  139. billState: this.tabList[this.current].status,
  140. }
  141. this.status = "loading"
  142. shelfRecallList(params).then(res => {
  143. if (res.status == 200) {
  144. if(this.pageNo>1){
  145. this.list = this.list.concat(res.data.list || [])
  146. }else{
  147. this.list = res.data.list || []
  148. }
  149. this.total = res.data.count || 0
  150. } else {
  151. this.list = []
  152. this.total = 0
  153. this.noDataText = res.message
  154. }
  155. this.status = "loadmore"
  156. })
  157. },
  158. resetPage(){
  159. this.status = 'loading';
  160. // 上划分页
  161. if(this.action == 'onreachBottom'){
  162. this.pageNo += 1
  163. this.getRow()
  164. }
  165. // 左右切换tab
  166. if(this.action == 'swiperChange'){
  167. this.list = [];
  168. this.getRow(1);
  169. }
  170. },
  171. // 待退库
  172. viewRow(item){
  173. // 已完成的
  174. uni.navigateTo({
  175. url: "/pages/shuntBackManage/cancellingStocks?recallBillSn="+item.recallBillSn
  176. })
  177. },
  178. // 状态颜色处理
  179. clsStatus(status){
  180. if(status == 'CHECK_PENDING'){
  181. return 'dsh'
  182. }
  183. if(status == 'PENDING'){
  184. return 'dzg'
  185. }
  186. if(status == 'FINISHED'){
  187. return 'ywc'
  188. }
  189. if(status == 'EXPIRED'){
  190. return 'ygq'
  191. }
  192. }
  193. }
  194. }
  195. </script>
  196. <style lang="scss">
  197. page {
  198. height: 100%;
  199. }
  200. .pagesCons{
  201. width: 100%;
  202. height: 100%;
  203. display: flex;
  204. flex-direction: column;
  205. .text-right {
  206. text-align: right;
  207. }
  208. .utabs{
  209. border-bottom: 1px solid #eee;
  210. }
  211. .check-list{
  212. flex: 1;
  213. .swiper-item{
  214. width: 100%;
  215. height: 100%;
  216. overflow: hidden;
  217. .scroll-view {
  218. width: 100%;
  219. height: 100%;
  220. overflow: auto;
  221. }
  222. }
  223. }
  224. // 列表样式
  225. .check-order-list{
  226. background: #ffffff;
  227. padding: 25upx 35upx;
  228. margin: 25upx;
  229. border-radius: 25upx;
  230. box-shadow: 1px 1px 3px #EEEEEE;
  231. .check-row{
  232. display: flex;
  233. justify-content: space-between;
  234. margin-bottom: 10rpx;
  235. >view{
  236. &:first-child{
  237. color: #222;
  238. font-size: 32rpx;
  239. width: 80%;
  240. }
  241. &:last-child{
  242. font-size: 28rpx;
  243. margin-top: 5rpx;
  244. }
  245. }
  246. }
  247. .check-col{
  248. > view{
  249. padding: 2rpx 0;
  250. color: #707070;
  251. font-size: 26rpx;
  252. }
  253. }
  254. }
  255. }
  256. </style>