car_detail.vue 15 KB

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