소스 검색

用户端 获取当前经纬度 图片 修改bug若干

zxl 1 년 전
부모
커밋
7d8393ebd2

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 19522 - 2
package-lock.json


+ 1 - 1
src/App.vue

@@ -13,7 +13,7 @@
       })
     }
     },
-    onShow() {
+    mounted() {
       uni.hideTabBar({
 		  success: () => {
 		  	console.log('hide tabber success');

+ 3 - 2
src/api/client/order.js

@@ -66,12 +66,13 @@ export function orderDetailGoodApi(id, data) {
  * @returns
  */
 
-export function cancelOrder(id) {
+export function cancelOrder(id,data) {
   return request({
     url: `/maintain/cancelOrder/${id}`,
     method: 'get',
+    data:data,
     headers: {
-      'content-type': 'application/json',
+      'content-type': 'application/x-www-form-urlencoded',
     },
   });
 }

+ 4 - 3
src/components/merchant/HotItem.vue

@@ -2,10 +2,11 @@
   <view class="container">
     <view class="content">
       <view class="img-box">
-        <image
-          :src="error || !loaded ? 'https://cdn.uviewui.com/uview/album/10.jpg' : item.cover"
+       <!-- <image
+          :src="error || !loaded ? 'https://cdn.uviewui.com/uview/album/10.jpg' : item.logo"
           mode="scaleToFill"
-        ></image>
+        ></image> -->
+        <image  mode="scaleToFill" :src='item.logo'></image>
         <view class="name u-line-1">{{ item.name }}</view>
       </view>
       <view class="pd-10">{{ item.address }}</view>

+ 2 - 1
src/components/merchant/RecommendItem.vue

@@ -2,7 +2,8 @@
   <view class="container">
     <view class="content">
       <view class="img-box">
-        <image :src="error || !loaded ? 'https://cdn.uviewui.com/uview/album/10.jpg' : item.cover" mode="scaleToFill" />
+        <!-- <image :src="error || !loaded ? 'https://cdn.uviewui.com/uview/album/10.jpg' : item.logo" mode="scaleToFill" /> -->
+        <image :src="item.logo " mode="scaleToFill" />
         <view class="name u-line-1">{{ item.name }}</view>
       </view>
       <view class="pd-10">{{ item.address }}</view>

+ 3 - 4
src/components/service/goodsItem.vue

@@ -5,7 +5,7 @@
         @click="handlerClearItem(itm,index)">
         <view class="list" @click='handlerRouterSkip(itm)'>
           <view class="list-img">
-            <image class="img" :src="error || !loaded ? 'https://cdn.uviewui.com/uview/album/10.jpg' : itm.logo"
+            <image class="img" :src=" itm.logo"
               mode="scaleToFill"></image>
           </view>
 
@@ -57,7 +57,6 @@
       close() {
         this.show = false;
       },
-
       // 点击跳转1
       handlerRouterSkip(item) {
         uni.navigateTo({
@@ -67,7 +66,7 @@
       // 点击取消
       handlerClearItem(item, index) {
         cancelFavorite(item.id).then(res => {
-          if (res.code == 200) {
+          if (res.code == 'OK') {
             uni.showToast({
               title: '取消成功',
               icon: 'none'
@@ -75,7 +74,7 @@
             this.$emit('uploadIniList', 1)
           } else {
             uni.showToast({
-              title: res.msg,
+              title: res.message,
               icon: 'none'
             })
             return

+ 28 - 24
src/components/service/index.vue

@@ -1,32 +1,36 @@
 <template>
   <view class="sort">
-    <u-swipe-action>
-      <u-swipe-action-item :options="options1" :key="index" v-for="(itm, index) of item"
-        @click="handlerClearItem(itm,index)">
-        <view class="list" @click="handlerRouterSkip(itm, index)">
-          <view class="list-img">
-            <image class="img" :src="error || !loaded ? 'https://cdn.uviewui.com/uview/album/10.jpg' : itm.logo"
-              mode="scaleToFill"></image>
-          </view>
+<!--    <u-swipe-action>
+      <u-swipe-action-item :options="options1"
+        @click="handlerClearItem(itm,index)"> -->
+        <view class="" :key="index" v-for="(itm, index) of item">
+          <view class="list" @click="handlerRouterSkip(itm, index)">
+            <view class="list-img">
+              <!-- <image class="img" :src="error || !loaded ? 'https://cdn.uviewui.com/uview/album/10.jpg' : itm.logo"
+                mode="scaleToFill"></image> -->
+                <image class="img" :src="itm.logo"  mode="scaleToFill"></image>
+            </view>
 
-          <view class="list-main">
-            <view class="item-text">{{ itm.address }}</view>
-            <view class="item-flex">
-              <view class="star">
-                <u-rate :count="itm.score" :size="14" />
-                <text class="line">|</text>
-                <text class="points">{{ itm.score }}分</text>
+            <view class="list-main">
+              <view class="item-text">{{ itm.address }}</view>
+              <view class="item-flex">
+                <view class="star">
+                  <u-rate :count="itm.score" :size="14" />
+                  <text class="line">|</text>
+                  <text class="points">{{ itm.score }}分</text>
+                </view>
+                <view>{{ itm.sale }}单</view>
+              </view>
+              <view class="list-item">
+                <view class="item-l">{{ itm.name }}</view>
+                <view class="item-r">{{ itm.distance }}KM</view>
               </view>
-              <view>{{ itm.sale }}单</view>
-            </view>
-            <view class="list-item">
-              <view class="item-l">{{ itm.name }}</view>
-              <view class="item-r">{{ itm.distance }}KM</view>
             </view>
           </view>
         </view>
-      </u-swipe-action-item>
-    </u-swipe-action>
+
+<!--      </u-swipe-action-item>
+    </u-swipe-action> -->
   </view>
 </template>
 
@@ -71,7 +75,7 @@
       // 点击取消
       handlerClearItem(item, index) {
         cancelFavorite(item.id).then(res => {
-          if (res.code == 200) {
+          if (res.code == 'OK') {
             uni.showToast({
               title: '取消成功',
               icon: 'none'
@@ -79,7 +83,7 @@
             this.$emit('uploadIniList', 0)
           } else {
             uni.showToast({
-              title: res.msg,
+              title: res.message,
               icon: 'none'
             })
             return

+ 21 - 7
src/components/settleBottomBtn/settleBottomBtn.vue

@@ -1,6 +1,6 @@
 <template>
   <view class="container">
-    <view class="item-box" @click="pop_show = true">
+    <view class="item-box" @click="handlerOpenPop">
       <view class="item-left">
         <image class="img" src="@/static/images/shopCarts.png"></image>
         <view class="edge-box">
@@ -8,8 +8,8 @@
         </view>
         <view class="left-price">
           <p class="price">
-            <span class="price-symbal">¥</span><span class="price-text1">{{ allPrice }}</span>
-            <span class="price-text2">¥219</span>
+            <span class="price-symbal">¥</span><span class="price-text1">{{ allPrice.price }}</span>
+            <span class="price-text2">¥{{ allPrice.originalPrice }}</span>
           </p>
         </view>
       </view>
@@ -81,11 +81,13 @@
     },
     computed: {
       allPrice() {
-        let sum = 0
+        let price = 0
+        let originalPrice = 0
         this.goodsCateList.map(rs => {
-          sum += Number((rs.price).toFixed(2) * rs.quantity)
+          price += Number((rs.price).toFixed(2) * rs.quantity)
+          originalPrice += Number((rs.originalPrice).toFixed(2) * rs.quantity)
         })
-        return sum
+        return { price , originalPrice }
       },
       allNumb() {
         let allNumber = 0
@@ -96,6 +98,18 @@
       }
     },
     methods: {
+      // 点击打开pop
+      handlerOpenPop(){
+        if(!this.goodsCateList.length){
+          uni.showToast({
+            title:'购物车商品为空',
+            icon:'none'
+          })
+          return
+        }else{
+          this.pop_show = true
+        }
+      },
       // 结算按钮
       handlerSettleBtn() {
         if (this.goodsCateList.length == 0) {
@@ -129,7 +143,7 @@
             this.$emit("handlerDeleteGoods")
           } else {
             uni.showToast({
-              title: res.msg,
+              title: res.message,
               icon: 'none'
             })
             return

+ 23 - 24
src/pages/client/clientPackage/orderAll.vue

@@ -53,7 +53,9 @@
           </view>
 
           <view class="item-bottom">
-            <button class="btn">取消订单</button>
+            <button class="btn" v-if="current == 0" @click='handlerCancelOrder(item)'>取消订单</button>
+            <button class="btn" v-if='current == 1' @click='handlerOrderBtn(1)'>申请退款</button>
+            <button class="btn" v-if='current == 2' @click='handlerOrderBtn(2)'>售后</button>
           </view>
         </view>
       </view>
@@ -162,7 +164,6 @@
 
       // 跳转到订单详情
       handlerSkipDetail(e) {
-        console.log('@@@@e', e);
         uni.navigateTo({
           url: `/pages/client/clientPackage/orderDetail?orderList=${JSON.stringify(e)}`,
         });
@@ -170,15 +171,18 @@
       // 取消订单
       handlerCancelOrder(e) {
         cancelOrder(e.id).then(res => {
-          console.log('###res', res);
-          if (res.code == 200) {
+          if (res.code == 'OK') {
             uni.showToast({
-              title: '取消成功',
+              title: '订单取消成功',
               icon: 'none',
             });
             this.userOrdersPage(this.type);
           } else {
-            console.log('###res', res);
+            uni.showToast({
+              title: res.message,
+              icon: 'none',
+            });
+            return
           }
         });
       },
@@ -298,27 +302,22 @@
             }
           }
         }
-
-        .item-bottom {
-          display: flex;
-          width: 100%;
-          margin-top: 20rpx;
-
-          .btn {
-            width: 80%;
-            height: 70rpx;
-            background-color: rgba(248, 213, 53, 0.8);
-            color: #4e5059;
-            font-size: 28rpx;
-            text-align: center;
-            line-height: 70rpx;
-            border-radius: 20rpx;
-          }
-        }
       }
     }
   }
-
+  .item-bottom {
+    width: 100%;
+    margin-top: 20rpx;
+    .btn {
+      height: 70rpx;
+      background-color: rgba(248, 213, 53, 0.8);
+      color: #4e5059;
+      font-size: 28rpx;
+      text-align: center;
+      line-height: 70rpx;
+      border-radius: 20rpx;
+    }
+  }
   .gray-color {
     color: #858797;
   }

+ 59 - 49
src/pages/client/clientPackage/storeDetail.vue

@@ -2,7 +2,8 @@
   <view class="detail">
     <!-- 轮播图 -->
     <view class="carousel-map">
-      <u-swiper :list="swiperList" previousMargin="30" nextMargin="30" circular bgColor="#ffffff" height="190" />
+      <u-swiper :list="swiperList" previousMargin="30" nextMargin="30" circular bgColor="#ffffff" height="150" />
+      <!-- <u-swiper :list="swiperList"/> -->
       <!-- <view class="carousel-item">
         <view class="mark">
           <view class="mark-item">{{ merchant.score }}分</view>
@@ -113,7 +114,7 @@
         <view class="draw-title"> 预约服务 </view>
         <view class="draw-item">
           <view class="item-text">时间</view>
-          <view class="time-box" @click="handlerSelectTime" :class="template_time == '' ? 'time-text' : ''">
+          <view class="time-box" @click="time_show = true" :class="template_time == '' ? 'time-text' : ''">
             {{ template_time == '' ? '请选择时间' : template_time }}
           </view>
         </view>
@@ -159,6 +160,7 @@
   } from "@/api/client/mine.js"
   import GainCoupon from '@/pages/client/clientPackage/serviceDetail/GainCoupon.vue';
   import settleBottomBtn from "@/components/settleBottomBtn/settleBottomBtn.vue"
+  import { mapState } from 'vuex';
   export default {
     components: {
       settleBottomBtn,
@@ -169,11 +171,7 @@
         show: false,
         merchant: {},
         goods: [],
-        swiperList: [
-          'https://cdn.uviewui.com/uview/swiper/swiper3.png',
-          'https://cdn.uviewui.com/uview/swiper/swiper2.png',
-          'https://cdn.uviewui.com/uview/swiper/swiper1.png'
-        ],
+        swiperList: [ ],
         categoryList: [{
           name: '全部',
           id: 0
@@ -201,10 +199,17 @@
     onLoad(option) {
       this.ids = option.id
       this.queryParams.id = option.id;
-      this.handlerInitLocation();
     },
     onShow() {
       this.handletInitShopCarList()
+      this.handlerInitList()
+    },
+    computed: {
+      ...mapState({
+        longitude: state => state.data.location.longitude,
+        latitude: state => state.data.location.latitude,
+        region: state => state.data.location.region,
+      }),
     },
     watch: {
       reserve_show(newValue) {
@@ -219,14 +224,18 @@
     methods: {
       // 初始化购物车列表
       handletInitShopCarList() {
+        this.swiperList = []
         getCartList(this.ids).then(res => {
+          // 商品轮播图
+          res.data.merchantDTO.banners.map(rs=>{
+            this.swiperList.push(rs.url)
+          })
           if (res.data.cartItems.length == 0) {
             this.goodsCateList = []
           } else {
             this.goodsCateList = res.data.cartItems
           }
         })
-
         accountTotIdGetConponList(this.ids, {
           paging: '1,10'
         }).then(res => {
@@ -234,52 +243,54 @@
         })
       },
       // 获取当前经纬度
-      handlerInitLocation() {
-        // uni.getLocation({
-        //   type: 'gcj02',
-        //   success: res => {
-        //     this.queryParams.longitude = res.longitude;
-        //     this.queryParams.latitude = res.latitude;
-        //     let point = {
-        //       latitude: res.latitude,
-        //       longitude: res.longitude,
-        //     };
-        //     getCurrentLocation(point).then(rc => {
-        //       this.queryParams.region = rc.data.id;
-        //       this.handlerInitList();
-        //     });
-        //   },
-        //   fail: rs => {
-        //     uni.showToast({
-        //       title: rs,
-        //       icon: 'none',
-        //     });
-        //   },
-        // });
-        this.queryParams.longitude = 119.13279;
-        this.queryParams.latitude = 36.70864;
-        let point = {
-          latitude: 36.70864,
-          longitude: 119.13279,
-        };
-        // getCurrentLocation(point).then(rc => {
-        this.queryParams.region = 370705;
-        this.handlerInitList();
-        // });
-      },
+      // handlerInitLocation() {
+      //   // uni.getLocation({
+      //   //   type: 'gcj02',
+      //   //   success: res => {
+      //   //     this.queryParams.longitude = res.longitude;
+      //   //     this.queryParams.latitude = res.latitude;
+      //   //     let point = {
+      //   //       latitude: res.latitude,
+      //   //       longitude: res.longitude,
+      //   //     };
+      //   //     getCurrentLocation(point).then(rc => {
+      //   //       this.queryParams.region = rc.data.id;
+      //   //       this.handlerInitList();
+      //   //     });
+      //   //   },
+      //   //   fail: rs => {
+      //   //     uni.showToast({
+      //   //       title: rs,
+      //   //       icon: 'none',
+      //   //     });
+      //   //   },
+      //   // });
+      //   this.queryParams.longitude = 119.13279;
+      //   this.queryParams.latitude = 36.70864;
+      //   let point = {
+      //     latitude: 36.70864,
+      //     longitude: 119.13279,
+      //   };
+      //   // getCurrentLocation(point).then(rc => {
+      //   this.queryParams.region = 370705;
+      //   this.handlerInitList();
+      //   // });
+      // },
       // 初始化列表
       handlerInitList() {
+        this.queryParams.longitude = this.longitude;
+        this.queryParams.latitude = this.latitude;
+        this.queryParams.region = this.region;
         this.categoryList = [{
           name: '全部',
           id: 0
         }]
         getSellsDetail(this.queryParams.id, this.queryParams).then(res => {
           this.merchant = res.data.merchant;
+          this.goods = res.data.goods;
           res.data.categories.map(rs => {
             this.categoryList.push(rs)
           })
-          this.goods = res.data.goods;
-          this.swiperList = res.data.merchant.banners.map(h => h.url);
         });
         // 获取锚点
         hotMerchant(this.queryParams.id).then();
@@ -290,14 +301,12 @@
           phoneNumber: this.merchant.mobile,
         });
       },
-
       // 点击跳转到商品详情
       handlerSkipGoodsDetail(item, index) {
         uni.navigateTo({
           url: `/pages/client/clientPackage/serviceDetail/index?id=${item.id}&shopId=${this.queryParams.id}`,
         });
       },
-
       // 预约
       handlerService(item, index) {
         this.addParams.merchantId = item.id;
@@ -313,9 +322,9 @@
       // },
 
       // 点击选择时间
-      handlerSelectTime() {
-        this.time_show = true;
-      },
+      // handlerSelectTime() {
+      //   this.time_show = true;
+      // },
 
       // 点击预约确定按钮
       handlerDrawConfirmBtn() {
@@ -401,6 +410,7 @@
           price: e.specialPrice,
           goodsName: e.name,
           goodsPic: e.logo,
+          originalPrice: e.originalPrice,
           // goodsSubTitle:this.goods.description
         }
         addShoppingCart(params).then(res => {

+ 11 - 14
src/pages/client/clientPackage/storeList.vue

@@ -56,9 +56,9 @@
     <view class="content-box">
       <view class="content-item" v-for="(item, index) in sellerList" :key="index" @tap="goSellerDetail(item.id)">
         <view class="item-left">
-          <!-- <image class="img" :src="item.logo" mode="aspectFit"></image> -->
-          <image class="img" :src="error || !loaded ? 'https://cdn.uviewui.com/uview/album/10.jpg' : item.logo"
-            mode="scaleToFill"></image>
+          <image class="img" :src="item.logo" mode="aspectFit"></image>
+          <!-- <image class="img" :src="error || !loaded ? 'https://cdn.uviewui.com/uview/album/10.jpg' : item.logo"
+            mode="scaleToFill"></image> -->
         </view>
         <view class="item-right">
           <view>
@@ -72,7 +72,8 @@
                 <text>{{ item.score }}</text>
               </view>
               <view class="border"></view>
-              <view class="srt-right">{{ item.sale }}单</view>
+              <!-- <view class="srt-right">{{ item.sale }}单</view> -->
+              <view class="srt-right"></view>
             </view>
           </view>
 
@@ -88,15 +89,9 @@
 </template>
 
 <script>
-  import {
-    getSellerList
-  } from '@/api/client/business.js';
-  import {
-    getCurrentLocation
-  } from '@/api/client/home.js';
-  import {
-    mapState
-  } from 'vuex';
+  import { getSellerList } from '@/api/client/business.js';
+  import { getCurrentLocation } from '@/api/client/home.js';
+  import { mapState } from 'vuex';
   export default {
     async mounted() {
       // let data = {
@@ -116,6 +111,7 @@
       ...mapState({
         longitude: state => state.data.location.longitude,
         latitude: state => state.data.location.latitude,
+        region: state => state.data.location.region,
       }),
     },
     data() {
@@ -143,7 +139,7 @@
           latitude: '',
           sort: 'SYNTHESE',
           size: 10,
-          region: '370705', //地区编码
+          region: '', //地区编码
           keyword: '', //关键字
           categoryId: '', //分类ID
         },
@@ -182,6 +178,7 @@
       getData() {
         this.sellerListParams.latitude = this.latitude;
         this.sellerListParams.longitude = this.longitude;
+        this.sellerListParams.region = this.region;
         getSellerList(this.sellerListParams)
           .then(res => {
             this.sellerList = res.data;

+ 37 - 33
src/pages/client/clientPackage/uptickOrder.vue

@@ -45,14 +45,13 @@
 							</view>
 						</view>
 					</view>
-
 					<view class="item-right">
 						<u-number-box v-model="item.quantity"></u-number-box>
 					</view>
 				</view>
 			</view>
 
-			<view class="message-box">
+			<!-- <view class="message-box">
 				<view class="couon-box">
 					<view class="coupon-left">
 						<image class="img" src='@/static/images/coupon.png'></image>
@@ -71,14 +70,14 @@
 						<u-icon name="arrow-right" size='13'></u-icon>
 					</view>
 				</view>
-			</view>
+			</view> -->
 
 			<view class="message-box">
 				<view class="message-item">
 					<view class="item-left"> 订单总价 </view>
 					<view class=" flex-end red-color" style="align-items: center;">
 						<p style="margin-right: 20rpx; font-size: 36rpx; font-weight: bold;">¥{{ orderParams.price.toFixed(2) }}</p>
-						<p>( 已优惠¥{{ orderParams.allPrice.toFixed(2) }} )</p>
+						<p style="text-decoration: line-through;font-style: italic;">( 已优惠¥{{ orderParams.discountPrice.toFixed(2) }} )</p>
 					</view>
 				</view>
 			</view>
@@ -93,7 +92,7 @@
 			</view>
 		</view>
 
-		<u-popup :show="coupon_show" @close="close" mode='bottom' round='20' bgColor='#F4F4F4'>
+		<!-- <u-popup :show="coupon_show" @close="close" mode='bottom' round='20' bgColor='#F4F4F4'>
 			<view class="pop-box">
 				<view class="pop-title"> 商家优惠券 </view>
 				<u-line margin='20rpx 0'></u-line>
@@ -127,7 +126,7 @@
           <button class='coupon-btn' @click="handlerSelectCoupon">确定</button>
         </view>
 			</view>
-		</u-popup>
+		</u-popup> -->
 
 		<view class="btn-box">
 			<view class="btn" @click="handlerSettleBtn">
@@ -146,7 +145,10 @@
 			return {
 				coupon_show: false,
         coupon_list:[],
-        init_list:[],
+        init_list:{
+          cartItems:[],
+          merchantDTO:[]
+        },
         phoneNumber:null ,// 订购电话
         goodsRemark:'' ,// 备注
         merchantId:null
@@ -161,42 +163,44 @@
     computed: {
       orderParams(){
         let price = 0
+        let originalPrice = 0
         let discountPrice = 0
-        let allPrice = 0
-        // this.init_list.cartItems.map(rs=>{
-        //   price += Number( rs.price * rs.quantity )
-        //   discountPrice += Number( rs.originalPrice * rs.quantity )
-        // })
-        // allPrice = discountPrice - price < 0 ? 0 : discountPrice - price
-        // console.log("@@@@@allPrice",allPrice)
-        return { allPrice , price }
+        if(this.init_list.cartItems){
+          this.init_list.cartItems.map(rs=>{
+            price += Number((rs.price).toFixed(2) * rs.quantity)
+            originalPrice += Number((rs.originalPrice).toFixed(2) * rs.quantity)
+          })
+          discountPrice = originalPrice - price
+        }
+        return { price , discountPrice }
       }
     },
 		methods:{
       // 初始化列表接口
       handlerInitList(){
         getCartList(this.merchantId).then(res=>{
-          this.init_list = res.data
-          this.handlerInitCouponList(res.data.cartItems)
+          this.init_list.cartItems = res.data.cartItems
+          this.init_list.merchantDTO = res.data.merchantDTO
+          // this.handlerInitCouponList(res.data.cartItems)
         })
       },
       // 初始化优惠券列表
-      handlerInitCouponList(cartItems){
-        let params = {
-          cartIds:[],
-          merchantId:this.merchantId
-        }
-        cartItems.map(rs=>{
-          params.cartIds.push(rs.id)
-        })
-        // 订单接口 - 根据购物车信息生成确认单信息
-        generateConfirmOrder(params).then(res=>{
-          this.coupon_list = res.data
-          this.coupon_list.couponHistoryDetailList.map(rs=>{
-            rs.couponDTO.endTime = changeTime(rs.couponDTO.createTime)
-          })
-        })
-      },
+      // handlerInitCouponList(cartItems){
+      //   let params = {
+      //     cartIds:[],
+      //     merchantId:this.merchantId
+      //   }
+      //   cartItems.map(rs=>{
+      //     params.cartIds.push(rs.id)
+      //   })
+      //   // 订单接口 - 根据购物车信息生成确认单信息
+      //   generateConfirmOrder(params).then(res=>{
+      //     this.coupon_list = res.data
+      //     this.coupon_list.couponHistoryDetailList.map(rs=>{
+      //       rs.couponDTO.endTime = changeTime(rs.couponDTO.createTime)
+      //     })
+      //   })
+      // },
 			// 结算按钮
 			handlerSettleBtn(){
         let params = {

+ 1 - 1
src/pages/client/clientUser/serviceCenter.vue

@@ -14,7 +14,7 @@
       <view class="item-box hote-box" >
         <view class="item" v-for='(itm,idx) of item.helpList' @click='handlerSkipDetail(itm)'>
           <view class="item-l">
-            <img class="img" src="@/static/logo.png" alt="" />
+            <img class="img" :src=" itm.icon ? itm.icon : require('@/static/logo.png')" alt="" />
           </view>
           <view class="item-r"> {{ itm.title }} </view>
         </view>

+ 167 - 201
src/pages/client/tabBar/home/index.vue

@@ -9,20 +9,15 @@
             <text class="iconfont icon-chevron-down" />
           </view>
           <view slot="center">
-            <u-search
-              placeholder="请输入搜索内容"
-              :showAction="false"
-              v-model="keyword"
-              @click="$Router.push('/pages/client/clientPackage/search')"
-              :disabled="true"
-            />
+            <u-search placeholder="请输入搜索内容" :showAction="false" v-model="keyword"
+              @click="$Router.push('/pages/client/clientPackage/search')" :disabled="true" />
           </view>
         </u-navbar>
       </view>
 
       <!-- 轮播图 -->
       <view class="home-swiper">
-        <u-swiper :list="swiperList" indicator />
+        <u-swiper :list="swiperUrlList" @click="handlerSwiperSkip" indicator />
       </view>
 
       <!-- 商品分类 -->
@@ -38,22 +33,14 @@
 
       <!-- 热门推荐 -->
       <view class="hot">
-        <u-cell
-          :border="false"
-          value="查看更多"
-          isLink
-          @click="$Router.push('/pages/client/clientPackage/storeHot')"
-        >
+        <u-cell :border="false" value="查看更多" isLink @click="$Router.push('/pages/client/clientPackage/storeHot')">
           <view slot="title" class="hot-title"> 热门推荐 </view>
         </u-cell>
         <block v-if="homeData.recommends && homeData.recommends.length > 0">
           <view>
             <u-grid :border="false" col="2">
-              <u-grid-item
-                @click="$Router.push(`/pages/client/clientPackage/storeDetail?id=${item.id}`)"
-                v-for="item in homeData.recommends"
-                :key="item.id"
-              >
+              <u-grid-item @click="$Router.push(`/pages/client/clientPackage/storeDetail?id=${item.id}`)"
+                v-for="item in homeData.recommends" :key="item.id">
                 <recommend-item :item="item"></recommend-item>
               </u-grid-item>
             </u-grid>
@@ -66,22 +53,14 @@
 
       <!-- 附近商家 -->
       <view class="near">
-        <u-cell
-          :border="false"
-          value="查看更多"
-          isLink
-          @click="$Router.push('/pages/client/clientPackage/storeNearby')"
-        >
+        <u-cell :border="false" value="查看更多" isLink @click="$Router.push('/pages/client/clientPackage/storeNearby')">
           <view slot="title" class="near-title"> 附近商家 </view>
         </u-cell>
         <block v-if="homeData.nears && homeData.nears.length > 0">
           <view>
             <u-grid :border="false" col="2">
-              <u-grid-item
-                @click="$Router.push(`/pages/client/clientPackage/storeDetail?id=${item.id}`)"
-                v-for="item in homeData.nears"
-                :key="item.id"
-              >
+              <u-grid-item @click="$Router.push(`/pages/client/clientPackage/storeDetail?id=${item.id}`)"
+                v-for="item in homeData.nears" :key="item.id">
                 <hot-item :item="item"></hot-item>
               </u-grid-item>
             </u-grid>
@@ -101,195 +80,182 @@
 </template>
 
 <script>
-import { getCurrentLocation, getHomePageApi, getSwiperListApi } from '@/api/client/home';
-import { mapGetters } from 'vuex';
-import RecommendItem from '@/components/merchant/RecommendItem.vue';
-import HotItem from '@/components/merchant/HotItem.vue';
-import dragButton from '@/components/drag/drag-button.vue';
+  import {
+    getCurrentLocation,
+    getHomePageApi,
+    getSwiperListApi
+  } from '@/api/client/home';
+  import {
+    mapGetters
+  } from 'vuex';
+  import RecommendItem from '@/components/merchant/RecommendItem.vue';
+  import HotItem from '@/components/merchant/HotItem.vue';
+  import dragButton from '@/components/drag/drag-button.vue';
 
-export default {
-  components: {
-    RecommendItem,
-    HotItem,
-    dragButton,
-  },
-  data() {
-    return {
-      list: [],
-      keyword: '',
-      // swiperList: [
-      //   'https://cdn.uviewui.com/uview/swiper/swiper1.png',
-      //   'https://cdn.uviewui.com/uview/swiper/swiper2.png',
-      //   'https://cdn.uviewui.com/uview/swiper/swiper3.png',
-      // ],
-      swiperList: [], // 轮播图
-      homeData: {
-        categories: [],
-        nears: [],
-        recommends: [],
-      },
-    };
-  },
-
-  computed: {
-    ...mapGetters(['location']),
-    categories() {
-      let initData = this.homeData.categories.map(item => {
-        if (!item.icon) {
-          item.icon = 'level';
-        }
-        return item;
-      });
-      let result =
-        initData.length > 14
-          ? initData.splice(0, 14).concat([
-              {
-                id: 'all',
-                icon: 'grid-fill',
-                name: '全部',
-                type: {
-                  code: 'ALL',
-                  description: '全部',
-                },
-              },
-            ])
-          : initData.push({
-              id: 'all',
-              icon: 'grid-fill',
-              name: '全部',
-            });
-      return result;
+  export default {
+    components: {
+      RecommendItem,
+      HotItem,
+      dragButton,
     },
-  },
-
-  // watch: {
-  //   location: {
-  //     handler: async function (newVal) {
-  //       const result = await getCurrentLocation({latitude: 36.70864,longitude: 119.13279});
-  //       const param = Object.assign(
-  //         {},
-  //         {
-  //           region: result.data.id,
-  //         },
-  //         newVal,
-  //       );
-  //       this.getHomeData(param);
-  //     },
-  //   },
-  // },
-  onShow() {
-    let params = {
-          region: 370705,
-          longitude: 119.13279,
-          latitude: 36.70864
+    data() {
+      return {
+        list: [],
+        keyword: '',
+        swiperUrlList: [], // 轮播图url列表
+        swiperList:[],
+        homeData: {
+          categories: [],
+          nears: [],
+          recommends: [],
+        },
+        queryParams:{
+          longitude:'',
+          latitude:'',
+          region:''
         }
-        this.getHomeData(params)
-  },
+      };
+    },
 
-  //页面加载
-  async onLoad() {
-    uni.hideTabBar()
-    setTimeout(() => {
-      this.list = new Array(10000).fill(1);
-    }, 5000);
-    uni.getLocation({
-      type: 'gcj02',
-      success: res => {
-        this.location.longitude = res.longitude;
-        this.location.latitude = res.latitude;
-        this.$store.commit('SET_LOCATION', {
-          longitude: res.longitude,
-          latitude: res.latitude,
+    computed: {
+      ...mapGetters(['location']),
+      categories() {
+        let initData = this.homeData.categories.map(item => {
+          if (!item.icon) {
+            item.icon = 'level';
+          }
+          return item;
         });
+        let result =
+          initData.length > 14 ?
+          initData.splice(0, 14).concat([{
+            id: 'all',
+            icon: 'grid-fill',
+            name: '全部',
+            type: {
+              code: 'ALL',
+              description: '全部',
+            },
+          }, ]) :
+          initData.push({
+            id: 'all',
+            icon: 'grid-fill',
+            name: '全部',
+          });
+        return result;
       },
-      fail: () => {
-        this.manualGetLocation();
-      },
-    });
-  },
-  mounted() {
-    this.getSwiperList();
-  },
-  methods: {
-    /* 轮播图 */
-    getSwiperList() {
-      getSwiperListApi().then(res => {
-        res.data.map(rs=>{
-          this.swiperList.push(rs.viewUrl)
-        })
-        console.log('this.swiperList',this.swiperList);
-      });
     },
 
-    // 获取首页数据
-    getHomeData(location) {
-      getHomePageApi(location)
-        .then(res => {
-          this.homeData = res.data;
-          // 将分类数据做缓存处理
-          this.$store.commit('SET_CATEGORIES', this.homeData.categories);
-        })
-        .catch(err => {
-          console.log(err);
+    onShow() {
+      // 页面显示时  获取当前零维度
+        uni.getLocation({
+          type: 'gcj02',
+          success: res => {
+            this.queryParams.longitude = res.longitude;
+            this.queryParams.latitude = res.latitude;
+            // getCurrentLocation 获取当前编码region
+            getCurrentLocation({latitude: res.latitude,longitude: res.longitude}).then(rs=>{
+              this.queryParams.region = rs.data.id;
+              this.getHomeData(this.queryParams)
+              this.$store.commit('SET_LOCATION', {
+                longitude: res.longitude,
+                latitude: res.latitude,
+                region: rs.data.id,
+              });
+            })
+          },
+          fail: () => {
+            this.manualGetLocation();
+          },
         });
     },
+    mounted() {
+      this.getSwiperList();
+    },
+    methods: {
+      /* 轮播图 */
+      getSwiperList() {
+        getSwiperListApi().then(res => {
+          this.swiperList = res.data
+          res.data.map(rs => {
+            this.swiperUrlList.push(rs.viewUrl)
+          })
+        });
+      },
+      // 获取首页数据
+      getHomeData(location) {
+        getHomePageApi(location)
+          .then(res => {
+            this.homeData = res.data;
+            // 将分类数据做缓存处理
+            this.$store.commit('SET_CATEGORIES', this.homeData.categories);
+          })
+          .catch(err => {
+            console.log(err);
+          });
+      },
+      // 手动选择城市
+      manualGetLocation() {
+        console.log("@@@@")
+        // uni.chooseLocation({
+        //   success: res => {
+        //     this.$store.commit('SET_LOCATION', {
+        //       longitude: res.longitude,
+        //       latitude: res.latitude,
+        //     });
+        //   },fail:err=>{
 
-    // 手动选择城市
-    manualGetLocation() {
-      uni.chooseLocation({
-        success: res => {
-          this.$store.commit('SET_LOCATION', {
-            longitude: res.longitude,
-            latitude: res.latitude,
+        //   }
+        // });
+      },
+      // 点击swiper跳转
+      handlerSwiperSkip(e){
+        console.log("@@@swiperList", this.swiperList[e])
+      },
+      // 点击菜单
+      handleMenuClick(item) {
+        if (item.id === 'all') {
+          this.$Router.push('/pages/client/clientPackage/category');
+        } else {
+          uni.navigateTo({
+            url: `/pages/client/clientPackage/storeList?id=${item.id}`,
           });
-        },
-      });
-    },
+        }
+      },
+
+      /* 询价 */
+      btnClick() {
+        // uni.chooseImage({
+        //   count: 9,
+        //   sizeType: ['original', 'compressed'],
+        //   sourceType: ['camera', 'album'],
+        //   success: res => {
+        //     const tempFilePaths = res.tempFilePaths;
+        //     this.uploadFileAlbum();
+        //   },
+        // });
 
-    // 点击菜单
-    handleMenuClick(item) {
-      if (item.id === 'all') {
-        this.$Router.push('/pages/client/clientPackage/category');
-      } else {
         uni.navigateTo({
-          url: `/pages/client/clientPackage/storeList?id=${item.id}`,
+          url: `/pages/client/clientUser/inquiry`,
         });
-      }
-    },
-
-    /* 询价 */
-    btnClick() {
-      // uni.chooseImage({
-      //   count: 9,
-      //   sizeType: ['original', 'compressed'],
-      //   sourceType: ['camera', 'album'],
-      //   success: res => {
-      //     const tempFilePaths = res.tempFilePaths;
-      //     this.uploadFileAlbum();
-      //   },
-      // });
-
-      uni.navigateTo({
-        url: `/pages/client/clientUser/inquiry`,
-      });
-    },
+      },
 
-    uploadFileAlbum() {
-      uni.uploadFile({
-        url: '', //服务器地址
-        fileType: 'image', //ZFB必填,不然报错
-        filePath: tempFilePaths[0], //这个就是我们上面拍照返回或者先中照片返回的数组
-        name: 'imgFile',
-        success: uploadFileRes => {
-          let imgData = JSON.parse(uploadFileRes.data);
-          this.imgDataUrl = imgData.data.imgUrl;
-        },
-      });
+      // uploadFileAlbum() {
+      //   uni.uploadFile({
+      //     url: '', //服务器地址
+      //     fileType: 'image', //ZFB必填,不然报错
+      //     filePath: tempFilePaths[0], //这个就是我们上面拍照返回或者先中照片返回的数组
+      //     name: 'imgFile',
+      //     success: uploadFileRes => {
+      //       let imgData = JSON.parse(uploadFileRes.data);
+      //       this.imgDataUrl = imgData.data.imgUrl;
+      //     },
+      //   });
+      // },
     },
-  },
-};
+  };
 </script>
 
 <style lang="scss" scoped>
-@import './index.scss';
+  @import './index.scss';
 </style>

+ 1 - 0
src/store/modules/data.js

@@ -5,6 +5,7 @@ export default {
     location:  {
       longitude: 0,
       latitude: 0,
+      region:null
     },
     categories:  [],
     storeInfo:  {},  //店铺信息

+ 0 - 1
src/utils/request.js

@@ -31,7 +31,6 @@ instance.interceptors.request.use((config) => {
 })
 
 instance.interceptors.response.use(async (res) => {
-  console.log("->", res)
   uni.hideLoading()
   const { code,data } = res.data
   if (data&&data.accessToken) {

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.