Преглед на файлове

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

1004749546@qq.com преди 4 години
родител
ревизия
935f3fb183

+ 11 - 2
api/order.js

@@ -17,8 +17,17 @@ export const existPayPwd = params => {
 // 设置支付密码
 export const setPayPwd = params => {
   return axios.request({
-    url: `customer/setPayPassword/${params.password}`,
-    method: 'get',
+    url: `customer/setPayPassword`,
+	data: params,
+    method: 'post',
+  })
+};
+// 修改支付密码
+export const changePayPwd = params => {
+  return axios.request({
+    url: `customer/updatePayPwd`,
+	data: params,
+    method: 'post',
   })
 };
 

+ 10 - 60
pages/order/LogList.vue

@@ -3,10 +3,10 @@
 		<view class="tab-body">
 					<scroll-view scroll-y class="scroll-view" @scrolltolower="onreachBottom">
 						<view class="check-order-list" v-for="(item,sindex) in list" :key="item.id"
-						 @click="viewRow(item)">
+						 >
 							<view class="order-log">
 								<view v-if="item.orderFlag=='待发货'">待发货</view>
-								<view>
+								<view v-else>
 									<view>
 										快递公司:<text class="address-title">{{item.logName}}</text>
 										<text class="btn-cont" @click="copyLogNum" style="float: right;">确认收货</text>
@@ -79,22 +79,12 @@
 				action: 'swiperChange', // 操作类型,上划分页,或左右滑动
 			}
 		},
-		onLoad() {
-			this.pageInit()
-		},
-		onUnload() {
-			uni.$off('refreshBL', this.refresh)
-			uni.$off('refreshBl-handle', this.handleRefresh)
+		onLoad(option) {
+			if(option.id) {
+				this.getRow(option.id)
+			}
 		},
 		methods: {
-			pageInit() {
-				this.sortIndex = 1
-				this.pageNo = 1
-				this.getRow()
-			},
-			handleRefresh() {
-				this.getRow()
-			},
 			// scroll-view到底部加载更多
 			onreachBottom() {
 				this.action = 'onreachBottom'
@@ -110,7 +100,7 @@
 				}
 			},
 			// 查询列表
-			getRow(pageNo) {
+			getRow(id) {
 				this.status = "loadmore"
 				this.list = [{
 					createDate: "2020-10-28 11:15:59",
@@ -165,23 +155,11 @@
 					]
 				}]
 				return 
-				if (pageNo) {
-					this.pageNo = pageNo
-				}
-				let params = {
-					pageNo: this.pageNo,
-					pageSize: this.pageSize,
-					queryLabel: this.tabList[this.current].queryLabel, // tab分类
-				}
 				this.status = "loading"
-				getBackLogList(params).then(res => {
+				queryOrderExpress({id:id}).then(res => {
+					console.log(res,'rrrrrrrr')
 					if (res.status == 200) {
-						if (this.pageNo > 1) {
-							this.list = this.list.concat(res.data.list || [])
-						} else {
-							this.list = res.data.list || []
-						}
-						this.total = res.data.count || 0
+						this.list = res.data.list || []
 					} else {
 						this.list = []
 						this.total = 0
@@ -190,24 +168,6 @@
 					this.status = "loadmore"
 				})
 			},
-			resetPage() {
-				this.status = 'loading';
-				// 上划分页
-				if (this.action == 'onreachBottom') {
-					this.getRow();
-				}
-				// 左右切换tab
-				if (this.action == 'swiperChange') {
-					this.list = [];
-					this.getRow(1);
-				}
-			},
-			// 获取查询参数 刷新列表
-			refresh(params) {
-				// console.log(params,'1111111111')
-				this.searchParams = params
-				this.getRow(1)
-			},
 			
 			// 复制运单编号 
 			copyLogNum () {
@@ -225,16 +185,6 @@
 					}
 				})
 			},
-			// 详细页
-			viewRow(item) {
-				// if (!this.$hasPermissions('M_backlog_detail_mobile')) {
-				// 	return
-				// }
-				// 已完成的
-				uni.navigateTo({
-					url: "/pages/order/orderDetail?id=" + item.id
-				})
-			},
 		}
 	}
 </script>

+ 3 - 3
pages/toOrder/index.vue

@@ -161,13 +161,13 @@
 			editAddress(){
 				this.$u.vuex("vuex_OrderAddress",this.userInfo)
 				uni.navigateTo({
-					url:"/pages/toOrder/editAddress?"
+					url:"/pages/toOrder/editAddress"
 				})
 			},
 			// 跳转到设置支付密码页
 			toSetPwd () {
 				uni.navigateTo({
-					url:"/pages/userCenter/userInfo/paymentPwd"
+					url:"/pages/userCenter/userInfo/smsVerification"
 				})
 			},
 			// 设置密码成功, 打开输入密码弹窗
@@ -222,7 +222,7 @@
 					receiverName: this.userInfo.receiverName,
 					receiverPhone: this.userInfo.receiverPhone,
 					orderGoodsList: orderGoodsList,
-					password: this.password
+					payPwd: this.password
 				}
 				saveOrder(params).then(res=>{
 					console.log(res,'rrrrrrr')

+ 4 - 1
pages/userCenter/userInfo/changePayPwd.vue

@@ -29,7 +29,10 @@
 			//  确定
 			submit(){
 				if(this.oldPwd){
-					
+					//  跳转到设置密码
+					uni.redirectTo({
+						url: `/pages/userCenter/userInfo/paymentPwd?oldPwd=${this.oldPwd}`
+					})
 				}else{
 					uni.showToast({ title: '请输入支付密码', icon: 'none' })
 				}

+ 88 - 21
pages/userCenter/userInfo/paymentPwd.vue

@@ -4,17 +4,17 @@
 		<view class="sms-item" @tap="showKeyboard=!showKeyboard">
 			<u-message-input mode="bottomLine" :maxlength="6" v-model="value" :dot-fill="true" :disabled-keyboard="true"></u-message-input>
 		</view>
-		<view class="btn-con">
+		<!-- <view class="btn-con">
 			<u-button class="handle-btn" type="info" size="medium" @click="cancel">取消</u-button>
 			<u-button class="handle-btn" type="primary" size="medium" @click="submit">确定</u-button>
-		</view>
+		</view> -->
 		<!-- 数字键盘 -->
 		<u-keyboard ref="uKeyboard" :dot-enabled="false" :mask="false" :tooltip="false" v-model="showKeyboard" @change="valChange" @backspace="backspace"></u-keyboard>
 	</view>
 </template>
 
 <script>
-	import {setPayPwd} from '@/api/order.js'
+	import {setPayPwd, changePayPwd} from '@/api/order.js'
 	export default {
 		data() {
 			return {
@@ -23,16 +23,48 @@
 				showKeyboard: false,  //  是否打开键盘
 				oPwd: '',  //  第一次密码
 				tPwd: '',  //  第二次密码
+				oldPwd: '', // 原密码
+				mobile: '', // 用户手机号
+				verifiCode: '', // 短信验证码
 			}
 		},
 		onShow() {
 		},
-		onLoad() {
+		onLoad(option) {
+			if (option.code){
+				this.mobile = option.mobile
+				this.verifiCode = option.code
+				this.oldPwd = ''
+			}
+			if (option.oldPwd){
+				this.oldPwd = option.oldPwd
+			}
 			//因为此时实例没有挂载完成,需要延迟操作
 			setTimeout(() => {
 			  this.showKeyboard = true
 			}, 50)
 		},
+		watch: {
+			// 监听输入框输入长度
+			 value: {
+				handler(newVal) {
+					console.log(newVal.length,'NNNNNNNNNNNN')
+					if(newVal.length==6) {
+						if(this.nowSetp == 1){
+							this.oPwd = this.value
+							this.value = ''
+							this.nowSetp++
+							this.showKeyboard = true
+						}else if(this.nowSetp == 2){
+							this.tPwd = this.value
+							this.showKeyboard = false
+							this.checkPwd()
+						}
+					}
+				},
+				deep: true
+			}
+		},
 		methods:{
 			// 按键被点击(点击退格键不会触发此事件)
 			valChange(val) {
@@ -65,23 +97,12 @@
 			//  密码校验
 			checkPwd(){
 				if(this.oPwd == this.tPwd){
-					//  请求接口
-					setPayPwd({password: this.tPwd}).then(res=>{
-						if(res.status==200) {
-							uni.showToast({ title: '支付密码设置成功', icon: 'none' })
-							 uni.$emit('setPswSuccess', {success: true})
-							setTimeout(()=>{
-								uni.navigateBack({
-								    delta: 1
-								})
-							}, 2000)
-						} else {
-							uni.showToast({
-								title: res.message,
-								icon: 'none'
-							})
-						}
-					})
+					if(this.oldPwd) {
+						this.changePsw()
+					} else{
+						//  设置密码 请求接口
+						this.setPsw()
+					}
 					
 				}else{
 					uni.showToast({ title: '两次密码不一致请重新输入', icon: 'none' })
@@ -89,6 +110,52 @@
 					this.showKeyboard = true
 				}
 			},
+			// 首次设置密码
+			setPsw () {
+				let params = {
+					mobile: this.mobile,
+					verifiCode: this.verifiCode,
+					payPassword: this.value
+				}
+				setPayPwd(params).then(res=>{
+					if(res.status==200) {
+						uni.showToast({ title: res.message, icon: 'none' })
+						 uni.$emit('setPswSuccess', {success: true})
+						setTimeout(()=>{
+							uni.navigateBack({
+							    delta: 1
+							})
+						}, 2000)
+					} else {
+						uni.showToast({
+							title: res.message,
+							icon: 'none'
+						})
+					}
+				})
+			},
+			// 修改密码
+			changePsw () {
+				let params = {
+					oldPayPassword: this.oldPwd,
+					payPassword: this.value
+				}
+				changePayPwd(params).then(res=>{
+					if(res.status==200) {
+						uni.showToast({ title: res.message, icon: 'none' })
+						setTimeout(()=>{
+							uni.navigateBack({
+							    delta: 1
+							})
+						}, 2000)
+					} else {
+						uni.showToast({
+							title: res.message,
+							icon: 'none'
+						})
+					}
+				})
+			},
 			//  取消
 			cancel(){
 				this.oPwd = ''

+ 85 - 24
pages/userCenter/userInfo/smsVerification.vue

@@ -1,24 +1,35 @@
 <template>
 	<view class="smsVerification-container">
 		<view class="sms-title">输入短信验证码</view>
-		<text class="sms-describe">验证码已发送至157****7854,请在下方输入框内输入6位数字验证码</text>
+		<text class="sms-describe">验证码已发送至{{userPhone}},请在下方输入框内输入6位数字验证码</text>
 		<view class="sms-item" @tap="showKeyboard=!showKeyboard">
 			<u-message-input mode="bottomLine" :maxlength="6" v-model="value" :disabled-keyboard="true"></u-message-input>
 		</view>
 		<view class="sendcode-con">
-			<text :class="['getcode-btn', isDisable ? 'grey-btn' : '']" @click="isDisable ? null : getCodeValidate()">{{nowVal}}</text>
+			<text :class="['getcode-btn', isDisable ? 'grey-btn' : '']" @click="isDisable ? null : pageInit()">{{nowVal}}</text>
 		</view>
-		<view class="btn-con">
+		<!-- <view class="btn-con">
 			<u-button class="handle-btn" type="info" size="medium" @click="cancel">取消</u-button>
 			<u-button class="handle-btn" type="primary" size="medium" @click="submit">确定</u-button>
-		</view>
+		</view> -->
 		<!-- 数字键盘 -->
 		<u-keyboard ref="uKeyboard" :dot-enabled="false" :mask="false" :tooltip="false" v-model="showKeyboard" @change="valChange" @backspace="backspace"></u-keyboard>
+		<!-- 图文验证码 -->
+		<uni-popup ref="imageTxtPopup" type="center">
+			<popup-con title="图文验证码" :popBtn="popBtn" :changeImg="changeImg" @captchaImg="captchaVerify"></popup-con>
+		</uni-popup>
 	</view>
 </template>
 
 <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'
 	export default {
+		components: {
+			uniPopup,
+			popupCon
+		},
 		data() {
 			return {
 				nowVal: '获取验证码',  //  按钮显示内容
@@ -26,19 +37,84 @@
 				timer: null,  //  倒计时
 				isDisable: false,  //  是否禁止获取验证码
 				value: '', //输入的内容
-				showKeyboard: false  //  是否打开键盘
+				phone: '', // 用户手机号
+				showKeyboard: false,  //  是否打开键盘
+				popBtn: [],  //  name为操作按钮名称,color为操作按钮颜色值
+				changeImg: false,  //  是否重新更换图形验证码
+				verifyCode: '',
+				randomCode: '',  //  图片验证码随机码
 			}
 		},
-		onShow() {
-			this.getCodeValidate()
-		},
 		onLoad() {
+			this.phone = this.$store.state.vuex_userData.mobile
+			console.log(this.$store.state.vuex_userData,'his.$store.state.vuex_OrderAddress')
 			//因为此时实例没有挂载完成,需要延迟操作
 			setTimeout(() => {
-			  this.showKeyboard = true
+			  this.pageInit()
 			}, 50)
 		},
+		computed: {
+			userPhone () {
+				return this.phone.substr(0,3) + "****" + this.phone.substr(7)
+			}
+		},
+		watch: {
+			// 监听输入框输入长度
+			 value: {
+				handler(newVal) {
+					// console.log(newVal.length,'NNNNNNNNNNNN')
+					if(newVal.length==6) {
+						//  跳转到设置密码
+						uni.redirectTo({
+							url: `/pages/userCenter/userInfo/paymentPwd?code=${this.value}&mobile=${this.phone}`
+						})
+					}
+				},
+				deep: true
+			}
+		},
 		methods:{
+			pageInit () {
+				this.value = ''
+				this.showKeyboard = false
+				this.retsetCode()
+				//  图文验证码
+				this.$refs.imageTxtPopup.open()
+			},
+			//  验证图片验证码
+			captchaVerify(code, nowRandomCode){
+				let obj = {}
+				obj.phone = this.phone
+				obj.random = nowRandomCode
+				obj.code = code
+				//  短信验证码
+				sendVerifyCode(obj).then(res => {
+					console.log(JSON.stringify(res))
+					if(res.status == 200){  //  验证码输入正确
+						this.randomCode = nowRandomCode  //  图片验证码随机码
+						//  关闭   图形验证码 弹框
+						this.$refs.imageTxtPopup.close()
+						//  开启倒计时
+						this.getCodeFun()
+						this.showKeyboard = true
+						uni.showToast({icon: 'none',title: '验证码发送成功'})
+					}else {  //  验证码输入错误
+						this.retsetCode()
+						uni.showToast({icon: 'none',title: res.message})
+					}
+				})
+			},
+			// 重新触发获取图片验证码
+			retsetCode(){
+				const _this = this
+				_this.verifyCode = ''
+				_this.randomCode = ''
+				//  切换验证码重新校验
+				_this.changeImg = false
+				_this.$nextTick(function(){
+					_this.changeImg = true
+				})
+			},
 			// 按键被点击(点击退格键不会触发此事件)
 			valChange(val) {
 				// 将每次按键的值拼接到value变量中,注意+=写法
@@ -51,21 +127,6 @@
 				// 删除value的最后一个字符
 				if(this.value.length) this.value = this.value.substr(0, this.value.length - 1)
 			},
-			//  获取验证码
-			getCodeValidate(){
-				const _this = this
-				//  短信验证码
-				// memberVerifyCode({ phone: '15454787787' }).then(res => {
-				// 	console.log(JSON.stringify(res))
-				// 	if(res.status == 200){  //  验证码输入正确
-						//  开启倒计时
-						this.getCodeFun()
-						uni.showToast({icon: 'none',title: '验证码发送成功'})
-				// 	}else {  //  验证码输入错误
-				// 		uni.showToast({icon: 'none',title: res.message})
-				// 	}
-				// })
-			},
 			//  开始倒计时
 			getCodeFun(){
 				const TIME_COUNT = 60

+ 2 - 2
pages/userCenter/userInfo/userInfo.vue

@@ -75,10 +75,10 @@
 			setPayPwd(){
 				// 设置过支付密码,则修改密码
 				if(this.existPayPwd){
-					uni.navigateTo({ url: '/pages/userCenter/userInfo/paymentPwd' })
+					uni.navigateTo({ url: '/pages/userCenter/userInfo/changePayPwd' })
 				}else{
 					// 没设置过支付密码,提示设置密码
-					uni.navigateTo({ url: '/pages/userCenter/userInfo/changePayPwd' })
+					uni.navigateTo({ url: '/pages/userCenter/userInfo/smsVerification' })
 				}
 			},
 			// 退出登录