replenishmentList.vue 7.4 KB

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