replenishmentList.vue 7.6 KB

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