修复内容

This commit is contained in:
2026-01-18 18:07:53 +08:00
parent 5455aceab5
commit 5fe5289e26
9 changed files with 493 additions and 470 deletions

View File

@@ -28,8 +28,8 @@ class OrderLogic
/** /**
* Notes: 列表查询条件 * Notes: 列表查询条件
* @param $get * @param $get
* @author 段誉(2021/2/1 10:12)
* @return array * @return array
* @author 段誉(2021/2/1 10:12)
*/ */
public static function getListsCondition($get) public static function getListsCondition($get)
{ {
@@ -80,7 +80,6 @@ class OrderLogic
} }
//配送方式 //配送方式
if (isset($get['delivery_type']) && $get['delivery_type'] != '') { if (isset($get['delivery_type']) && $get['delivery_type'] != '') {
$where[] = ['delivery_type', '=', $get['delivery_type']]; $where[] = ['delivery_type', '=', $get['delivery_type']];
@@ -110,8 +109,8 @@ class OrderLogic
/** /**
* Notes: 列表 * Notes: 列表
* @param $get * @param $get
* @author 段誉(2021/2/1 10:12)
* @return array * @return array
* @author 段誉(2021/2/1 10:12)
*/ */
public static function lists($get) public static function lists($get)
{ {
@@ -142,7 +141,6 @@ class OrderLogic
} }
//获取订单的商品 //获取订单的商品
$goods = GoodsLogic::goodsinfo($item['goods_id']); $goods = GoodsLogic::goodsinfo($item['goods_id']);
if ($goods) { if ($goods) {
@@ -267,7 +265,8 @@ class OrderLogic
} }
public static function exportorder($get){ public static function exportorder($get)
{
$where[] = ['o.del', '=', 0]; $where[] = ['o.del', '=', 0];
$where = self::getListsCondition($get); $where = self::getListsCondition($get);
$lists = Db::name('order')->where($where)->select(); //获取订单的内容 $lists = Db::name('order')->where($where)->select(); //获取订单的内容
@@ -313,8 +312,6 @@ class OrderLogic
$dsynumber = $item['number'] - $ervice; $dsynumber = $item['number'] - $ervice;
if ($item['pay_zd'] == 0) { if ($item['pay_zd'] == 0) {
$item['pay_zd'] = '已收款'; $item['pay_zd'] = '已收款';
} else { } else {
@@ -333,10 +330,11 @@ class OrderLogic
/** /**
* Notes: 我的订单导出功能 * Notes: 我的订单导出功能
* @param $get * @param $get
* @author 段誉(2021/2/1 10:12)
* @return array * @return array
* @author 段誉(2021/2/1 10:12)
*/ */
public static function userexport($get){ public static function userexport($get)
{
$where = []; $where = [];
$where = self::getListsCondition($get); $where = self::getListsCondition($get);
@@ -538,8 +536,8 @@ class OrderLogic
/** /**
* Notes: 详情 * Notes: 详情
* @param $id * @param $id
* @author 段誉(2021/2/1 10:12)
* @return Order * @return Order
* @author 段誉(2021/2/1 10:12)
*/ */
public static function getDetail($id) public static function getDetail($id)
{ {
@@ -561,6 +559,7 @@ class OrderLogic
} }
return $result; return $result;
} }
/** /**
* Notes: 取消订单(返回商品规格表库存) * Notes: 取消订单(返回商品规格表库存)
* @param $order_id * @param $order_id
@@ -618,11 +617,11 @@ class OrderLogic
/** /**
* Notes: 物流公司 * Notes: 物流公司
* @author 段誉(2021/2/1 10:15)
* @return array|\PDOStatement|string|\think\Collection * @return array|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
* @author 段誉(2021/2/1 10:15)
*/ */
public static function express() public static function express()
{ {
@@ -630,19 +629,17 @@ class OrderLogic
} }
/** /**
* Notes: 发货操作 * Notes: 发货操作
* @param $data * @param $data
* @param $admin_id * @param $admin_id
* @author 段誉(2021/2/1 10:15)
* @return bool * @return bool
* @throws \think\Exception * @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
* @throws \think\exception\PDOException * @throws \think\exception\PDOException
* @author 段誉(2021/2/1 10:15)
*/ */
public static function deliveryHandle($data, $admin_id) public static function deliveryHandle($data, $admin_id)
{ {
@@ -733,8 +730,6 @@ class OrderLogic
} }
/** /**
* Notes: 确认收货 * Notes: 确认收货
* @param $order_id * @param $order_id
@@ -766,15 +761,14 @@ class OrderLogic
} }
/** /**
* Notes: 物流信息 * Notes: 物流信息
* @param $order_id * @param $order_id
* @author 段誉(2021/2/1 10:16)
* @return array|\PDOStatement|string|\think\Model|null * @return array|\PDOStatement|string|\think\Model|null
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
* @author 段誉(2021/2/1 10:16)
*/ */
public static function shippingInfo($order_id) public static function shippingInfo($order_id)
{ {
@@ -790,11 +784,11 @@ class OrderLogic
/** /**
* Notes: 物流轨迹 * Notes: 物流轨迹
* @param $order_id * @param $order_id
* @author 段誉(2021/2/1 10:16)
* @return array|bool * @return array|bool
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
* @author 段誉(2021/2/1 10:16)
*/ */
public static function getShipping($order_id) public static function getShipping($order_id)
{ {
@@ -868,7 +862,8 @@ class OrderLogic
* @param $id int 订单id * @param $id int 订单id
* @return string * @return string
*/ */
public static function orderPrint($id){ public static function orderPrint($id)
{
try { try {
//打印机配置 //打印机配置
@@ -901,7 +896,8 @@ class OrderLogic
} }
} }
public static function getPrintOrder($id){ public static function getPrintOrder($id)
{
$order = new Order(); $order = new Order();
$result = $order $result = $order
->with(['user', 'order_goods']) ->with(['user', 'order_goods'])
@@ -920,7 +916,8 @@ class OrderLogic
} }
//后台增加订单 //后台增加订单
public static function add($post){ public static function add($post)
{
$adder = UserLogic::adder($post['user_id']); //获取用户的地址 $adder = UserLogic::adder($post['user_id']); //获取用户的地址
$goods = Db::name('goods')->where('id', $post['goods_id'])->find(); //获取商品的ID $goods = Db::name('goods')->where('id', $post['goods_id'])->find(); //获取商品的ID
$user = Db::name('user')->where('mobile', $adder['telephone'])->find(); $user = Db::name('user')->where('mobile', $adder['telephone'])->find();
@@ -936,6 +933,13 @@ class OrderLogic
$post['gord_id'] = 0; $post['gord_id'] = 0;
} }
$post['order_sn'] = createSn('order', 'order_sn', '', 4); $post['order_sn'] = createSn('order', 'order_sn', '', 4);
if ($post['order_ysck'] == 1) {
$pay_status = 0;
$order_status = 0;
} else {
$pay_status = 1;
$order_status = 1;
}
$data = [ $data = [
'order_sn' => $post['order_sn'], 'order_sn' => $post['order_sn'],
'goods_id' => $post['goods_id'], 'goods_id' => $post['goods_id'],
@@ -949,10 +953,12 @@ class OrderLogic
'lat' => $adder['lat'], 'lat' => $adder['lat'],
'lng' => $adder['lng'], 'lng' => $adder['lng'],
'goods_price' => $post['total_amount'], 'goods_price' => $post['total_amount'],
'order_amount'=>$post['total_amount'], // 'order_amount'=>$post['total_amount'],
'order_amount' => $goods['max_price'],
'total_amount' => $post['total_amount'], 'total_amount' => $post['total_amount'],
'pay_zd' => $post['order_ysck'], 'pay_zd' => $post['order_ysck'],
'pay_status'=>1, 'pay_status' => $pay_status,
'order_status' => $order_status,
'code' => $goods['code'], 'code' => $goods['code'],
'number' => $goods['code'], 'number' => $goods['code'],
'channel_id' => $post['channel_id'], 'channel_id' => $post['channel_id'],
@@ -967,12 +973,14 @@ class OrderLogic
} }
//根据订单编号获取到订单信息 //根据订单编号获取到订单信息
public static function orderinfo($order_sn){ public static function orderinfo($order_sn)
{
return Db::name('order')->where('order_sn', $order_sn)->find(); return Db::name('order')->where('order_sn', $order_sn)->find();
} }
//根据订单ID获取到订单信息 //根据订单ID获取到订单信息
public static function orderinfoid($id){ public static function orderinfoid($id)
{
return Db::name('order')->where('id', $id)->find(); return Db::name('order')->where('id', $id)->find();
} }
@@ -1085,25 +1093,29 @@ class OrderLogic
} }
public static function edit($post){ public static function edit($post)
return Db::name('order')->where('id',$post['id'])->update(['consignee'=>$post['name'], {
if ($post['pay_status'] == 1) {
$pay = 0;
} else {
$pay = 1;
}
$res = Db::name('order')->where('id', $post['id'])->update(['consignee' => $post['name'],
'address' => $post['address'], 'address' => $post['address'],
'mobile' => $post['phone'], 'mobile' => $post['phone'],
'pay_status'=>$post['pay_status'], 'pay_status' => $pay,
'order_status' => $pay,
'province' => $post['first_category_id'], 'province' => $post['first_category_id'],
'city' => $post['second_category_id'], 'city' => $post['second_category_id'],
'district' => $post['third_category_id'], 'district' => $post['third_category_id'],
'lat' => $post['store_longitude'], 'lat' => $post['store_longitude'],
'lng' => $post['store_latitude'], 'lng' => $post['store_latitude'],
'gord_id' => $post['gord_id'], 'gord_id' => $post['gord_id'],
'pay_status'=>1,
'pay_zd' => $post['pay_status'], 'pay_zd' => $post['pay_status'],
'channel_id' => $post['brand_id'], 'channel_id' => $post['brand_id'],
'order_amount' => $post['total_amount']]); 'order_amount' => $post['total_amount']]);
return $res;
} }
/** /**
@@ -1129,7 +1141,8 @@ class OrderLogic
} }
} }
public static function channel_update($post){ public static function channel_update($post)
{
$order = Db::name('order')->where('id', $post['id'])->find(); $order = Db::name('order')->where('id', $post['id'])->find();
Db::name('order')->where('id', $post['id'])->update(['channel_id' => $post['channel_id']]); Db::name('order')->where('id', $post['id'])->update(['channel_id' => $post['channel_id']]);

View File

@@ -101,7 +101,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">订单类型:</label> <label class="layui-form-label">订单类型:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="radio" name="order_ysck" title="已收款" value=""0 lay-filter="link" > <input type="radio" name="order_ysck" title="已收款" value="0" lay-filter="link" >
<input type="radio" name="order_ysck" title="应收款" value="1" lay-filter="link" checked="turn"> <input type="radio" name="order_ysck" title="应收款" value="1" lay-filter="link" checked="turn">
</div> </div>
</div> </div>
@@ -186,9 +186,12 @@
var value = data.value; var value = data.value;
$('.link').hide(); $('.link').hide();
switch (value) { switch (value) {
case '1': case '0': // 已收款时显示选择付款
$('.page').show(); $('.page').show();
break; break;
case '1': // 应收款时隐藏
$('.page').hide();
break;
case '2': case '2':
$('.page').show(); $('.page').show();
$('.url-tips').show(); $('.url-tips').show();
@@ -196,7 +199,6 @@
case '3': case '3':
$('.url').show(); $('.url').show();
$('.url-tips').show(); $('.url-tips').show();
break; break;
} }

View File

@@ -385,12 +385,12 @@
{{# } }} {{# } }}
</p> </p>
{{# if(d.pay_status == 0){ }} {{# if(d.pay_status == 0 || d.pay_zd == 1){ }}
<p style="color:#fe0707">订单状态 <p style="color:#fe0707">订单状态
待支付 待支付
</p> </p>
{{# } }} {{# } }}
{{# if(d.pay_status == 1){ }} {{# if(d.pay_status == 1 && d.pay_zd == 0){ }}
<p style="color:#3A91FB">订单状态 <p style="color:#3A91FB">订单状态
已支付 已支付
</p> </p>
@@ -617,6 +617,7 @@
, {field: 'order_goods', title: '商品信息', align: 'center',templet:'#goods',width:320} , {field: 'order_goods', title: '商品信息', align: 'center',templet:'#goods',width:320}
, {field: 'total_amount', title: '支付信息', align: 'center',templet:'#amount',width:180} , {field: 'total_amount', title: '支付信息', align: 'center',templet:'#amount',width:180}
, {field: 'admin_id', title: '订单归属人', align: 'center',width:180} , {field: 'admin_id', title: '订单归属人', align: 'center',width:180}
, {field: 'order_remarks', title: '备注信息', align: 'center',width:130}
, {fixed: 'right', title: '操作', width: 160, align: 'center', toolbar: '#order-operation'} , {fixed: 'right', title: '操作', width: 160, align: 'center', toolbar: '#order-operation'}
]] ]]
, page: true , page: true

View File

@@ -17,20 +17,23 @@ class Calendar extends ApiBase
if (!preg_match('/^\d{4}-\d{2}$/', $month)) { if (!preg_match('/^\d{4}-\d{2}$/', $month)) {
return $this->_error("月份格式错误请使用格式2026-01"); return $this->_error("月份格式错误请使用格式2026-01");
} }
// 计算该月的开始和结束日期 // 计算该月的开始和结束日期
$startDate = $month . '-01'; $startDate = $month . '-01';
$endDate = date('Y-m-t', strtotime($startDate)); // 获取该月最后一天 $endDate = date('Y-m-t', strtotime($startDate)); // 获取该月最后一天
// 查询该月份的所有服务数据,关联商品表和员工表 $uid = $this->user_id;
// 查询该月份的所有服务数据,关联总订单表、商品表和员工表
$service = Db::name('order_exe') $service = Db::name('order_exe')
->alias('oe') ->alias('oe')
->join('order o', 'oe.order_sn = o.order_sn', 'INNER')
->join('goods g', 'oe.goods_id = g.id', 'LEFT') ->join('goods g', 'oe.goods_id = g.id', 'LEFT')
->join('staff s', 'oe.staff_id = s.id', 'LEFT') ->join('staff s', 'oe.staff_id = s.id', 'LEFT')
->where('o.user_id', $uid)
->where('oe.date', '>=', $startDate) ->where('oe.date', '>=', $startDate)
->where('oe.date', '<=', $endDate) ->where('oe.date', '<=', $endDate)
->where('oe.abnormal', 0) ->where('oe.abnormal', 0)
->field('oe.staff_status,oe.date,oe.addtime,oe.start_time,oe.timeout,oe.xq,oe.staff_id,s.name as staff_name,s.onwork,s.leave,g.name as goods_name') ->field('oe.staff_status,oe.date,oe.addtime,oe.start_time,oe.timeout,oe.xq,oe.staff_id,oe.order_sn,s.name as staff_name,s.onwork,s.leave,g.name as goods_name')
->order('oe.date asc, oe.addtime asc') ->order('oe.date asc, oe.addtime asc')
->select(); ->select();
@@ -38,9 +41,10 @@ class Calendar extends ApiBase
if ($service) { if ($service) {
foreach ($service as $v) { foreach ($service as $v) {
// 如果有绑定员工,但员工状态不符合要求,则跳过 // 如果有绑定员工,但员工状态不符合要求,则跳过
if (!empty($v['staff_id']) && ($v['onwork'] != 1 || $v['leave'] != 1)) { // 注释掉员工状态过滤,先看看是否能查询出来
continue; // if (!empty($v['staff_id']) && ($v['onwork'] != 1 || $v['leave'] != 1)) {
} // continue;
// }
// 处理服务时间 // 处理服务时间
$timeRange = ''; $timeRange = '';

View File

@@ -75,7 +75,9 @@ class Payment extends ApiBase
if ($order['pay_status'] == Pay::ISPAID || $order['order_amount'] == 0) { if ($order['pay_status'] == Pay::ISPAID || $order['order_amount'] == 0) {
$this->_success('支付成功', ['order_id' => $order['id']], 10001); $this->_success('支付成功', ['order_id' => $order['id']], 10001);
} }
if ($post['order_source'] == null){
$post['order_source'] = 1;
}
$result = PaymentLogic::pay($post['from'], $order, $post['order_source']); $result = PaymentLogic::pay($post['from'], $order, $post['order_source']);
if (false === $result) { if (false === $result) {
$this->_error(PaymentLogic::getError(), ['order_id' => $order['id']], PaymentLogic::getReturnCode()); $this->_error(PaymentLogic::getError(), ['order_id' => $order['id']], PaymentLogic::getReturnCode());
@@ -86,7 +88,6 @@ class Payment extends ApiBase
* 支付成功 * 支付成功
* 添加对应商品积分 * 添加对应商品积分
*/ */
$this->_success('', $result, PaymentLogic::getReturnCode()); $this->_success('', $result, PaymentLogic::getReturnCode());
} }

View File

@@ -75,11 +75,11 @@ class UserAddress extends ApiBase
$result = $this->validate($post, 'app\api\validate\UserAddress.add'); $result = $this->validate($post, 'app\api\validate\UserAddress.add');
if ($result === true) { if ($result === true) {
$user_id = $this->user_id; $user_id = $this->user_id;
$adder=Db::name('user_address')->whereLike('telephone',$post['telephone'])->find(); //判断电话号码存在 // $adder=Db::name('user_address')->whereLike('telephone',$post['telephone'])->find(); //判断电话号码存在
if($adder){ // if($adder){
$adderss=Db::name('user_address')->whereLike('telephone',$post['telephone'])->update(['user_id'=>$user_id]); // $adderss=Db::name('user_address')->whereLike('telephone',$post['telephone'])->update(['user_id'=>$user_id]);
$this->_success('添加成功', $adderss); // $this->_success('添加成功', $adderss);
} // }
$result = UserAddressLogic::addUserAddress($user_id, $post); $result = UserAddressLogic::addUserAddress($user_id, $post);
if ($result) { if ($result) {
$this->_success('添加成功', $result); $this->_success('添加成功', $result);

View File

@@ -32,11 +32,11 @@ class GoodsCategoryLogic{
* @author: 2021/3/6 18:49 * @author: 2021/3/6 18:49
*/ */
public static function categoryThirdTree($client,$type){ public static function categoryThirdTree($client,$type){
$cache_key = 'goods_category_'.$client.'_'.$type; // $cache_key = 'goods_category_'.$client.'_'.$type;
$cache = Cache::get($cache_key); // $cache = Cache::get($cache_key);
if ($cache) { // if ($cache) {
return $cache; // return $cache;
} // }
// 构建查询条件 // 构建查询条件
$where1 = ['is_show'=>1,'del'=>0,'level'=>1]; $where1 = ['is_show'=>1,'del'=>0,'level'=>1];
@@ -137,7 +137,7 @@ class GoodsCategoryLogic{
} }
} }
Cache::set($cache_key, array_values($lists)); // Cache::set($cache_key, array_values($lists));
return array_values($lists); return array_values($lists);
} }

View File

@@ -1069,6 +1069,7 @@ class OrderLogic extends LogicBase
case 'delivery': case 'delivery':
$where[] = ['pay_status', '=', 1]; $where[] = ['pay_status', '=', 1];
$where[] = ['order_status', '=', 1]; $where[] = ['order_status', '=', 1];
$where[] = ['refund_status', '=', 0];
break; break;
case 'finish': case 'finish':
$where[] = ['pay_status', '=', 1]; $where[] = ['pay_status', '=', 1];
@@ -1133,10 +1134,10 @@ class OrderLogic extends LogicBase
$list['goods_name']=$goods['name']; $list['goods_name']=$goods['name'];
$list['goods_price']=$goods['min_price']; $list['goods_price']=$goods['min_price'];
$number=Db::name('order_exe')->where('order_sn',$list['order_sn'])->where('staff_status',3)->count(); //查询订单服务次数 $number=Db::name('order_exe')->where('order_sn',$list['order_sn'])->where('staff_status',3)->count(); //查询订单服务次数
$list['ordercs']=$number; $list['ordercs'] = Db::name('order_exe')->where('order_sn',$list['order_sn'])->where('staff_status','<>',3)->count(); //已预约
$list['orderyjfw']= $list['number']-$number; $list['orderyjfw']= $list['number']-$number;
$list['orderdaifw'] = Db::name('order_exe')->where('order_sn',$list['order_sn'])->where('staff_status',0)->count(); //待服务数量 $list['orderdaifw'] = $list['number']-$number; //待预约数量
$list['orderfwzhon'] = Db::name('order_exe')->where('order_sn',$list['order_sn'])->where('staff_status',1)->count(); //服务中数量 $list['orderfwzhon'] = Db::name('order_exe')->where('order_sn',$list['order_sn'])->where('status',3)->count(); //暂停中数量
$list['orderyiwanchen'] = Db::name('order_exe')->where('order_sn',$list['order_sn'])->where('staff_status',3)->count(); //服务已完成 $list['orderyiwanchen'] = Db::name('order_exe')->where('order_sn',$list['order_sn'])->where('staff_status',3)->count(); //服务已完成
$list['showBubble']=false; $list['showBubble']=false;
$list['more']="更多"; $list['more']="更多";
@@ -1492,13 +1493,12 @@ class OrderLogic extends LogicBase
break; break;
} }
$count =$order->where('order_sn',$order_sn) $count =$order->where($where)->count();
->count();
$lists = $order->where('order_sn',$order_sn) $lists = $order->where('order_sn',$order_sn)
->where($where) ->where($where)
->page($page, $size) ->page($page, $size)
->order('autotime asc') ->orderRaw('CASE WHEN staff_status = 3 THEN 1 ELSE 0 END, autotime ASC')
->select(); ->select();
foreach ($lists as $list){ foreach ($lists as $list){
@@ -1518,8 +1518,6 @@ class OrderLogic extends LogicBase
} }
$list['autotime']=date("Y-m-d",$list['autotime']); $list['autotime']=date("Y-m-d",$list['autotime']);
} }
$data = [ $data = [
'list' => $lists, 'list' => $lists,

View File

@@ -136,7 +136,9 @@ class UserAddressLogic
'district_id' => $post['district_id'], 'district_id' => $post['district_id'],
'address' => $post['address'], 'address' => $post['address'],
'is_default' => $post['is_default'], 'is_default' => $post['is_default'],
'createtime' => time() 'createtime' => time(),
'lng' => $post['latitude'],
'lat' => $post['longitude']
]; ];
$result = Db::name('user_address')->insert($data); $result = Db::name('user_address')->insert($data);
Db::commit(); Db::commit();
@@ -175,7 +177,9 @@ class UserAddressLogic
'district_id' => $post['district_id'], 'district_id' => $post['district_id'],
'address' => $post['address'], 'address' => $post['address'],
'is_default' => $post['is_default'], 'is_default' => $post['is_default'],
'updatetime' => time() 'updatetime' => time(),
'lng' => $post['latitude'],
'lat' => $post['longitude']
]; ];
$result = Db::name('user_address') $result = Db::name('user_address')