replenishmentList.vue 11 KB

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