shish 1 год назад
Родитель
Сommit
9f5aa140e6

+ 32 - 5
hdApp/src/admin/shop/add.vue

@@ -73,9 +73,11 @@
 					<view class="tui-placeholder" v-else>请选择</view>
 					<input v-model="form.province" name="province" hidden />
 				</tui-list-cell>
-				<tui-list-cell class="line-cell" :hover="false">
+				<tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="selectRegion">
 					<view class="tui-title">所在地址</view>
-					<input v-model="form.address" placeholder-class="phcolor" class="tui-input" name="address" placeholder="请填写地址" />
+					<view class="tui-input" v-if="form.address">{{ form.address }}</view>
+					<view class="tui-placeholder" v-else>请填写详细地址</view>
+					<input v-model="form.address" name="address" hidden />
 				</tui-list-cell>
 				<tui-list-cell class="line-cell" :hover="false">
 					<view class="tui-title ">门牌号</view>
@@ -108,6 +110,8 @@
 		</form>
 		<!-- 省市联动 -->
 		<simple-address ref="simpleAddress" :pickerValueDefault="cityPickerValueDefault" @onConfirm="onCityConfirm"></simple-address>
+		<!-- 选择地区 -->
+		<app-area-sel :show.sync="showRegion" :city="form.city" @change="changeAreaFn" />
 	</view>
 </template>
 
@@ -158,10 +162,12 @@ export default {
 				default:0,
 				superWx:[]
 			},
+			showRegion: false,
 			region: {
-				lat: 10,
-				long: 11
+				lat: 0,
+				long: 0
 			},
+			regionData: [],
 			cityPickerValueDefault: [0, 0],
 			img: [],
       		headers:{token:''},
@@ -214,6 +220,8 @@ export default {
 					Object.keys(this.form).forEach((i, index) => {
 						this.form[i] = data[i]
 					})
+					this.region.lat = data.lat
+					this.region.long = data.long
 
 					// 营业时间初始化
 					this.visible = this.form.open == 1 ? true : false
@@ -262,10 +270,28 @@ export default {
 				this.end_time = '18:00'
 			}
 		},
+		selectRegion() {
+			if (!this.form.city) {
+				this.$msg('请先选择城市!')
+				return false
+			}
+			this.showRegion = true
+		},
 		_resultData(val) {
 			console.log(val)
 			this.form.img = val;
 		},
+		changeAreaFn(e) {
+			this.form.address = e.name
+
+			let locationStr = e.location
+			let fruits = locationStr.split(",").map(fruit => fruit.trim())
+
+			this.region.lat = fruits[1]
+			this.region.long = fruits[0]
+			this.form.showAddress = e.address
+		},
+		// 省市联动
 		openAddres() {
 			this.$refs.simpleAddress.open()
 		},
@@ -273,6 +299,8 @@ export default {
 			this.form.province = e.provinceName
 			this.form.city = e.cityName
 			this.form.address = ''
+			this.region.lat = 0
+			this.region.long = 0
 		},
 		confirmFn() {
 			let hostFn = this.option.id ? update : add
@@ -283,7 +311,6 @@ export default {
 			if(Array.isArray(this.form.superWx) && !this.$util.isEmpty(this.form.superWx)){
 				superWx = this.form.superWx[0]
 			}
-			this.form.showAddress = this.form.city+this.form.address+this.form.floor
 			this.form = {...this.form,...this.region,superWx:superWx}
 			uni.showLoading({mask:true})
 			hostFn(this.form).then(res => {

+ 2 - 2
hdApp/src/components/app-area-sel.vue

@@ -26,7 +26,7 @@
 					<view v-for="(item,index) in nearListData" :key="index" @click="switchAddress(item,index)" class="near-item">
 						<div class="current-site" :class="{'active' : currentSelectAddress === index}"></div>
 						<view>
-							<view :class="['title',currentSelectAddress === index? 'title1':'']">{{item.title}}</view>
+							<view :class="['title',currentSelectAddress === index? 'title1':'']">{{item.name}}</view>
 							<view class="add">{{item.address}}</view>
 						</view>
 					</view>
@@ -99,7 +99,7 @@
 					return false
 				}
 				suggestion({ region: this.city, keyword: this.keyword }).then(res => {
-					this.nearListData = res.data.data
+					this.nearListData = res.data.tips ? res.data.tips : []
 				})
 			},
 			// 搜索

+ 4 - 16
mallApp/src/components/app-area-sel.vue

@@ -6,26 +6,14 @@
           <div class="map-top-tit">选择收货地址</div>
           <app-close icon="iconguanbi" @close="hidePopup" />
         </div>
-        <!-- 搜索 -->
         <div class="map-search">
-          <app-search-module
-            ref="aaaaa"
-            placeholder="请输入你的收货地址"
-            :focus="isFocus"
-            @input="searchFn"
-          />
+          <app-search-module ref="aaaaa" placeholder="请输入你的收货地址" :focus="isFocus" @input="searchFn" />
         </div>
-        <!-- 列表 -->
         <scroll-view class="near-list" scroll-y>
-          <view
-            v-for="(item,index) in nearListData"
-            :key="index"
-            @click="switchAddress(item,index)"
-            class="near-item"
-          >
+          <view v-for="(item,index) in nearListData" :key="index" @click="switchAddress(item,index)" class="near-item" >
             <div class="current-site" :class="{'active' : currentSelectAddress === index}"></div>
             <view>
-              <view :class="['title',currentSelectAddress === index? 'title1':'']">{{item.title}}</view>
+              <view :class="['title',currentSelectAddress === index? 'title1':'']">{{item.name}}</view>
               <view class="add">{{item.address}}</view>
             </view>
           </view>
@@ -107,7 +95,7 @@ export default {
         return false;
       }
       suggestion({ region: this.city, keyword: this.keyword }).then(res => {
-        this.nearListData = res.data.data;
+        this.nearListData = res.data.tips ? res.data.tips : [];
       });
     },
     // 搜索

+ 9 - 22
mallApp/src/components/app-delivery.vue

@@ -66,29 +66,14 @@
     <div class="module-com remark-wrap">
       <tui-list-cell class="line-cell" :hover="false">
         <div class="tui-title">其它备注</div>
-        <input
-          v-model="form.remark"
-          placeholder-class="phcolor"
-          placeholder-style="color:#ccc"
-          class="tui-input"
-          name="remark"
-          placeholder="请填写备注信息(选填)"
-        />
+        <input v-model="form.remark" placeholder-class="phcolor" placeholder-style="color:#ccc" class="tui-input" name="remark" placeholder="请填写备注信息(选填)" />
       </tui-list-cell>
     </div>
     <!-- 省市联动 -->
-    <simple-address
-      ref="simpleAddress"
-      :region="orderShop.region"
-      :pickerValueDefault="cityPickerValueDefault"
-      @onConfirm="onCityConfirm"
-    ></simple-address>
+    <simple-address ref="simpleAddress" :region="orderShop.region" :pickerValueDefault="cityPickerValueDefault" @onConfirm="onCityConfirm" >
+    </simple-address>
     <!-- 选择地区 -->
-    <app-area-sel
-      :isFocus="false"
-      :show.sync="showRegion" 
-      :city="form.city" 
-      @change="changeAreaFn" />
+    <app-area-sel :isFocus="false" :show.sync="showRegion" :city="form.city" @change="changeAreaFn" />
   </div>
 </template>
 
@@ -177,10 +162,12 @@ export default {
     },
     changeAreaFn(e) {
       console.log("changeAreaFn", e);
-      this.form.address = e.title;
+      this.form.address = e.name;
       this.form.showAddress = e.address;
-      this.region.latitude = e.location.lat;
-      this.region.longitude = e.location.lng;
+      let locationStr = e.location
+      let fruits = locationStr.split(",").map(fruit => fruit.trim());
+      this.region.latitude = fruits[1];
+      this.region.longitude = fruits[0];
       this.$emit("changeAddress", e);
     },
     anonymityChange(e) {

+ 4 - 3
mallApp/src/pages/order/buy.vue

@@ -166,11 +166,12 @@ export default {
         }
       }
       uni.showLoading({mask:true})
-      createOrder({...form, ...this.form}).then(res => {
+      let hdId = this.option.hdId?this.option.hdId:0
+      createOrder({...form, ...this.form,hdId:hdId}).then(res => {
         uni.hideLoading()
         uni.removeStorageSync("buyGoodsDetil")
-        this.$util.pageTo({ url: "/pages/callback/index", type: 2, query: { pageStatus: 1, ...res.data } })
-      });
+        this.$util.pageTo({ url: "/pages/callback/index", type: 2, query: { pageStatus: 1, ...res.data,hdId:hdId } })
+      })
     }
   }
 };