index.vue 12 KB

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