shuntBackList.vue 6.9 KB

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