tempOrderList.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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.tempNo}}</view>
  19. <view class="times">{{item.createDate}}</view>
  20. </view>
  21. <view class="check-row flex align-center">
  22. <view class="carImage flex align-center">
  23. <u-image :src="item.vehicleLogo" border-radius="30" width="100" height="100" bg-color="#EBEBEB" ></u-image>
  24. </view>
  25. <view>
  26. <view class="carModel flex align-center" v-if="item.vehicleNumber" >
  27. <view><carNo color="#0055ff" :val="item.vehicleNumber"></carNo></view>
  28. <text style="margin-left: 20rpx;" v-if="item.vehicleModel">{{item.vehicleModel.split(' ')[0]}}</text>
  29. </view>
  30. <view class="carModel flex" v-if="!item.vehicleNumber" >
  31. <text>{{item.vehicleModel}}</text>
  32. </view>
  33. <view class="carVin flex align-center">
  34. VIN码:{{item.vin||'暂无'}}
  35. <text v-if="item.vin" @click.stop="copyVin(item.vin)">复制</text>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="check-row">
  40. <view class="nums">
  41. {{item.totalQty}}件商品
  42. </view>
  43. <view style="text-align: right;">
  44. <span v-if="item.billState == 'WAIT_AUDIT'">待审核</span>
  45. <span v-if="item.billState == 'AUDIT_REJECT'">审核不通过</span>
  46. <span v-if="item.billState == 'WAIT_OUT_WAREHOUSE'">待收货</span>
  47. <span v-if="item.billState == 'FINISH'">已完结</span>
  48. </view>
  49. </view>
  50. </view>
  51. <view style="padding: 20upx;">
  52. <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>
  53. <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
  54. </view>
  55. </scroll-view>
  56. </swiper-item>
  57. </swiper>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. import carNo from '@/components/carNo.vue'
  63. import { getShelfTempBillList, shelfTempTotalWaitQty } from '@/api/shelf.js'
  64. import moment from 'moment'
  65. export default {
  66. components: {carNo},
  67. data() {
  68. return {
  69. theme:'',
  70. status: 'loading',
  71. noDataText: '暂无数据',
  72. tabList: [
  73. {
  74. dispName: '全部',
  75. typeId: 1,
  76. count: 0
  77. },
  78. {
  79. dispName: '待收货',
  80. typeId: 2,
  81. count: 0
  82. },
  83. {
  84. dispName: '已完结',
  85. typeId: 3,
  86. count: 0
  87. },
  88. ],
  89. current: 0,
  90. swiperCurrent: 0,
  91. // 查询条件
  92. pageNo: 1,
  93. pageSize: 10,
  94. list: [],
  95. total: 0,
  96. }
  97. },
  98. onLoad() {
  99. let _this = this
  100. _this.pageInit()
  101. _this.theme = getApp().globalData.theme
  102. uni.$on('refreshOrder',function(data){
  103. _this.list = []
  104. _this.status = "loading"
  105. _this.pageInit()
  106. })
  107. },
  108. methods:{
  109. // 复制
  110. copyVin(vin){
  111. uni.setClipboardData({
  112. data: vin||'',
  113. })
  114. },
  115. message(title){
  116. uni.showToast({
  117. icon:'none',
  118. title: title
  119. })
  120. },
  121. pageInit(){
  122. this.total = 0
  123. this.pageNo = 1
  124. this.getRow()
  125. // 获取总条数
  126. this.getWaitTotal()
  127. },
  128. // tabs通知swiper切换
  129. tabsChange(index) {
  130. this.list = []
  131. this.status = "loading"
  132. this.swiperCurrent = index;
  133. },
  134. swiperChange(event){
  135. this.list = []
  136. this.status = "loading"
  137. this.swiperCurrent = event.detail.current
  138. },
  139. // swiper-item左右移动,通知tabs的滑块跟随移动
  140. transition(e) {
  141. let dx = e.detail.dx;
  142. this.$refs.uTabs.setDx(dx);
  143. },
  144. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  145. // swiper滑动结束,分别设置tabs和swiper的状态
  146. animationfinish(e) {
  147. let current = e.detail.current;
  148. if(current != this.current){
  149. this.$refs.uTabs.setFinishCurrent(current);
  150. this.swiperCurrent = current;
  151. this.current = current;
  152. this.pageInit()
  153. }
  154. },
  155. // scroll-view到底部加载更多
  156. onreachBottom() {
  157. console.log(this.list.length, this.total)
  158. if(this.list.length < this.total){
  159. this.pageNo += 1
  160. this.getRow()
  161. }else{
  162. this.status = "nomore"
  163. }
  164. },
  165. checkNums (states, i){
  166. if(states){
  167. let arr = states.split(',')
  168. return arr[i]
  169. }
  170. return 0
  171. },
  172. // 查询列表
  173. getRow (pageNo) {
  174. let _this = this
  175. if (pageNo) {
  176. this.pageNo = pageNo
  177. }
  178. let params = {
  179. pageNo: this.pageNo,
  180. pageSize: this.pageSize,
  181. }
  182. // 状态条件
  183. if(this.swiperCurrent == 1){
  184. params.billStateList = ['WAIT_AUDIT','AUDIT_REJECT','WAIT_OUT_WAREHOUSE']
  185. }
  186. if(this.swiperCurrent == 2){
  187. params.billStateList = ['FINISH']
  188. }
  189. this.status = "loading"
  190. getShelfTempBillList(params).then(res => {
  191. if (res.code == 200 || res.status == 204 || res.status == 200) {
  192. if(_this.pageNo>1){
  193. _this.list = _this.list.concat(res.data.list || [])
  194. }else{
  195. _this.list = res.data.list || []
  196. }
  197. _this.total = res.data.count || 0
  198. } else {
  199. _this.list = []
  200. _this.total = 0
  201. _this.noDataText = res.message
  202. }
  203. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  204. })
  205. },
  206. // 详细页
  207. viewRow(item){
  208. uni.navigateTo({
  209. url: "/pagesA/digitalShelf/tempOrderList/orderDetail?orderSn="+item.tempSn+"&state="+(item.billState == 'FINISH'?1:0)
  210. })
  211. },
  212. // 获取待拿货数量
  213. async getWaitTotal(){
  214. const ret = await shelfTempTotalWaitQty({billStateList:['WAIT_AUDIT','AUDIT_REJECT','WAIT_OUT_WAREHOUSE']}).then(res => res.data)
  215. this.tabList[1].count = ret || 0
  216. }
  217. }
  218. }
  219. </script>
  220. <style lang="scss">
  221. page{
  222. height: 100%;
  223. }
  224. .digitShelf-pagesCons{
  225. height: 100%;
  226. display: flex;
  227. flex-direction: column;
  228. .tab-body{
  229. .check-list{
  230. height: calc(100vh - 44px);
  231. }
  232. .check-order-list{
  233. background: #ffffff;
  234. padding: 10upx 20upx;
  235. margin: 25upx;
  236. border-radius: 30upx;
  237. box-shadow: 1px 1px 3px #EEEEEE;
  238. .check-row{
  239. display: flex;
  240. padding: 20upx 10upx;
  241. font-size: 28upx;
  242. &:first-child{
  243. color: #666E75;
  244. font-size: 24upx;
  245. padding-bottom: 10upx;
  246. .orderNo{
  247. font-size: 30upx;
  248. color: #222222;
  249. margin-top: -6upx;
  250. flex-grow: 1;
  251. }
  252. .times{
  253. text-align: right;
  254. }
  255. border-bottom: 2upx solid #f5f5f5;
  256. }
  257. &:last-child{
  258. align-items: center;
  259. justify-content: space-between;
  260. .nums{
  261. font-size: 28upx;
  262. color: #033692;
  263. }
  264. }
  265. > view{
  266. .carModel{
  267. color: #222222;
  268. font-size: 32upx;
  269. font-weight: bold;
  270. line-height: normal;
  271. margin-bottom: 10rpx;
  272. }
  273. .carVin{
  274. color: #666E75;
  275. font-size: 24upx;
  276. text{
  277. background-color: #EBEBEB;
  278. border-radius: 100rpx;
  279. padding: 0 20rpx;
  280. color: #033692;
  281. font-size: 20rpx;
  282. display: flex;
  283. align-items: center;
  284. justify-content: center;
  285. margin-left: 20rpx;
  286. }
  287. }
  288. }
  289. .carImage{
  290. padding-right: 20rpx;
  291. }
  292. .action{
  293. padding: 0 30rpx;
  294. color: #fff;
  295. border-radius: 100rpx;
  296. margin-left: 15upx;
  297. font-size: 24upx;
  298. &:after{
  299. border: 0;
  300. }
  301. &:active{
  302. opacity: 0.5;
  303. }
  304. }
  305. .finish{
  306. background-color: #2d8cf0;
  307. }
  308. .del{
  309. color: #666;
  310. border:2rpx solid #EDEDED;
  311. background: none;
  312. }
  313. }
  314. }
  315. }
  316. }
  317. </style>