hallinfo.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  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.loadData();
  108. this.loadDataNext();
  109. },
  110. onReachBottom() {
  111. console.log('123456');
  112. if (this.isbuy1) {
  113. this.loadData();
  114. }
  115. },
  116. onHide() {
  117. clearTimeout(this.timers);
  118. },
  119. // 监听页面卸载
  120. onUnload() {
  121. // 关闭倒计时
  122. clearTimeout(this.timers);
  123. },
  124. // 监听页面后退
  125. onBackPress() {
  126. // 关闭倒计时
  127. clearTimeout(this.timers);
  128. },
  129. methods: {
  130. ...mapMutations(['setBuy1']),
  131. isDjs() {
  132. uni.showLoading({
  133. title: '加载中'
  134. });
  135. count_down({
  136. id: this.id
  137. }).then(({
  138. data
  139. }) => {
  140. uni.hideLoading();
  141. this.canbuy = data.time;
  142. let day = getTime(this.canbuy * 1000).split(' ');
  143. this.time = day[1];
  144. this.counTime();
  145. });
  146. },
  147. counTime() {
  148. //获取当前时间
  149. let data = new Date();
  150. let newTime = data.getTime();
  151. //结束时间
  152. let end = this.canbuy;
  153. //时间差
  154. let leftTime = end * 1000 - newTime;
  155. console.log(leftTime);
  156. console.log(this.la, '2222222');
  157. if (leftTime <= 0) {
  158. console.log('已结束');
  159. this.setBuy1(true);
  160. return;
  161. }
  162. //定义保存倒计时时间
  163. let m, s;
  164. if (leftTime >= 0) {
  165. m = Math.floor((leftTime / 1000 / 60) % 60);
  166. s = Math.floor((leftTime / 1000) % 60);
  167. this.second = s;
  168. this.la = m + s;
  169. console.log(this.la, '计算');
  170. console.log(this.second);
  171. console.log(m, s);
  172. //倒计时赋值view
  173. this.countdown_time = `${m}:${s}`;
  174. this.timers = setTimeout(this.counTime, 1000);
  175. //显示动态时间效果
  176. if (s < 10) {
  177. return (this.countdown_time = `${m}:0${s}`);
  178. this.timers = setTimeout(this.counTime, 1000);
  179. }
  180. if (m < 10) {
  181. return (this.countdown_time = `0${m}:${s}`);
  182. this.timers = setTimeout(this.counTime, 1000);
  183. }
  184. }
  185. },
  186. search() {
  187. this.firstList = [];
  188. this.page = 1;
  189. this.limit = 10;
  190. this.loadingType = 'more';
  191. this.loadData();
  192. },
  193. loadData() {
  194. const obj = this;
  195. // if (obj.loadingType == 'nomore' || obj.loadingType == 'loading') {
  196. // return;
  197. // }
  198. // obj.loadingType = 'loading';
  199. auction_product({
  200. page: obj.page,
  201. limit: obj.limit,
  202. id: obj.id,
  203. name: obj.productname
  204. })
  205. .then(({
  206. data
  207. }) => {
  208. // obj.firstList = obj.firstList.concat(data);
  209. obj.firstList = data;
  210. console.log(obj.firstList, '123456789');
  211. // if (data.length == obj.limit) {
  212. // obj.loadingType = 'more';
  213. // obj.page++;
  214. // } else {
  215. // obj.loadingType = 'nomore';
  216. // }
  217. })
  218. .catch(e => {
  219. console.log(e);
  220. });
  221. },
  222. loadDataNext() {
  223. const obj = this;
  224. // if (obj.loadingType == 'nomore' || obj.loadingType == 'loading') {
  225. // return;
  226. // }
  227. // obj.loadingType = 'loading';
  228. auction_product({
  229. page: obj.page + 1,
  230. limit: obj.limit,
  231. id: obj.id,
  232. name: obj.productname
  233. })
  234. .then(({
  235. data
  236. }) => {
  237. // obj.firstList = obj.firstList.concat(data);
  238. // obj.firstList = data;
  239. // if (data.length == obj.limit) {
  240. // obj.loadingType = 'more';
  241. // obj.page++;
  242. // } else {
  243. // obj.loadingType = 'nomore';
  244. // }
  245. if (data.length === 0) {
  246. obj.isLast = false;
  247. } else {
  248. obj.isLast = true;
  249. }
  250. console.log(obj.isLast);
  251. })
  252. .catch(e => {
  253. console.log(e);
  254. });
  255. },
  256. toBack() {
  257. uni.navigateBack({});
  258. },
  259. nav(url) {
  260. uni.navigateTo({
  261. url
  262. });
  263. },
  264. last() {
  265. let that = this;
  266. if (this.page != 1) {
  267. this.page = this.page - 1;
  268. this.loadData();
  269. this.loadDataNext();
  270. } else {
  271. that.$api.msg('已经是第一页了');
  272. }
  273. },
  274. next() {
  275. let that = this;
  276. this.page = this.page + 1;
  277. if (this.isLast) {
  278. this.loadData();
  279. this.loadDataNext();
  280. } else {
  281. this.page = this.page - 1;
  282. that.$api.msg('已经是最后一页了');
  283. }
  284. },
  285. navToDetailPage(item) {
  286. if (item.status == '2') {
  287. return this.$api.msg('已售罄');
  288. }
  289. uni.navigateTo({
  290. url: '/pages/hall/porducthall?id=' + item.id + '&uid=' + this.id + '&name=' + this.name +
  291. '&peoplename=' + this.peoplename
  292. });
  293. }
  294. }
  295. };
  296. </script>
  297. <style lang="scss">
  298. .center,
  299. page {
  300. height: auto;
  301. min-height: 100%;
  302. background-color: #ffffff;
  303. }
  304. .money-box {
  305. color: #ffffff;
  306. text-align: center;
  307. position: relative;
  308. padding-top: 250rpx;
  309. .money_bg {
  310. position: absolute;
  311. width: 750rpx;
  312. height: 412rpx;
  313. top: 0;
  314. left: 0;
  315. right: 0;
  316. }
  317. .header {
  318. position: absolute;
  319. left: 0;
  320. top: 0;
  321. width: 100%;
  322. height: 80rpx;
  323. font-size: 32rpx;
  324. font-weight: 700;
  325. z-index: 99;
  326. display: flex;
  327. justify-content: center;
  328. align-items: center;
  329. }
  330. .goback-box {
  331. position: absolute;
  332. left: 18rpx;
  333. top: 0;
  334. height: 80rpx;
  335. display: flex;
  336. align-items: center;
  337. }
  338. .goback {
  339. z-index: 100;
  340. width: 34rpx;
  341. height: 34rpx;
  342. }
  343. .message {
  344. display: inline-block;
  345. position: relative;
  346. z-index: 2;
  347. margin: 0 auto;
  348. padding: 20rpx 40rpx;
  349. background: rgba(253, 59, 57, 0.4);
  350. border-radius: 25rpx;
  351. font-size: 30rpx;
  352. font-family: PingFang SC;
  353. font-weight: 500;
  354. color: #ffffff;
  355. }
  356. }
  357. .search {
  358. margin-top: 120rpx;
  359. padding: 0 30rpx 0 20rpx;
  360. display: flex;
  361. align-items: center;
  362. .search-left {
  363. width: 112rpx;
  364. height: 70rpx;
  365. background: #fd3b39;
  366. border-radius: 25rpx;
  367. font-size: 30rpx;
  368. font-family: PingFang SC;
  369. font-weight: 500;
  370. color: #ffffff;
  371. line-height: 70rpx;
  372. text-align: center;
  373. }
  374. .search-right {
  375. width: 570rpx;
  376. background: #dcdcdc;
  377. border-radius: 35rpx;
  378. margin-left: 20rpx;
  379. padding: 18rpx 50rpx 18rpx 36rpx;
  380. .search-inco {
  381. width: 34rpx;
  382. height: 34rpx;
  383. }
  384. }
  385. }
  386. .hotgoods {
  387. margin-top: 38rpx;
  388. width: 100%;
  389. display: flex;
  390. flex-wrap: wrap;
  391. padding: 0 32rpx 20rpx;
  392. .hotgoods-item {
  393. position: relative;
  394. width: 48%;
  395. background-color: #ffffff;
  396. border-radius: 12rpx;
  397. margin-bottom: 24rpx;
  398. &:nth-child(2n + 1) {
  399. margin-right: 24rpx;
  400. }
  401. .sell-out {
  402. position: absolute;
  403. top: 0;
  404. left: 0;
  405. right: 0;
  406. width: 150rpx;
  407. height: 130rpx;
  408. z-index: 2;
  409. }
  410. .image-wrapper {
  411. width: 100%;
  412. height: 330rpx;
  413. border-radius: 3px;
  414. overflow: hidden;
  415. image {
  416. width: 100%;
  417. height: 100%;
  418. opacity: 1;
  419. border-radius: 12rpx 12rpx 0 0;
  420. }
  421. }
  422. .title {
  423. font-size: $font-base;
  424. color: $font-color-dark;
  425. font-weight: bold;
  426. line-height: 80rpx;
  427. }
  428. .hot-price {
  429. display: flex;
  430. justify-content: space-between;
  431. padding: 0 16rpx 12rpx;
  432. align-items: center;
  433. .price {
  434. font-size: 40rpx;
  435. color: #ff0000;
  436. font-weight: 500;
  437. }
  438. .over {
  439. font-size: 24rpx;
  440. color: #a199a1;
  441. font-weight: 500;
  442. }
  443. }
  444. }
  445. }
  446. .djs {
  447. margin: 90rpx auto 0;
  448. width: 700rpx;
  449. .djs-bg {
  450. margin: auto;
  451. width: 400rpx;
  452. height: 400rpx;
  453. image {
  454. width: 100%;
  455. height: 100%;
  456. }
  457. }
  458. .djs-font {
  459. margin-top: 20rpx;
  460. font-size: 32rpx;
  461. text-align: center;
  462. }
  463. .djs-main {
  464. margin-top: 20rpx;
  465. font-size: 40rpx;
  466. text-align: center;
  467. color: #fd3b39;
  468. }
  469. }
  470. .nav {
  471. .next {
  472. margin: 40rpx;
  473. width: 50%;
  474. background-color: #fd3b39;
  475. color: #ffffff;
  476. text-align: center;
  477. padding: 10rpx 0rpx;
  478. border-radius: 50rpx;
  479. }
  480. }
  481. </style>