porducthall.vue 14 KB

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