replenishmentList.vue 7.3 KB

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