hallinfo.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. <template>
  2. <view class="center">
  3. <view class="content-money">
  4. <view class="money-box">
  5. <view class="status_bar"><!-- 这里是状态栏 --></view>
  6. <!-- #ifndef APP-PLUS -->
  7. <image class="money_bg" src="http://yiqugo.oss-cn-hangzhou.aliyuncs.com/87a32202304061420101468.png">
  8. </image>
  9. <!-- #endif -->
  10. <!-- #ifdef APP-PLUS -->
  11. <image class="money_bg" src="../../static/img/hinfo-bg1.png"></image>
  12. <!-- #endif -->
  13. <view class="goback-box" @click="toBack">
  14. <image class="goback" src="../../static/img/fanhui.png" mode=""></image>
  15. </view>
  16. <view class="header">{{ name }}</view>
  17. <view class="message flex">{{ name }}馆长:{{ peoplename }}</view>
  18. </view>
  19. </view>
  20. <view class="search">
  21. <view class="search-left" @click="nav('/pages/order/order')">订单</view>
  22. <view class="search-right">
  23. <view class="input-box flex">
  24. <view class="input"><input type="text" placeholder="搜索挂售商品" v-model="productname" /></view>
  25. <image @click="search()" class="search-inco" src="../../static/img/search.png" mode=""></image>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="djs" v-if="!isbuy1">
  30. <view class="djs-bg">
  31. <!-- #ifndef APP-PLUS -->
  32. <image src="http://yiqugo.oss-cn-hangzhou.aliyuncs.com/b7365202304061422072002.png" mode=""></image>
  33. <!-- #endif -->
  34. <!-- #ifdef APP-PLUS -->
  35. <image src="../../static/img/djs1.png" mode=""></image>
  36. <!-- #endif -->
  37. </view>
  38. <view class="djs-font">客官请稍后,请{{ time }}入场</view>
  39. <view class="djs-main">入场倒计时:{{ countdown_time }}</view>
  40. </view>
  41. <view v-if="firstList.length != 0 && isbuy1">
  42. <view class="hotgoods">
  43. <view class="hotgoods-item" v-for="item in firstList" :key="item.id" @click="navToDetailPage(item)">
  44. <image class="sell-out" v-if="item.status == 2" src="../../static/img/sOut1.png" mode=""></image>
  45. <view class="image-wrapper">
  46. <image :src="item.image" mode="scaleToFill"></image>
  47. </view>
  48. <view class="title clamp margin-c-20">{{ item.name }}</view>
  49. <view class="hot-price">
  50. <view class="price">
  51. <text class="font-size-sm">¥</text>
  52. {{ item.hanging_price }}
  53. </view>
  54. <view class="over" v-if="item.status == 2">已售罄</view>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="nav flex" v-show="page != 1 || isLast">
  59. <view class="next" @click="last">上一页</view>
  60. <view class="next" @click="next">下一页</view>
  61. </view>
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. import {
  67. auction_product,
  68. count_down
  69. } from '@/api/hall.js';
  70. import {
  71. getTime
  72. } from '@/utils/rocessor.js';
  73. import {
  74. mapState,
  75. mapMutations
  76. } from 'vuex';
  77. export default {
  78. data() {
  79. return {
  80. productname: '', //商品名称
  81. name: '', //馆名字
  82. peoplename: '', //馆长名字
  83. firstList: [],
  84. id: '', //场次id
  85. page: 1,
  86. limit: 20,
  87. loadingType: 'more',
  88. countdown_time: '',
  89. canbuy: 0, //结束时间
  90. time: '', //进场时间
  91. timers: '', //延时器id
  92. isLast: true
  93. };
  94. },
  95. onLoad(option) {
  96. this.name = option.name;
  97. this.peoplename = option.peoplename;
  98. this.id = option.id;
  99. },
  100. computed: {
  101. ...mapState(['isbuy1'])
  102. },
  103. onShow() {
  104. // if (!this.isbuy1) {
  105. // this.isDjs();
  106. // }
  107. this.isDjs();
  108. this.loadData();
  109. this.loadDataNext();
  110. },
  111. onReachBottom() {
  112. console.log('123456');
  113. if (this.isbuy1) {
  114. this.loadData();
  115. }
  116. },
  117. onHide() {
  118. clearTimeout(this.timers);
  119. },
  120. // 监听页面卸载
  121. onUnload() {
  122. // 关闭倒计时
  123. clearTimeout(this.timers);
  124. },
  125. // 监听页面后退
  126. onBackPress() {
  127. // 关闭倒计时
  128. clearTimeout(this.timers);
  129. },
  130. methods: {
  131. ...mapMutations(['setBuy1']),
  132. isDjs() {
  133. uni.showLoading({
  134. title: '加载中'
  135. });
  136. count_down({
  137. id: this.id
  138. }).then(({
  139. data
  140. }) => {
  141. uni.hideLoading();
  142. this.canbuy = data.time;
  143. // this.canbuy = 1699492500;
  144. let day = getTime(this.canbuy * 1000).split(' ');
  145. this.time = day[1];
  146. this.counTime();
  147. });
  148. },
  149. counTime() {
  150. //获取当前时间
  151. let data = new Date();
  152. let newTime = data.getTime();
  153. //结束时间
  154. let end = this.canbuy;
  155. //时间差
  156. let leftTime = end * 1000 - newTime;
  157. console.log(leftTime);
  158. console.log(this.la, '2222222');
  159. if (leftTime <= 0) {
  160. console.log('已结束');
  161. this.setBuy1(true);
  162. return;
  163. }
  164. //定义保存倒计时时间
  165. let m, s;
  166. if (leftTime >= 0) {
  167. m = Math.floor((leftTime / 1000 / 60) % 60);
  168. s = Math.floor((leftTime / 1000) % 60);
  169. this.second = s;
  170. this.la = m + s;
  171. console.log(this.la, '计算');
  172. console.log(this.second);
  173. console.log(m, s);
  174. //倒计时赋值view
  175. this.countdown_time = `${m}:${s}`;
  176. this.timers = setTimeout(this.counTime, 1000);
  177. //显示动态时间效果
  178. if (s < 10) {
  179. return (this.countdown_time = `${m}:0${s}`);
  180. // this.timers = setTimeout(this.counTime, 1000);
  181. }
  182. if (m < 10) {
  183. return (this.countdown_time = `0${m}:${s}`);
  184. // this.timers = setTimeout(this.counTime, 1000);
  185. }
  186. }
  187. },
  188. search() {
  189. this.firstList = [];
  190. this.page = 1;
  191. this.limit = 10;
  192. this.loadingType = 'more';
  193. this.loadData();
  194. },
  195. loadData() {
  196. const obj = this;
  197. // if (obj.loadingType == 'nomore' || obj.loadingType == 'loading') {
  198. // return;
  199. // }
  200. // obj.loadingType = 'loading';
  201. auction_product({
  202. page: obj.page,
  203. limit: obj.limit,
  204. id: obj.id,
  205. name: obj.productname
  206. })
  207. .then(({
  208. data
  209. }) => {
  210. // obj.firstList = obj.firstList.concat(data);
  211. obj.firstList = data;
  212. console.log(obj.firstList, '123456789');
  213. // if (data.length == obj.limit) {
  214. // obj.loadingType = 'more';
  215. // obj.page++;
  216. // } else {
  217. // obj.loadingType = 'nomore';
  218. // }
  219. })
  220. .catch(e => {
  221. console.log(e);
  222. });
  223. },
  224. loadDataNext() {
  225. const obj = this;
  226. // if (obj.loadingType == 'nomore' || obj.loadingType == 'loading') {
  227. // return;
  228. // }
  229. // obj.loadingType = 'loading';
  230. auction_product({
  231. page: obj.page + 1,
  232. limit: obj.limit,
  233. id: obj.id,
  234. name: obj.productname
  235. })
  236. .then(({
  237. data
  238. }) => {
  239. // obj.firstList = obj.firstList.concat(data);
  240. // obj.firstList = data;
  241. // if (data.length == obj.limit) {
  242. // obj.loadingType = 'more';
  243. // obj.page++;
  244. // } else {
  245. // obj.loadingType = 'nomore';
  246. // }
  247. if (data.length === 0) {
  248. obj.isLast = false;
  249. } else {
  250. obj.isLast = true;
  251. }
  252. console.log(obj.isLast);
  253. })
  254. .catch(e => {
  255. console.log(e);
  256. });
  257. },
  258. toBack() {
  259. uni.navigateBack({});
  260. },
  261. nav(url) {
  262. uni.navigateTo({
  263. url
  264. });
  265. },
  266. last() {
  267. let that = this;
  268. if (this.page != 1) {
  269. this.page = this.page - 1;
  270. this.loadData();
  271. this.loadDataNext();
  272. } else {
  273. that.$api.msg('已经是第一页了');
  274. }
  275. },
  276. next() {
  277. let that = this;
  278. this.page = this.page + 1;
  279. if (this.isLast) {
  280. this.loadData();
  281. this.loadDataNext();
  282. } else {
  283. this.page = this.page - 1;
  284. that.$api.msg('已经是最后一页了');
  285. }
  286. },
  287. navToDetailPage(item) {
  288. if (item.status == '2') {
  289. return this.$api.msg('已售罄');
  290. }
  291. uni.navigateTo({
  292. url: '/pages/hall/porducthall?id=' + item.id + '&uid=' + this.id + '&name=' + this.name +
  293. '&peoplename=' + this.peoplename
  294. });
  295. }
  296. }
  297. };
  298. </script>
  299. <style lang="scss">
  300. .center,
  301. page {
  302. height: auto;
  303. min-height: 100%;
  304. background-color: #ffffff;
  305. }
  306. .money-box {
  307. color: #ffffff;
  308. text-align: center;
  309. position: relative;
  310. padding-top: 250rpx;
  311. .money_bg {
  312. position: absolute;
  313. width: 750rpx;
  314. height: 412rpx;
  315. top: 0;
  316. left: 0;
  317. right: 0;
  318. }
  319. .header {
  320. position: absolute;
  321. left: 0;
  322. top: 0;
  323. width: 100%;
  324. height: 80rpx;
  325. font-size: 32rpx;
  326. font-weight: 700;
  327. z-index: 99;
  328. display: flex;
  329. justify-content: center;
  330. align-items: center;
  331. }
  332. .goback-box {
  333. position: absolute;
  334. left: 18rpx;
  335. top: 0;
  336. height: 80rpx;
  337. display: flex;
  338. align-items: center;
  339. }
  340. .goback {
  341. z-index: 100;
  342. width: 34rpx;
  343. height: 34rpx;
  344. }
  345. .message {
  346. display: inline-block;
  347. position: relative;
  348. z-index: 2;
  349. margin: 0 auto;
  350. padding: 20rpx 40rpx;
  351. background: rgba(253, 59, 57, 0.4);
  352. border-radius: 25rpx;
  353. font-size: 30rpx;
  354. font-family: PingFang SC;
  355. font-weight: 500;
  356. color: #ffffff;
  357. }
  358. }
  359. .search {
  360. margin-top: 120rpx;
  361. padding: 0 30rpx 0 20rpx;
  362. display: flex;
  363. align-items: center;
  364. .search-left {
  365. width: 112rpx;
  366. height: 70rpx;
  367. background: #fd3b39;
  368. border-radius: 25rpx;
  369. font-size: 30rpx;
  370. font-family: PingFang SC;
  371. font-weight: 500;
  372. color: #ffffff;
  373. line-height: 70rpx;
  374. text-align: center;
  375. }
  376. .search-right {
  377. width: 570rpx;
  378. background: #dcdcdc;
  379. border-radius: 35rpx;
  380. margin-left: 20rpx;
  381. padding: 18rpx 50rpx 18rpx 36rpx;
  382. .search-inco {
  383. width: 34rpx;
  384. height: 34rpx;
  385. }
  386. }
  387. }
  388. .hotgoods {
  389. margin-top: 38rpx;
  390. width: 100%;
  391. display: flex;
  392. flex-wrap: wrap;
  393. padding: 0 32rpx 20rpx;
  394. .hotgoods-item {
  395. position: relative;
  396. width: 48%;
  397. background-color: #ffffff;
  398. border-radius: 12rpx;
  399. margin-bottom: 24rpx;
  400. &:nth-child(2n + 1) {
  401. margin-right: 24rpx;
  402. }
  403. .sell-out {
  404. position: absolute;
  405. top: 0;
  406. left: 0;
  407. right: 0;
  408. width: 150rpx;
  409. height: 130rpx;
  410. z-index: 2;
  411. }
  412. .image-wrapper {
  413. width: 100%;
  414. height: 330rpx;
  415. border-radius: 3px;
  416. overflow: hidden;
  417. image {
  418. width: 100%;
  419. height: 100%;
  420. opacity: 1;
  421. border-radius: 12rpx 12rpx 0 0;
  422. }
  423. }
  424. .title {
  425. font-size: $font-base;
  426. color: $font-color-dark;
  427. font-weight: bold;
  428. line-height: 80rpx;
  429. }
  430. .hot-price {
  431. display: flex;
  432. justify-content: space-between;
  433. padding: 0 16rpx 12rpx;
  434. align-items: center;
  435. .price {
  436. font-size: 40rpx;
  437. color: #ff0000;
  438. font-weight: 500;
  439. }
  440. .over {
  441. font-size: 24rpx;
  442. color: #a199a1;
  443. font-weight: 500;
  444. }
  445. }
  446. }
  447. }
  448. .djs {
  449. margin: 90rpx auto 0;
  450. width: 700rpx;
  451. .djs-bg {
  452. margin: auto;
  453. width: 400rpx;
  454. height: 400rpx;
  455. image {
  456. width: 100%;
  457. height: 100%;
  458. }
  459. }
  460. .djs-font {
  461. margin-top: 20rpx;
  462. font-size: 32rpx;
  463. text-align: center;
  464. }
  465. .djs-main {
  466. margin-top: 20rpx;
  467. font-size: 40rpx;
  468. text-align: center;
  469. color: #fd3b39;
  470. }
  471. }
  472. .nav {
  473. .next {
  474. margin: 40rpx;
  475. width: 50%;
  476. background-color: #fd3b39;
  477. color: #ffffff;
  478. text-align: center;
  479. padding: 10rpx 0rpx;
  480. border-radius: 50rpx;
  481. }
  482. }
  483. </style>