作者 lihan

.

@@ -50,10 +50,8 @@ class OrderController extends AdminBaseController @@ -50,10 +50,8 @@ class OrderController extends AdminBaseController
50 if (request()->isPost()) { 50 if (request()->isPost()) {
51 $act = request()->param('act'); 51 $act = request()->param('act');
52 $status = 0; 52 $status = 0;
53 - if ($act == 'down_payment') {  
54 - $status = 2;  
55 - } elseif ($act == 'final_payment') {  
56 - $status = 4; 53 + if ($act == 'final_payment') {
  54 + $status = 3;
57 } else { 55 } else {
58 $this->error('操作失败'); 56 $this->error('操作失败');
59 } 57 }
@@ -112,15 +112,18 @@ class OrderController extends HomeBaseController @@ -112,15 +112,18 @@ class OrderController extends HomeBaseController
112 $data['is_use_discount_coupon'] = (empty($post['discount_coupon_id'])) ? 0 : 1; 112 $data['is_use_discount_coupon'] = (empty($post['discount_coupon_id'])) ? 0 : 1;
113 $data['discount_coupon_id'] = $post['discount_coupon_id']; 113 $data['discount_coupon_id'] = $post['discount_coupon_id'];
114 $data['payment'] = $post['payment']; 114 $data['payment'] = $post['payment'];
115 - $data['status'] = 0; 115 + $data['status'] = 1;
116 $data['room'] = $post['room']; 116 $data['room'] = $post['room'];
117 $data['desc'] = $post['desc']; 117 $data['desc'] = $post['desc'];
118 $final_price = $this->getFinalPrice($data['activity_id'], $data['schedule_id'], $post['num'], $data['discount_coupon_id']); 118 $final_price = $this->getFinalPrice($data['activity_id'], $data['schedule_id'], $post['num'], $data['discount_coupon_id']);
119 $post['escort'] = substr($post['escort'], 0, strlen($post['escort']) - 1); 119 $post['escort'] = substr($post['escort'], 0, strlen($post['escort']) - 1);
  120 + if (empty($post['escort'])) {
  121 + echo json_encode(['msg' => '请选择出行人', 'code' => 40000]);
  122 + exit();
  123 + }
120 $this->checkOrder($data['schedule_id'], $data['payment'], $post['escort'], $post['num'], $final_price); 124 $this->checkOrder($data['schedule_id'], $data['payment'], $post['escort'], $post['num'], $final_price);
121 Db::startTrans(); 125 Db::startTrans();
122 if (Db::name('order_info')->insert($data)) { 126 if (Db::name('order_info')->insert($data)) {
123 - //☆在这就要将优惠券变为已使用☆  
124 $oid = Db::name('order_info')->getLastInsID(); 127 $oid = Db::name('order_info')->getLastInsID();
125 $detail = []; 128 $detail = [];
126 $explode_escort = explode(',', $post['escort']); 129 $explode_escort = explode(',', $post['escort']);
@@ -132,6 +135,17 @@ class OrderController extends HomeBaseController @@ -132,6 +135,17 @@ class OrderController extends HomeBaseController
132 ]; 135 ];
133 } 136 }
134 if (Db::name('order_detail')->insertAll($detail)) { 137 if (Db::name('order_detail')->insertAll($detail)) {
  138 + //☆在这就要将优惠券变为已使用☆
  139 + if ($data['is_use_discount_coupon'] == 1 && !empty($data['discount_coupon_id'])) {
  140 + $coupons = [
  141 + 'id' => $post['discount_coupon_id'],
  142 + 'use_time' => time(),
  143 + 'status' => 2
  144 + ];
  145 + if (!(Db::name('discount_coupon')->update($coupons))) {
  146 + Db::rollback();
  147 + }
  148 + }
135 //插入订单记录表(包含订单总价) 149 //插入订单记录表(包含订单总价)
136 $log = [ 150 $log = [
137 'oid' => $oid, 151 'oid' => $oid,
@@ -140,6 +154,14 @@ class OrderController extends HomeBaseController @@ -140,6 +154,14 @@ class OrderController extends HomeBaseController
140 ]; 154 ];
141 if (Db::name('order_log')->insert($log)) { 155 if (Db::name('order_log')->insert($log)) {
142 Db::commit(); 156 Db::commit();
  157 + //首次下单状态改变
  158 + Db::name('user')->update(['id' => session('user.id'), 'is_first' => 0]);
  159 + if ($data['payment'] == 1) {
  160 + echo json_encode(['msg' => '微信支付']);
  161 + exit();
  162 + } elseif ($data['payment'] == 2) {
  163 +
  164 + } elseif ($data['payment'] == 0) {
143 $model = new OrderModel; 165 $model = new OrderModel;
144 if ($model->orderCallBack($oid)) { 166 if ($model->orderCallBack($oid)) {
145 echo json_encode(['msg' => '下单成功', 'code' => 20000]); 167 echo json_encode(['msg' => '下单成功', 'code' => 20000]);
@@ -148,6 +170,10 @@ class OrderController extends HomeBaseController @@ -148,6 +170,10 @@ class OrderController extends HomeBaseController
148 echo json_encode(['msg' => '下单失败', 'code' => 40000]); 170 echo json_encode(['msg' => '下单失败', 'code' => 40000]);
149 exit(); 171 exit();
150 } 172 }
  173 + } else {
  174 + echo json_encode(['msg' => '未知错误', 'code' => 40000]);
  175 + exit();
  176 + }
151 } 177 }
152 } 178 }
153 } else { 179 } else {
@@ -161,6 +187,63 @@ class OrderController extends HomeBaseController @@ -161,6 +187,63 @@ class OrderController extends HomeBaseController
161 } 187 }
162 } 188 }
163 189
  190 + //个人中心继续付款
  191 + public function done2()
  192 + {
  193 + $request = request();
  194 + if ($request->isPost()) {
  195 + $oid = $request->param('oid');
  196 + $info = Db::name('order_info')->alias('o')
  197 + ->field('status,order_type,a.down_price,s.price')
  198 + ->join('activity a', 'o.activity_id=a.id')
  199 + ->join('activity_schedule s ', 'o.schedule_id=s.id')
  200 + ->where(['o.id' => $oid])->find();
  201 + $num = Db::name('order_detail')->where(['oid' => $oid, 'status' => ['neq', 2]])->count();
  202 + if ($info['status'] == 1) {
  203 + if ($info['order_type'] == 0) {
  204 + $order_amount = $num * $info['price'];
  205 + } elseif ($info['order_type'] == 1) {
  206 + $order_amount = $num * $info['down_price'];
  207 + } else {
  208 + echo json_encode(['msg' => '未知错误', 'code' => 40000]);
  209 + exit();
  210 + }
  211 + } elseif ($info['status'] == 3) {
  212 + $order_amount = $num * $info['price'];
  213 + } else {
  214 + echo json_encode(['msg' => '未知错误', 'code' => 40000]);
  215 + exit();
  216 + }
  217 + //再次支付的支付方式
  218 + $payment = $request->param('payment');
  219 + Db::name('order_info')->update(['id' => $oid, 'payment' => $payment]);
  220 + if ($payment == 0) {
  221 + $model = new OrderModel;
  222 + if ($model->orderCallBack($oid, $order_amount)) {
  223 + //如果是有定金订单,则需要更新order_log
  224 + if ($info['order_type'] == 1) {
  225 + Db::name('order_log')->where(['oid' => $oid])->update(['type' => 0, 'order_amount' => $order_amount]);
  226 + }
  227 + echo json_encode(['msg' => '支付成功', 'code' => 20000]);
  228 + exit();
  229 + } else {
  230 + echo json_encode(['msg' => '支付失败', 'code' => 40000]);
  231 + exit();
  232 + }
  233 + } elseif ($payment == 1) {
  234 +
  235 + } elseif ($payment == 2) {
  236 +
  237 + } else {
  238 + echo json_encode(['msg' => '未知错误', 'code' => 40000]);
  239 + exit();
  240 + }
  241 + } else {
  242 + echo json_encode(['msg' => '非法操作', 'code' => 40000]);
  243 + exit();
  244 + }
  245 + }
  246 +
164 /** 247 /**
165 * 计算订单最终价格 248 * 计算订单最终价格
166 * @param $activityId 249 * @param $activityId
@@ -20,6 +20,8 @@ class OrderModel extends Model @@ -20,6 +20,8 @@ class OrderModel extends Model
20 } 20 }
21 if ($status != null) { 21 if ($status != null) {
22 $where['status'] = ['eq', $status]; 22 $where['status'] = ['eq', $status];
  23 + }else {
  24 + $where['status'] = ['neq', 7];
23 } 25 }
24 $res = Db::name('order_info')->alias('o') 26 $res = Db::name('order_info')->alias('o')
25 ->field('o.id as oid,o.order_sn,a.name,a.thumb,o.status,a.down_price,s.price') 27 ->field('o.id as oid,o.order_sn,a.name,a.thumb,o.status,a.down_price,s.price')
@@ -39,7 +41,7 @@ class OrderModel extends Model @@ -39,7 +41,7 @@ class OrderModel extends Model
39 41
40 //通用订单回调类(未完待续。。。) 42 //通用订单回调类(未完待续。。。)
41 //余额扣除(如果余额支付->钱包记录)->优惠券变为已使用(如果使用优惠券)->改变订单状态(必然)->相应批次库存减少(必然) 43 //余额扣除(如果余额支付->钱包记录)->优惠券变为已使用(如果使用优惠券)->改变订单状态(必然)->相应批次库存减少(必然)
42 - public function orderCallBack($oid) 44 + public function orderCallBack($oid, $order_amount = null)
43 { 45 {
44 $orderInfo = Db::name('order_info')->alias('o') 46 $orderInfo = Db::name('order_info')->alias('o')
45 ->field('o.user_id,o.is_use_discount_coupon,discount_coupon_id,o.status,o.payment,o.order_type,o.activity_id,o.schedule_id,l.order_amount') 47 ->field('o.user_id,o.is_use_discount_coupon,discount_coupon_id,o.status,o.payment,o.order_type,o.activity_id,o.schedule_id,l.order_amount')
@@ -49,7 +51,8 @@ class OrderModel extends Model @@ -49,7 +51,8 @@ class OrderModel extends Model
49 Db::startTrans(); 51 Db::startTrans();
50 $go = 'rollback'; 52 $go = 'rollback';
51 if ($orderInfo['payment'] == 0) { 53 if ($orderInfo['payment'] == 0) {
52 - if (Db::name('user')->where(['id' => $orderInfo['user_id']])->setDec('balance', $orderInfo['order_amount'])) { 54 + $amount = ($order_amount == null) ? $order_amount['order_amount'] : $order_amount;
  55 + if (Db::name('user')->where(['id' => $orderInfo['user_id']])->setDec('balance', $amount)) {
53 $wallet = [ 56 $wallet = [
54 'user_id' => $orderInfo['user_id'], 57 'user_id' => $orderInfo['user_id'],
55 'type' => 0, 58 'type' => 0,
@@ -65,24 +68,12 @@ class OrderModel extends Model @@ -65,24 +68,12 @@ class OrderModel extends Model
65 return false; 68 return false;
66 } 69 }
67 } 70 }
68 - if ($orderInfo['is_use_discount_coupon'] == 1 && !empty($orderInfo['discount_coupon_id'])) {  
69 - $coupons = [  
70 - 'id' => $orderInfo['discount_coupon_id'],  
71 - 'use_time' => time(),  
72 - 'status' => 2  
73 - ];  
74 - if (Db::name('discount_coupon')->update($coupons)) {  
75 - $go = 'commit';  
76 - } else {  
77 - return false;  
78 - }  
79 - }  
80 - //订单状态无定金直接变为3,有定金变为1  
81 - if ($orderInfo['status'] == 0) { 71 + //订单状态无定金直接变为4,有定金变为2
  72 + if ($orderInfo['status'] == 1) {
82 if ($orderInfo['order_type'] == 0) { 73 if ($orderInfo['order_type'] == 0) {
83 - $status = 3; 74 + $status = 4;
84 } elseif ($orderInfo['order_type'] == 1) { 75 } elseif ($orderInfo['order_type'] == 1) {
85 - $status = 1; 76 + $status = 2;
86 } else { 77 } else {
87 $status = 0; 78 $status = 0;
88 } 79 }
@@ -102,6 +93,19 @@ class OrderModel extends Model @@ -102,6 +93,19 @@ class OrderModel extends Model
102 return false; 93 return false;
103 } 94 }
104 } 95 }
  96 + //待付尾款订单
  97 + if($orderInfo['status'] == 3) {
  98 + $status = 4;
  99 + $order = [
  100 + 'id' => $oid,
  101 + 'status' => $status
  102 + ];
  103 + if(Db::name('order_info')->update($order)) {
  104 + $go = 'commit';
  105 + }else {
  106 + return false;
  107 + }
  108 + }
105 if ($go == 'commit') { 109 if ($go == 'commit') {
106 Db::commit(); 110 Db::commit();
107 return true; 111 return true;
@@ -414,4 +414,58 @@ class CenterController extends HomeBaseController @@ -414,4 +414,58 @@ class CenterController extends HomeBaseController
414 } 414 }
415 } 415 }
416 416
  417 + public function cancelOrder()
  418 + {
  419 + $request = request();
  420 + if ($request->isAjax()) {
  421 + if (Db::name('order_info')->where(['id' => $request->param('oid')])->value('status') == 1) {
  422 + $data = [
  423 + 'id' => $request->param('oid'),
  424 + 'status' => 7
  425 + ];
  426 + if (Db::name('order_info')->update($data)) {
  427 + echo json_encode(['msg' => '已取消订单', 'code' => 20000]);
  428 + exit();
  429 + } else {
  430 + echo json_encode(['msg' => '取消失败', 'code' => 40000]);
  431 + exit();
  432 + }
  433 + } else {
  434 + echo json_encode(['msg' => '该订单禁止取消', 'code' => 40000]);
  435 + exit();
  436 + }
  437 + }
  438 + }
  439 +
  440 + public function confirmOrder() {
  441 + $request = request();
  442 + if($request->isAjax()) {
  443 + if (Db::name('order_info')->where(['id' => $request->param('oid')])->value('status') == 4) {
  444 + $data = [
  445 + 'id' => $request->param('oid'),
  446 + 'status' => 5
  447 + ];
  448 + if (Db::name('order_info')->update($data)) {
  449 + echo json_encode(['msg' => '订单已确认', 'code' => 20000]);
  450 + exit();
  451 + } else {
  452 + echo json_encode(['msg' => '确认失败', 'code' => 40000]);
  453 + exit();
  454 + }
  455 + } else {
  456 + echo json_encode(['msg' => '该订单禁止确认', 'code' => 40000]);
  457 + exit();
  458 + }
  459 + }
  460 + }
  461 +
  462 + public function comment(){
  463 + $request = request();
  464 + if($request->isAjax()) {
  465 +
  466 + }else {
  467 + return $this->fetch(':comment');
  468 + }
  469 + }
  470 +
417 } 471 }
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 // [ 入口文件 ] 10 // [ 入口文件 ]
11 11
12 // 调试模式开关 12 // 调试模式开关
13 -define("APP_DEBUG", false); 13 +define("APP_DEBUG", true);
14 14
15 // 定义CMF根目录,可更改此目录 15 // 定义CMF根目录,可更改此目录
16 define('CMF_ROOT', __DIR__ . '/../'); 16 define('CMF_ROOT', __DIR__ . '/../');
@@ -52,21 +52,12 @@ @@ -52,21 +52,12 @@
52 </volist> 52 </volist>
53 </div> 53 </div>
54 <div style="clear: left">&nbsp;</div> 54 <div style="clear: left">&nbsp;</div>
55 - <if condition="$order_info['status'] eq '1'">  
56 - <div style="width: 112px; margin: 0 auto; margin-top: 20px">  
57 - <form action="{:url('Order/detail')}" method="post">  
58 - <input type="hidden" name="id" value="{$order_info.id}">  
59 - <input type="hidden" name="act" value="down_payment">  
60 - <input type="submit" value="确定支付定金" class="btn btn-danger" onclick="return isConfirm()">  
61 - </form>  
62 - </div>  
63 - </if>  
64 - <if condition="$order_info['status'] eq '3'"> 55 + <if condition="$order_info['status'] eq '2'">
65 <div style="width: 112px; margin: 0 auto; margin-top: 20px"> 56 <div style="width: 112px; margin: 0 auto; margin-top: 20px">
66 <form action="{:url('Order/detail')}" method="post"> 57 <form action="{:url('Order/detail')}" method="post">
67 <input type="hidden" name="id" value="{$order_info.id}"> 58 <input type="hidden" name="id" value="{$order_info.id}">
68 <input type="hidden" name="act" value="final_payment"> 59 <input type="hidden" name="act" value="final_payment">
69 - <input type="submit" value="确定支付尾款" class="btn btn-danger" onclick="return isConfirm()"> 60 + <input type="submit" value="已支付定金" class="btn btn-danger" onclick="return isConfirm()">
70 </form> 61 </form>
71 </div> 62 </div>
72 </if> 63 </if>
@@ -86,7 +77,7 @@ @@ -86,7 +77,7 @@
86 </style> 77 </style>
87 <script> 78 <script>
88 function isConfirm() { 79 function isConfirm() {
89 - if(!window.confirm('是否确定支付尾款?')) { 80 + if(!window.confirm('是否确定已支付定金?该订单即将变为待付尾款状态')) {
90 return false; 81 return false;
91 }else { 82 }else {
92 return true; 83 return true;
@@ -749,6 +749,7 @@ @@ -749,6 +749,7 @@
749 } 749 }
750 }) 750 })
751 751
  752 + var money_id='';
752 $(".agreepay").click(function () { 753 $(".agreepay").click(function () {
753 $.ajax({ 754 $.ajax({
754 url:"{:url('order/Order/done')}", 755 url:"{:url('order/Order/done')}",
@@ -750,8 +750,8 @@ @@ -750,8 +750,8 @@
750 single: false, 750 single: false,
751 space: true, 751 space: true,
752 starHalf: 'star-half.png', 752 starHalf: 'star-half.png',
753 - starOff: '../images/no_stary.png',  
754 - starOn: '../images/stary.png', 753 + starOff: '/themes/simpleboot3/static/images/no_stary.png',
  754 + starOn: '/themes/simpleboot3/static/images/stary.png',
755 starType: 'img', 755 starType: 'img',
756 target: undefined, 756 target: undefined,
757 targetFormat: '{score}', 757 targetFormat: '{score}',
  1 +
  2 +<!DOCTYPE html>
  3 +<html>
  4 +
  5 +<head>
  6 + <meta charset="UTF-8">
  7 + <title>评价页面</title>
  8 + <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  9 + <link rel="stylesheet" type="text/css" href="__TMPL__/static/assets/css/weui.min.css" />
  10 + <link rel="stylesheet" type="text/css" href="__TMPL__/static/assets/css/swiper-3.4.2.min.css" />
  11 + <link rel="stylesheet" type="text/css" href="http://at.alicdn.com/t/font_773803_1qg03k1415.css" />
  12 + <script type="text/javascript" src="__TMPL__/static/assets/font/iconfont.js"></script>
  13 + <script type="text/javascript" src="__TMPL__/static/js/base.js"></script>
  14 + <link rel="stylesheet" href="__TMPL__/static/css/jquery.raty.css" />
  15 + <link rel="stylesheet" href="__TMPL__/static/css/evaluate.css" />
  16 +</head>
  17 +
  18 +<body>
  19 +<div class="travel">这次的旅行,您还满意吗?</div>
  20 +<div class="img_box" id='start'>
  21 +</div>
  22 +<div class="service">
  23 + <div class="fu">服务评价</div>
  24 + <div class="icon" id="icon">
  25 + <!--<i class="iconfont icon-wuxing "></i>
  26 + <i class="iconfont icon-wuxing "></i>
  27 + <i class="iconfont icon-wuxing "></i>
  28 + <i class="iconfont icon-wuxing "></i>
  29 + <i class="iconfont icon-wuxing "></i>-->
  30 + </div>
  31 +</div>
  32 +<div class="service">
  33 + <div class="fu">行程安排</div>
  34 + <div class="icon" id="wuxing">
  35 + <!--<i class="iconfont icon-wuxing "></i>
  36 + <i class="iconfont icon-wuxing "></i>
  37 + <i class="iconfont icon-wuxing "></i>
  38 + <i class="iconfont icon-wuxing "></i>
  39 + <i class="iconfont icon-wuxing "></i>-->
  40 + </div>
  41 +</div>
  42 +<div class="xing">
  43 + 给五星好评可获得代金券一张
  44 +</div>
  45 +<div class="ideaout">
  46 + <textarea class="idea" placeholder="请留下您的宝贵意"></textarea>
  47 +
  48 +
  49 +</div>
  50 +<div class="save">
  51 + <div class="footer ok">
  52 + 提交
  53 + </div>
  54 +</div>
  55 +
  56 +</body>
  57 +<script type="text/javascript" src="__TMPL__/static/assets/js/jquery-2.1.0.js"></script>
  58 +<script type="text/javascript" src="__TMPL__/static/assets/js/jquery.raty.js"></script>
  59 +<script type="text/javascript">
  60 + var startnum = 0;
  61 + $('#start').raty({
  62 + click: function(s) {
  63 + console.log(s)
  64 + startnum = s;
  65 + }
  66 + })
  67 + var startnum_min1 = 0;
  68 + $('#icon').raty({
  69 + click: function(s) {
  70 + console.log(s)
  71 + startnum = s;
  72 + }
  73 + })
  74 + var startnum_min2 = 0;
  75 + $('#wuxing').raty({
  76 + click: function(s) {
  77 + console.log(s)
  78 + startnum = s;
  79 + }
  80 + })
  81 +</script>
  82 +
  83 +</html>
@@ -99,9 +99,23 @@ @@ -99,9 +99,23 @@
99 </div> 99 </div>
100 100
101 <div class="footer_out"> 101 <div class="footer_out">
  102 + <if condition="$data.baseInfo.status eq '1' || $data.baseInfo.status eq '3'">
102 <div class="footer ok"> 103 <div class="footer ok">
103 立即支付 104 立即支付
104 </div> 105 </div>
  106 + </if>
  107 +
  108 + <if condition="$data.baseInfo.status eq '4'">
  109 + <div class="footer ko">
  110 + 确认完成
  111 + </div>
  112 + </if>
  113 +
  114 + <if condition="$data.baseInfo.status eq '5'">
  115 + <div class="footer go">
  116 + 去评价
  117 + </div>
  118 + </if>
105 </div> 119 </div>
106 <!--选择支付方式--> 120 <!--选择支付方式-->
107 <div class='move1'> 121 <div class='move1'>
@@ -153,8 +167,8 @@ @@ -153,8 +167,8 @@
153 <i class='iconfont'></i> 167 <i class='iconfont'></i>
154 </div> 168 </div>
155 </div> 169 </div>
156 - <div class="agreepay">  
157 170
  171 + <div class="agreepay">
158 确认支付 172 确认支付
159 </div> 173 </div>
160 </div> 174 </div>
@@ -173,7 +187,7 @@ @@ -173,7 +187,7 @@
173 187
174 <script> 188 <script>
175 //点击选择支付方式 189 //点击选择支付方式
176 - $('.footer').click(function() { 190 + $('.ok').click(function() {
177 $('.move1').css('display', 'block'); 191 $('.move1').css('display', 'block');
178 }) 192 })
179 $('.move1').click(function() { 193 $('.move1').click(function() {
@@ -272,3 +286,46 @@ @@ -272,3 +286,46 @@
272 286
273 }) 287 })
274 </script> 288 </script>
  289 +
  290 +<script>
  291 + $(".agreepay").click(function () {
  292 + $.ajax({
  293 + url:"{:url('order/Order/done2')}",
  294 + data:{
  295 + oid:'{$data.baseInfo.oid}',
  296 + payment:0
  297 + },
  298 + type:"POST",
  299 + dataType:"JSON",
  300 +
  301 + success: function (data) {
  302 + if(data.code == 20000) {
  303 + window.location.reload();
  304 + }
  305 + }
  306 + })
  307 + })
  308 +</script>
  309 +
  310 +<script>
  311 + $(".ko").click(function () {
  312 + if(window.confirm('是否确认完成?')) {
  313 + $.ajax({
  314 + url:"{:url('user/Center/confirmOrder')}",
  315 + data:{
  316 + oid:'{$data.baseInfo.oid}'
  317 + },
  318 + type:"POST",
  319 + dataType:"JSON",
  320 +
  321 + success: function (data) {
  322 + if(data.code == 20000) {
  323 + window.location.reload();
  324 + }
  325 + }
  326 + })
  327 + }else {
  328 + return false;
  329 + }
  330 + })
  331 +</script>
@@ -102,7 +102,7 @@ @@ -102,7 +102,7 @@
102 </div> 102 </div>
103 <div <if condition="$status eq '4'">class="swiper-slide active_top"<else/>class="swiper-slide"</if> data-url="{:url('user/Center/orderList',['status'=>4])}"> 103 <div <if condition="$status eq '4'">class="swiper-slide active_top"<else/>class="swiper-slide"</if> data-url="{:url('user/Center/orderList',['status'=>4])}">
104 104
105 - 已付尾款 105 + 待完成
106 106
107 </div> 107 </div>
108 <div <if condition="$status eq '5'">class="swiper-slide active_top"<else/>class="swiper-slide"</if> data-url="{:url('user/Center/orderList',['status'=>5])}"> 108 <div <if condition="$status eq '5'">class="swiper-slide active_top"<else/>class="swiper-slide"</if> data-url="{:url('user/Center/orderList',['status'=>5])}">
@@ -119,8 +119,7 @@ @@ -119,8 +119,7 @@
119 </div> 119 </div>
120 120
121 <volist name="data" id="vo"> 121 <volist name="data" id="vo">
122 - <a href="{:url('user/Center/orderDetail',['oid'=>$vo['oid']])}">  
123 - <div class="good_out_stay" data-id="{$vo.oid}"> 122 + <div class="good_out_stay DETAIL" data-id="{$vo.oid}" data-url="{:url('user/Center/orderDetail',['oid'=>$vo['oid']])}">
124 <div class="good"> 123 <div class="good">
125 <span>订单号:{$vo.order_sn}</span> 124 <span>订单号:{$vo.order_sn}</span>
126 <span class="confirmed">{$vo.status_text}</span> 125 <span class="confirmed">{$vo.status_text}</span>
@@ -146,7 +145,7 @@ @@ -146,7 +145,7 @@
146 </div> 145 </div>
147 <if condition="$vo['status'] eq '1'"> 146 <if condition="$vo['status'] eq '1'">
148 <div class="btnlist"> 147 <div class="btnlist">
149 - <div class="btnleft can">取消</div> 148 + <div class="btnleft can" data-id="{$vo['oid']}">取消</div>
150 <div class="btnright ">付款</div> 149 <div class="btnright ">付款</div>
151 </div> 150 </div>
152 </if> 151 </if>
@@ -159,11 +158,10 @@ @@ -159,11 +158,10 @@
159 158
160 <if condition="$vo['status'] eq '5'"> 159 <if condition="$vo['status'] eq '5'">
161 <div class="btnlist"> 160 <div class="btnlist">
162 - <div class="pingjia">评价</div> 161 + <div class="pingjia" data-url="{:url('user/Center/comment',['oid'=>$vo['oid']])}">评价</div>
163 </div> 162 </div>
164 </if> 163 </if>
165 </div> 164 </div>
166 - </a>  
167 </volist> 165 </volist>
168 166
169 167
@@ -212,45 +210,44 @@ @@ -212,45 +210,44 @@
212 <script type="text/javascript" src="__TMPL__/static/assets/js/jquery-2.1.0.js"></script> 210 <script type="text/javascript" src="__TMPL__/static/assets/js/jquery-2.1.0.js"></script>
213 <script type="text/javascript" src="__TMPL__/static/js/swiper-3.4.2.jquery.min.js"></script> 211 <script type="text/javascript" src="__TMPL__/static/js/swiper-3.4.2.jquery.min.js"></script>
214 <script> 212 <script>
215 - //确认取消弹出框  
216 - $('.can').click(function() {  
217 - var id = $(this).parents('.good_out').data("id");  
218 - console.log(id);  
219 - $('.confirm_cancel').css('display', 'block');  
220 - $('.confirm_yes').click(function() {  
221 - console.log("点击确定按钮获取整个li的id为:" + id);  
222 - $('.confirm_cancel').css('display', 'none');  
223 - })  
224 - $('.confirm_no').click(function() {  
225 - $('.confirm_cancel').css('display', 'none');  
226 - })  
227 - $('.confirm_main').click(function() {  
228 - event.stopPropagation();  
229 - // $(this).css('display','none');  
230 - }) 213 +
  214 + $(".DETAIL").click(function () {
  215 + window.location.href=$(this).attr('data-url');
231 }) 216 })
232 217
  218 + var oid='';
  219 +
233 //确认取消弹出框 220 //确认取消弹出框
234 - $('.btnright').click(function() {  
235 - var id = $(this).parents('.good_out').data("id");  
236 - console.log(id); 221 + $('.can').click(function() {
  222 + window.event.stopPropagation();
  223 + var id = $(this).attr('data-id');
237 $('.confirm_cancel').css('display', 'block'); 224 $('.confirm_cancel').css('display', 'block');
238 $('.confirm_yes').click(function() { 225 $('.confirm_yes').click(function() {
239 - console.log("点击确定按钮获取整个li的id为:" + id);  
240 $('.confirm_cancel').css('display', 'none'); 226 $('.confirm_cancel').css('display', 'none');
241 }) 227 })
242 $('.confirm_no').click(function() { 228 $('.confirm_no').click(function() {
243 $('.confirm_cancel').css('display', 'none'); 229 $('.confirm_cancel').css('display', 'none');
  230 + $.ajax({
  231 + url:"{:url('user/Center/cancelOrder')}",
  232 + data:{
  233 + oid:id
  234 + },
  235 + type:"POST",
  236 + dataType:"JSON",
  237 +
  238 + success: function (data) {
  239 + if(data.code == 20000) {
  240 + window.location.reload();
  241 + }
  242 + }
  243 + })
244 }) 244 })
245 $('.confirm_main').click(function() { 245 $('.confirm_main').click(function() {
246 event.stopPropagation(); 246 event.stopPropagation();
247 // $(this).css('display','none'); 247 // $(this).css('display','none');
248 }) 248 })
249 }) 249 })
250 - //阻止按钮的点击冒泡  
251 - $('.btnlist').click(function(event) {  
252 - event.stopPropagation();  
253 - }); 250 +
254 $('.choice .swiper-slide').click(function() { 251 $('.choice .swiper-slide').click(function() {
255 $(this).addClass("active_top").siblings().removeClass("active_top"); 252 $(this).addClass("active_top").siblings().removeClass("active_top");
256 }) 253 })
@@ -272,3 +269,12 @@ @@ -272,3 +269,12 @@
272 window.location.href=$(this).attr('data-url'); 269 window.location.href=$(this).attr('data-url');
273 }) 270 })
274 </script> 271 </script>
  272 +
  273 +<script>
  274 + $('.pingjia').click(function() {
  275 + window.event.stopPropagation();
  276 + //评论页跳转
  277 + window.location.href=$(this).attr('data-url');
  278 +
  279 + })
  280 +</script>