正在显示
4 个修改的文件
包含
33 行增加
和
5 行删除
@@ -368,9 +368,17 @@ class FormController extends WeChatBaseController | @@ -368,9 +368,17 @@ class FormController extends WeChatBaseController | ||
368 | public function create_order_renew(){ | 368 | public function create_order_renew(){ |
369 | $user_id = cmf_get_current_user_id(); | 369 | $user_id = cmf_get_current_user_id(); |
370 | $param = $this->request->param(); | 370 | $param = $this->request->param(); |
371 | + //查询当前订单号 | ||
372 | + $orderInfoModel = new OrderInfoModel(); | ||
373 | + $order = $orderInfoModel->findData(array('collocation_id'=>$param['id'])); | ||
374 | + if(empty($order)){ | ||
375 | + $arr['code'] = 40000; | ||
376 | + $arr['msg'] = "未查询到订单"; | ||
377 | + return json_encode($arr); | ||
378 | + } | ||
371 | //判断当前订单是否为当收费 | 379 | //判断当前订单是否为当收费 |
372 | $orderModel = new OrderModel(); | 380 | $orderModel = new OrderModel(); |
373 | - $order = $orderModel->findData(array('id'=>$param['order_id'],'user_id'=>$user_id)); | 381 | + $order = $orderModel->findData(array('id'=>$order['order_id'],'user_id'=>$user_id)); |
374 | if(empty($order)){ | 382 | if(empty($order)){ |
375 | $arr['code'] = 40002; | 383 | $arr['code'] = 40002; |
376 | $arr['msg'] = '我查询到当前订单!'; | 384 | $arr['msg'] = '我查询到当前订单!'; |
@@ -397,6 +405,7 @@ class FormController extends WeChatBaseController | @@ -397,6 +405,7 @@ class FormController extends WeChatBaseController | ||
397 | } | 405 | } |
398 | $arr['code'] = 20000; | 406 | $arr['code'] = 20000; |
399 | $arr['msg'] = '创建续费订单成功'; | 407 | $arr['msg'] = '创建续费订单成功'; |
408 | + $arr['data'] = $result; | ||
400 | return json_encode($arr); | 409 | return json_encode($arr); |
401 | } | 410 | } |
402 | //进入下单页面 | 411 | //进入下单页面 |
@@ -18,7 +18,7 @@ class OrderRenewModel extends Model | @@ -18,7 +18,7 @@ class OrderRenewModel extends Model | ||
18 | return $data; | 18 | return $data; |
19 | } | 19 | } |
20 | public function insertData($data){ | 20 | public function insertData($data){ |
21 | - $result = $this->insert($data); | 21 | + $result = $this->insertGetId($data); |
22 | return $result; | 22 | return $result; |
23 | } | 23 | } |
24 | } | 24 | } |
@@ -30,7 +30,7 @@ class PayRenewController extends HomeBaseController | @@ -30,7 +30,7 @@ class PayRenewController extends HomeBaseController | ||
30 | * 微信支付 | 30 | * 微信支付 |
31 | */ | 31 | */ |
32 | public function index(){ | 32 | public function index(){ |
33 | - $order_renew_id = $this->request->param('order_renew_id'); | 33 | + $order_renew_id = $this->request->param('id'); |
34 | $data = Db::name('order_renew')->where('id',$order_renew_id)->find(); | 34 | $data = Db::name('order_renew')->where('id',$order_renew_id)->find(); |
35 | if(empty($data)){ | 35 | if(empty($data)){ |
36 | $this->error('未查询到该订单!',''); | 36 | $this->error('未查询到该订单!',''); |
@@ -39,7 +39,7 @@ class PayRenewController extends HomeBaseController | @@ -39,7 +39,7 @@ class PayRenewController extends HomeBaseController | ||
39 | 'trade_type' => 'JSAPI', | 39 | 'trade_type' => 'JSAPI', |
40 | 'body' => '橙象保单-续费', | 40 | 'body' => '橙象保单-续费', |
41 | 'detail' => '以客户为中心 以奋斗者文本', | 41 | 'detail' => '以客户为中心 以奋斗者文本', |
42 | - 'out_trade_no' => cmf_get_order_sn(), | 42 | + 'out_trade_no' => $data['num'], |
43 | 'total_fee' => $data['total'],//1, // 单位:分 | 43 | 'total_fee' => $data['total'],//1, // 单位:分 |
44 | 'notify_url' => url('portal/pay_renew/notify','','',true), // 支付结果通知网址,如果不设置则会使用配置里的默认地址 | 44 | 'notify_url' => url('portal/pay_renew/notify','','',true), // 支付结果通知网址,如果不设置则会使用配置里的默认地址 |
45 | 'openid' => cmf_get_current_user_openid(), // trade_type=JSAPI,此参数必传,用户在商户appid下的唯一标识, | 45 | 'openid' => cmf_get_current_user_openid(), // trade_type=JSAPI,此参数必传,用户在商户appid下的唯一标识, |
@@ -148,12 +148,31 @@ | @@ -148,12 +148,31 @@ | ||
148 | <div class="trust_name">代理人姓名:{$data.agent_name}</div> | 148 | <div class="trust_name">代理人姓名:{$data.agent_name}</div> |
149 | <div class="trust_name">代理人联系方式</div> | 149 | <div class="trust_name">代理人联系方式</div> |
150 | <div class="trust_nimitel">{$data.agent_phone}</div> | 150 | <div class="trust_nimitel">{$data.agent_phone}</div> |
151 | - <a class="trust_btn" href="pay.html">立即续约</a> | 151 | + <a class="trust_btn">立即续约</a> |
152 | </div> | 152 | </div> |
153 | 153 | ||
154 | <script type="text/javascript" src="__TMPL__/public/assets/assets/js/jquery-2.1.0.js"></script> | 154 | <script type="text/javascript" src="__TMPL__/public/assets/assets/js/jquery-2.1.0.js"></script> |
155 | 155 | ||
156 | <script type="text/javascript" src="__TMPL__/public/assets/assets/js/swiper-3.4.2.jquery.min.js"></script> | 156 | <script type="text/javascript" src="__TMPL__/public/assets/assets/js/swiper-3.4.2.jquery.min.js"></script> |
157 | <script type="text/javascript" src="__TMPL__/public/assets/assets/js/common.js"></script> | 157 | <script type="text/javascript" src="__TMPL__/public/assets/assets/js/common.js"></script> |
158 | +<script> | ||
159 | + $(function(){ | ||
160 | + var id = {$data.id}; | ||
161 | + //订单续费 | ||
162 | + $('.trust_btn').click(function(){ | ||
163 | + $.ajax({ | ||
164 | + url:"{:url('index/form/create_order_renew')}", | ||
165 | + type:'POST', | ||
166 | + data:{'id':id}, | ||
167 | + success:function(data){ | ||
168 | + var result = eval("(" + data + ")"); | ||
169 | + if(result.code == 20000){ | ||
170 | + window.location.href="{:url('portal/pay_renew/index','','')}"+'/id/'+result.data; | ||
171 | + } | ||
172 | + } | ||
173 | + }) | ||
174 | + }) | ||
175 | + }) | ||
176 | +</script> | ||
158 | </body> | 177 | </body> |
159 | </html> | 178 | </html> |
-
请 注册 或 登录 后发表评论