procureOrderList.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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">
  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.swiperCurrent = index;
  105. },
  106. swiperChange(event){
  107. this.list = []
  108. this.status = "loading"
  109. },
  110. // swiper-item左右移动,通知tabs的滑块跟随移动
  111. transition(e) {
  112. let dx = e.detail.dx;
  113. this.$refs.uTabs.setDx(dx);
  114. },
  115. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  116. // swiper滑动结束,分别设置tabs和swiper的状态
  117. animationfinish(e) {
  118. let current = e.detail.current;
  119. if(current != this.current){
  120. this.$refs.uTabs.setFinishCurrent(current);
  121. this.swiperCurrent = current;
  122. this.current = current;
  123. this.pageInit()
  124. }
  125. },
  126. // scroll-view到底部加载更多
  127. onreachBottom() {
  128. if(this.list.length < this.total){
  129. this.pageNo += 1
  130. this.getRow()
  131. }else{
  132. this.status = "nomore"
  133. }
  134. },
  135. // 查询列表
  136. getRow (pageNo) {
  137. let _this = this
  138. if (pageNo) {
  139. this.pageNo = pageNo
  140. }
  141. let params = {
  142. pageNo: this.pageNo,
  143. pageSize: this.pageSize,
  144. }
  145. // 状态条件
  146. if(this.swiperCurrent == 1){
  147. params.billStatusList = ['WAIT_AUDIT','AUDIT_REJECT','WAIT_OUT_WAREHOUSE']
  148. }
  149. if(this.swiperCurrent == 2){
  150. params.billStatusList = ['FINISH']
  151. }
  152. this.status = "loading"
  153. purchaseQueryPage(params).then(res => {
  154. if (res.code == 200 || res.status == 204 || res.status == 200) {
  155. if(_this.pageNo>1){
  156. _this.list = _this.list.concat(res.data.list || [])
  157. }else{
  158. _this.list = res.data.list || []
  159. }
  160. _this.total = res.data.count || 0
  161. // 待收货
  162. if(_this.swiperCurrent == 1){
  163. _this.tabList[1].count = _this.total
  164. }
  165. } else {
  166. _this.list = []
  167. _this.total = 0
  168. _this.noDataText = res.message
  169. }
  170. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  171. })
  172. },
  173. // 详细页
  174. viewRow(item){
  175. this.$store.state.vuex_tempData = item
  176. uni.navigateTo({
  177. url: "/pagesB/procureOrder?purchaseSn="+item.purchaseSn+"&state="+item.billStatus
  178. })
  179. }
  180. }
  181. }
  182. </script>
  183. <style lang="scss">
  184. page{
  185. height: 100%;
  186. }
  187. .digitShelf-pagesCons{
  188. height: 100%;
  189. display: flex;
  190. flex-direction: column;
  191. .tab-body{
  192. .check-list{
  193. height: calc(100vh - 44px);
  194. }
  195. .check-order-list{
  196. background: #ffffff;
  197. padding: 10upx 20upx;
  198. margin: 25upx;
  199. border-radius: 30upx;
  200. box-shadow: 1px 1px 3px #EEEEEE;
  201. .check-row{
  202. display: flex;
  203. padding: 20upx 10upx;
  204. font-size: 28upx;
  205. &:first-child{
  206. color: #666E75;
  207. font-size: 24upx;
  208. padding-bottom: 10upx;
  209. .orderNo{
  210. font-size: 30upx;
  211. color: #222222;
  212. margin-top: -6upx;
  213. flex-grow: 1;
  214. }
  215. .times{
  216. text-align: right;
  217. }
  218. border-bottom: 2upx solid #f5f5f5;
  219. }
  220. &:last-child{
  221. align-items: center;
  222. justify-content: space-between;
  223. .nums{
  224. font-size: 28upx;
  225. color: #033692;
  226. }
  227. }
  228. > view{
  229. .price{
  230. color: red;
  231. font-size: 28upx;
  232. }
  233. }
  234. .finish{
  235. background-color: #2d8cf0;
  236. }
  237. .del{
  238. color: #666;
  239. border:2rpx solid #EDEDED;
  240. background: none;
  241. }
  242. }
  243. }
  244. }
  245. }
  246. </style>