12-Add页面

华宇
2023-12-01

<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Add</title>
<script src="~/Content/jquery-3.1.1.js"></script>
<script>
$(function () {
$("#form1").hide();
GetCarPrice();
GetPinPai();
GetCarXingType();
GetCarGroup();
})
function GetPinPai() {
$.ajax({
url: '/CarHome/GetCarPinPai',
type: 'post',
success: function (data) {
var json = JSON.parse(data);
console.log(json);
$("#CarPinPaiID").empty();
$("#CarPinPaiID").append('<option value="-1">请选择</option>');
for (var i = 0; i < json.length; i++) {
var op = '<option value = " ' + json[i].PinPaiName + '">' + json[i].PinPaiName + '</option>';
$("#CarPinPaiID").append(op);
}
}
})
}
function GetCarPrice() {
$.ajax({
url: '/CarHome/GetCarPrice',
type: 'post',
success: function (data) {
var json = JSON.parse(data);
console.log(json);
$("#CarPriceID").empty();
$("#CarPriceID").append('<option value="-1">请选择</option>');
for (var i = 0; i < json.length; i++) {
var op = '<option value = "' + json[i].CarPriceName + '">' + json[i].CarPriceName + '</option>';
$("#CarPriceID").append(op);
}
}
})
}
function GetCarXingType() {
$.ajax({
url: '/CarHome/GetCarXingType',
type: 'post',
success: function (data) {
var json = JSON.parse(data);
$("#CarXingTypeID").empty();
$("#CarXingTypeID").append('<option value="-1">请选择</option>');
for (var i = 0; i < json.length; i++) {
var op = '<option value = "' + json[i].CarXingName + '">' + json[i].CarXingName + '</option>';
$("#CarXingTypeID").append(op);
}
}
})
}
function GetCarGroup() {
$.ajax({
url: '/CarHome/GetCarGroup',
type: 'post',
success: function (data) {
var json = JSON.parse(data);
$("#CarGroupID").empty();
$("#CarGroupID").append('<option value="-1">请选择</option>');
for (var i = 0; i < json.length; i++) {
var op = '<option value = "' + json[i].CarGroupName + '">' + json[i].CarGroupName + '</option>';
$("#CarGroupID").append(op);
}
}
})
}
function Img() {
$("#form1").show();
}
function UpImg() {
$.ajax({
url: '/CarHome/Imgs',
type: 'post',
contentType: false,
processData: false,
cache: false,
data: new FormData($("#form1")[0]),
success: function (data) {
$("#uploadimg").prop("src", data);
$("[name=CarImg]").val(data);
$("#form1").hide();
}
})
}
function Add() {
$.ajax({
url: '/CarHome/CarAdd',
data: $("#form0").serialize(),
type: 'post',
success: function (data) {
if (data > 0) {
alert("添加成功!");
return;
}
else {
alert("添加失败!");
return;
}
}
})
}
</script>
</head>
<body>
<div>
<form action="/" method="post" id="form0">
<div>
<input type="hidden" name="CarImg" />
<table>
<tr>
<td>房车名称</td>
<td><input type="text" name="CarName" /></td>
<td>房车品牌</td>
<td>
<select name="CarPinPaiID" id="CarPinPaiID">
<option value="-1">请选择</option>
</select>
</td>
</tr>
<tr>
<td>房车型号</td>
<td><input type="text" name="CarTypeID" /></td>
<td>房车型号</td>
<td><input type="text" name="CarTyoeID2" /></td>
</tr>
<tr>
<td>房车型号</td>
<td colspan="3"><img src="" id="uploadimg" width="50" height="50" /><input type="button" οnclick="Img()" value="上传图片" /></td>
</tr>

<tr>
<td>房车描述</td>
<td>
<textarea style="width:500px;height:100px;" name="CarRemark">
</textarea>
</td>
</tr>
</table>
<span style="color:#0094ff">参数配置:</span><br />
<table>
<tr>
<td>车辆形式</td>
<td><input type="text" name="CarXingShi" /></td>
<td>驱动方式</td>
<td><input type="text" name="CarQuDong" /></td>
</tr>
<tr>
<td>发动机型号</td>
<td><input type="text" name="CarFaDongJi" /></td>
<td>轴距(mm)</td>
<td><input type="text" name="CarZhouJu" /></td>
</tr>
<tr>
<td>发动机排量/功率</td>
<td><input type="text" name="CarPaiLiang" /></td>
<td>最大总质量(kg)</td>
<td><input type="text" name="CarZhiLiang" /></td>
</tr>
<tr>
<td>发动机扭矩</td>
<td><input type="text" name="CarNiuJu" /></td>
<td>整备质量(kg)</td>
<td><input type="text" name="CarZhengBei" /></td>
</tr>
<tr>
<td>燃油类型/环保标准</td>
<td><input type="text" name="CarRanYou" /></td>
<td>燃油容积</td>
<td><input type="text" name="CarYouXiang" /></td>
</tr>
</table>
<span style="color:#0094ff">分类信息:</span><br />
<p>
<table>
<tr>
<td>价格区间</td>
<td>
<select name="CarPriceID" id="CarPriceID">
<option value="-1">请选择</option>
</select>
</td>
<td>车辆分类</td>
<td>
<select name="CarXingTypeID" id="CarXingTypeID">
<option value="-1">请选择</option>
</select>
</td>
<td>车辆分组</td>
<td>
<select name="CarGroupID" id="CarGroupID">
<option value="-1">请选择</option>
</select>
</td>
</tr>
</table>
</p>
<span style="color:#0094ff">基本信息:</span><br />
<table>
<tr>
<td>咨询热线</td>
<td><input type="text" name="CarZiXun" /></td>
<td>排放标准</td>
<td><input type="text" name="CarPaiFang" /></td>
</tr>
<tr>
<td>市场 价</td>
<td><input type="text" name="CarPrice" /></td>
<td>型 号</td>
<td><input type="text" name="CarXingNum" /></td>
</tr>
<tr>
<td>类 型</td>
<td><input type="text" name="CarTypeXing" /></td>
<td>保养周期(kg)</td>
<td><input type="text" name="CarBaoYang" /></td>
</tr>
<tr>
<td>功能类型</td>
<td><input type="text" name="CarGong" /></td>
<td>上市时间</td>
<td><input type="text" name="CarCreateTime" /></td>
</tr>
<tr>
<td>变速箱</td>
<td><input type="text" name="CarBianSuXiang" /></td>
<td>长宽高</td>
<td><input type="text" name="CarLongWidth" /></td>
</tr>
<tr>
<td>销售展厅</td>
<td><input type="text" name="CarZhanTing" /></td>
<td></td>
<td></td>
</tr>
</table>
<span style="color:#0094ff">基本信息:</span><br />
<table>
<tr>
<td>厂家名称</td>
<td><input type="text" name="CarChangName" /></td>
<td>厂家描述</td>
<td rowspan="3">
<textarea style="width:200px;" name="CarChangRemark">

</textarea>
</td>
</tr>
<tr>
<td>厂家地址</td>
<td><input type="text" name="CarChangAddress" /></td>
<td></td>
<td></td>
</tr>
<tr>
<td>厂家电话</td>
<td><input type="text" name="CarChangPhone" /></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td><input type="button" value="添加" οnclick="Add()"/></td>
<td></td>
<td></td>
</tr>
</table>
</div>
</form>
<form action="/" method="post" id="form1">
<input type="file" name="file" id="file" />
<input type="button" value="上传图片" οnclick="UpImg()" />
</form>
</div>
</body>
</html>

转载于:https://www.cnblogs.com/Wangyang11/p/10003367.html

 类似资料: