procureOrderList.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <view class="digitShelf-pagesCons">
  3. <view class="tab-body">
  4. <view>
  5. <u-tabs-swiper ref="uTabs" :list="tabList" :offset="[5,40]" bar-width='100' active-color="#1283d4" name="dispName" :current="current" @change="tabsChange" :is-scroll="false"
  6. swiperWidth="750"></u-tabs-swiper>
  7. </view>
  8. <swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
  9. <swiper-item class="swiper-item" style="height: 100%;width: 100%;overflow: hidden;" v-for="(tabs, indexs) in tabList" :key="indexs">
  10. <scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom" v-if="swiperCurrent == indexs">
  11. <view
  12. class="check-order-list"
  13. v-for="(item,index) in list"
  14. :key="item.id"
  15. @click="viewRow(item)"
  16. >
  17. <view class="check-row align-center justify_between">
  18. <view class="orderNo">{{item.purchaseNo}}</view>
  19. <view class="times">{{item.createDate}}</view>
  20. </view>
  21. <view class="check-row flex align-center justify_between">
  22. <view>总款数:{{item.totalCategory}}</view>
  23. <view>总金额:<text class="price">¥{{item.totalAmount}}</text></view>
  24. </view>
  25. <view class="check-row">
  26. <view class="nums">
  27. 共{{item.totalQty}}件商品
  28. </view>
  29. <view style="text-align: right;">
  30. <span v-if="item.billStatus == 'WAIT_AUDIT'">待审核</span>
  31. <span v-if="item.billStatus == 'AUDIT_REJECT'">审核不通过</span>
  32. <span v-if="item.billStatus == 'WAIT_OUT_WAREHOUSE'">待收货</span>
  33. <span v-if="item.billStatus == 'FINISH'">已完结</span>
  34. </view>
  35. </view>
  36. </view>
  37. <view style="padding: 20upx;">
  38. <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
  39. <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
  40. </view>
  41. </scroll-view>
  42. </swiper-item>
  43. </swiper>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import { purchaseQueryPage } from '@/api/purchase.js'
  49. export default {
  50. data() {
  51. return {
  52. status: 'loading',
  53. noDataText: '暂无数据',
  54. tabList: [
  55. {
  56. dispName: '全部',
  57. typeId: 1,
  58. count: 0
  59. },
  60. {
  61. dispName: '待收货',
  62. typeId: 2,
  63. count: 0
  64. },
  65. {
  66. dispName: '已完结',
  67. typeId: 3,
  68. count: 0
  69. },
  70. ],
  71. current: 1,
  72. swiperCurrent: 1,
  73. // 查询条件
  74. pageNo: 1,
  75. pageSize: 10,
  76. list: [],
  77. total: 0,
  78. }
  79. },
  80. onLoad() {
  81. this.$store.state.vuex_tempData = null
  82. let _this = this
  83. _this.pageInit()
  84. uni.$on('refreshOrder',function(data){
  85. _this.list = []
  86. _this.status = "loading"
  87. _this.pageInit()
  88. })
  89. },
  90. methods:{
  91. message(title){
  92. uni.showToast({
  93. icon:'none',
  94. title: title
  95. })
  96. },
  97. pageInit(){
  98. this.total = 0
  99. this.pageNo = 1
  100. this.getRow()
  101. },
  102. // tabs通知swiper切换
  103. tabsChange(index) {
  104. this.list = []
  105. this.status = "loading"
  106. this.swiperCurrent = index;
  107. },
  108. swiperChange(event){
  109. this.list = []
  110. this.status = "loading"
  111. this.swiperCurrent = event.detail.current
  112. },
  113. // swiper-item左右移动,通知tabs的滑块跟随移动
  114. transition(e) {
  115. let dx = e.detail.dx;
  116. this.$refs.uTabs.setDx(dx);
  117. },
  118. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  119. // swiper滑动结束,分别设置tabs和swiper的状态
  120. animationfinish(e) {
  121. let current = e.detail.current;
  122. if(current != this.current){
  123. this.$refs.uTabs.setFinishCurrent(current);
  124. this.swiperCurrent = current;
  125. this.current = current;
  126. this.pageInit()
  127. }
  128. },
  129. // scroll-view到底部加载更多
  130. onreachBottom() {
  131. if(this.list.length < this.total){
  132. this.pageNo += 1
  133. this.getRow()
  134. }else{
  135. this.status = "nomore"
  136. }
  137. },
  138. // 查询列表
  139. getRow (pageNo) {
  140. let _this = this
  141. if (pageNo) {
  142. this.pageNo = pageNo
  143. }
  144. let params = {
  145. pageNo: this.pageNo,
  146. pageSize: this.pageSize,
  147. }
  148. // 状态条件
  149. if(this.swiperCurrent == 1){
  150. params.billStatusList = ['WAIT_AUDIT','AUDIT_REJECT','WAIT_OUT_WAREHOUSE']
  151. }
  152. if(this.swiperCurrent == 2){
  153. params.billStatusList = ['FINISH']
  154. }
  155. this.status = "loading"
  156. purchaseQueryPage(params).then(res => {
  157. if (res.code == 200 || res.status == 204 || res.status == 200) {
  158. if(_this.pageNo>1){
  159. _this.list = _this.list.concat(res.data.list || [])
  160. }else{
  161. _this.list = res.data.list || []
  162. }
  163. _this.total = res.data.count || 0
  164. // 待收货
  165. if(_this.swiperCurrent == 1){
  166. _this.tabList[1].count = _this.total
  167. }
  168. } else {
  169. _this.list = []
  170. _this.total = 0
  171. _this.noDataText = res.message
  172. }
  173. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  174. })
  175. },
  176. // 详细页
  177. viewRow(item){
  178. this.$store.state.vuex_tempData = item
  179. uni.navigateTo({
  180. url: "/pagesB/procureOrder?purchaseSn="+item.purchaseSn+"&state="+item.billStatus
  181. })
  182. }
  183. }
  184. }
  185. </script>
  186. <style lang="scss">
  187. page{
  188. height: 100%;
  189. }
  190. .digitShelf-pagesCons{
  191. height: 100%;
  192. display: flex;
  193. flex-direction: column;
  194. .tab-body{
  195. .check-list{
  196. height: calc(100vh - 44px);
  197. }
  198. .check-order-list{
  199. background: #ffffff;
  200. padding: 10upx 20upx;
  201. margin: 25upx;
  202. border-radius: 30upx;
  203. box-shadow: 1px 1px 3px #EEEEEE;
  204. .check-row{
  205. display: flex;
  206. padding: 20upx 10upx;
  207. font-size: 28upx;
  208. &:first-child{
  209. color: #666E75;
  210. font-size: 24upx;
  211. padding-bottom: 10upx;
  212. .orderNo{
  213. font-size: 30upx;
  214. color: #222222;
  215. margin-top: -6upx;
  216. flex-grow: 1;
  217. }
  218. .times{
  219. text-align: right;
  220. }
  221. border-bottom: 2upx solid #f5f5f5;
  222. }
  223. &:last-child{
  224. align-items: center;
  225. justify-content: space-between;
  226. .nums{
  227. font-size: 28upx;
  228. color: #033692;
  229. }
  230. }
  231. > view{
  232. .price{
  233. color: red;
  234. font-size: 28upx;
  235. }
  236. }
  237. .finish{
  238. background-color: #2d8cf0;
  239. }
  240. .del{
  241. color: #666;
  242. border:2rpx solid #EDEDED;
  243. background: none;
  244. }
  245. }
  246. }
  247. }
  248. }
  249. </style>