orderList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  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.shelfOrderNo}}</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. <button :hover-stop-propagation="true" @click.stop="deleteRow(item,index)" v-if="item.billState != 'CLOSE'&&item.settleState=='WAIT'" class="action del" size="mini">取消订单</button>
  45. <button :hover-stop-propagation="true" @click.stop="sanCodeRow(item)" v-if="item.billState == 'WAIT'" class="action finish" size="mini">扫码取货</button>
  46. <button :hover-stop-propagation="true" @click.stop="onceQh(item,index)" :loading="loading" v-if="item.billState == 'WAIT'" class="action finish" size="mini">一键取货</button>
  47. </view>
  48. </view>
  49. </view>
  50. <view style="padding: 20upx;">
  51. <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>
  52. <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
  53. </view>
  54. </scroll-view>
  55. </swiper-item>
  56. </swiper>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import carNo from '@/components/carNo.vue'
  62. import { getShelfOrderList, cancelShelfOrder, shelfGetTotalWaitQty, takeGoods } from '@/api/shelf.js'
  63. import moment from 'moment'
  64. export default {
  65. components: {carNo},
  66. data() {
  67. return {
  68. loading: false,
  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. // tabs通知swiper切换
  127. tabsChange(index) {
  128. this.swiperCurrent = index;
  129. },
  130. swiperChange(event){
  131. console.log(event.detail)
  132. this.list = []
  133. this.status = "loading"
  134. },
  135. // swiper-item左右移动,通知tabs的滑块跟随移动
  136. transition(e) {
  137. let dx = e.detail.dx;
  138. this.$refs.uTabs.setDx(dx);
  139. },
  140. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  141. // swiper滑动结束,分别设置tabs和swiper的状态
  142. animationfinish(e) {
  143. let current = e.detail.current;
  144. if(current != this.current){
  145. this.$refs.uTabs.setFinishCurrent(current);
  146. this.swiperCurrent = current;
  147. this.current = current;
  148. this.pageInit()
  149. }
  150. },
  151. // scroll-view到底部加载更多
  152. onreachBottom() {
  153. console.log(this.list.length, this.total)
  154. if(this.list.length < this.total){
  155. this.pageNo += 1
  156. this.getRow()
  157. }else{
  158. this.status = "nomore"
  159. }
  160. },
  161. checkNums (states, i){
  162. if(states){
  163. let arr = states.split(',')
  164. return arr[i]
  165. }
  166. return 0
  167. },
  168. // 查询列表
  169. getRow (pageNo) {
  170. let _this = this
  171. if (pageNo) {
  172. this.pageNo = pageNo
  173. }
  174. // 状态条件
  175. const state = ['WAIT','FINISH','CLOSE']
  176. let params = {
  177. pageNo: this.pageNo,
  178. pageSize: this.pageSize,
  179. billState: state[this.swiperCurrent]
  180. }
  181. this.status = "loading"
  182. getShelfOrderList(params).then(res => {
  183. console.log(res,'++++++++++')
  184. if (res.code == 200 || res.status == 204 || res.status == 200) {
  185. if(_this.pageNo>1){
  186. _this.list = _this.list.concat(res.data.list || [])
  187. }else{
  188. _this.list = res.data.list || []
  189. }
  190. _this.total = res.data.count || 0
  191. if(this.current == 0){
  192. _this.tabList[0].count = _this.total
  193. }
  194. } else {
  195. _this.list = []
  196. _this.total = 0
  197. _this.noDataText = res.message
  198. }
  199. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  200. })
  201. },
  202. // 详细页
  203. viewRow(item){
  204. uni.navigateTo({
  205. url: "/pages/digitalShelf/orderDetail?shelfOrderSn="+item.shelfOrderSn
  206. })
  207. },
  208. // 删除
  209. delOrder(sn,index){
  210. cancelShelfOrder({
  211. 'sn': sn
  212. }).then(res => {
  213. console.log(res)
  214. if(res.status == 200){
  215. this.list.splice(index,1)
  216. if(this.current == 0){
  217. this.tabList[0].count = this.tabList[0].count - 1
  218. }
  219. }
  220. this.message(res.data.message)
  221. })
  222. },
  223. // 确认取消取货单
  224. deleteRow (params,index) {
  225. let _this = this
  226. uni.showModal({
  227. title: '提示',
  228. content: '确认取消订单吗?',
  229. success: (ret) => {
  230. if(ret.confirm){
  231. _this.delOrder(params.shelfOrderSn,index)
  232. }
  233. }
  234. })
  235. },
  236. // 打开扫描取货
  237. sanCodeRow (item) {
  238. uni.navigateTo({
  239. url:"/pages/digitalShelf/scanBarcode/scanBarcode?shelfOrderSn="+item.shelfOrderSn
  240. })
  241. },
  242. // 一键取货
  243. onceQh(item,index){
  244. const _this = this
  245. uni.showModal({
  246. title: '提示',
  247. content: '确认一键取货吗?',
  248. success: (ret) => {
  249. if(ret.confirm){
  250. _this.loading = true
  251. takeGoods({sn:item.shelfOrderSn}).then(res => {
  252. if(res.status == 200){
  253. _this.list.splice(index,1)
  254. if(_this.current == 0){
  255. _this.tabList[0].count = _this.tabList[0].count - 1
  256. }
  257. }
  258. uni.showToast({
  259. title: res.message,
  260. icon:"none"
  261. })
  262. _this.loading = false
  263. })
  264. }
  265. }
  266. })
  267. },
  268. }
  269. }
  270. </script>
  271. <style lang="scss">
  272. page{
  273. height: 100%;
  274. }
  275. .digitShelf-pagesCons{
  276. height: 100%;
  277. display: flex;
  278. flex-direction: column;
  279. .tab-body{
  280. .check-list{
  281. height: calc(100vh - 44px);
  282. }
  283. .check-order-list{
  284. background: #ffffff;
  285. padding: 10upx 20upx;
  286. margin: 25upx;
  287. border-radius: 30upx;
  288. box-shadow: 1px 1px 3px #EEEEEE;
  289. .check-row{
  290. display: flex;
  291. padding: 20upx 10upx;
  292. font-size: 28upx;
  293. &:first-child{
  294. color: #666E75;
  295. font-size: 24upx;
  296. padding-bottom: 10upx;
  297. .orderNo{
  298. font-size: 30upx;
  299. color: #222222;
  300. margin-top: -6upx;
  301. flex-grow: 1;
  302. }
  303. .times{
  304. text-align: right;
  305. }
  306. border-bottom: 2upx solid #f5f5f5;
  307. }
  308. &:last-child{
  309. align-items: center;
  310. justify-content: space-between;
  311. .nums{
  312. font-size: 28upx;
  313. color: #033692;
  314. }
  315. }
  316. > view{
  317. .carModel{
  318. color: #222222;
  319. font-size: 32upx;
  320. font-weight: bold;
  321. line-height: normal;
  322. margin-bottom: 10rpx;
  323. }
  324. .carVin{
  325. color: #666E75;
  326. font-size: 24upx;
  327. text{
  328. background-color: #EBEBEB;
  329. border-radius: 100rpx;
  330. padding: 0 20rpx;
  331. color: #033692;
  332. font-size: 20rpx;
  333. display: flex;
  334. align-items: center;
  335. justify-content: center;
  336. margin-left: 20rpx;
  337. }
  338. }
  339. }
  340. .carImage{
  341. padding-right: 20rpx;
  342. }
  343. .action{
  344. padding: 0 30rpx;
  345. color: #fff;
  346. border-radius: 100rpx;
  347. margin-left: 15upx;
  348. font-size: 24upx;
  349. &:after{
  350. border: 0;
  351. }
  352. &:active{
  353. opacity: 0.5;
  354. }
  355. }
  356. .finish{
  357. background-color: #2d8cf0;
  358. }
  359. .del{
  360. color: #666;
  361. border:2rpx solid #EDEDED;
  362. background: none;
  363. }
  364. }
  365. }
  366. }
  367. }
  368. .search-popup{
  369. .search-title{
  370. text-align: center;
  371. padding: 20upx;
  372. color: #333;
  373. border-bottom: 1px solid #eee;
  374. }
  375. .uni-list{
  376. padding:10upx 20upx;
  377. margin: 0;
  378. border-bottom: 1px solid #EEEEEE;
  379. .uni-list-cell{
  380. border: 0;
  381. .uni-list-cell-db{
  382. flex: 1;
  383. width: 100%;
  384. }
  385. .uni-input{
  386. height: 2.5em;
  387. line-height: 2.5em;
  388. font-size: 28upx;
  389. display: flex;
  390. align-items: center;
  391. > view{
  392. &:first-child{
  393. flex-grow: 1;
  394. color: #666;
  395. }
  396. &:last-child{
  397. color: #999;
  398. }
  399. }
  400. }
  401. .item-icon{
  402. margin-left: 10upx;
  403. }
  404. }
  405. }
  406. .uni-list-btns{
  407. display: flex;
  408. padding: 50upx 20upx;
  409. uni-button{
  410. font-size: 28upx;
  411. margin: 0 30upx;
  412. flex:1;
  413. border-radius: 100upx;
  414. &:after{
  415. border: 0;
  416. }
  417. }
  418. }
  419. .checkbox-items{
  420. display: flex;
  421. flex-wrap: wrap;
  422. justify-content: space-between;
  423. .checkbox{
  424. width: 24%;
  425. background: #F8F8F8;
  426. text-align: center;
  427. margin: 20upx 0;
  428. padding: 10upx 0;
  429. border-radius: 50upx;
  430. font-size: 24upx;
  431. border:1upx solid #eee;
  432. }
  433. .checked{
  434. background: rgba(4, 133, 246, 0.15);
  435. border-color: rgba(4, 133, 246, 0.5);
  436. color: rgba(4, 133, 246, 1);
  437. }
  438. }
  439. }
  440. </style>