You've already forked qlg.tsgz.moe
后台页面
This commit is contained in:
@ -1,16 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace wstmart\admin\model;
|
namespace wstmart\admin\model;
|
||||||
|
|
||||||
use think\Db;
|
use think\Db;
|
||||||
use think\Loader;
|
use think\Loader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
* 订单业务处理类
|
* 订单业务处理类
|
||||||
*/
|
*/
|
||||||
class Orders extends Base{
|
class Orders extends Base
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* 获取用户订单列表
|
* 获取用户订单列表
|
||||||
*/
|
*/
|
||||||
public function pageQuery($orderStatus = 10000,$isAppraise = -1){
|
public function pageQuery($orderStatus = 10000, $isAppraise = -1)
|
||||||
|
{
|
||||||
$where = ['o.dataFlag' => 1];
|
$where = ['o.dataFlag' => 1];
|
||||||
if ($orderStatus != 10000) {
|
if ($orderStatus != 10000) {
|
||||||
$where['orderStatus'] = $orderStatus;
|
$where['orderStatus'] = $orderStatus;
|
||||||
@ -71,8 +76,16 @@ class Orders extends Base{
|
|||||||
o.orderStatus,o.userName,o.payable,o.deliverType,o.goodsType,o.helpUserId,o.productNum,o.couponsNum,o.wangNum,o.moneyNum,o.productHandlingFee,o.productTaxFee,o.couponsHandlingFee,o.couponsTaxFee,payType,payFrom,o.orderStatus,orderSrc,o.createTime,o.orderCode,se.investmentStaff')
|
o.orderStatus,o.userName,o.payable,o.deliverType,o.goodsType,o.helpUserId,o.productNum,o.couponsNum,o.wangNum,o.moneyNum,o.productHandlingFee,o.productTaxFee,o.couponsHandlingFee,o.couponsTaxFee,payType,payFrom,o.orderStatus,orderSrc,o.createTime,o.orderCode,se.investmentStaff')
|
||||||
->order($order)
|
->order($order)
|
||||||
->paginate(input('limit/d'))->toArray();
|
->paginate(input('limit/d'))->toArray();
|
||||||
|
$m = Model('common/Table');
|
||||||
if (count($page['Rows']) > 0) {
|
if (count($page['Rows']) > 0) {
|
||||||
foreach ($page['Rows'] as $key => $v) {
|
foreach ($page['Rows'] as $key => $v) {
|
||||||
|
$m->setTable('order_goods');
|
||||||
|
$orderGoodsList = $m->getList(['orderId' => $v['orderId']], 'goodsPrice,goodsNum,freight,discountRate');
|
||||||
|
$discountMoney = 0;//优惠款
|
||||||
|
foreach ($orderGoodsList as &$val) {
|
||||||
|
$discountMoney += ($val['goodsPrice'] * $val['goodsNum'] + $val['freight']) * ($val['discountRate'] * 0.01);//优惠款
|
||||||
|
}
|
||||||
|
$page['Rows'][$key]['coupons'] = round($discountMoney,2);
|
||||||
$page['Rows'][$key]['loginName'] = "【" . $v['loginName'] . "】";
|
$page['Rows'][$key]['loginName'] = "【" . $v['loginName'] . "】";
|
||||||
$page['Rows'][$key]['userName'] = $v['userName'];
|
$page['Rows'][$key]['userName'] = $v['userName'];
|
||||||
$shopUserInfo = getUserInfo(['userId' => $v['shopUserId']], 'loginName');
|
$shopUserInfo = getUserInfo(['userId' => $v['shopUserId']], 'loginName');
|
||||||
@ -91,11 +104,13 @@ class Orders extends Base{
|
|||||||
}
|
}
|
||||||
return $page;
|
return $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取凭证
|
* 获取凭证
|
||||||
* @return [type] [description]
|
* @return [type] [description]
|
||||||
*/
|
*/
|
||||||
public function getCertificate(){
|
public function getCertificate()
|
||||||
|
{
|
||||||
$certificateStatus = (int)input('post.certificateStatus');
|
$certificateStatus = (int)input('post.certificateStatus');
|
||||||
$shopName = input('post.shopName');
|
$shopName = input('post.shopName');
|
||||||
$data = [];
|
$data = [];
|
||||||
@ -131,8 +146,10 @@ class Orders extends Base{
|
|||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
//凭证设置
|
//凭证设置
|
||||||
public function certificateSet(){
|
public function certificateSet()
|
||||||
|
{
|
||||||
$id = input('post.id');
|
$id = input('post.id');
|
||||||
$status = input('post.status') + 2;
|
$status = input('post.status') + 2;
|
||||||
$data['status'] = $status;
|
$data['status'] = $status;
|
||||||
@ -151,14 +168,17 @@ class Orders extends Base{
|
|||||||
return WSTReturn("操作成功", 1);
|
return WSTReturn("操作成功", 1);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
Db::rollback();errLog($e);
|
Db::rollback();
|
||||||
|
errLog($e);
|
||||||
}
|
}
|
||||||
return WSTReturn("操作失败");
|
return WSTReturn("操作失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户退款订单列表
|
* 获取用户退款订单列表
|
||||||
*/
|
*/
|
||||||
public function refundPageQuery(){
|
public function refundPageQuery()
|
||||||
|
{
|
||||||
$where = ['o.dataFlag' => 1];
|
$where = ['o.dataFlag' => 1];
|
||||||
$where['orderStatus'] = ['in', [-1, -4]];
|
$where['orderStatus'] = ['in', [-1, -4]];
|
||||||
$where['o.payType'] = 1;
|
$where['o.payType'] = 1;
|
||||||
@ -192,18 +212,22 @@ class Orders extends Base{
|
|||||||
}
|
}
|
||||||
return $page;
|
return $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取退款资料
|
* 获取退款资料
|
||||||
*/
|
*/
|
||||||
public function getInfoByRefund(){
|
public function getInfoByRefund()
|
||||||
|
{
|
||||||
return $this->where(['orderId' => (int)input('get.id'), 'isRefund' => 0, 'orderStatus' => ['in', [-1, -4]]])
|
return $this->where(['orderId' => (int)input('get.id'), 'isRefund' => 0, 'orderStatus' => ['in', [-1, -4]]])
|
||||||
->field('orderNo,orderId,goodsMoney,totalMoney,realTotalMoney,deliverMoney,payType,payFrom,tradeNo')
|
->field('orderNo,orderId,goodsMoney,totalMoney,realTotalMoney,deliverMoney,payType,payFrom,tradeNo')
|
||||||
->find();
|
->find();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退款
|
* 退款
|
||||||
*/
|
*/
|
||||||
public function orderRefund(){
|
public function orderRefund()
|
||||||
|
{
|
||||||
$id = (int)input('post.id');
|
$id = (int)input('post.id');
|
||||||
$content = input('post.content');
|
$content = input('post.content');
|
||||||
if ($id == 0) return WSTReturn("操作失败!");
|
if ($id == 0) return WSTReturn("操作失败!");
|
||||||
@ -243,7 +267,8 @@ class Orders extends Base{
|
|||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
Db::rollback();errLog($e);
|
Db::rollback();
|
||||||
|
errLog($e);
|
||||||
}
|
}
|
||||||
return WSTReturn("操作失败,请刷新后再重试");
|
return WSTReturn("操作失败,请刷新后再重试");
|
||||||
}
|
}
|
||||||
@ -252,7 +277,8 @@ class Orders extends Base{
|
|||||||
/**
|
/**
|
||||||
* 获取订单详情
|
* 获取订单详情
|
||||||
*/
|
*/
|
||||||
public function getByView($orderId){
|
public function getByView($orderId)
|
||||||
|
{
|
||||||
$orders = $this->alias('o')->join('__EXPRESS__ e', 'o.expressId=e.expressId', 'left')
|
$orders = $this->alias('o')->join('__EXPRESS__ e', 'o.expressId=e.expressId', 'left')
|
||||||
->join('__ORDER_REFUNDS__ orf ', 'o.orderId=orf.orderId', 'left')
|
->join('__ORDER_REFUNDS__ orf ', 'o.orderId=orf.orderId', 'left')
|
||||||
->join('__SHOPS__ s', 'o.shopId=s.shopId', 'left')
|
->join('__SHOPS__ s', 'o.shopId=s.shopId', 'left')
|
||||||
@ -276,7 +302,8 @@ class Orders extends Base{
|
|||||||
/**
|
/**
|
||||||
* 导出订单
|
* 导出订单
|
||||||
*/
|
*/
|
||||||
public function toExport(){
|
public function toExport()
|
||||||
|
{
|
||||||
$name = '订单表';
|
$name = '订单表';
|
||||||
$where = ['o.dataFlag' => 1];
|
$where = ['o.dataFlag' => 1];
|
||||||
$orderStatus = (int)input('orderStatus', 0);
|
$orderStatus = (int)input('orderStatus', 0);
|
||||||
|
@ -156,11 +156,9 @@ function initGrid(){
|
|||||||
h += item['orderNo'];
|
h += item['orderNo'];
|
||||||
return h;
|
return h;
|
||||||
}},
|
}},
|
||||||
|
{title:'交易额', name:'realTotalMoney', width: 30,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}},
|
||||||
{title:'购户', name:'loginName', width: 120,sortable:true},
|
{title:'购户', name:'loginName', width: 120,sortable:true},
|
||||||
{title:'收货人', name:'userName', width: 120,sortable:true},
|
{title:'收货人', name:'userName', width: 120,sortable:true},
|
||||||
{title:'商户', name:'shopLoginName', width: 120,sortable:true},
|
|
||||||
{title:'店铺', name:'shopName', width: 90,sortable:true},
|
|
||||||
{title:'交易额', name:'realTotalMoney', width: 30,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}},
|
|
||||||
{title:'购户付现', name:'moneyNum', width: 30,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}},
|
{title:'购户付现', name:'moneyNum', width: 30,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}},
|
||||||
{title:'旺旺券', name:'wangNum', width: 30,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}},
|
{title:'旺旺券', name:'wangNum', width: 30,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}},
|
||||||
{title:'产品券', name:'productNum', width: 30,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}},
|
{title:'产品券', name:'productNum', width: 30,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}},
|
||||||
@ -172,10 +170,12 @@ function initGrid(){
|
|||||||
{title:'优惠券', name:'couponsNum', width: 30,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}},
|
{title:'优惠券', name:'couponsNum', width: 30,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}},
|
||||||
{title:'优惠券税', name:'couponsTaxFee', width: 30,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}},
|
{title:'优惠券税', name:'couponsTaxFee', width: 30,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}},
|
||||||
{title:'优惠券手续费', name:'couponsHandlingFee', width: 30,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}},
|
{title:'优惠券手续费', name:'couponsHandlingFee', width: 30,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}},
|
||||||
|
|
||||||
// {title:'优惠券手续费+税', name:'couponsHandlingFee', width: 30,sortable:true, renderer:function(val,item,rowIndex){
|
// {title:'优惠券手续费+税', name:'couponsHandlingFee', width: 30,sortable:true, renderer:function(val,item,rowIndex){
|
||||||
// return item['couponsTaxFee']+val;;
|
// return item['couponsTaxFee']+val;;
|
||||||
// }},
|
// }},
|
||||||
|
{title:'商户', name:'shopLoginName', width: 120,sortable:true},
|
||||||
|
{title:'店铺', name:'shopName', width: 90,sortable:true},
|
||||||
|
{title:'优惠款', name:'coupons', width: 90,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}},
|
||||||
{title:'商户付现', name:'payable', width: 30,sortable:true, renderer:function(val,item,rowIndex){
|
{title:'商户付现', name:'payable', width: 30,sortable:true, renderer:function(val,item,rowIndex){
|
||||||
if(val<0){
|
if(val<0){
|
||||||
return Math.abs(val);
|
return Math.abs(val);
|
||||||
|
Reference in New Issue
Block a user