<template>
	<view>
		<view class="tr">
			<input class="input" style="display:none;" />
			<text>编号：</text><input class="input" name="coding" v-model="coding" />
			<button  type="primary" @click="select()" class="button1">
				<p class="p">查询</p>
			</button>
			<button  type="primary" @click="del()" class="button1">
				<p class="p">删除</p>
			</button>
		</view>
		<view class="tr">
			<input class="input" style="display:none;" />
			<text>名称：</text><p class="">{{name}}</p>
		</view>
		<view class="tr">
			<input class="input" style="display:none;" />
			<text>添加时间：</text><p class="">{{createDate}}</p>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				coding:null,
				name:'',
				createDate:''
			}
		},
		methods: {
			select(){
				var token = uni.getStorageSync("token");
				uni.request({
					url: this.serverurl + "/TCoding/select?coding=" + this.coding,
					method: "POST",
					header: {
						'token': token
					},
					success: (Result) => {
						// console.log(Result);
						var res = Result;
						if(!res.data.code){
							uni.showModal({
								title: '提示',
								content: res.data.message,
							});
						}else{
							var data = res.data.data;
							this.name = data.name;
							this.createDate = data.createDate;
						}
					}
				});
			},
			del(){
				uni.showModal({
					title: '删除',
					content: '确定执行操作？',
					success: (res) => {
						if (res.confirm) {
							var that = this;
							var serverUrl = that.serverurl;
							var token = uni.getStorageSync("token");
							uni.request({
								url: serverUrl + "/TCoding/delete?coding=" + this.coding,
								method: "POST",
								header: {
									'token': token
								},
								success: (Result) => {
									// console.log(Result);
									var res = Result;
									uni.showModal({
										title: '提示',
										content: res.data.message,
									});
								}
							});
						}
					}
				});
			}
		}
	}
</script>

<style>
	.tr {
		padding-left: 30upx;
		padding-top: 13upx;
		font-size: 30upx;
		padding-bottom: 13upx;
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
	}
	.button1 {
		margin: auto;
		width: 75upx;
		height: 50upx;
	}
	.input {
		/* padding: 10upx 20upx 10upx 0upx; */
		padding-left: 20upx;
		padding-top: 10upx;
		background-color: #FFFFFF;
		width: 400upx;
		height: 50upx;
		box-shadow: 0upx 0upx 20upx #D3D3D3;
		border-radius: 5upx;
	}
	.p {
		/* #ifdef H5 */
		top: -13%;
		/* #endif */
		width: 50upx;
		height: 30upx;
		font-size: 25upx;
		padding-right: 9upx;
		padding-top: 6upx;
		/* #ifndef H5 */
		/* padding-top: 10upx; */
		/* #endif */
	
		position: absolute;
		/* 水平居中 */
		left: 50%;
		-webkit-transform: translateX(-50%);
		transform: translateX(-50%);
	}
</style>
