Procházet zdrojové kódy

商品详情-立即购买新增收货方式选择

gcz před 1 rokem
rodič
revize
63b97c7dfc
1 změnil soubory, kde provedl 87 přidání a 16 odebrání
  1. 87 16
      shopping/submitorder.vue

+ 87 - 16
shopping/submitorder.vue

@@ -8,7 +8,7 @@
 			 :safeAreaInsetTop="true"
 		>
 		</u-navbar>
-	<!-- 	<view class="page-wrap receive-way u-flex">
+		<view class="page-wrap receive-way u-flex">
 			<view class="til">
 				提货方式
 			</view>
@@ -16,9 +16,9 @@
 				<text class="icon"></text>
 				<text class="text">{{item|filterLogisticsType}}</text>
 			</view>
-		</view> -->
+		</view>
 		 <!-- v-if="logisticsType!=1" -->
-        <view class="addr page-wrap u-flex u-row-between">
+        <view class="addr page-wrap u-flex u-row-between" v-if="logisticsType!=1">
         	<view class="left">
         		<view class="top">
         			<text class="label" v-if="orderInfo.receive.ifDefault">默认</text>{{receive.address}}
@@ -28,36 +28,36 @@
         	</view>
 			<u-icon name="arrow-right" color="#676767" size="20" @click="selectAddr"></u-icon>
         </view>
-		<!-- <view class="page-wrap pickup-info" v-else>
-			<view class="item u-flex u-row-between">
+		<view class="page-wrap pickup-info" v-else>
+			<view class="item u-flex u-row-between"  @click="selectAddr">
 				<view class="left">
 					提货人:
-					<text>张小娴</text>
-					<text>15534567778</text>
+					<text>{{pickupInfo.pickupName}}</text>
+					<text>{{pickupInfo.pickupMobile}}</text>
 				</view>
 				<view class="right">
 					<u-icon name="arrow-right" color="#676767" size="20"></u-icon>
 				</view>
 			</view>
-			<view class="item u-flex u-row-between">
+			<view class="item u-flex u-row-between" @click="pickupTimeShow=true">
 				<view class="left">
 					预约提货时间:
-					<text>2023年12月23日  15:00:00</text>
+					<text>{{pickupInfo.pickupTime}}</text>
 				</view>
 				<view class="right">
 					<u-icon name="arrow-right" color="#676767" size="20"></u-icon>
 				</view>
 			</view>
 			<view class="item u-flex u-row-between">
-				<view class="left">
-					自提地点:
-					<text>贵州省贵阳市南明区河滨街道茅…:</text>
+				<view class="left u-flex">
+					<text style="flex: 1;white-space: nowrap;">自提地点:</text>
+					<text class="ellipsis-1">{{pickupInfo.pickupAddress}}</text>
 				</view>
 				<view class="right">
-					<u-icon name="arrow-right" color="#676767" size="20"></u-icon>
+					<u-icon  @click="goMap" :name="staticUrl+'/img/go-map-icon-y.png'" color="#676767" size="20"></u-icon>
 				</view>
 			</view>
-		</view> -->
+		</view>
 		<!-- <view class="payway page-wrap u-flex u-row-between">
 			<view class="left">支付方式</view>
 			<view class="u-flex">
@@ -157,12 +157,23 @@
 				</view>
 			</view>
 		</view>
+		<u-datetime-picker
+				:show="pickupTimeShow"
+				v-model="pickupTime"
+				@cancel="pickupTimeShow=false"
+				:formatter="formatter"
+				mode="datetime"
+				:minDate="new Date().getTime()"
+				@confirm="confirmDate"
+		></u-datetime-picker>
+		<!-- :maxDate="new Date().setDate(new Date().getDate() + 10)" -->
     </view>
 </template>
 <script>
     export default {
         data() {
             return {
+				staticUrl:this.$commonConfig.staticUrl,
 				cansubmit:true,
 				fromPage:'',
 				useIntegral:false,
@@ -180,7 +191,16 @@
 				receiveWayList:[],//
 				selectReceiveIndex:0,
 				logisticsType:0,//物流方式默认值
-				pickupInfo:{}
+				pickupInfo:{
+					pickupName:'',
+					pickupMobile:'',
+					pickupTime:'',
+					pickupAddress:'',
+					pickupLongitude:'',
+					pickupLatitude:''
+				},
+				pickupTime:'',
+				pickupTimeShow:false,
             }
         },
 		onLoad(page) {
@@ -203,6 +223,12 @@
 				this.orderInfo.goodsList = this.buyNowGoods;
 			}
 			this.settlement();
+			// 默认提货时间
+			let now = Number(new Date());
+			this.pickupInfo.pickupTime = uni.$u.timeFormat(now, 'yyyy-mm-dd  hh:MM:ss');
+			this.pickupTime = now;
+			//商行信息
+			this.getIntro();
 		},
 		onUnload() {
 		    this.$u.vuex('buyNowGoods',[]);
@@ -234,6 +260,43 @@
 			}
 		},
         methods: {
+			formatter(type, value) {
+				if (type === 'year') {
+					return `${value}年`
+				}
+				if (type === 'month') {
+					return `${value}月`
+				}
+				if (type === 'day') {
+					return `${value}日`
+				}
+				return value
+			},
+			confirmDate(e){
+				this.pickupTimeShow = false;
+				this.pickupInfo.pickupTime = uni.$u.timeFormat(e.value, 'yyyy-mm-dd  hh:MM:ss');
+				this.pickupTime = e.value;
+				// console.log('pickupTime',this.pickupInfo.pickupTime);
+			},
+			getIntro(){
+				this.$u.api.xsGetIntro().then(res=>{
+					// console.log('xsGetIntro',res.data);
+					this.pickupInfo.pickupAddress = res.data.shopAddress;
+					this.pickupInfo.pickupLongitude = res.data.shopLongitude;
+					this.pickupInfo.pickupLatitude = res.data.shopLatitude;
+				}).catch(err=>{
+					console.log('xsGetIntro',err.data);
+				})
+			},
+			goMap(){
+				uni.openLocation({
+				  latitude:this.pickupInfo.pickupLatitude,	//维度
+				  longitude: this.pickupInfo.pickupLongitude, //经度
+				  name: "商行地址",	//目的地定位名称
+				  scale: 15,	//缩放比例
+				  address: this.pickupInfo.pickupAddress	//导航详细地址
+				})
+			},
 			leftClick(e){
 				console.log('leftClick',e);
 			},
@@ -315,7 +378,8 @@
 					logisticsType,
 					orderTotalCredit } = jsonData || {};
 				this.receiveWayList = logisticsType.split(",");//支持的物流方式
-				console.log('orderTotalCredit',orderTotalCredit);
+				// console.log('orderTotalCredit',orderTotalCredit);
+				// console.log('receive',receive);
 				this.orderInfo = jsonData;
 				this.receive = receive;
 				this.distribution = distribution;//物流信息
@@ -324,6 +388,10 @@
 				this.userTotalBalance = userTotalBalance;//	用户总余额
 				this.userTotalCredit = userTotalCredit;//	用户总积分
 				this.orderTotalCredit = orderTotalCredit;//订单需要的总积分
+				// pickupInfo
+				this.pickupInfo.pickupName = receive.receiveName;
+				this.pickupInfo.pickupMobile = receive.receivePhone;
+				// console.log('pickupInfo',this.pickupInfo);
 			},
 			submitOrder(){
 				let that = this;
@@ -333,6 +401,7 @@
 					receiveId:this.receive.id,
 					distribution:this.distribution,
 					logisticsType:this.logisticsType,
+					pickupInfo:this.pickupInfo,
 				};
 				if(this.fromPage == 'creditOrder'){
 					orderType = 2
@@ -341,6 +410,7 @@
 				param.goodsList = this.orderInfo.goodsList.map(item=>{
 					return {goodsId:item.id,quantity:item.quantity}
 				})
+				console.log('submitOrder param',param);
 				//获取经纬度
 				uni.getLocation({
 					type: 'gcj02',
@@ -372,6 +442,7 @@
 				this.selectReceiveIndex = index;
 				console.log('selectReceiveWay index',index);
 				console.log('selectReceiveWay',this.receiveWayList[index]);
+				console.log('pickupInfo',this.pickupInfo);
 			}
         }
     }