From 5b219a9694c8d69db42e746a654c779cc6a61bf6 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期四, 18 七月 2024 18:42:20 +0800
Subject: [PATCH] ‘’
---
wechat_jiaxuan/pages/store/store.js | 68 +++++++++++++++++++++++++++++-----
1 files changed, 58 insertions(+), 10 deletions(-)
diff --git a/wechat_jiaxuan/pages/store/store.js b/wechat_jiaxuan/pages/store/store.js
index cbbe687..f113fa2 100644
--- a/wechat_jiaxuan/pages/store/store.js
+++ b/wechat_jiaxuan/pages/store/store.js
@@ -1,32 +1,80 @@
-// pages/store/store.js
+import {
+ getShopPage
+} from '../../api/index'
+var QQMapWX = require('../../utils/qqmap-wx-jssdk.min');
+var qqmapsdk;
Page({
/**
* 椤甸潰鐨勫垵濮嬫暟鎹�
*/
data: {
-
+ shopList: [],
+ address: '',
+ latitude: '',
+ longitude: '',
},
selAddress() {
console.log('鐐瑰嚮浜�');
wx.chooseLocation({
type: 'wgs84',
- success: (res)=> {
+ success: (res) => {
this.setData({
- city: res.name
+ address: res.address,
+ latitude: res.latitude,
+ longitude: res.longitude,
})
- console.log('res', res);
}
})
},
onLoad(options) {
-
+ let that = this
+ qqmapsdk = new QQMapWX({
+ key: 'HIDBZ-2QXL4-TAWUD-XET6Q-EKTJE-CCBSQ'
+ });
+ qqmapsdk.reverseGeocoder({
+ success: (res) => {
+ console.log('res', res);
+ this.setData({
+ address: res.result.address,
+ latitude: res.result.latitude,
+ longitude: res.result.longitude,
+ })
+ }
+ })
+ wx.getLocation({
+ type: 'wgs84',
+ success(res) {
+ const latitude = res.latitude
+ const longitude = res.longitude
+ that.getShops(latitude, longitude)
+ }
+ })
},
-
- /**
- * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
- */
+ getShops(latitude, longitude) {
+ getShopPage({
+ model: {
+ longitude,
+ latitude
+ }
+ }).then(res => {
+ this.setData({
+ shopList: res.data.records
+ })
+ })
+ },
+ handleDetail(e) {
+ const id = e.currentTarget.dataset.id
+ wx.navigateTo({
+ url: `/pages/store/info?id=${id}`,
+ })
+ },
+ makePhone(e) {
+ console.log('e', e);
+ const phoneNumber = e.currentTarget.dataset.phone
+ wx.makePhoneCall({ phoneNumber })
+ },
onReady() {
},
--
Gitblit v1.9.3