123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482 |
- <template>
- <view class="content">
- <!-- <view class="search flex">
- <view class="input-box flex" @click.stop="clickSearch">
- <view class=" input-content flex">
- <view class="iconfont iconsearch"></view>
- <view class="input"><input type="text" placeholder="请输入店铺名称" v-model="name" /></view>
- </view>
- </view>
- <view class="search-btn" @click="search()">
- 搜索
- </view>
- </view> -->
- <scroll-view scroll-y="true" :style="{'height': height}" class="shop-list-wrap" @scrolltolower="getStoreList()">
- <!-- 空白页 -->
- <!-- <empty v-if="loaded === true && shopList.length === 0"></empty> -->
- <view class="djq-wrap flex f-ai-s" v-for="item in shopList"
- @click="navTo('/pages/shop/shopDetail?id=' + item.id)">
- <image :src="item.image" mode="" class="djq-img"></image>
- <view class="djq-right pl20">
- <view class="djq-tit flex f-j-sb f-ai-s">
- <view class="djq-name clamp">
- {{item.name}}
- </view>
- <view class="djq-dis">
- <!-- <image src="../../static/icon/dw.png" mode=""></image> -->
- <!-- 距离{{item.range*1}}KM -->
- </view>
- </view>
- <view class="flex f-d-c f-j-sb f-ai-s fg1" style="height: 110rpx;">
- <view class="djq-dz clamp2">
- {{item.detailed_address}}
- </view>
- <view class="djq-hd flex f-j-sb">
- <view class="buy-info">
- <!-- {{item.count}}人已购买 -->
- </view>
- <view class="hd-btn">
- <image src="../../static/icon/call.png" mode="" style="margin-right: 15rpx;"
- @click.stop="makeCall(item.phone)"></image>
- <image src="../../static/icon/dh.png" mode=""
- @click.stop="toGaodeMap(item)"></image>
- </view>
- </view>
- </view>
- <view class="" style="padding: 10rpx 0 0 0;">
- <view class="left-btm flex f-j-s" v-for="itemt in item.coupon">
- <view class="j-logo">
- 券
- </view>
- <view class="j-price">
- <text>¥</text>{{itemt.price}}
- </view>
- <view class="j-zk">
- {{(((itemt.price*10)/(itemt.ot_price*1)).toFixed(1))}}折
- </view>
- <view class="j-name">
- {{itemt.store_name}}
- </view>
- </view>
- </view>
- </view>
- </view>
- <uni-load-more :status="loadingType"></uni-load-more>
- </scroll-view>
- </view>
- </template>
- <script>
- // import empty from '@/uview-ui/components/u-empty/u-empty.vue';
- // #ifdef H5
- import {
- weixindata,
- shareLoad
- } from '@/utils/wxAuthorized';
- // #endif
- import {
- mapState,
- mapMutations
- } from 'vuex';
- import {
- getStoreList
- } from '@/api/index.js'
- import {
- Cookie
- } from 'tough-cookie';
- export default {
- // components: {
- // empty
- // },
- data() {
- return {
- page: 1,
- limit: 10,
- shopList: [],
- name: '',
- height: '',
- loadingType: 'more',
- loaded: false,
- latitude: '',
- longitude: '',
- current_address: ''
- }
- },
- computed: {
- ...mapState(['loginInterceptor', 'baseURL']),
- },
- onLoad(opt) {
- let that = this
- console.log('获取经纬度')
- uni.getLocation({
- geocode: true,
- complete(res) {
- console.log(res)
- that.latitude = res.latitude
- that.longitude = res.longitude
- that.current_address = res.address.province + res.address.city + res.address.district + res
- .address.street + res.address.streetNum + res.address.poiName;
- },
- fail() {
- }
- })
- that.getStoreList()
- },
- onShow() {
- },
- onReachBottom() {
- },
- onReady() {
- var obj = this;
- uni.getSystemInfo({
- success: resu => {
- const query = uni.createSelectorQuery();
- query.select('.shop-list-wrap').boundingClientRect();
- query.exec(function(res) {
- obj.height = resu.windowHeight - res[0].top + 'px';
- });
- },
- fail: res => {}
- });
- },
- methods: {
- navTo(url) {
- uni.navigateTo({
- url,
- fail() {
- uni.switchTab({
- url
- })
- }
- })
- },
- search() {
- let obj = this
- obj.shopList = []
- obj.loadingType = 'more'
- obj.page = 1
- obj.getStoreList()
- },
- // 拨打电话
- makeCall(phone) {
- uni.makePhoneCall({
- phoneNumber: phone //仅为示例
- });
- },
- // 导航
- dh(item) {
- // #ifdef H5
- weixindata().then(wxOjb => {
- console.log(wxOjb, '获取微信');
- wxOjb.openLocation({
- latitude: item.latitude, // 纬度,浮点数,范围为90 ~ -90
- longitude: item.longitude, // 经度,浮点数,范围为180 ~ -180。
- name: item.name, // 位置名
- address: item.detailed_address, // 地址详情说明
- scale: 28, // 地图缩放级别,整型值,范围从1~28。默认为最大
- infoUrl: '' // 在查看位置界面底部显示的超链接,可点击跳转
- });
- });
- // #endif
- },
- getStoreList() {
- let obj = this
- if (obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
- return
- }
- obj.loadingType = 'loading'
- console.log('开始')
- getStoreList({
- name: obj.name,
- latitude: obj.latitude,
- longitude: obj.longitude,
- page: obj.page,
- limit: obj.limit
- }).then(res => {
- console.log(res)
- obj.shopList = obj.shopList.concat(res.data.list)
- obj.page++
- if (obj.limit == res.data.list.length) {
- obj.loadingType = 'more'
- } else {
- obj.loadingType = 'noMore'
- }
- obj.loaded = true
- }).catch(err => {
- console.log(err)
- })
- },
- // 调用高德
- toGaodeMap(item) {
- // #ifdef H5
- // console.log('选择高德', latitude, longitude, address);
- window.location.href = `https://uri.amap.com/marker?position=${item.longitude},${item.latitude}&name=${item.address}`;
- return
- // #endif
- uni.openLocation({
- latitude:+item.latitude,
- longitude:+item.longitude,
- name:item.name,
- address:item.detailed_address,
- fail(e){
- console.log(e,'连接失败');
- }
- })
- },
- }
- }
- </script>
- <style lang="scss">
- .search-top {
- // position: fixed;
- // top: 0;
- // z-index: 99;
- }
- .shop {
- // margin-top: 20rpx;
- background: #ffffff;
- padding: 0 12rpx;
- .shop-title {
- padding: 30rpx 0 20rpx;
- display: flex;
- align-items: center;
- border-bottom: 1px solid #e3e6e7;
- .shop-item {
- width: 33%;
- display: flex;
- align-items: center;
- justify-content: center;
- .sitem-font {
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #333333;
- }
- .jt-down {
- width: 10rpx;
- height: 8rpx;
- margin-left: 12rpx;
- }
- }
- }
- }
- .shop-list-wrap {
- // background-color: red;
- padding-top: 20rpx;
- }
- .djq-wrap {
- width: 701rpx;
- // height: 255rpx;
- background: #FFFFFF;
- box-shadow: 0px 0px 27rpx 0px rgba(50, 50, 52, 0.06);
- border-radius: 20rpx;
- margin: 0 auto 20rpx;
- padding: 23rpx 22rpx;
- &:last-of-type {
- margin-bottom: 0;
- }
- .djq-img {
- flex-shrink: 0;
- width: 150rpx;
- height: 150rpx;
- border-radius: 10rpx;
- }
- .djq-right {
- padding-left: 15rpx;
- flex-grow: 1;
- .djq-tit {
- font-size: 34rpx;
- font-weight: bold;
- color: #333333;
- line-height: 52rpx;
- .djq-name {
- max-width: 300rpx;
- }
- .djq-dis {
- flex-shrink: 0;
- image {
- width: 20rpx;
- height: 28rpx;
- margin-right: 10rpx;
- }
- font-size: 22rpx;
- font-weight: 500;
- color: #666666;
- }
- }
- .djq-dz {
- width: 100%;
- font-size: 24rpx;
- font-weight: 500;
- color: #666666;
- }
- .djq-hd {
- width: 100%;
- .buy-info {
- display: inline-block;
- height: 32rpx;
- border-radius: 16rpx 16rpx 16rpx 0px;
- line-height: 32rpx;
- font-size: 20rpx;
- font-weight: 500;
- color: #FF440D;
- padding: 0 15rpx;
- background-color: #fff;
- }
- .hd-btn {
- image {
- width: 46rpx;
- height: 46rpx;
- }
- }
- }
- }
- }
- .left-btm {
- height: 50rpx;
- .j-logo {
- width: 32rpx;
- line-height: 33rpx;
- background: linear-gradient(-48deg, #FFA30B, #FFD158);
- border-radius: 13rpx;
- font-size: 21rpx;
- font-weight: 500;
- color: #FFFFFF;
- text-align: center;
- }
- .j-price {
- font-size: 27rpx;
- font-weight: bold;
- color: #FF4C4C;
- margin: 0 10rpx 0 5rpx;
- }
- .j-zk {
- height: 31rpx;
- border: 1rpx solid #FF4C4C;
- border-radius: 7rpx;
- line-height: 31rpx;
- padding: 0 8rpx;
- font-size: 20rpx;
- font-weight: bold;
- color: #FF4C4C;
- margin-right: 5rpx;
- }
- .j-name {
- font-size: 23rpx;
- font-weight: bold;
- color: #333333;
- }
- }
- .search {
- justify-content: flex-start;
- padding: 10rpx 32rpx 20rpx;
- align-items: center;
- background-color: #fff;
- .search-btn {
- display: inline-block;
- // flex-grow: ;
- flex-shrink: 0;
- padding: 0 0 0 20rpx;
- font-size: 32rpx;
- color: #FF4C4C;
- z-index: 99;
- }
- .address {
- width: 32rpx;
- height: 38rpx;
- }
- .shop-name {
- height: 38rpx;
- position: relative;
- top: -4rpx;
- z-index: 100;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: 500;
- padding-left: 10rpx;
- }
- .shop-jt {
- margin-left: 8rpx;
- width: 16rpx;
- height: 10rpx;
- }
- .input-box {
- margin-left: 10rpx;
- position: relative;
- z-index: 99;
- width: 710rpx;
- height: 60rpx;
- background: #EEEEEE;
- border-radius: 30rpx;
- .input-content {
- position: relative;
- z-index: 11;
- border-radius: 99rpx;
- flex-grow: 1;
- padding: 5rpx 30rpx;
- background: #EEEEEE;
- .iconsearch {
- font-size: 50rpx;
- color: #CBCBCB;
- }
- .input {
- margin-left: 19rpx;
- flex-grow: 1;
- input {
- font-size: 28rpx;
- color: #000;
- }
- }
- }
- .input-button {
- padding-left: 20rpx;
- font-size: $font-base;
- height: 100%;
- }
- }
- }
- </style>
|