作者 lihan

评价

@@ -16,7 +16,7 @@ class SmsController extends HomeBaseController @@ -16,7 +16,7 @@ class SmsController extends HomeBaseController
16 { 16 {
17 require_once EXTEND_PATH . '/zt_sms/sms.php'; 17 require_once EXTEND_PATH . '/zt_sms/sms.php';
18 $mobile = request()->param('mobile'); 18 $mobile = request()->param('mobile');
19 - $code = rand(000000, 999999); 19 + $code = rand(100000, 999999);
20 $content = '【天生红】您的验证码为' . $code . ',有效期5分钟,请及时使用。'; 20 $content = '【天生红】您的验证码为' . $code . ',有效期5分钟,请及时使用。';
21 $sms = new \SendMsg($mobile, $content); 21 $sms = new \SendMsg($mobile, $content);
22 $sms->sendSMS(); 22 $sms->sendSMS();
@@ -68,4 +68,5 @@ class SmsController extends HomeBaseController @@ -68,4 +68,5 @@ class SmsController extends HomeBaseController
68 } 68 }
69 } 69 }
70 } 70 }
  71 +
71 } 72 }
@@ -195,4 +195,30 @@ class CenterController extends HomeBaseController @@ -195,4 +195,30 @@ class CenterController extends HomeBaseController
195 ]); 195 ]);
196 } 196 }
197 197
  198 + public function evaluate()
  199 + {
  200 + $request = request();
  201 + $oid = $request->param('oid');
  202 + if ($request->isAjax()) {
  203 + $res = Db::name('zj_order_goods')->field('gid')->where(['oid' => $oid])->select();
  204 + $data = [];
  205 + foreach ($res as $key => $item) {
  206 + $data[$key] = [
  207 + 'oid' => $oid,
  208 + 'gid' => $item['gid'],
  209 + 'uid' => session('user.id'),
  210 + 'is_sta' => 1,
  211 + 'is_shove' => 1,
  212 + 'create_time' => time(),
  213 + 'rank' => $request->param('rank')
  214 + ];
  215 + }
  216 + if (Db::name('zj_evaluate')->insertAll($data)) {
  217 + $this->success('评价成功', '', true);
  218 + }
  219 + } else {
  220 + return $this->fetch();
  221 + }
  222 + }
  223 +
198 } 224 }
@@ -165,5 +165,35 @@ @@ -165,5 +165,35 @@
165 } 165 }
166 } 166 }
167 }) 167 })
  168 +
  169 + var InterValObj; //timer变量,控制时间
  170 + var count = 60; //间隔函数,1秒执行
  171 + var curCount;//当前剩余秒数
  172 +
  173 + $(".sendcode").click(function(){
  174 + curCount = count;
  175 + //设置button效果,开始计时
  176 + $(".sendcode").attr("disabled",true);
  177 +
  178 + // $(".sendcode").unbind()
  179 + $(".sendcode").html( curCount + "秒");
  180 + InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器,1秒执行一次
  181 +
  182 +
  183 + });
  184 +
  185 + //timer处理函数
  186 + function SetRemainTime() {
  187 + if (curCount == 0) {
  188 + window.clearInterval(InterValObj);//停止计时器
  189 + $(".sendcode").removeAttr("disabled");//启用按钮
  190 +
  191 + $(".sendcode").html("重新发送验证码");
  192 + }
  193 + else {
  194 + curCount--;
  195 + $(".sendcode").html(curCount + "秒");
  196 + }
  197 + }
168 </script> 198 </script>
169 </html> 199 </html>
  1 +
  2 +<!DOCTYPE html>
  3 +<html lang="en">
  4 +<head>
  5 + <meta charset="UTF-8">
  6 + <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7 + <link rel="stylesheet" href="https://at.alicdn.com/t/font_834805_0ml90wdq5hzm.css">
  8 + <link rel="stylesheet" href="__INDEX__/css/base.css">
  9 + <link rel="stylesheet" href="__INDEX__/css/swiper.min.css">
  10 + <script type="text/javascript" src="__INDEX__/js/base.js"></script>
  11 + <title>写评价</title>
  12 + <style>
  13 + body,html{
  14 + width:100%;
  15 + height:100%;
  16 + background: #fff;
  17 + }
  18 + .evalute_rank{
  19 +
  20 + height:1.6rem;
  21 + display:flex;
  22 + justify-content: space-between;
  23 + align-items: center;
  24 + padding: 0.38rem 1.63rem;
  25 + }
  26 + .rank_type_img{
  27 + font-size: 0;
  28 + width:0.6rem;
  29 + height:0.72rem;
  30 + }
  31 + .rank_type_img img{
  32 + width:100%;
  33 + }
  34 + .evalute_text{
  35 + width:0.6rem;
  36 + text-align: center;
  37 + font-size: 0.24rem;
  38 + color:#CCCCCC;
  39 + }
  40 + .active{
  41 + width:0.6rem;
  42 + text-align: center;
  43 + font-size: 0.24rem;
  44 + color:#FE0A01;
  45 + }
  46 + .writevalute{
  47 + width:6.86rem;
  48 + height:3.6rem;
  49 + background:#EBEBEB;
  50 + border-radius: 0.1rem;
  51 + margin: 0 auto;
  52 + padding: 0.31rem 0.3rem;
  53 + }
  54 + #write_evalute{
  55 + width:6.25rem;
  56 + height:3rem;
  57 + border:none;
  58 + outline:none;
  59 + background: #EBEBEB;
  60 + color:#999999;
  61 + font-size: 0.28rem;
  62 + }
  63 + .photo{
  64 + display:flex;
  65 + padding: 0.24rem 0.32rem;
  66 + }
  67 + .enter_photo{
  68 + width:1.8rem;
  69 + height:1.8rem;
  70 + }
  71 + .addphoto{
  72 + width:1.6rem;
  73 + height:1.6rem;
  74 + margin-top:0.1rem;
  75 + margin-left: 0.24rem;
  76 + }
  77 + .enter_photo img,.addphoto img{
  78 + width:100%;
  79 + }
  80 + .publish{
  81 + width:6.86rem;
  82 + height:0.88rem;
  83 + text-align: center;
  84 + line-height: 0.88rem;
  85 + background:#FE0A01;
  86 + color:#fff;
  87 + font-size:0.32rem;
  88 + position:fixed;
  89 + bottom:0.55rem;
  90 + left:0;
  91 + right:0;
  92 + margin:0 auto;
  93 + box-shadow:0px 15px 30px 0px rgba(254,10,1,0.24);
  94 + border-radius: 0.44rem;
  95 + }
  96 + </style>
  97 +</head>
  98 +<body>
  99 +<div class="container">
  100 + <div class="evalute_rank">
  101 + <div class="rank_type">
  102 + <p class="rank_type_img">
  103 + <img src="__INDEX__/img/rank1red.png" alt="">
  104 + </p>
  105 + <p class="evalute_text active">好评</p>
  106 +
  107 + </div>
  108 + <div class="rank_type">
  109 + <p class="rank_type_img">
  110 + <img src="__INDEX__/img/rank2gray.png" alt="">
  111 + </p>
  112 + <p class="evalute_text">中评</p>
  113 +
  114 + </div>
  115 + <div class="rank_type">
  116 + <p class="rank_type_img">
  117 + <img src="__INDEX__/img/rank3gray.png" alt="">
  118 + </p>
  119 + <p class="evalute_text">差评</p>
  120 +
  121 + </div>
  122 + </div>
  123 + <div class="writevalute">
  124 + <textarea name="" id="write_evalute" cols="30" rows="10" placeholder="请写下您的评价"></textarea>
  125 + </div>
  126 + <div class="photo">
  127 + <div style="display:flex">
  128 + <p class="enter_photo">
  129 + <img src="__INDEX__/img/apic01.png" alt="">
  130 + </p>
  131 +
  132 + </div>
  133 + <div class="addphoto">
  134 + <!--__INDEX__/img/addimg.png-->
  135 + <div id="preview">
  136 + <img id="imghead" border="0" src="__INDEX__/img/tianjia@2x.png" style="width:100%;height:100%" onclick="$('#previewImg').click();">
  137 + </div>
  138 + <!--<img src="__INDEX__/img/delet.png" alt="" style="position:absolute;bottom:92px;left:46px" class="deleteimg"/>-->
  139 + <input type="file" onchange="previewImage(this)" style="display: none;" id="previewImg">
  140 + </div>
  141 + <!--<p class="addphoto">-->
  142 + <!--<img src="__INDEX__/img/tianjia@2x.png" alt="">-->
  143 + <!--</p>-->
  144 + </div>
  145 + <div class="publish">
  146 + 发表
  147 + </div>
  148 +</div>
  149 +</body>
  150 +<script src="__INDEX__/js/jquery.min.js"></script>
  151 +<script>
  152 + function clacImgZoomParam(maxWidth, maxHeight, width, height) {
  153 + var param = {
  154 + top: 0,
  155 + left: 0,
  156 + width: width,
  157 + height: height
  158 + };
  159 + if(width > maxWidth || height > maxHeight) {
  160 + rateWidth = width / maxWidth;
  161 + rateHeight = height / maxHeight;
  162 +
  163 + if(rateWidth > rateHeight) {
  164 + param.width = maxWidth;
  165 + param.height = Math.round(height / rateWidth);
  166 + } else {
  167 + param.width = Math.round(width / rateHeight);
  168 + param.height = maxHeight;
  169 + }
  170 + }
  171 + param.left = Math.round((maxWidth - param.width) / 2);
  172 + param.top = Math.round((maxHeight - param.height) / 2);
  173 + return param;
  174 + }
  175 +
  176 +
  177 + function previewImage(file) {
  178 + var MAXWIDTH =60;
  179 + var MAXHEIGHT =77;
  180 + var div = document.getElementById('preview');
  181 + if(file.files && file.files[0]) {
  182 + div.innerHTML = '<img id=imghead onclick=$("#previewImg").click()>';
  183 + var img = document.getElementById('imghead');
  184 + img.onload = function() {
  185 + var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
  186 + img.width = rect.width;
  187 + img.height = rect.height;
  188 + // img.style.marginLeft = rect.left+'px';
  189 + img.style.marginTop = rect.top + 'px';
  190 + }
  191 + var reader = new FileReader();
  192 + reader.onload = function(evt) {
  193 + img.src = evt.target.result;
  194 + }
  195 + reader.readAsDataURL(file.files[0]);
  196 + } else //兼容IE
  197 + {
  198 + var sFilter = 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="';
  199 + file.select();
  200 + var src = document.selection.createRange().text;
  201 + div.innerHTML = '<img id=imghead>';
  202 + var img = document.getElementById('imghead');
  203 + img.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = src;
  204 + var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
  205 + status = ('rect:' + rect.top + ',' + rect.left + ',' + rect.width + ',' + rect.height);
  206 + div.innerHTML = "<div id=divhead style='width:" + rect.width + "px;height:" + rect.height + "px;margin-top:" + rect.top + "px;" + sFilter + src + "\"'></div>";
  207 + }
  208 + // var formData = new FormData();
  209 + // var fileM = document.querySelector("#previewImg");
  210 + // var fileObj = fileM.files[0];
  211 + // formData.append("files", fileObj);
  212 + // $.ajax({
  213 + // url: 'http://hula.wx.bronet.cn/index.php/MyComment/upload',
  214 + // type: 'POST',
  215 + // data: formData,
  216 + // async: false,
  217 + // cache: false,
  218 + // contentType: false,
  219 + // processData: false,
  220 + // success: function(res) {
  221 + // console.log(res);
  222 + // pic = res.data;
  223 + // console.log(pic);
  224 + // imgurl.push(pic);
  225 + // console.log(imgurl)
  226 + // var text = '';
  227 + // text += '<div class="evaluate_pic_item" style="float:left">' +
  228 + // '<img src="' + pic + '" class="delimg"/>' +
  229 + // '<div class="icon">' +
  230 + // '<img src="__INDEX__/img/10拷贝2@2x_59.png" />' +
  231 + // '</div>' +
  232 + // '</div>'
  233 + // $(".addimg").append(text);
  234 + // if(imgurl.length == 3) {
  235 + // $(".imgone").css("display", "none");
  236 + // }
  237 + // $("#imghead").attr("src","__INDEX__/img/3@2x.png");
  238 + // },
  239 + // error: function() {
  240 + //
  241 + // }
  242 + // });
  243 + }
  244 +</script>
  245 +</html>
@@ -91,7 +91,7 @@ @@ -91,7 +91,7 @@
91 </if> 91 </if>
92 <if condition="$vo['step'] eq '5'"> 92 <if condition="$vo['step'] eq '5'">
93 <div class="unpay"> 93 <div class="unpay">
94 - <p class="pay eval">评价</p> 94 + <p class="pay eval" data-url="{:url('user/Center/evaluate',['oid'=>$vo['id']])}">评价</p>
95 <p class="cancelorder refund">申请退款</p> 95 <p class="cancelorder refund">申请退款</p>
96 </div> 96 </div>
97 </if> 97 </if>
@@ -244,7 +244,7 @@ @@ -244,7 +244,7 @@
244 </volist> 244 </volist>
245 </div> 245 </div>
246 <div class="unpay"> 246 <div class="unpay">
247 - <p class="pay eval">评价</p> 247 + <p class="pay eval" data-url="{:url('user/Center/evaluate',['oid'=>$vo['id']])}">评价</p>
248 <p class="cancelorder refund">申请退款</p> 248 <p class="cancelorder refund">申请退款</p>
249 249
250 </div> 250 </div>
@@ -295,7 +295,7 @@ @@ -295,7 +295,7 @@
295 //评价 295 //评价
296 $(".eval").click(function(){ 296 $(".eval").click(function(){
297 window.event.stopPropagation() 297 window.event.stopPropagation()
298 - window.location.href='evalute.html' 298 + window.location.href=$(this).attr('data-url');
299 }) 299 })
300 //退款申请详情页 300 //退款申请详情页
301 $(".drawback").click(function(){ 301 $(".drawback").click(function(){