作者 anyv
1 个管道 的构建 通过 耗费 1 秒

4

... ... @@ -141,7 +141,13 @@ class PersonalcenterController extends WeChatBaseController{
*/
public function shop_address(){
$data = Db::name('address') -> where("delete_time = 0") -> select();
$data = Db::name('address') -> where("delete_time = 0") -> select() -> toArray();
if(!empty($data)){
foreach($data as $key => $val){
$detailed = explode(',',$val['detailed']);
$data[$key]['detailed'] = $detailed[0].$detailed[1];
}
}
$this -> assign('data',$data);
return $this -> fetch();
... ... @@ -205,6 +211,9 @@ class PersonalcenterController extends WeChatBaseController{
$id = $this -> request -> param();
$data = Db::name('address') -> where('id',$id['id']) -> find();
$detailed = explode(',',$data['detailed']);
$data['detailed0'] = $detailed[0];
$data['detailed1'] = $detailed[1];
$this -> assign('data',$data);
return $this -> fetch();
... ...
... ... @@ -78,7 +78,7 @@
region = $('#city_text').text();
address_content = $('#address_content').val();
address_content_con = $('#address_content_con').val();
detailed = address_content+address_content_con;
detailed = address_content+','+address_content_con;
$.post("{:url('Personalcenter/add_shop_address')}",{name:name,phone:phone,region:region,detailed:detailed},function(data){
if(data){
window.location.href = "{:url('Personalcenter/shop_address')}";
... ...
... ... @@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>学考无忧-新增地址</title>
<title>学考无忧-地址编辑</title>
<link rel="stylesheet" href="__TMPL__/public/assets/css/mui.min.css">
<link rel="stylesheet" href="__TMPL__/public/assets/css/mui.picker.min.css">
<link rel="stylesheet" href="__TMPL__/public/assets/css/reset.css">
... ... @@ -25,7 +25,7 @@
<a href="javascript:history.back(-1)">
<img class="ad_topImg" src="__TMPL__/public/assets/images/left.png" alt="">
</a>
<h1>收货地址</h1>
<h1>收货地址编辑</h1>
<p style="color:#FF7700;" onclick="add_save()">保存</p>
</div>
<!-- 内容 -->
... ... @@ -33,24 +33,24 @@
<ul>
<li>
<label for="">姓名</label>
<input type="text" placeholder="请输入姓名" id="name">
<input type="text" placeholder="请输入姓名" id="name" value="{$data.name}">
</li>
<li>
<label for="">手机号</label>
<input type="text" placeholder="请输入手机号" id="phone">
<input type="text" placeholder="请输入手机号" id="phone" value="{$data.phone}">
</li>
<li class="add_conThere">
<label for="">地区</label>
<div class="add_city" id="city_text" type="text" placeholder="">选择省市区</div>
<div class="add_city" id="city_text" type="text" placeholder="">{$data.region}</div>
<img src="__TMPL__/public/assets/images/29.png" alt="">
</li>
<li>
<label for="">详细地址</label>
<input type="text" placeholder="街道、小区、门牌号码" id="address_content">
<input type="text" placeholder="街道、小区、门牌号码" id="address_content" value="{$data.detailed0}">
</li>
</ul>
<div class="add_detailAddress">
<textarea placeholder="请输入详细地址,不少于15字" maxlength="200" id="address_content_con"></textarea>
<textarea placeholder="请输入详细地址,不少于15字" maxlength="200" id="address_content_con">{$data.detailed1}</textarea>
</div>
</div>
</div>
... ...