From bf99ae66d14857dfcd97dc6ccb8e82a38d3bd75f Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 19 七月 2024 09:05:46 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
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