143 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			143 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <template>
 | ||
| 	<view class="content">
 | ||
| 		<view class="container">
 | ||
| 			<view class="my-header">
 | ||
| 				<view class="my-icons" @click="goBack"> <uni-icons type="left" size="16"></uni-icons> </view>
 | ||
| 				<view class="my-text">添加子卡</view>
 | ||
| 				<view class="my-icons"></view>
 | ||
| 			</view>
 | ||
| 			<!-- 顶部区域 -->
 | ||
| 			<view class="input_">
 | ||
| 				<view class="">请输入手机号:</view>
 | ||
| 				<view class="">
 | ||
| 					<input type="text" v-model="cardValueChildrens.cardChildPhones" placeholder="请输入手机号" />
 | ||
| 				</view>
 | ||
| 			</view>
 | ||
| 			<view class="anniu" @click="submitCardValChildren">
 | ||
| 				<text>提交</text>
 | ||
| 			</view>
 | ||
| 
 | ||
| 
 | ||
| 		</view>
 | ||
| 	</view>
 | ||
| </template>
 | ||
| 
 | ||
| <script>
 | ||
| 	import request from '../../utils/request'
 | ||
| 	export default {
 | ||
| 		data() {
 | ||
| 			return {
 | ||
| 				title: '',
 | ||
| 				cardValueChildrens:{
 | ||
| 					cardChildPhones:"",
 | ||
| 					storeId:uni.getStorageSync("storeId"),
 | ||
| 				},
 | ||
| 			}
 | ||
| 		},
 | ||
| 
 | ||
| 		components: {
 | ||
| 
 | ||
| 		},
 | ||
| 		methods: {
 | ||
| 			// 添加子卡信息
 | ||
| 			submitCardValChildren(){
 | ||
| 				console.log(this.cardValueChildrens);
 | ||
| 				if(this.cardValueChildrens.cardChildPhones==""){
 | ||
| 					uni.showToast({
 | ||
| 						title:"请填写子卡手机号",
 | ||
| 						icon:"none"
 | ||
| 					})
 | ||
| 					return;
 | ||
| 				}
 | ||
| 				if(this.cardValueChildrens.cardChildPhones.length!=11){
 | ||
| 					uni.showToast({
 | ||
| 						title:"请填写正确的手机号",
 | ||
| 						icon:"none"
 | ||
| 					})
 | ||
| 					return;
 | ||
| 				}
 | ||
| 				request({
 | ||
| 					url: "cardValudChildrens",
 | ||
| 					method: 'post',
 | ||
| 					data:this.cardValueChildrens,
 | ||
| 				}).then((res) => {
 | ||
| 					// console.log(res)
 | ||
| 					if (res.data.error){
 | ||
| 						uni.showToast({
 | ||
| 							title:res.data.error,
 | ||
| 							icon:"none"
 | ||
| 						})
 | ||
| 					}else{
 | ||
| 						uni.showToast({
 | ||
| 							title:"添加成功",
 | ||
| 							icon:"success"
 | ||
| 						})
 | ||
| 						this.goBack()
 | ||
| 					}
 | ||
| 				})
 | ||
| 			},
 | ||
| 			goBack() {
 | ||
| 				uni.navigateBack()
 | ||
| 			}
 | ||
| 		}
 | ||
| 	}
 | ||
| </script>
 | ||
| 
 | ||
| <style scoped lang="scss">
 | ||
| 	.content {
 | ||
| 		background: #ffffff;
 | ||
| 	}
 | ||
| 
 | ||
| 	.container {
 | ||
| 		width: 100%;
 | ||
| 		height: 100vh;
 | ||
| 		box-sizing: border-box;
 | ||
| 		padding-top: 88px;
 | ||
| 	}
 | ||
| 
 | ||
| 	.my-header {
 | ||
| 		width: 100%;
 | ||
| 		height: 88px;
 | ||
| 		background: #ffffff;
 | ||
| 		display: flex;
 | ||
| 		align-items: center;
 | ||
| 		justify-content: space-between;
 | ||
| 		color: #000;
 | ||
| 		box-sizing: border-box;
 | ||
| 		padding: 0px 15px;
 | ||
| 		padding-top: 40px;
 | ||
| 
 | ||
| 		.my-icons {
 | ||
| 			width: 20px;
 | ||
| 
 | ||
| 		}
 | ||
| 
 | ||
| 		position: fixed;
 | ||
| 		top: 0px;
 | ||
| 	}
 | ||
| 
 | ||
| 	.input_ {
 | ||
| 		width: 90%;
 | ||
| 		box-sizing: border-box;
 | ||
| 		padding: 15px 0px;
 | ||
| 		display: flex;
 | ||
| 		align-items: center;
 | ||
| 		border-bottom: 1px solid #DDDDDD;
 | ||
| 		margin: 15px auto;
 | ||
| 
 | ||
| 	}
 | ||
| 
 | ||
| 	.anniu {
 | ||
| 		width: 90%;
 | ||
| 		height: 42px;
 | ||
| 		margin: 15px auto;
 | ||
| 		display: flex;
 | ||
| 		align-items: center;
 | ||
| 		justify-content: center;
 | ||
| 		color: white;
 | ||
| 		border-radius: 8px;
 | ||
| 		background: #ff6e05;
 | ||
| 
 | ||
| 	}
 | ||
| </style>
 |