Ver código fonte

Merge branch 'develop' of http://git.chelingzhu.com/chelingzhu-web/zxyj-mini-html into develop

lilei 4 anos atrás
pai
commit
a0370279ff

+ 17 - 0
api/order.js

@@ -14,6 +14,14 @@ export const existPayPwd = params => {
     method: 'get',
   })
 };
+// 校验短信验证码是否正确
+export const checkCode = params => {
+  return axios.request({
+    url: `customer/checkVerificationCode`,
+	data: params,
+    method: 'post',
+  })
+};
 // 设置支付密码
 export const setPayPwd = params => {
   return axios.request({
@@ -22,6 +30,15 @@ export const setPayPwd = params => {
     method: 'post',
   })
 };
+// 校验原密码是否正确
+export const checkPayPwd = params => {
+  return axios.request({
+    url: `customer/checkPayPwd`,
+	data: params,
+    method: 'post',
+  })
+};
+
 // 修改支付密码
 export const changePayPwd = params => {
   return axios.request({

+ 1 - 0
pages/order/LogList.vue

@@ -109,6 +109,7 @@
 				}
 				finishOrder(params).then(res=>{
 					if(res.status==200) {
+						uni.$emit('refresh')
 						uni.showToast({
 							title:res.message,
 							icon: 'none'

+ 3 - 1
pages/order/order.vue

@@ -172,7 +172,7 @@
 		onLoad() {
 			// 监听设置密码是否成功
 			uni.$once('setPswSuccess', this.setPsw)
-			// 监听详情支付成功事件
+			// 监听页面刷新事件 在详情支付成功后或在物流确认收货后刷新列表
 			uni.$on('refresh', this.handleRefresh)
 			this.pageInit()
 		},
@@ -301,6 +301,7 @@
 			},
 			//确认放弃
 			canclePay() {
+				this.password = ''
 				this.showLeavePsw = false
 				this.showInputPsw = false
 			},
@@ -357,6 +358,7 @@
 						},300)
 						
 					} else{
+						this.password = ''
 						uni.showToast({
 							title: res.message,
 							icon: 'none'

+ 30 - 7
pages/order/orderDetail.vue

@@ -5,7 +5,7 @@
 			<view class="order-status">
 				<view class="status-title">{{orderInfo.orderStateDictValue}}</view>
 				<view v-if="orderInfo.orderState=='WAIT_PAY'" class="status-care">
-					请在 <text>29</text>分钟内付款,过期系统将自动取消订单
+					请在 <text>{{leftTime}}</text>分钟内付款,过期系统将自动取消订单
 				</view>
 				<view v-if="orderInfo.orderState=='CANCEL'" class="status-care">
 					超时未支付,系统已自动取消订单
@@ -122,7 +122,8 @@
 				showSetPswModal: false,  // 设置支付密码弹窗
 				showInputPsw: false, // 打开输入密码弹窗
 				showLeavePsw: false, // 打开确定放弃弹窗
-				orderStatusList: []
+				orderId: '', // 订单id
+				leftTime: null
 			}
 		},
 		onLoad(options) {
@@ -130,19 +131,38 @@
 			uni.$once('setPswSuccess', this.setPsw)
 			if (options.id) {
 				console.log(options.id)
-				this.getOrderDetail(options.id)
-				this.orderStatusList = this.$store.state.vuex_payStatus
+				this.orderId = options.id
+				this.getOrderDetail()
 			}
+		},
+		computed: {
+			
 		},
 		methods: {
+			// 支付剩余时间
+			leftTimeFun() {
+				let nowT = new Date().valueOf() // 现在时间戳
+				let orderT = new Date(this.orderInfo.orderTime).valueOf() // 下单时间戳
+				let tt = (1800 * 1000) - (nowT - orderT)   // 距离30分钟支付 相差时间戳  
+				console.log(tt,'tttttt')
+				if (tt >0) {
+					this.leftTime =  parseInt(tt/(60*1000))
+				} else {
+					// this.getOrderDetail()
+					this.leftTime = '00'
+				}
+			},
 			// 获取订单详情
-			getOrderDetail(id) {
-				let payTypeList = this.$store.state.vuex_payType
+			getOrderDetail() {
 				orderDetail({
-					id: id
+					id: this.orderId
 				}).then(res => {
+					console.log(res,'rrrrrrrr')
 					if (res.status == 200) {
 						this.orderInfo = res.data
+						if(this.orderInfo.orderState=='WAIT_PAY') {
+							this.leftTimeFun()
+						}
 					} else {
 						uni.showToast({
 							title: res.message,
@@ -165,6 +185,7 @@
 			},
 			//确认放弃
 			canclePay() {
+				this.password = ''
 				this.showLeavePsw = false
 				this.showInputPsw = false
 			},
@@ -212,11 +233,13 @@
 				signPay(params).then(res=>{
 					this.btnLoading = false
 					if(res.status == 200) {
+						uni.$emit('refresh')
 						// 跳转到支付完成界面
 						uni.navigateTo({
 							url:"/pages/toOrder/payFinish?id=" + id
 						})
 					} else{
+						this.password = ''
 						uni.showToast({
 							title: res.message,
 							icon: 'none'

+ 7 - 1
pages/toOrder/index.vue

@@ -189,6 +189,11 @@
 			canclePay() {
 				this.showLeavePsw = false
 				this.showInputPsw = false
+				this.password = ''
+				// 跳转到订单列表
+				uni.navigateTo({
+					url:"/pages/order/order"
+				})
 			},
 			// 继续支付
 			payAgain () {
@@ -279,10 +284,11 @@
 					this.payBtn = false
 					if(res.status == 200) {
 						// 跳转到支付完成界面
-						uni.navigateTo({
+						uni.redirectTo({
 							url:"/pages/toOrder/payFinish?id=" + this.orderId
 						})
 					} else{
+						this.password = ''
 						uni.showToast({
 							title: res.message,
 							icon: 'none'

+ 14 - 3
pages/userCenter/userInfo/changePayPwd.vue

@@ -15,6 +15,7 @@
 </template>
 
 <script>
+	import { checkPayPwd } from '@/api/order.js'
 	export default {
 		data() {
 			return {
@@ -29,10 +30,20 @@
 			//  确定
 			submit(){
 				if(this.oldPwd){
-					//  跳转到设置密码
-					uni.redirectTo({
-						url: `/pages/userCenter/userInfo/paymentPwd?oldPwd=${this.oldPwd}`
+					checkPayPwd({oldPayPassword:this.oldPwd}).then(res=>{
+						if(res.status == 200) {
+							//  跳转到设置密码
+							uni.redirectTo({
+								url: `/pages/userCenter/userInfo/paymentPwd?oldPwd=${this.oldPwd}`
+							})
+						} else {
+							uni.showToast({
+								title: res.message,
+								icon: 'none'
+							})
+						}
 					})
+					
 				}else{
 					uni.showToast({ title: '请输入支付密码', icon: 'none' })
 				}

+ 19 - 4
pages/userCenter/userInfo/smsVerification.vue

@@ -26,7 +26,8 @@
 <script>
 	import uniPopup from '@/components/uni-popup/uni-popup.vue'
 	import popupCon from '@/components/uni-popup/popup-con.vue'
-	import { loginPhone, sendVerifyCode } from '@/api/user.js'
+	import { sendVerifyCode } from '@/api/user.js'
+	import { checkCode } from '@/api/order.js'
 	export default {
 		components: {
 			uniPopup,
@@ -67,10 +68,24 @@
 				handler(newVal) {
 					// console.log(newVal.length,'NNNNNNNNNNNN')
 					if(newVal.length==6) {
-						//  跳转到设置密码
-						uni.redirectTo({
-							url: `/pages/userCenter/userInfo/paymentPwd?code=${this.value}&mobile=${this.phone}`
+						let params = {
+							mobile: this.phone,
+							verifiCode: newVal
+						}
+						checkCode(params).then(res=>{
+							if(res.status==200) {
+								//  跳转到设置密码
+								uni.redirectTo({
+									url: `/pages/userCenter/userInfo/paymentPwd?code=${this.value}&mobile=${this.phone}`
+								})
+							} else {
+								uni.showToast({
+									title: res.message,
+									icon: 'none'
+								})
+							}
 						})
+						
 					}
 				},
 				deep: true