Browse Source

开启定位(设置经纬)然后寻找附近批发店

shizhongqi 4 tháng trước cách đây
mục cha
commit
12b10123d4

+ 49 - 10
hdApp/src/admin/home/workbench.vue

@@ -64,7 +64,7 @@
                       <view class="section_1 flex-col">
                         <image class="logo" :src="ghsInfo.smallAvatar" @click="enterShop(ghsInfo)" />
                       </view>
-                      <view class="text-group_7 flex-col justify-between" @click="enterShop(ghsInfo)">
+                      <view class="text-group_7 flex-col justify-center" @click="enterShop(ghsInfo)">
                         <text class="text_8">{{ghsInfo.name}}</text>
                         <text class="text_9">
     
@@ -86,6 +86,7 @@
                           </block>
     
                         </text>
+                        <text class="text_distance" v-if="ghsInfo.distance && ghsInfo.distance > 0">{{ Math.round(Number(ghsInfo.distance) / 1000) }}km</text>
                       </view>
                     </view>
                     <view class="box_4 flex-col"></view>
@@ -156,7 +157,19 @@
             </template>
 
             <block v-else>
-              <view style="margin:60upx auto 40upx auto;font-weight:bold;font-size:36upx;text-align: center;">暂无批发店</view>
+              <view v-if="isWithinTwoDays" style="margin:60upx auto 40upx auto;font-weight:bold;font-size:36upx;text-align: center;color:#999;">附近暂无批发店</view>
+              <block v-else>
+                <view v-if="!shopInfo.lat || !shopInfo.long" style="display:flex;flex-direction:column;align-items:center;margin-top:100upx;margin-bottom:100upx;">
+                  <zui-svg-icon icon="general-location" :width="40" :height="40" color="#09C567"/>
+                  <view style="font-size:36upx;color:#999;font-weight:bold;margin-bottom:40upx;">开启定位,查看附近批发店</view>
+                  <button style="background-color:#09C567;color:#fff;width:240upx;border-radius:10upx;" @click="pageTo({url:'/admin/shop/add?id='+loginInfo.shopId+'&openLocation=1'})">开启</button>
+                </view>
+                <view v-else style="display:flex;flex-direction:column;align-items:center;margin-top:100upx;margin-bottom:100upx;">
+                  <zui-svg-icon icon="general-location" :width="40" :height="40" color="#09C567"/>
+                  <view style="font-size:36upx;color:#999;font-weight:bold;margin-bottom:40upx;">寻找附近批发店</view>
+                  <button style="background-color:#09C567;color:#fff;width:240upx;border-radius:10upx;" @click="searchGhs()">寻找</button>
+                </view>
+              </block>
             </block>
   
             <view style="text-align:center;margin-top:50upx;margin-bottom:50upx;color:#827171;font-size:32upx;" @click="toPhone()">
@@ -216,10 +229,9 @@
   import { consoleIndex } from "@/api/workbench";
   import autoUpdateMixins from "@/mixins/autoUpdate";
   import { ghsList } from "@/api/purchase";
-  import { changeDelStatus,hasMoreGhs } from "@/api/ghs";
+  import { changeDelStatus,hasMoreGhs,searchNearbyGhs } from "@/api/ghs";
   import {currentShop, uploadShopAvatar} from "@/api/shop";
   import { clearLogin,hasNotice } from "@/api/admin";
-  import { unReadMsgCount } from "@/api/chat";
   import { APIHOST } from "@/config";
   export default {
     name: "workbench",
@@ -251,10 +263,16 @@
         shortUrlList:[],
         unReadMsgNum:0, //未读消息数
         showBoughtTooltip: false, // 是否显示买花记录提示
+        supplierSearchTime: 0, // 查找附近批发店时间
       };
     },
     computed: {
-      ...mapGetters({ loginInfo: "getLoginInfo",dictInfo:"getDictionariesInfo",myShopInfo:"getMyShopInfo" })
+      ...mapGetters({ loginInfo: "getLoginInfo",dictInfo:"getDictionariesInfo",myShopInfo:"getMyShopInfo" }),
+      isWithinTwoDays() {
+        if (!this.supplierSearchTime) return false;
+        const twoDays = 2 * 24 * 60 * 60 * 1000;
+        return (Date.now() - this.supplierSearchTime) < twoDays;
+      }
     },
     watch: {
       //只需要采购花材的花店不显示底部菜单
@@ -279,14 +297,15 @@
         const isClosed = uni.getStorageSync('boughtTooltipClosed');
         this.showBoughtTooltip = (isClosed !== true && isClosed !== 'true' && isClosed !== '1');
       
+        this.supplierSearchTime = uni.getStorageSync('supplier_search_time') || 0;
+
         this.init();
     
         // 判断是否登录
         if(!this.$util.isEmpty(this.loginInfo.admin) && this.loginInfo.admin.currentShopId > 0){
             this.handleLoginStyle()  
-            this.showShopName()
+            //this.showShopName()
         }
-
     },
     onShareAppMessage(res) {
       if (res.from === 'button') {
@@ -313,7 +332,7 @@
         this.showBoughtTooltip = false;
         uni.setStorageSync('boughtTooltipClosed', '1');
       },
-    onChooseAvatar(e){
+      onChooseAvatar(e){
         if(this.loginInfo && this.loginInfo.staff && this.loginInfo.staff.founder != 2){
           this.$msg('门店LOGO请老板修改')
           return
@@ -728,6 +747,18 @@
           return false
         }
         // #endif
+      },
+      searchGhs(){
+        searchNearbyGhs().then(res=>{
+          if(res.code == 1){
+            uni.setStorageSync('supplier_search_time', Date.now()) //设置缓存时间--记录当前查找附近批发店的时间
+            //重新刷新列表
+            this.getGHSList()
+            this.$msg('查找成功')
+          }else{
+            this.$msg(res.msg)
+          }
+        })
       }
     }
   };
@@ -878,8 +909,10 @@
           }
           .text-group_7 {
             width: 533upx;
-            height: 99upx;
+            min-height: 99upx;
+            height: auto;
             margin-top: 5upx;
+            justify-content: center;
             .text_8 {
               display:inline-block;
               width: 550upx;
@@ -891,6 +924,7 @@
               white-space: nowrap;
               line-height:38upx;
               overflow:hidden;
+              margin-bottom: 12upx;
             }
             .text_9 {
               width: 533upx;
@@ -901,7 +935,12 @@
               text-align: left;
               white-space: nowrap;
               line-height: 24upx;
-              margin-top: 10upx;
+              margin-bottom: 10upx;
+            }
+            .text_distance {
+              font-size: 26upx;
+              color: #666;
+              line-height: 24upx;
             }
           }
         }

+ 16 - 9
hdApp/src/admin/shop/add.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="app-content">
-		<form @submit="formSubmit" @reset="formReset">
+		<form @submit="formSubmit">
 			<view class="module-com input-line-wrap">
 				<tui-list-cell class="line-cell" :hover="false" v-if="merchantName!=''">
 					<view class="tui-title">门店名称</view>
@@ -178,7 +178,8 @@ export default {
 				img: [],
 				default:0,
 				superWx:[],
-				rechargeWeal: 0
+				rechargeWeal: 0,
+				openLocation:0 // 是否开启定位 0不开启 1开启
 			},
 			hasMap:0, // 是否具备地址功能 0不具备 1具备
 			showRegion: false,
@@ -212,13 +213,13 @@ export default {
 		init() {
 
 		},
-	defaultChange(e){
-		this.form.default = e.target.value ? 1 : 0
-	},
-	updateRechargeWeal(value){
-		this.form.rechargeWeal = value
-	},
-	imgUploadSuccess(res) {
+		defaultChange(e){
+			this.form.default = e.target.value ? 1 : 0
+		},
+		updateRechargeWeal(value){
+			this.form.rechargeWeal = value
+		},
+		imgUploadSuccess(res) {
 			var imgReturn = JSON.parse(res.data)
 			if(imgReturn.code == 1){
 				this.currentImgData.push(imgReturn.data.smallUrl)
@@ -333,6 +334,7 @@ export default {
 			if(Array.isArray(this.form.superWx) && !this.$util.isEmpty(this.form.superWx)){
 				superWx = this.form.superWx[0]
 			}
+			this.form.openLocation = this.option.openLocation ? 1 : 0
 			this.form = {...this.form,...this.region,superWx:superWx}
 			uni.showLoading({mask:true})
 			hostFn(this.form).then(res => {
@@ -340,6 +342,11 @@ export default {
 				let promptText = this.option.id ? '修改成功!' : '添加成功!'
 				this.$msg(promptText)
 				uni.removeStorageSync('currentShopInfo')
+				
+				// 设置缓存时间--记录当前查找附近批发店的时间
+				if (this.option.openLocation) {
+					uni.setStorageSync('supplier_search_time', Date.now())
+				}
 
 				uni.navigateBack({})
 

+ 4 - 0
hdApp/src/api/ghs/index.js

@@ -68,4 +68,8 @@ export const balanceChangeList = data => {
 
 export const getRechargeList = data => {
 	return https.get('/ghs-recharge/list', data)
+}
+
+export const searchNearbyGhs = data => {
+	return https.get('/ghs/search-nearby-ghs', data)
 }

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
hdApp/src/assets/svg-icons/general/location.svg


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 5 - 1
hdApp/src/static/svg-icons-lib.js


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác