orderList.vue 10 KB

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