Jelajahi Sumber

修改applogin

wenjie 1 Minggu lalu
induk
melakukan
87e22920dd

+ 1 - 1
pages/applyRefund/applyRefund.wxml

@@ -13,7 +13,7 @@
           <radio class="radio" checked="{{applyType == 1}}" value="1" color="#006CE8" />
           <view class="info">
             <view class="title">我要退款</view>
-            <view class="desc">没收到货,已收到货与商家协商后无需退货只退款</view>
+            <view class="desc">没收到货,已收到货与商家协商后无需退货只退款</view>
           </view>
       </view>
       <view class="item">

+ 44 - 33
pages/index/index.js

@@ -66,6 +66,7 @@ Page({
   },
 
   onLoad: function () {
+    console.log('load');
     // 实例化API核心类
     qqmapsdk = new QQMapWX({
       key: 'D3MBZ-LQK6U-IONVC-GJDPK-C43GF-UYFOC'
@@ -161,32 +162,32 @@ Page({
         wx.setStorageSync('LATITUDE', res.latitude)
         wx.setStorageSync('LONGITUDE', res.longitude)
         // 调用腾讯地图api获取当前位置
-        qqmapsdk.reverseGeocoder({
-          location: {
-            latitude: latitude,
-            longitude: longitude
-          },
-          success: function (res) {
-            console.log(res.result, '---address_success');
-            wx.setStorageSync('ADDRESS', res.result.address_component.street)
-            that.setData({
-              select_address: wx.getStorageSync('ADDRESS')
-            })
-          },
-          fail: function (res) {
-            console.log(res, '---address_err');
-            wx.showToast({
-              title: res + '地址信息获取失败',
-              icon: "none"
-            })
-            setTimeout(() => {
-              wx.hideToast();
-            }, 2000)
-          },
-          complete: function (res) {
-            // console.log(res, '---callback');
-          }
-        });
+        // qqmapsdk.reverseGeocoder({
+        //   location: {
+        //     latitude: latitude,
+        //     longitude: longitude
+        //   },
+        //   success: function (res) {
+        //     console.log(res.result, '---address_success');
+        //     wx.setStorageSync('ADDRESS', res.result.address_component.street)
+        //     that.setData({
+        //       select_address: wx.getStorageSync('ADDRESS')
+        //     })
+        //   },
+        //   fail: function (res) {
+        //     console.log(res, '---address_err');
+        //     wx.showToast({
+        //       title: res + '地址信息获取失败',
+        //       icon: "none"
+        //     })
+        //     setTimeout(() => {
+        //       wx.hideToast();
+        //     }, 2000)
+        //   },
+        //   complete: function (res) {
+        //     // console.log(res, '---callback');
+        //   }
+        // });
       },
       fail: function (err) {
         wx.removeStorageSync('ADDRESS')
@@ -577,19 +578,24 @@ Page({
               showShopList:true
             })
           }
-          res.forEach(item=>{
+
+          for (let i = 0; i < res.length; i++) {
+            const item = res[i];
             if(item.hasProduct){
+              console.log('==========================');
               wx.setStorageSync('shopInfo', item)
               // this.getaddress_transports(item.shopId)
               this.setData({
                 shop_id: item.shopId,
                 shopName:item.shopName
               })
+              this.getClassInfo(item.shopId);
               resolve()
-               return this.getClassInfo(item.shopId);
+              break; // 直接终止整个循环(输出1,2)
+
             }
-           
-          })
+          }
+
         }
       };
       http.request(params);
@@ -766,7 +772,8 @@ Page({
     })
   
   },
-  getAllData() {
+  getAllData(type) {
+    console.log('=========type',type);
     this.setData({
       current:1,
       shop_id: wx.getStorageSync("shopInfo").shopId,
@@ -780,9 +787,13 @@ Page({
     this.getRecommended()
     this.getRecommendeds()
     this.getAdv()
-    this.get_neighborShop().then(res=>{
+    if(type == 'refresh'){//切换店铺
       this.getHotSalesProds()
-    })
+    }else{
+      this.get_neighborShop().then(res=>{
+        this.getHotSalesProds()
+      })
+    }
   },
 
   //加载轮播图

+ 10 - 6
pages/locationAdd/locationAdd.js

@@ -71,8 +71,8 @@ Page({
       method: "GET",
       data: {
         addrId:'',
-        lat: wx.getStorageSync('LATITUDE'),
-        lon: wx.getStorageSync('LONGITUDE'),
+        lat: wx.getStorageSync('LATITUDE')||wx.getStorageSync('shopInfo').lat,
+        lon: wx.getStorageSync('LONGITUDE')||wx.getStorageSync('shopInfo').lon,
         channelId:wx.getStorageSync('channelId')||3
       },
       callBack: (res) => {
@@ -139,7 +139,7 @@ Page({
         wx.hideLoading();
         this.getAddrList()
         // 当前定位显示选择地址的名称 不再显示路名
-        this.getTxmap()
+        // this.getTxmap()
        wx.setStorageSync('ADDRESS', e.currentTarget.dataset.item.addressName)
         setTimeout(() => {
           let pages = getCurrentPages();
@@ -148,7 +148,9 @@ Page({
             delta: 1,
             success: function (e) { // 成功的回调
               if (prevPage == undefined || prevPage == null) return;
-              prevPage.go_update(); // 调用A页面的方法, 并将值传过去
+              // prevPage.go_update(); // 调用A页面的方法, 并将值传过去
+              prevPage.getAllData(); // 调用A页面的方法, 并将值传过去
+
             }
           })
         }, 500)
@@ -161,8 +163,8 @@ Page({
     // 调用腾讯地图api获取当前位置
     qqmapsdk.reverseGeocoder({
       location: {
-        latitude: wx.getStorageSync('LATITUDE'),
-        longitude: wx.getStorageSync('LONGITUDE')
+        latitude: wx.getStorageSync('LATITUDE')||wx.getStorageSync('shopInfo').lat,
+        longitude: wx.getStorageSync('LONGITUDE')||wx.getStorageSync('shopInfo').lon
       },
       success: (res) => {
         wx.hideLoading()
@@ -207,6 +209,8 @@ Page({
             success: function (e) { // 成功的回调
               if (prevPage == undefined || prevPage == null) return;
               prevPage.go_update(); // 调用A页面的方法, 并将值传过去
+              // prevPage.getAllData('refresh'); // 调用A页面的方法, 并将值传过去
+
             }
           })
         }, 500)

+ 2 - 2
pages/locationAdd/locationAdd.wxml

@@ -3,10 +3,10 @@
   <view class="top-card-box">
     <view class="current-location">当前定位</view>
     <view class="location-box">
-      <view class="location-address">
+      <!-- <view class="location-address">
         <van-icon name="location" />
         <view class="address-text">{{address||'未授权定位'}}</view>
-      </view>
+      </view> -->
       <view bindtap="getLocation" class="reset-location">
         <image style="width: 40rpx;height: 40rpx;margin-right: 10rpx;" src="/images/icon/location.png" mode="" />
         <view>重新定位</view>

+ 3 - 2
pages/login/login.js

@@ -120,9 +120,10 @@ Page({
         // 发送 res.code 到后台换取 openId, sessionKey, unionId
         http.request({
           login: true,
-          url: '/appLogin',
+          url: '/p/user/miniAppLogin',
+          method:"GET",
           data: {
-            principal: res.code,
+            code: res.code,
             appType: 1
           },
           callBack: result => {

+ 2 - 2
utils/config.js

@@ -4,8 +4,8 @@
 
 var domain = "https://shop.api.zswlgz.com"; //统一接口域名,正式环境 
 var wsDomain = "wss://shop-h5.dev.zswllife.cn/api"; //统一接口域名,正式环境 
-var domain = "http://47.109.84.152:8112"; //统一接口域名,测试环境 
-var domain = "https://1b5a4ee0.r36.cpolar.top"; //统一接口域名,正式环境 
+// var domain = "http://47.109.84.152:8112"; //统一接口域名,测试环境 
+var domain = "https://3af85f91.r36.cpolar.top"; //统一接口域名,正式环境 
 // var wsDomain = "wss://shop.haimamart.com/api"; //统一接口域名,正式环境 
 
 // var domain = "http://192.168.1.206:8112"; //统一接口域名,测试环境

+ 3 - 2
utils/http.js

@@ -150,9 +150,10 @@ var getToken = function (fn) {
       console.log(res);
       request({
         login: true,
-        url: '/appLogin',
+        url: '/p/user/miniAppLogin',
+        method:"get",
         data: {
-          principal: res.code,
+          code: res.code,
           appType: 1
         },
         callBack: result => {