replenishmentList.vue 9.8 KB

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