|
|
@ -1,19 +1,15 @@ |
|
|
|
|
|
|
|
|
<template> |
|
|
<template> |
|
|
<div class="home"> |
|
|
<div class="home"> |
|
|
<!--<input type="hidden" id="openedDistrict" th:value="${openedDistrict}"/>--> |
|
|
|
|
|
<input type="hidden" id="merchantNo" th:value="${merchantNo}"/> <!--商户标号--> |
|
|
|
|
|
<input type="hidden" id="districtId" th:value="${districtId}"/> <!--选定区县id--> |
|
|
|
|
|
<div class="page-top"> |
|
|
|
|
|
|
|
|
<div ref="test" class="page-top"> |
|
|
<i class="position" @click="show = true"><img src="../assets/images/icon/position.png"/>{{defaultCity}}</i> |
|
|
<i class="position" @click="show = true"><img src="../assets/images/icon/position.png"/>{{defaultCity}}</i> |
|
|
<i class="logo"><img src="../assets/images/icon/logo.png" /></i> |
|
|
<i class="logo"><img src="../assets/images/icon/logo.png" /></i> |
|
|
<i class="text"><a href="tel:400-6080100">联系客服</a></i> |
|
|
<i class="text"><a href="tel:400-6080100">联系客服</a></i> |
|
|
</div> |
|
|
</div> |
|
|
<div class="page-content"> |
|
|
<div class="page-content"> |
|
|
<div class="banner"> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="banner" v-if="bannerImgList.length > 0"> |
|
|
<swiper :options="swiperOption"> |
|
|
<swiper :options="swiperOption"> |
|
|
<swiper-slide v-for="(item,index) in bannerImgList" v-if="bannerImgList.length > 0" :key="index"> |
|
|
|
|
|
|
|
|
<swiper-slide v-for="(item,index) in bannerImgList" :key="index"> |
|
|
<div class="swiper-img" :style="{backgroundImage:'url('+item.imgUrl+')'}"></div> |
|
|
<div class="swiper-img" :style="{backgroundImage:'url('+item.imgUrl+')'}"></div> |
|
|
<!--<img src="../../dist/static/img/slider-img.21dc32f.png"/>--> |
|
|
<!--<img src="../../dist/static/img/slider-img.21dc32f.png"/>--> |
|
|
</swiper-slide> |
|
|
</swiper-slide> |
|
|
@ -24,8 +20,8 @@ |
|
|
</swiper> |
|
|
</swiper> |
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
|
<div class="coupon" > |
|
|
|
|
|
<a v-if="promotionImgList != {}" :href="promotionImgList.linkUrl || ''"><img :src="promotionImgList.imgUrl"/></a> |
|
|
|
|
|
|
|
|
<div class="coupon" v-if="promotionImgList == {}"> |
|
|
|
|
|
<a :href="promotionImgList.linkUrl || ''"><img :src="promotionImgList.imgUrl"/></a> |
|
|
</div> |
|
|
</div> |
|
|
<div class="new-card" v-for="item in goodsList"> |
|
|
<div class="new-card" v-for="item in goodsList"> |
|
|
<div class="new-card-top"> |
|
|
<div class="new-card-top"> |
|
|
@ -52,6 +48,10 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="page-bottom"> |
|
|
|
|
|
<routerFooter></routerFooter> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<popup v-model="show"> |
|
|
<popup v-model="show"> |
|
|
<div class="picke-address"> |
|
|
<div class="picke-address"> |
|
|
<div class="status-btn"> |
|
|
<div class="status-btn"> |
|
|
@ -68,11 +68,14 @@ |
|
|
import homeApi from "../models/home-model.js"; |
|
|
import homeApi from "../models/home-model.js"; |
|
|
import Swiper from '@/common/swiper'; |
|
|
import Swiper from '@/common/swiper'; |
|
|
import { Alert, Toast,Popup,Picker } from "vux"; |
|
|
import { Alert, Toast,Popup,Picker } from "vux"; |
|
|
|
|
|
import routerFooter from "../components/nav-bottom"; |
|
|
export default { |
|
|
export default { |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
show: false, |
|
|
show: false, |
|
|
defaultCity: '天河区', |
|
|
defaultCity: '天河区', |
|
|
|
|
|
merchantNo: '', //商户编号 |
|
|
|
|
|
districtId: '', //区id |
|
|
addressData: [], |
|
|
addressData: [], |
|
|
addressValue: [], |
|
|
addressValue: [], |
|
|
bannerImgList:[], //轮播图 |
|
|
bannerImgList:[], //轮播图 |
|
|
@ -88,17 +91,17 @@ |
|
|
components: { |
|
|
components: { |
|
|
Toast, |
|
|
Toast, |
|
|
Popup, |
|
|
Popup, |
|
|
Picker |
|
|
|
|
|
|
|
|
Picker, |
|
|
|
|
|
routerFooter |
|
|
}, |
|
|
}, |
|
|
watch: { |
|
|
watch: { |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
getName (){ |
|
|
getName (){ |
|
|
let arr = this.addressValue[2].split('&') |
|
|
|
|
|
console.log(arr) |
|
|
|
|
|
$("#districtId").val(arr[0]) |
|
|
|
|
|
$("#merchantNo").val(arr[2]) |
|
|
|
|
|
|
|
|
let arr = this.addressValue[2].split('&') || '' |
|
|
|
|
|
this.districtId = arr[0] |
|
|
|
|
|
this.merchantNo = arr[2] |
|
|
this.getGoodsList() |
|
|
this.getGoodsList() |
|
|
this.defaultCity = arr[1] |
|
|
this.defaultCity = arr[1] |
|
|
this.show = false |
|
|
this.show = false |
|
|
@ -111,16 +114,14 @@ |
|
|
getGoodsList (){ |
|
|
getGoodsList (){ |
|
|
|
|
|
|
|
|
var params = { |
|
|
var params = { |
|
|
"merchantNo": $("#merchantNo").val(), |
|
|
|
|
|
"selectedDistrictId": $("#districtId").val() |
|
|
|
|
|
|
|
|
"merchantNo": this.merchantNo, |
|
|
|
|
|
"selectedDistrictId": this.districtId |
|
|
} |
|
|
} |
|
|
console.log(params) |
|
|
|
|
|
|
|
|
// console.log(params) |
|
|
homeApi.getGoods(params).then(res => { |
|
|
homeApi.getGoods(params).then(res => { |
|
|
//console.log(res) |
|
|
|
|
|
if ( res.code == 0 ){ |
|
|
if ( res.code == 0 ){ |
|
|
this.bannerImgList = res.response.bannerImgList |
|
|
this.bannerImgList = res.response.bannerImgList |
|
|
this.promotionImgList = res.response.promotionImgList[0] || {}; |
|
|
this.promotionImgList = res.response.promotionImgList[0] || {}; |
|
|
// console.log('11',this.promotionImgList) |
|
|
|
|
|
let goodsList = res.response.goodsList |
|
|
let goodsList = res.response.goodsList |
|
|
let arr = []; |
|
|
let arr = []; |
|
|
for(let i=0;i<goodsList.length;i++){ |
|
|
for(let i=0;i<goodsList.length;i++){ |
|
|
@ -166,14 +167,15 @@ |
|
|
}, |
|
|
}, |
|
|
//获取默认地址信息 |
|
|
//获取默认地址信息 |
|
|
getdefaultAddress (){ |
|
|
getdefaultAddress (){ |
|
|
console.log(123) |
|
|
|
|
|
homeApi.getdefaultAddress().then(res => { |
|
|
homeApi.getdefaultAddress().then(res => { |
|
|
//console.log('默认地址信息',res) |
|
|
|
|
|
|
|
|
// console.log('默认地址信息',res) |
|
|
if ( res.code == 0 ){ |
|
|
if ( res.code == 0 ){ |
|
|
if ( !res.data ){ |
|
|
if ( !res.data ){ |
|
|
this.show = true |
|
|
this.show = true |
|
|
} else { |
|
|
} else { |
|
|
this.defaultCity = res.data.districtName |
|
|
|
|
|
|
|
|
this.defaultCity = res.data.districtName || '' |
|
|
|
|
|
this.districtId = res.data.districtId || '' |
|
|
|
|
|
this.merchantNo = res.data.merchantNo || '' |
|
|
this.addressValue = [] |
|
|
this.addressValue = [] |
|
|
this.addressValue.push(res.data.provinceId) |
|
|
this.addressValue.push(res.data.provinceId) |
|
|
this.addressValue.push(res.data.cityId) |
|
|
this.addressValue.push(res.data.cityId) |
|
|
@ -191,7 +193,6 @@ |
|
|
this.getdefaultAddress() |
|
|
this.getdefaultAddress() |
|
|
this.getGoodsList() |
|
|
this.getGoodsList() |
|
|
this.getAddress() |
|
|
this.getAddress() |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
</script> |
|
|
</script> |
|
|
@ -237,12 +238,14 @@ |
|
|
} |
|
|
} |
|
|
.home .page-content { |
|
|
.home .page-content { |
|
|
background:rgba(255,255,255,1); |
|
|
background:rgba(255,255,255,1); |
|
|
|
|
|
padding-bottom: 1rem; |
|
|
} |
|
|
} |
|
|
.home .page-content .banner { |
|
|
.home .page-content .banner { |
|
|
height: 2.56rem; |
|
|
|
|
|
|
|
|
max-height: 2.56rem; |
|
|
|
|
|
margin-bottom: 0.3rem; |
|
|
} |
|
|
} |
|
|
.home .page-content .banner > div { |
|
|
.home .page-content .banner > div { |
|
|
height: 2.56rem; |
|
|
|
|
|
|
|
|
max-height: 2.56rem; |
|
|
} |
|
|
} |
|
|
.home .page-content .banner a { |
|
|
.home .page-content .banner a { |
|
|
display: block; |
|
|
display: block; |
|
|
@ -255,11 +258,11 @@ |
|
|
.swiper-img { |
|
|
.swiper-img { |
|
|
width: 100%; |
|
|
width: 100%; |
|
|
height: 2.56rem; |
|
|
height: 2.56rem; |
|
|
background-size: cover; |
|
|
|
|
|
background-position: center center; |
|
|
|
|
|
|
|
|
background-size: 100% 100%; |
|
|
} |
|
|
} |
|
|
.home .page-content .coupon { |
|
|
.home .page-content .coupon { |
|
|
margin-top: 0.3rem; |
|
|
margin-top: 0.3rem; |
|
|
|
|
|
margin-bottom: 0.4rem; |
|
|
} |
|
|
} |
|
|
.home .page-content .coupon img { |
|
|
.home .page-content .coupon img { |
|
|
width:6.8rem; |
|
|
width:6.8rem; |
|
|
@ -267,10 +270,10 @@ |
|
|
margin: auto; |
|
|
margin: auto; |
|
|
} |
|
|
} |
|
|
.home .page-content .new-card { |
|
|
.home .page-content .new-card { |
|
|
padding-bottom: 0.5rem; |
|
|
|
|
|
|
|
|
/*padding-bottom: 0.5rem;*/ |
|
|
} |
|
|
} |
|
|
.home .page-content .new-card .new-card-top { |
|
|
.home .page-content .new-card .new-card-top { |
|
|
padding: 0.4rem 0 0.3rem; |
|
|
|
|
|
|
|
|
padding: 0rem 0 0.3rem; |
|
|
} |
|
|
} |
|
|
.home .page-content .new-card .new-card-top img { |
|
|
.home .page-content .new-card .new-card-top img { |
|
|
width:7.1rem; |
|
|
width:7.1rem; |
|
|
@ -359,6 +362,13 @@ |
|
|
align-items: center; |
|
|
align-items: center; |
|
|
justify-content: center; |
|
|
justify-content: center; |
|
|
} |
|
|
} |
|
|
|
|
|
.home .page-bottom { |
|
|
|
|
|
width: 100%; |
|
|
|
|
|
height: 1rem; |
|
|
|
|
|
position: fixed; |
|
|
|
|
|
bottom: 0; |
|
|
|
|
|
background:rgba(255,255,255,1); |
|
|
|
|
|
} |
|
|
.picke-address .status-btn { |
|
|
.picke-address .status-btn { |
|
|
display: flex; |
|
|
display: flex; |
|
|
height: 0.8rem; |
|
|
height: 0.8rem; |
|
|
|