shuntBackList.vue 7.0 KB

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