96 lines
4.2 KiB
PHP
96 lines
4.2 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('content')
|
|
<style type="text/css" media="screen">
|
|
.c_footer_bg{display: none}
|
|
</style>
|
|
<section class="padding_btm">
|
|
<!--添加收货地址-->
|
|
<form action="{{ route('addresses.update', $address )}}" method="post" accept-charset="utf-8">
|
|
<div class="g-input">
|
|
<div class="g-input-name"><i class="icon-user address-i"></i>收货人</div>
|
|
<input type="text" name="name" value="{{ $address->name }}" placeholder="输入收货人姓名">
|
|
</div>
|
|
<div class="g-input">
|
|
<div class="g-input-name"><i class="icon-tablet address-i"></i>手机号</div>
|
|
<input type="number" name="mobile" value="{{ $address->mobile }}" placeholder="输入手机号">
|
|
</div>
|
|
<div class="g-select">
|
|
<div class="g-input-name"><i class="icon-map-marker address-i"></i>收货地址</div>
|
|
<select name="province_sn" id="province">
|
|
<option value="">选择省份</option>
|
|
@foreach ($provinces as $province)
|
|
<option value="{{ $province->sn }}" @if ($address['province_sn'] == $province->sn) selected @endif>{{ $province->name }}</option>
|
|
@endforeach
|
|
</select>
|
|
<select name="city_sn" id="city" style="margin-top:15px;">
|
|
<option value="">选择城市</option>
|
|
@foreach ($cities as $city)
|
|
<option value="{{ $city->sn }}" @if ($address['city_sn'] == $city->sn) selected @endif>{{ $city->name }}</option>
|
|
@endforeach
|
|
</select>
|
|
<select name="area_sn" id="area" style="margin-top:15px;">
|
|
<option value="">选择地区</option>
|
|
|
|
@foreach ($areas as $area)
|
|
<option value="{{ $area->sn }}" @if ($address['area_sn'] == $area->sn) selected @endif>{{ $area->name }}</option>
|
|
@endforeach
|
|
</select>
|
|
<textarea class="textarea" placeholder="街道等详细地址" name="address" id="address" rows="2" style="margin-top:15px;">{{ $address->address }}</textarea>
|
|
</div>
|
|
@csrf
|
|
@method('put')
|
|
<div >
|
|
<button type="button" class="footer-btn ajax-post" style="background:#313131;position:static;">保存</button>
|
|
</div>
|
|
</form>
|
|
<!--end 添加收货地址-->
|
|
</section>
|
|
|
|
@endsection
|
|
|
|
@section('script')
|
|
<script type="text/javascript">
|
|
$("#province").on('change', function() {
|
|
var psn = $(this).val();
|
|
$.post('{{ route('addresses.areas')}}', {psn: psn, _token:"{{ csrf_token() }}"}, function(res) {
|
|
if (res.code) {
|
|
$('#city').html("");
|
|
var option1 = $("<option>").val(0).text('请选择');
|
|
$('#city').append(option1);
|
|
$.each(res.data, function(key, val) {
|
|
var option1 = '<option value="' + val.sn + '">'+ val.name +'</option>';
|
|
$('#city').append(option1);
|
|
});
|
|
$("#area").get(0).selectedIndex = 0;
|
|
$("#city").get(0).selectedIndex = 0;
|
|
|
|
} else {
|
|
updateAlert(res.msg);
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
$("#city").on('change', function() {
|
|
var psn = $(this).val();
|
|
$.post('{{ route('addresses.areas')}}', {psn: psn, _token:"{{ csrf_token() }}"}, function(res) {
|
|
if (res.code) {
|
|
$('#area').html("");
|
|
var option1 = $("<option>").val(0).text('请选择');
|
|
$('#area').append(option1);
|
|
$.each(res.data, function(key, val) {
|
|
var option1 = '<option value="' + val.sn + '">'+ val.name +'</option>';
|
|
$('#area').append(option1);
|
|
});
|
|
$("#area").get(0).selectedIndex=0;
|
|
} else {
|
|
updateAlert(res.msg);
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
@endsection
|