replenishmentList.vue 7.4 KB

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