index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <template>
  2. <view class="pages">
  3. <view class="" :style="{height: navHeight+'px' }"></view>
  4. <view class="swiper-wrap">
  5. <u-swiper
  6. :list="bannerList"
  7. indicator
  8. height="750rpx"
  9. keyName="sliderImg"
  10. indicatorMode="dot"
  11. radius="0"
  12. :circular="true"
  13. imgMode="aspectFit"
  14. @click="bannerClick()"
  15. ></u-swiper>
  16. </view>
  17. <view class="swiper-block" :style="{height: ( 375 - navHeight )+'px' }"></view>
  18. <view class="page-wrap">
  19. <view class="member-info u-flex u-row-between" :style="[memberInfoBg]">
  20. <view class="left u-flex">
  21. <u-avatar :src="avatar||staticUrl+'/img/avatar-white.png'" size="88rpx"></u-avatar>
  22. <view class="text">
  23. <view class="name">{{vuex_member_info.name}}</view>
  24. <text class="level-name">{{vuex_member_info.levelName}}</text>
  25. </view>
  26. </view>
  27. <view class="right u-flex">
  28. <text class="credit-text">积分</text>
  29. <text class="num">{{memberInfo.credit}}</text>
  30. </view>
  31. </view>
  32. <view class="index-nav u-flex u-row-between u-flex-wrap">
  33. <view class="nav-item" v-for="(item,index) in iconNavList" @click="indexNavClick(item)" :key="index">
  34. <!-- <u--image class="image" :src="item.icon" width="101rpx" height="101rpx"></u--image> -->
  35. <img class="image" :src="item.icon" alt="">
  36. <view class="name">{{item.name}}</view>
  37. </view>
  38. </view>
  39. <view class="index-img">
  40. <u-swiper
  41. :list="centerImg"
  42. :indicator="centerImg.length>1"
  43. radius="0"
  44. keyName="sliderImg"
  45. indicatorMode="dot"
  46. imgMode="aspectFit"
  47. height="240rpx"
  48. @click="centerImgClick()"
  49. ></u-swiper>
  50. </view>
  51. <view class="activity">
  52. <view class="single-til u-flex u-row-between">
  53. <view class="text u-flex">
  54. 活动专区
  55. <text class="sub-title">Activity Zone</text>
  56. </view>
  57. <view class="u-flex" @click="$u.route('/shopping/producTypetList')">
  58. <text class="more-text">更多</text>
  59. <u-icon name="arrow-right" color="#676767" size="24rpx"></u-icon>
  60. </view>
  61. </view>
  62. <view class="">
  63. </view>
  64. </view>
  65. <view class="product-list-v2">
  66. <view class="single-til u-flex u-row-between">
  67. <view class="text u-flex">
  68. 全部产品
  69. <text class="sub-title">All Products</text>
  70. </view>
  71. <view class="u-flex" @click="$u.route('/shopping/producTypetList')">
  72. <text class="more-text">更多</text>
  73. <u-icon name="arrow-right" color="#676767" size="24rpx"></u-icon>
  74. </view>
  75. </view>
  76. <view class="product-wrap u-flex u-flex-wrap u-row-between">
  77. <view class="product-v2" @click="$u.route('/shopping/productdetails',{id:item.id})" v-for="item in hotGoods" :key="item.id">
  78. <u--image :showLoading="true" :src="item.mainImg" width="100%" height="280rpx"></u--image>
  79. <view class="name ellipsis-2">{{item.goodsName}}</view>
  80. <view class="price u-flex">
  81. <view class="myprice" v-if="vuex_member_info.priceType>1">
  82. ¥ <text class="price-num">{{item.vipPrice}}</text>
  83. <text class="gray line-through">{{item.salePrice}}</text>
  84. </view>
  85. <view class="myprice" v-else>
  86. ¥ <text class="price-num">{{item.salePrice}}</text>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. </view>
  93. <view class="goMap u-flex" @click="goMap" :style="{top:`${statusBarHeight}px`}">
  94. <img class="image" :src="staticUrl+'/img/go-map-icon.png'" alt="">
  95. <text class="text">去商场</text>
  96. </view>
  97. <tabbar :tabbarIndexProps='0' />
  98. <!-- <cartfixed ref="cartfixed" @getCartList="getCartList" /> -->
  99. </view>
  100. </template>
  101. <script>
  102. import { systemInfo } from "@/mixin.js";
  103. import tabbar from "../../components/tabbar.vue";
  104. import cartfixed from "../../components/cartfixed.vue"
  105. export default {
  106. components:{
  107. tabbar,
  108. // cartfixed
  109. },
  110. mixins:[systemInfo],
  111. data() {
  112. return {
  113. staticUrl:this.$commonConfig.staticUrl,
  114. bannerList: [],
  115. centerImg:[],
  116. hotGoods:[],
  117. memberInfo:{},
  118. avatar:'',
  119. iconNavList:[
  120. {name:'品牌导览',icon:`${this.$commonConfig.staticUrl}/img/index-nav-icon-1.png`,url:''},
  121. {name:'会员权益',icon:`${this.$commonConfig.staticUrl}/img/index-nav-icon-2.png`,url:''},
  122. {name:'线上商城',icon:`${this.$commonConfig.staticUrl}/img/index-nav-icon-3.png`,url:'/shopping/producTypetList'},
  123. {name:'积分兑换',icon:`${this.$commonConfig.staticUrl}/img/index-nav-icon-4.png`,url:'/credits/credits'},
  124. {name:'酒店预定',icon:`${this.$commonConfig.staticUrl}/img/index-nav-icon-5.png`,url:''},
  125. {name:'月子中心',icon:`${this.$commonConfig.staticUrl}/img/index-nav-icon-6.png`,url:''},
  126. {name:'限时抢购',icon:`${this.$commonConfig.staticUrl}/img/index-nav-icon-7.png`,url:''},
  127. {name:'爆款专区',icon:`${this.$commonConfig.staticUrl}/img/index-nav-icon-8.png`,url:'/shopping/productList',param:{typeId:2,typeName:'爆款专区'}},
  128. ],
  129. xsIntro:{},
  130. shopLatitude:'',
  131. shopLongitude:'',
  132. }
  133. },
  134. computed: {
  135. memberInfoBg() {
  136. return { backgroundImage: `url(${this.staticUrl}/img/index-member-info-bg.png)` }
  137. }
  138. },
  139. onShow() {
  140. // this.$refs.cartfixed.getCartList();
  141. this.getHotGoods();
  142. this.getMemberInfo()
  143. },
  144. onLoad(query) {
  145. const scene = decodeURIComponent(query.scene);
  146. scene&&uni.setStorage({
  147. key:'scene',
  148. data:scene
  149. });
  150. let that = this;
  151. this.swiperList();
  152. setTimeout(()=>{
  153. that.getCenterImg();
  154. },200);
  155. this.getSystemInfo();
  156. this.getIntro();
  157. // console.log('statusBarHeight',this.statusBarHeight);
  158. // console.log('navigationBarHeight',this.navigationBarHeight);
  159. // console.log('windowHeight',this.windowHeight);
  160. // console.log('navHeight',this.navHeight);
  161. },
  162. methods: {
  163. getIntro(){
  164. this.$u.api.xsGetIntro().then(res=>{
  165. this.xsIntro = res.data;
  166. // this.shopLatitude = res.data.shopLatitude;
  167. // this.shopLongitude = res.data.shopLongitude;
  168. // console.log('res',res);
  169. }).catch(err=>{
  170. console.log('xsGetIntro',err.data);
  171. })
  172. },
  173. goMap(){
  174. uni.openLocation({
  175. latitude:this.xsIntro.shopLatitude, //维度
  176. longitude: this.xsIntro.shopLongitude, //经度
  177. name: "商行地址", //目的地定位名称
  178. scale: 15, //缩放比例
  179. address: this.xsIntro.shopAddress //导航详细地址
  180. })
  181. },
  182. getMemberInfo(){
  183. this.$u.api.memberInfo({id:this.vuex_member_info.id}).then(res=>{
  184. this.memberInfo = res.data;
  185. this.avatar = res.data.avatar;
  186. this.$u.vuex('vuex_member_info', res.data);
  187. // console.log('memberInfo',this.memberInfo);
  188. }).catch(err=>{
  189. console.log('memberInfo',err.data);
  190. })
  191. },
  192. swiperList(){
  193. this.$u.api.swiperList({postion:1}).then(res=>{
  194. this.bannerList = res.data.rows;
  195. // console.log('res',res.data.rows);
  196. }).catch(err=>{
  197. console.log('swiperList',err.data);
  198. })
  199. },
  200. getCenterImg(){
  201. this.$u.api.swiperList({postion:2}).then(res=>{
  202. this.centerImg = res.data.rows;
  203. // console.log('res',res.data.rows);
  204. }).catch(err=>{
  205. console.log('swiperList',err.data);
  206. })
  207. },
  208. bannerClick(e){
  209. // console.log('e',e);
  210. // console.log('bannerClick',this.bannerList[e]);
  211. let item = this.bannerList[e];
  212. uni.$u.route('/xushuo/dynamicdetails', {
  213. type: 'swiperDetail',
  214. id: item.id
  215. });
  216. },
  217. centerImgClick(e){
  218. let item = this.centerImg[e];
  219. uni.$u.route('/xushuo/dynamicdetails', {
  220. type: 'swiperDetail',
  221. id: item.id
  222. });
  223. },
  224. indexNavClick(item){
  225. if(item.url){
  226. uni.$u.route(item.url,item.param );
  227. }else{
  228. uni.$u.toast('开发中,请等待')
  229. }
  230. // if(item.param){
  231. // uni.$u.route(item.url,item.param );
  232. // }
  233. },
  234. getHotGoods(){
  235. this.$u.api.topGoodList({pageNum:1,pageSize:20}).then(res=>{
  236. this.hotGoods = res.data.rows;
  237. console.log('res',res);
  238. }).catch(err=>{
  239. console.log('getHotGoods',err.data);
  240. })
  241. },
  242. }
  243. }
  244. </script>
  245. <style>
  246. page{
  247. padding-bottom: 40rpx;
  248. }
  249. </style>
  250. <style lang="scss" scoped>
  251. .swiper-wrap{
  252. position: absolute;
  253. left: 0;
  254. top: 0;
  255. width: 100%;
  256. z-index: 10;
  257. }
  258. .page-wrap{
  259. position: relative;
  260. z-index: 20;
  261. background-color: #fff;
  262. }
  263. .member-info{
  264. box-sizing: border-box;
  265. height: 136rpx;
  266. background: linear-gradient(270deg, #EACCA8 0%, #D6986B 100%);
  267. background-size: contain;
  268. background-repeat: no-repeat;
  269. border-radius: 8rpx 8rpx 0rpx 0rpx;
  270. padding: 24rpx;
  271. margin-bottom: 60rpx;
  272. color: #fff;
  273. font-size: 34rpx;
  274. .text{
  275. margin-left: 20rpx;
  276. .name{
  277. font-weight: 600;
  278. color: rgba(255,255,255,0.99);
  279. // line-height: 48rpx;
  280. // margin-bottom: 8rpx;
  281. }
  282. .level-name{
  283. font-size: 22rpx;
  284. font-weight: 400;
  285. // line-height: 30rpx;
  286. }
  287. }
  288. .right{
  289. .credit-text{
  290. font-size: 26rpx;
  291. font-weight: 400;
  292. color: rgba(255,255,255,0.99);
  293. margin-right: 16rpx;
  294. }
  295. .num{
  296. font-weight: 600;
  297. }
  298. }
  299. }
  300. .index-nav{
  301. padding: 0 32rpx;
  302. text-align: center;
  303. margin-bottom: 60rpx;
  304. .nav-item{
  305. width: 25%;
  306. margin-bottom: 30rpx;
  307. .image{
  308. margin-left: auto;
  309. width: 80rpx;
  310. height: 80rpx;
  311. }
  312. .name{
  313. font-size: 26rpx;
  314. font-weight: 400;
  315. color: #666666;
  316. line-height: 37rpx;
  317. }
  318. }
  319. }
  320. .index-img{
  321. margin-bottom: 60rpx;
  322. }
  323. .goMap{
  324. position: absolute;
  325. z-index: 31;
  326. padding: 20rpx;
  327. .image{
  328. width: 34rpx;
  329. height: 35rpx;
  330. }
  331. .text{
  332. font-size: 30rpx;
  333. font-weight: 400;
  334. color: #FFFFFF;
  335. margin-left: 12rpx;
  336. }
  337. }
  338. </style>