hallinfo.vue 9.7 KB

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