orderList.vue 12 KB

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