orderList.vue 12 KB

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