orderList.vue 11 KB

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