瀏覽代碼

Signed-off-by: 1004749546@qq.com <1004749546@qq.com>
下单修改

1004749546@qq.com 4 年之前
父節點
當前提交
76c3bc59d6
共有 4 個文件被更改,包括 114 次插入92 次删除
  1. 1 55
      pages/order/LogList.vue
  2. 58 17
      pages/order/order.vue
  3. 43 12
      pages/order/orderDetail.vue
  4. 12 8
      pages/toOrder/index.vue

+ 1 - 55
pages/order/LogList.vue

@@ -101,65 +101,11 @@
 			},
 			// 查询列表
 			getRow(id) {
-				this.status = "loadmore"
-				this.list = [{
-					createDate: "2020-10-28 11:15:59",
-					orderFlag: "待支付",
-					payedAmount: 0,
-					id: 11,
-					amount: 450,
-					totalNum: 3,
-					logName: '韵达快递',
-					logNum: '12454545485',
-					itemList: [
-						{
-							name: "八九箭冠",
-							id: 76435,
-							number: 1,
-							price: 150,
-							icon: ''
-						},
-						{
-							name: "数据库的合法身份觉得很附近发生纠纷解决",
-							id: 76436,
-							number: 2,
-							price: 150,
-							icon: ''
-						}
-					]
-				},
-				{
-					createDate: "2020-10-28 11:15:59",
-					orderFlag: "待支付",
-					payedAmount: 0,
-					id: 12,
-					amount: 450,
-					totalNum: 3,
-					logName: '韵达快递',
-					logNum: '12454545485',
-					itemList: [
-						{
-							name: "八九箭冠",
-							id: 76435,
-							number: 1,
-							price: 150,
-							icon: ''
-						},
-						{
-							name: "数据库的合法身份觉得很附近发生纠纷解决",
-							id: 76436,
-							number: 2,
-							price: 150,
-							icon: ''
-						}
-					]
-				}]
-				return 
 				this.status = "loading"
 				queryOrderExpress({id:id}).then(res => {
 					console.log(res,'rrrrrrrr')
 					if (res.status == 200) {
-						this.list = res.data.list || []
+						this.list = res.data || []
 					} else {
 						this.list = []
 						this.total = 0

+ 58 - 17
pages/order/order.vue

@@ -92,7 +92,13 @@
 					<text class="num-big">{{totalPrice}}</text>乐豆
 				</view>
 				<view class="footer">
-					<u-input v-model="password" maxlength="30" input-align="center" type="password" placeholder="请输入支付密码" />
+					<u-input v-model="password" maxlength="30" 
+					input-align="center" type="password" 
+					placeholder="请输入支付密码" 
+					@confirm="toPayOrder"/>
+				</view>
+				<view class="fot-btn">
+					<u-button  @click="toPayOrder" type="error" >确认支付</u-button>
 				</view>
 			</view>
 		</u-popup>
@@ -162,8 +168,6 @@
 				showLeavePsw: false, // 打开确定放弃弹窗
 			}
 		},
-		onShow() {
-		},
 		onLoad() {
 			// 监听设置密码是否成功
 			uni.$once('setPswSuccess', this.setPsw)
@@ -274,11 +278,11 @@
 			},
 			// 支付剩余时间
 			filterTime (time) {
-				console.log(time,'tttttt')
+				// console.log(time,'tttttt')
 				let nowT = new Date().valueOf() // 现在时间戳
 				let orderT = new Date(time).valueOf() // 下单时间戳
 				let tt = (1800 * 1000) - (nowT - orderT)   // 距离30分钟支付 相差时间戳  
-				console.log(tt,'tttttt')
+				// console.log(tt,'tttttt')
 				return  tt
 			},
 			
@@ -304,12 +308,35 @@
 				this.showLeavePsw = false
 				this.showInputPsw = true
 			},
-			// 支付
+			// 支付 判断用户是否设置过支付密码
 			toPay(item) {
-				// this.totalPrice = item.payGold
-				// this.showSetPswModal = true
-				// return
-				signPay({id:item.id}).then(res=>{
+				this.orderId = item.id
+				// 判断用户是否设置过支付密码
+				existPayPwd().then(res=>{
+					console.log(res,'rrrrrr')
+					if(res.status == 200) {
+						// 设置过支付密码,输入密码
+						if(res.data) {
+							this.showInputPsw = true
+						} else {
+							// 没设置过支付密码,提示设置密码
+							 this.showSetPswModal = true
+						}
+					} else {
+						uni.showToast({
+							title: res.message,
+							icon: 'none'
+						})
+					}
+				})
+			},
+			// 支付
+			toPayOrder() {
+				let params = {
+					payPwd: this.password,
+					id: this.orderId
+				}
+				signPay(params).then(res=>{
 					this.btnLoading = false
 					if(res.status == 200) {
 						// 跳转到支付完成界面
@@ -460,6 +487,7 @@
 					>view {
 						&:last-child {
 							flex: 1;
+							padding: 10upx 0;
 							margin-left: 20upx;
 							display: flex;
 							flex-direction: column;
@@ -497,13 +525,26 @@
 			}
 		}
 
-		// 物流弹窗
-		.slot-content {
-			padding: 40upx 60upx;
-			font-size: 28upx;
-
-			>view {
-				line-height: 60upx;
+		// 支付密码弹窗
+		.slot-content{
+			padding: 30upx 0;
+			display: flex;
+			flex-direction: column;
+			align-items: center;
+			justify-content: space-between;
+			.text-cont{
+				width: 100%;
+				padding: 60upx 0;
+				text-align: center;
+				.num-big{
+					font-size: 40upx;
+					color: red;
+				}
+			}
+			.footer{
+				width: 80%;
+				border-bottom: 1px solid #b1b1b1;
+				margin-bottom: 30upx;
 			}
 		}
 	}

+ 43 - 12
pages/order/orderDetail.vue

@@ -91,7 +91,13 @@
 					<text class="num-big">{{totalPrice}}</text>乐豆
 				</view>
 				<view class="footer">
-					<u-input v-model="password" @confirm="handlePay" maxlength="30" input-align="center" type="password" placeholder="请输入支付密码" />
+					<u-input v-model="password" 
+					@confirm="toPayOrder" 
+					maxlength="30" input-align="center" type="password" 
+					placeholder="请输入支付密码" />
+				</view>
+				<view class="fot-btn">
+					<u-button  @click="toPayOrder" type="error" >确认支付</u-button>
 				</view>
 			</view>
 		</u-popup>
@@ -167,7 +173,7 @@
 				this.showLeavePsw = false
 				this.showInputPsw = true
 			},
-			// 支付
+			// 支付 判断用户是否设置过支付密码
 			toPay() {
 				// 判断用户是否设置过支付密码
 				existPayPwd().then(res=>{
@@ -176,8 +182,9 @@
 						// 设置过支付密码,输入密码
 						if(res.data) {
 							this.showInputPsw = true
-							// this.totalPrice = item.payGold
-							// this.showSetPswModal = true
+						} else {
+							// 没设置过支付密码,提示设置密码
+							 this.showSetPswModal = true
 						}
 					} else {
 						uni.showToast({
@@ -186,14 +193,20 @@
 						})
 					}
 				})
-				
-				signPay({id:this.orderInfo.id}).then(res=>{
+			},
+			// 支付
+			toPayOrder() {
+				let id = this.orderInfo.id
+				let params = {
+					payPwd: this.password,
+					id: id
+				}
+				signPay(params).then(res=>{
 					this.btnLoading = false
 					if(res.status == 200) {
-						uni.$emit('refresh')
 						// 跳转到支付完成界面
 						uni.navigateTo({
-							url:"/pages/toOrder/payFinish?id=" + this.orderInfo.id
+							url:"/pages/toOrder/payFinish?id=" + id
 						})
 					} else{
 						uni.showToast({
@@ -203,10 +216,6 @@
 					}
 				})
 			},
-			// 输入支付密码完成  
-			handlePay(e) {
-				console.log(e,'eeeeeeeeee')
-			}
 		},
 	}
 </script>
@@ -317,6 +326,28 @@
 		.footer {
 			padding: 20rpx;
 		}
+		// 支付密码弹窗
+		.slot-content{
+			padding: 30upx 0;
+			display: flex;
+			flex-direction: column;
+			align-items: center;
+			justify-content: space-between;
+			.text-cont{
+				width: 100%;
+				padding: 60upx 0;
+				text-align: center;
+				.num-big{
+					font-size: 40upx;
+					color: red;
+				}
+			}
+			.footer{
+				width: 80%;
+				border-bottom: 1px solid #b1b1b1;
+				margin-bottom: 30upx;
+			}
+		}
 
 	}
 </style>

+ 12 - 8
pages/toOrder/index.vue

@@ -54,7 +54,7 @@
 			  <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
 			</view>
 			<view>
-				<u-button size="mini" :loading="btnLoading" :custom-style="toOrderButton" type="error" @click="toSave">确认支付</u-button>
+				<u-button size="mini" :loading="btnLoading" :custom-style="toOrderButton" type="error" @click="toSaveOrder">确认支付</u-button>
 			</view>
 		</view>
 		<!-- 提示用户设置支付密码 -->
@@ -88,11 +88,11 @@
 					maxlength="30" 
 					input-align="center" 
 					type="password" 
-					@confirm="toSaveOrder"
+					@confirm="toPay"
 					placeholder="请输入支付密码" />
 				</view>
 				<view class="fot-btn">
-					<u-button  @click="toSaveOrder" type="error" >确认支付</u-button>
+					<u-button  @click="toPay" type="error" >确认支付</u-button>
 				</view>
 			</view>
 		</u-popup>
@@ -187,7 +187,7 @@
 				this.showInputPsw = true
 			},
 			// 支付  校验用户是否设置过支付密码
-			toSave(){
+			toCheckPwd(){
 				// 判断用户是否设置过支付密码
 				existPayPwd().then(res=>{
 					console.log(res,'rrrrrr')
@@ -222,13 +222,13 @@
 					receiverName: this.userInfo.receiverName,
 					receiverPhone: this.userInfo.receiverPhone,
 					orderGoodsList: orderGoodsList,
-					payPwd: this.password
 				}
 				saveOrder(params).then(res=>{
 					console.log(res,'rrrrrrr')
 					if(res.status==200) {
 						this.orderId = res.data.id
-						this.toPay(this.orderId)
+						// 校验用户是否设置过支付密码
+						this.toCheckPwd()
 					} else {
 						this.btnLoading = false
 						uni.showToast({
@@ -239,8 +239,12 @@
 				})
 			},
 			// 支付
-			toPay(id) {
-				signPay({id:id}).then(res=>{
+			toPay() {
+				let params = {
+					payPwd: this.password,
+					id: this.orderId
+				}
+				signPay(params).then(res=>{
 					this.btnLoading = false
 					if(res.status == 200) {
 						// 跳转到支付完成界面