car_detail.vue 15 KB

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