replenishmentList.vue 11 KB

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