shuntBackList.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <view class="pagesCons">
  3. <view class="utabs">
  4. <u-tabs-swiper ref="uTabs" :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. <text style="margin-right: 0.5rem;">{{item.shelfInfo&&item.shelfInfo.shelfName}}</text>
  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.recallBillNo}}</view>
  28. <view>
  29. <view v-if="item.billState=='FINISH'">实退数量:<text>{{(item.totalConfirmQty || item.totalConfirmQty==0)?item.totalConfirmQty:'--'}}</text></view>
  30. <view v-else>调回数量:<text>{{(item.totalQty || item.totalQty==0)?item.totalQty:'--'}}</text></view>
  31. </view>
  32. <view>{{item.createDate}}</view>
  33. </view>
  34. </view>
  35. <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>
  36. <view v-if="index==current" style="padding: 20upx;">
  37. <u-loadmore :load-text="$config('loadText')" v-if="total>pageSize || status=='loading'" :status="status" />
  38. </view>
  39. </scroll-view>
  40. </swiper-item>
  41. </swiper>
  42. </view>
  43. </template>
  44. <script>
  45. import { queryStateCount, shelfRecallList } from '@/api/shelfRecall.js'
  46. export default {
  47. components: {
  48. },
  49. data() {
  50. return {
  51. status: 'loadmore',
  52. noDataText: '暂无数据',
  53. tabList: [
  54. {
  55. dispName: '全部',
  56. status: 'ALL'
  57. },
  58. {
  59. dispName: '待退库',
  60. status: 'WAIT_CONFIRM',
  61. count: 0
  62. },
  63. {
  64. dispName: '已完成',
  65. status: 'FINISH'
  66. },
  67. {
  68. dispName: '已取消',
  69. status: 'CANCEL'
  70. }
  71. ],
  72. current: 0,
  73. swiperCurrent: 0,
  74. pageNo: 1,
  75. pageSize: 6,
  76. list: [],
  77. total: 0,
  78. action:'swiperChange', // 操作类型,上划分页,或左右滑动
  79. }
  80. },
  81. onLoad(options) {
  82. const _this = this
  83. uni.setNavigationBarColor({
  84. frontColor: '#ffffff',
  85. backgroundColor: this.$config('primaryColor')
  86. })
  87. if(options&&options.billState){ // 指定单据状态
  88. this.tabList.map((item,index) => {
  89. if(item.status == options.billState){
  90. _this.swiperCurrent = index
  91. _this.current = index
  92. }
  93. })
  94. }else{
  95. _this.swiperCurrent = 0
  96. _this.current = 0
  97. }
  98. // 监听整改完成后刷新事件
  99. uni.$on('refreshBL', this.pageInit)
  100. },
  101. onShow() {
  102. this.pageInit()
  103. },
  104. onNavigationBarButtonTap(){
  105. uni.navigateTo({
  106. url:'/pages/shuntBackManage/shelfList'
  107. })
  108. },
  109. onUnload() {
  110. uni.$off('refreshBL')
  111. },
  112. methods:{
  113. pageInit(){
  114. queryStateCount({}).then(res =>{
  115. if(res.status==200 && res.data){
  116. this.tabList[1].count = res.data.WAIT_CONFIRM || 0
  117. this.getRow(1)
  118. }else{
  119. this.getRow(1)
  120. }
  121. })
  122. },
  123. // tabs通知swiper切换
  124. tabsChange(index) {
  125. this.swiperCurrent = index
  126. },
  127. swiperChange(event){
  128. this.action = 'swiperChange'
  129. this.status = 'loading'
  130. },
  131. // swiper-item左右移动,通知tabs的滑块跟随移动
  132. transition(e) {
  133. let dx = e.detail.dx
  134. this.$refs.uTabs.setDx(dx)
  135. },
  136. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  137. // swiper滑动结束,分别设置tabs和swiper的状态
  138. animationfinish(e) {
  139. let current = e.detail.current
  140. let isCurtab = this.current == current
  141. if(this.status!="nomore"){
  142. let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab
  143. if(loadData){
  144. this.$refs.uTabs.setFinishCurrent(current)
  145. this.swiperCurrent = current
  146. this.current = current
  147. this.resetPage()
  148. }
  149. }
  150. },
  151. // scroll-view到底部加载更多
  152. onreachBottom() {
  153. this.action = 'onreachBottom'
  154. if(this.list.length < this.total){
  155. this.resetPage()
  156. }else{
  157. this.status = "nomore"
  158. }
  159. },
  160. // 查询列表
  161. getRow (pageNo) {
  162. if (pageNo) {
  163. this.pageNo = pageNo
  164. }
  165. let params = {
  166. pageNo: this.pageNo,
  167. pageSize: this.pageSize,
  168. billState: this.tabList[this.current].status=='ALL'?'':this.tabList[this.current].status
  169. }
  170. this.status = "loading"
  171. shelfRecallList(params).then(res => {
  172. if (res.status == 200) {
  173. if(this.pageNo>1){
  174. this.list = this.list.concat(res.data.list || [])
  175. }else{
  176. this.list = res.data.list || []
  177. }
  178. this.total = res.data.count || 0
  179. } else {
  180. this.list = []
  181. this.total = 0
  182. this.noDataText = res.message
  183. }
  184. this.status = "loadmore"
  185. })
  186. },
  187. resetPage(){
  188. this.status = 'loading';
  189. // 上划分页
  190. if(this.action == 'onreachBottom'){
  191. this.pageNo += 1
  192. this.getRow()
  193. }
  194. // 左右切换tab
  195. if(this.action == 'swiperChange'){
  196. this.list = []
  197. this.getRow(1)
  198. }
  199. },
  200. // 详细页
  201. viewRow(item){
  202. if(item.billState=='WAIT_CONFIRM'){ // 待退库
  203. uni.navigateTo({ url: "/pages/shuntBackManage/cancellingStocks?sn="+item.recallBillSn })
  204. }else if(item.billState=='FINISH'){ // 已完成
  205. uni.navigateTo({ url: "/pages/shuntBackManage/detail?sn="+item.recallBillSn+"&type=success" })
  206. }else if(item.billState=='CANCEL'){ // 已取消
  207. uni.navigateTo({ url: "/pages/shuntBackManage/detail?sn="+item.recallBillSn+"&type=cancel" })
  208. }
  209. }
  210. }
  211. }
  212. </script>
  213. <style lang="scss">
  214. page {
  215. height: 100%;
  216. }
  217. .pagesCons{
  218. width: 100%;
  219. height: 100%;
  220. display: flex;
  221. flex-direction: column;
  222. .text-right {
  223. text-align: right;
  224. }
  225. .utabs{
  226. border-bottom: 1px solid #eee;
  227. }
  228. .check-list{
  229. flex: 1;
  230. .swiper-item{
  231. width: 100%;
  232. height: 100%;
  233. overflow: hidden;
  234. .scroll-view {
  235. width: 100%;
  236. height: 100%;
  237. overflow: auto;
  238. }
  239. }
  240. }
  241. // 列表样式
  242. .check-order-list{
  243. background: #ffffff;
  244. padding: 25upx 35upx;
  245. margin: 25upx;
  246. border-radius: 25upx;
  247. box-shadow: 1px 1px 3px #EEEEEE;
  248. .check-row{
  249. display: flex;
  250. justify-content: space-between;
  251. margin-bottom: 10rpx;
  252. >view{
  253. &:first-child{
  254. color: #222;
  255. font-size: 32rpx;
  256. width: 80%;
  257. }
  258. &:last-child{
  259. font-size: 28rpx;
  260. margin-top: 5rpx;
  261. }
  262. }
  263. }
  264. .check-col{
  265. > view{
  266. padding: 2rpx 0;
  267. color: #707070;
  268. font-size: 26rpx;
  269. }
  270. }
  271. }
  272. }
  273. </style>