record.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772
  1. <template>
  2. <view class="content">
  3. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" class="mescroll"
  4. :up="upOption">
  5. <view class="top">
  6. <u-icon class="back" name="arrow-left" color="" size="20" @click="back"></u-icon>
  7. <u-search placeholder="可按编号、货主、收发地查找" v-model="searchKeyWord" @search="search" @custom="search"
  8. bgColor='#F5F6FA'></u-search>
  9. </view>
  10. <!-- <u-tabs
  11. :list="list1"
  12. lineWidth="30"
  13. lineColor="#f56c6c"
  14. :activeStyle="{
  15. color: '#303133',
  16. fontWeight: 'bold',
  17. transform: 'scale(1.05)'
  18. }"
  19. :inactiveStyle="{
  20. color: '#606266',
  21. transform: 'scale(1)'
  22. }"
  23. itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;"
  24. >
  25. </u-tabs> -->
  26. <view class='tab-nav'>
  27. <view class='tab-item' v-for='item in list1' @click='statuschange(item)'
  28. :class='{active:item.status==searchType}'>
  29. {{item.name}}
  30. <!-- {{item.num}} -->
  31. </view>
  32. </view>
  33. <!-- <u-tabs :list="list1" @click="click"></u-tabs> -->
  34. <view :id="'good'+good.id" class="good-list" v-for="good in goods" :key="good.id"
  35. @click="toDetail(good.id)">
  36. <view style="padding: 0 35rpx 20rpx 35rpx;">
  37. <view class="flex flex-space-between row1">
  38. <view class="item1">
  39. {{good.taskNo}}
  40. <!-- {{good.goodsName}} -->
  41. </view>
  42. <view class="item2 ytg-color" v-if="good.status=='已通过'">{{good.status}}</view>
  43. <view class="item2 wtg-color" v-if="good.status=='未通过'">{{good.status}}</view>
  44. <view class="item2 shz-color" v-if="good.status=='审核中'">{{good.status}}</view>
  45. <view class="item2 ygq-color" v-if="good.status=='已过期'">{{good.status}}</view>
  46. </view>
  47. <view class="flex row2">
  48. <view class="left flex">
  49. <view class="flex">
  50. <view class="ssx">
  51. {{$helper.getProvinceAbbreviation(good.sendPrivate?good.sendPrivate:good.sendCity)}}
  52. </view>
  53. <view class="level2-title">{{good.sendCity}}</view>
  54. </view>
  55. <view class="level2-title">{{good.sendArea}}</view>
  56. </view>
  57. <image class="jt-icon" src="@/static/images/goodSource/jt.png" mode='widthFix'></image>
  58. <view class="right flex">
  59. <view class="flex">
  60. <view class="ssx">
  61. {{$helper.getProvinceAbbreviation(good.unloadPrivate?good.unloadPrivate:good.unloadCity)}}
  62. </view>
  63. <view class="level2-title">{{good.unloadCity}} </view>
  64. </view>
  65. <view class="level2-title">{{good.unloadArea}}</view>
  66. </view>
  67. </view>
  68. <view class="flex row3">
  69. <view class="left">
  70. <!-- <image class="hz" src="@/static/images/news/hz.png"></image> -->
  71. </view>
  72. <view class="right">
  73. <view class="flex row">
  74. <view class="flex">
  75. <!-- <image class="hz-good" src="@/static/images/order/good-img.png"></image> -->
  76. <view>{{good.goodsName}}</view>
  77. </view>
  78. <view class="sline" v-if="good.carLengthSmall&&good.carLength"></view>
  79. <view class="cc" v-if="good.carLengthSmall&&good.carLength">{{good.carLengthSmall}} -
  80. {{good.carLength}} 米
  81. </view>
  82. <view class="sline" v-if="carType(good)"></view>
  83. <view>{{carType(good)}}</view>
  84. </view>
  85. <view class="flex align-center">
  86. <view class="">运距约 {{good.distance}}km</view>
  87. <view v-if='good.weight' class="sline"></view>
  88. <view v-if='good.weight' class="">{{good.weight}}吨</view>
  89. </view>
  90. </view>
  91. </view>
  92. <view class="row4 flex flex-end align-center">
  93. <view class="time">{{good.updateDate}}</view>
  94. <!-- <view class="car">{{good.freight}}{{good.illingMethod==0?'元/吨':'元/车'}}</view> -->
  95. </view>
  96. <view style='justify-content: space-between;' class="row5 flex">
  97. <!-- <u-icon name="share" @click.stop="share(good)" size="28"></u-icon> -->
  98. <view class="normal" @click.stop="share(good)">分享</view>
  99. <view class='flex'>
  100. <view class="normal" @click.stop="edit(good)" v-if="good.status =='未通过'">编辑</view>
  101. <!-- 只有已驳回的任务有编辑-->
  102. <view class="normal" @click.stop="del(good)">删除</view>
  103. <!-- v-if="good.status!='已通过'" -->
  104. <view class="normal" @click.stop="Refresh(good)" v-if="good.status=='已通过'">刷新</view>
  105. <view class="normal" @click.stop="hideShow(good)" v-if="good.showHide=='1'&&good.status=='已通过'">
  106. 隐藏</view>
  107. <view class="normal" @click.stop="hideShow(good)" v-if="good.showHide=='2'&&good.status=='已通过'">
  108. 显示</view>
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. </mescroll-body>
  114. <u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :confirmText='confirmText'
  115. :closeOnClickOverlay='true' :showCancelButton='true' @confirm="$u.throttle(confirmClick, 1000)"
  116. @close="cancelClick" @cancel="cancelClick" class="modal">
  117. </u-modal>
  118. <u-popup :show="isShowCode" @close="isShowCode=false" mode="center" :round='10'>
  119. <image :src="currectData.qrCode" mode="widthFix" style="height: auto;"></image>
  120. <u-icon style='margin:0 auto;' name="download" @click="download" size="28"></u-icon>
  121. </u-popup>
  122. <u-toast ref="uToast"></u-toast>
  123. </view>
  124. </template>
  125. <script>
  126. import {
  127. mapState
  128. } from 'vuex';
  129. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  130. import {
  131. apiGoods
  132. } from "@/api/mock.js"
  133. export default {
  134. mixins: [MescrollMixin], // 使用mixin
  135. data() {
  136. return {
  137. keyword: '',
  138. isShowCode:false,
  139. // isShowStopBtn: false,
  140. // isConfirmLoadingBtn:false,
  141. // isShowCustomerServiceBtn:false,
  142. // isConfirmUnLoadingBtn:false,
  143. // isClosedBtn:false,
  144. searchKeyWord: '',
  145. currectData:{},
  146. mescroll: null,
  147. id: '',
  148. confirmText: '确定',
  149. searchType: '',
  150. alertTitle: '',
  151. alertContent: "",
  152. isShowAlert: false,
  153. goods: [], // 数据列表
  154. delOrShowHidden: '',
  155. rowObj: {},
  156. list1: [{
  157. name: '全部',
  158. status: '',
  159. num: 0,
  160. }, {
  161. name: '审核中',
  162. status: '1',
  163. num: 0,
  164. }, {
  165. name: '已通过',
  166. status: '3',
  167. num: 0,
  168. }, {
  169. name: '未通过',
  170. status: '2',
  171. num: 0,
  172. }, {
  173. name: '已过期',
  174. status: '4',
  175. num: 0,
  176. }],
  177. upOption: {
  178. page: {
  179. size: 10 // 每页数据的数量,默认10
  180. },
  181. noMoreSize: 0, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  182. empty: {
  183. tip: ''
  184. }
  185. },
  186. }
  187. },
  188. computed: {
  189. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication'])
  190. },
  191. onTabItemTap(e) {
  192. // tab 点击时执行,此处直接接收单击事件
  193. uni.pageScrollTo({
  194. scrollTop: 0,
  195. duration: 300
  196. });
  197. },
  198. created() {
  199. //#ifdef APP-PLUS
  200. // this.getLngLat();
  201. //#endif
  202. },
  203. onLoad() {
  204. // let _isHave = this.$utils.getRoles('aaa')
  205. // console.log(_isHave)
  206. },
  207. onShow() {
  208. this.upCallback({
  209. size: 10,
  210. num: 1
  211. })
  212. },
  213. // onPageScroll(res) {
  214. // this.scrollTop = res.scrollTop
  215. // console.log("页面滚动了", res.scrollTop)
  216. // if (this.scrollTop > 1200) {
  217. // uni.setTabBarItem({
  218. // index: 1,
  219. // text: '返回顶部',
  220. // iconPath: 'static/images/common/top@2x.png',
  221. // selectedIconPath: 'static/images/common/top@2x.png'
  222. // })
  223. // } else {
  224. // uni.setTabBarItem({
  225. // index: 1,
  226. // text: '订单',
  227. // iconPath: 'static/images/common/dingdan@2x(1).png',
  228. // selectedIconPath: 'static/images/common/dingdan@2x.png'
  229. // })
  230. // }
  231. // },
  232. methods: {
  233. download(){
  234. var that = this
  235. console.log(this.currectData.qrCode)
  236. uni.downloadFile({
  237. url: that.currectData.qrCode, // 这里是我已经请求好的图片数据
  238. success: (res) => {
  239. console.log(res, 'res')
  240. var tempFilePath = res.tempFilePath;
  241. uni.saveImageToPhotosAlbum({ // 然后调用这个方法
  242. filePath: tempFilePath,
  243. success: (res) => {
  244. uni.showToast({
  245. title: '图片已保存'
  246. })
  247. }
  248. })
  249. },
  250. fail: () => {
  251. uni.showToast({
  252. title: '图片保存失败'
  253. })
  254. }
  255. });
  256. },
  257. share(item){
  258. this.currectData=item
  259. this.isShowCode=true
  260. },
  261. statuschange(item) {
  262. this.searchType = item.status
  263. this.upCallback({
  264. size: 10,
  265. num: 1
  266. })
  267. },
  268. mescrollInit(mescroll) {
  269. this.mescroll = mescroll;
  270. },
  271. search() {
  272. this.mescroll.resetUpScroll()
  273. },
  274. back() {
  275. uni.navigateBack()
  276. },
  277. carType(good) {
  278. let _val = '';
  279. if (good.carModel == 1) {
  280. _val = ''
  281. } else {
  282. if (good.carModel && good.carModel.includes(2)) {
  283. _val += '高栏'
  284. }
  285. if (good.carModel && good.carModel.includes(3)) {
  286. _val += '/集装箱'
  287. }
  288. if (good.carModel && good.carModel.includes(4)) {
  289. _val += '/自卸车'
  290. }
  291. }
  292. return _val
  293. },
  294. confirmDel() {
  295. let that = this
  296. that.isShowAlert = false
  297. this.$request.baseRequest('post', '/publishTaskInfo/deleteTask', {
  298. id: this.rowObj.id,
  299. }).then(res => {
  300. if (res.code == 200) {
  301. this.$refs.uToast.show({
  302. type: 'success',
  303. message: "删除成功!",
  304. complete() {
  305. that.mescroll.resetUpScroll()
  306. }
  307. })
  308. } else {
  309. this.$refs.uToast.show({
  310. type: 'success',
  311. message: "删除失败!",
  312. complete() {
  313. that.isShowAlert = false
  314. }
  315. })
  316. }
  317. })
  318. .catch(res => {
  319. uni.$u.toast(res.message);
  320. });
  321. },
  322. del(val) {
  323. this.alertTitle = '确定删除任务?'
  324. this.isShowAlert = true
  325. this.rowObj = val
  326. this.delOrShowHidden = 2
  327. },
  328. edit(item) {
  329. uni.$u.route('/pages/release/editRelease', item);
  330. },
  331. Refresh(val) {
  332. let that = this
  333. this.$request.baseRequest('post', '/publishTaskInfo/api/refresh', {
  334. id: val.id,
  335. commonId: this.userInfo.id
  336. }).then(res => {
  337. if (res.code == 200) {
  338. this.$refs.uToast.show({
  339. type: 'success',
  340. message: "刷新成功"
  341. })
  342. } else {
  343. this.$refs.uToast.show({
  344. type: 'error',
  345. message: "刷新失败",
  346. })
  347. }
  348. this.isShowAlert = false
  349. this.mescroll.resetUpScroll()
  350. })
  351. .catch(res => {
  352. uni.$u.toast(res.message);
  353. });
  354. },
  355. back() {
  356. uni.navigateBack(-1)
  357. },
  358. radioChange(n) {
  359. console.log('radioChange', n);
  360. },
  361. confirmHideShow() {
  362. let that = this
  363. this.$request.baseRequest('post', '/publishTaskInfo/api/showHidden', {
  364. id: this.rowObj.id,
  365. }).then(res => {
  366. console.log(this.rowObj)
  367. if (res.code == 200) {
  368. if (this.rowObj.showHide == 2) {
  369. this.$refs.uToast.show({
  370. type: 'success',
  371. message: "显示成功"
  372. })
  373. }
  374. this.isShowAlert = false
  375. this.mescroll.resetUpScroll()
  376. } else {
  377. this.$refs.uToast.show({
  378. type: 'error',
  379. message: "显示失败",
  380. })
  381. }
  382. })
  383. .catch(res => {
  384. uni.$u.toast(res.message);
  385. });
  386. },
  387. hideShow(val) {
  388. //隐藏 显示
  389. // =1为点击隐藏
  390. this.rowObj = val
  391. if (val.showHide == '1') {
  392. this.alertTitle = '确定隐藏任务?'
  393. this.isShowAlert = true
  394. this.delOrShowHidden = 1
  395. } else {
  396. this.confirmHideShow()
  397. }
  398. },
  399. confirmClick() {
  400. if (this.delOrShowHidden == 1) {
  401. this.confirmHideShow();
  402. } else if (this.delOrShowHidden == 2) {
  403. this.confirmDel()
  404. }
  405. },
  406. cancelClick() {
  407. this.isShowAlert = false
  408. },
  409. toDetail(id) {
  410. uni.$u.route('/pages/release/lookRelease', {
  411. id: id,
  412. });
  413. },
  414. upCallback(page) {
  415. uni.showLoading({
  416. mask: true,
  417. title: '加载中...'
  418. })
  419. this.$request.baseRequest('get', '/publishTaskInfo/selectNum', {
  420. commonId: this.userInfo.id,
  421. }).then(res => {
  422. this.list1[0].num = res.data.allNum
  423. this.list1[1].num = res.data.examieNum
  424. this.list1[2].num = res.data.passNum
  425. this.list1[3].num = res.data.noNum
  426. this.list1[4].num = res.data.overdueNum
  427. })
  428. .catch(res => {
  429. uni.$u.toast(res.message);
  430. });
  431. this.$request.baseRequest('get', '/publishTaskInfo/selectTask', {
  432. commonId: this.userInfo.id,
  433. searchKeyWord: this.searchKeyWord,
  434. searchType: this.searchType,
  435. pageSize: page.size,
  436. currentPage: page.num
  437. }).then(res => {
  438. this.mescroll.endBySize(res.data.records.length, res.data.total);
  439. if (page.num == 1) this.goods = []; //如果是第一页需手动制空列表
  440. this.goods = this.goods.concat(res.data.records); //追加新数据
  441. uni.hideLoading()
  442. })
  443. .catch(res => {
  444. uni.hideLoading()
  445. uni.$u.toast(res.message);
  446. });
  447. },
  448. }
  449. }
  450. </script>
  451. <style scoped lang="scss">
  452. .content {
  453. padding-top: var(--status-bar-height);
  454. // background: white;
  455. .top {
  456. display: flex;
  457. background: white;
  458. padding: 20rpx;
  459. .back {
  460. margin-right: 20rpx;
  461. }
  462. }
  463. }
  464. // .banner {
  465. // width: 100%;
  466. // position: relative;
  467. // }
  468. // .fixed,
  469. // .fixed1 {
  470. // background: white;
  471. // position: fixed;
  472. // top: var(--status-bar-height);
  473. // z-index: 999;
  474. // width: 100%;
  475. // }
  476. // .fixed {
  477. // .title {
  478. // background: white;
  479. // position: relative;
  480. // font-size: 36rpx;
  481. // font-weight: 500;
  482. // color: rgba(0, 0, 0, 0.85);
  483. // .search {
  484. // position: absolute;
  485. // right: 20rpx;
  486. // }
  487. // }
  488. // }
  489. // .fixed1 {
  490. // top: 0;
  491. // height: var(--status-bar-height);
  492. // background: white;
  493. // }
  494. // .banner-img {
  495. // width: 100%;
  496. // }
  497. // .head {
  498. // position: absolute;
  499. // width: calc(100% - 108rpx);
  500. // bottom: 0;
  501. // background: white;
  502. // margin: 0 20rpx;
  503. // border-radius: 20rpx;
  504. // .item1,
  505. // .item3 {
  506. // width: 40%;
  507. // .text {
  508. // text-overflow: ellipsis;
  509. // overflow: hidden;
  510. // white-space: nowrap;
  511. // }
  512. // }
  513. // .item1 .text {
  514. // text-align: left;
  515. // }
  516. // .item3 .text {
  517. // text-align: right;
  518. // }
  519. // }
  520. // .change-btn {
  521. // width: 86rpx;
  522. // height: 86rpx;
  523. // }
  524. .hz-good {
  525. width: 44rpx;
  526. height: 44rpx;
  527. margin: 0 30rpx;
  528. }
  529. .good-list {
  530. background-color: white;
  531. margin: 20rpx;
  532. padding: 20rpx 0rpx 0 0;
  533. border-radius: 20rpx;
  534. .row1 {
  535. font-size: 26rpx;
  536. .item1 {
  537. color: #333333;
  538. }
  539. }
  540. .row2 {
  541. margin: 30rpx 0;
  542. .left {
  543. width: calc(50% - 25rpx);
  544. align-items: center;
  545. flex-direction: column;
  546. justify-content: center;
  547. }
  548. .right {
  549. width: calc(50% - 25rpx);
  550. align-items: center;
  551. justify-content: flex-end;
  552. flex-direction: column;
  553. }
  554. }
  555. .row3 {
  556. background: #F5F6FA;
  557. padding: 20rpx;
  558. border-radius: 10rpx;
  559. color: #333333;
  560. .hz {
  561. width: 74rpx;
  562. height: 74rpx;
  563. margin-right: 30rpx;
  564. }
  565. .cc {
  566. margin-left: 10rpx;
  567. }
  568. .yj {
  569. margin-left: 30rpx;
  570. }
  571. }
  572. .row4 {
  573. margin: 20rpx 0;
  574. .time {
  575. font-size: 26rpx;
  576. color: #999999;
  577. margin-right: 20rpx;
  578. }
  579. .car {
  580. font-size: 28rpx;
  581. color: #000000;
  582. }
  583. }
  584. .row5 {
  585. margin: 20rpx 0;
  586. font-size: 28rpx;
  587. .stop {
  588. border-radius: 33px;
  589. border: 1px solid #FE6300;
  590. padding: 13rpx 31rpx;
  591. margin-right: 20rpx;
  592. color: #FE6300;
  593. }
  594. .normal {
  595. border: 1px solid #CDCDCD;
  596. border-radius: 33px;
  597. padding: 13rpx 31rpx;
  598. margin-left: 20rpx;
  599. }
  600. }
  601. }
  602. .jt-icon {
  603. position: relative;
  604. top: 6rpx;
  605. width: 60rpx;
  606. margin: 0 20rpx;
  607. }
  608. .row {
  609. margin: 10rpx 0;
  610. align-items: center;
  611. }
  612. // .item-bottom {
  613. // background: #F0F5FF;
  614. // padding: 0 30rpx;
  615. // .name {
  616. // font-size: 26rpx;
  617. // font-weight: 700;
  618. // color: #000000;
  619. // margin-left: 30rpx;
  620. // }
  621. // .hp {
  622. // margin: 30rpx;
  623. // }
  624. // .number-color {
  625. // margin: 0 10rpx;
  626. // }
  627. // .qd {
  628. // background: linear-gradient(97deg, #4FABFD 0%, #F5BA3C 100%);
  629. // border-radius: 13px;
  630. // font-size: 29rpx;
  631. // font-weight: 400;
  632. // color: #FFFFFF;
  633. // padding: 10rpx 35rpx;
  634. // }
  635. // }
  636. .dw {
  637. align-items: center;
  638. }
  639. // .mescroll {
  640. // margin-top: calc(var(--status-bar-height) + 140rpx);
  641. // }
  642. .sline {
  643. height: 28rpx;
  644. width: 1px;
  645. background: black;
  646. margin: 0 20rpx;
  647. }
  648. .search-view {
  649. margin-top: var(--status-bar-height);
  650. background: white;
  651. padding: 0 20rpx;
  652. }
  653. .back-icon {
  654. margin-right: 20rpx;
  655. }
  656. .near-search-text {
  657. margin: 20rpx 0;
  658. }
  659. .item-style {
  660. background: #F5F6FA;
  661. padding: 11rpx 24rpx;
  662. margin-right: 20rpx;
  663. border-radius: 10px;
  664. font-size: 26rpx;
  665. color: #333333;
  666. }
  667. /deep/.u-modal__content {
  668. flex-direction: column;
  669. }
  670. .tab-nav {
  671. width: 100%;
  672. background: white;
  673. display: flex;
  674. }
  675. .tab-item {
  676. width: 25%;
  677. display: block;
  678. position: relative;
  679. text-align: center;
  680. padding: 10px 0;
  681. box-sizing: border-box;
  682. color: #7D8087;
  683. font-size: 14px;
  684. }
  685. .tab-item.active {
  686. color: #000;
  687. font-size: 16px;
  688. }
  689. .tab-item.active:after {
  690. position: absolute;
  691. content: '';
  692. display: block;
  693. width: 50%;
  694. left: 50%;
  695. transform: translate(-50%);
  696. height: 4px;
  697. bottom: 0;
  698. background: #F5BA3C;
  699. border-radius: 2px;
  700. }
  701. </style>