replenishmentList.vue 9.8 KB

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