index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <template>
  2. <view class="center">
  3. <view class="top">
  4. <view class="vheigh"></view>
  5. <image class="top-bg" src="../../static/img/top-bg.png" mode=""></image>
  6. <view class="top-main flex">
  7. <view class="search-box flex" @click="clickSearch()">
  8. <image class="search" src="../../static/img/search.png" mode=""></image>
  9. <view class="search-font">输入关键词搜索</view>
  10. </view>
  11. </view>
  12. </view>
  13. <swiper class="carousel" autoplay="true" duration="400" interval="5000" @change="swiperChange">
  14. <swiper-item v-for="(item, index) in carouselList" :key="index" class="carousel-item"
  15. @click="bannerNavToUrl(item)">
  16. <image :src="item.pic" />
  17. </swiper-item>
  18. </swiper>
  19. <view class="tongz flex">
  20. <view>
  21. <view class="tongz-bg">
  22. <image src="../../static/img/tongz-bg.png" mode=""></image>
  23. </view>
  24. <view class="tongz-left flex">
  25. <image class="image-left" src="../../static/img/ling.png" mode=""></image>
  26. <u-notice-bar style="width: 100%;" mode="vertical" type="none" :volume-icon="false"
  27. :more-icon="false" :list="text"></u-notice-bar>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="navbar">
  32. <view class="nav-item" @click="nav('/pages/index/index')">
  33. <image class="nav-img" src="../../static/img/newbanner.png" mode=""></image>
  34. </view>
  35. <view class="nav-item" @click="nav('/pages/navigation/main')">
  36. <image class="nav-img" src="../../static/img/oldbanner.png" mode=""></image>
  37. </view>
  38. </view>
  39. <view class="box margin-t-30 flex">
  40. <view class="leftbox flex">
  41. <view class="flex-center">
  42. <view class="title">
  43. {{ticketBase.fullname}}
  44. </view>
  45. </view>
  46. <view class="num flex">
  47. <image class="tip" src="../../static/img/wpicon.png" mode="scaleToFill"></image>
  48. <text class="chines margin-l-10">
  49. 价格(CNY):
  50. </text>
  51. <text class="onStrong margin-r-10">
  52. {{ticketBase.CurPrice}}
  53. </text>
  54. <image class="tip tipr" src="../../static/img/wpicon.png" mode="scaleToFill"></image>
  55. </view>
  56. </view>
  57. <view class="right flex-center">
  58. <view class="righttext flex-center">
  59. <view class="rightNumBox">
  60. <text class="font-size-sm" v-if="ticketBase.CurrentGains>0">+</text>
  61. <text class="font-size-sm" v-if="ticketBase.CurrentGains<0">-</text>
  62. {{ticketBase.CurrentGains}}
  63. <text class="font-size-sm">%</text>
  64. </view>
  65. </view>
  66. <view class="text">
  67. 近24小时涨跌幅
  68. </view>
  69. </view>
  70. </view>
  71. <!-- #ifdef H5 -->
  72. <view class="btm">
  73. <a href="https://beian.miit.gov.cn" class="a-pm">备案编号:浙ICP备2022017146号 </a>
  74. </view>
  75. <!-- #endif -->
  76. </view>
  77. </template>
  78. <script>
  79. import {
  80. loadIndexs,
  81. store_list
  82. } from '@/api/index.js';
  83. import {
  84. getTicket
  85. } from '@/api/quick.js';
  86. import {
  87. mapState,
  88. mapMutations
  89. } from 'vuex';
  90. export default {
  91. data() {
  92. return {
  93. current: 0,
  94. titleNViewBackground: '',
  95. swiperCurrent: 0,
  96. swiperLength: 0,
  97. carouselList: [], //轮播图列表
  98. text: ['双模式 双系统 开创第三代新零售'],
  99. ticketBase: {}
  100. };
  101. },
  102. onShow() {
  103. this.loadData();
  104. this.getTicket()
  105. },
  106. methods: {
  107. ...mapMutations(['setLat', 'setLon', 'setChoose']),
  108. getTicket() {
  109. getTicket()
  110. .then(
  111. (res) => {
  112. console.log(res);
  113. this.ticketBase = res.data.v;
  114. this.ticketBase.CurrentGains = +this.ticketBase.CurrentGains
  115. }
  116. ).catch(
  117. (err) => {
  118. console.log(err);
  119. }
  120. )
  121. },
  122. loadData() {
  123. loadIndexs({})
  124. .then(({
  125. data
  126. }) => {
  127. let goods = data.info;
  128. this.dataList = goods.bastList; //精品推荐
  129. this.carouselList = data.banner;
  130. })
  131. .catch(e => {});
  132. },
  133. nav(url) {
  134. uni.navigateTo({
  135. url,
  136. fail() {
  137. uni.switchTab({
  138. url
  139. });
  140. }
  141. });
  142. },
  143. //轮播图切换修改背景色
  144. swiperChange(e) {
  145. const index = e.detail.current;
  146. this.swiperCurrent = index;
  147. this.titleNViewBackground = this.carouselList[index].background;
  148. },
  149. // 點擊搜索框
  150. clickSearch() {
  151. uni.navigateTo({
  152. url: '/pages/product/search'
  153. });
  154. },
  155. }
  156. };
  157. </script>
  158. <style lang="scss">
  159. .box {
  160. border-radius: 10rpx;
  161. line-height: 1;
  162. margin: 0 30rpx;
  163. background-image: url("../../static/img/indwxWp.png");
  164. background-size: 100% auto;
  165. background-repeat: no-repeat;
  166. position: relative;
  167. height: 230rpx;
  168. align-items: stretch;
  169. .leftbox {
  170. flex-grow: 1;
  171. padding: 20rpx 0;
  172. flex-direction: column;
  173. .title {
  174. padding: 6rpx 20rpx;
  175. border-radius: 50rpx;
  176. font-size: $font-sm;
  177. color: #FFF;
  178. border: 1px solid #FFF;
  179. }
  180. .num {
  181. font-size: $font-lg;
  182. text-align: center;
  183. color: $color-red;
  184. height: 80rpx;
  185. .onStrong{
  186. font-size: 36rpx;
  187. }
  188. .chines {
  189. color: #FFF;
  190. }
  191. .tip {
  192. width: 80rpx;
  193. height: 6rpx;
  194. &.tipr {
  195. transform: rotate(180deg);
  196. }
  197. }
  198. }
  199. }
  200. .right {
  201. flex-shrink: 0;
  202. width: 200rpx;
  203. flex-direction: column;
  204. color: #FFF;
  205. .righttext {
  206. width: 130rpx;
  207. height: 130rpx;
  208. border-radius: 1000rpx;
  209. border: 1px solid #FFF;
  210. .rightNumBox {
  211. font-size: 40rpx;
  212. }
  213. }
  214. .text {
  215. margin-top: 20rpx;
  216. font-size: $font-sm;
  217. text-shadow: 2px 2px 1px red;
  218. }
  219. }
  220. }
  221. page,
  222. .center {
  223. min-height: 100%;
  224. height: auto;
  225. background: #ffffff;
  226. }
  227. .vheigh {
  228. height: var(--status-bar-height);
  229. background-color: $base-color;
  230. }
  231. .top {
  232. position: relative;
  233. width: 100%;
  234. height: 360rpx;
  235. .top-bg {
  236. position: absolute;
  237. top: 0;
  238. left: 0;
  239. right: 0;
  240. width: 100%;
  241. height: 100%;
  242. }
  243. .top-main {
  244. position: relative;
  245. z-index: 2;
  246. padding: 30rpx;
  247. .search-box {
  248. justify-content: center;
  249. width: 698rpx;
  250. height: 60rpx;
  251. background: rgba(255, 240, 245, 0.4);
  252. box-shadow: 0px 10rpx 20rpx 0px rgba(4, 114, 69, 0.22);
  253. border-radius: 30rpx;
  254. .search {
  255. width: 34rpx;
  256. height: 34rpx;
  257. }
  258. .search-font {
  259. margin-left: 14rpx;
  260. font-size: 28rpx;
  261. font-family: PingFang SC;
  262. font-weight: 500;
  263. color: #ffffff;
  264. }
  265. }
  266. }
  267. }
  268. .carousel {
  269. width: 700rpx;
  270. height: 276rpx;
  271. /* #ifndef APP-PLUS */
  272. margin: -240rpx auto 0;
  273. /* #endif */
  274. /* #ifdef APP-PLUS */
  275. margin: -180rpx auto 0;
  276. /* #endif */
  277. border-radius: 40rpx;
  278. image {
  279. border-radius: 40rpx;
  280. width: 700rpx;
  281. height: 276rpx;
  282. }
  283. }
  284. .tongz {
  285. width: 690rpx;
  286. height: 70rpx;
  287. margin: 32rpx auto 0;
  288. padding: 18rpx 30rpx 18rpx 24rpx;
  289. align-items: center;
  290. position: relative;
  291. .tongz-bg {
  292. position: absolute;
  293. top: 0;
  294. right: 0;
  295. left: 0;
  296. width: 690rpx;
  297. height: 70rpx;
  298. image {
  299. width: 100%;
  300. height: 100%;
  301. }
  302. }
  303. .tongz-left {
  304. width: 640rpx;
  305. .image-left {
  306. width: 28rpx;
  307. height: 34rpx;
  308. }
  309. .tongz-font {
  310. margin-left: 22rpx;
  311. font-size: 28rpx;
  312. font-family: Source Han Sans CN;
  313. font-weight: 400;
  314. color: #0f253a;
  315. }
  316. }
  317. .tongz-right {
  318. position: relative;
  319. z-index: 11;
  320. width: 12rpx;
  321. height: 26rpx;
  322. image {
  323. width: 100%;
  324. height: 100%;
  325. }
  326. }
  327. }
  328. .nav-item {
  329. width: 698rpx;
  330. height: 219rpx;
  331. background: linear-gradient(150deg, #F5BE41 0%, #DF4226 100%);
  332. border-radius: 14rpx;
  333. margin: 40rpx auto 0;
  334. .nav-img {
  335. width: 100%;
  336. height: 100%;
  337. border-radius: 14rpx;
  338. }
  339. }
  340. .btm {
  341. position: fixed;
  342. bottom: 0;
  343. width: 100%;
  344. height: 50rpx;
  345. line-height: 50rpx;
  346. text-align: center;
  347. .a-pm {
  348. text-decoration: none;
  349. width: 100%;
  350. height: 50rpx;
  351. line-height: 50rpx;
  352. color: navigator;
  353. }
  354. }
  355. </style>