bug修改
parent
36f40d27dc
commit
e5b9785c32
|
@ -439,6 +439,7 @@ class Coupon extends Base
|
|||
// 3. 写入商家扣费记录
|
||||
$deductionData = [
|
||||
"money" => $deductionMoney,
|
||||
"user_code" => $account->user_code,
|
||||
"business_code" => $business->code,
|
||||
"business_name" => $business->business_name,
|
||||
"balance" => $business->balance - $deductionMoney,
|
||||
|
|
|
@ -104,6 +104,13 @@ class Coupon extends Base
|
|||
} else {
|
||||
$item->state_text = '<span class="f_red">已过期</span>';
|
||||
}
|
||||
//渠道商名称
|
||||
if(isset($item->business) && $item->business && !empty($item->business->agency_code)){
|
||||
$item->agency_text = BusinessModel::where("code",$time->item->business->agency_code)->value("business_name",'');
|
||||
}else{
|
||||
$item->agency_text = '';
|
||||
}
|
||||
|
||||
});
|
||||
return $this->json(0, 'success', $list);
|
||||
}
|
||||
|
|
|
@ -23,4 +23,8 @@ class Deduction extends Base
|
|||
{
|
||||
return $this->hasOne(CouponBill::class,"id","bill_id");
|
||||
}
|
||||
public function account()
|
||||
{
|
||||
return $this->hasOne(Account::class,"user_code","user_code");
|
||||
}
|
||||
}
|
|
@ -114,7 +114,7 @@ class BusinessRepository extends Repository
|
|||
public function businessDeductionList($where, int $page = 1, int $limit = 0, array $order = ["create_time" => "desc", "id" => "desc"])
|
||||
{
|
||||
return Deduction::findList($where, [], $page, $limit, function ($q) {
|
||||
return $q->with(["couponMain","bill"]);
|
||||
return $q->with(["couponMain","bill","account"]);
|
||||
}, $order);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,10 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect',"laydate"]
|
|||
//index页面
|
||||
if ($('.location-index-page').length > 0) {
|
||||
miniTab.listen();
|
||||
|
||||
var exportDataTitle=
|
||||
["用户昵称","商家昵称","优惠券名称","持有比例(渠道商:平台:消费者)","金额","时间"]
|
||||
;
|
||||
var exportData =[];
|
||||
// 渲染表格
|
||||
let listUrl = $('#table-container').data('url');
|
||||
let insTb = table.render({
|
||||
|
@ -55,6 +58,19 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect',"laydate"]
|
|||
done: function (res, curr, count) {
|
||||
|
||||
Tools.setInsTb(insTb);
|
||||
var rdata=[];
|
||||
res.data.forEach(function (d,index) {
|
||||
rdata[index] = [
|
||||
d.nick_name ,
|
||||
d.business_name ,
|
||||
d.coupon_main_name ,
|
||||
("比例:"+d.commission_agency +":"+ d.commission_admin+ ":"+ d.commission_consumer +
|
||||
"金额:" + d.agency_money+":" + d.admin_money + ":" + d.consumer_money) ,
|
||||
d.money,
|
||||
d.create_time,
|
||||
]
|
||||
})
|
||||
exportData=rdata
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -81,7 +97,11 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect',"laydate"]
|
|||
,type: 'datetime'
|
||||
});
|
||||
|
||||
|
||||
$("#exports").on("click",function(){
|
||||
//console.log(exportData)
|
||||
table.exportFile(exportDataTitle,exportData, 'xls');
|
||||
return false;
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -39,6 +39,14 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function
|
|||
},
|
||||
page: true,
|
||||
cols: [[
|
||||
|
||||
{templet : function (d) {
|
||||
if(d.account!=undefined&& d.account){
|
||||
return d.account.nick_name;
|
||||
}
|
||||
return '';
|
||||
}, title: '消费者昵称'},
|
||||
{templet: '#row-cover', title: '消费者头像'},
|
||||
{field: 'business_name', title: '商家名称'},
|
||||
{field: 'create_time', title: '扣费时间'},
|
||||
{field: 'money', title: '扣费金额'},
|
||||
|
|
|
@ -17,7 +17,9 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect','laydate']
|
|||
let insTb = table.render({
|
||||
elem: '#table-container',
|
||||
toolbar: '#toolbar-tpl',
|
||||
defaultToolbar: [{ //自定义头部工具栏右侧图标。如无需自定义,去除该参数即可
|
||||
defaultToolbar: [
|
||||
|
||||
{ //自定义头部工具栏右侧图标。如无需自定义,去除该参数即可
|
||||
title: '搜索'
|
||||
, layEvent: 'search'
|
||||
, icon: 'layui-icon-search'
|
||||
|
@ -56,6 +58,7 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect','laydate']
|
|||
}
|
||||
return '';
|
||||
}, title: '商家简称'},
|
||||
{field: 'agency_text', title: '渠道商名称'},
|
||||
{field: 'money', title: '金额'},
|
||||
{field: 'deduction_money', title: '扣费'},
|
||||
{field: 'start_time', title: '开始时间'},
|
||||
|
|
|
@ -152,6 +152,7 @@
|
|||
<!-- toolbar -->
|
||||
<script type="text/html" id="toolbar-tpl">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-sm" data-table-refresh lay-event="refresh"><i class="fa fa-refresh"></i></a>
|
||||
<a class="layui-btn layui-btn-primary layui-btn-sm" id="exports">导出</a>
|
||||
</script>
|
||||
|
||||
|
||||
|
@ -159,7 +160,6 @@
|
|||
<script type="text/html" id="row-commission">
|
||||
比例: <span style="font-weight: bold">{{ d.commission_agency}} : {{ d.commission_admin}} : {{ d.commission_consumer}}</span> <br>
|
||||
金额: <span style="font-weight: bold">{{ d.agency_money}} : {{ d.admin_money}} : {{ d.consumer_money}}</span>
|
||||
|
||||
</script>
|
||||
|
||||
<script src="__MANAGER__/js/bill.js?v={:mt_rand()}"></script>
|
|
@ -64,9 +64,12 @@
|
|||
|
||||
<!-- 列 轮播图 -->
|
||||
<script type="text/html" id="row-cover">
|
||||
{{# if(d.account !=undefined&&d.account ){ }}
|
||||
<div class="layui-layer-photos">
|
||||
<img src="{{ d.image_url }}" layer-src="{{ (d.image_url) }}" alt="">
|
||||
<img src="{{ d.account.avatar_url }}" layer-src="{{ (d.account.avatar_url) }}" alt="">
|
||||
</div>
|
||||
{{# } }}
|
||||
|
||||
</script>
|
||||
|
||||
<!-- 列 轮播图 -->
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">商家名称</label>
|
||||
<label class="layui-form-label required">商家全称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="business_name" lay-verify="required" value="{$item.business_name??''}" placeholder="请输入商家名称" class="layui-input">
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue