From 4b80c98ef5fda8d6358778f2efe8bb35cb20ccf9 Mon Sep 17 00:00:00 2001
From: queenwuli <942534046@qq.com>
Date: Fri, 15 Jan 2021 16:18:21 +0800
Subject: [PATCH] gx

---
 hive-app/pages/workbench/confirmService.vue |   92 ++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 84 insertions(+), 8 deletions(-)

diff --git a/hive-app/pages/workbench/confirmService.vue b/hive-app/pages/workbench/confirmService.vue
index cfb01e9..297eb77 100644
--- a/hive-app/pages/workbench/confirmService.vue
+++ b/hive-app/pages/workbench/confirmService.vue
@@ -16,7 +16,7 @@
 				<text>预约时间</text>
 				<text class="gray" @click="showTime()">{{yyTime || '请选择预约时间'}}</text>
 			</view>
-			<date-time-picker ref='date-time' type='datetime' @change='dateTimeChange'></date-time-picker>
+			<date-time-picker ref='date-time' :startDate="startDate" type='datetime' @change='dateTimeChange'></date-time-picker>
 			<view class="content-row flex align-center justify-between">
 				<text>预约技师</text>
 				<view class="blue">
@@ -55,14 +55,28 @@
 		<view class="footer">
 			<button :disabled="isDisabled" class="blue-btn" @click="createOrder">提交服务单</button>
 		</view>
+		
+		<uni-popup ref="popup" type="center" @change="popupChange">
+			<view class="popup-container">
+				<view class="popup-title">请输入资金密码</view>
+				<password-input :numLng='password'></password-input>
+			</view>
+		</uni-popup>
+		<number-keyboard ref='KeyboarHid' :topBarShow="false" @input='changePwd' psdLength='6' :value="password"></number-keyboard>
 	</view>
 </template>
 
 <script>
+	import numberKeyboard from '@/components/number-keyboard/number-keyboard.vue'
+	import passwordInput from '@/components/password-input/password-input.vue'
 	import DateTimePicker from '../../components/bory-dateTimePicker/bory-dateTimePicker.vue'
+	import uniPopup from '@/components/uni-popup/uni-popup.vue'
 	export default{
 		components:{
-			DateTimePicker
+			DateTimePicker,
+			numberKeyboard,
+			passwordInput,
+			uniPopup
 		},
 		data(){
 			return{
@@ -73,7 +87,9 @@
 				curEmployee: {},
 				memberInfo: {},
 				remark: '',
-				isDisabled: false
+				isDisabled: false,
+				password: '',
+				isExistPwd: false
 			}
 		},
 		computed:{
@@ -90,14 +106,25 @@
 					timeLength += item.timeLength * item.num;
 				})
 				return timeLength;
+			},
+			startDate(){
+				return this.$utils.formmatTime('YY-mm-dd')
 			}
 		},
 		onLoad(options) {
 			this.id = options.id;
 			this.list = JSON.parse(decodeURIComponent(options.list));
+			this.loadIsExistFundPassword();
 			this.loadMemberInfo();
 		},
 		methods:{
+			loadIsExistFundPassword(){
+				this.$httpUtils.request('/api/vip/isExistFundPassword/'+this.id).then((res) => {
+					if(res.status == 200){
+						this.isExistPwd = res.mapInfo.isExist;
+					}
+				})
+			},
 			loadMemberInfo(){
 				this.$httpUtils.request('/api/vip/findVipInfoById/'+this.id).then((res) => {
 					if(res.status == 200){
@@ -125,6 +152,9 @@
 				this.loadEmployeeList()
 			},
 			employeeChange(e){
+				if(!this.employeeList.length){
+					return;
+				}
 				this.curEmployee = this.employeeList[e.detail.value];
 			},
 			valid(){
@@ -132,16 +162,43 @@
 					this.$toast.info('请预约时间');
 					return false
 				}
-				if(!this.curEmployee.id){
+				if(!this.curEmployee || !this.curEmployee.id){
 					this.$toast.info('请预约美疗师');
 					return false
+				}
+			},
+			// 弹窗状态change
+			popupChange(e) {
+				if(!e.show){
+					this.password = '';
+					this.$refs.KeyboarHid.close();
+				}
+			},
+			changePwd(val){
+				this.password = val;
+				if(this.password.length == 6){
+					this.submit()
 				}
 			},
 			createOrder(){
 				if(this.valid() === false){
 					return;
 				}
-				this.isDisabled = true;
+				// 未设置资金密码,不弹出密码框
+				if(!this.isExistPwd){
+					this.submit();
+					return;
+				}
+				this.$refs.popup.open();
+				setTimeout(() => {
+					this.$refs.KeyboarHid.open()
+				}, 50);
+			},
+			submit(){
+				if(this.isRequesting){
+					return;
+				}
+				this.isRequesting = true;
 				let projItems = this.list.map((item) => {
 					return {
 						"count": item.num,
@@ -154,17 +211,20 @@
 					remark: this.remark,
 					totalTime: this.totalTime,
 					yyTime: this.yyTime,
-					vipId: this.id
+					vipId: this.id,
+					password: this.password
 				}, 'POST').then((res) => {
 					if(res.status == 200){
 						uni.navigateTo({
 							url: './submitSucceed?type=2'
 						})
+					}else{
+						this.password = '';
 					}
 					this.$toast.info(res.info);
-					this.isDisabled = false;
+					this.isRequesting = false;
 				}).catch(() => {
-					this.isDisabled = false;
+					this.isRequesting = false;
 				})
 			}
 		}
@@ -172,6 +232,22 @@
 </script>
 
 <style>
+	.popup-container{
+		background: #FFFFFF;
+		width: 500rpx;
+		padding: 20px 20px 30px;
+		border-radius: 6px;
+	}
+	.popup-title{
+		font-size: 16px;
+		text-align: center;
+		margin-bottom: 15px;
+	}
+	.popup-sub-title{
+		font-size: 15px;
+		text-align: center;
+		padding: 10px 0;
+	}
 	page{
 		background: #F6F6F8;
 		padding-top: 10px;

--
Gitblit v1.9.1