orderList.vue 13 KB

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