replenishmentList.vue 11 KB

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