replenishmentList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  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. onReady() {
  125. uni.setNavigationBarColor({
  126. frontColor: '#ffffff',
  127. backgroundColor: this.$config('primaryColor')
  128. })
  129. },
  130. onUnload() {
  131. uni.$off('refreshBL')
  132. },
  133. onNavigationBarButtonTap(e) {
  134. if(e.index == 0){
  135. uni.navigateTo({
  136. url: "/pages/soldOut/shelfList"
  137. })
  138. }
  139. },
  140. methods:{
  141. // tabs通知swiper切换
  142. tabsChange(index) {
  143. this.swiperCurrent = index
  144. },
  145. swiperChange(event){
  146. this.action = 'swiperChange'
  147. this.status = 'loading'
  148. },
  149. // swiper-item左右移动,通知tabs的滑块跟随移动
  150. transition(e) {
  151. let dx = e.detail.dx
  152. this.$refs.uTabs.setDx(dx)
  153. },
  154. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  155. // swiper滑动结束,分别设置tabs和swiper的状态
  156. animationfinish(e) {
  157. let current = e.detail.current
  158. let isCurtab = this.current == current
  159. if(this.status!="nomore"){
  160. let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab
  161. if(loadData){
  162. this.$refs.uTabs.setFinishCurrent(current)
  163. this.swiperCurrent = current
  164. this.current = current
  165. this.resetPage()
  166. this.queryByTypeSum(true)
  167. }
  168. }
  169. },
  170. // scroll-view到底部加载更多
  171. onreachBottom() {
  172. this.action = 'onreachBottom'
  173. if(this.list.length < this.total){
  174. this.resetPage()
  175. }else{
  176. this.status = "nomore"
  177. }
  178. },
  179. // 查询列表
  180. getRow (pageNo) {
  181. if (pageNo) {
  182. this.pageNo = pageNo
  183. }
  184. let params = {
  185. pageNo: this.pageNo,
  186. pageSize: this.pageSize,
  187. billState: this.tabList[this.current].status=='ALL'?'':this.tabList[this.current].status
  188. }
  189. this.status = "loading"
  190. shelfReplenishList(params).then(res => {
  191. if (res.status == 200) {
  192. if(this.pageNo>1){
  193. this.list = this.list.concat(res.data.list || [])
  194. }else{
  195. this.list = res.data.list || []
  196. }
  197. this.total = res.data.count || 0
  198. } else {
  199. this.list = []
  200. this.total = 0
  201. this.noDataText = res.message
  202. }
  203. this.status = "loadmore"
  204. })
  205. },
  206. resetPage(){
  207. this.status = 'loading';
  208. // 上划分页
  209. if(this.action == 'onreachBottom'){
  210. this.pageNo += 1
  211. this.getRow()
  212. }
  213. // 左右切换tab
  214. if(this.action == 'swiperChange'){
  215. this.list = []
  216. this.getRow(1)
  217. }
  218. },
  219. // 详细页
  220. viewRow(item){
  221. if(item.billState=='WAIT_CONFIRM'){ // 待确认
  222. uni.navigateTo({ url: "/pages/replenishmentManage/confirm?sn="+item.replenishBillSn })
  223. }else if(item.billState=='WAIT_OUT_STOCK'){ // 待出库
  224. uni.navigateTo({ url: "/pages/replenishmentManage/outWarehousing?sn="+item.replenishBillSn })
  225. }else if(item.billState=='WAIT_CHECK'){ // 待签收
  226. uni.navigateTo({ url: "/pages/replenishmentManage/signWarehousing?sn="+item.replenishBillSn })
  227. }else if(item.billState=='FINISH'){ // 已完成
  228. uni.navigateTo({ url: "/pages/replenishmentManage/detail?sn="+item.replenishBillSn+"&type=success" })
  229. }else if(item.billState=='CANCEL'){ // 已取消
  230. uni.navigateTo({ url: "/pages/replenishmentManage/detail?sn="+item.replenishBillSn+"&type=cancel" })
  231. }
  232. },
  233. // 取消补货单
  234. handleCancelOrder (row) {
  235. const _this = this;
  236. clzConfirm({
  237. title: '提示',
  238. content: '确认取消补货单吗?',
  239. success: function(res) {
  240. if (res.confirm || res.index == 0) {
  241. _this.showLoading('正在取消...')
  242. shelfReplenishCancel({ replenishBillSn: row.replenishBillSn }).then(res => {
  243. if (res.status == 200) {
  244. _this.toashMsg(res.message)
  245. _this.queryByTypeSum()
  246. }
  247. uni.hideLoading()
  248. })
  249. }
  250. }
  251. });
  252. },
  253. // 删除补货单
  254. handleDelOrder(row){
  255. const _this = this;
  256. clzConfirm({
  257. title: '提示',
  258. content: '确认删除补货单吗?',
  259. success: function(res) {
  260. if (res.confirm || res.index == 0) {
  261. _this.showLoading('正在删除...')
  262. shelfReplenishDelete({ replenishBillSn: row.replenishBillSn }).then(res => {
  263. if (res.status == 200) {
  264. _this.toashMsg(res.message)
  265. _this.queryByTypeSum()
  266. }
  267. uni.hideLoading()
  268. })
  269. }
  270. }
  271. });
  272. },
  273. // 查询每个状态的数据条数
  274. queryByTypeSum (flag) {
  275. shelfReplenishStateCount({}).then(res => {
  276. if (res.data && res.status == 200) {
  277. // this.tabList[1].count = res.data.WAIT_CONFIRM || 0
  278. this.tabList[1].count = res.data.WAIT_OUT_STOCK || 0
  279. this.tabList[2].count = res.data.WAIT_CHECK || 0
  280. if(!flag){
  281. this.getRow(1)
  282. }
  283. }
  284. })
  285. },
  286. refreshBhList(tab){
  287. const _this = this
  288. const index = this.tabList.findIndex(item => item.status == tab)
  289. _this.tabsChange(index)
  290. },
  291. print(item){
  292. this.tempData = item
  293. this.printModal=true
  294. },
  295. // 打印贴签 confirm
  296. modalPrint(type){
  297. this.printModal = false
  298. if(type == 'manual'){ // 手动打印
  299. uni.navigateTo({ url: "/pages/replenishmentManage/manualPrint?sn="+this.tempData.replenishBillSn })
  300. }else if(type == 'scan'){ // 扫码打印
  301. uni.navigateTo({ url: "/pages/replenishmentManage/scanCodePrint?sn="+this.tempData.replenishBillSn })
  302. }
  303. },
  304. }
  305. }
  306. </script>
  307. <style lang="scss">
  308. page {
  309. height: 100%;
  310. }
  311. .pagesCons{
  312. width: 100%;
  313. height: 100%;
  314. display: flex;
  315. flex-direction: column;
  316. .text-right {
  317. text-align: right;
  318. }
  319. .utabs{
  320. border-bottom: 1px solid #eee;
  321. }
  322. .check-list{
  323. flex: 1;
  324. .swiper-item{
  325. width: 100%;
  326. height: 100%;
  327. overflow: hidden;
  328. .scroll-view {
  329. width: 100%;
  330. height: 100%;
  331. overflow: auto;
  332. }
  333. }
  334. }
  335. // 列表样式
  336. .check-order-list{
  337. background: #ffffff;
  338. padding: 20upx 30upx;
  339. margin: 20upx;
  340. border-radius: 20upx;
  341. box-shadow: 1px 1px 3px #EEEEEE;
  342. .check-row{
  343. display: flex;
  344. justify-content: space-between;
  345. margin-bottom: 10rpx;
  346. >view{
  347. &:first-child{
  348. color: #222;
  349. font-size: 32rpx;
  350. width: 80%;
  351. }
  352. &:last-child{
  353. font-size: 28rpx;
  354. margin-top: 5rpx;
  355. }
  356. }
  357. }
  358. .check-col{
  359. > view{
  360. padding: 2rpx 0;
  361. font-size: 28rpx;
  362. color: #666666;
  363. }
  364. }
  365. .ptools{
  366. color: #707070;
  367. .print{
  368. padding: 0 10rpx 0 30rpx;
  369. }
  370. }
  371. }
  372. }
  373. </style>