作者 李洪娟

Merge branch 'master' of http://114.215.101.231:8099/lihan/integral into juan

... ... @@ -88,7 +88,7 @@ class ZjGoodsController extends AdminBaseController
public function state(){
if ($this->request->isAjax()){
$param=input('param.');
if (empty($param['is_shove'])){
if (!empty($param['is_shove'])){
if ($param['is_shove']==2){
$num=Db::name('zj_goods')->where(['delete_time'=>0,'is_shove'=>2])->count();
if ($num>=6){
... ... @@ -460,4 +460,11 @@ class ZjGoodsController extends AdminBaseController
}
}
public function listorder() {
$request = request();
if($request->isAjax()) {
Db::name('zj_goods')->update($request->param());
}
}
}
\ No newline at end of file
... ...
... ... @@ -23,6 +23,9 @@ class ZjSystemController extends AdminBaseController
public function edit(){
if ($this->request->param()){
$arr=input('param.');
if (empty($arr['about_img'])){
$this->error('关于我们页背景图不可为空');
}
$arr['about']=htmlspecialchars(cmf_replace_content_file_url(htmlspecialchars_decode($arr['about'])));
$up=Db::name('zj_system')->update($arr);
if (empty($up)){
... ...
... ... @@ -80,7 +80,11 @@ class GoodsController extends HomeBaseController
$data['integral'] = '该商品无积分奖励';
}
$data['content'] = html_entity_decode($data['content']);
$total = Db::name('zj_cart')->field('sum(num) as total')->where(['uid' => session('user.id')])->select();
$total = Db::name('zj_cart')->alias('c')
->field('sum(num) as total')
->join('zj_goods g', 'c.gid=g.id')
->where(['uid' => session('user.id'), 'is_sta' => 1])
->select();
if ($total[0]['total'] == '') {
$total = 0;
} else {
... ...
... ... @@ -18,6 +18,7 @@ class GoodsModel extends Model
}
$res = Db::name('zj_goods')->alias('g')->join('zj_category c','g.cid=c.id')
->field('g.id,g.name,g.intro,g.price,g.thumb,c.cid as caid')->where($map)
->order('listorder')
->select()->toArray();
foreach ($res as $k => $v) {
$res[$k]['thumb'] = cmf_get_image_url($v['thumb']);
... ...
... ... @@ -7,47 +7,6 @@ use think\Db;
class IndexController extends HomeBaseController
{
function _initialize()
{
// parent::_initialize(); // TODO: Change the autogenerated stub
// if (cmf_is_wechat()) {
// if (empty(session('user.id'))) {
// require_once EXTEND_PATH . '/WeChatCommon.php';
// $wx = new \WeChatCommon();
// if (request()->param('code') == NULL) {
// $wx->code();
// } else {
// $code = request()->param('code');
// $info = $wx->getOpenid($code);
// if(Db::name('user')->where(['openid'=>$info['openid']])->count() == 0) {
// //注册新用户
// //拉去用户信息
// $return = $wx->getUserInfo($info);
// $data = [
// 'user_type' => 2,
// 'create_time' => time(),
// 'user_nickname' => $return['nickname'],
// 'sex' => $return['sex'],
// 'avatar' => $return['headimgurl'],
// 'openid' => $info['openid']
// ];
// if(Db::name('user')->insert($data)) {
// $userId = Db::name('user')->getLastInsID();
// session('user.id', $userId);
// session('user.openid', $info['openid']);
// }
// }else {
// $userId = Db::name('user')->where(['openid'=>$info['openid']])->value('id');
// session('user.id', $userId);
// session('user.openid', $info['openid']);
// }
// }
// }
// }else {
// $this->error('请从微信浏览器打开');
// }
}
public function index()
{
$goods = new GoodsModel;
... ...
... ... @@ -19,7 +19,7 @@ class IntegralController extends HomeBaseController
foreach ($give as $item) {
$give_balance = (int)($item['total'] * $item['ratio'] / 100);
$remain_balance = $item['balance'] - $give_balance;
if($remain_balance <= $give_balance) {
if($remain_balance < 0) {
$give_balance = $remain_balance;
$remain_balance = 0;
}
... ...
... ... @@ -14,9 +14,10 @@ class IntegralModel extends Model
* @param $balance
* @param $type 1购物收入 2购物使用 3好友赠送
* @param null $remark
* @param null $order_sn
* @return bool
*/
public function insertIntegralLog($integral_give_id = null, $uid, $create_time, $balance, $type, $remark = null)
public function insertIntegralLog($integral_give_id = null, $uid, $create_time, $balance, $type, $remark = null, $order_sn = null)
{
$data = [
'integral_give_id' => $integral_give_id,
... ... @@ -24,7 +25,8 @@ class IntegralModel extends Model
'create_time' => $create_time,
'balance' => $balance,
'type' => $type,
'remark' => $remark
'remark' => $remark,
'order_sn' => $order_sn
];
if (Db::name('zj_integral_log')->insert($data)) {
return true;
... ...
... ... @@ -17,7 +17,7 @@ class OrderModel extends Model
public function getAllOrders()
{
$all = Db::name('zj_order')
->field('id,order_num,step')
->field('id,order_num,step,is_evaluate,create_time')
->where(['uid' => session('user.id')])
->order('create_time DESC')
->select()
... ...
... ... @@ -53,8 +53,9 @@ class PayController extends HomeBaseController
} else {
$whole_num = $whole;
}
$sn = date('YmdHis') . rand(100000, 999999);
$order = [
'order_num' => date('YmdHis') . rand(100000, 999999),
'order_num' => $sn,
'step' => 1,
'uid' => session('user.id'),
'site' => $consignee['province'] . $consignee['city'] . $consignee['county'] . $consignee['place'],
... ... @@ -67,7 +68,13 @@ class PayController extends HomeBaseController
'pay_type' => $request->param('pay_type'),
'step' => 1,
//购买同时加入一级分类,用于判断是否赠送积分用
'cid' => $request->param('cid')
'cid' => $request->param('cid'),
//二级分类字符串-1-,-2-,-3-
'cids' => $this->getSonCategoryStr($data),
'province' => $consignee['province'],
'city' => $consignee['city'],
'county' => $consignee['county'],
'place' => $consignee['place']
];
Db::startTrans();
if (Db::name('zj_order')->insert($order)) {
... ... @@ -80,7 +87,7 @@ class PayController extends HomeBaseController
'oid' => $oid,
'gid' => $v['id'],
'num' => $v['num'],
'price' => Db::name('zj_goods')->where(['id'=>$v['id']])->value('price')
'price' => Db::name('zj_goods')->where(['id' => $v['id']])->value('price')
];
}
if (Db::name('zj_order_goods')->insertAll($orderGoods)) {
... ... @@ -110,7 +117,7 @@ class PayController extends HomeBaseController
if (Db::name('user')->update(['id' => session('user.id'), 'balance' => $balance])) {
//记录积分日志
$model = new IntegralModel;
$model->insertIntegralLog('', session('user.id'), time(), $whole, 2);
$model->insertIntegralLog('', session('user.id'), time(), $whole, 2, '', $sn);
//支付后改变订单状态
$update = [
'id' => $oid,
... ... @@ -122,7 +129,7 @@ class PayController extends HomeBaseController
session('goods.id', null);
Db::name('zj_cart')->where(['id' => ['in', session('cart.id')]])->delete();
session('cart.id', null);
$this->success('积分支付成功', url('user/center/orderList'), true);
$this->success('积分支付成功', url('user/Center/orderList'), true);
} else {
Db::rollback();
}
... ... @@ -138,28 +145,23 @@ class PayController extends HomeBaseController
if ($pay_cash > $balance) {
$this->success('您的积分不足', '', false);
} else {
if ($balance < $pay_num) {
Db::rollback();
$this->success('您的积分不足', '', false);
} else {
//先减余额
$balance -= $pay_num;
Db::name('user')->update(['id' => session('user.id'), 'balance' => (int)$balance]);
//记录积分日志
$model = new IntegralModel;
$model->insertIntegralLog('', session('user.id'), time(), $pay_num, 2);
Db::commit();
session('goods.id', null);
Db::name('zj_cart')->where(['id' => ['in', session('cart.id')]])->delete();
session('cart.id', null);
$info = [
'attach' => $oid,
'openid' => session('user.openid'),
'body' => '微信支付-天生红商城',
'total_fee' => $pay_cash
];
$this->wxPay($info);
}
//先减余额
$balance -= $pay_num;
Db::name('user')->update(['id' => session('user.id'), 'balance' => (int)$balance]);
//记录积分日志
$model = new IntegralModel;
$model->insertIntegralLog('', session('user.id'), time(), $pay_num, 2, '', $sn);
Db::commit();
session('goods.id', null);
Db::name('zj_cart')->where(['id' => ['in', session('cart.id')]])->delete();
session('cart.id', null);
$info = [
'attach' => $oid,
'openid' => session('user.openid'),
'body' => '微信支付-天生红商城',
'total_fee' => $pay_cash
];
$this->wxPay($info);
}
} else {
$this->success('请选择支付方式', '', false);
... ... @@ -201,7 +203,7 @@ class PayController extends HomeBaseController
//只有未支付的订单才能唤起微信支付
if (Db::name('zj_order')->where(['id' => $info['attach']])->value('step') == 1) {
require_once EXTEND_PATH . '/Payment.php';
$pay = new \Payment($info['attach'], $info['openid'], $info['body'], 1/*$info['total_fee'] * 100*/);
$pay = new \Payment($info['attach'], $info['openid'], $info['body'], $info['total_fee'] * 100);
$this->success('ok', url('user/center/orderList'), $pay->pay());
} else {
$this->success('该订单禁止支付', '', false);
... ... @@ -251,7 +253,7 @@ class PayController extends HomeBaseController
->select();
$integral = 0;
foreach ($data as $item) {
$integral += $item['price'] * $item['num'];
$integral += $item['price'] * $item['num'] * 2;
}
$ratio = Db::name('zj_system')->where(['id' => 1])->value('integral');
... ... @@ -260,12 +262,12 @@ class PayController extends HomeBaseController
//插入配送计划表,先将此积分的一半立刻给用户,剩余一半每日按固定百分比给用户,直到发完为止
$integral_half = $integral / 2;
Db::startTrans();
$integral_give_id = $model->insertIntegralGive($info['uid'], $ratio, $integral_half, $integral, time());
$integral_give_id = $model->insertIntegralGive($info['uid'], $ratio, $integral_half, $integral_half, time());
if ($integral_give_id) {
if ($model->insertIntegralLog($integral_give_id, $info['uid'], time(), $integral_half, 1)) {
if(Db::name('user')->where(['id'=>$info['uid']])->setInc('balance', $integral_half)) {
if (Db::name('user')->where(['id' => $info['uid']])->setInc('balance', $integral_half)) {
Db::commit();
}else {
} else {
Db::rollback();
}
} else {
... ... @@ -278,4 +280,14 @@ class PayController extends HomeBaseController
}
}
//获取购买商品的二级分类字符串
private function getSonCategoryStr($data)
{
$str = '';
foreach ($data as $item) {
$str .= '-' . Db::name('zj_goods')->where(['id' => $item['id']])->value('cid') . '-,';
}
return substr($str, 0, strlen($str) - 1);
}
}
\ No newline at end of file
... ...
... ... @@ -64,7 +64,7 @@ class AdminIndexController extends AdminBaseController
$keywordComplex = [];
if (!empty($param['keyword'])) {
$keyword = $param['keyword'];
$keywordComplex['mobile|id'] = ['like', "%$keyword%"];
$keywordComplex['mobile|id'] = $keyword;
}
if (!empty($param['start_time'])){
$where['create_time']=['egt',strtotime($param['start_time'])];
... ...
... ... @@ -8,13 +8,6 @@ use app\order\model\OrderModel;
class CenterController extends HomeBaseController
{
function _initialize()
{
if (empty(session('user.id'))) {
$this->error('登录超时', url('index/Index/index'));
}
}
/**
* 个人中心首页
*/
... ... @@ -117,7 +110,6 @@ class CenterController extends HomeBaseController
if (Db::name('zj_user_place')->insert($post)) {
$this->success('', url('user/Center/addressManage'), true);
}
} else {
return $this->fetch('add_address');
}
... ... @@ -179,6 +171,11 @@ class CenterController extends HomeBaseController
upload();
}
public function upload2()
{
$this->success('', '', upload2());
}
public function orderList()
{
$order = new OrderModel;
... ... @@ -196,24 +193,45 @@ class CenterController extends HomeBaseController
$request = request();
$oid = $request->param('oid');
if ($request->isAjax()) {
$res = Db::name('zj_order_goods')->field('gid')->where(['oid' => $oid])->select();
$data = [];
foreach ($res as $key => $item) {
$data[$key] = [
'oid' => $oid,
'gid' => $item['gid'],
'uid' => session('user.id'),
'is_sta' => 1,
'is_shove' => 1,
'create_time' => time(),
'rank' => $request->param('rank')
];
}
if (Db::name('zj_evaluate')->insertAll($data)) {
$this->success('评价成功', '', true);
Db::startTrans();
if (Db::name('zj_order')->where(['id' => $oid])->value('is_evaluate') == 0) {
$res = Db::name('zj_order_goods')->field('gid')->where(['oid' => $oid])->select();
$data = [];
foreach ($res as $key => $item) {
$data[$key] = [
'oid' => $oid,
'gid' => $item['gid'],
'uid' => session('user.id'),
'is_sta' => 1,
'is_shove' => 1,
'create_time' => time(),
'rank' => $request->param('rank'),
'more' => substr($request->param('more'), 0, strlen($request->param('more')) - 1),
'content' => $request->param('content')
];
}
if (Db::name('zj_evaluate')->insertAll($data)) {
//变为已评价
$evaluate = [
'id' => $oid,
'is_evaluate' => 1
];
if (Db::name('zj_order')->update($evaluate)) {
Db::commit();
$this->success('感谢您的支持!', url('user/Center/orderList'), true);
} else {
Db::rollback();
$this->success('评价失败', '', false);
}
}
} else {
Db::rollback();
$this->success('您已评价过此订单啦', '', false);
}
} else {
return $this->fetch();
return $this->fetch('', [
'oid' => $oid
]);
}
}
... ... @@ -266,7 +284,7 @@ class CenterController extends HomeBaseController
} else {
$order_sn = Db::name('zj_order')->where(['id' => $oid])->value('order_num');
$list = Db::name('zj_order_goods')->alias('o')
->field('g.name,g.intro,g.price,g.thumb,o.num')
->field('g.name,g.intro,o.price,g.thumb,o.num')
->join('zj_goods g', 'g.id=o.gid')
->where(['o.oid' => $oid])
->select();
... ... @@ -302,7 +320,7 @@ class CenterController extends HomeBaseController
} else {
$order = Db::name('zj_order')->field('order_num,cause')->where(['id' => $oid])->find();
$list = Db::name('zj_order_goods')->alias('o')
->field('g.name,g.intro,g.price,g.thumb,o.num')
->field('g.name,g.intro,o.price,g.thumb,o.num')
->join('zj_goods g', 'g.id=o.gid')
->where(['o.oid' => $oid])
->select();
... ...
... ... @@ -10,7 +10,7 @@
// [ 入口文件 ]
// 调试模式开关
define("APP_DEBUG", true);
define("APP_DEBUG", false);
// 定义CMF根目录,可更改此目录
define('CMF_ROOT', __DIR__ . '/../');
... ...
... ... @@ -291,6 +291,9 @@ body,html{
text-align: center;
}
/*购物车为空*/
.shopcart{
margin-left: 0.4rem;
}
.shopcar{
width:3.5rem;
font-size: 0.3rem;
... ...
... ... @@ -170,7 +170,7 @@ body,html{
.people_comment{
font-size: 0.24rem;
color:#FF0000;
margin-left: 1.51rem;
margin-left: 1.2rem;
height:0.25rem;
line-height: 0.25rem;
}
... ... @@ -189,12 +189,22 @@ body,html{
}
/*.home, .shopcart,.membercenter{*/
/*width:33.33%;*/
/*margin:0 auto;*/
/*!*display:flex;*!*/
/*!*justify-content: center;*!*/
/*!*align-items: center;*!*/
/*}*/
.home_page{
font-size: 0.24rem;
color:#BA1B2B;
width:0.6rem;
text-align: center;
}
.shopcart{
margin-left: 0.4rem;
}
.shop_cart{
color:#969799;
font-size: 0.24rem;
... ...
... ... @@ -166,6 +166,9 @@ body,html{
width:0.6rem;
text-align: center;
}
.shopcart{
margin-left: 0.4rem;
}
.shop_cart{
color:#969799;
font-size: 0.24rem;
... ...
... ... @@ -47,7 +47,8 @@
<table class="table table-hover table-bordered">
<thead>
<tr>
<th style="width: 50px;">id</th>
<!--<th style="width: 50px;">id</th>-->
<th>权重</th>
<th>商品名称</th>
<th>商品简介</th>
<th style="width: 80px;">一级分类</th>
... ... @@ -63,7 +64,8 @@
<tbody>
<foreach name="all" item="vo">
<tr>
<td>{$vo.id}</td>
<!--<td>{$vo.id}</td>-->
<td><input class="form-control listorder" style="width: 100px" type="number" value="{$vo.listorder}" data-id="{$vo.id}"></td>
<td>{$vo.name}</td>
<td>{$vo.intro}</td>
<td>{$vo.caname}</td>
... ... @@ -156,6 +158,19 @@
selectbox.remove(i);
}
}
$(".listorder").change(function () {
$.ajax({
url:"{:url('ZjGoods/listorder')}",
data:{
id:$(this).attr('data-id'),
listorder:$(this).val()
},
type:"POST",
dataType:"JSON"
})
})
</script>
</body>
</html>
\ No newline at end of file
... ...
... ... @@ -49,6 +49,12 @@
</td>
</tr>
<tr>
<th>联系方式</th>
<td>
<span>{$one.mobile}</span>
</td>
</tr>
<tr>
<th>下单时间</th>
<td>
<span>{:date('Y-m-d H:i',$one.create_time)}</span>
... ... @@ -65,7 +71,11 @@
<tr>
<th>支付时间</th>
<td>
<span>{:date('Y-m-d H:i',$one.pay_time)}</span>
<span>
<if condition="$one.pay_time neq ''">
{:date('Y-m-d H:i',$one.pay_time)}
</if>
</span>
</td>
</tr>
<tr>
... ...
... ... @@ -18,7 +18,26 @@
</div>
</div>
<div class="form-group">
<label><span class="form-required">*</span>关于我们</label>
<label><span class="form-required">*</span>关于我们-背景图</label>
<div style="text-align: center;">
<input type="hidden" name="about_img" id="thumbnai2"
value="{$one.about_img|default=''}">
<a href="javascript:uploadOneImage('图片上传','#thumbnai2');">
<if condition="empty($one.about_img)">
<img src="__TMPL__/public/assets/images/default-thumbnail.png"
id="thumbnai2-preview"
width="135" style="cursor: pointer"/>
<else/>
<img src="{:cmf_get_image_preview_url($one.about_img)}"
id="thumbnai2-preview"
width="135" style="cursor: pointer"/>
</if>
</a>
<input type="button" class="btn btn-sm btn-cancel-thumbnai2" value="取消图片">
</div>
</div>
<div class="form-group">
<label><span class="form-required">*</span>关于我们-公司简介</label>
<div>
<script type="text/plain" id="content" name="about">{:cmf_replace_content_file_url(htmlspecialchars_decode($one.about))}</script>
</div>
... ... @@ -66,6 +85,12 @@
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript" src="__STATIC__/js/city-picker.js"></script>
<script>
$('.btn-cancel-thumbnai2').click(function () {
$('#thumbnai2-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
$('#thumbnai2').val('');
});
var pla=$.rawCitiesData
var ci=document.getElementById('city')
var co=document.getElementById('county')
... ...
... ... @@ -12,7 +12,7 @@
<th>类型</th>
<th>变更时间</th>
<th>变更额度</th>
<th>变更后余额</th>
<!--<th>变更后余额</th>-->
</tr>
</thead>
<tbody>
... ... @@ -32,7 +32,7 @@
</if>
</td>
<td>{:date('Y-m-d H:i',$vo.create_time)}</td>
<td>{$vo.change}</td>
<td>{$vo['balance']}</td>
</tr>
</foreach>
... ...
... ... @@ -635,7 +635,7 @@
</if>
<if condition="$caid eq '2'">
<div class="pay_type_list">
<p class="pay_name">积分支付</p>
<p class="pay_name">积分支付<font color="red">(积分支付无积分赠送)</font></p>
<p class="iconfont pay icon-not_Selected-copy jifen alter" data-var="3"></p>
</div>
<div class="pay_type_list">
... ... @@ -818,6 +818,7 @@
dataType: "JSON",
success: function (data) {
//积分+微信支付
if (data.msg == 'ok') {
wx.chooseWXPay({
timestamp: data.data.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
... ... @@ -829,8 +830,10 @@
window.location.href = data.url;
},
});
}else {
alert(data.msg);
}
//积分支付
else {
window.location.href=data.url;
}
}
})
... ...
... ... @@ -113,26 +113,35 @@
<div class="line"></div>
<div class="foot">
<div class="home">
<p class="home_img">
<img src="__INDEX__/img/homered.png" alt="">
</p>
<p class="home_page">首页</p>
<p class="home_img">
<img src="__INDEX__/img/homered.png" alt="">
</p>
<p class="home_page">首页</p>
</div>
<div class="shopcart">
<p class="shopcart_img">
<img src="__INDEX__/img/cartgray.png" alt="">
</p>
<p class="shop_cart">
购物车
</p>
<p class="shopcart_img">
<img src="__INDEX__/img/cartgray.png" alt="">
</p>
<p class="shop_cart">
购物车
</p>
</div>
<div class="membercenter">
<p class="member_img">
<img src="__INDEX__/img/peoplegray.png" alt="">
</p>
<p class="member_center">
会员中心
</p>
<p class="member_img">
<img src="__INDEX__/img/peoplegray.png" alt="">
</p>
<p class="member_center">
会员中心
</p>
</div>
</div>
</div>
... ...
... ... @@ -126,21 +126,21 @@
<div class="evalute_rank">
<div class="rank_type">
<p class="rank_type_img">
<img src="__INDEX__/img/rank1red.png" alt="">
<img src="__INDEX__/img/rank1red.png" alt="" id="one">
</p>
<p class="evalute_text active">好评</p>
<p class="evalute_text active" data-rank="3">好评</p>
</div>
<div class="rank_type">
<p class="rank_type_img">
<img src="__INDEX__/img/rank2gray.png" alt="">
<img src="__INDEX__/img/rank2gray.png" alt="" id="two">
</p>
<p class="evalute_text">中评</p>
<p class="evalute_text" data-rank="2">中评</p>
</div>
<div class="rank_type">
<p class="rank_type_img">
<img src="__INDEX__/img/rank3gray.png" alt="">
<img src="__INDEX__/img/rank3gray.png" alt="" id="three">
</p>
<p class="evalute_text">差评</p>
<p class="evalute_text" data-rank="1">差评</p>
</div>
</div>
<div class="writevalute">
... ... @@ -170,30 +170,22 @@
$(this).children(".evalute_text").addClass("active");
$(this).siblings(".rank_type").children(".evalute_text").removeClass("active");
if($(this).children(".evalute_text").html()=='好评'){
$(this).children(".rank_type_img").children("img").attr("src","../img/rank1red.png");
if($(this).siblings(".rank_type").children(".evalute_text").html()=="中评"){
$(this).siblings(".rank_type").children(".rank_type_img").children("img").attr("src","__INDEX__/img/rank2gray.png");
}else if($(this).siblings(".rank_type").children(".evalute_text").html()=="差评"){
$(this).siblings(".rank_type").children(".rank_type_img").children("img").attr("src","__INDEX__/img/rank3gray.png");
}
$(this).children(".rank_type_img").children("img").attr("src","/static/index/img/rank1red.png");
$("#two").attr("src", "/static/index/img/rank2gray.png")
$("#three").attr("src", "/static/index/img/rank3gray.png")
}else if($(this).children(".evalute_text").html()=='中评'){
$(this).children(".rank_type_img").children("img").attr("src","../img/rank2red.png");
if($(this).siblings(".rank_type").children(".evalute_text").html()=="好评"){
$(this).siblings(".rank_type").children(".rank_type_img").children("img").attr("src","__INDEX__/img/rank1gray.png");
}else if($(this).siblings(".rank_type").children(".evalute_text").html()=="差评"){
$(this).siblings(".rank_type").children(".rank_type_img").children("img").attr("src","__INDEX__/img/rank3gray.png");
}
$(this).children(".rank_type_img").children("img").attr("src","/static/index/img/rank2red.png");
$("#one").attr("src", "/static/index/img/rank1gray.png")
$("#three").attr("src", "/static/index/img/rank3gray.png")
}else if($(this).children(".evalute_text").html()=='差评'){
$(this).children(".rank_type_img").children("img").attr("src","../img/rank3red.png");
if($(this).siblings(".rank_type").children(".evalute_text").html()=="好评"){
$(this).siblings(".rank_type").children(".rank_type_img").children("img").attr("src","__INDEX__/img/rank1gray.png");
}else if($(this).siblings(".rank_type").children(".evalute_text").html()=="中评"){
$(this).siblings(".rank_type").children(".rank_type_img").children("img").attr("src","__INDEX__/img/rank2gray.png");
}
$(this).children(".rank_type_img").children("img").attr("src","/static/index/img/rank3red.png");
$("#one").attr("src", "/static/index/img/rank1gray.png")
$("#two").attr("src", "/static/index/img/rank2gray.png")
}
})
var src="";
var more='';
function clacImgZoomParam(maxWidth, maxHeight, width, height) {
var param = {
top: 0,
... ... @@ -217,14 +209,15 @@
param.top = Math.round((maxHeight - param.height) / 2);
return param;
}
function previewImage(file) {
var MAXWIDTH =60;
var MAXHEIGHT =77;
var MAXWIDTH = 60;
var MAXHEIGHT = 77;
var div = document.getElementById('preview');
if(file.files && file.files[0]) {
if (file.files && file.files[0]) {
div.innerHTML = '<img id=imghead onclick=$("#previewImg").click()>';
var img = document.getElementById('imghead');
img.onload = function() {
img.onload = function () {
var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
img.width = rect.width;
img.height = rect.height;
... ... @@ -232,13 +225,13 @@
//img.style.marginTop = rect.top + 'px';
}
var reader = new FileReader();
reader.onload = function(evt) {
reader.onload = function (evt) {
src = evt.target.result;
var text='';
text+=' <div class="pushimg">' +
//console.log(src);
var text = '';
text += ' <div class="pushimg">' +
'<p class="enter_photo">' +
'<img src="'+src+'" alt="">' +
'<img src="' + src + '" alt="">' +
'</p>' +
'<p class="cancel">' +
'<img src="__INDEX__/img/cancel.png" alt="">' +
... ... @@ -248,7 +241,7 @@
$(".addimg").append(text);
img.src='__INDEX__/img/tianjia@2x.png';
img.src = '__INDEX__/img/tianjia@2x.png';
}
reader.readAsDataURL(file.files[0]);
} else //兼容IE
... ... @@ -264,56 +257,69 @@
div.innerHTML = "<div id=divhead style='width:" + rect.width + "px;height:" + rect.height + "px;margin-top:" + rect.top + "px;" + sFilter + src + "\"'></div>";
}
$(this).attr("src","__INDEX__/img/tianjia@2x.png");
var len=$(".enter_photo");
console.log(len.length)
if(len==3){
$("#preview").css("display","none")
$(this).attr("src", "__INDEX__/img/tianjia@2x.png");
var len = $(".enter_photo");
//console.log(len.length)
if (len == 3) {
$("#preview").css("display", "none")
}
//删除图片
console.log($(".addimg"))
$(".addimg").on("click",".cancel",function(){
//console.log($(".addimg"))
$(".addimg").on("click", ".cancel", function () {
$(this).parent(".pushimg").remove()
})
// var formData = new FormData();
// var fileM = document.querySelector("#previewImg");
// console.log(fileM)
// var fileObj = fileM.files[0];
// console.log(fileObj);
// formData.append("files", fileObj);
// $.ajax({
// url: 'http://hula.wx.bronet.cn/index.php/MyComment/upload',
// type: 'POST',
// data: formData,
// async: false,
// cache: false,
// contentType: false,
// processData: false,
// success: function(res) {
// console.log(res);
// pic = res.data;
// console.log(pic);
// imgurl.push(pic);
// console.log(imgurl)
// var text = '';
// text += '<div class="evaluate_pic_item" style="float:left">' +
// '<img src="' + pic + '" class="delimg"/>' +
// '<div class="icon">' +
// '<img src="../img/cancel.png" />' +
// '</div>' +
// '</div>'
// $(".addimg").append(text);
// if(imgurl.length == 3) {
// $(".imgone").css("display", "none");
// }
// $("#imghead").attr("src","../img/3@2x.png");
// },
// error: function() {
//
// }
// });
var formData = new FormData();
var fileM = document.querySelector("#previewImg");
//console.log(fileM)
var fileObj = fileM.files[0];
//console.log(fileObj);
formData.append("files", fileObj);
$.ajax({
url: "{:url('user/Center/upload2')}",
type: 'POST',
data: formData,
async: false,
cache: false,
contentType: false,
processData: false,
success: function (data) {
more=more+data.data+';';
}
});
}
//ajax如何传数组对象?
$(".publish").click(function () {
var content = $("#write_evalute").val();
content = $.trim(content);
if(content == '') {
alert('评价内容不能为空')
return false;
}else {
var data = {
oid: '{$oid}',
content: $("#write_evalute").val(),
more: more,
rank: $(".active").attr('data-rank')
}
$.ajax({
url: "",
data: data,
type: "POST",
dataType: "JSON",
success: function (data) {
if (data.data === true) {
alert(data.msg);
window.location.href = data.url;
} else {
alert(data.msg);
}
}
})
}
})
</script>
</html>
... ...
... ... @@ -51,6 +51,9 @@
</if>
</p>
<p class="good_date">{$vo.create_time|date='Y-m-d', ###}</p>
<if condition="$vo['order_sn'] neq ''">
<p class="good_date">订单号:{$vo.order_sn}</p>
</if>
</div>
<div class="code_intergral">
{$vo.balance}积分
... ...
... ... @@ -113,7 +113,9 @@
<in name="vo.step" value="5,6,7,8,9">
<div class="unpay">
<p class="pay eval" data-url="{:url('user/Center/evaluate',['oid'=>$vo['id']])}">评价</p>
<if condition="$vo['is_evaluate'] eq '0'">
<p class="pay eval" data-url="{:url('user/Center/evaluate',['oid'=>$vo['id']])}">评价</p>
</if>
<if condition="$vo['step'] eq '5'">
<p class="cancelorder refund" data-url="{:url('user/Center/refund',['oid'=>$vo['id']])}">申请退货</p>
</if>
... ... @@ -281,7 +283,9 @@
</volist>
</div>
<div class="unpay">
<p class="pay eval" data-url="{:url('user/Center/evaluate',['oid'=>$vo['id']])}">评价</p>
<if condition="$vo['is_evaluate'] eq '0'">
<p class="pay eval" data-url="{:url('user/Center/evaluate',['oid'=>$vo['id']])}">评价</p>
</if>
<if condition="$vo['step'] eq '5'">
<p class="cancelorder refund" data-url="{:url('user/Center/refund',['oid'=>$vo['id']])}">申请退货</p>
</if>
... ...
... ... @@ -90,6 +90,12 @@
if(!window.confirm('是否提交退货申请?')) {
return false;
}else {
var cause = $("#cause").val();
cause = $.trim(cause)
if(cause == '') {
alert('请详细填写退款原因');
return false;
}
$.ajax({
url:"{:url('user/Center/refund')}",
data:{
... ...
... ... @@ -1882,4 +1882,30 @@ function upload()
}
}
}
function upload2()
{
$request = request();
if ($request->isAjax()) {
$file = request()->file('files');
$info = $file->move(ROOT_PATH . 'public' . DS . 'upload/portal/comment');
if ($info) {
// 成功上传后 获取上传信息
// 输出 jpg
//echo $info->getExtension();
// 输出 20160820/42a79759f284b767dfcb2a0197904287.jpg
$save = cmf_get_image_url('portal/comment/' . $info->getSaveName());
// 输出 42a79759f284b767dfcb2a0197904287.jpg
//echo $info->getFilename();
//更新头像
//原始头像
return $save;
} else {
// 上传失败获取错误信息
echo $file->getError();
exit();
}
}
}
\ No newline at end of file
... ...
... ... @@ -56,7 +56,7 @@ class HomeBaseController extends BaseController
}
}
}else {
$this->error('请从微信浏览器打开');
// $this->error('请从微信浏览器打开');
}
... ...