orderList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  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. <u-empty :src="`/static/def_imgs.png`" icon-size="240" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
  50. <view style="padding: 20upx;">
  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 { clzConfirm } from '@/libs/tools.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. theme:'',
  70. status: 'loading',
  71. noDataText: '暂无数据',
  72. tabList: [
  73. {
  74. dispName: '待取货',
  75. typeId: 1,
  76. count: 0
  77. },
  78. {
  79. dispName: '已取货',
  80. typeId: 2,
  81. count: 0
  82. },
  83. {
  84. dispName: '已关闭',
  85. typeId: 3,
  86. count: 0
  87. },
  88. ],
  89. current: 0,
  90. swiperCurrent: 0,
  91. // 查询条件
  92. pageNo: 1,
  93. pageSize: 10,
  94. list: [],
  95. total: 0,
  96. }
  97. },
  98. onLoad() {
  99. let _this = this
  100. _this.pageInit()
  101. _this.theme = getApp().globalData.theme
  102. uni.$on('refreshOrder',function(data){
  103. _this.list = []
  104. _this.status = "loading"
  105. _this.pageInit()
  106. })
  107. },
  108. methods:{
  109. // 复制
  110. copyVin(vin){
  111. clipboard.setText(vin);
  112. uni.showToast({
  113. icon: 'none',
  114. title: 'vin码已复制成功'
  115. })
  116. },
  117. message(title){
  118. uni.showToast({
  119. icon:'none',
  120. title: title
  121. })
  122. },
  123. pageInit(){
  124. this.total = 0
  125. this.pageNo = 1
  126. this.getRow()
  127. // this.shelfGetTotalWaitQty()
  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. shelfGetTotalWaitQty(){
  173. shelfGetTotalWaitQty({billState:'WAIT'}).then(res => {
  174. console.log(res)
  175. if(res.status == 200){
  176. this.tabList[0].count = res.data<=99?res.data:'99+'
  177. }
  178. })
  179. },
  180. // 查询列表
  181. getRow (pageNo) {
  182. let _this = this
  183. if (pageNo) {
  184. this.pageNo = pageNo
  185. }
  186. // 状态条件
  187. const state = ['WAIT','FINISH','CLOSE']
  188. let params = {
  189. pageNo: this.pageNo,
  190. pageSize: this.pageSize,
  191. billState: state[this.swiperCurrent]
  192. }
  193. this.status = "loading"
  194. getShelfOrderList(params).then(res => {
  195. console.log(res,'++++++++++')
  196. if (res.code == 200 || res.status == 204 || res.status == 200) {
  197. if(_this.pageNo>1){
  198. _this.list = _this.list.concat(res.data.list || [])
  199. }else{
  200. _this.list = res.data.list || []
  201. }
  202. _this.total = res.data.count || 0
  203. if(this.current == 0){
  204. _this.tabList[0].count = _this.total
  205. }
  206. } else {
  207. _this.list = []
  208. _this.total = 0
  209. _this.noDataText = res.message
  210. }
  211. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  212. })
  213. },
  214. // 详细页
  215. viewRow(item){
  216. uni.navigateTo({
  217. url: "/pages/digitalShelf/orderDetail?shelfOrderSn="+item.shelfOrderSn
  218. })
  219. },
  220. // 删除
  221. delOrder(sn,index){
  222. cancelShelfOrder({
  223. 'sn': sn
  224. }).then(res => {
  225. console.log(res)
  226. if(res.status == 200){
  227. this.list.splice(index,1)
  228. // this.shelfGetTotalWaitQty()
  229. if(this.current == 0){
  230. this.tabList[0].count = this.tabList[0].count - 1
  231. }
  232. }
  233. this.message(res.data.message)
  234. })
  235. },
  236. // 确认关闭取货单
  237. deleteRow (params,index) {
  238. let _this = this
  239. clzConfirm({
  240. title: '提示',
  241. content: '确认关闭取货单吗?',
  242. success: (ret) => {
  243. if(ret.confirm||ret.index==0){
  244. _this.delOrder(params.shelfOrderSn,index)
  245. }
  246. }
  247. })
  248. },
  249. // 打开扫描取货
  250. sanCodeRow (item) {
  251. uni.navigateTo({
  252. url:"/pages/digitalShelf/scanBarcode/scanBarcode?shelfOrderSn="+item.shelfOrderSn
  253. })
  254. },
  255. }
  256. }
  257. </script>
  258. <style lang="scss">
  259. page{
  260. height: 100%;
  261. }
  262. .digitShelf-pagesCons{
  263. height: 100%;
  264. display: flex;
  265. flex-direction: column;
  266. .tab-body{
  267. .check-list{
  268. height: calc(100vh - 44px);
  269. }
  270. .check-order-list{
  271. background: #ffffff;
  272. padding: 10upx 20upx;
  273. margin: 25upx;
  274. border-radius: 30upx;
  275. box-shadow: 1px 1px 3px #EEEEEE;
  276. .check-row{
  277. display: flex;
  278. padding: 20upx 10upx;
  279. font-size: 28upx;
  280. &:first-child{
  281. color: #666E75;
  282. font-size: 24upx;
  283. padding-bottom: 10upx;
  284. .orderNo{
  285. font-size: 30upx;
  286. color: #222222;
  287. margin-top: -6upx;
  288. flex-grow: 1;
  289. }
  290. .times{
  291. text-align: right;
  292. }
  293. border-bottom: 2upx solid #f5f5f5;
  294. }
  295. &:last-child{
  296. align-items: center;
  297. justify-content: space-between;
  298. .nums{
  299. font-size: 32upx;
  300. color: #033692;
  301. }
  302. }
  303. > view{
  304. .carModel{
  305. color: #222222;
  306. font-size: 32upx;
  307. font-weight: bold;
  308. line-height: normal;
  309. margin-bottom: 10rpx;
  310. }
  311. .carVin{
  312. color: #666E75;
  313. font-size: 24upx;
  314. text{
  315. background-color: #EBEBEB;
  316. border-radius: 100rpx;
  317. padding: 0 20rpx;
  318. color: #033692;
  319. font-size: 20rpx;
  320. display: flex;
  321. align-items: center;
  322. justify-content: center;
  323. margin-left: 20rpx;
  324. }
  325. }
  326. }
  327. .carImage{
  328. padding-right: 20rpx;
  329. }
  330. .action{
  331. padding: 0 30rpx;
  332. color: #fff;
  333. border-radius: 100rpx;
  334. margin-left: 25upx;
  335. font-size: 24upx;
  336. &:after{
  337. border: 0;
  338. }
  339. &:active{
  340. opacity: 0.5;
  341. }
  342. }
  343. .finish{
  344. background-color: #2d8cf0;
  345. }
  346. .del{
  347. color: #666;
  348. border:2rpx solid #EDEDED;
  349. background: none;
  350. }
  351. }
  352. }
  353. }
  354. }
  355. .search-popup{
  356. .search-title{
  357. text-align: center;
  358. padding: 20upx;
  359. color: #333;
  360. border-bottom: 1px solid #eee;
  361. }
  362. .uni-list{
  363. padding:10upx 20upx;
  364. margin: 0;
  365. border-bottom: 1px solid #EEEEEE;
  366. .uni-list-cell{
  367. border: 0;
  368. .uni-list-cell-db{
  369. flex: 1;
  370. width: 100%;
  371. }
  372. .uni-input{
  373. height: 2.5em;
  374. line-height: 2.5em;
  375. font-size: 28upx;
  376. display: flex;
  377. align-items: center;
  378. > view{
  379. &:first-child{
  380. flex-grow: 1;
  381. color: #666;
  382. }
  383. &:last-child{
  384. color: #999;
  385. }
  386. }
  387. }
  388. .item-icon{
  389. margin-left: 10upx;
  390. }
  391. }
  392. }
  393. .uni-list-btns{
  394. display: flex;
  395. padding: 50upx 20upx;
  396. uni-button{
  397. font-size: 28upx;
  398. margin: 0 30upx;
  399. flex:1;
  400. border-radius: 100upx;
  401. &:after{
  402. border: 0;
  403. }
  404. }
  405. }
  406. .checkbox-items{
  407. display: flex;
  408. flex-wrap: wrap;
  409. justify-content: space-between;
  410. .checkbox{
  411. width: 24%;
  412. background: #F8F8F8;
  413. text-align: center;
  414. margin: 20upx 0;
  415. padding: 10upx 0;
  416. border-radius: 50upx;
  417. font-size: 24upx;
  418. border:1upx solid #eee;
  419. }
  420. .checked{
  421. background: rgba(4, 133, 246, 0.15);
  422. border-color: rgba(4, 133, 246, 0.5);
  423. color: rgba(4, 133, 246, 1);
  424. }
  425. }
  426. }
  427. </style>