index.vue 9.9 KB

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