orderList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  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" :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: 0,
  101. swiperCurrent: 0,
  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: "/pages/digitalShelf/orderDetail?shelfOrderSn="+item.shelfOrderSn
  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. }
  230. this.message(res.data.message)
  231. })
  232. },
  233. // 确认取消订单
  234. deleteRow (params,index) {
  235. let _this = this
  236. uni.showModal({
  237. title: '提示',
  238. content: '确认取消订单吗?',
  239. success: (ret) => {
  240. if(ret.confirm){
  241. _this.delOrder(params.shelfOrderSn,index)
  242. }
  243. }
  244. })
  245. },
  246. // 打开扫描取货
  247. sanCodeRow (item) {
  248. uni.navigateTo({
  249. url:"/pages/digitalShelf/scanBarcode/scanBarcode?shelfOrderSn="+item.shelfOrderSn
  250. })
  251. },
  252. // 一键取货
  253. onceQh(item,index){
  254. const _this = this
  255. uni.showModal({
  256. title: '提示',
  257. content: '确认一键取货吗?',
  258. success: (ret) => {
  259. if(ret.confirm){
  260. _this.loading = true
  261. takeGoods({sn:item.shelfOrderSn}).then(res => {
  262. if(res.status == 200){
  263. _this.list.splice(index,1)
  264. if(_this.current == 0){
  265. _this.tabList[0].count = _this.tabList[0].count - 1
  266. }
  267. }
  268. uni.showToast({
  269. title: res.message,
  270. icon:"none"
  271. })
  272. _this.loading = false
  273. })
  274. }
  275. }
  276. })
  277. },
  278. }
  279. }
  280. </script>
  281. <style lang="scss">
  282. page{
  283. height: 100%;
  284. }
  285. .digitShelf-pagesCons{
  286. height: 100%;
  287. display: flex;
  288. flex-direction: column;
  289. .tab-body{
  290. .check-list{
  291. height: calc(100vh - 44px);
  292. }
  293. .check-order-list{
  294. background: #ffffff;
  295. padding: 10upx 20upx;
  296. margin: 25upx;
  297. border-radius: 30upx;
  298. box-shadow: 1px 1px 3px #EEEEEE;
  299. .check-row{
  300. display: flex;
  301. padding: 20upx 10upx;
  302. font-size: 28upx;
  303. &:first-child{
  304. color: #666E75;
  305. font-size: 24upx;
  306. padding-bottom: 10upx;
  307. .orderNo{
  308. font-size: 30upx;
  309. color: #222222;
  310. margin-top: -6upx;
  311. flex-grow: 1;
  312. }
  313. .times{
  314. text-align: right;
  315. }
  316. border-bottom: 2upx solid #f5f5f5;
  317. }
  318. &:last-child{
  319. align-items: center;
  320. justify-content: space-between;
  321. .nums{
  322. font-size: 28upx;
  323. color: #033692;
  324. }
  325. }
  326. > view{
  327. .pcode{
  328. margin-bottom: 10rpx;
  329. }
  330. .carModel{
  331. color: #222222;
  332. font-size: 32upx;
  333. font-weight: bold;
  334. line-height: normal;
  335. margin-bottom: 10rpx;
  336. }
  337. .carVin{
  338. color: #666E75;
  339. font-size: 24upx;
  340. text{
  341. background-color: #EBEBEB;
  342. border-radius: 100rpx;
  343. padding: 0 20rpx;
  344. color: #033692;
  345. font-size: 20rpx;
  346. display: flex;
  347. align-items: center;
  348. justify-content: center;
  349. margin-left: 20rpx;
  350. }
  351. }
  352. }
  353. .carImage{
  354. padding-right: 20rpx;
  355. }
  356. .action{
  357. padding: 0 30rpx;
  358. color: #fff;
  359. border-radius: 100rpx;
  360. margin-left: 15upx;
  361. font-size: 24upx;
  362. &:after{
  363. border: 0;
  364. }
  365. &:active{
  366. opacity: 0.5;
  367. }
  368. }
  369. .finish{
  370. background-color: #066cff;
  371. }
  372. .del{
  373. color: #666;
  374. border:2rpx solid #EDEDED;
  375. background: none;
  376. }
  377. }
  378. }
  379. }
  380. }
  381. .search-popup{
  382. .search-title{
  383. text-align: center;
  384. padding: 20upx;
  385. color: #333;
  386. border-bottom: 1px solid #eee;
  387. }
  388. .uni-list{
  389. padding:10upx 20upx;
  390. margin: 0;
  391. border-bottom: 1px solid #EEEEEE;
  392. .uni-list-cell{
  393. border: 0;
  394. .uni-list-cell-db{
  395. flex: 1;
  396. width: 100%;
  397. }
  398. .uni-input{
  399. height: 2.5em;
  400. line-height: 2.5em;
  401. font-size: 28upx;
  402. display: flex;
  403. align-items: center;
  404. > view{
  405. &:first-child{
  406. flex-grow: 1;
  407. color: #666;
  408. }
  409. &:last-child{
  410. color: #999;
  411. }
  412. }
  413. }
  414. .item-icon{
  415. margin-left: 10upx;
  416. }
  417. }
  418. }
  419. .uni-list-btns{
  420. display: flex;
  421. padding: 50upx 20upx;
  422. uni-button{
  423. font-size: 28upx;
  424. margin: 0 30upx;
  425. flex:1;
  426. border-radius: 100upx;
  427. &:after{
  428. border: 0;
  429. }
  430. }
  431. }
  432. .checkbox-items{
  433. display: flex;
  434. flex-wrap: wrap;
  435. justify-content: space-between;
  436. .checkbox{
  437. width: 24%;
  438. background: #F8F8F8;
  439. text-align: center;
  440. margin: 20upx 0;
  441. padding: 10upx 0;
  442. border-radius: 50upx;
  443. font-size: 24upx;
  444. border:1upx solid #eee;
  445. }
  446. .checked{
  447. background: rgba(4, 133, 246, 0.15);
  448. border-color: rgba(4, 133, 246, 0.5);
  449. color: rgba(4, 133, 246, 1);
  450. }
  451. }
  452. }
  453. </style>