Jelajahi Sumber

当hasMap为0时,选择跑腿(或同城配送)送货会提示:地图服务停用,无法使用快递服务

shizhongqi 11 bulan lalu
induk
melakukan
feebc80b13

+ 13 - 4
hdApp/src/admin/order/modify.vue

@@ -3,9 +3,7 @@
   <view class="affirm-page">
     <view class="affirm-view overscroll">
       <form>
-
-        <app-delivery-module ref="appDelivery" @changeAddress="changeAddress" :info.sync="orderInfo" />
-
+        <app-delivery-module ref="appDelivery" @changeAddress="changeAddress" :info.sync="orderInfo" :hasMap="hasMap" />
       </form>
     </view>
     <view class="under-bar">
@@ -22,6 +20,7 @@ import AppDeliveryModule from "@/components/app-delivery-modify";
 import { updateOrder } from "@/api/order";
 import { mapGetters } from "vuex";
 import { getDetB} from "@/api/order";
+import { getHasMap } from "@/api/express";
 export default {
   name: "modify",
   components: {
@@ -39,12 +38,16 @@ export default {
       categorySelectedData:{},
       currentImgData:[],
       dj:'',
-      orderInfo: {}
+      orderInfo: {},
+      hasMap: 0 // 是否具备定位功能 0不具备 1具备
     };
   },
   onLoad (option) {
     const token = uni.getStorageSync('token')
     this.headers.token = token
+    getHasMap().then(res => {
+      this.hasMap = (res.data && res.data.hasMap) ? res.data.hasMap : 0
+    })
   },
   computed: {
     ...mapGetters(["getLoginInfo"])
@@ -66,6 +69,12 @@ export default {
     confirmToSubmit () {
       let that = this
       that.form = {...that.$refs.appDelivery.form}
+
+      if(that.hasMap == 0 && that.form.sendType == 3) {
+        that.$msg('由于地图定位服务停用,无法使用骑手送')
+        return false
+      }
+      
       that.$util.confirmModal({content:'确认提交?'},() => {
           updateOrder({...that.form,id:that.orderInfo.id}).then((res) => {
             if(res.code == 1){

+ 43 - 9
hdApp/src/components/app-delivery-modify.vue

@@ -65,10 +65,20 @@
           <view class="tui-input" v-if="form.province || form.city" >{{ form.province + '-' + form.city }}</view> <view class="tui-placeholder" v-else>请选择</view>
         </tui-list-cell>
 
-        <tui-list-cell class="line-cell" :hover="false">
+        <!-- <tui-list-cell class="line-cell" :hover="false">
           <view class="tui-title">详细地址</view>
           <input v-model="form.address" placeholder-class="phcolor" placeholder-style="color:#ccc" class="tui-input" name="address" placeholder="请填写地址" @input="changeAddress()" />
-        </tui-list-cell>
+        </tui-list-cell> -->
+        <tui-list-cell v-if="hasMap == 0" class="line-cell" :hover="false">
+					<view class="tui-title">详细地址</view>
+					<input v-model="form.address" placeholder-class="phcolor" class="tui-input" name="address" @input="changeAddress" placeholder="请填写详细地址" />
+				</tui-list-cell>
+				<tui-list-cell v-else class="line-cell" :hover="false" :arrow="true" @click="selectRegion">
+					<view class="tui-title">详细地址</view>
+					<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>
@@ -98,12 +108,12 @@
 
     <!-- 省市联动 -->
     <simple-address ref="simpleAddress" :region="regionTree" :pickerValueDefault="cityPickerValueDefault" @onConfirm="getCityConfirm" ></simple-address>
-
+    <!-- 选择地区 -->
+		<app-area-sel :show.sync="showRegion" :city="form.city" @change="changeAreaFn" />
   </view>
 </template>
 
 <script>
-import { mapGetters } from "vuex";
 import TuiListCell from "@/components/plugin/list-cell";
 import AppDatePicker from "@/components/app-date-picker";
 import SimpleAddress from "@/components/plugin/simple-address";
@@ -125,6 +135,10 @@ export default {
 			type: Object,
 			default: {}
 		},
+    hasMap: { // 是否具备定位功能 0不具备 1具备
+      type: Number,
+      default: 0
+    }
   },
   data() {
     return {
@@ -137,6 +151,7 @@ export default {
         receiveMobile: "",
         province: "",
         city: "",
+        dist: "",
         address: "",
         showAddress:"",
         floor: "",
@@ -155,9 +170,9 @@ export default {
       regionTree:[],
       cityPickerValueDefault: [0, 0],
       timeOptions: [
-			['00', '01', '02','03','04','05','06','07','08','09','10','11','12','13', '14','15','16','17','18','19','20','21','22','23'],
-			['00', '05', '10','15','20','25','30','35','40','45','50','55']
-		],
+        ['00', '01', '02','03','04','05','06','07','08','09','10','11','12','13', '14','15','16','17','18','19','20','21','22','23'],
+        ['00', '05', '10','15','20','25','30','35','40','45','50','55']
+      ]
     };
   },
   mounted() {
@@ -209,7 +224,6 @@ export default {
 
           this.form.lat = newVal.lat
           this.form.long = newVal.long
-
         }
 			},
 			immediate:true
@@ -247,7 +261,27 @@ export default {
     getCityConfirm(e) {
       this.form.province = e.provinceName;
       this.form.city = e.cityName;
-    }
+    },
+    selectRegion() {
+			if (!this.form.city) {
+				this.$msg('请先选择城市!')
+				return false
+			}
+			this.showRegion = true
+		},
+    changeAreaFn(e) {
+			this.form.address = e.name
+			let locationStr = e.location
+			let fruits = locationStr.split(",").map(fruit => fruit.trim())
+			this.form.lat = fruits[1]
+			this.form.long = fruits[0]
+			this.form.showAddress = e.address
+
+			// 提取地区信息,按遇到第一个"市"字后,把"市"后面的字符串作为地区
+			const districtStr = e.district || '';
+			const cityIndex = districtStr.indexOf('市');
+			this.form.dist = cityIndex !== -1 ? districtStr.substring(cityIndex + 1) : districtStr;
+		},
   }
 };
 </script>

+ 2 - 1
hdApp/src/pages.json

@@ -408,7 +408,8 @@
 		{
 			"root": "admin/express",
 			"pages": [
-				{ "path": "create", "style": { "navigationBarTitleText": "配送信息" } }
+				{ "path": "create", "style": { "navigationBarTitleText": "配送信息" } },
+				{ "path": "success", "style": { "navigationBarTitleText": "配送成功" } }
 			]
 		},
 		{

+ 8 - 0
mallApp/src/pages/billing/affirmGhs.vue

@@ -320,6 +320,14 @@ export default {
 					return false
 				}
 			}
+			if(this.form.sendType == 2 && this.form.sendCost <= 0) {
+				this.$msg('选择代叫跑腿,必须获取运费')
+				return false
+			}
+			if(this.form.sendType == 2 && this.form.hasMap == 0) {
+				this.$msg('由于地图定位服务停用,无法使用代叫跑腿')
+				return false
+			}
 			uni.showLoading({mask:true})
 			buyItem(params).then(res => {
 				uni.hideLoading()

+ 8 - 0
mallApp/src/pages/order/buy.vue

@@ -191,6 +191,14 @@ export default {
     createOrderFn() {
       let form = {}
       if (this.form.sendType == 2) {
+        if(this.form.hasMap == 0) {
+          this.$msg('由于地图定位服务停用,无法使用代叫跑腿')
+          return
+        }
+        if(this.form.freightPrice <= 0) {
+          this.$msg('选择代叫跑腿,必须获取运费')
+          return
+        }
         const deliveryRef = this.$refs.appDelivery
         if(!deliveryRef || !deliveryRef.form){
           this.$msg("请完善配送信息")