record.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. <template>
  2. <view class="content">
  3. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" class="mescroll">
  4. <view class="top">
  5. <u-icon class="back" name="arrow-left" color="" size="20" @click="back"></u-icon>
  6. <u-search placeholder="可按编号、货主、收发地查找" v-model="searchKeyWord" @search="search" @custom="search"
  7. bgColor='#F5F6FA'></u-search>
  8. </view>
  9. <view :id="'good'+good.id" class="good-list" v-for="good in goods" :key="good.id"
  10. @click="toDetail(good.id)">
  11. <view style="padding: 0 35rpx 20rpx 35rpx;">
  12. <view class="flex flex-space-between row1">
  13. <view class="item1">
  14. {{good.taskNo}}
  15. <!-- {{good.goodsName}} -->
  16. </view>
  17. <view class="item2 ytg-color" v-if="good.status=='已通过'">{{good.status}}</view>
  18. <view class="item2 wtg-color" v-if="good.status=='未通过'">{{good.status}}</view>
  19. <view class="item2 shz-color" v-if="good.status=='审核中'">{{good.status}}</view>
  20. <view class="item2 ygq-color" v-if="good.status=='已过期'">{{good.status}}</view>
  21. </view>
  22. <view class="flex row2">
  23. <view class="left flex">
  24. <view class="flex">
  25. <view class="ssx">{{$helper.getProvinceAbbreviation(good.sendPrivate)}}</view>
  26. <view class="level2-title">{{good.sendCity}}</view>
  27. </view>
  28. <view class="level2-title">{{good.sendArea}}</view>
  29. </view>
  30. <image class="jt-icon" src="@/static/images/goodSource/jt.png" mode='widthFix'></image>
  31. <view class="right flex">
  32. <view class="flex">
  33. <view class="ssx">
  34. {{$helper.getProvinceAbbreviation(good.unloadPrivate)}}
  35. </view>
  36. <view class="level2-title">{{good.unloadCity}} </view>
  37. </view>
  38. <view class="level2-title">{{good.unloadArea}}</view>
  39. </view>
  40. </view>
  41. <view class="flex row3">
  42. <view class="left">
  43. <!-- <image class="hz" src="@/static/images/news/hz.png"></image> -->
  44. </view>
  45. <view class="right">
  46. <view class="flex row">
  47. <view class="flex">
  48. <!-- <image class="hz-good" src="@/static/images/order/good-img.png"></image> -->
  49. <view>{{good.goodsName}}</view>
  50. </view>
  51. <view class="cc">{{good.carLengthSmall}} - {{good.carLength}} 米</view>
  52. <view class="sline"></view>
  53. <view>{{carType(good)}}</view>
  54. </view>
  55. <view class="flex align-center">
  56. <view class="">运距约 {{good.distance}}km</view>
  57. <view class="sline"></view>
  58. <view class=" ">{{good.weight}}吨</view>
  59. </view>
  60. </view>
  61. </view>
  62. <view class="row4 flex flex-end align-center">
  63. <view class="time">{{good.updateDate}}</view>
  64. <!-- <view class="car">{{good.freight}}{{good.illingMethod==0?'元/吨':'元/车'}}</view> -->
  65. </view>
  66. <view class="row5 flex flex-end">
  67. <view class="normal" @click.stop="edit(good)" v-if="good.status!='审核中'">编辑</view>
  68. <view class="normal" @click.stop="del(good)">删除</view>
  69. <!-- v-if="good.status!='已通过'" -->
  70. <view class="normal" @click.stop="Refresh(good)" v-if="good.status=='已通过'">刷新</view>
  71. <view class="normal" @click.stop="hideShow(good)" v-if="good.showHide=='1'">隐藏</view>
  72. <view class="normal" @click.stop="hideShow(good)" v-if="good.showHide=='2'">显示</view>
  73. </view>
  74. </view>
  75. </view>
  76. </mescroll-body>
  77. <u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :confirmText='confirmText'
  78. :closeOnClickOverlay='true' :showCancelButton='true' @confirm="confirmClick" @close="cancelClick"
  79. @cancel="cancelClick" class="modal">
  80. </u-modal>
  81. <u-toast ref="uToast"></u-toast>
  82. </view>
  83. </template>
  84. <script>
  85. import {
  86. mapState
  87. } from 'vuex';
  88. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  89. import {
  90. apiGoods
  91. } from "@/api/mock.js"
  92. export default {
  93. mixins: [MescrollMixin], // 使用mixin
  94. data() {
  95. return {
  96. keyword: '',
  97. // isShowStopBtn: false,
  98. // isConfirmLoadingBtn:false,
  99. // isShowCustomerServiceBtn:false,
  100. // isConfirmUnLoadingBtn:false,
  101. // isClosedBtn:false,
  102. searchKeyWord: '',
  103. mescroll: null,
  104. id: '',
  105. confirmText: '确定',
  106. alertTitle: '',
  107. alertContent: "",
  108. isShowAlert: false,
  109. goods: [], // 数据列表
  110. delOrShowHidden: '',
  111. rowObj: {}
  112. }
  113. },
  114. computed: {
  115. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication'])
  116. },
  117. onTabItemTap(e) {
  118. // tab 点击时执行,此处直接接收单击事件
  119. uni.pageScrollTo({
  120. scrollTop: 0,
  121. duration: 300
  122. });
  123. },
  124. created() {
  125. //#ifdef APP-PLUS
  126. // this.getLngLat();
  127. //#endif
  128. },
  129. onLoad() {
  130. // let _isHave = this.$utils.getRoles('aaa')
  131. // console.log(_isHave)
  132. },
  133. onShow() {
  134. // this.upCallback({
  135. // size: 10,
  136. // num: 1
  137. // })
  138. },
  139. // onPageScroll(res) {
  140. // this.scrollTop = res.scrollTop
  141. // console.log("页面滚动了", res.scrollTop)
  142. // if (this.scrollTop > 1200) {
  143. // uni.setTabBarItem({
  144. // index: 1,
  145. // text: '返回顶部',
  146. // iconPath: 'static/images/common/top@2x.png',
  147. // selectedIconPath: 'static/images/common/top@2x.png'
  148. // })
  149. // } else {
  150. // uni.setTabBarItem({
  151. // index: 1,
  152. // text: '订单',
  153. // iconPath: 'static/images/common/dingdan@2x(1).png',
  154. // selectedIconPath: 'static/images/common/dingdan@2x.png'
  155. // })
  156. // }
  157. // },
  158. methods: {
  159. mescrollInit(mescroll) {
  160. this.mescroll = mescroll;
  161. },
  162. search() {
  163. this.mescroll.resetUpScroll()
  164. },
  165. back() {
  166. uni.navigateBack()
  167. },
  168. carType(good) {
  169. let _val = '';
  170. if (good.carModel == 1) {
  171. _val = '不限'
  172. } else {
  173. if (good.carModel.includes(2)) {
  174. _val += '高栏/'
  175. }
  176. if (good.carModel.includes(3)) {
  177. _val += '集装箱/'
  178. }
  179. if (good.carModel.includes(4)) {
  180. _val += '自卸车'
  181. }
  182. }
  183. return _val
  184. },
  185. confirmDel() {
  186. let that = this
  187. this.$request.baseRequest('post', '/publishTaskInfo/deleteTask', {
  188. id: this.rowObj.id,
  189. }).then(res => {
  190. if (res.code == 200) {
  191. this.$refs.uToast.show({
  192. type: 'success',
  193. message: "删除成功!",
  194. complete() {
  195. that.isShowAlert = false
  196. that.mescroll.resetUpScroll()
  197. }
  198. })
  199. } else {
  200. this.$refs.uToast.show({
  201. type: 'success',
  202. message: "删除失败!",
  203. complete() {
  204. that.isShowAlert = false
  205. }
  206. })
  207. }
  208. })
  209. .catch(res => {
  210. uni.$u.toast(res.message);
  211. });
  212. },
  213. del(val) {
  214. this.alertTitle = '确定删除任务?'
  215. this.isShowAlert = true
  216. this.rowObj = val
  217. this.delOrShowHidden = 2
  218. },
  219. edit(item) {
  220. uni.$u.route('/pages/release/editRelease', item);
  221. },
  222. Refresh(val) {
  223. let that = this
  224. this.$request.baseRequest('post', '/publishTaskInfo/api/refresh', {
  225. id: val.id,
  226. commonId: this.userInfo.id
  227. }).then(res => {
  228. if (res.code == 200) {
  229. this.$refs.uToast.show({
  230. type: 'success',
  231. message: "刷新成功"
  232. })
  233. } else {
  234. this.$refs.uToast.show({
  235. type: 'error',
  236. message: "刷新失败",
  237. })
  238. }
  239. this.isShowAlert = false
  240. this.mescroll.resetUpScroll()
  241. })
  242. .catch(res => {
  243. uni.$u.toast(res.message);
  244. });
  245. },
  246. back() {
  247. uni.navigateBack(-1)
  248. },
  249. mescrollInit(mescroll) {
  250. this.mescroll = mescroll;
  251. },
  252. radioChange(n) {
  253. console.log('radioChange', n);
  254. },
  255. confirmHideShow() {
  256. let that = this
  257. this.$request.baseRequest('post', '/publishTaskInfo/api/showHidden', {
  258. id: this.rowObj.id,
  259. }).then(res => {
  260. console.log(this.rowObj)
  261. if (res.code == 200) {
  262. if (this.rowObj.showHide == 2) {
  263. this.$refs.uToast.show({
  264. type: 'success',
  265. message: "显示成功"
  266. })
  267. }
  268. this.isShowAlert = false
  269. this.mescroll.resetUpScroll()
  270. } else {
  271. this.$refs.uToast.show({
  272. type: 'error',
  273. message: "显示失败",
  274. })
  275. }
  276. })
  277. .catch(res => {
  278. uni.$u.toast(res.message);
  279. });
  280. },
  281. hideShow(val) {
  282. //隐藏 显示
  283. // =1为点击隐藏
  284. this.rowObj = val
  285. if (val.showHide == '1') {
  286. this.alertTitle = '确定隐藏任务?'
  287. this.isShowAlert = true
  288. this.delOrShowHidden = 1
  289. } else {
  290. this.confirmHideShow()
  291. }
  292. },
  293. confirmClick() {
  294. if (this.delOrShowHidden == 1) {
  295. this.confirmHideShow();
  296. } else if (this.delOrShowHidden == 2) {
  297. this.confirmDel()
  298. }
  299. },
  300. cancelClick() {
  301. this.isShowAlert = false
  302. },
  303. toDetail(id) {
  304. uni.$u.route('/pages/release/lookRelease', {
  305. id: id,
  306. });
  307. },
  308. upCallback(page) {
  309. uni.showLoading({
  310. mask: true,
  311. title: '加载中...'
  312. })
  313. this.$request.baseRequest('get', '/publishTaskInfo/selectTask', {
  314. commonId: this.userInfo.id,
  315. searchKeyWord: this.searchKeyWord,
  316. searchType: this.searchType,
  317. pageSize: page.size,
  318. currentPage: page.num
  319. }).then(res => {
  320. this.mescroll.endBySize(res.data.records.length, res.data.total);
  321. if (page.num == 1) this.goods = []; //如果是第一页需手动制空列表
  322. this.goods = this.goods.concat(res.data.records); //追加新数据
  323. uni.hideLoading()
  324. })
  325. .catch(res => {
  326. uni.$u.toast(res.message);
  327. });
  328. },
  329. }
  330. }
  331. </script>
  332. <style scoped lang="scss">
  333. .content {
  334. padding-top: var(--status-bar-height);
  335. .top {
  336. display: flex;
  337. background: white;
  338. padding: 20rpx;
  339. .back {
  340. margin-right: 20rpx;
  341. }
  342. }
  343. }
  344. // .banner {
  345. // width: 100%;
  346. // position: relative;
  347. // }
  348. // .fixed,
  349. // .fixed1 {
  350. // background: white;
  351. // position: fixed;
  352. // top: var(--status-bar-height);
  353. // z-index: 999;
  354. // width: 100%;
  355. // }
  356. // .fixed {
  357. // .title {
  358. // background: white;
  359. // position: relative;
  360. // font-size: 36rpx;
  361. // font-weight: 500;
  362. // color: rgba(0, 0, 0, 0.85);
  363. // .search {
  364. // position: absolute;
  365. // right: 20rpx;
  366. // }
  367. // }
  368. // }
  369. // .fixed1 {
  370. // top: 0;
  371. // height: var(--status-bar-height);
  372. // background: white;
  373. // }
  374. // .banner-img {
  375. // width: 100%;
  376. // }
  377. // .head {
  378. // position: absolute;
  379. // width: calc(100% - 108rpx);
  380. // bottom: 0;
  381. // background: white;
  382. // margin: 0 20rpx;
  383. // border-radius: 20rpx;
  384. // .item1,
  385. // .item3 {
  386. // width: 40%;
  387. // .text {
  388. // text-overflow: ellipsis;
  389. // overflow: hidden;
  390. // white-space: nowrap;
  391. // }
  392. // }
  393. // .item1 .text {
  394. // text-align: left;
  395. // }
  396. // .item3 .text {
  397. // text-align: right;
  398. // }
  399. // }
  400. // .change-btn {
  401. // width: 86rpx;
  402. // height: 86rpx;
  403. // }
  404. .hz-good {
  405. width: 44rpx;
  406. height: 44rpx;
  407. margin: 0 30rpx;
  408. }
  409. .good-list {
  410. background-color: white;
  411. margin: 20rpx;
  412. padding: 20rpx 0rpx 0 0;
  413. border-radius: 20rpx;
  414. .row1 {
  415. font-size: 26rpx;
  416. .item1 {
  417. color: #333333;
  418. }
  419. }
  420. .row2 {
  421. margin: 30rpx 0;
  422. .left {
  423. width: calc(50% - 25rpx);
  424. align-items: center;
  425. flex-direction: column;
  426. justify-content: center;
  427. }
  428. .right {
  429. width: calc(50% - 25rpx);
  430. align-items: center;
  431. justify-content: flex-end;
  432. flex-direction: column;
  433. }
  434. }
  435. .row3 {
  436. background: #F5F6FA;
  437. padding: 20rpx;
  438. border-radius: 10rpx;
  439. color: #333333;
  440. .hz {
  441. width: 74rpx;
  442. height: 74rpx;
  443. margin-right: 30rpx;
  444. }
  445. .cc {
  446. margin-left: 20rpx;
  447. }
  448. .yj {
  449. margin-left: 30rpx;
  450. }
  451. }
  452. .row4 {
  453. margin: 20rpx 0;
  454. .time {
  455. font-size: 26rpx;
  456. color: #999999;
  457. margin-right: 20rpx;
  458. }
  459. .car {
  460. font-size: 28rpx;
  461. color: #000000;
  462. }
  463. }
  464. .row5 {
  465. margin: 20rpx 0;
  466. font-size: 28rpx;
  467. .stop {
  468. border-radius: 33px;
  469. border: 1px solid #FE6300;
  470. padding: 13rpx 31rpx;
  471. margin-right: 20rpx;
  472. color: #FE6300;
  473. }
  474. .normal {
  475. border: 1px solid #CDCDCD;
  476. border-radius: 33px;
  477. padding: 13rpx 31rpx;
  478. margin-left: 20rpx;
  479. }
  480. }
  481. }
  482. .jt-icon {
  483. position: relative;
  484. top: 6rpx;
  485. width: 60rpx;
  486. margin: 0 20rpx;
  487. }
  488. .row {
  489. margin: 10rpx 0;
  490. align-items: center;
  491. }
  492. // .item-bottom {
  493. // background: #F0F5FF;
  494. // padding: 0 30rpx;
  495. // .name {
  496. // font-size: 26rpx;
  497. // font-weight: 700;
  498. // color: #000000;
  499. // margin-left: 30rpx;
  500. // }
  501. // .hp {
  502. // margin: 30rpx;
  503. // }
  504. // .number-color {
  505. // margin: 0 10rpx;
  506. // }
  507. // .qd {
  508. // background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  509. // border-radius: 13px;
  510. // font-size: 29rpx;
  511. // font-weight: 400;
  512. // color: #FFFFFF;
  513. // padding: 10rpx 35rpx;
  514. // }
  515. // }
  516. .dw {
  517. align-items: center;
  518. }
  519. // .mescroll {
  520. // margin-top: calc(var(--status-bar-height) + 140rpx);
  521. // }
  522. .sline {
  523. height: 28rpx;
  524. width: 1px;
  525. background: black;
  526. margin: 0 20rpx;
  527. }
  528. .search-view {
  529. margin-top: var(--status-bar-height);
  530. background: white;
  531. padding: 0 20rpx;
  532. }
  533. .back-icon {
  534. margin-right: 20rpx;
  535. }
  536. .near-search-text {
  537. margin: 20rpx 0;
  538. }
  539. .item-style {
  540. background: #F5F6FA;
  541. padding: 11rpx 24rpx;
  542. margin-right: 20rpx;
  543. border-radius: 10px;
  544. font-size: 26rpx;
  545. color: #333333;
  546. }
  547. /deep/.u-modal__content {
  548. flex-direction: column;
  549. }
  550. </style>