xiaohaizhao 1 年之前
父節點
當前提交
5b9f51b984
共有 4 個文件被更改,包括 276 次插入74 次删除
  1. 265 4
      pages/index/index/index.vue
  2. 6 2
      pages/index/index/modules/apps.vue
  3. 5 0
      pages/login/modules/otherLogin.vue
  4. 0 68
      pages/shop/homeShop.vue

+ 265 - 4
pages/index/index/index.vue

@@ -1,8 +1,53 @@
 <template>
     <view>
-        <homeShop />
+        <view @click="showShopOtions = true" class="head-shop" v-if="shopDetail.storename" hover-class="navigator-hover">
+            <view class="head-shop-name">
+                {{ shopDetail.storename }} <text class="iconfont icon-a-wodetiaozhuan" />
+            </view>
+            <view class="head-shop-distance">
+                距您{{ shopDetail.distance }}
+            </view>
+        </view>
+
         <slideshow ref="indexTop" />
         <apps @appsToPage="appsToPage" />
+
+        <view class="shop" v-if="shopDetail.storename">
+            <view class="head">
+                <view class="text">
+                    当前服务导购
+                </view>
+                <view class="icons">
+                    <view class="icon-box" hover-class="navigator-hover" @click="goAtOnce">
+                        <text class="iconfont icon-dizhi-hui" />
+                    </view>
+                    <view v-if="shopDetail.phonenumber" class="icon-box" hover-class="navigator-hover"
+                        @click="callPhone(shopDetail.phonenumber)">
+                        <text class="iconfont icon-dianhua" />
+                    </view>
+                </view>
+            </view>
+            <view class="user">
+                <view class="headpic">
+                    <image v-if="shopDetail.headpic" class="image" :src="shopDetail.headpic" mode="aspectFill" lazy-load />
+                    <image v-else class="image"
+                        src="https://yossys06593.obs.cn-east-3.myhuaweicloud.com:443/202404231713854678447B26b4363.svg"
+                        mode="aspectFill" lazy-load />
+                </view>
+                <view class="introduce">
+                    <view class="name u-line-1">
+                        {{ shopDetail.name || '--' }}
+                    </view>
+                    <view class="shop-name u-line-1">
+                        {{ shopDetail.storename || '--' }}
+                    </view>
+                </view>
+            </view>
+            <view class="bottom">
+                <text class="iconfont icon-dizhi-hui" /> {{ getCity(shopDetail) }}
+            </view>
+        </view>
+
         <slideshow ref="indexBottom" />
         <floatBut isSlot>
             <contact>
@@ -15,15 +60,35 @@
             </contact>
         </floatBut>
         <view style="height: 80px;" />
+        <u-popup :show="showShopOtions" :round="8" @close="showShopOtions = false">
+            <view class="popup-box">
+                <view class="popup-row" style="color: #666666;font-size: 14px;">
+                    门店定位
+                </view>
+                <view class="popup-row" @click="showShopOtions = false" hover-class="navigator-hover"
+                    style="color: #C30D23;">
+                    {{ shopDetail.storename }}
+                </view>
+                <navigator @click="changeShop" class="popup-row" url="/packageA/shop/history" hover-class="navigator-hover"
+                    open-type="navigate">
+                    历史足迹
+                </navigator>
+                <view class="popup-row" hover-class="navigator-hover" @click="getLocaT">
+                    <u-loading-icon v-if="getLocationLoading" />
+                    <text v-else>
+                        重新定位
+                    </text>
+                </view>
+            </view>
+        </u-popup>
     </view>
 </template>
 
 <script>
-import homeShop from "../../shop/homeShop.vue"
 import contact from "../../../components/contact"
 import apps from "./modules/apps"
 export default {
-    components: { homeShop, contact, apps },
+    components: { contact, apps },
     props: {
         changePage: {
             type: Function
@@ -32,23 +97,202 @@ export default {
     data() {
         return {
             updatePage: true,
+            shopDetail: {
+                storename: "",
+                distance: ""
+            },
+            showShopOtions: false,
+            getLocationLoading: true,
         }
     },
     methods: {
         init(callBack) {
-            Promise.all([this.$refs.indexTop.getBanners(['indexTop']), this.$refs.indexBottom.getBanners(['indexBottom'])]).then(res => {
+            Promise.all([this.getLocaT(), this.$refs.indexTop.getBanners(['indexTop']), this.$refs.indexBottom.getBanners(['indexBottom'])]).then(res => {
                 callBack()
                 this.updatePage = false;
             })
         },
         appsToPage(id, name, params) {
             this.$emit("changePage", id, name, params)
+        },
+        getLocaT() {
+            return new Promise((resolve, reject) => {
+                this.getLocationLoading = true;
+                this.getLocation().then(s => {
+                    console.log("获取地理位置信息", s)
+                    resolve()
+                    this.$Http.basic({
+                        "id": 20240416153202,
+                        "content": {
+                            "longitude": s.longitude,
+                            "latitude": s.latitude
+                        }
+                    }).then(res => {
+                        this.getLocationLoading = false;
+                        this.showShopOtions = false;
+                        console.log("获取最近门店信息", res)
+                        if (this.cutoff(res.msg)) return;
+                        res.data.distance = res.data.distance > 1000 ? ((res.data.distance / 1000).toFixed(2) - 0) + 'km' : ((res.data.distance).toFixed(2) - 0) + 'm'
+                        this.shopDetail = res.data;
+                    })
+                })
+            })
+        },
+        callPhone(phoneNumber) {
+            uni.makePhoneCall({
+                phoneNumber: phoneNumber + ''
+            })
+        },
+        goAtOnce() {
+            uni.openLocation({
+                latitude: this.shopDetail.latitude - 0,
+                longitude: this.shopDetail.longitude - 0,
+                address: this.shopDetail.address,
+                name: this.shopDetail.storename,
+                success: function () {
+                    console.log('success');
+                },
+                fail: (fail) => {
+                    console.log('fail', fail)
+                },
+            });
+        },
+        changeShop() {
+            this.showShopOtions = false;
+            this.$Http.changeShop = item => {
+                this.shopDetail = item;
+                uni.navigateBack({})
+                uni.showToast({
+                    title: "切换门店成功",
+                    icon: "none",
+                    duration: 2000,
+                })
+            }
         }
     },
 }
 </script>
 
 <style lang="scss" scoped>
+.head-shop {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    width: 100vw;
+    height: 45px;
+    background: #F7F7F7;
+    padding: 0 10px;
+    box-sizing: border-box;
+
+    &-name {
+        font-family: PingFang SC, PingFang SC;
+        font-size: 14px;
+        color: #333333;
+    }
+
+    &-distance {
+        font-family: PingFang SC, PingFang SC;
+        font-size: 12px;
+        color: #666666;
+    }
+
+}
+
+.shop {
+    padding: 10px;
+    width: 355px;
+    background: #FFFFFF;
+    border-radius: 8px;
+    box-sizing: border-box;
+    margin: 0 auto 10px;
+
+    .head {
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        height: 32px;
+
+        .text {
+            font-family: Source Han Sans SC, Source Han Sans SC;
+            font-weight: bold;
+            font-size: 14px;
+            color: #333333;
+        }
+
+        .icons {
+            display: flex;
+
+            .icon-box {
+                width: 32px;
+                height: 32px;
+                background: #F2F2F2;
+                text-align: center;
+                line-height: 32px;
+                margin-left: 10px;
+                border-radius: 50%;
+
+                .iconfont {
+                    font-size: 14px;
+                    color: #666666;
+                }
+            }
+        }
+    }
+
+
+    .user {
+        display: flex;
+        margin-top: 8px;
+
+        .headpic {
+            width: 44px;
+            height: 44px;
+
+            .image {
+                width: 44px;
+                height: 44px;
+                border-radius: 50%;
+            }
+        }
+
+        .introduce {
+            margin-left: 10px;
+
+            .name {
+                line-height: 20px;
+                font-family: Source Han Sans SC, Source Han Sans SC;
+                font-weight: bold;
+                font-size: 14px;
+                color: #333333;
+            }
+
+            .shop-name {
+                line-height: 17px;
+                font-family: Source Han Sans SC, Source Han Sans SC;
+                font-size: 12px;
+                color: #999999;
+                margin-top: 4px;
+            }
+        }
+    }
+
+    .bottom {
+        width: 100%;
+        height: 24px;
+        box-sizing: border-box;
+        padding-top: 7px;
+        border-top: 1px solid #DDDDDD;
+        font-family: Source Han Sans SC, Source Han Sans SC;
+        font-size: 12px;
+        color: #999999;
+        margin-top: 15px;
+
+        .iconfont {
+            margin-right: 5px;
+        }
+    }
+}
+
 .contact {
     background: #EDD27E;
     width: 50px;
@@ -71,4 +315,21 @@ export default {
         line-height: 17px;
     }
 }
+
+.popup-box {
+    border-radius: 8px 8px 0 0;
+    overflow: hidden;
+
+    .popup-row {
+        width: 100vw;
+        height: 50px;
+        line-height: 50px;
+        text-align: center;
+        background: #FFFFFF;
+        box-shadow: inset 0px -1px 0px 1px #DDDDDD;
+        font-family: Source Han Sans SC, Source Han Sans SC;
+        font-size: 16px;
+        color: #333333;
+    }
+}
 </style>

+ 6 - 2
pages/index/index/modules/apps.vue

@@ -56,11 +56,11 @@ export default {
             }, {
                 label: "6C红人服务",
                 introduce: "装修报价 / 老房改造 / 精装房焕新\n品质服务",
-                path: "/packageA/advertising/shareable?id=465"
+                path: "/packageA/advertising/unshareable?id=505"
             }, {
                 label: "免费设计",
                 introduce: "0元领取全屋顶墙设计方案\n免费量尺寸 / 免费设计",
-                path: "/packageA/advertising/shareable?id=147"
+                path: "/packageA/advertising/shareable?id=505"
             }, {
                 label: "视频",
                 introduce: "品牌 / 产品 / 安装 / 服务等视频",
@@ -77,6 +77,10 @@ export default {
     methods: {
         onClick(item) {
             if (item.itemId) {
+                uni.pageScrollTo({
+                    scrollTop: 0,
+                    duration: 0,
+                })
                 this.$emit("appsToPage", item.itemId, item.page || item.label, item.params || '')
             } else if (item.path) {
                 uni.navigateTo({

+ 5 - 0
pages/login/modules/otherLogin.vue

@@ -48,6 +48,11 @@ export default {
             let that = this;
             uni.login({
                 success(res) {
+                    console.log(res)
+                    return uni.setClipboardData({
+                        data: res.code,
+                        showToast: true,
+                    });
                     that.$Http.loginbywechat({
                         wechat_code: res.code,
                         "systemclient": "marketingtool"

+ 0 - 68
pages/shop/homeShop.vue

@@ -1,68 +0,0 @@
-<template>
-    <view class="shop" v-if="detail.storename">
-        <view class="shop-name">
-            {{ detail.storename }} <text class="iconfont icon-a-wodetiaozhuan" />
-        </view>
-        <view class="shop-distance">
-            距您{{ detail.distance }}
-        </view>
-    </view>
-</template>
-
-<script>
-export default {
-    name: "homeShop",
-    data() {
-        return {
-            detail: {
-                storename: "",
-                distance: ""
-            }
-        }
-    },
-    created() {
-        this.getLocation().then(s => {
-            console.log("获取地理位置信息", s)
-            this.$Http.basic({
-                "id": 20240416153202,
-                "content": {
-                    "longitude": s.longitude,
-                    "latitude": s.latitude
-                }
-            }).then(res => {
-                console.log("获取最近门店信息", res)
-                if (this.cutoff(res.msg)) return;
-                res.data.distance = res.data.distance > 1000 ? ((res.data.distance / 1000).toFixed(2) - 0) + 'km' : ((res.data.distance).toFixed(2) - 0) + 'm'
-                this.detail = res.data;
-            })
-        })
-    },
-
-}
-</script>
-
-<style lang="scss" scoped>
-.shop {
-    display: flex;
-    align-items: center;
-    justify-content: space-between;
-    width: 100vw;
-    height: 45px;
-    background: #F7F7F7;
-    padding: 0 10px;
-    box-sizing: border-box;
-
-    &-name {
-        font-family: PingFang SC, PingFang SC;
-        font-size: 14px;
-        color: #333333;
-    }
-
-    &-distance {
-        font-family: PingFang SC, PingFang SC;
-        font-size: 12px;
-        color: #666666;
-    }
-
-}
-</style>