hallinfo.vue 9.5 KB

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