添加个人中心功能
添加订单记录
This commit is contained in:
@@ -73,6 +73,13 @@
|
|||||||
height: 62px;
|
height: 62px;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
/* 退款状态标红样式 */
|
||||||
|
.refund-status-row {
|
||||||
|
background-color: #ffebee !important;
|
||||||
|
}
|
||||||
|
.refund-status-row:hover {
|
||||||
|
background-color: #ffcdd2 !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="layui-fluid">
|
<div class="layui-fluid">
|
||||||
@@ -356,18 +363,46 @@
|
|||||||
<div style="text-align: left">
|
<div style="text-align: left">
|
||||||
<p>订单编号:{{d.order_sn}}</p>
|
<p>订单编号:{{d.order_sn}}</p>
|
||||||
<p>下单时间:{{d.create_time}}</p>
|
<p>下单时间:{{d.create_time}}</p>
|
||||||
<p>订单来源:{{d.channel}}</p>
|
<p>订单来源:
|
||||||
<p>收款方式:{{d.gord_name}}</p>
|
{{# if(d.channel){ }}
|
||||||
|
{{d.channel}}
|
||||||
|
{{# } else { }}
|
||||||
|
小程序
|
||||||
|
{{# } }}
|
||||||
|
</p>
|
||||||
|
<p>支付方式:
|
||||||
|
{{# if(d.pay_way == 1){ }}
|
||||||
|
微信支付
|
||||||
|
{{# } }}
|
||||||
|
{{# if(d.pay_way == 2){ }}
|
||||||
|
支付宝支付
|
||||||
|
{{# } }}
|
||||||
|
{{# if(d.pay_way == 3){ }}
|
||||||
|
余额支付
|
||||||
|
{{# } }}
|
||||||
|
{{# if(!d.pay_way || (d.pay_way != 1 && d.pay_way != 2 && d.pay_way != 3)){ }}
|
||||||
|
-
|
||||||
|
{{# } }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{{# if(d.pay_status == 0){ }}
|
||||||
{{# if(d.pay_zd == 0){ }}
|
<p style="color:#fe0707">订单状态:
|
||||||
<p style="color:#fe0707">支付状态:
|
待支付
|
||||||
已收款
|
|
||||||
</p>
|
</p>
|
||||||
{{# } }}
|
{{# } }}
|
||||||
{{# if(d.pay_zd == 1){ }}
|
{{# if(d.pay_status == 1){ }}
|
||||||
<p style="color:#3A91FB">支付状态:
|
<p style="color:#3A91FB">订单状态:
|
||||||
未收账款
|
已支付
|
||||||
|
</p>
|
||||||
|
{{# } }}
|
||||||
|
{{# if(d.pay_status == 2){ }}
|
||||||
|
<p style="color:#ff9800">订单状态:
|
||||||
|
已退款
|
||||||
|
</p>
|
||||||
|
{{# } }}
|
||||||
|
{{# if(d.pay_status == 3){ }}
|
||||||
|
<p style="color:#f44336">订单状态:
|
||||||
|
拒绝退款
|
||||||
</p>
|
</p>
|
||||||
{{# } }}
|
{{# } }}
|
||||||
</div>
|
</div>
|
||||||
@@ -600,6 +635,23 @@
|
|||||||
$($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
|
$($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
|
||||||
$($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
|
$($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 如果 refund_status > 0,整行标红显示
|
||||||
|
if (res && res.data && res.data.length > 0) {
|
||||||
|
res.data.forEach(function(item, index) {
|
||||||
|
if (item.refund_status && parseInt(item.refund_status) > 0) {
|
||||||
|
// 给主表格行添加红色背景
|
||||||
|
var $mainRow = $(".layui-table-main tbody tr").eq(index);
|
||||||
|
$mainRow.addClass('refund-status-row');
|
||||||
|
|
||||||
|
// 给固定列的行也添加红色背景
|
||||||
|
var $fixedLeftRow = $(".layui-table-fixed-l .layui-table-body tbody tr").eq(index);
|
||||||
|
var $fixedRightRow = $(".layui-table-fixed-r .layui-table-body tbody tr").eq(index);
|
||||||
|
$fixedLeftRow.addClass('refund-status-row');
|
||||||
|
$fixedRightRow.addClass('refund-status-row');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ use app\api\logic\AfterSaleLogic;
|
|||||||
* Class Order
|
* Class Order
|
||||||
* @package app\api\controller
|
* @package app\api\controller
|
||||||
*/
|
*/
|
||||||
class AfterSale extends ApiBase
|
class Aftersale extends ApiBase
|
||||||
{
|
{
|
||||||
public function lists()
|
public function lists()
|
||||||
{
|
{
|
||||||
@@ -107,7 +107,10 @@ class AfterSale extends ApiBase
|
|||||||
$this->_error('订单已完成,无法申请退款');
|
$this->_error('订单已完成,无法申请退款');
|
||||||
}
|
}
|
||||||
$ref=Db::name('order')->where('id',$post['id'])->update(['refund_status'=>2]);
|
$ref=Db::name('order')->where('id',$post['id'])->update(['refund_status'=>2]);
|
||||||
|
if ($ref){
|
||||||
$this->_success('申请成功');
|
$this->_success('申请成功');
|
||||||
|
}else{
|
||||||
|
$this->_error('申请失败');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -44,4 +44,15 @@ class File extends ApiBase
|
|||||||
$data = FileServer::userFormImage($this->user_id);
|
$data = FileServer::userFormImage($this->user_id);
|
||||||
$this->_success($data['msg'], $data['data'], $data['code']);
|
$this->_success($data['msg'], $data['data'], $data['code']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频上传
|
||||||
|
* @param string $file
|
||||||
|
* @return \think\response\Json
|
||||||
|
*/
|
||||||
|
public function videoUpload($file = '')
|
||||||
|
{
|
||||||
|
$result = FileServer::video();
|
||||||
|
$this->_success('上传成功', $result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
80
application/api/controller/Sale.php
Normal file
80
application/api/controller/Sale.php
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
use think\Db;
|
||||||
|
|
||||||
|
class Sale extends ApiBase
|
||||||
|
{
|
||||||
|
//添加投诉内容
|
||||||
|
public function addComplaint()
|
||||||
|
{
|
||||||
|
$post = $this->request->post();
|
||||||
|
if ($post['sub_id'] == null){
|
||||||
|
$this->_error('请选择售后订单');
|
||||||
|
}
|
||||||
|
if ($post['content'] == null){
|
||||||
|
$this->_error('请填写售后问题');
|
||||||
|
}
|
||||||
|
//查询是否存在该订单
|
||||||
|
$userid = $this->user_id;
|
||||||
|
$orderInfo = Db::name('order_exe')->find($post['sub_id']);
|
||||||
|
if ($orderInfo == null){
|
||||||
|
$this->_error('订单不存在');
|
||||||
|
}
|
||||||
|
if ($orderInfo['sale_state'] == 1){
|
||||||
|
$this->_error('该订单已投诉');
|
||||||
|
}
|
||||||
|
if ($post['mobile'] != null){
|
||||||
|
$phone = $post['mobile'];
|
||||||
|
}else{
|
||||||
|
$phone = $orderInfo['phone'];
|
||||||
|
}
|
||||||
|
if ($post['images'] != null){
|
||||||
|
$post['images'] = is_array($post['images']) ? implode(',', $post['images']) : $post['images'];
|
||||||
|
}
|
||||||
|
if ($post['videos'] != null){
|
||||||
|
$post['videos'] = is_array($post['videos']) ? implode(',', $post['videos']) : $post['videos'];
|
||||||
|
}
|
||||||
|
$data = [
|
||||||
|
'user_id' => $userid,
|
||||||
|
'name' => $orderInfo['name'],
|
||||||
|
'phone' => $phone,
|
||||||
|
'type' => $post['type'],
|
||||||
|
'goods_images' => $post['images'],
|
||||||
|
'video' => $post['videos'],
|
||||||
|
'problem' => $post['content'],
|
||||||
|
'autotime' => time(),
|
||||||
|
'staff_id' => $orderInfo['staff_id'],
|
||||||
|
'status' => 0,
|
||||||
|
'adjust' => "",
|
||||||
|
'order_id' => $post['sub_id'],
|
||||||
|
'punish' => 0,
|
||||||
|
'time' => time()
|
||||||
|
];
|
||||||
|
Db::startTrans();
|
||||||
|
try{
|
||||||
|
//创建投诉记录
|
||||||
|
Db::name('order_sale')->insert($data);
|
||||||
|
//修改子订单投诉状态
|
||||||
|
Db::name('order_exe')->where('id',$post['sub_id'])->update(['sale_state' => 1]);
|
||||||
|
Db::commit();
|
||||||
|
}catch (\Exception $e){
|
||||||
|
Db::rollback();
|
||||||
|
$this->_error('提交失败');
|
||||||
|
}
|
||||||
|
$this->_success('提交成功');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//投诉列表
|
||||||
|
public function complaintList()
|
||||||
|
{
|
||||||
|
$userid = $this->user_id;
|
||||||
|
$list = Db::name('order_sale')
|
||||||
|
->where('')
|
||||||
|
->where('user_id',$userid)
|
||||||
|
->paginate(10);
|
||||||
|
$this->_success('成功',$list);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -365,6 +365,9 @@ class Staffgoods extends ApiBase
|
|||||||
$this->_error('订单不存在');
|
$this->_error('订单不存在');
|
||||||
}
|
}
|
||||||
$user=Db::name('order')->where('order_sn',$order['order_sn'])->find(); //获取主订单信息
|
$user=Db::name('order')->where('order_sn',$order['order_sn'])->find(); //获取主订单信息
|
||||||
|
if ($user == null){
|
||||||
|
$this->_error('订单不存在');
|
||||||
|
}
|
||||||
$data=[
|
$data=[
|
||||||
'name'=> $user['consignee'],
|
'name'=> $user['consignee'],
|
||||||
'phone'=> $user['mobile'],
|
'phone'=> $user['mobile'],
|
||||||
@@ -372,19 +375,29 @@ class Staffgoods extends ApiBase
|
|||||||
'order_id'=>$get['order_id'],
|
'order_id'=>$get['order_id'],
|
||||||
'staff_id'=>$order['staff_id'],
|
'staff_id'=>$order['staff_id'],
|
||||||
'score'=>$get['score'],
|
'score'=>$get['score'],
|
||||||
'eceives'=>$get['infoReceives'],
|
'eceives'=>$get['service_attitude'],
|
||||||
'eceivesd'=>$get['infoReceivesd'],
|
'eceivesd'=>$get['service_quality'],
|
||||||
'content'=>$get['textareaValue'],
|
'content'=>$get['comment'],
|
||||||
'create_time'=>time()
|
'create_time'=>time()
|
||||||
];
|
];
|
||||||
$where=Db::name('orderexe_evaluate')->where('order_id',$get['order_id'])->find();
|
$pljl = Db::name('orderexe_evaluate')->where('order_id',$get['order_id'])->find();
|
||||||
if($where){
|
if ($pljl){
|
||||||
$this->_success('已经提交评价');
|
$this->_success('请勿重复评价');
|
||||||
}else{
|
|
||||||
$inser=Db::name('orderexe_evaluate')->data($data)->insert();
|
|
||||||
$this->_success('评价内容提交成功');
|
|
||||||
}
|
}
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
//添加评论记录
|
||||||
|
Db::name('orderexe_evaluate')->data($data)->insert();
|
||||||
|
//修改子订单评论状态
|
||||||
|
Db::name('order_exe')->where('id',$get['order_id'])->update(['orderpl'=>1]);
|
||||||
|
// 提交事务
|
||||||
|
Db::commit();
|
||||||
|
}catch (\Exception $exception){
|
||||||
|
// 回滚事务
|
||||||
|
Db::rollback();
|
||||||
|
$this->_error('评价失败');
|
||||||
|
}
|
||||||
|
$this->_success('评价成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
//员工的工资单
|
//员工的工资单
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ class AfterSaleLogic extends LogicBase
|
|||||||
// Db::startTrans();
|
// Db::startTrans();
|
||||||
// try {
|
// try {
|
||||||
/// $id = $post['id'];
|
/// $id = $post['id'];
|
||||||
// $after_sale = AfterSale::get($id); //获取订单的基本信息
|
// $after_sale = Aftersale::get($id); //获取订单的基本信息
|
||||||
/// $refund_status= Db::name('order')->where('id',$id)->update(['refund_status'=>2]);
|
/// $refund_status= Db::name('order')->where('id',$id)->update(['refund_status'=>2]);
|
||||||
/// dump($refund_status);
|
/// dump($refund_status);
|
||||||
// if($refund_status){
|
// if($refund_status){
|
||||||
@@ -386,7 +386,7 @@ class AfterSaleLogic extends LogicBase
|
|||||||
// $after_sale->refund_reason = trim($post['reason']);
|
// $after_sale->refund_reason = trim($post['reason']);
|
||||||
// $after_sale->refund_remark = isset($post['remark']) ? trim($post['remark']) : '';
|
// $after_sale->refund_remark = isset($post['remark']) ? trim($post['remark']) : '';
|
||||||
// $after_sale->refund_image = isset($post['img']) ? $post['img'] : '';
|
// $after_sale->refund_image = isset($post['img']) ? $post['img'] : '';
|
||||||
// $after_sale->status = AfterSale::STATUS_APPLY_REFUND;
|
// $after_sale->status = Aftersale::STATUS_APPLY_REFUND;
|
||||||
// $after_sale->save();
|
// $after_sale->save();
|
||||||
|
|
||||||
// //2,更改订单商品,退款状态为申请退款
|
// //2,更改订单商品,退款状态为申请退款
|
||||||
|
|||||||
@@ -957,29 +957,70 @@ class OrderLogic extends LogicBase
|
|||||||
case 'pay':
|
case 'pay':
|
||||||
$where[] = ['pay_status', '=', CommonOrder::STATUS_WAIT_PAY];
|
$where[] = ['pay_status', '=', CommonOrder::STATUS_WAIT_PAY];
|
||||||
break;
|
break;
|
||||||
|
case 'stop':
|
||||||
|
$where[] = ['pay_status', '=', 1];
|
||||||
|
$where[] = ['status', '=', 1];
|
||||||
|
break;
|
||||||
case 'delivery':
|
case 'delivery':
|
||||||
$where[] = ['pay_status', '=', 0];
|
$where[] = ['pay_status', '=', 1];
|
||||||
break;
|
break;
|
||||||
case 'finish':
|
case 'finish':
|
||||||
$where[] = ['order_status', '=',1];
|
$where[] = ['pay_status', '=', 1];
|
||||||
|
$where[] = ['order_status', '=', 3];
|
||||||
break;
|
break;
|
||||||
case 'close':
|
case 'close':
|
||||||
$where[] = ['order_status', '=', 4];
|
$where[] = ['order_status', '=', 4];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user=Db::name('user')->where('id',$user_id)->find();
|
// $user=Db::name('user')->where('id',$user_id)->find();
|
||||||
$count = $order->where(['del' => 0, 'user_id' => $user['mobile']])
|
if ($type=='reserving'){
|
||||||
|
$where[] = ['pay_status', '=', 1];
|
||||||
|
//查询待预约订单
|
||||||
|
$count = $order->where(['del' => 0, 'user_id' => $user_id])
|
||||||
|
->with('OrderExe')
|
||||||
->where($where)
|
->where($where)
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
$lists = $order->where(['del' => 0, 'mobile' => $user['mobile']])
|
$lists = $order->where(['del' => 0, 'user_id' => $user_id])
|
||||||
->where($where)
|
->where($where)
|
||||||
// ->with(['orderGoods'])
|
->with('OrderExe')
|
||||||
->field('id,order_sn,order_status,pay_status,order_amount,order_status,order_type,shipping_status,create_time,number,goods_id,code')
|
->field('id,order_sn,order_status,pay_status,order_amount,order_status,order_type,shipping_status,refund_status,create_time,number,goods_id,code')
|
||||||
->page($page, $size)
|
->page($page, $size)
|
||||||
->order('id desc')
|
->order('id desc')
|
||||||
->select();
|
->select();
|
||||||
|
}else if($type == 'inservice'){
|
||||||
|
//服务中
|
||||||
|
$where[] = ['pay_status', '=', 1];
|
||||||
|
$count = $order->where(['del' => 0, 'user_id' => $user_id])
|
||||||
|
->with(['OrderExe' => function ($query) {
|
||||||
|
$query->where('timeout', '<>', 'null');
|
||||||
|
}])
|
||||||
|
->where($where)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
$lists = $order->where(['del' => 0, 'user_id' => $user_id])
|
||||||
|
->where($where)
|
||||||
|
->with(['OrderExe' => function ($query) {
|
||||||
|
$query->where('timeout', '<>', 'null');
|
||||||
|
}])
|
||||||
|
->field('id,order_sn,order_status,pay_status,order_amount,order_status,order_type,shipping_status,refund_status,create_time,number,goods_id,code')
|
||||||
|
->page($page, $size)
|
||||||
|
->order('id desc')
|
||||||
|
->select();
|
||||||
|
}else{
|
||||||
|
$count = $order->where(['del' => 0, 'user_id' => $user_id])
|
||||||
|
->where($where)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
$lists = $order->where(['del' => 0, 'user_id' => $user_id])
|
||||||
|
->where($where)
|
||||||
|
// ->with(['orderGoods'])
|
||||||
|
->field('id,order_sn,order_status,pay_status,order_amount,order_status,order_type,shipping_status,refund_status,create_time,number,goods_id,code')
|
||||||
|
->page($page, $size)
|
||||||
|
->order('id desc')
|
||||||
|
->select();
|
||||||
|
}
|
||||||
foreach ($lists as $list){
|
foreach ($lists as $list){
|
||||||
$goods=Db::name('goods')->where('id',$list['goods_id'])->find();
|
$goods=Db::name('goods')->where('id',$list['goods_id'])->find();
|
||||||
$list['image']=UrlServer::getFileUrl($goods['image']);
|
$list['image']=UrlServer::getFileUrl($goods['image']);
|
||||||
@@ -1329,17 +1370,18 @@ class OrderLogic extends LogicBase
|
|||||||
$order = new Orderexe();
|
$order = new Orderexe();
|
||||||
$where[] = ['order_sn', '=',$order_sn];
|
$where[] = ['order_sn', '=',$order_sn];
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'pay':
|
case 'wait':
|
||||||
|
//待服务
|
||||||
$where[] = ['staff_status', '=',0];
|
$where[] = ['staff_status', '=',0];
|
||||||
break;
|
break;
|
||||||
case 'delivery':
|
case 'delivery':
|
||||||
$where[] = ['staff_status', '=',1];
|
$where[] = ['staff_status', '=',1];
|
||||||
break;
|
break;
|
||||||
case 'finish':
|
case 'service':
|
||||||
$where[] = ['staff_status', '=',2];
|
$where[] = ['staff_status', '=',2];
|
||||||
break;
|
break;
|
||||||
case 'close':
|
case 'finish':
|
||||||
$where[] = ['staff_status', '=',4];
|
$where[] = ['staff_status', '=',3];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1372,7 +1414,6 @@ class OrderLogic extends LogicBase
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'list' => $lists,
|
'list' => $lists,
|
||||||
'page' => $page,
|
'page' => $page,
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ use app\common\server\ConfigServer;
|
|||||||
use think\Db;
|
use think\Db;
|
||||||
use think\Model;
|
use think\Model;
|
||||||
use app\common\model\Order as CommonOrder;
|
use app\common\model\Order as CommonOrder;
|
||||||
|
use think\model\relation\HasOne;
|
||||||
|
|
||||||
class Order extends Model
|
class Order extends Model
|
||||||
{
|
{
|
||||||
@@ -38,6 +39,12 @@ class Order extends Model
|
|||||||
return date('Y-m-d H:i:s', $value);
|
return date('Y-m-d H:i:s', $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//查询预约订单列表
|
||||||
|
public function OrderExe(): HasOne
|
||||||
|
{
|
||||||
|
return $this->hasOne(Orderexe::class, 'order_sn', 'order_sn');
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 付款时间
|
* 付款时间
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user