1
0
Kaynağa Gözat

首页修改

dq 6 yıl önce
ebeveyn
işleme
4fac586ed1

+ 4 - 4
kmall-admin/src/main/resources/conf/db.properties

@@ -1,14 +1,14 @@
 ########## 数据库配置 ##########
 
 #========== 开发环境 ==========
-jdbc.url=jdbc:mysql://localhost:3306/kmall_pt?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
-jdbc.username=root
-jdbc.password=111111
+jdbc.url=jdbc:mysql://120.76.84.45:3306/kmall_pt?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
+jdbc.username=ceshi
+jdbc.password=abc-123
 
 jdbc.initialSize=5
 jdbc.maxActive=30
 
-jdbc.minPoolSize=2
+jdbc.minPoolSize=2+
 jdbc.maxIdleTime=30000
 jdbc.idleConnectionTestPeriod=100
 

+ 1 - 0
kmall-api/src/main/resources/mybatis/mapper/ApiGoodsMapper.xml

@@ -36,6 +36,7 @@
         <result property="is_app_exclusive" column="is_app_exclusive"/>
         <result property="is_limited" column="is_limited"/>
         <result property="is_hot" column="is_hot"/>
+        <result property="product_id" column="product_id"/>
         <result property="sku" column="sku"/>
         <result property="goodsBizType" column="goods_biz_type"/>
         <result column="creater_sn" property="createrSn" jdbcType="VARCHAR" />

+ 50 - 35
kmall-api/src/main/resources/mybatis/mapper/ApiStoreMapper.xml

@@ -95,38 +95,46 @@
     </select>
 
 
-    <!--<select id="queryNearbyList" resultMap="storeMap">-->
-        <!--select * from-->
-        <!--( select-->
-        <!--`id`,-->
-        <!--`store_name`,-->
-        <!--`store_number`,-->
-        <!--`store_address`,-->
-        <!--`province_name`,-->
-        <!--`city_name`,-->
-        <!--`county_name`,-->
-        <!--`latitude`,-->
-        <!--`longitude`,-->
-        <!--`cover_radius`,-->
-        <!--`remark`,-->
-        <!--round(6378.138*2*asin(sqrt(pow(sin( (a.latitude*pi()/180-#{latitude}*pi()/180)/2),2)-->
-        <!--+cos(a.latitude*pi()/180)*cos(#{latitude}*pi()/180)* pow(sin(-->
-        <!--(a.longitude*pi()/180-#{longitude}*pi()/180)/2),2)))*1000) as distance-->
-        <!--from mall_store a-->
-        <!--WHERE 1=1-->
-        <!--<if test="province_name != null and province_name.trim() != ''">-->
-            <!--AND province_name = #{province_name}-->
-        <!--</if>-->
-        <!--<if test="city_name != null and city_name.trim() != ''">-->
-            <!--AND city_name = #{city_name}-->
-        <!--</if>-->
-        <!--<if test="county_name != null and county_name.trim() != ''">-->
-            <!--AND county_name = #{county_name}-->
-        <!--</if>-->
-        <!--) tmp-->
-        <!--where cover_radius * 1000 > distance-->
-        <!--order by distance asc-->
-    <!--</select>-->
+    <!-- 在配送范围之内查找店铺 -->
+    <!--<select id="queryNearbyList" resultMap="storeMap">
+        select * from
+        ( select
+        `id`,
+        `store_name`,
+        `store_number`,
+        `store_address`,
+        `province_name`,
+        `city_name`,
+        `county_name`,
+        `latitude`,
+        `longitude`,
+        `cover_radius`,
+        `remark`,
+        round(6378.138*2*asin(sqrt(pow(sin((a.latitude*pi()/180-#{latitude}*pi()/180)/2),2)
+          +cos(a.latitude*pi()/180)*cos(#{latitude}*pi()/180)
+          *pow(sin((a.longitude*pi()/180-#{longitude}*pi()/180)/2),2)))*1000) as distance,
+        merch_sn,
+        merch_name,
+        creater_sn,
+        create_time,
+        moder_sn,
+        mod_time,
+        tstm
+        from mall_store a
+        WHERE 1=1
+        <if test="province_name != null and province_name.trim() != ''">
+            AND province_name = #{province_name}
+        </if>
+        <if test="city_name != null and city_name.trim() != ''">
+            AND city_name = #{city_name}
+        </if>
+        <if test="county_name != null and county_name.trim() != ''">
+            AND county_name = #{county_name}
+        </if>
+        ) tmp
+        where cover_radius * 1000 > distance
+        order by distance asc
+    </select>-->
 
     <!--删除距离限制-->
     <select id="queryNearbyList" resultMap="storeMap">
@@ -144,9 +152,15 @@
         `cover_radius`,
         `remark`,
         round(6378.138*2*asin(sqrt(pow(sin( (a.latitude*pi()/180-#{latitude}*pi()/180)/2),2)
-        +cos(a.latitude*pi()/180)*cos(#{latitude}*pi()/180)* pow(sin(
-        (a.longitude*pi()/180-#{longitude}*pi()/180)/2),2)))*1000) as distance,merch_sn, merch_name, creater_sn, create_time,
-        moder_sn, mod_time, tstm
+            +cos(a.latitude*pi()/180)*cos(#{latitude}*pi()/180)
+            *pow(sin((a.longitude*pi()/180-#{longitude}*pi()/180)/2),2)))*1000) as distance,
+        merch_sn,
+        merch_name,
+        creater_sn,
+        create_time,
+        moder_sn,
+        mod_time,
+        tstm
         from mall_store a
         WHERE 1=1
         <if test="province_name != null and province_name.trim() != ''">
@@ -160,5 +174,6 @@
         </if>
         ) tmp
         order by distance asc
+        limit 0, 10
     </select>
 </mapper>

+ 4 - 1
wx-mall/pages/index/index.js

@@ -78,6 +78,9 @@ Page({
   },
   onShow: function () {
     // 页面显示
+    let that = this;
+    wx.setStorageSync("navUrl", "/pages/index/index")
+    that.syncStore();
   },
   onHide: function () {
     // 页面隐藏
@@ -87,7 +90,7 @@ Page({
   },
   handleStore() {
     wx.navigateTo({
-      url: '../store/store',
+      url: '../map/map',
     })
   },
   goSearch() {

+ 10 - 5
wx-mall/pages/index/index.wxss

@@ -1,6 +1,7 @@
 .banner {
   width: 750rpx;
   height: 365rpx;
+  padding-top: 130rpx;
 }
 
 .discount-dialog {
@@ -40,19 +41,21 @@
 }
 
 .home-header {
-  height: 160rpx;
+  position: fixed;
+  width: 750rpx;
+  height: 40rpx;
   display: flex;
   justify-content: left;
   align-items: left;
   background-color: #fff;
-  padding: 20rpx;
+  z-index: 98;
 }
 
 .current-store {
   text-align: left;
   position: relative;
-  margin-top:70rpx;
-  margin-left: 26rpx;
+  margin-left: 35rpx;
+  font-size: 14px;
 }
 
 .search-icon {
@@ -587,7 +590,7 @@
 
 .search-header {
   position: fixed;
-  top: 0;
+  top: 40rpx;
   width: 750rpx;
   height: 91rpx;
   display: flex;
@@ -595,6 +598,7 @@
   padding: 0 31.25rpx;
   font-size: 29rpx;
   color: #333;
+  z-index: 99;
 }
 .search-header .icon {
   position: absolute;
@@ -618,6 +622,7 @@
   top: 0;
   width: 506rpx;
   height: 59rpx;
+  font-size: 12px;
 }
 
 .search-header .right {

+ 52 - 2
wx-mall/pages/map/map.js

@@ -4,17 +4,67 @@ var api = require('../../config/api.js');
 var app = getApp();
 
 Page({
+  /**
+   * 页面的初始数据
+   */
   data: {
-    
+    // 中心点纬度、经度
+    latitude: "",
+    longitude: "",
+    // 标记点 当前位置
+    markers: [],
+    isShow: true,
+    storeName: "",
+    storeAddress: "",
+    distance: ""
   },
   onLoad: function (options) {
     // 页面初始化 options为页面跳转所带来的参数
+    this.mapCtx = wx.createMapContext('myMap');
+    this.mapCtx.moveToLocation();
 
+  
+    let that = this;
+    util.getLocation((lng, lat) => {
+      util.request(api.NearbyList, { longitude: lng, latitude: lat }).then((res) => {
+        let markers = [];
+        let marker = {
+          iconPath: "/static/images/myAddress.png",
+          id: 0,
+          latitude: lat,
+          longitude: lng,
+          width: 35,
+          height: 35,
+          clickable: true,
+          
+        };
+        markers.push(marker);
 
+        let nlist = res.data;
+        for (var i = 1; i <= nlist.length; i++) {
+          let marker = {
+            iconPath: "/static/images/address.png",
+            id: i,
+            latitude: nlist[i-1].latitude,
+            longitude: nlist[i-1].longitude,
+            width: 35,
+            height: 35,
+            clickable: true
+          };
+          markers.push(marker);
+        }
+
+        that.setData({
+          latitude: lat,
+          longitude: lng,
+          markers: markers
+        })
+      })
+    })
   },
   onReady: function () {
     // 页面渲染完成
-
+    wx.create
   },
   onShow: function () {
     // 页面显示

+ 1 - 1
wx-mall/pages/map/map.json

@@ -1,3 +1,3 @@
 {
-    "navigationBarTitleText": "选择小区"
+    "navigationBarTitleText": "附近门店"
 }

+ 8 - 2
wx-mall/pages/map/map.wxml

@@ -1,3 +1,9 @@
-<view class="container">
-  
+<view class="map_container">
+  <map class="map" longitude="{{longitude}}" latitude="{{latitude}}" markers='{{markers}}' show-location bindmarkertap='getInfo'>
+      <cover-view class="map-tab-bar map-foot {{isShow ? '' : 'map-hide'}}">
+        <cover-view class="map-storeName">{{storeName}}</cover-view>
+        <cover-view class="map-storeAddress">{{storeAddress}}</cover-view>
+        <cover-view class="map-distance">距离当前定位地址{{distance}}米</cover-view>
+      </cover-view>
+  </map>
 </view>

+ 44 - 4
wx-mall/pages/map/map.wxss

@@ -1,8 +1,48 @@
-.container {
-  background: #f4f4f4;
+.map_container {
   width: 100%;
-  height: auto;
-  min-height: 100%;
+  height: 100%;
+  position: fixed;
+  top: 0;
+  bottom: 0;
+  left: 0;
+  right: 0;
+}
+
+.map {
+  width: 100%;
+  height: 100%;
+}
+
+.map-tab-bar {
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  z-index: 1000;
+  font-size: 0;
+  background-color: #fff;
+}
+
+.map-hide {
+  display: none;
+}
+
+.map-foot {
+  top: auto;
+  bottom: 0;
+  padding: 0 10px;
+}
+
+.map-name {
+  height: 80rpx;
+  line-height: 80rpx;
+  font-size: 35rpx;
   overflow: hidden;
 }
 
+.map-address {
+  height: 60rpx;
+  line-height: 60rpx;
+  font-size: 25rpx;
+  overflow: hidden;
+}