shuntBackList.vue 6.8 KB

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