Merge pull request 'dev' (#164) from dev into master

Reviewed-on: #164
This commit is contained in:
mkm 2024-03-04 10:49:25 +08:00
commit 72609d5c3f
42 changed files with 81 additions and 49 deletions

View File

@ -76,7 +76,7 @@ class StoreOrderDao extends BaseDao
});
if (isset($where['source']) && ($where['source'] == 103||$where['source'] == 105)) {
$wheres['activity_type'] = [0, 2, 98];
$wheres['source'] = [0,2,103,105];
$wheres['source'] = [0,2,103,105,999];
$query->where($wheres);
unset($where['source']);
} else {

View File

@ -82,6 +82,9 @@ class FinancialRecordDao extends BaseDao
->when(isset($where['date']) && $where['date'] !== '', function ($query) use ($where) {
getModelTime($query, $where['date'], 'create_time');
})
->when(isset($where['order_id']) && $where['order_id'] !== '', function ($query) use ($where) {
$query->where('order_id', $where['order_id']);
})
->when(isset($where['is_mer']) && $where['is_mer'] !== '', function ($query) use ($where) {
if($where['is_mer']){
$query->where('mer_id',$where['is_mer'])->where('type','in',[0,1, 2]);

View File

@ -228,19 +228,10 @@ class StoreOrderRepository extends BaseRepository
$svipDiscount = 0;
$financeDao = new FinancialDao();
foreach ($groupOrder->orderList as $_k => $order) {
$isPickupCard = $order->source == 999;
(new StoreActivityDao())->saveOrderProduct(2, $order);
$order->paid = 1;
$order->pay_time = $time;
if ($order->source == 999) {
$order->status = 3;
//订单确认收货,增加商户销售金额
Merchant::where('mer_id', $order->mer_id)->update(['sale_amount' => Db::raw('sale_amount+' . $order->pay_price)]);
//订单确认收货,增加商户采购金额
$merId = Merchant::where('uid', $order->uid)->value('mer_id');
if (!empty($merId)) {
Merchant::where('mer_id', $merId)->update(['purchase_amount' => Db::raw('purchase_amount+' . $order->pay_price)]);
}
}
$svipDiscount = bcadd($order->svip_discount, $svipDiscount, 2);
if (isset($subOrders[$order->order_sn])) {
$order->transaction_id = $subOrders[$order->order_sn]['transaction_id'];
@ -322,35 +313,39 @@ class StoreOrderRepository extends BaseRepository
}
$_payPrice = bcsub($order->pay_price, bcadd($order['extension_one'], $order['extension_two'], 3), 2);
$orderValidAmount = bcsub($order->total_price, bcadd($order['extension_one'], $order['extension_two'], 3), 2);
// 平台支出推广费
$promoter = $order->merchant->promoter();
if (!empty($promoter)) {
$promoterCommission = bcmul($_payPrice, 0.003, 2);
$promoterCommission = bcmul($orderValidAmount, 0.003, 2);
if (!empty($promoter) && $promoterCommission > 0) {
$financeDao->platformOut($promoterCommission, 'commission_to_promoter');
}
// 平台收入手续费
if ($order['commission_rate'] > 0) {
$commission_rate = bcdiv((string)$order['commission_rate'],'100',6);
$platformCommission = bcmul($_payPrice, (string)$commission_rate, 2);
$_payPrice = bcsub($_payPrice, $platformCommission, 2);
if (isset($promoterCommission) && $promoterCommission > 0) {
$commission_rate = bcdiv((string)$order['commission_rate'],'100',6);
$platformCommission = bcmul($orderValidAmount, (string)$commission_rate, 2);
if ($commission_rate > 0 && $platformCommission > 0) {
$orderValidAmount = bcsub($orderValidAmount, $platformCommission, 2);
if ($promoterCommission > 0) {
$platformCommission = bcsub($platformCommission, $promoterCommission, 2);
}
$financeDao->platformIn($platformCommission, 'commission_to_platform', $order['mer_id']);
}
if ($_payPrice > 0) {
if ($orderValidAmount > 0) {
/** @var MerchantRepository $merchantRepo */
$merchantRepo = app()->make(MerchantRepository::class);
$merchantRepo->merId = $order['mer_id'];
$merchantRepo->forceMargin = false;
[$_payPrice, $financeDao] = $merchantRepo->deductDeposit($_payPrice, $order, $financeDao);
[$orderValidAmount, $financeDao] = $merchantRepo->deductDeposit($orderValidAmount, $order, $financeDao);
}
// 商户收入金额
$financeDao->platformOut($_payPrice, 'merchant_order', $order['mer_id']);
$financeDao->platformOut($orderValidAmount, 'merchant_order', $order['mer_id']);
if (!$is_combine) {
app()->make(MerchantRepository::class)->addLockMoney($order->mer_id, 'order', $order->order_id, $orderValidAmount);
}
if ($is_combine) {
$profitsharing[] = [
@ -376,7 +371,7 @@ class StoreOrderRepository extends BaseRepository
$this->autoPrinter($order->order_id, $order->mer_id);
//判断是否是平台购物卡
if ($order->orderProduct[0]->product->isPlatformCard()) {
if ($order->orderProduct[0]->product->isPlatformCard() || $isPickupCard) {
//购物卡自动发货
$deliveryData = [
'delivery_type' => 3,
@ -769,8 +764,9 @@ class StoreOrderRepository extends BaseRepository
'mark' => $order->merchant['mer_name'] . '成功销售' . floatval($order['pay_price']) . '元,奖励推广佣金' . floatval($promoterCommission['number']),
'balance' => 0
]);
$userRepository = app()->make(UserRepository::class);
$userRepository->incBrokerage($promoterCommission['user_id'], $promoterCommission['number']);
$balance = bcadd($user->now_money, $promoterCommission['number'], 2);
$user->save(['now_money' => $balance]);
}
}
@ -798,7 +794,8 @@ class StoreOrderRepository extends BaseRepository
if ($order->uid != $order->merchant->uid) {
$refundPrice = StoreRefundOrder::where('order_id', $order['order_id'])->where('status', '<>', -1)->sum('refund_price');
$money = bcsub($order->pay_price, $refundPrice, 2);
$money = bcsub($order->total_price, bcadd($order['extension_one'], $order['extension_two'], 3), 2);
$money = bcsub($money, $refundPrice, 2);
//订单确认收货,增加商户销售金额
Merchant::where('mer_id', $order->mer_id)->update(['sale_amount' => Db::raw('sale_amount+' . $money)]);
//订单确认收货,增加商户采购金额

View File

@ -766,6 +766,7 @@ class FinancialRecordRepository extends BaseRepository
[$data['count'], $data['number']] = $this->dao->getDataByType($type, $where, $date, $financialType);
$data['number'] = bcsub($data['number'], 0, 2);
} else { //平台的
[$data['count_order'], $data['number_order']] = $this->dao->getDataByType($type, $where, $date, ['order']);
// 退款订单
[$data['count_refund'], $data['number_refund']] = $this->dao->getDataByType($type, $where, $date, ['order_refund']);
$total = $data['number_refund'];

View File

@ -13,6 +13,7 @@
namespace app\common\repositories\system\merchant;
use app\common\model\system\merchant\Merchant;
use app\common\model\system\merchant\MerchantCategory;
use app\common\model\system\merchant\MerchantIntention;
use app\common\repositories\BaseRepository;
use crmeb\jobs\SendSmsJob;
@ -117,6 +118,7 @@ class MerchantIntentionRepository extends BaseRepository
$config = systemConfig(['broadcast_room_type', 'broadcast_goods_type']);
$margin = app()->make(MerchantTypeRepository::class)->get($intention['mer_type_id']);
$commissionRate = MerchantCategory::where('merchant_category_id', $intention['merchant_category_id'])->value('commission_rate');
$data['is_margin'] = $margin['is_margin'] ?? -1;
$data['margin'] = $margin['margin'] ?? 0;
$merData = [];
@ -146,6 +148,9 @@ class MerchantIntentionRepository extends BaseRepository
'reg_admin_id' => 0,
'mer_intention_id' => $id,
'is_company'=>$intention['is_company'],
'business_status'=>2,
'mer_settlement_agree_status'=>1,
'commission_rate'=>$commissionRate,
];
if($margin['type_code']=='PersonalStore'){
$merData['mer_address']='集体地址';
@ -154,8 +159,6 @@ class MerchantIntentionRepository extends BaseRepository
$merData['mini_banner']='https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/oa_app/23565656.png';
$merData['create_time']=date('Y-m-d H:i:s');
$merData['update_time']=date('Y-m-d H:i:s',time()+1);
$merData['business_status']=2;
$merData['mer_settlement_agree_status']=1;
}
$data['fail_msg'] = '';
$smsData = [

View File

@ -13,6 +13,7 @@
namespace app\controller\admin\order;
use app\common\repositories\system\merchant\FinancialRecordRepository;
use crmeb\basic\BaseController;
use app\common\repositories\store\ExcelRepository;
use app\common\repositories\system\merchant\MerchantRepository;
@ -201,4 +202,18 @@ class Order extends BaseController
$data = $this->repository->childrenList($id, 0);
return app('json')->success($data);
}
/**
* 订单资金流水
* @param $id
* @return mixed
*/
public function financeRecord($id)
{
/** @var FinancialRecordRepository $repo */
$repo = app()->make(FinancialRecordRepository::class);
$data = $repo->getList(['order_id' => $id], 1, 9999);
return app('json')->success($data);
}
}

View File

@ -373,7 +373,7 @@ class Auth extends BaseController
if ($mer_arr && $mer_arr['mer_avatar'] != '' && $mer_arr['mer_banner'] != '' && $mer_arr['mer_info'] && $mer_arr['service_phone'] != '' && $mer_arr['mer_address'] != '') {
$data['is_wsxx'] = 1;
}
if(count($bank_info)>0 && count($mer_arr)>0){
if($bank_info && count($bank_info)>0 && count($mer_arr)>0){
$data['mer_info'] = array_merge($mer_arr,$bank_info);
}else{
$data['mer_info'] =$mer_arr;

View File

@ -111,12 +111,14 @@ class Store extends BaseController
foreach ($consumption['config'] as $k => $item) {
if (empty($userConsumption) && in_array($merchant['type_id'], $item['type_id'])) {
$saleTarget = $item['amount'];
$subsidyAmount = $saleTarget;
$purchaseTarget = bcmul($saleTarget, 0.5, 2);
break;
}
if (!empty($userConsumption) && in_array($merchant['type_id'], $item['type_id'])) {
$nextItem = $consumption['config'][$k + 1] ?? $item;
$saleTarget = $nextItem['amount'];
$subsidyAmount = $saleTarget;
$purchaseTarget = bcmul($saleTarget, 0.5, 2);
break;
}

View File

@ -336,7 +336,14 @@ class MerchantIntention extends BaseController
'street_id',
'village_id',
'is_nmsc',
'is_company'
'is_company',
'bank_username',
'bank_code',
'bank_opening',
'bank_front',
'bank_back',
'cardno_front',
'cardno_back',
]);
app()->make(MerchantIntentionValidate::class)->check($data);

View File

@ -112,7 +112,7 @@ class StoreSpu extends BaseController
if ($where['category_id'] != '') {
$where['mer_ids'] = Db::name('merchant')->where(['category_id' => $where['category_id'], 'status' => 1, 'is_del' => 0])->column('mer_id');
}
$data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo);
$data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo, true);
return app('json')->success($data);
}

View File

@ -17,7 +17,7 @@ return [
//默认上传模式
'default' => 'local',
//上传文件大小
'filesize' => 52428800,
'filesize' => 102400000,
//上传文件后缀类型
'fileExt' => ['jpg', 'jpeg', 'png', 'gif', 'pem', 'mp3', 'wma', 'wav', 'amr', 'mp4', 'key', 'xlsx', 'xls', 'ico', 'apk', 'ipa','wgt','zip','webp'],
//上传文件类型

View File

@ -327,6 +327,7 @@ class ExcelService
'order_platform_coupon', 'commission_to_cloud_warehouse', 'commission_to_entry_merchant', 'commission_to_town', 'commission_to_village', 'commission_to_service_team'];
$date_ = $where['date'];
unset($where['date']);
/** @var FinancialRecordRepository $make */
$make = app()->make(FinancialRecordRepository::class);
$query = $make->search($where)->with(['orderInfo', 'refundOrder', 'merchant.merchantCategory']);

View File

@ -2,4 +2,4 @@
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')
if(window.location.protocol == 'https:'){
document.write('<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">')
}</script><link rel=stylesheet href=/static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.c6349b23.js></script><script src=/static/js/index.deab0dc7.js></script></body></html>
}</script><link rel=stylesheet href=/static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.c6349b23.js></script><script src=/static/js/index.66771264.js></script></body></html>

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
.selWidth[data-v-73102b09]{width:300px}.el-dropdown-link[data-v-73102b09]{cursor:pointer;color:#409eff;font-size:12px}.el-icon-arrow-down[data-v-73102b09]{font-size:12px}.tabBox_tit[data-v-73102b09]{width:60%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}.mt20[data-v-73102b09]{margin-top:20px}.demo-image__preview[data-v-73102b09]{position:relative;padding-left:40px}.demo-image__preview .el-image[data-v-73102b09],.el-image__error[data-v-73102b09]{position:absolute;left:0}.maxw180[data-v-73102b09]{display:inline-block;max-width:180px}

View File

@ -0,0 +1 @@
.selWidth[data-v-ec206684]{width:300px}.el-dropdown-link[data-v-ec206684]{cursor:pointer;color:#409eff;font-size:12px}.el-icon-arrow-down[data-v-ec206684]{font-size:12px}.tabBox_tit[data-v-ec206684]{width:60%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}.mt20[data-v-ec206684]{margin-top:20px}.demo-image__preview[data-v-ec206684]{position:relative;padding-left:40px}.demo-image__preview .el-image[data-v-ec206684],.el-image__error[data-v-ec206684]{position:absolute;left:0}.maxw180[data-v-ec206684]{display:inline-block;max-width:180px}

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d209391"],{a7af:function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"divBox"},[a("el-card",{staticClass:"box-card"},[a("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[a("el-button",{attrs:{size:"small",type:"primary"},on:{click:t.onAdd}},[t._v("添加商品标签")])],1),t._v(" "),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.listLoading,expression:"listLoading"}],staticStyle:{width:"100%"},attrs:{data:t.tableData.data,size:"small"}},[a("el-table-column",{attrs:{prop:"label_name",label:"标签名称","min-width":"60"}}),t._v(" "),a("el-table-column",{attrs:{prop:"info",label:"标签说明","min-width":"150"}}),t._v(" "),a("el-table-column",{attrs:{prop:"sort",label:"排序","min-width":"50"}}),t._v(" "),a("el-table-column",{attrs:{prop:"status",label:"是否显示","min-width":"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-switch",{attrs:{"active-value":1,"inactive-value":0,"active-text":"显示","inactive-text":"隐藏"},on:{change:function(a){return t.onchangeIsShow(e.row)}},model:{value:e.row.status,callback:function(a){t.$set(e.row,"status",a)},expression:"scope.row.status"}})]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"create_time",label:"创建时间","min-width":"150"}}),t._v(" "),a("el-table-column",{attrs:{label:"操作","min-width":"100",fixed:"right"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.onEdit(e.row.product_label_id)}}},[t._v("编辑")]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.handleDelete(e.row.product_label_id,e.$index)}}},[t._v("删除")])]}}])})],1),t._v(" "),a("div",{staticClass:"block"},[a("el-pagination",{attrs:{"page-sizes":[20,40,60,80],"page-size":t.tableFrom.limit,"current-page":t.tableFrom.page,layout:"total, sizes, prev, pager, next, jumper",total:t.tableData.total},on:{"size-change":t.handleSizeChange,"current-change":t.pageChange}})],1)],1)],1)},i=[],s=a("c4c8"),l={name:"LabelList",data:function(){return{tableFrom:{page:1,limit:20},tableData:{data:[],total:0},listLoading:!0}},mounted:function(){this.getList("")},methods:{add:function(){},getList:function(t){var e=this;this.listLoading=!0,this.tableFrom.page=t||this.tableFrom.page,Object(s["N"])(this.tableFrom).then((function(t){e.tableData.data=t.data.list,e.tableData.total=t.data.count,e.listLoading=!1})).catch((function(t){e.listLoading=!1,e.$message.error(t.message)}))},pageChange:function(t){this.tableFrom.page=t,this.getList("")},handleSizeChange:function(t){this.tableFrom.limit=t,this.getList("")},onAdd:function(){var t=this;this.$modalForm(Object(s["L"])()).then((function(){return t.getList("")}))},onEdit:function(t){var e=this;this.$modalForm(Object(s["P"])(t)).then((function(){return e.getList("")}))},handleDelete:function(t,e){var a=this;this.$modalSure("删除该标签").then((function(){Object(s["M"])(t).then((function(t){var e=t.message;a.$message.success(e),a.getList("")})).catch((function(t){var e=t.message;a.$message.error(e)}))}))},onchangeIsShow:function(t){var e=this;Object(s["O"])(t.product_label_id,t.status).then((function(t){var a=t.message;e.$message.success(a),e.getList("")})).catch((function(t){var a=t.message;e.$message.error(a)}))}}},o=l,r=a("2877"),c=Object(r["a"])(o,n,i,!1,null,null,null);e["default"]=c.exports}}]);

View File

@ -0,0 +1 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d209391"],{a7af:function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"divBox"},[a("el-card",{staticClass:"box-card"},[a("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[a("el-button",{attrs:{size:"small",type:"primary"},on:{click:t.onAdd}},[t._v("添加商品标签")])],1),t._v(" "),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.listLoading,expression:"listLoading"}],staticStyle:{width:"100%"},attrs:{data:t.tableData.data,size:"small"}},[a("el-table-column",{attrs:{prop:"label_name",label:"标签名称","min-width":"60"}}),t._v(" "),a("el-table-column",{attrs:{prop:"info",label:"标签说明","min-width":"150"}}),t._v(" "),a("el-table-column",{attrs:{prop:"value",label:"value","min-width":"150"}}),t._v(" "),a("el-table-column",{attrs:{prop:"sort",label:"排序","min-width":"50"}}),t._v(" "),a("el-table-column",{attrs:{prop:"status",label:"是否显示","min-width":"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-switch",{attrs:{"active-value":1,"inactive-value":0,"active-text":"显示","inactive-text":"隐藏"},on:{change:function(a){return t.onchangeIsShow(e.row)}},model:{value:e.row.status,callback:function(a){t.$set(e.row,"status",a)},expression:"scope.row.status"}})]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"create_time",label:"创建时间","min-width":"150"}}),t._v(" "),a("el-table-column",{attrs:{label:"操作","min-width":"100",fixed:"right"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.onEdit(e.row.product_label_id)}}},[t._v("编辑")]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.handleDelete(e.row.product_label_id,e.$index)}}},[t._v("删除")])]}}])})],1),t._v(" "),a("div",{staticClass:"block"},[a("el-pagination",{attrs:{"page-sizes":[20,40,60,80],"page-size":t.tableFrom.limit,"current-page":t.tableFrom.page,layout:"total, sizes, prev, pager, next, jumper",total:t.tableData.total},on:{"size-change":t.handleSizeChange,"current-change":t.pageChange}})],1)],1)],1)},i=[],s=a("c4c8"),l={name:"LabelList",data:function(){return{tableFrom:{page:1,limit:20},tableData:{data:[],total:0},listLoading:!0}},mounted:function(){this.getList("")},methods:{add:function(){},getList:function(t){var e=this;this.listLoading=!0,this.tableFrom.page=t||this.tableFrom.page,Object(s["N"])(this.tableFrom).then((function(t){e.tableData.data=t.data.list,e.tableData.total=t.data.count,e.listLoading=!1})).catch((function(t){e.listLoading=!1,e.$message.error(t.message)}))},pageChange:function(t){this.tableFrom.page=t,this.getList("")},handleSizeChange:function(t){this.tableFrom.limit=t,this.getList("")},onAdd:function(){var t=this;this.$modalForm(Object(s["L"])()).then((function(){return t.getList("")}))},onEdit:function(t){var e=this;this.$modalForm(Object(s["P"])(t)).then((function(){return e.getList("")}))},handleDelete:function(t,e){var a=this;this.$modalSure("删除该标签").then((function(){Object(s["M"])(t).then((function(t){var e=t.message;a.$message.success(e),a.getList("")})).catch((function(t){var e=t.message;a.$message.error(e)}))}))},onchangeIsShow:function(t){var e=this;Object(s["O"])(t.product_label_id,t.status).then((function(t){var a=t.message;e.$message.success(a),e.getList("")})).catch((function(t){var a=t.message;e.$message.error(a)}))}}},o=l,r=a("2877"),c=Object(r["a"])(o,n,i,!1,null,null,null);e["default"]=c.exports}}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -33,6 +33,9 @@ Route::group(function () {
Route::get('detail/:id', 'Order/detail')->name('systemOrderDetail')->option([
'_alias' => '详情',
]);
Route::get('financeRecord/:id', 'Order/financeRecord')->name('systemOrderFinanceRecord')->option([
'_alias' => '资金流水',
]);
Route::get('excel', 'Order/Excel')->name('systemOrderExcel')->option([
'_alias' => '导出',
]);