index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. <template>
  2. <view class="container">
  3. <view class="top">
  4. <!-- <image class="top-bg" src="../../static/img/top-bg.png" mode=""></image> -->
  5. <view class="top-main flex">
  6. <view class="search-box flex" @click="clickSearch()">
  7. <image class="search" src="../../static/icon/search-h.png" mode=""></image>
  8. <view class="search-font">输入关键词搜索</view>
  9. </view>
  10. </view>
  11. <swiper class="carousel" autoplay="true" duration="400" interval="5000" @change="swiperChange">
  12. <swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"
  13. @click="bannerNavToUrl(item)">
  14. <image class="img" :src="item.pic" mode="scaleToFill" />
  15. </swiper-item>
  16. </swiper>
  17. </view>
  18. <view class="box">
  19. <view class="box-title">
  20. <view class="left">
  21. 艺绘
  22. </view>
  23. <view class="right" @click="navTo('/pages/index/cangp')">
  24. 查看更多 >
  25. </view>
  26. </view>
  27. <view class="box-content" v-for="(item,index) in list" @click="buy(item)">
  28. <view class="img">
  29. <image :src="item.image" mode=""></image>
  30. </view>
  31. <view class="content-title">
  32. <view class="title">
  33. {{item.store_name}}
  34. </view>
  35. <view class="text">
  36. 黑道研究会 发行
  37. </view>
  38. <view class="text">
  39. 发行数量: {{item.stock}}份
  40. </view>
  41. <view class="text">
  42. 开售时间: {{item.cmy_pay_time}}
  43. </view>
  44. </view>
  45. </view>
  46. <!-- <view class="box-content">
  47. <view class="img">
  48. <image src="../../static/index/nvwang.png" mode=""></image>
  49. </view>
  50. <view class="content-title">
  51. <view class="">
  52. 黑道女王
  53. </view>
  54. <view class="text">
  55. 黑道研究会 发行
  56. </view>
  57. <view class="text">
  58. 发行数量: 14521份
  59. </view>
  60. </view>
  61. </view> -->
  62. </view>
  63. <view class="btm" style="height: 44px;"></view>
  64. <!-- 客服 -->
  65. <!-- <uni-popup ref="popupkf" type="center">
  66. <view class="popup-box">
  67. <view class="img"><image src="../../static/img/img009.png" mode=""></image></view>
  68. <view class="mian">
  69. <view class="delivery">
  70. <view class="title">已经为您定制专属客服</view>
  71. <image src="../../static/img/img010.png" mode=""></image>
  72. </view>
  73. <view class="nocancel">客服VX:{{ text }}</view>
  74. <view class="comfirm-box">
  75. <view class="cancel" @click="kfClose()">取消</view>
  76. <view class="comfirm" @click="comfirm(text)">复制微信</view>
  77. </view>
  78. </view>
  79. </view>
  80. </uni-popup> -->
  81. </view>
  82. </template>
  83. <script>
  84. import {
  85. getBargainList,
  86. getProducts
  87. } from '@/api/product.js';
  88. // import {mapState} from 'vuex'
  89. import {
  90. loadIndexs
  91. } from '@/api/index.js'
  92. import {
  93. mapState,
  94. mapMutations
  95. } from 'vuex';
  96. // #ifdef H5
  97. import {
  98. weixindata,
  99. shareLoad
  100. } from '@/utils/wxAuthorized';
  101. // #endif
  102. export default {
  103. data() {
  104. return {
  105. isSc: 2,
  106. text: '',
  107. checkid: 0,
  108. titleNViewBackground: '',
  109. longitude: 0, //经度
  110. latitude: 0, //纬度
  111. swiperCurrent: 0,
  112. swiperLength: 0,
  113. carouselList: [], //轮播列表
  114. bastList: [], //会员礼包
  115. integralList: [], //兑换专区
  116. list: [], //卡片信息
  117. page: 1,
  118. limit: 10,
  119. loadType: 'more',
  120. text: [],
  121. article: []
  122. };
  123. },
  124. computed: {
  125. ...mapState(['loginInterceptor', 'baseURL']),
  126. ...mapState('user', ['hasLogin', 'userInfo'])
  127. },
  128. onLoad: function(option) {
  129. this.loadIndex()
  130. this.getProduct()
  131. },
  132. onShow: function() {
  133. if (this.hasLogin) {
  134. this.loadIndex()
  135. this.getProduct()
  136. }
  137. },
  138. // onReachBottom() {
  139. // this.getproducts();
  140. // },
  141. methods: {
  142. ...mapMutations(['setLat', 'setLon']),
  143. loadIndex() {
  144. let obj = this
  145. loadIndexs().then(res => {
  146. // console.log(res, 'res');
  147. obj.carouselList = res.data.banner
  148. // console.log(res,'res');
  149. // obj.list = res.data.info.fastList
  150. })
  151. },
  152. getProduct() {
  153. let obj = this
  154. getProducts().then(res => {
  155. // obj.carouselList = res.data.banner
  156. // console.log(res, 'res');
  157. obj.list = res.data.map((e) => {
  158. let time = new Date(e.sell_time * 1000);
  159. e.cmy_pay_time = time.getFullYear() + '年' + (time.getMonth() + 1) + '月' + time
  160. .getDate() + '日' + time.getHours() + '时' + time.getMinutes() + '分' + time
  161. .getSeconds() + '秒'
  162. return e
  163. })
  164. })
  165. },
  166. buy(item) {
  167. console.log(item, 'res');
  168. uni.navigateTo({
  169. url: '/pages/product/product?id=' + item.id + '&isSc=' + this.isSc
  170. })
  171. },
  172. navTo(url) {
  173. uni.switchTab({
  174. url
  175. })
  176. },
  177. // 點擊搜索框
  178. clickSearch() {
  179. uni.navigateTo({
  180. url: '/pages/product/search'
  181. });
  182. },
  183. swiperChange() {}
  184. }
  185. };
  186. </script>
  187. <style lang="scss">
  188. page {
  189. width: 750rpx;
  190. height: 100%;
  191. background: #111111;
  192. }
  193. .carousel {
  194. width: 750rpx;
  195. height: 375rpx;
  196. .carousel-item {
  197. height:100%;
  198. width:100%;
  199. .img{
  200. height:100%;
  201. width:100%;
  202. }
  203. }
  204. }
  205. .top {
  206. position: relative;
  207. width: 100%;
  208. .top-bg {
  209. position: absolute;
  210. top: 0;
  211. left: 0;
  212. right: 0;
  213. width: 100%;
  214. height: 100%;
  215. }
  216. .top-main {
  217. position: relative;
  218. z-index: 2;
  219. padding: 30rpx;
  220. .search-box {
  221. justify-content: center;
  222. width: 698rpx;
  223. height: 60rpx;
  224. background: #191919;
  225. // box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
  226. border-radius: 30rpx;
  227. .search {
  228. width: 34rpx;
  229. height: 34rpx;
  230. }
  231. .search-font {
  232. margin-left: 14rpx;
  233. font-size: 28rpx;
  234. font-family: PingFang SC;
  235. font-weight: 500;
  236. color: #a4a4a4;
  237. }
  238. }
  239. }
  240. }
  241. .box {
  242. padding: 30rpx;
  243. .box-title {
  244. margin-top: 20rpx;
  245. display: flex;
  246. justify-content: space-between;
  247. .left {
  248. font-size: 38rpx;
  249. font-family: PingFang SC;
  250. font-weight: bold;
  251. color: #FFFFFF;
  252. line-height: 120rpx;
  253. }
  254. .right {
  255. font-size: 24rpx;
  256. font-family: PingFang SC;
  257. font-weight: 500;
  258. color: #FFFFFF;
  259. line-height: 120rpx;
  260. }
  261. }
  262. .box-content {
  263. margin: 50rpx 0;
  264. .img {
  265. width: 690rpx;
  266. height: 690rpx;
  267. image {
  268. width: 100%;
  269. height: 100%;
  270. }
  271. }
  272. .content-title {
  273. margin-top: -10rpx;
  274. padding: 30rpx 20rpx;
  275. border-bottom-left-radius: 10rpx;
  276. border-bottom-right-radius: 10rpx;
  277. border: 2rpx solid #533A6A;
  278. // box-shadow: 0px 0px 20rpx 0px rgba(79,59,103,0.0600);
  279. .title {
  280. font-size: 39rpx;
  281. font-weight: bold;
  282. color: #FFFFFF;
  283. margin-bottom: 20rpx;
  284. }
  285. .text {
  286. margin: 10rpx 0;
  287. color: #FFFFFF;
  288. font-size: 28rpx;
  289. }
  290. }
  291. }
  292. }
  293. .popup-box {
  294. width: 522rpx;
  295. height: 605rpx;
  296. background-color: #ffffff;
  297. border-radius: 20rpx;
  298. position: relative;
  299. .img {
  300. position: relative;
  301. top: -56rpx;
  302. left: 0;
  303. width: 522rpx;
  304. height: 132rpx;
  305. display: flex;
  306. justify-content: center;
  307. image {
  308. border-radius: 20rpx 20rpx 0 0;
  309. width: 450rpx;
  310. height: 132rpx;
  311. }
  312. }
  313. .mian {
  314. margin-top: -44rpx;
  315. display: flex;
  316. flex-direction: column;
  317. align-items: center;
  318. // padding: 32rpx 32rpx;
  319. background-color: #ffffff;
  320. border-radius: 0 0 20rpx 20rpx;
  321. text-align: center;
  322. .delivery {
  323. font-size: 40rpx;
  324. color: #333333;
  325. display: flex;
  326. align-items: center;
  327. flex-direction: column;
  328. .title {}
  329. image {
  330. margin-top: 48rpx;
  331. width: 172rpx;
  332. height: 160rpx;
  333. }
  334. }
  335. .nocancel {
  336. font-size: 32rpx;
  337. color: #333333;
  338. margin-top: 14rpx;
  339. }
  340. .comfirm-box {
  341. margin-top: 52rpx;
  342. display: flex;
  343. // margin-bottom: 32rpx;
  344. // justify-content: space-around;
  345. .cancel {
  346. display: flex;
  347. align-items: center;
  348. justify-content: center;
  349. width: 197rpx;
  350. height: 74rpx;
  351. border: 1px solid #dcc786;
  352. border-radius: 38rpx;
  353. font-size: 32rpx;
  354. color: #605128;
  355. }
  356. .comfirm {
  357. margin-left: 32rpx;
  358. display: flex;
  359. align-items: center;
  360. justify-content: center;
  361. width: 197rpx;
  362. height: 74rpx;
  363. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  364. border-radius: 38px;
  365. font-size: 32rpx;
  366. color: #605128;
  367. }
  368. }
  369. }
  370. }
  371. .tongz {
  372. width: 690rpx;
  373. height: 70rpx;
  374. margin: 32rpx auto 0;
  375. padding: 18rpx 30rpx 18rpx 24rpx;
  376. align-items: center;
  377. position: relative;
  378. .tongz-bg {
  379. position: absolute;
  380. top: 0;
  381. right: 0;
  382. left: 0;
  383. width: 690rpx;
  384. height: 70rpx;
  385. image {
  386. width: 100%;
  387. height: 100%;
  388. }
  389. }
  390. .tongz-left {
  391. width: 640rpx;
  392. .image-left {
  393. width: 28rpx;
  394. height: 34rpx;
  395. }
  396. .tongz-font {
  397. margin-left: 22rpx;
  398. font-size: 28rpx;
  399. font-family: Source Han Sans CN;
  400. font-weight: 400;
  401. color: #0f253a;
  402. }
  403. }
  404. .tongz-right {
  405. position: relative;
  406. z-index: 11;
  407. width: 12rpx;
  408. height: 26rpx;
  409. image {
  410. width: 100%;
  411. height: 100%;
  412. }
  413. }
  414. }
  415. </style>