replenishmentList.vue 8.9 KB

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