replenishmentList.vue 11 KB

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