Ver Fonte

历史足迹

xiaohaizhao há 1 ano atrás
pai
commit
486c5f629b
1 ficheiros alterados com 147 adições e 0 exclusões
  1. 147 0
      packageA/shop/history.vue

+ 147 - 0
packageA/shop/history.vue

@@ -0,0 +1,147 @@
+<template>
+    <view>
+        <My_listbox ref="List" @getlist="getList">
+            <view class="item" @click="changeShop(index)" v-for="(item, index) in list" :key="item.sa_storeid"
+                hover-class="navigator-hover">
+                <image class="logo" :src="logo" />
+                <view class="content">
+                    <view class="label u-line-1">
+                        {{ item.storename }}
+                    </view>
+                    <view class="icons">
+                        <view class="icon-box" hover-class="navigator-hover" @click.stop="goAtOnce(item)">
+                            <text class="iconfont icon-dizhi-hui" />
+                        </view>
+                        <view v-if="item.phonenumber" class="icon-box" hover-class="navigator-hover"
+                            @click.stop="callPhone(item.phonenumber)">
+                            <text class="iconfont icon-dianhua" />
+                        </view>
+                    </view>
+                </view>
+            </view>
+        </My_listbox>
+    </view>
+</template>
+
+<script>
+export default {
+    data() {
+        return {
+            "content": {
+                "pageNumber": 1,
+                "pageSize": 20
+            },
+            list: [],
+            logo: uni.getStorageSync('site').logo
+        }
+    }, onLoad(options) {
+        this.getList(true)
+        uni.setNavigationBarTitle({
+            title: '历史足迹',
+        })
+    },
+    methods: {
+        async getList(init = false) {
+            if (this.paging(this.content, init)) return;
+            if (init) {
+                let s = await this.getLocation();
+                this.content.longitude = s.longitude;
+                this.content.latitude = s.latitude;
+            }
+            this.$Http.basic({
+                "id": 20240416162002,
+                content: this.content
+            }).then(res => {
+                this.$refs.List.RefreshToComplete()
+                console.log("获取历史足迹", res)
+                if (this.cutoff(res.msg)) return;
+                res.data = res.data.map(v => {
+                    v.image = v.attinfos.length ? this.getSpecifiedImage(v.attinfos[0]) : '';
+                    v.distance = v.distance > 1000 ? ((v.distance / 1000).toFixed(2) - 0) + 'km' : ((v.distance).toFixed(2) - 0) + 'm'
+                    return v
+                })
+                this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
+                this.content = this.$refs.List.paging(this.content, res)
+            })
+        },
+        callPhone(phoneNumber) {
+            uni.makePhoneCall({
+                phoneNumber: phoneNumber + ''
+            })
+        },
+        goAtOnce(item) {
+            uni.openLocation({
+                latitude: item.latitude - 0,
+                longitude: item.longitude - 0,
+                address: item.address,
+                name: item.storename,
+                success: function () {
+                    console.log('success');
+                },
+                fail: (fail) => {
+                    console.log('fail', fail)
+                },
+            });
+        },
+        changeShop(index) {
+            this.$Http.changeShop && this.$Http.changeShop(this.list[index]);
+        }
+    },
+    onUnload() {
+        delete this.$Http.changeShop
+    }
+}
+</script>
+
+<style lang="scss">
+.item {
+    display: flex;
+    width: 100vw;
+    height: 84px;
+    background: #FFFFFF;
+    margin-top: 10px;
+    padding: 10px;
+    box-sizing: border-box;
+
+    .logo {
+        width: 64px;
+        height: 64px;
+        background: #FFFFFF;
+        border-radius: 5px;
+        border: 1px solid #CCCCCC;
+        box-sizing: border-box;
+    }
+
+    .content {
+        margin-left: 26px;
+
+        .label {
+            line-height: 20px;
+            font-family: Source Han Sans SC, Source Han Sans SC;
+            font-weight: bold;
+            font-size: 14px;
+            color: #333333;
+        }
+
+        .icons {
+            display: flex;
+            margin-top: 12px;
+
+            .icon-box {
+                width: 32px;
+                height: 32px;
+                background: #F2F2F2;
+                text-align: center;
+                line-height: 32px;
+                margin-right: 10px;
+                border-radius: 50%;
+
+                .iconfont {
+                    font-size: 14px;
+                    color: #666666;
+                }
+            }
+        }
+    }
+}
+</style>