car_detail.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833
  1. <template>
  2. <view class="container">
  3. <view class="detail-desc">
  4. <view class="d-header">
  5. <text>基本信息</text>
  6. </view>
  7. <view class="c-list">
  8. <view class="c-row b-b">
  9. <text class="tit">承运人</text>
  10. <view class="con-list">
  11. <text>{{car.driver}}</text>
  12. </view>
  13. </view>
  14. <view class="c-row b-b">
  15. <text class="tit">承运人电话</text>
  16. <view class="con-list">
  17. <text>{{car.driverPhone}}</text>
  18. </view>
  19. </view>
  20. <view class="c-row b-b">
  21. <text class="tit">车牌号</text>
  22. <view class="con-list">
  23. <text>{{car.carNo}}</text>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="d-header">
  28. <text>货源信息</text>
  29. </view>
  30. <view class="c-list">
  31. <view class="c-row b-b">
  32. <view class="tit">货源单号</view>
  33. <view class="con-list">
  34. <text >{{tranNo}}</text>
  35. </view>
  36. <button class="cu-btn bg-green shadow" @tap="showModal" data-target="RadioModal">选择</button>
  37. </view>
  38. <view class="c-row b-b">
  39. <text class="tit">剩余量</text>
  40. <view class="con-list">
  41. <text>{{exsitCount}}</text>
  42. </view>
  43. </view>
  44. <view class="c-row b-b">
  45. <text class="tit">价格</text>
  46. <view class="con-list">
  47. <input placeholder="请填写" name="input" @input="priceInput"></input>
  48. </view>
  49. </view>
  50. <view class="c-row b-b">
  51. <text class="tit">承运吨数</text>
  52. <view class="con-list">
  53. <input placeholder="请填写" type="mobile" name="input" @input="tranCountInput"></input>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="cu-modal" :class="modalName=='RadioModal'?'show':''" @tap="hideModal">
  59. <scroll-view scroll-y class="cu-dialog" style="height: 800rpx;" @tap.stop="">
  60. <radio-group class="block" @change="RadioChange">
  61. <view class="cu-list menu text-left">
  62. <view class="cu-item" v-for="(item,index) in tranInfo" :key="index">
  63. <label class="flex justify-between align-center flex-sub">
  64. <view class="flex-sub">{{item.tranNo}}(剩余量:{{item.total-item.tranCount}})</view>
  65. <radio class="round" :class="tranNo==item.tranNo?'checked':''" :checked="tranNo==item.tranNo?true:false"
  66. :value="index"></radio>
  67. </label>
  68. </view>
  69. </view>
  70. </radio-group>
  71. </scroll-view>
  72. </view>
  73. <!-- 底部操作菜单 -->
  74. <view class="page-bottom">
  75. <view class="action-btn-group">
  76. <button type="primary" class=" action-btn no-border buy-now-btn" @click="contactUs">联系我们</button>
  77. <button v-if="car.status == 2" type="primary" class=" action-btn no-border add-cart-btn" @click="tranNow">立即委派</button>
  78. <button v-else type="primary" class=" action-btn no-border add-cart-btn" >正在承运</button>
  79. </view>
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. import uniNumberBox from '@/components/uni-number-box.vue';
  85. import {
  86. mapState
  87. } from 'vuex';
  88. export default {
  89. components: {
  90. uniNumberBox
  91. },
  92. data() {
  93. return {
  94. car: {
  95. id:'',
  96. tranNo:'',
  97. tranCount: 0,
  98. price:0,
  99. driverPhone:'',
  100. },
  101. tranInfo:{},
  102. driver:'',
  103. driverPhone:'',
  104. price:0,
  105. carNo:'',
  106. tranCount: 0,
  107. sendText:'获取验证码',
  108. sendDisabled: false,
  109. verifyCode:'',
  110. modalName: null,
  111. tranNo: '请选择货源单号',
  112. exsitCount:0
  113. };
  114. },
  115. onShow() {
  116. },
  117. onLoad(options) {
  118. const that = this
  119. uni.showLoading({
  120. title: '正在加载',
  121. mask:true
  122. })
  123. that.$api.request('tran', 'getCarDetailInfo', {
  124. id: options.id
  125. }, failres => {
  126. that.$api.msg(failres.errmsg)
  127. uni.hideLoading()
  128. }).then(res => {
  129. that.car = res.data
  130. uni.hideLoading()
  131. })
  132. },
  133. computed: {
  134. ...mapState(['hasLogin','userInfo'])
  135. },
  136. methods: {
  137. RadioChange(e) {
  138. this.tranNo = this.tranInfo[e.detail.value].tranNo
  139. this.exsitCount = this.tranInfo[e.detail.value].total - this.tranInfo[e.detail.value].tranCount
  140. this.modalName = null
  141. },
  142. tranCountInput(e) {
  143. this.tranCount = e.detail.value
  144. },
  145. priceInput(e) {
  146. this.price = e.detail.value
  147. },
  148. hideModal(e) {
  149. this.modalName = null
  150. },
  151. showModal(e) {
  152. // if (!this.hasLogin||this.userInfo.phone == undefined) {
  153. // uni.showModal({
  154. // title: '登录提示',
  155. // content: '您尚未登录,是否立即登录?',
  156. // showCancel: true,
  157. // confirmText: '登录',
  158. // success: (e) => {
  159. // if (e.confirm) {
  160. // uni.navigateTo({
  161. // url: '/pages/public/login'
  162. // })
  163. // }
  164. // },
  165. // fail: () => {},
  166. // complete: () => {}
  167. // })
  168. // }
  169. // else{
  170. let that = this
  171. this.modalName = e.currentTarget.dataset.target
  172. this.$api.request('tran', 'getTranNoList',{
  173. senderPhone: that.userInfo.phone,
  174. }, failres => {
  175. that.$api.msg(failres.errmsg)
  176. uni.hideLoading()
  177. }).then(res => {
  178. let data = res.data
  179. console.log(data.tranInfo)
  180. //销售信息
  181. if(data.tranInfo){
  182. that.tranInfo = data.tranInfo
  183. }
  184. uni.hideLoading()
  185. })
  186. // }
  187. },
  188. contactUs() {
  189. const that = this
  190. uni.makePhoneCall({
  191. // 手机号
  192. phoneNumber: that.car.driverPhone,
  193. // 成功回调
  194. success: (res) => {
  195. console.log('调用成功!')
  196. },
  197. // 失败回调
  198. fail: (res) => {
  199. console.log('调用失败!')
  200. }
  201. });
  202. },
  203. tranNow(){
  204. let that = this
  205. if (!this.hasLogin) {
  206. uni.showModal({
  207. title: '登录提示',
  208. content: '您尚未登录,是否立即登录?',
  209. showCancel: true,
  210. confirmText: '登录',
  211. success: (e) => {
  212. if (e.confirm) {
  213. uni.navigateTo({
  214. url: '/pages/public/login'
  215. })
  216. }
  217. },
  218. fail: () => {},
  219. complete: () => {}
  220. })
  221. }
  222. else{
  223. if(!that.tranNo){
  224. this.$api.msg('请选择货源单号');
  225. return;
  226. }
  227. if (!that.price) {
  228. that.$api.msg('请填写运价');
  229. return
  230. }
  231. if (!that.tranCount) {
  232. that.$api.msg('请填写承运吨数');
  233. return
  234. }
  235. if(that.tranCount>that.exsitCount){
  236. that.$api.msg('承运吨数必须小于等于剩余量');
  237. return
  238. }
  239. that.car.tranCount = that.tranCount
  240. that.car.price = that.price
  241. that.car.tranNo = that.tranNo
  242. uni.showLoading({
  243. title: '正在提交',
  244. mask:true
  245. })
  246. that.$api.request('tran', 'pipei',that.car, failres => {
  247. uni.hideLoading()
  248. that.$api.msg(failres.errmsg);
  249. }).then(res => {
  250. uni.hideLoading()
  251. uni.showModal({
  252. title: '提示',
  253. content: "委派承运成功",
  254. showCancel: false,
  255. confirmText: '确定',
  256. success: () => {
  257. uni.navigateBack({
  258. delta: 2
  259. })
  260. }
  261. })
  262. // that.$api.prePage().refreshList(data, that.manageType);
  263. })
  264. }
  265. }
  266. },
  267. }
  268. </script>
  269. <style lang='scss' scoped>
  270. page {
  271. background: $page-color-base;
  272. padding-bottom: 160upx;
  273. }
  274. .icon-you {
  275. font-size: $font-base + 2upx;
  276. color: #888;
  277. }
  278. .carousel {
  279. height: 722upx;
  280. position: relative;
  281. swiper {
  282. height: 100%;
  283. }
  284. .image-wrapper {
  285. width: 100%;
  286. height: 100%;
  287. }
  288. .swiper-item {
  289. display: flex;
  290. justify-content: center;
  291. align-content: center;
  292. height: 750upx;
  293. overflow: hidden;
  294. image {
  295. width: 100%;
  296. height: 100%;
  297. }
  298. }
  299. }
  300. .c-list {
  301. font-size: $font-sm + 2upx;
  302. color: $font-color-base;
  303. background: #fff;
  304. .c-row {
  305. display: flex;
  306. align-items: center;
  307. padding: 20upx 30upx;
  308. position: relative;
  309. }
  310. .tit {
  311. width: 220upx;
  312. }
  313. .con {
  314. flex: 1;
  315. color: $font-color-dark;
  316. .selected-text {
  317. margin-right: 10upx;
  318. }
  319. }
  320. .bz-list {
  321. height: 40upx;
  322. font-size: $font-sm+2upx;
  323. color: $font-color-dark;
  324. text {
  325. display: inline-block;
  326. margin-right: 30upx;
  327. }
  328. }
  329. .con-list {
  330. flex: 1;
  331. display: flex;
  332. flex-direction: column;
  333. color: $font-color-dark;
  334. line-height: 40upx;
  335. text-align: right;
  336. padding-right: 20upx;
  337. }
  338. .red {
  339. color: $uni-color-primary;
  340. }
  341. }
  342. /* 评价 */
  343. .eva-section {
  344. display: flex;
  345. flex-direction: column;
  346. padding: 20upx 30upx;
  347. background: #fff;
  348. margin-top: 16upx;
  349. .e-header {
  350. display: flex;
  351. align-items: center;
  352. height: 70upx;
  353. font-size: $font-sm + 2upx;
  354. color: $font-color-light;
  355. .tit {
  356. font-size: $font-base + 2upx;
  357. color: $font-color-dark;
  358. margin-right: 4upx;
  359. }
  360. .tip {
  361. flex: 1;
  362. text-align: right;
  363. }
  364. .icon-you {
  365. margin-left: 10upx;
  366. }
  367. }
  368. }
  369. .eva-box {
  370. display: flex;
  371. padding: 20upx 0;
  372. .portrait {
  373. flex-shrink: 0;
  374. width: 80upx;
  375. height: 80upx;
  376. border-radius: 100px;
  377. }
  378. .right {
  379. flex: 1;
  380. display: flex;
  381. flex-direction: column;
  382. font-size: $font-base;
  383. color: $font-color-base;
  384. padding-left: 26upx;
  385. .con {
  386. font-size: $font-base;
  387. color: $font-color-dark;
  388. padding: 20upx 0;
  389. }
  390. .bot {
  391. display: flex;
  392. justify-content: space-between;
  393. font-size: $font-sm;
  394. color: $font-color-light;
  395. }
  396. }
  397. }
  398. /* 详情 */
  399. .detail-desc {
  400. background: #fff;
  401. margin-top: 16upx;
  402. width: 750upx;
  403. .d-header {
  404. display: flex;
  405. justify-content: center;
  406. align-items: center;
  407. height: 80upx;
  408. font-size: $font-base + 2upx;
  409. color: $font-color-dark;
  410. position: relative;
  411. text {
  412. padding: 0 20upx;
  413. background: #fff;
  414. position: relative;
  415. z-index: 1;
  416. }
  417. &:after {
  418. position: absolute;
  419. left: 50%;
  420. top: 50%;
  421. transform: translateX(-50%);
  422. width: 300upx;
  423. height: 0;
  424. content: '';
  425. border-bottom: 1px solid #ccc;
  426. }
  427. }
  428. }
  429. /* 规格选择弹窗 */
  430. .attr-content {
  431. padding: 10upx 30upx;
  432. .a-t {
  433. display: flex;
  434. image {
  435. width: 170upx;
  436. height: 170upx;
  437. flex-shrink: 0;
  438. margin-top: -40upx;
  439. border-radius: 8upx;
  440. ;
  441. }
  442. .right {
  443. display: flex;
  444. flex-direction: column;
  445. padding-left: 24upx;
  446. font-size: $font-sm + 2upx;
  447. color: $font-color-base;
  448. line-height: 42upx;
  449. .price {
  450. font-size: $font-lg;
  451. color: $uni-color-primary;
  452. margin-bottom: 10upx;
  453. }
  454. .selected-text {
  455. margin-right: 10upx;
  456. }
  457. }
  458. }
  459. .attr-list {
  460. display: flex;
  461. flex-direction: column;
  462. font-size: $font-base + 2upx;
  463. color: $font-color-base;
  464. padding-top: 30upx;
  465. padding-left: 10upx;
  466. }
  467. .item-list {
  468. padding: 30upx 0 0;
  469. display: flex;
  470. flex-wrap: wrap;
  471. text {
  472. display: flex;
  473. align-items: center;
  474. justify-content: center;
  475. background: #eee;
  476. margin-right: 20upx;
  477. margin-bottom: 20upx;
  478. border-radius: 100upx;
  479. min-width: 60upx;
  480. height: 60upx;
  481. padding: 0 20upx;
  482. font-size: $font-base;
  483. color: $font-color-dark;
  484. }
  485. .selected {
  486. background: #fbebee;
  487. color: $uni-color-primary;
  488. }
  489. }
  490. }
  491. /* 弹出层 */
  492. .popup {
  493. position: fixed;
  494. left: 0;
  495. top: 0;
  496. right: 0;
  497. bottom: 0;
  498. z-index: 99;
  499. &.show {
  500. display: block;
  501. .mask {
  502. animation: showPopup 0.2s linear both;
  503. }
  504. .layer {
  505. animation: showLayer 0.2s linear both;
  506. }
  507. }
  508. &.hide {
  509. .mask {
  510. animation: hidePopup 0.2s linear both;
  511. }
  512. .layer {
  513. animation: hideLayer 0.2s linear both;
  514. }
  515. }
  516. &.none {
  517. display: none;
  518. }
  519. .mask {
  520. position: fixed;
  521. top: 0;
  522. width: 100%;
  523. height: 100%;
  524. z-index: 1;
  525. background-color: rgba(0, 0, 0, 0.4);
  526. }
  527. .layer {
  528. position: fixed;
  529. z-index: 99;
  530. bottom: 0;
  531. width: 100%;
  532. min-height: 40vh;
  533. border-radius: 10upx 10upx 0 0;
  534. background-color: #fff;
  535. .btn {
  536. height: 66upx;
  537. line-height: 66upx;
  538. border-radius: 100upx;
  539. background: $uni-color-primary;
  540. font-size: $font-base + 2upx;
  541. color: #fff;
  542. margin: 30upx auto 20upx;
  543. }
  544. }
  545. @keyframes showPopup {
  546. 0% {
  547. opacity: 0;
  548. }
  549. 100% {
  550. opacity: 1;
  551. }
  552. }
  553. @keyframes hidePopup {
  554. 0% {
  555. opacity: 1;
  556. }
  557. 100% {
  558. opacity: 0;
  559. }
  560. }
  561. @keyframes showLayer {
  562. 0% {
  563. transform: translateY(120%);
  564. }
  565. 100% {
  566. transform: translateY(0%);
  567. }
  568. }
  569. @keyframes hideLayer {
  570. 0% {
  571. transform: translateY(0);
  572. }
  573. 100% {
  574. transform: translateY(120%);
  575. }
  576. }
  577. }
  578. /* 底部操作菜单 */
  579. .page-bottom {
  580. position: fixed;
  581. left: 30upx;
  582. bottom: 30upx;
  583. z-index: 95;
  584. display: flex;
  585. justify-content: center;
  586. align-items: center;
  587. width: 690upx;
  588. height: 100upx;
  589. background: rgba(255, 255, 255, .9);
  590. box-shadow: 0 0 20upx 0 rgba(0, 0, 0, .5);
  591. border-radius: 16upx;
  592. .p-b-btn {
  593. display: flex;
  594. flex-direction: column;
  595. align-items: center;
  596. justify-content: center;
  597. font-size: $font-sm;
  598. color: $font-color-base;
  599. width: 96upx;
  600. height: 80upx;
  601. .yticon {
  602. font-size: 40upx;
  603. line-height: 48upx;
  604. color: $font-color-light;
  605. }
  606. &.active,
  607. &.active .yticon {
  608. color: $uni-color-primary;
  609. }
  610. .icon-fenxiang2 {
  611. font-size: 42upx;
  612. transform: translateY(-2upx);
  613. }
  614. .icon-shoucang {
  615. font-size: 46upx;
  616. }
  617. }
  618. }
  619. /* 优惠券面板 */
  620. .mask {
  621. display: flex;
  622. align-items: flex-end;
  623. position: fixed;
  624. left: 0;
  625. top: var(--window-top);
  626. bottom: 0;
  627. width: 100%;
  628. background: rgba(0, 0, 0, 0);
  629. z-index: 9995;
  630. transition: .3s;
  631. .mask-content {
  632. width: 100%;
  633. min-height: 30vh;
  634. max-height: 70vh;
  635. background: #f3f3f3;
  636. transform: translateY(100%);
  637. transition: .3s;
  638. overflow-y: scroll;
  639. }
  640. &.none {
  641. display: none;
  642. }
  643. &.show {
  644. background: rgba(0, 0, 0, .4);
  645. .mask-content {
  646. transform: translateY(0);
  647. }
  648. }
  649. }
  650. /* 优惠券列表 */
  651. .coupon-item {
  652. display: flex;
  653. flex-direction: column;
  654. margin: 20upx 24upx;
  655. background: #fff;
  656. .con {
  657. display: flex;
  658. align-items: center;
  659. position: relative;
  660. height: 120upx;
  661. padding: 0 30upx;
  662. &:after {
  663. position: absolute;
  664. left: 0;
  665. bottom: 0;
  666. content: '';
  667. width: 100%;
  668. height: 0;
  669. border-bottom: 1px dashed #f3f3f3;
  670. transform: scaleY(50%);
  671. }
  672. }
  673. .left {
  674. display: flex;
  675. flex-direction: column;
  676. justify-content: center;
  677. flex: 1;
  678. overflow: hidden;
  679. height: 100upx;
  680. }
  681. .title {
  682. font-size: 32upx;
  683. color: $font-color-dark;
  684. margin-bottom: 10upx;
  685. }
  686. .time {
  687. font-size: 24upx;
  688. color: $font-color-light;
  689. }
  690. .right {
  691. display: flex;
  692. flex-direction: column;
  693. justify-content: center;
  694. align-items: center;
  695. font-size: 26upx;
  696. color: $font-color-base;
  697. height: 100upx;
  698. }
  699. .price {
  700. font-size: 44upx;
  701. color: $base-color;
  702. &:before {
  703. content: '¥';
  704. font-size: 34upx;
  705. }
  706. }
  707. .tips {
  708. font-size: 24upx;
  709. color: $font-color-light;
  710. line-height: 60upx;
  711. padding-left: 30upx;
  712. }
  713. .circle {
  714. position: absolute;
  715. left: -6upx;
  716. bottom: -10upx;
  717. z-index: 10;
  718. width: 20upx;
  719. height: 20upx;
  720. background: #f3f3f3;
  721. border-radius: 100px;
  722. &.r {
  723. left: auto;
  724. right: -6upx;
  725. }
  726. }
  727. }
  728. .rich-img {
  729. width: 100%;
  730. height: auto;
  731. margin: 0;
  732. padding: 0;
  733. line-height: 0px;
  734. }
  735. button::after {
  736. border: none;
  737. }
  738. </style>