porducthall.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
  1. <template>
  2. <view class="container">
  3. <view class="carousel">
  4. <swiper indicator-dots :circular="true" duration="400">
  5. <swiper-item class="swiper-item" v-for="(item, index) in imageList" :key="index">
  6. <view class="image-wrapper">
  7. <image :src="item" class="loaded" mode="scaleToFill"></image>
  8. </view>
  9. </swiper-item>
  10. </swiper>
  11. <view class="title flex">
  12. <view class="title-num">
  13. <text>¥</text>
  14. {{ info.hanging_price }}
  15. </view>
  16. <view class="title-time">挂售时间:{{ info.time }}</view>
  17. </view>
  18. </view>
  19. <view class="title-main flex">
  20. <view class="tm-left">
  21. <view class="tm-title clamp">{{ info.name }}</view>
  22. <view class="tm-people flex">
  23. <image class="people-image" src="../../static/img/people.png" mode=""></image>
  24. <view class="people-name">归属人:{{ info.user_nickname }}</view>
  25. </view>
  26. </view>
  27. <view class="tm-right flex">
  28. <!-- <view class="tmr-item" @click="isDjs()">
  29. <image class="tmr-image" src="../../static/img/shua.png" mode=""></image>
  30. <view class="tmr-font">刷新倒计时</view>
  31. </view> -->
  32. <view class="tmr-item" @click="nav('/pages/hall/history?id=' + id)">
  33. <image class="tmr-image1" src="../../static/img/yuan.png" mode=""></image>
  34. <view class="tmr-font">溯源</view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="dz"></view>
  39. <!-- <view class="introduce">
  40. <view class="introduct-title">
  41. <image class="introduce-image" src="../../static/img/productIcon.png" mode=""></image>
  42. <view class="introduce-font">艺术品挂售交易平台</view>
  43. </view>
  44. <view class="introduct-main">
  45. <view class="im-item">
  46. <image class="im-image" src="../../static/img/jian.png" mode=""></image>
  47. <view class="im-font">大师作品</view>
  48. </view>
  49. <view class="im-item">
  50. <image class="im-image" src="../../static/img/zheng.png" mode=""></image>
  51. <view class="im-font">证书收藏</view>
  52. </view>
  53. <view class="im-item">
  54. <image class="im-image" src="../../static/img/gong.png" mode=""></image>
  55. <view class="im-font">自由交易</view>
  56. </view>
  57. </view>
  58. </view> -->
  59. <view class="dz"></view>
  60. <view class="explain">
  61. <view class="explain-title">商品挂售说明</view>
  62. <view class="explain-main">
  63. <view class="explainImage-box">
  64. <image class="explain-image-item" src="../../static/img/lc1.png" mode=""></image>
  65. <image class="explain-image-jiant" src="../../static/img/jingt.png" mode=""></image>
  66. <image class="explain-image-item" src="../../static/img/lc2.png" mode=""></image>
  67. <image class="explain-image-jiant" src="../../static/img/jingt.png" mode=""></image>
  68. <image class="explain-image-item" src="../../static/img/lc3.png" mode=""></image>
  69. <image class="explain-image-jiant" src="../../static/img/jingt.png" mode=""></image>
  70. <image class="explain-image-item" src="../../static/img/lc4.png" mode=""></image>
  71. </view>
  72. <view class="explainfont-box">
  73. <view class="explain-font-item">挂售商品</view>
  74. <view class="explain-font-item">支付货款</view>
  75. <view class="explain-font-item">卖家发货</view>
  76. <view class="explain-font-item">挂售/提货</view>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="detail-desc">
  81. <view class="d-header"><text>商品详情</text></view>
  82. <rich-text class="detail-centent" :nodes="info.description"></rich-text>
  83. <view class="contentBottomHeight"></view>
  84. </view>
  85. <view class="bottom flex">
  86. <view class="bottom-item">
  87. <image class="bi-image" src="../../static/img/quan.png" mode=""></image>
  88. <view class="bottom-font">易趣卷</view>
  89. <!-- <view class="bottom-num">200</view> -->
  90. </view>
  91. <view class="shu"></view>
  92. <view class="bottom-item" @click="openKf()">
  93. <image class="bi-image" src="../../static/img/kf.png" mode=""></image>
  94. <view class="bottom-font">联系</view>
  95. <view class="bottom-num">客服</view>
  96. </view>
  97. <view class="btn" @click="buy()">{{ isbuy ? '立即购买' : countdown_time }}</view>
  98. </view>
  99. </view>
  100. </template>
  101. <script>
  102. import {
  103. details,
  104. purchase,
  105. count_down,
  106. verify_code,
  107. captcha
  108. } from '@/api/hall.js';
  109. import {
  110. mapState,
  111. mapMutations
  112. } from 'vuex';
  113. import {
  114. getTime
  115. } from '@/utils/rocessor.js';
  116. export default {
  117. data() {
  118. return {
  119. isbiao: 0,
  120. text: '123456',
  121. id: '',
  122. uid: '',
  123. name: '',
  124. peoplename: '',
  125. info: '',
  126. imageList: [],
  127. countdown_time: '',
  128. unicode: '',
  129. key: '',
  130. code: '',
  131. isdian: 0,
  132. canbuy: 0, //结束时间
  133. time: '', //进场时间
  134. timers: '' //延时器id
  135. };
  136. },
  137. onLoad(option) {
  138. this.id = option.id;
  139. this.uid = option.uid;
  140. this.name = option.name;
  141. this.peoplename = option.peoplename;
  142. },
  143. computed: {
  144. ...mapState(['isbuy', 'baseURL'])
  145. },
  146. onShow() {
  147. this.loadData();
  148. console.log(this.isbuy);
  149. if (!this.isbuy) {
  150. this.isDjs();
  151. }
  152. },
  153. onHide() {
  154. clearTimeout(this.timers);
  155. },
  156. // 监听页面卸载
  157. onUnload() {
  158. // 关闭倒计时
  159. clearTimeout(this.timers);
  160. },
  161. // 监听页面后退
  162. onBackPress() {
  163. // 关闭倒计时
  164. clearTimeout(this.timers);
  165. },
  166. methods: {
  167. ...mapMutations(['setBuy']),
  168. isDjs() {
  169. clearTimeout(this.timers);
  170. count_down({
  171. id: this.uid
  172. }).then(({
  173. data
  174. }) => {
  175. this.canbuy = data.times;
  176. let day = getTime(this.canbuy * 1000).split(' ');
  177. this.time = day[1];
  178. this.counTime();
  179. });
  180. },
  181. counTime() {
  182. //获取当前时间
  183. let data = new Date();
  184. let newTime = data.getTime();
  185. //结束时间
  186. let end = this.canbuy;
  187. //时间差
  188. let leftTime = end * 1000 - newTime;
  189. console.log(leftTime);
  190. console.log(this.la, '2222222');
  191. if (leftTime <= 0) {
  192. console.log('已结束');
  193. this.setBuy(true);
  194. return;
  195. }
  196. //定义保存倒计时时间
  197. let m, s;
  198. if (leftTime >= 0) {
  199. m = Math.floor((leftTime / 1000 / 60) % 60);
  200. s = Math.floor((leftTime / 1000) % 60);
  201. this.second = s;
  202. this.la = m + s;
  203. //倒计时赋值view
  204. this.countdown_time = `${m}:${s}`;
  205. this.timers = setTimeout(this.counTime, 1000);
  206. //显示动态时间效果
  207. if (s < 10) {
  208. return (this.countdown_time = `${m}:0${s}`);
  209. this.timers = setTimeout(this.counTime, 1000);
  210. }
  211. if (m < 10) {
  212. return (this.countdown_time = `0${m}:${s}`);
  213. this.timers = setTimeout(this.counTime, 1000);
  214. }
  215. }
  216. },
  217. loadData() {
  218. details({
  219. product_id: this.id
  220. })
  221. .then(({
  222. data
  223. }) => {
  224. console.log(data);
  225. this.imageList = data.slider_image;
  226. this.unicode = data.unicode
  227. if (data.description != '') {
  228. data.description = data.description.replace(/\<img/gi, '<img class="rich-img"');
  229. }
  230. this.info = data;
  231. })
  232. .catch(e => {});
  233. },
  234. // 打开客服
  235. openKf() {
  236. this.$refs.popupkf.open();
  237. },
  238. // 关闭客服
  239. cancel() {
  240. this.$refs.popupkf.close();
  241. },
  242. nav(url) {
  243. uni.navigateTo({
  244. url
  245. });
  246. },
  247. buy() {
  248. if (!this.isbuy) {
  249. return this.$api.msg('还未到购买时间');
  250. }
  251. uni.showLoading({
  252. title: '抢购中'
  253. })
  254. console.log(this.isdian, '123456');
  255. if (this.isdian != 0) {
  256. uni.hideLoading()
  257. return
  258. }
  259. this.isdian = 1
  260. purchase({
  261. product_id: this.id,
  262. unicode: this.unicode,
  263. })
  264. .then(({
  265. data
  266. }) => {
  267. this.isdian = 0
  268. uni.hideLoading()
  269. uni.navigateTo({
  270. url: '/pages/money/paySuccess?type=1&uid=' + this.uid + +'&name=' + this.name +
  271. '&peoplename=' + this.peoplename
  272. });
  273. console.log(data);
  274. })
  275. .catch(e => {
  276. this.isdian = 0;
  277. uni.hideLoading();
  278. console.log(e);
  279. });
  280. }
  281. }
  282. };
  283. </script>
  284. <style lang="less">
  285. .carousel {
  286. width: 750rpx;
  287. height: 710rpx;
  288. position: relative;
  289. swiper {
  290. height: 100%;
  291. }
  292. .image-wrapper {
  293. width: 100%;
  294. height: 100%;
  295. }
  296. .swiper-item {
  297. display: flex;
  298. justify-content: center;
  299. align-content: center;
  300. // height: 750rpx;
  301. height: 710rpx;
  302. overflow: hidden;
  303. image {
  304. width: 100%;
  305. height: 100%;
  306. }
  307. }
  308. .title {
  309. background: linear-gradient(90deg, #ef4e51 0%, #f4713b 100%);
  310. width: 750rpx;
  311. position: absolute;
  312. bottom: 0;
  313. padding: 30rpx;
  314. .title-num {
  315. font-size: 50rpx;
  316. font-family: PingFang SC;
  317. font-weight: bold;
  318. color: #ffffff;
  319. text {
  320. font-size: 30rpx;
  321. }
  322. }
  323. .title-time {
  324. font-size: 28rpx;
  325. font-family: PingFang SC;
  326. font-weight: bold;
  327. color: #ffffff;
  328. }
  329. }
  330. }
  331. .title-main {
  332. padding: 30rpx 30rpx 30rpx 22rpx;
  333. .tm-left {
  334. width: 50%;
  335. .tm-title {
  336. width: 100%;
  337. font-size: 30rpx;
  338. font-family: PingFang SC;
  339. font-weight: bold;
  340. color: #1d2023;
  341. }
  342. .tm-people {
  343. margin-top: 30rpx;
  344. justify-content: flex-start;
  345. .people-image {
  346. width: 22rpx;
  347. height: 22rpx;
  348. flex-shrink: 0;
  349. }
  350. .people-name {
  351. margin-left: 12rpx;
  352. font-size: 24rpx;
  353. font-family: PingFang SC;
  354. font-weight: 500;
  355. color: #333333;
  356. }
  357. }
  358. }
  359. .tm-right {
  360. justify-content: flex-end;
  361. .tmr-item {
  362. margin-left: 38rpx;
  363. display: flex;
  364. flex-direction: column;
  365. align-items: center;
  366. .tmr-image {
  367. width: 42rpx;
  368. height: 38rpx;
  369. }
  370. .tmr-image1 {
  371. width: 42rpx;
  372. height: 42rpx;
  373. }
  374. .tmr-font {
  375. margin-top: 16rpx;
  376. font-size: 24rpx;
  377. font-family: PingFang SC;
  378. font-weight: 500;
  379. color: #333333;
  380. }
  381. }
  382. }
  383. }
  384. .dz {
  385. width: 750rpx;
  386. height: 20rpx;
  387. background: #f8f6f6;
  388. }
  389. .introduce {
  390. padding: 40rpx 24rpx;
  391. .introduct-title {
  392. display: flex;
  393. align-items: center;
  394. .introduce-image {
  395. width: 36rpx;
  396. height: 36rpx;
  397. }
  398. .introduce-font {
  399. margin-left: 10rpx;
  400. font-size: 28rpx;
  401. font-family: PingFang SC;
  402. font-weight: bold;
  403. color: #333333;
  404. }
  405. }
  406. .introduct-main {
  407. display: flex;
  408. justify-content: space-between;
  409. margin-top: 26rpx;
  410. .im-item {
  411. display: flex;
  412. align-items: center;
  413. .im-image {
  414. width: 44rpx;
  415. height: 44rpx;
  416. }
  417. .im-font {
  418. margin-left: 6rpx;
  419. font-size: 28rpx;
  420. font-family: PingFang SC;
  421. font-weight: bold;
  422. color: #333333;
  423. }
  424. }
  425. }
  426. }
  427. .explain {
  428. padding: 40rpx 34rpx 46rpx 34rpx;
  429. .explain-title {
  430. font-size: 32rpx;
  431. font-family: PingFang SC;
  432. font-weight: bold;
  433. color: #333333;
  434. }
  435. .explain-main {
  436. margin-top: 52rpx;
  437. .explainImage-box {
  438. display: flex;
  439. justify-content: space-around;
  440. align-items: center;
  441. .explain-image-item {
  442. width: 42rpx;
  443. height: 40rpx;
  444. }
  445. .explain-image-jiant {
  446. width: 38rpx;
  447. height: 10rpx;
  448. }
  449. }
  450. .explainfont-box {
  451. margin-top: 20rpx;
  452. display: flex;
  453. justify-content: space-between;
  454. .explain-font-item {
  455. font-size: 28rpx;
  456. font-family: PingFang SC;
  457. font-weight: 500;
  458. color: #333333;
  459. }
  460. }
  461. }
  462. }
  463. .detail-desc {
  464. background: #fff;
  465. margin-top: 16rpx;
  466. /deep/ img {
  467. max-width: 100% !important;
  468. display: inline !important;
  469. }
  470. /deep/ div {
  471. max-width: 100% !important;
  472. }
  473. .d-header {
  474. display: flex;
  475. justify-content: center;
  476. align-items: center;
  477. height: 80rpx;
  478. font-size: 30rpx;
  479. color: #303133;
  480. position: relative;
  481. text {
  482. padding: 0 20rpx;
  483. background: #fff;
  484. position: relative;
  485. z-index: 1;
  486. }
  487. &:after {
  488. position: absolute;
  489. left: 50%;
  490. top: 50%;
  491. transform: translateX(-50%);
  492. width: 300rpx;
  493. height: 0;
  494. content: '';
  495. border-bottom: 1px solid #ccc;
  496. }
  497. }
  498. }
  499. .bottom {
  500. position: fixed;
  501. z-index: 10;
  502. bottom: 0;
  503. background: #ffffff;
  504. width: 750rpx;
  505. height: 146rpx;
  506. justify-content: flex-start;
  507. .bottom-item {
  508. margin-left: 42rpx;
  509. display: flex;
  510. flex-direction: column;
  511. align-items: center;
  512. .bi-image {
  513. width: 38rpx;
  514. height: 34rpx;
  515. }
  516. .bottom-font {
  517. margin-top: 14rpx;
  518. font-size: 24rpx;
  519. font-family: PingFang SC;
  520. font-weight: bold;
  521. color: #333333;
  522. }
  523. .bottom-num {
  524. line-height: 1;
  525. font-size: 24rpx;
  526. font-family: PingFang SC;
  527. font-weight: bold;
  528. color: #333333;
  529. }
  530. }
  531. .shu {
  532. margin-left: 38rpx;
  533. width: 2px;
  534. height: 74rpx;
  535. background: #c0bfc0;
  536. }
  537. .btn {
  538. margin-left: 40rpx;
  539. width: 430rpx;
  540. height: 80rpx;
  541. background: #fd3b39;
  542. border-radius: 20rpx;
  543. text-align: center;
  544. font-size: 34rpx;
  545. font-family: PingFang SC;
  546. font-weight: bold;
  547. color: #ffffff;
  548. line-height: 80rpx;
  549. }
  550. }
  551. .popup-box {
  552. width: 522rpx;
  553. height: 605rpx;
  554. background-color: #ffffff;
  555. border-radius: 20rpx;
  556. position: relative;
  557. .img {
  558. position: relative;
  559. top: -56rpx;
  560. left: 0;
  561. width: 522rpx;
  562. height: 132rpx;
  563. display: flex;
  564. justify-content: center;
  565. image {
  566. border-radius: 20rpx 20rpx 0 0;
  567. width: 450rpx;
  568. height: 132rpx;
  569. }
  570. }
  571. .mian {
  572. margin-top: -44rpx;
  573. display: flex;
  574. flex-direction: column;
  575. align-items: center;
  576. // padding: 32rpx 32rpx;
  577. background-color: #ffffff;
  578. border-radius: 0 0 20rpx 20rpx;
  579. text-align: center;
  580. .delivery {
  581. font-size: 40rpx;
  582. color: #333333;
  583. display: flex;
  584. align-items: center;
  585. flex-direction: column;
  586. .title {}
  587. image {
  588. margin-top: 48rpx;
  589. width: 172rpx;
  590. height: 160rpx;
  591. }
  592. }
  593. .nocancel {
  594. font-size: 32rpx;
  595. color: #333333;
  596. margin-top: 14rpx;
  597. }
  598. .comfirm-box {
  599. margin-top: 52rpx;
  600. display: flex;
  601. // margin-bottom: 32rpx;
  602. // justify-content: space-around;
  603. .cancel {
  604. display: flex;
  605. align-items: center;
  606. justify-content: center;
  607. width: 197rpx;
  608. height: 74rpx;
  609. border: 1px solid #dcc786;
  610. border-radius: 38rpx;
  611. font-size: 32rpx;
  612. color: #605128;
  613. }
  614. .comfirm {
  615. margin-left: 32rpx;
  616. display: flex;
  617. align-items: center;
  618. justify-content: center;
  619. width: 197rpx;
  620. height: 74rpx;
  621. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  622. border-radius: 38px;
  623. font-size: 32rpx;
  624. color: #605128;
  625. }
  626. }
  627. }
  628. }
  629. // 文章页底部高度撑开
  630. .contentBottomHeight {
  631. height: 150rpx;
  632. }
  633. </style>