index.vue 9.8 KB

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