作者 lihan

订单详情分批次退款

@@ -26,6 +26,9 @@ class CouponModel extends Model @@ -26,6 +26,9 @@ class CouponModel extends Model
26 $y = 0; 26 $y = 0;
27 $z = 0; 27 $z = 0;
28 $map['user_id'] = array('eq', $user_id); 28 $map['user_id'] = array('eq', $user_id);
  29 + $data['unused'] = [];
  30 + $data['used'] = [];
  31 + $data['expired'] = [];
29 $res = Db::name('discount_coupon')->field('reduce,discount_coupon_name,deadline,status')->where($map)->order('status')->select()->toArray(); 32 $res = Db::name('discount_coupon')->field('reduce,discount_coupon_name,deadline,status')->where($map)->order('status')->select()->toArray();
30 foreach ($res as $key => $item) { 33 foreach ($res as $key => $item) {
31 $item['deadline'] = date('Y.m.d', $item['deadline']); 34 $item['deadline'] = date('Y.m.d', $item['deadline']);
@@ -245,21 +245,28 @@ class CenterController extends HomeBaseController @@ -245,21 +245,28 @@ class CenterController extends HomeBaseController
245 $info['status_text'] = getOrderStatusText($info['status']); 245 $info['status_text'] = getOrderStatusText($info['status']);
246 $info['count'] = Db::name('order_detail')->where(['oid' => $oid])->count(); 246 $info['count'] = Db::name('order_detail')->where(['oid' => $oid])->count();
247 $escort = Db::name('order_detail')->alias('d') 247 $escort = Db::name('order_detail')->alias('d')
248 - ->field('d.id,d.status,e.name,e.tel') 248 + ->field('d.id,d.status,d.reason,e.name,e.tel')
249 ->join('escort e', 'e.id=d.escort_id') 249 ->join('escort e', 'e.id=d.escort_id')
250 ->where(['oid' => $oid]) 250 ->where(['oid' => $oid])
251 ->select(); 251 ->select();
252 foreach ($escort as $k => $v) { 252 foreach ($escort as $k => $v) {
253 $v['count'] = 1; 253 $v['count'] = 1;
254 $v['down_price'] = $info['down_price']; 254 $v['down_price'] = $info['down_price'];
  255 + $v['bar'] = $this->progressBar($v['status']);
255 $escort[$k] = $v; 256 $escort[$k] = $v;
256 } 257 }
257 $return = [ 258 $return = [
258 'baseInfo' => $info, 259 'baseInfo' => $info,
259 'escort' => $escort 260 'escort' => $escort
260 ]; 261 ];
261 - echo json_encode(['data' => $return, 'code' => 20000]);  
262 - exit(); 262 + if ($request->isPost()) {
  263 + echo json_encode(['data' => $return, 'code' => 20000]);
  264 + exit();
  265 + } else {
  266 + return $this->fetch(':order_detail', [
  267 + 'data' => $return
  268 + ]);
  269 + }
263 } 270 }
264 271
265 /** 272 /**
@@ -305,4 +312,106 @@ class CenterController extends HomeBaseController @@ -305,4 +312,106 @@ class CenterController extends HomeBaseController
305 ]); 312 ]);
306 } 313 }
307 314
  315 + //进度条
  316 + private function progressBar($status)
  317 + {
  318 + if ($status == 2) {
  319 + $bar = '<div class="faqi_out">
  320 + <div class="circle_main active_circle">
  321 + <span class="circle">
  322 + </span>
  323 + <span class="fa">
  324 + 发起退款待审核中
  325 + </span>
  326 + </div>
  327 + <div class="circle_main active_circle">
  328 + <span class="circle">
  329 + </span>
  330 + <span class="fa">
  331 + 审核通过
  332 + </span>
  333 + <span class="span_line"></span>
  334 + </div>
  335 + <div class="circle_main active_circle">
  336 + <span class="circle">
  337 + </span>
  338 + <span class="fa">
  339 + 已退款
  340 + </span>
  341 + <span class="span_line"></span>
  342 + </div>
  343 + </div>';
  344 + } elseif ($status == 3) {
  345 + $bar = '<div class="faqi_out">
  346 + <div class="circle_main active_circle">
  347 + <span class="circle">
  348 + </span>
  349 + <span class="fa">
  350 + 发起退款待审核中
  351 + </span>
  352 + </div>
  353 + <div class="circle_main">
  354 + <span class="circle">
  355 + <i class="iconfont icon-chahao" id="icon-chahao"></i>
  356 + </span>
  357 + <span class="fa ">
  358 + 审核不通过
  359 + </span>
  360 +
  361 + <span class="span_line"></span>
  362 + </div>
  363 + <div class="circle_main ">
  364 + <span class="circle">
  365 + </span>
  366 + <span class="fa">
  367 + 已退款
  368 + </span>
  369 + <span class="span_line"></span>
  370 + </div>
  371 + </div>';
  372 + } else {
  373 + $bar = '<div class="faqi_out">
  374 + <div class="circle_main active_circle">
  375 + <span class="circle">
  376 + </span>
  377 + <span class="fa">
  378 + 发起退款待审核中
  379 + </span>
  380 + </div>
  381 + <div class="circle_main">
  382 + <span class="circle">
  383 + </span>
  384 + <span class="fa ">
  385 + </span>
  386 +
  387 + <span class="span_line"></span>
  388 + </div>
  389 + <div class="circle_main ">
  390 + <span class="circle">
  391 + </span>
  392 + <span class="fa">
  393 + </span>
  394 + <span class="span_line"></span>
  395 + </div>
  396 + </div>';
  397 + }
  398 + return $bar;
  399 + }
  400 +
  401 + public function refund()
  402 + {
  403 + $request = request();
  404 + if ($request->isAjax()) {
  405 + $id = $request->param('id');
  406 + $data = [
  407 + 'id' => $id,
  408 + 'status' => 1,
  409 + 'cause' => $request->param('cause'),
  410 + ];
  411 + if (Db::name('order_detail')->update($data)) {
  412 + $this->success('', '', true);
  413 + }
  414 + }
  415 + }
  416 +
308 } 417 }
@@ -88,10 +88,12 @@ body{ @@ -88,10 +88,12 @@ body{
88 outline: none; 88 outline: none;
89 border: 1px solid #3988E5; 89 border: 1px solid #3988E5;
90 background: #fff; 90 background: #fff;
91 - padding: 0.1rem 0.3rem; 91 + /*padding: 0.1rem 0.3rem;*/
92 color: #3988E5; 92 color: #3988E5;
93 border-radius:0.05rem ; 93 border-radius:0.05rem ;
94 font-size: 0.31rem; 94 font-size: 0.31rem;
  95 + position: relative;
  96 + top: -40px;
95 } 97 }
96 .confirmed{ 98 .confirmed{
97 font-size:0.28rem; 99 font-size:0.28rem;
@@ -158,11 +160,12 @@ body{ @@ -158,11 +160,12 @@ body{
158 padding:0.1rem 0.2rem; 160 padding:0.1rem 0.2rem;
159 width: 6rem; 161 width: 6rem;
160 height: 3rem; 162 height: 3rem;
161 - align-items: center; 163 + align-items: center;
162 display: flex; 164 display: flex;
163 - flex-direction: column;  
164 - border:0.01rem solid #ccc;  
165 - top:7rem;left: 0.5rem; 165 + flex-direction: column;
  166 + border:0.01rem solid #ccc;
  167 + top:1rem;
  168 + left: 0.5rem;
166 } 169 }
167 textarea{ 170 textarea{
168 outline: none; 171 outline: none;
@@ -179,14 +182,14 @@ textarea{ @@ -179,14 +182,14 @@ textarea{
179 position: fixed; 182 position: fixed;
180 height: 100%; 183 height: 100%;
181 width: 100%; 184 width: 100%;
182 - 185 + z-index: 999
183 186
184 } 187 }
185 .icon-chahao{ 188 .icon-chahao{
186 position: absolute; 189 position: absolute;
187 right: 0.12rem; 190 right: 0.12rem;
188 top: 0.08rem; 191 top: 0.08rem;
189 - color:#000; 192 + /*color:#000;*/
190 193
191 } 194 }
192 .refund_reason_submit{ 195 .refund_reason_submit{
@@ -56,9 +56,11 @@ @@ -56,9 +56,11 @@
56 </div> 56 </div>
57 57
58 </div> 58 </div>
  59 + </a>
59 <div class="sub_out"> 60 <div class="sub_out">
60 <ul class="sub"> 61 <ul class="sub">
61 62
  63 + <a href="{:url('user/Center/orderList',['status'=>1])}">
62 <li> 64 <li>
63 <span > 65 <span >
64 <i class="iconfont icon-daizhifu"></i> 66 <i class="iconfont icon-daizhifu"></i>
@@ -67,17 +69,19 @@ @@ -67,17 +69,19 @@
67 待付定金 69 待付定金
68 </span> 70 </span>
69 </li> 71 </li>
  72 + </a>
70 73
71 - 74 + <a href="{:url('user/Center/orderList',['status'=>2])}">
72 <li> 75 <li>
73 - <span > 76 + <span>
74 <i class="iconfont icon-dingdanyizhifu"></i> 77 <i class="iconfont icon-dingdanyizhifu"></i>
75 </span> 78 </span>
76 <span class="dai"> 79 <span class="dai">
77 已付定金 80 已付定金
78 </span> 81 </span>
79 </li> 82 </li>
80 - 83 + </a>
  84 + <a href="{:url('user/Center/orderList',['status'=>3])}">
81 <li> 85 <li>
82 <span > 86 <span >
83 <i class="iconfont icon-daishouhuo"></i> 87 <i class="iconfont icon-daishouhuo"></i>
@@ -86,18 +90,18 @@ @@ -86,18 +90,18 @@
86 待付尾款 90 待付尾款
87 </span> 91 </span>
88 </li> 92 </li>
89 -  
90 - 93 + </a>
  94 + <a href="{:url('user/Center/orderList',['status'=>4])}">
91 <li> 95 <li>
92 <span > 96 <span >
93 <i class="iconfont icon-daiwancheng"></i> 97 <i class="iconfont icon-daiwancheng"></i>
94 </span> 98 </span>
95 <span class="dai"> 99 <span class="dai">
96 - 待完成 100 + 已付尾款
97 </span> 101 </span>
98 </li> 102 </li>
99 -  
100 - 103 + </a>
  104 + <a href="{:url('user/Center/orderList',['status'=>5])}">
101 <li> 105 <li>
102 <span > 106 <span >
103 <i class="iconfont icon-pingjia"></i> 107 <i class="iconfont icon-pingjia"></i>
@@ -106,10 +110,10 @@ @@ -106,10 +110,10 @@
106 待评价 110 待评价
107 </span> 111 </span>
108 </li> 112 </li>
109 - 113 + </a>
110 </ul> 114 </ul>
111 </div> 115 </div>
112 - </a> 116 +
113 <a href="{:url('Center/discountCoupon')}"> 117 <a href="{:url('Center/discountCoupon')}">
114 <div class="wallet"> 118 <div class="wallet">
115 119
  1 +
  2 +<!DOCTYPE html>
  3 +<html>
  4 +<head>
  5 + <meta charset="UTF-8">
  6 + <title></title>
  7 + <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  8 + <script type="text/javascript" src="__TMPL__/static/js/base.js"></script>
  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_5o00hpwhlb.css" />
  12 + <script type="text/javascript" src="__TMPL__/static/assets/font/iconfont.js">
  13 + </script>
  14 + <link rel="stylesheet" href="__TMPL__/static/css/paybalance.css" />
  15 + <link rel="stylesheet" href="__TMPL__/static/css/common.css"/>
  16 + <link rel="stylesheet" href="__TMPL__/static/css/payed.css" />
  17 + <style type="text/css">
  18 + .bot_reason {
  19 + display: none;
  20 + }
  21 + </style>
  22 +</head>
  23 +
  24 +<body>
  25 +<div class="good">
  26 + <span>订单号:{$data.baseInfo.order_sn}</span>
  27 + <span class="confirmed">{$data.baseInfo.status_text}</span>
  28 +</div>
  29 +<div class="goods">
  30 + <div class="pic_row">
  31 + <span class="rock">
  32 + <span class="pic">
  33 + <img src="{$data.baseInfo.thumb}" alt="" style=" width: 2.04rem; height: 0.98rem;" />
  34 + </span>
  35 + <span class="two">
  36 + <span>{$data.baseInfo.name}</span>
  37 + <span class="price">
  38 + <span>定金 ¥{$data.baseInfo.down_price}</span>
  39 + <span>价格 ¥{$data.baseInfo.price}</span>
  40 + </span>
  41 + </span>
  42 + </span>
  43 + </div>
  44 + <span class="five">
  45 + x{$data.baseInfo.count}
  46 + </span>
  47 +</div>
  48 +<div class="list">
  49 + <div class="title">{$data.baseInfo.status_text}</div>
  50 + <volist name="data.escort" id="vo" key="k">
  51 + <div class="caned_out caned_bottom">
  52 + <div class="caned">
  53 + <div class="real">出行人{$k}:{$vo.name} {$vo.tel} x1 定金{$vo.down_price}</div>
  54 + <if condition="$vo['status'] neq '0'">
  55 + <div class="refundmoneyed">
  56 + <span>已发起退款</span>
  57 + <i class="iconfont icon-iconset0413"></i>
  58 + </div>
  59 + <else/>
  60 + <span id="B_{$vo.id}" style="height: 30px">
  61 + <button class="cancel" id="escort_{$vo.id}" data-id="{$vo.id}">退款</button>
  62 + </span>
  63 + </if>
  64 + </div>
  65 + <div class="refund_main_out">
  66 + <div class="refund">
  67 + <span class="tui">
  68 + 退款进度
  69 + </span>
  70 + <if condition="$vo['status'] eq '3'">
  71 + <span class="tui reson">查看原因</span>
  72 + </if>
  73 + </div>
  74 + {$vo.bar}
  75 + </div>
  76 + <div class="bot_reason">
  77 + <div class="bottom_reason">
  78 + <span>{$vo.reason}</span>
  79 + </div>
  80 + </div>
  81 + </div>
  82 + </volist>
  83 + <!--点击取消填写退款原因-->
  84 + <div class="refund_reason_out" id="refund_reason_out">
  85 +
  86 + <div class="refund_reason">
  87 + <i class="iconfont icon-chahao"></i>
  88 + <textarea id="T" name="" rows="" cols="" placeholder="请填写申请退款原因"></textarea>
  89 + <button class="refund_reason_submit">提交</button>
  90 + </div>
  91 + </div>
  92 + <!--提交后toast的提示-->
  93 + <div id="toast" style='display: none;'>
  94 + <div class="weui-mask_transparent"></div>
  95 + <div class="weui-toast">
  96 + <!--<i class="weui-icon-success-no-circle weui-icon_toast"></i>-->
  97 + <p class="weui-toast__content">已完成</p>
  98 + </div>
  99 + </div>
  100 +
  101 + <div class="footer_out">
  102 + <div class="footer ok">
  103 + 立即支付
  104 + </div>
  105 + </div>
  106 + <!--选择支付方式-->
  107 + <div class='move1'>
  108 + <div class='move_main1'>
  109 + <div class="shang2">
  110 + <div class="shang1">
  111 + <span class="choose">
  112 + 选择支付方式
  113 + </span>
  114 + </div>
  115 + <div class="shang1 shan1 shang_list">
  116 + <div class="shang1_inner">
  117 + <div class="img_out">
  118 + <img src="__TMPL__/static/images/yue.png" alt="" class="yue" />
  119 + </div>
  120 + <div>
  121 + 余额支付
  122 + </div>
  123 + </div>
  124 + <div>
  125 + <i class='iconfont icon-xuanzhong2'></i>
  126 + </div>
  127 + </div>
  128 + <div class="shang1 shan1">
  129 + <div class="shang1_inner">
  130 + <div class="img_out">
  131 + <img src="__TMPL__/static/images/wei.png" alt="" class="yue" />
  132 +
  133 + </div>
  134 + <div>
  135 + 微信支付
  136 + </div>
  137 + </div>
  138 + <div>
  139 + <i class='iconfont'></i>
  140 + </div>
  141 + </div>
  142 + <div class="shang1 shan1">
  143 + <div class="shang1_inner">
  144 + <div class="img_out">
  145 + <img src="__TMPL__/static/images/zhi.png" alt="" class="yue" />
  146 +
  147 + </div>
  148 + <div>
  149 + 支付宝支付
  150 + </div>
  151 + </div>
  152 + <div>
  153 + <i class='iconfont'></i>
  154 + </div>
  155 + </div>
  156 + <div class="agreepay">
  157 +
  158 + 确认支付
  159 + </div>
  160 + </div>
  161 + </div>
  162 + </div>
  163 +
  164 +</div>
  165 +</body>
  166 +
  167 +</html>
  168 +<script type="text/javascript" src="__TMPL__/static/assets/js/jquery-2.1.0.js"></script>
  169 +<script type="text/javascript" src="__TMPL__/static/assets/js/swiper-3.4.2.min.js"></script>
  170 +<script type="text/javascript" src="__TMPL__/static/assets/js/weui.js"></script>
  171 +<script type="text/javascript" src="__TMPL__/static/assets/js/common.js"></script>
  172 +<script type='text/javascript' src='__TMPL__/static/assets/js/Augly_Verification.js'></script>
  173 +
  174 +<script>
  175 + //点击选择支付方式
  176 + $('.footer').click(function() {
  177 + $('.move1').css('display', 'block');
  178 + })
  179 + $('.move1').click(function() {
  180 + $(this).css('display', 'none');
  181 + })
  182 + $('.move_main').click(function(e) {
  183 + e.stopPropagation();
  184 + })
  185 + $('.move_main1').click(function(e) {
  186 + e.stopPropagation();
  187 + })
  188 + $('.shan1').click(function() {
  189 + $(this).find('i').attr('class', 'iconfont icon-xuanzhong2');
  190 + $(this).siblings().find('i').attr('class', 'iconfont');
  191 + })
  192 + $('.move1').click(function() {
  193 + $(this).css('display', 'none');
  194 + })
  195 + $('.phone_btn').click(function() {
  196 + $('.move3').css('display', 'none');
  197 + })
  198 +
  199 + $('.reson').click(function() {
  200 + if($(this).parents('.caned_out').find('.bot_reason').css('display') == 'none') {
  201 + $(this).parents('.caned_out').find('.bot_reason').css('display', 'block');
  202 + } else {
  203 + $(this).parents('.caned_out').find('.bot_reason').css('display', 'none');
  204 +
  205 + }
  206 + })
  207 +
  208 + $('.refundmoneyed').click(function() {
  209 + if($(this).parents('.caned_out').find('.refund_main_out').css('display') == 'none') {
  210 + $(this).parents('.caned_out').find('.refund_main_out').css('display', 'block');
  211 + //$(this).parents('.caned_out').find('.iconfont').attr("class", "iconfont icon-chahao icon-iconset0414");
  212 + $('#icon-chahao').attr("class", "iconfont icon-chahao");
  213 + } else {
  214 + $(this).parents('.caned_out').find('.refund_main_out').css('display', 'none');
  215 + $(this).parents('.caned_out').find('.bot_reason').css('display', 'none');
  216 + //$(this).parents('.caned_out').find('.iconfont').attr("class", "iconfont icon-chahao icon-iconset0413");
  217 + $('#icon-chahao').attr("class", "iconfont icon-chahao");
  218 + }
  219 +
  220 + })
  221 +
  222 + var id='';
  223 +
  224 + $(function(){
  225 + //确认取消弹出框
  226 + $('.cancel').click(function(){
  227 + id = $(this).attr('data-id');
  228 + $('.refund_reason_out').css('display','block');
  229 + })
  230 + //阻止按钮的点击冒泡
  231 + $('.btnlist').click(function(event) {
  232 + event.stopPropagation();
  233 + });
  234 + $('.choice .swiper-slide').click(function(){
  235 + $(this).addClass("active_top").siblings().removeClass("active_top");
  236 +
  237 + })
  238 + //点击提交
  239 + $('.refund_reason_submit').click(function(){
  240 + $('.refund_reason_out').css('display','none');
  241 + if($("#T").val() == '') {
  242 + setTimeout("toast('请填写您的退款原因');", 900);
  243 + }else {
  244 + $.ajax({
  245 + url: "{:url('user/Center/refund')}",
  246 + data: {
  247 + id: id,
  248 + cause: $("#T").val()
  249 + },
  250 + type: "POST",
  251 + dataType: "JSON",
  252 +
  253 + success: function (data) {
  254 + if (data.data === true) {
  255 + if(setTimeout("toast('提交成功');", 900)) {
  256 +
  257 + }
  258 + }
  259 + }
  260 + })
  261 + }
  262 + })
  263 + $('.refund_reason_out').click(function(event){
  264 + $(this).css('display','none');
  265 + })
  266 + $('.icon-chahao').click(function(){
  267 + $(this).parents('.refund_reason_out').css('display','none');
  268 + })
  269 + $('.refund_reason').click(function(event){
  270 + event.stopPropagation();
  271 + })
  272 +
  273 + })
  274 +</script>
@@ -119,6 +119,7 @@ @@ -119,6 +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']])}">
122 <div class="good_out_stay" data-id="{$vo.oid}"> 123 <div class="good_out_stay" data-id="{$vo.oid}">
123 <div class="good"> 124 <div class="good">
124 <span>订单号:{$vo.order_sn}</span> 125 <span>订单号:{$vo.order_sn}</span>
@@ -162,6 +163,7 @@ @@ -162,6 +163,7 @@
162 </div> 163 </div>
163 </if> 164 </if>
164 </div> 165 </div>
  166 + </a>
165 </volist> 167 </volist>
166 168
167 169