replenishmentList.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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 :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. }
  142. }
  143. },
  144. // scroll-view到底部加载更多
  145. onreachBottom() {
  146. this.action = 'onreachBottom'
  147. if(this.list.length < this.total){
  148. this.resetPage()
  149. }else{
  150. this.status = "nomore"
  151. }
  152. },
  153. // 查询列表
  154. getRow (pageNo) {
  155. if (pageNo) {
  156. this.pageNo = pageNo
  157. }
  158. let params = {
  159. pageNo: this.pageNo,
  160. pageSize: this.pageSize,
  161. billState: this.tabList[this.current].status=='ALL'?'':this.tabList[this.current].status
  162. }
  163. this.status = "loading"
  164. shelfReplenishList(params).then(res => {
  165. if (res.status == 200) {
  166. if(this.pageNo>1){
  167. this.list = this.list.concat(res.data.list || [])
  168. }else{
  169. this.list = res.data.list || []
  170. }
  171. this.total = res.data.count || 0
  172. } else {
  173. this.list = []
  174. this.total = 0
  175. this.noDataText = res.message
  176. }
  177. this.status = "loadmore"
  178. })
  179. },
  180. resetPage(){
  181. this.status = 'loading';
  182. // 上划分页
  183. if(this.action == 'onreachBottom'){
  184. this.pageNo += 1
  185. this.getRow()
  186. }
  187. // 左右切换tab
  188. if(this.action == 'swiperChange'){
  189. this.list = []
  190. this.getRow(1)
  191. }
  192. },
  193. // 详细页
  194. viewRow(item){
  195. if(item.billState=='WAIT_CONFIRM'){ // 待确认
  196. uni.navigateTo({ url: "/pages/replenishmentManage/confirm?sn="+item.replenishBillSn })
  197. }else if(item.billState=='WAIT_OUT_STOCK'){ // 待出库
  198. uni.navigateTo({ url: "/pages/replenishmentManage/outWarehousing?sn="+item.replenishBillSn })
  199. }else if(item.billState=='WAIT_CHECK'){ // 待签收
  200. uni.navigateTo({ url: "/pages/replenishmentManage/signWarehousing?sn="+item.replenishBillSn })
  201. }else if(item.billState=='FINISH'){ // 已完成
  202. uni.navigateTo({ url: "/pages/replenishmentManage/detail?sn="+item.replenishBillSn+"&type=success" })
  203. }else if(item.billState=='CANCEL'){ // 已取消
  204. uni.navigateTo({ url: "/pages/replenishmentManage/detail?sn="+item.replenishBillSn+"&type=cancel" })
  205. }
  206. },
  207. // 查询每个状态的数据条数
  208. queryByTypeSum () {
  209. shelfReplenishStateCount({}).then(res => {
  210. if (res.data && res.status == 200) {
  211. this.tabList[1].count = res.data.WAIT_CONFIRM || 0
  212. this.tabList[2].count = res.data.WAIT_OUT_STOCK || 0
  213. this.tabList[3].count = res.data.WAIT_CHECK || 0
  214. this.getRow(1)
  215. }
  216. })
  217. },
  218. refreshBhList(tab){
  219. const _this = this
  220. const index = this.tabList.findIndex(item => item.status == tab)
  221. _this.tabsChange(index)
  222. },
  223. print(item){
  224. this.tempData = item
  225. this.printModal=true
  226. },
  227. // 打印贴签 confirm
  228. modalPrint(type){
  229. this.printModal = false
  230. if(type == 'manual'){ // 手动打印
  231. uni.navigateTo({ url: "/pages/replenishmentManage/manualPrint?sn="+this.tempData.replenishBillSn })
  232. }else if(type == 'scan'){ // 扫码打印
  233. uni.navigateTo({ url: "/pages/replenishmentManage/scanCodePrint?sn="+this.tempData.replenishBillSn })
  234. }
  235. },
  236. }
  237. }
  238. </script>
  239. <style lang="scss">
  240. page {
  241. height: 100%;
  242. }
  243. .pagesCons{
  244. width: 100%;
  245. height: 100%;
  246. display: flex;
  247. flex-direction: column;
  248. .text-right {
  249. text-align: right;
  250. }
  251. .utabs{
  252. border-bottom: 1px solid #eee;
  253. }
  254. .check-list{
  255. flex: 1;
  256. .swiper-item{
  257. width: 100%;
  258. height: 100%;
  259. overflow: hidden;
  260. .scroll-view {
  261. width: 100%;
  262. height: 100%;
  263. overflow: auto;
  264. }
  265. }
  266. }
  267. // 列表样式
  268. .check-order-list{
  269. background: #ffffff;
  270. padding: 20upx 30upx;
  271. margin: 20upx;
  272. border-radius: 25upx;
  273. box-shadow: 1px 1px 3px #EEEEEE;
  274. .check-row{
  275. display: flex;
  276. justify-content: space-between;
  277. margin-bottom: 10rpx;
  278. >view{
  279. &:first-child{
  280. color: #222;
  281. font-size: 32rpx;
  282. width: 80%;
  283. }
  284. &:last-child{
  285. font-size: 28rpx;
  286. margin-top: 5rpx;
  287. }
  288. }
  289. }
  290. .check-col{
  291. > view{
  292. padding: 2rpx 0;
  293. font-size: 28rpx;
  294. color: #666666;
  295. }
  296. }
  297. .ptools{
  298. color: #707070;
  299. .print{
  300. padding: 0 10rpx;
  301. }
  302. }
  303. }
  304. }
  305. </style>