index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. <!-- 货源 -->
  2. <template>
  3. <view class="content">
  4. <view class="fixed1"></view>
  5. <view v-if="!isSearch">
  6. <view class="fixed">
  7. <view class='title flex flex-center'>
  8. <view>订单</view>
  9. <u-icon class="search" name="search" color="" size="28" @click="search"></u-icon>
  10. </view>
  11. <u-tabs :list="tabList" @click="clickTab" lineColor='#2772FB' :current='tabIndex' :activeStyle="{
  12. color: '#2772FB',
  13. fontWeight: 'bold',
  14. transform: 'scale(1.05)'
  15. }"></u-tabs>
  16. </view>
  17. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
  18. class="mescroll">
  19. <view :id="'good'+good.id" class="good-list" v-for="good in goods" :key="good.id"
  20. @click="toDetail(good.id)">
  21. <view style="padding: 0 35rpx 20rpx 35rpx;">
  22. <view class="flex flex-space-between row1">
  23. <view class="item1">
  24. {{good.orderNo}} {{good.goodsName}}
  25. </view>
  26. <view class="item2">
  27. {{good.orderStatus}}
  28. </view>
  29. </view>
  30. <view class="flex row2">
  31. <view class="left flex flex-space-between">
  32. <view class="ssx">{{$helper.getProvinceAbbreviation(good.sendPrivate)}}</view>
  33. <view class="level2-title">{{good.sendCity}} {{good.sendArea}}</view>
  34. <view>
  35. <image class="jt-icon" src="@/static/images/goodSource/jt.png" mode='widthFix'>
  36. </image>
  37. </view>
  38. <view class="ssx">
  39. {{$helper.getProvinceAbbreviation(good.unloadPrivate)}}
  40. </view>
  41. <view class="level2-title">{{good.unloadCity}} {{good.unloadArea}}</view>
  42. </view>
  43. </view>
  44. <view class="flex row3">
  45. <view class="left">
  46. <image class="hz" src="@/static/images/news/hz.png"></image>
  47. </view>
  48. <view class="right">
  49. <view class="flex fontsize-26 row">
  50. <view>{{good.compName}}</view>
  51. <view class="sline"></view>
  52. <view>{{good.cargoOwner}}</view>
  53. </view>
  54. <view class="flex align-center">
  55. <view class="fontsize-26 ">运距 {{good.distance}}km</view>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="row4 flex flex-end align-center">
  60. <view class="time">{{good.updateDate}}</view>
  61. <view class="car">{{good.freight}}{{good.illingMethod==0?'元/吨':'元/车'}}</view>
  62. </view>
  63. <view class="row5 flex flex-end">
  64. <view class="stop active" @click.stop="stop(good)" v-if="good.orderStatus=='待货主确认'||good.orderStatus=='未装车'">终止</view>
  65. <view class="start normal" @click.stop="confirmLoading(good)" v-if="good.orderStatus=='未装车'||good.orderStatus=='货主驳回装车信息'||good.orderStatus=='平台驳回装车信息'">确认装车</view>
  66. <view class="start normal" v-if="good.orderStatus!='未装车'&&good.orderStatus!='待货主确认'">联系客服</view>
  67. <view class="start normal" @click.stop="confirmUnLoading(good)" v-if="good.orderStatus=='运输中'||good.orderStatus=='货主驳回卸车信息'||good.orderStatus=='平台驳回卸车信息'">确认卸车</view>
  68. <!-- <view class="start">评价</view>
  69. -->
  70. <view class="start normal" @click.stop="closed(good)" v-if="good.orderStatus=='结算中'">完结</view>
  71. </view>
  72. </view>
  73. </view>
  74. </mescroll-body>
  75. </view>
  76. <view v-else class="search-view">
  77. <view class="flex">
  78. <u-icon name="arrow-left" color="" size="20" class="back-icon" @click="back()"></u-icon>
  79. <u-search placeholder="可按编号、货主、收发地查找" placeholderColor="#AFB3BF" :actionStyle="textColor"
  80. bgColor="#F5F6FA" v-model="searchKeyWord" actionText='取消' @custom="cancel" @search="getSearch">
  81. </u-search>
  82. </view>
  83. <view class="near-search">
  84. <view class="flex flex-space-between">
  85. <view class="near-search-text">最近搜索</view>
  86. <u-icon name="trash-fill" color="#AFB3BF" size="20" class="back-icon" @click="del"></u-icon>
  87. </view>
  88. <view class="">
  89. <view v-for="(item,index) in useSearchList" :key="index" class="item-style inline-block">
  90. {{item}}
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. <u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :confirmText='confirmText'
  96. :closeOnClickOverlay='true' :showCancelButton='true' @confirm="confirmClick" @close="cancelClick"
  97. @cancel="cancelClick" class="modal">
  98. <u-radio-group v-model="radiovalue1" placement="" v-if='isShowTerminationReason' class='row'>
  99. <u-radio :customStyle="{marginBottom: '8px'}" v-for="(item, index) in radiolist1" :key="index"
  100. :label="item.name" :name="item.name" @change="radioChange">
  101. </u-radio>
  102. </u-radio-group>
  103. <u--textarea class="row" v-model="value2" placeholder="终止原因描述" count maxlength='50'
  104. v-if='isShowTerminationReason'>
  105. </u--textarea>
  106. </u-modal>
  107. <u-toast ref="uToast"></u-toast>
  108. </view>
  109. </template>
  110. <script>
  111. import {
  112. mapState
  113. } from 'vuex';
  114. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  115. import {
  116. apiGoods
  117. } from "@/api/mock.js"
  118. export default {
  119. mixins: [MescrollMixin], // 使用mixin
  120. data() {
  121. return {
  122. // isShowStopBtn: false,
  123. // isConfirmLoadingBtn:false,
  124. // isShowCustomerServiceBtn:false,
  125. // isConfirmUnLoadingBtn:false,
  126. // isClosedBtn:false,
  127. searchKeyWord: '',
  128. useSearchList: [],
  129. mescroll: null,
  130. isShowTerminationReason: false,
  131. id: '',
  132. value2: '',
  133. radiolist1: [{
  134. name: '已与货主协商',
  135. disabled: false
  136. },
  137. {
  138. name: '货主原因终止',
  139. disabled: false
  140. },
  141. {
  142. name: '司机个人原因终止',
  143. disabled: false
  144. }, {
  145. name: '其他',
  146. disabled: false
  147. }
  148. ],
  149. radiovalue1: '已与货主协商',
  150. confirmText: '终止',
  151. alertTitle: '确定终止订单?',
  152. alertContent: "",
  153. isShowAlert: false,
  154. textColor: {
  155. "color": "#AFB3BF"
  156. },
  157. isSearch: false,
  158. startPlace: '齐齐哈尔齐齐哈尔',
  159. endPlace: '全国',
  160. goods: [], // 数据列表
  161. src: 'https://cdn.uviewui.com/uview/album/1.jpg',
  162. height: "", // 需要固定swiper的高度
  163. tabList: [{
  164. name: '全部'
  165. }, {
  166. name: '未发运'
  167. }, {
  168. name: '运输中'
  169. }, {
  170. name: '待收货'
  171. }, {
  172. name: '待结算'
  173. },
  174. {
  175. name: '已完结'
  176. },
  177. // {
  178. // name: '评价'
  179. // },
  180. ],
  181. tabIndex: 0,
  182. scrollTop: 0
  183. }
  184. },
  185. computed: {
  186. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication'])
  187. },
  188. onTabItemTap(e) {
  189. // tab 点击时执行,此处直接接收单击事件
  190. uni.pageScrollTo({
  191. scrollTop: 0,
  192. duration: 300
  193. });
  194. },
  195. created() {
  196. //#ifdef APP-PLUS
  197. // this.getLngLat();
  198. //#endif
  199. },
  200. onLoad() {
  201. // let _isHave = this.$utils.getRoles('aaa')
  202. // console.log(_isHave)
  203. },
  204. onShow() {
  205. this.upCallback({
  206. size: 10,
  207. num: 1
  208. })
  209. },
  210. onPageScroll(res) {
  211. this.scrollTop = res.scrollTop
  212. console.log("页面滚动了", res.scrollTop)
  213. if (this.scrollTop > 1200) {
  214. uni.setTabBarItem({
  215. index: 1,
  216. text: '返回顶部',
  217. iconPath: 'static/images/common/top@2x.png',
  218. selectedIconPath: 'static/images/common/top@2x.png'
  219. })
  220. } else {
  221. uni.setTabBarItem({
  222. index: 1,
  223. text: '订单',
  224. iconPath: 'static/images/common/dingdan@2x(1).png',
  225. selectedIconPath: 'static/images/common/dingdan@2x.png'
  226. })
  227. }
  228. },
  229. methods: {
  230. // 完结
  231. closed(item) {
  232. let that = this
  233. this.$request.baseRequest('post', '/orderInfo/api/editEnd', {
  234. id: item.id,
  235. }).then(res => {
  236. if (res.code == 200) {
  237. this.$refs.uToast.show({
  238. type: 'success',
  239. message: "提交成功",
  240. complete() {
  241. that.upCallback({
  242. size: 10,
  243. num: 1
  244. })
  245. }
  246. })
  247. }
  248. })
  249. .catch(res => {
  250. uni.$u.toast(res.message);
  251. });
  252. },
  253. confirmLoading(item) {
  254. uni.$u.route('/pages/order/confirmLoading', item);
  255. },
  256. confirmUnLoading(item) {
  257. uni.$u.route('/pages/order/confirmUnloading', item);
  258. },
  259. back() {
  260. uni.navigateBack(-1)
  261. },
  262. mescrollInit(mescroll) {
  263. this.mescroll = mescroll;
  264. },
  265. radioChange(n) {
  266. console.log('radioChange', n);
  267. },
  268. stop(item) {
  269. // 货主接单
  270. if (item.orderStatusKey == 1) {
  271. this.isShowTerminationReason = false
  272. } else {
  273. this.isShowTerminationReason = true
  274. }
  275. this.id = item.id
  276. this.isShowAlert = true
  277. },
  278. init() {
  279. },
  280. del() {
  281. this.isShowAlert = true
  282. },
  283. confirmClick() {
  284. console.log('终止')
  285. if (this.radiovalue1 == '其他' && !this.value2) {
  286. this.$refs.uToast.show({
  287. type: 'error',
  288. message: "请填写终止原因描述!",
  289. })
  290. return
  291. }
  292. let _terminationReason = ''
  293. if (this.radiovalue1 == '已与货主协商') {
  294. _terminationReason = 1
  295. } else if (this.radiovalue1 == '货主原因终止') {
  296. _terminationReason = 2
  297. } else if (this.radiovalue1 == '司机个人原因终止') {
  298. _terminationReason = 3
  299. } else if (this.radiovalue1 == '其他') {
  300. _terminationReason = 4
  301. }
  302. this.$request.baseRequest('post', '/orderInfo/api/end', {
  303. id: this.id,
  304. terminator: 1,
  305. terminationReason: _terminationReason,
  306. terminationReasonDescription: this.value2
  307. }).then(res => {
  308. console.log(res)
  309. this.isShowAlert = false
  310. this.mescroll.resetUpScroll()
  311. })
  312. .catch(res => {
  313. uni.$u.toast(res.message);
  314. });
  315. },
  316. cancelClick() {
  317. this.isShowAlert = false
  318. },
  319. getSearch(e) {
  320. // = uni.getStorageSync('useSearchList')
  321. this.useSearchList.unshift(e)
  322. uni.setStorageSync("useSearchList", this.useSearchList)
  323. console.log("点击搜索", e)
  324. this.upCallback({
  325. size: 10,
  326. num: 1
  327. })
  328. },
  329. cancel() {
  330. this.isSearch = false
  331. },
  332. toDetail(id) {
  333. uni.$u.route('/pages/order/orderDetails', {
  334. id: id,
  335. });
  336. },
  337. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  338. upCallback(page) {
  339. // 此处可以继续请求其他接口
  340. // if(page.num == 1){
  341. // // 请求其他接口...
  342. // }
  343. // 如果希望先请求其他接口,再触发upCallback,可参考以下写法
  344. // if(!this.isInitxx){
  345. // apiGetxx().then(res=>{
  346. // this.isInitxx = true
  347. // this.mescroll.resetUpScroll() // 重新触发upCallback
  348. // }).catch(()=>{
  349. // this.mescroll.endErr()
  350. // })
  351. // return // 此处return,先获取xx
  352. // }
  353. // 订单状态12345
  354. this.$request.baseRequest('get', '/orderInfo/selectOrderInfo', {
  355. commonId: this.userInfo.id,
  356. searchKeyWord: this.searchKeyWord,
  357. searchType: this.searchType,
  358. pageSize: page.size,
  359. currentPage: page.num
  360. }).then(res => {
  361. this.isSearch = false
  362. if (page.num == 1) this.goods = []; //如果是第一页需手动制空列表
  363. this.goods = this.goods.concat(res.data.records); //追加新数据
  364. this.mescroll.endBySize(res.data.records.length, res.data.total);
  365. })
  366. .catch(res => {
  367. uni.$u.toast(res.message);
  368. });
  369. },
  370. clickTab(val) {
  371. console.log(val)
  372. this.searchType = val.index
  373. this.upCallback({
  374. size: 10,
  375. num: 1
  376. })
  377. },
  378. search() {
  379. this.isSearch = true
  380. //获取缓存搜索数据
  381. this.useSearchList = uni.getStorageSync('useSearchList')
  382. if (!this.useSearchList) this.useSearchList = [];
  383. }
  384. }
  385. }
  386. </script>
  387. <style scoped lang="scss">
  388. .banner {
  389. width: 100%;
  390. position: relative;
  391. }
  392. .fixed,
  393. .fixed1 {
  394. background: white;
  395. position: fixed;
  396. top: var(--status-bar-height);
  397. z-index: 999;
  398. width: 100%;
  399. }
  400. .fixed {
  401. .title {
  402. background: white;
  403. position: relative;
  404. font-size: 36rpx;
  405. font-weight: 500;
  406. color: rgba(0, 0, 0, 0.85);
  407. .search {
  408. position: absolute;
  409. right: 20rpx;
  410. }
  411. }
  412. }
  413. .fixed1 {
  414. top: 0;
  415. height: var(--status-bar-height);
  416. background: white;
  417. }
  418. .banner-img {
  419. width: 100%;
  420. }
  421. .head {
  422. position: absolute;
  423. width: calc(100% - 108rpx);
  424. bottom: 0;
  425. background: white;
  426. margin: 0 20rpx;
  427. border-radius: 20rpx;
  428. .item1,
  429. .item3 {
  430. width: 40%;
  431. .text {
  432. text-overflow: ellipsis;
  433. overflow: hidden;
  434. white-space: nowrap;
  435. }
  436. }
  437. .item1 .text {
  438. text-align: left;
  439. }
  440. .item3 .text {
  441. text-align: right;
  442. }
  443. }
  444. .change-btn {
  445. width: 86rpx;
  446. height: 86rpx;
  447. }
  448. .good-list {
  449. background-color: white;
  450. margin: 20rpx;
  451. padding: 20rpx 0rpx 0 0;
  452. border-radius: 20rpx;
  453. .row1 {
  454. font-size: 26rpx;
  455. .item1 {
  456. color: #333333;
  457. }
  458. .item2 {
  459. color: #FE6300;
  460. }
  461. }
  462. .row2 {
  463. margin: 30rpx 0;
  464. }
  465. .row3 {
  466. background: #F5F6FA;
  467. padding: 20rpx;
  468. border-radius: 10rpx;
  469. color: #333333;
  470. .hz {
  471. width: 74rpx;
  472. height: 74rpx;
  473. margin-right: 30rpx;
  474. }
  475. }
  476. .row4 {
  477. margin: 20rpx 0;
  478. .time {
  479. font-size: 26rpx;
  480. color: #999999;
  481. margin-right: 20rpx;
  482. }
  483. .car {
  484. font-size: 28rpx;
  485. color: #000000;
  486. }
  487. }
  488. .row5 {
  489. margin: 20rpx 0;
  490. font-size: 28rpx;
  491. .stop {
  492. border-radius: 33px;
  493. border: 1px solid #FE6300;
  494. padding: 13rpx 31rpx;
  495. margin-right: 20rpx;
  496. color: #FE6300;
  497. }
  498. .normal {
  499. border: 1px solid #CDCDCD;
  500. border-radius: 33px;
  501. padding: 13rpx 31rpx;
  502. }
  503. }
  504. }
  505. .jt-icon {
  506. position: relative;
  507. top: 6rpx;
  508. width: 60rpx;
  509. margin: 0 20rpx;
  510. }
  511. .row {
  512. margin: 10rpx 0;
  513. align-items: center;
  514. }
  515. // .item-bottom {
  516. // background: #F0F5FF;
  517. // padding: 0 30rpx;
  518. // .name {
  519. // font-size: 26rpx;
  520. // font-weight: 700;
  521. // color: #000000;
  522. // margin-left: 30rpx;
  523. // }
  524. // .hp {
  525. // margin: 30rpx;
  526. // }
  527. // .number-color {
  528. // margin: 0 10rpx;
  529. // }
  530. // .qd {
  531. // background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  532. // border-radius: 13px;
  533. // font-size: 29rpx;
  534. // font-weight: 400;
  535. // color: #FFFFFF;
  536. // padding: 10rpx 35rpx;
  537. // }
  538. // }
  539. .dw {
  540. align-items: center;
  541. }
  542. .mescroll {
  543. margin-top: calc(var(--status-bar-height) + 140rpx);
  544. }
  545. .sline {
  546. height: 28rpx;
  547. width: 1px;
  548. background: black;
  549. margin: 0 20rpx;
  550. }
  551. .search-view {
  552. margin-top: var(--status-bar-height);
  553. background: white;
  554. padding: 0 20rpx;
  555. }
  556. .back-icon {
  557. margin-right: 20rpx;
  558. }
  559. .near-search-text {
  560. margin: 20rpx 0;
  561. }
  562. .item-style {
  563. background: #F5F6FA;
  564. padding: 11rpx 24rpx;
  565. margin-right: 20rpx;
  566. border-radius: 10px;
  567. font-size: 26rpx;
  568. color: #333333;
  569. }
  570. /deep/.u-modal__content {
  571. flex-direction: column;
  572. }
  573. </style>