hallinfo.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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 class="hotgoods" v-if="firstList.length != 0 && isbuy">
  27. <view class="hotgoods-item" v-for="item in firstList" :key="item.id" @click="navToDetailPage(item)">
  28. <view class="image-wrapper"><image :src="item.image" mode="scaleToFill"></image></view>
  29. <view class="title clamp margin-c-20">{{ item.name }}</view>
  30. <view class="hot-price">
  31. <view class="price">
  32. <text class="font-size-sm">¥</text>
  33. {{ item.hanging_price }}
  34. </view>
  35. <view class="over" v-if="item.status == 2">已售罄</view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import { auction_product, count_down } from '@/api/hall.js';
  43. import { getTime } from '@/utils/rocessor.js';
  44. export default {
  45. data() {
  46. return {
  47. productname: '', //商品名称
  48. name: '', //馆名字
  49. peoplename: '', //馆长名字
  50. firstList: [],
  51. id: '', //场次id
  52. page: 1,
  53. limit: 10,
  54. loadingType: 'more',
  55. countdown_time: '',
  56. canbuy: 0, //结束时间
  57. isbuy: false,
  58. time: '' //进场时间
  59. };
  60. },
  61. onLoad(option) {
  62. this.name = option.name;
  63. this.peoplename = option.peoplename;
  64. this.id = option.id;
  65. this.isDjs();
  66. this.loadData();
  67. },
  68. onShow() {
  69. this.isDjs();
  70. this.loadData();
  71. },
  72. methods: {
  73. isDjs() {
  74. count_down({ id: this.id }).then(({ data }) => {
  75. this.canbuy = data.time;
  76. let day = getTime(this.canbuy * 1000).split(' ');
  77. this.time = day[1];
  78. this.counTime();
  79. });
  80. },
  81. counTime() {
  82. //获取当前时间
  83. let data = new Date();
  84. let newTime = data.getTime();
  85. //结束时间
  86. let end = this.canbuy;
  87. //时间差
  88. let leftTime = end * 1000 - newTime;
  89. console.log(leftTime);
  90. console.log(this.la, '2222222');
  91. if (leftTime <= 0) {
  92. console.log('已结束');
  93. this.isbuy = true;
  94. return;
  95. }
  96. //定义保存倒计时时间
  97. let m, s;
  98. if (leftTime >= 0) {
  99. m = Math.floor((leftTime / 1000 / 60) % 60);
  100. s = Math.floor((leftTime / 1000) % 60);
  101. this.second = s;
  102. this.la = m + s;
  103. console.log(this.la, '计算');
  104. console.log(this.second);
  105. console.log(m, s);
  106. //倒计时赋值view
  107. this.countdown_time = `${m}:${s}`;
  108. let timers = setTimeout(this.counTime, 1000);
  109. //显示动态时间效果
  110. if (s < 10) {
  111. return (this.countdown_time = `${m}:0${s}`);
  112. let timers = setTimeout(this.counTime, 1000);
  113. }
  114. if (m < 10) {
  115. return (this.countdown_time = `0${m}:${s}`);
  116. let timers = setTimeout(this.counTime, 1000);
  117. }
  118. }
  119. },
  120. search() {
  121. this.firstList = [];
  122. this.page = 1;
  123. this.limit = 10;
  124. this.loadingType = 'more';
  125. this.loadData();
  126. },
  127. loadData() {
  128. const obj = this;
  129. if (obj.loadingType == 'nomore' || obj.loadingType == 'loading') {
  130. return;
  131. }
  132. obj.loadingType = 'loading';
  133. auction_product({
  134. page: obj.page,
  135. limit: obj.limit,
  136. id: obj.id,
  137. name: obj.productname
  138. })
  139. .then(({ data }) => {
  140. obj.firstList = obj.firstList.concat(data);
  141. if (data.length != obj.limit) {
  142. obj.loadingType = 'more';
  143. obj.page++;
  144. } else {
  145. obj.loadingType = 'nomore';
  146. }
  147. })
  148. .catch(e => {
  149. console.log(e);
  150. });
  151. },
  152. toBack() {
  153. uni.navigateBack({});
  154. },
  155. nav(url) {
  156. uni.navigateTo({
  157. url
  158. });
  159. },
  160. navToDetailPage(item) {
  161. if (item.status == '2') {
  162. return this.$api.msg('已售罄');
  163. }
  164. uni.navigateTo({
  165. url: '/pages/hall/porducthall?id=' + item.id + '&uid=' + this.id + '&name=' + this.name + '&peoplename=' + this.peoplename
  166. });
  167. }
  168. }
  169. };
  170. </script>
  171. <style lang="scss">
  172. .center,
  173. page {
  174. height: auto;
  175. min-height: 100%;
  176. background-color: #ffffff;
  177. }
  178. .money-box {
  179. color: #ffffff;
  180. text-align: center;
  181. position: relative;
  182. padding-top: 250rpx;
  183. .money_bg {
  184. position: absolute;
  185. width: 750rpx;
  186. height: 412rpx;
  187. top: 0;
  188. left: 0;
  189. right: 0;
  190. }
  191. .header {
  192. position: absolute;
  193. left: 0;
  194. top: 0;
  195. width: 100%;
  196. height: 80rpx;
  197. font-size: 32rpx;
  198. font-weight: 700;
  199. z-index: 99;
  200. display: flex;
  201. justify-content: center;
  202. align-items: center;
  203. }
  204. .goback-box {
  205. position: absolute;
  206. left: 18rpx;
  207. top: 0;
  208. height: 80rpx;
  209. display: flex;
  210. align-items: center;
  211. }
  212. .goback {
  213. z-index: 100;
  214. width: 34rpx;
  215. height: 34rpx;
  216. }
  217. .message {
  218. display: inline-block;
  219. position: relative;
  220. z-index: 2;
  221. margin: 0 auto;
  222. padding: 20rpx 40rpx;
  223. background: rgba(253, 59, 57, 0.4);
  224. border-radius: 25rpx;
  225. font-size: 30rpx;
  226. font-family: PingFang SC;
  227. font-weight: 500;
  228. color: #ffffff;
  229. }
  230. }
  231. .search {
  232. margin-top: 120rpx;
  233. padding: 0 30rpx 0 20rpx;
  234. display: flex;
  235. align-items: center;
  236. .search-left {
  237. width: 112rpx;
  238. height: 70rpx;
  239. background: #fd3b39;
  240. border-radius: 25rpx;
  241. font-size: 30rpx;
  242. font-family: PingFang SC;
  243. font-weight: 500;
  244. color: #ffffff;
  245. line-height: 70rpx;
  246. text-align: center;
  247. }
  248. .search-right {
  249. width: 570rpx;
  250. background: #dcdcdc;
  251. border-radius: 35rpx;
  252. margin-left: 20rpx;
  253. padding: 18rpx 50rpx 18rpx 36rpx;
  254. .search-inco {
  255. width: 34rpx;
  256. height: 34rpx;
  257. }
  258. }
  259. }
  260. .hotgoods {
  261. margin-top: 38rpx;
  262. width: 100%;
  263. display: flex;
  264. flex-wrap: wrap;
  265. padding: 0 32rpx 108rpx;
  266. .hotgoods-item {
  267. width: 48%;
  268. background-color: #ffffff;
  269. border-radius: 12rpx;
  270. margin-bottom: 24rpx;
  271. &:nth-child(2n + 1) {
  272. margin-right: 24rpx;
  273. }
  274. .image-wrapper {
  275. width: 100%;
  276. height: 330rpx;
  277. border-radius: 3px;
  278. overflow: hidden;
  279. image {
  280. width: 100%;
  281. height: 100%;
  282. opacity: 1;
  283. border-radius: 12rpx 12rpx 0 0;
  284. }
  285. }
  286. .title {
  287. font-size: $font-base;
  288. color: $font-color-dark;
  289. font-weight: bold;
  290. line-height: 80rpx;
  291. }
  292. .hot-price {
  293. display: flex;
  294. justify-content: space-between;
  295. padding: 0 16rpx 12rpx;
  296. align-items: center;
  297. .price {
  298. font-size: 40rpx;
  299. color: #ff0000;
  300. font-weight: 500;
  301. }
  302. .over {
  303. font-size: 24rpx;
  304. color: #a199a1;
  305. font-weight: 500;
  306. }
  307. }
  308. }
  309. }
  310. .djs {
  311. margin: 90rpx auto 0;
  312. width: 700rpx;
  313. .djs-bg {
  314. margin: auto;
  315. width: 400rpx;
  316. height: 400rpx;
  317. image {
  318. width: 100%;
  319. height: 100%;
  320. }
  321. }
  322. .djs-font {
  323. margin-top: 20rpx;
  324. font-size: 32rpx;
  325. text-align: center;
  326. }
  327. .djs-main {
  328. margin-top: 20rpx;
  329. font-size: 40rpx;
  330. text-align: center;
  331. color: #fd3b39;
  332. }
  333. }
  334. </style>