replenishmentList.vue 11 KB

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