USER-20230908AJ\Administrator před 1 rokem
rodič
revize
38e35b300b
2 změnil soubory, kde provedl 46 přidání a 45 odebrání
  1. 28 22
      pages/index/order.vue
  2. 18 23
      pages/index/success.vue

+ 28 - 22
pages/index/order.vue

@@ -115,7 +115,7 @@
 			<uni-popup-dialog v-model="headValue" mode="input" title="输入条码" placeholder="请输入条码"
 				@confirm="dialogInputConfirm"></uni-popup-dialog>
 		</uni-popup>
-		
+
 		<!-- 选择会员登录方式 -->
 		<uni-popup ref="memberType" type="center" :mask-click="false">
 			<view class="member-type-box">
@@ -135,7 +135,7 @@
 				</view>
 			</view>
 		</uni-popup>
-		
+
 		<!-- 会员输入手机号 -->
 		<uni-popup ref="inputPhone" type="bottom" :mask-click="false">
 			<view class="flex-common-css member-pop-view">
@@ -158,7 +158,7 @@
 				</view>
 			</view>
 		</uni-popup>
-		
+
 		<!-- 会员扫码 -->
 		<uni-popup ref="inputMember" type="bottom" :mask-click="false">
 			<view class="flex-common-css member-pop-view">
@@ -219,9 +219,9 @@
 </template>
 
 <script>
-	import {
-		projectDiscount
-	} from '@/api/project.js';
+import {
+  projectDiscount, projectWriteDiscount
+} from '@/api/project.js';
 
 	import keyboardListener from 'uniapp-keyboard-listener';
 	import {
@@ -260,7 +260,7 @@
 				isAJAX: false,
 				headValue: '', //手动输入的值
 				shop_id: '',
-				
+
 				phone:'',
 				numList:[1,2,3,4,5,6,7,8,9],
 			};
@@ -293,7 +293,7 @@
 				let num3 = (((num1*num2*10000)/100).toFixed(0)/100).toFixed(2)
 				return num3
 			},
-			
+
 			monitorKeyboard(e) {
 				if (e.key.length == 1) { // 字母和数字的长度都是1,所以只要字母和数字的按键,适配不同的设备
 					this.keyArr.push(e.key)
@@ -317,6 +317,7 @@
 						}).then((res) => {
 							if (res.code == 1) {
 								this.isAJAX = false;
+								this.phone = "";
 								this.member_id = res.data.member_id;
 								this.discount = res.data.discount * 1 / 10;
 								this.isMemeber = false;
@@ -350,7 +351,7 @@
 								if (res.code == 1) {
 									this.payFLag = true;
 									this.isAJAX = false;
-
+                  this.upData()
 									uni.redirectTo({
 										url: '/pages/index/success?money=' + this.totalPrice +
 											"&discount=" + this.discount + '&invite_code=' + this
@@ -366,7 +367,12 @@
 					this.keyArr = [];
 				}
 			},
-
+      upData(){
+        this.shop_id = uni.getStorageSync('shop_id')
+        if(this.shop_id == 299){
+          projectWriteDiscount({order_money:this.money,invite_code:this.invite_code,discount:this.discount,phone:this.phone}).then((res)=>{})
+        }
+      },
 			// 获取商品
 			getGoods() {
 				GoodsInfo({
@@ -418,7 +424,7 @@
 				this.totalNum -= 1;
 				this.totalPrice = (this.totalPrice * 1 - (this.goodsList[i].price * 1)).toFixed(2);
 			},
-			// 添加 
+			// 添加
 			add(i) {
 				this.goodsList[i].num += 1
 				this.totalNum += 1;
@@ -483,12 +489,12 @@
 
 			// 选择会员登录方式
 			openMenber() {
-				this.$refs.memberType.open();	
+				this.$refs.memberType.open();
 			},
 			closeMemberTypePop(){
 				this.$refs.memberType.close();
 			},
-			
+
 			// 扫码登录会员
 			openPOP(){
 				this.isMemeber = true;
@@ -499,7 +505,7 @@
 				this.isMemeber = false;
 				this.$refs.inputMember.close();
 			},
-			
+
 			// 手机号登录会员
 			openPhone(){
 				this.$refs.memberType.close();
@@ -523,13 +529,13 @@
 				if (this.isAJAX) {
 					return
 				}
-				this.isAJAX = true;				
+				this.isAJAX = true;
 				projectDiscount({
 					phone: this.phone
 				}).then((res) => {
 					this.isAJAX = false;
 					if (res.code == 1) {
-						this.phone = '';
+						// this.phone = '';
 						this.member_id = res.data.member_id;
 						this.discount = res.data.discount * 1 / 10;
 						this.$refs.inputPhone.close();
@@ -571,7 +577,7 @@
 		margin-bottom: 10rpx;
 		border-radius: 20rpx;
 	}
-	
+
 	.member-type-box-title{
 		position: relative;
 		image{
@@ -589,7 +595,7 @@
 		border-radius: 20rpx;
 		box-sizing: border-box;
 		padding: 24rpx;
-		
+
 		.member-type-box-icon{
 			image{
 				width: 100rpx;
@@ -598,12 +604,12 @@
 			}
 		}
 	}
-	
+
 	.member-pop-view {
 		width: 100%;
 		height: 100vh;
 		background: #939394;
-		
+
 		.member-pop-phone-1{
 			width: 100%;
 		}
@@ -615,7 +621,7 @@
 			padding: 38rpx;
 			border-radius: 20rpx 20rpx 0 0;
 		}
-		
+
 
 		.member-pop-view-1 {
 			width: 100%;
@@ -846,4 +852,4 @@
 		color: #fff;
 		font-size: 32rpx;
 	}
-</style>
+</style>

+ 18 - 23
pages/index/success.vue

@@ -1,21 +1,21 @@
 <template>
 	<view class="success-box">
 		<view class="box-1"></view>
-		
+
 		<view class="img-1">
 			<image class="img-2" src="@/static/img/s-2.png" mode="scaleToFill"></image>
-			
+
 			<view class="text-align-center fs-32 fc-3 fw-400 mb-25 ">支付成功</view>
-			
+
 			<view class="text-align-center fs-42 fc-3 fw-b mb-120 ">¥{{totalPrice}}</view>
-			
+
 			<view class="fs-30 text-align-center fc-6 fw-400 ">请取走你的小票和商品</view>
 		</view>
-		
+
 		<view class="box-border-box box-2">
 			<view class="" @click="buy()">继续购买</view>
 		</view>
-		
+
 	</view>
 </template>
 
@@ -27,31 +27,28 @@
 				totalPrice:'',//实付款
 				money:'',//原价
 				discount:'',
-				invite_code:'',	
+				invite_code:'',
 				shop_id:'',
 			}
 		},
 		onLoad(e) {
-			this.shop_id = uni.getStorageSync('shop_id')
-			if(this.shop_id == 299){
-				this.upData();
-			}
-			
+
+
 			if(e.discount*1 > 0){
 				this.totalPrice = (((e.money*1)*(e.discount*1)*100).toFixed(2)/100).toFixed(2);
 				let num1 = e.money*1
 				let num2 = e.discount*1
 				this.totalPrice = (((num1*num2*10000)/100).toFixed(0)/100).toFixed(2)
-				
+
 			}else{
 				this.totalPrice = e.money;
 			}
-			
+
 			this.money = e.money;
 			this.invite_code = e.invite_code;
 			this.discount = e.discount;
-			
-			
+
+
 		},
 		methods:{
 			buy(){
@@ -59,9 +56,7 @@
 					url:'/pages/index/index'
 				})
 			},
-			upData(){
-				projectWriteDiscount({order_money:this.money,invite_code:this.invite_code,discount:this.discount}).then((res)=>{})
-			},
+
 		},
 	}
 </script>
@@ -72,7 +67,7 @@
 		height: 100vh;
 		background-color: #F2F3F5;
 		position: relative;
-		
+
 		.box-2{
 			margin-top: 600rpx;
 			padding: 0 40rpx;
@@ -88,13 +83,13 @@
 				margin: 0 auto;
 			}
 		}
-		
+
 		.box-1{
 			width: 750rpx;
 			height: 272rpx;
 			background: #0473CF;
 			border-radius: 0 0 100rpx 100rpx;
-			
+
 		}
 		.img-1{
 			background: url('@/static/img/s-1.png') no-repeat;
@@ -118,4 +113,4 @@
 			margin-bottom: 140rpx;
 		}
 	}
-</style>
+</style>