index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
  1. <template>
  2. <view class="content">
  3. <view class="main">
  4. <scroll-view scroll-y="true" class="scroll-view">
  5. <view class="list-scroll-view">
  6. <view class="top">
  7. <u-swiper :list="info.url" height="300px" keyName="url" @change="e => currentNum = e.current"
  8. :autoplay="false" indicatorStyle="right: 20px" radius="0">
  9. <template #indicator>
  10. <view class="indicator-num">
  11. <text class="indicator-num__text">{{ currentNum + 1 }}/{{ info.url.length }}</text>
  12. </view>
  13. </template>
  14. </u-swiper>
  15. </view>
  16. <view class="bottom">
  17. <view class="one">
  18. <view class="left">
  19. <view class="money">
  20. <text>{{info.money||'0'}}</text>
  21. <text>万</text>
  22. </view>
  23. <view class="price">
  24. <text>新车含税价</text>
  25. <text>{{info.price||'0'}}万</text>
  26. </view>
  27. </view>
  28. <view class="right">
  29. <button class="button" size="mini" type="default" open-type="getPhoneNumber"
  30. @getphonenumber="PhoneNumber">聊聊价格</button>
  31. </view>
  32. </view>
  33. <view class="two">
  34. <view class="two_1">{{info.name||'暂无名称'}}</view>
  35. <view class="two_2">
  36. <view class="other">
  37. <span>{{info.type}}</span>&nbsp;
  38. <u-icon name="arrow-right" size="12"></u-icon>
  39. </view>
  40. <view class="other">
  41. <span>{{info.rank}}·</span>
  42. <span>第{{info.rankNum}}名</span>&nbsp;
  43. <u-icon name="arrow-right" size="12"></u-icon>
  44. </view>
  45. </view>
  46. <view class="two_3">
  47. <view class="left">
  48. <text>分期购车</text>
  49. <text>首付{{info.payment}}万开回家</text>
  50. </view>
  51. <view class="right">
  52. <u-icon name="arrow-right" size="16"></u-icon>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="two thr">
  57. <view class="thr_1">
  58. <text>档案</text>
  59. <view class="info">
  60. <view class="list" v-for="(item, index) in files" :key="index"
  61. @tap="toCommon(item)">
  62. <view class="info_1">{{item.content}}</view>
  63. <view class="info_2">{{item.name}}</view>
  64. </view>
  65. <u-icon name="arrow-right" size="16" @tap="toRecord"></u-icon>
  66. </view>
  67. </view>
  68. <view class="thr_1">
  69. <text>参数</text>
  70. <view class="info">
  71. <view class="list" v-for="(item, index) in parameter" :key="index"
  72. @tap="toCommon(item)">
  73. <view class="info_1">{{item.content}}</view>
  74. <view class="info_2">{{item.name}}</view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. <view class="two four">
  80. <view class="four_1">
  81. <view class="left">
  82. <image class="image"
  83. :src="shop.file&&shop.file.length>0?shop.file[0].url:'https://cdn.uviewui.com/uview/album/1.jpg'">
  84. </image>
  85. </view>
  86. <view class="right">
  87. <view class="right_1" @tap="toShop">
  88. <text>{{shop.name||'暂无'}}</text>
  89. <u-icon :bold="true" color="#000" name="arrow-right" size="16"></u-icon>
  90. </view>
  91. <view class="right_2">
  92. <text>在售车源: </text>
  93. <text>{{shop.num||0}}辆</text>
  94. </view>
  95. </view>
  96. </view>
  97. <view class="four_2">
  98. <u-button icon="phone" text="咨询卖家车况" size="normal" type="info"
  99. @click="toChat"></u-button>
  100. </view>
  101. </view>
  102. <view class="two five">
  103. <view class="name">实拍</view>
  104. <view class="text">外观漆面</view>
  105. <view class="five_1">
  106. <view class="five_1">
  107. <image class="image"
  108. :src="info.file&&info.file.length>0?info.file[0].url:'https://cdn.uviewui.com/uview/album/1.jpg'">
  109. </image>
  110. </view>
  111. <view class="five_2">
  112. <image class="image"
  113. :src="info.file&&info.file.length>1?info.file[1].url:'https://cdn.uviewui.com/uview/album/5.jpg'">
  114. </image>
  115. <image class="image"
  116. :src="info.file&&info.file.length>2?info.file[2].url:'https://cdn.uviewui.com/uview/album/2.jpg'">
  117. </image>
  118. </view>
  119. </view>
  120. <view class="text">中控内饰</view>
  121. <view class="five_2">
  122. <image class="image"
  123. :src="info.file&&info.file.length>3?info.file[3].url:'https://cdn.uviewui.com/uview/album/3.jpg'">
  124. </image>
  125. <image class="image"
  126. :src="info.file&&info.file.length>4?info.file[4].url:'https://cdn.uviewui.com/uview/album/4.jpg'">
  127. </image>
  128. </view>
  129. <view class="five_3">
  130. <u-button text="查看更多图片" size="normal" type="info" @click="toMore"></u-button>
  131. </view>
  132. </view>
  133. <view class="six">
  134. <view class="title">为你推荐</view>
  135. <view class="listL">
  136. <view class="list" v-for="(item, index) in list" :key="index" @tap="toView(item)">
  137. <view class="list_1">
  138. <view class="left">
  139. <image class="image"
  140. :src="item.file&&item.file.length>0?item.file[0].url:''">
  141. </image>
  142. </view>
  143. <view class="right">
  144. <view class="name textOver">{{item.name||'暂无'}}</view>
  145. <view class="other">
  146. <text v-if="item.year">{{item.year||'暂无'}}| </text>
  147. <text v-if="item.kilometer">{{item.kilometer||'暂无'}} | </text>
  148. <text v-if="item.city">{{item.city||'暂无'}}</text>
  149. </view>
  150. <view class="money">
  151. <text>{{item.money||'0'}}</text>
  152. <text>万</text>
  153. </view>
  154. </view>
  155. </view>
  156. </view>
  157. </view>
  158. </view>
  159. </view>
  160. </view>
  161. </scroll-view>
  162. </view>
  163. <view class="foot">
  164. <view class="foot_1">
  165. <view class="left" @click="toChat">
  166. <u-icon color="#000" name="red-packet" size="20"></u-icon>
  167. <text>分期购车</text>
  168. </view>
  169. <view class="left" @click="toCollect">
  170. <u-icon color="#000" name="heart" size="20"></u-icon>
  171. <text>收藏</text>
  172. </view>
  173. </view>
  174. <view class="foot_2">
  175. <button class="left-btn" @click="toChat">联系卖家</button>
  176. <button class="right-btn" @click="toChat">询底价</button>
  177. </view>
  178. </view>
  179. </view>
  180. </template>
  181. <script setup lang="ts">
  182. import { getCurrentInstance, computed, ref } from 'vue';
  183. //该依赖已内置不需要单独安装
  184. import { onLoad } from "@dcloudio/uni-app";
  185. // 请求接口
  186. const $api = getCurrentInstance()?.appContext.config.globalProperties.$api;
  187. // openid
  188. const openid = computed(() => {
  189. return uni.getStorageSync('openid');
  190. })
  191. // 基本信息
  192. const config = ref({});
  193. // id
  194. const id = ref('');
  195. // 轮播图
  196. const currentNum = ref(1);
  197. // 档案
  198. const files = ref([{ name: '上牌时间', content: '2013-10' }, { name: '表显里程', content: '8.0万公里' }, { name: '排放标准', content: '国六' }, { name: '车源地', content: '长春' }]);
  199. // 参数
  200. const parameter = ref([{ name: '发动机', content: '1.8L' }, { name: '轴距', content: '2700mm' }, { name: '变速箱', content: '自动' }, { name: '最大功率', content: '103kW' }]);
  201. // 详情
  202. const info = ref({ url: [{ url: 'https://cdn.uviewui.com/uview/album/1.jpg' }, { url: 'https://cdn.uviewui.com/uview/album/2.jpg' }, { url: 'https://cdn.uviewui.com/uview/album/3.jpg' }, { url: 'https://cdn.uviewui.com/uview/album/4.jpg' }, { url: 'https://cdn.uviewui.com/uview/album/5.jpg' }], payment: '2.7', rankNum: '11', rank: '全国紧凑型SUV销售榜', type: '夏朗', name: '夏朗 2013款 1.8TSI 标配型 欧IV', money: '7.80', price: '29.06' });
  203. // 店铺
  204. const shop = ref({ name: '淘车车长春店', num: '109' });
  205. // 列表
  206. const list = ref([
  207. {
  208. id: '1',
  209. file: [{ url: 'https://cdn.uviewui.com/uview/album/1.jpg' }],
  210. name: '夏朗 2013款 1.8TSI 标配型 欧IV',
  211. year: '2014年 ',
  212. city: '丹东',
  213. kilometer: '8万公里',
  214. money: '7.80'
  215. },
  216. {
  217. id: '1',
  218. file: [{ url: 'https://cdn.uviewui.com/uview/album/2.jpg' }],
  219. name: '捷豹XEL 2020款 2.0T 200PS S进取优雅版',
  220. year: '2014年 ',
  221. city: '丹东',
  222. kilometer: '8万公里',
  223. money: '7.80'
  224. },
  225. {
  226. id: '1',
  227. file: [{ url: 'https://cdn.uviewui.com/uview/album/3.jpg' }],
  228. name: '夏朗 2013款 1.8TSI 标配型 欧IV',
  229. year: '2014年 ',
  230. city: '丹东',
  231. kilometer: '8万公里',
  232. money: '7.80'
  233. },
  234. {
  235. id: '1',
  236. file: [{ url: 'https://cdn.uviewui.com/uview/album/4.jpg' }],
  237. name: '夏朗 2013款 1.8TSI 标配型 欧IV',
  238. year: '2014年 ',
  239. city: '丹东',
  240. kilometer: '8万公里',
  241. money: '7.80'
  242. },
  243. {
  244. id: '1',
  245. file: [{ url: 'https://cdn.uviewui.com/uview/album/5.jpg' }],
  246. name: '夏朗 2013款 1.8TSI 标配型 欧IV',
  247. year: '2014年 ',
  248. city: '丹东',
  249. kilometer: '8万公里',
  250. money: '7.80'
  251. },
  252. {
  253. id: '1',
  254. file: [{ url: 'https://cdn.uviewui.com/uview/album/6.jpg' }],
  255. name: '夏朗 2013款 1.8TSI 标配型 欧IV',
  256. year: '2014年 ',
  257. city: '丹东',
  258. kilometer: '8万公里',
  259. money: '7.80'
  260. },
  261. {
  262. id: '1',
  263. file: [{ url: 'https://cdn.uviewui.com/uview/album/7.jpg' }],
  264. name: '夏朗 2013款 1.8TSI 标配型 欧IV',
  265. year: '2014年 ',
  266. city: '丹东',
  267. kilometer: '8万公里',
  268. money: '7.80'
  269. },
  270. {
  271. id: '1',
  272. file: [{ url: 'https://cdn.uviewui.com/uview/album/8.jpg' }],
  273. name: '夏朗 2013款 1.8TSI 标配型 欧IV',
  274. year: '2014年 ',
  275. city: '丹东',
  276. kilometer: '8万公里',
  277. money: '7.80'
  278. },
  279. {
  280. id: '1',
  281. file: [{ url: 'https://cdn.uviewui.com/uview/album/9.jpg' }],
  282. name: '夏朗 2013款 1.8TSI 标配型 欧IV',
  283. year: '2014年 ',
  284. city: '丹东',
  285. kilometer: '8万公里',
  286. money: '7.80'
  287. },
  288. {
  289. id: '1',
  290. file: [{ url: 'https://cdn.uviewui.com/uview/album/10.jpg' }],
  291. name: '夏朗 2013款 1.8TSI 标配型 欧IV',
  292. year: '2014年 ',
  293. city: '丹东',
  294. kilometer: '8万公里',
  295. money: '7.80'
  296. }]);
  297. onLoad(async (options) => {
  298. id.value = options && options.id
  299. await searchConfig();
  300. await searchOther();
  301. await search();
  302. })
  303. // config信息
  304. const searchConfig = async () => {
  305. config.value = uni.getStorageSync('config');
  306. };
  307. // 查询其他信息
  308. const searchOther = async () => {
  309. let res;
  310. };
  311. // 查询
  312. const search = async () => { };
  313. // 获取手机号
  314. const PhoneNumber = (e) => {
  315. console.log(e);
  316. };
  317. // 档案
  318. const toRecord = () => {
  319. uni.navigateTo({
  320. url: `/pagesHome/record/index?id=${info.value.id || info.value._id}`
  321. })
  322. };
  323. // 查看详情
  324. const toView = (item) => {
  325. uni.navigateTo({
  326. url: `/pagesHome/car/index?id=${item.id || item._id}`
  327. })
  328. };
  329. // 联系卖家
  330. const toChat = (item) => {
  331. uni.makePhoneCall({
  332. phoneNumber: item?.shop || '110',
  333. success: function () {
  334. console.log('拨打电话成功');
  335. },
  336. fail: function () {
  337. console.log('拨打电话失败');
  338. }
  339. });
  340. };
  341. // 店铺详情
  342. const toShop = () => {
  343. uni.navigateTo({
  344. url: `/pagesHome/shop/index?id=${shop.value.id || shop.value._id}&name=${shop.value.name}`
  345. })
  346. };
  347. // 查看更多图片
  348. const toMore = () => {
  349. uni.navigateTo({
  350. url: `/pagesHome/picture/index?id=${info.value.id || info.value._id}`
  351. })
  352. };
  353. // 收藏
  354. const toCollect = () => {
  355. console.log('收藏');
  356. };
  357. </script>
  358. <style lang="scss" scoped>
  359. .content {
  360. display: flex;
  361. flex-direction: column;
  362. width: 100vw;
  363. height: 100vh;
  364. .main {
  365. position: relative;
  366. flex-grow: 1;
  367. .top {
  368. position: relative;
  369. .indicator-num {
  370. padding: 2px 0;
  371. background-color: rgba(0, 0, 0, 0.35);
  372. border-radius: 5px;
  373. width: 35px;
  374. @include flex;
  375. justify-content: center;
  376. &__text {
  377. color: var(--mainColor);
  378. font-size: var(--font12Size);
  379. }
  380. }
  381. }
  382. .bottom {
  383. background-color: #f1f1f1;
  384. .one {
  385. display: flex;
  386. justify-content: space-between;
  387. align-items: center;
  388. padding: 3vw;
  389. background: linear-gradient(to bottom, #FFE4B5, #f1f1f1);
  390. .left {
  391. .money {
  392. color: var(--fF0Color);
  393. font-size: var(--font12Size);
  394. text:first-child {
  395. font-size: var(--font18Size);
  396. }
  397. }
  398. .price {
  399. margin: 1vw 0 0 0;
  400. color: var(--f69Color);
  401. font-size: var(--font12Size);
  402. }
  403. }
  404. .right {
  405. .button {
  406. background-color: var(--fFFColor);
  407. }
  408. }
  409. }
  410. .two {
  411. margin: 2vw 3vw;
  412. padding: 2vw;
  413. background-color: var(--mainColor);
  414. border-radius: 5px;
  415. .two_1 {
  416. font-size: var(--font16Size);
  417. font-weight: bold;
  418. }
  419. .two_2 {
  420. display: flex;
  421. align-items: center;
  422. margin: 2vw 0 0 0;
  423. padding: 2vw 0;
  424. border-bottom: 1px solid var(--f5Color);
  425. .other {
  426. display: flex;
  427. align-items: center;
  428. color: var(--f828Color);
  429. font-size: var(--font12Size);
  430. margin: 0 5px 0 0;
  431. }
  432. }
  433. .two_3 {
  434. display: flex;
  435. align-items: center;
  436. justify-content: space-between;
  437. padding: 2vw 0;
  438. .left {
  439. display: flex;
  440. justify-content: space-between;
  441. align-items: center;
  442. text {
  443. font-size: var(--font14Size);
  444. margin: 0 5px 0 0;
  445. }
  446. text:first-child {
  447. background-color: rgba(255, 127, 80, 0.35);
  448. color: #FF7F50;
  449. padding: 2px 5px;
  450. font-size: var(--font12Size);
  451. }
  452. }
  453. }
  454. }
  455. .thr {
  456. .thr_1 {
  457. display: flex;
  458. .info {
  459. display: flex;
  460. width: 89%;
  461. margin: 0 0 2vw 0;
  462. .list {
  463. font-size: var(--font14Size);
  464. text-align: center;
  465. width: 19vw;
  466. .info_2 {
  467. color: var(--f828Color);
  468. margin: 1vw 0 0 0;
  469. }
  470. }
  471. }
  472. text {
  473. margin: 0 2vw 0 0;
  474. color: var(--f828Color);
  475. font-size: var(--font14Size);
  476. }
  477. }
  478. }
  479. .four {
  480. .four_1 {
  481. display: flex;
  482. align-items: center;
  483. .left {
  484. .image {
  485. width: 120px;
  486. height: 80px;
  487. }
  488. }
  489. .right {
  490. margin: 0 0 0 2vw;
  491. .right_1 {
  492. display: flex;
  493. align-items: center;
  494. font-size: var(--font16Size);
  495. font-weight: bold;
  496. text {
  497. margin: 0 1vw 1vw 0;
  498. }
  499. }
  500. .right_2 {
  501. margin: 2vw 0 0 0;
  502. color: var(--f828Color);
  503. font-size: var(--font14Size);
  504. }
  505. }
  506. }
  507. .four_2 {
  508. margin: 2vw 0 0 0;
  509. }
  510. }
  511. .five {
  512. .name {
  513. font-size: var(--font16Size);
  514. }
  515. .text {
  516. padding: 2vw 0;
  517. color: var(--f69Color);
  518. font-size: var(--font14Size);
  519. }
  520. .five_1 {
  521. border-radius: 5px;
  522. .image {
  523. width: 100%;
  524. height: 230px;
  525. border-radius: 5px;
  526. }
  527. }
  528. .five_2 {
  529. display: flex;
  530. justify-content: space-between;
  531. border-radius: 5px;
  532. .image {
  533. width: 49%;
  534. height: 120px;
  535. border-radius: 5px;
  536. }
  537. }
  538. .five_3 {
  539. margin: 2vw 0 0 0;
  540. }
  541. }
  542. .six {
  543. padding: 0 2vw 2vw 2vw;
  544. .title {
  545. font-size: var(--font16Size);
  546. padding: 0 1vw;
  547. }
  548. .listL {
  549. display: flex;
  550. flex-wrap: wrap;
  551. justify-content: space-between;
  552. .list {
  553. width: 47vw;
  554. margin: 2vw 0 0 0;
  555. border-radius: 5px;
  556. border: 1px solid var(--f5Color);
  557. background-color: var(--mainColor);
  558. .list_1 {
  559. .left {
  560. .image {
  561. width: 100%;
  562. height: 120px;
  563. border-radius: 5px 5px 0 0;
  564. }
  565. }
  566. .right {
  567. display: flex;
  568. flex-direction: column;
  569. justify-content: space-between;
  570. margin: 0 0 0 2vw;
  571. .name {
  572. font-size: var(--font14Size);
  573. }
  574. .other {
  575. color: var(--f85Color);
  576. font-size: var(--font12Size);
  577. }
  578. .money {
  579. color: var(--fF0Color);
  580. font-size: var(--font12Size);
  581. margin: 0 0 1vw 0;
  582. text:first-child {
  583. font-size: var(--font18Size);
  584. }
  585. }
  586. }
  587. }
  588. }
  589. }
  590. }
  591. }
  592. }
  593. .foot {
  594. display: flex;
  595. justify-content: space-between;
  596. align-items: center;
  597. height: 8vh;
  598. padding: 2vw 1vw;
  599. .foot_1 {
  600. display: flex;
  601. justify-content: space-between;
  602. width: 25%;
  603. .left {
  604. display: flex;
  605. flex-direction: column;
  606. align-items: center;
  607. font-size: var(--font14Size);
  608. }
  609. }
  610. .foot_2 {
  611. display: flex;
  612. justify-content: space-around;
  613. align-items: center;
  614. width: 73%;
  615. .left-btn {
  616. background-color: var(--fF0Color);
  617. color: var(--mainColor);
  618. font-size: var(--font16Size);
  619. }
  620. .right-btn {
  621. background-color: var(--fFFColor);
  622. color: var(--mainColor);
  623. width: 45vw;
  624. font-size: var(--font16Size);
  625. }
  626. }
  627. }
  628. }
  629. .scroll-view {
  630. position: absolute;
  631. top: 0;
  632. left: 0;
  633. right: 0;
  634. bottom: 0;
  635. .list-scroll-view {
  636. display: flex;
  637. flex-direction: column;
  638. }
  639. }
  640. </style>