shuntBackList.vue 6.9 KB

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