Browse Source

修改确认订单页代码

pangqijun 1 year ago
parent
commit
50d3b32355
1 changed files with 64 additions and 64 deletions
  1. 64 64
      pages/groupbuying_details/order_details_confirm/index.vue

+ 64 - 64
pages/groupbuying_details/order_details_confirm/index.vue

@@ -1,73 +1,29 @@
 <template>
 	<view :style="colorStyle">
 
-		<view class="all-products-body">
-			<view class="all-products-item" @click="addGoodPopupShow = true">
+		<view class="all-products-body" v-for="(item, index) in grouponOrderData.goodsInfos" :key="index">
+			<view class="all-products-item">
 				<image
-					src="https://lanhu-dds-backend.oss-cn-beijing.aliyuncs.com/merge_image/imgs/38e693de009644aa9de2dc6d6f7e747a_mergeImage.png"
+					:src="item.goodsCover"
 					mode="scaleToFill" />
 
 				<view class="all-products-item-content">
 					<view class="all-products-item-content-t">
-						宫中秘策(GOONGBE)进口儿童韩国进口儿童防晒霜80g
+						{{item.goodsName}}
 					</view>
 					<view class="all-products-item-content-b">
 						<view style="display:flex;">
-							<text class="red"> ¥48.00</text>
-							<text class="line-thr">¥52.00</text>
+							<text class="red"> ¥{{item.discountPrice}}</text>
 						</view>
 
 						<view>
-							<u-number-box v-model="value" @change="valChange"></u-number-box>
-						</view>
-					</view>
-				</view>
-			</view>
-			<view class="all-products-item" @click="addGoodPopupShow = true">
-				<image
-					src="https://lanhu-dds-backend.oss-cn-beijing.aliyuncs.com/merge_image/imgs/38e693de009644aa9de2dc6d6f7e747a_mergeImage.png"
-					mode="scaleToFill" />
-
-				<view class="all-products-item-content">
-					<view class="all-products-item-content-t">
-						宫中秘策(GOONGBE)进口儿童韩国进口儿童防晒霜80g
-					</view>
-					<view class="all-products-item-content-b">
-						<view style="display:flex;">
-							<text class="red"> ¥48.00</text>
-							<text class="line-thr">¥52.00</text>
-						</view>
-
-						<view>
-							<u-number-box v-model="value" @change="valChange"></u-number-box>
-						</view>
-					</view>
-				</view>
-			</view>
-			<view class="all-products-item" @click="addGoodPopupShow = true">
-				<image
-					src="https://lanhu-dds-backend.oss-cn-beijing.aliyuncs.com/merge_image/imgs/38e693de009644aa9de2dc6d6f7e747a_mergeImage.png"
-					mode="scaleToFill" />
-
-				<view class="all-products-item-content">
-					<view class="all-products-item-content-t">
-						宫中秘策(GOONGBE)进口儿童韩国进口儿童防晒霜80g
-					</view>
-					<view class="all-products-item-content-b">
-						<view style="display:flex;">
-							<text class="red"> ¥48.00</text>
-							<text class="line-thr">¥52.00</text>
-						</view>
-
-						<view>
-							<u-number-box v-model="value" @change="valChange"></u-number-box>
+							<u-number-box :name="item.id" :min="0" v-model="grouponOrderData.goodsInfos[index].num" @change="calGoodsPrice"></u-number-box>
 						</view>
 					</view>
 				</view>
 			</view>
 		</view>
-
-
+		
 		<view class='order-submission'>
 			<view>
 
@@ -91,25 +47,25 @@
 						<view class="a-m">
 							<view class="am1">
 								<view class="am1-1">
-									夜未央佳佳便利店
+									{{grouponOrderData.selfTake.name}}
 								</view>
 								<view class="am1-2">
-									距您1.8km
+									距您{{grouponOrderData.selfTake.distanceDesc}}
 									<image src="http://www.gzzzyd.com/groupon/order_details/距离@2x.png" mode="scaleToFill" />
 								</view>
 							</view>
 							<view class="am2">
-								上海市浦东新区秀浦路29号三层303
+								{{grouponOrderData.selfTake.address}}
 							</view>
 							<view class="am3">
-								营业时间 08:15-18:00
+								营业时间 {{grouponOrderData.selfTake.busStartTime}}-{{grouponOrderData.selfTake.busEndTime}}
 							</view>
 						</view>
 						<view class="a-b">
 							<view class="a-b1">
 								对接团长:
 								<text class="red">
-									陈晓旭
+									{{grouponOrderData.username}}
 								</text>
 							</view>
 							<view class="a-b2">
@@ -127,7 +83,7 @@
 						</view>
 						<view class="p-b-item">
 							<view class="item-lable">商品金额</view>
-							<view class="item-value">¥48</view>
+							<view class="item-value">¥{{parseFloat(totalPrice).toFixed(2)}}</view>
 						</view>
 						<view class="p-b-item">
 							<view class="item-lable">积分抵扣</view>
@@ -135,7 +91,7 @@
 						</view>
 						<view class="p-b-item">
 							<view class="item-lable">总计金额</view>
-							<view class="item-value">¥48</view>
+							<view class="item-value">¥{{parseFloat(totalPrice).toFixed(2)}}</view>
 						</view>
 					</blok>
 				</view>
@@ -182,10 +138,10 @@
 			</view>
 		</view>
 		<view class="alipaysubmit" v-html="formContent"></view>
-		<couponListWindow :coupon='coupon' @ChangCouponsClone="ChangCouponsClone" :openType='openType' :cartId='cartId'
-			@ChangCoupons="ChangCoupons"></couponListWindow>
-		<addressWindow ref="addressWindow" @changeTextareaStatus="changeTextareaStatus" :news='news' :address='address'
-			:pagesUrl="pagesUrl" @OnChangeAddress="OnChangeAddress" @changeClose="changeClose"></addressWindow>
+<!-- 		<couponListWindow :coupon='coupon' @ChangCouponsClone="ChangCouponsClone" :openType='openType' :cartId='cartId'
+			@ChangCoupons="ChangCoupons"></couponListWindow> -->
+<!-- 		<addressWindow ref="addressWindow" @changeTextareaStatus="changeTextareaStatus" :news='news' :address='address'
+			:pagesUrl="pagesUrl" @OnChangeAddress="OnChangeAddress" @changeClose="changeClose"></addressWindow> -->
 		<!-- #ifdef MP -->
 		<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
 		<!-- #endif -->
@@ -209,7 +165,8 @@ import {
 	getCouponsOrderPrice,
 	orderCreate,
 	postOrderComputed,
-	checkShipping
+	checkShipping,
+	getGroupOrderData
 } from '@/api/order.js';
 import {
 	getAddressDefault,
@@ -385,6 +342,10 @@ export default {
 			goodsSpecId: 0,
 			freight: 0,
 			zoneType: 0,
+			goods: [],
+			organizerUserId: '',
+			selfTakeId: '',
+			grouponOrderData: {}
 		};
 	},
 	computed: mapGetters(['isLogin']),
@@ -397,6 +358,10 @@ export default {
 	// 	}
 	// },
 	onLoad (options) {
+		const goods = JSON.parse(decodeURIComponent(options.goods));
+		this.goods = goods;
+		this.organizerUserId = options.organizerUserId;
+		this.selfTakeId = options.selfTakeId;
 		this.from = 'routine'
 		// if (!options.productId) return this.$util.Tips({
 		// 	title: this.$t(`请选择要购买的商品`)
@@ -406,7 +371,8 @@ export default {
 		// });
 
 		if (this.isLogin && this.toPay == false) {
-			this.checkShipping();
+			this.getOrderData();
+			// this.checkShipping();
 			// this.getaddressInfo();
 			// this.getConfirm();
 			// this.$nextTick(function() {
@@ -430,6 +396,40 @@ export default {
 		})
 	},
 	methods: {
+		calGoodsPrice(value) {
+			console.log(value);
+			this.grouponOrderData.goodsInfos.forEach(e => {
+				console.log(e.id + " - " + e.num)
+				if (value.name == e.id) {
+					let c = value.value - e.num;
+					this.totalPrice = this.totalPrice - (c*e.discountPrice)
+				}
+			});
+		},
+		getOrderData() {
+			let longitude = uni.getStorageSync("user_longitude"); //经度
+			let latitude = uni.getStorageSync("user_latitude"); //纬度
+			getGroupOrderData({
+				goods: this.goods,
+				organizerUserId: this.organizerUserId,
+				selfTakeId: this.selfTakeId,
+				longitude: longitude,
+				latitude: latitude
+			}).then(res => {
+				this.grouponOrderData = res.data;
+				let total = 0.0;
+				this.grouponOrderData.goodsInfos.forEach(e => {
+					console.log(e.goodsName + "-" + e.num)
+					total+=(e.discountPrice*e.num)
+				});
+				this.totalPrice = total;
+			}).catch(err => {
+				uni.showToast({
+					title: err,
+					icon: 'none'
+				});
+			});
+		},
 		checkShipping () {
 			let that = this;
 			this.getConfirm();