From 049a98a0a9c7d76bf6639b89b6ae33df3842c0b1 Mon Sep 17 00:00:00 2001 From: wangxinglong <2371974647@qq.com> Date: Wed, 16 Feb 2022 17:53:58 +0800 Subject: [PATCH] setter --- app/controller/api/Coupon.php | 11 +++++------ app/controller/manager/Consumer.php | 4 +--- app/repository/BillRepository.php | 3 ++- app/repository/CouponRepository.php | 4 ++-- public/static/manager/js/bill.js | 4 +++- public/static/manager/js/bill_deduction.js | 4 +++- public/static/manager/js/consumer/index.js | 17 +++++++++-------- public/static/manager/js/coupon/info.js | 8 +++++++- view/manager/coupon/add.html | 4 ++-- view/manager/coupon/edit.html | 8 +++----- view/manager/coupon/info.html | 12 +++++++----- 11 files changed, 44 insertions(+), 35 deletions(-) diff --git a/app/controller/api/Coupon.php b/app/controller/api/Coupon.php index b2b12b1..13219c8 100644 --- a/app/controller/api/Coupon.php +++ b/app/controller/api/Coupon.php @@ -607,23 +607,22 @@ class Coupon extends Base //付款成功才提交!!!!!伪装成功 if( isset($result['payment_no']) ){ $redpackData['pay_time'] = date("Y-m-d H:i:s",$time); - + Redpack::create($redpackData); Db::commit(); return $this->json( 0, "优惠券签到使用成功,您获得{$consumerMoney}元红包,已存入您的零钱", [ - "redpack" =>$consumerMoney + "redpack" =>$consumerMoney, + "user_coupon_id" =>$couponId, ]); } + //否则失败 记录失败原因 Log::info("企业发起付款失败:" . json_encode($result,JSON_UNESCAPED_UNICODE)); - - //默认回滚 Db::rollback(); - + //失败也要写入红包记录 Redpack::create($redpackData); - return $this->json(5003, "验证失败,发放红包失败"); } Db::commit(); diff --git a/app/controller/manager/Consumer.php b/app/controller/manager/Consumer.php index bed8e79..6b06e71 100644 --- a/app/controller/manager/Consumer.php +++ b/app/controller/manager/Consumer.php @@ -37,9 +37,7 @@ class Consumer extends Base if (!empty($keyword)) { $whereMap[] = ['nick_name', 'like', "%$keyword%"]; } - $list = $repo->findList($whereMap, [], $page, $size, function ($q) { - return $q->with("tag"); - }, $orders); + $list = $repo->findList($whereMap, [], $page, $size, null, $orders); $list["list"]->each(function ($item) { //优惠券领取总数 $item->coupon_total_count = Coupon::where(["consumer_code" => $item->user_code])->count("id"); diff --git a/app/repository/BillRepository.php b/app/repository/BillRepository.php index 34a6cb3..3a0e0e2 100644 --- a/app/repository/BillRepository.php +++ b/app/repository/BillRepository.php @@ -58,7 +58,7 @@ class BillRepository extends Repository ->when(!empty($endTime), function ($q) use ($endTime) { $q->whereTime("a.create_time", "<=", $endTime); }) - ->field("a.*,b.business_name,c.nick_name,c.avatar_url,d.name as coupon_main_name,d.deduction_money"); + ->field("a.*,a.coupon_id as user_coupon_id,b.business_name,c.nick_name,c.avatar_url,d.name as coupon_main_name,d.deduction_money"); $failData ['total'] = $rep->count(); $failData ['list'] = $rep @@ -198,6 +198,7 @@ class BillRepository extends Repository "a.money", "a.balance", "a.create_time", + "a.coupon_id as user_coupon_id", "b.nick_name", "b.avatar_url", "e.name as coupon_main_name", diff --git a/app/repository/CouponRepository.php b/app/repository/CouponRepository.php index 1f41eb2..489f163 100644 --- a/app/repository/CouponRepository.php +++ b/app/repository/CouponRepository.php @@ -42,11 +42,11 @@ class CouponRepository extends Repository return Coupon::findList(["coupon_id" => $id], ["*"], $page, $size, function ($q) use ($keyword) { if (!empty($keyword)) { return $q::hasWhere('account', function ($q) use ($keyword) { - $q->where('nick_name', 'like', "%" . $keyword . "%")->field("nick_name,avatar_url,user_code"); + $q->where('nick_name', 'like', "%" . $keyword . "%")->field("nick_name,avatar_url,user_code,mobile"); }); } else { return $q->with(["account" => function ($query) { - $query->field("nick_name,avatar_url,user_code"); + $query->field("nick_name,avatar_url,user_code,mobile"); }]); } }, ["id" => "desc"]); diff --git a/public/static/manager/js/bill.js b/public/static/manager/js/bill.js index c13a534..977a62c 100644 --- a/public/static/manager/js/bill.js +++ b/public/static/manager/js/bill.js @@ -12,7 +12,7 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect',"laydate"] if ($('.location-index-page').length > 0) { miniTab.listen(); var exportDataTitle= - ["用户昵称","商家昵称","优惠券名称","持有比例(渠道商:平台:消费者)","金额","时间"] + ["用户昵称","核销编码","商家昵称","优惠券名称","持有比例(渠道商:平台:消费者)","金额","时间"] ; var exportData =[]; // 渲染表格 @@ -49,6 +49,7 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect',"laydate"] cols: [[ {type: 'checkbox'}, {field: "nick_name",title: '用户昵称'}, + {field: "user_coupon_id",title: '核销编码'}, {field: "business_name", title: '商家名称'}, {field: "coupon_main_name", title: '优惠券名称'}, {templet:"#row-commission", title: '持有比例(渠道商:平台:消费者)'}, @@ -62,6 +63,7 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect',"laydate"] res.data.forEach(function (d,index) { rdata[index] = [ d.nick_name , + d.user_coupon_id , d.business_name , d.coupon_main_name , ("比例:"+d.commission_agency +":"+ d.commission_admin+ ":"+ d.commission_consumer + diff --git a/public/static/manager/js/bill_deduction.js b/public/static/manager/js/bill_deduction.js index 2bca8b1..2684eab 100644 --- a/public/static/manager/js/bill_deduction.js +++ b/public/static/manager/js/bill_deduction.js @@ -13,7 +13,7 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect',"laydate"] miniTab.listen(); var exportDataTitle= [ - "消费者昵称","扣款优惠券名称", + "消费者昵称","核销编码","扣款优惠券名称", "所属商家名称","商家所属平台商", "扣款总额","当前余额", "消费者红包","平台商佣金", @@ -57,6 +57,7 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect',"laydate"] cols: [[ {type: 'checkbox'}, { field:"nick_name",title: '消费者昵称'}, + { field:"user_coupon_id",title: '核销编码'}, {templet: "#row-avatar_url",field:"avatar_url",title: '消费者头像'}, {field:"coupon_main_name",title: '扣款优惠券名称'}, @@ -79,6 +80,7 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect',"laydate"] res.data.forEach(function (d,index) { rdata[index] = [ d.nick_name , + d.user_coupon_id , d.coupon_main_name , d.business_name , d.agency_business_name , diff --git a/public/static/manager/js/consumer/index.js b/public/static/manager/js/consumer/index.js index 74dbf34..b182f61 100644 --- a/public/static/manager/js/consumer/index.js +++ b/public/static/manager/js/consumer/index.js @@ -43,7 +43,8 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function {field: 'id' , width: 80, title: 'ID'}, {templet: '#row-cover', title: '头像', style: 'height: 90px;'}, {field: 'nick_name', title: '昵称'}, - {templet: '#row-gender', title: '性别'}, + //{templet: '#row-gender', title: '性别'}, + {field: 'mobile', title: '授权手机号'}, {field: 'coupon_total_count', title: '优惠券领取数'}, {field: 'coupon_used_count', title: '优惠券使用数'}, {field: 'coupon_not_use_count', title: '优惠券未使用数'}, @@ -51,13 +52,13 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function {field: 'login_time', title: '最近登录'}, - {templet:function(d){ - if( d.tag != undefined && d.tag.name != null){ - return d.tag.name - } - return ''; - },title: '用户标签'}, - {templet: '#row-operate', minWidth: 350, field: 'right', align: 'center', title: '操作', } + // {templet:function(d){ + // if( d.tag != undefined && d.tag.name != null){ + // return d.tag.name + // } + // return ''; + // },title: '用户标签'}, + {templet: '#row-operate', align: 'center', title: '操作', } ]], done: function () { Tools.setInsTb(insTb); diff --git a/public/static/manager/js/coupon/info.js b/public/static/manager/js/coupon/info.js index 08599d1..6e4ca43 100644 --- a/public/static/manager/js/coupon/info.js +++ b/public/static/manager/js/coupon/info.js @@ -44,8 +44,14 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function } return d.consumer_name; }, title: '昵称'}, - + {templet:function(d){ + if(d.account!=undefined&&d.account){ + return d.account.mobile; + } + return ''; + }, title: '授权手机号'}, {field: 'received_time', title: '领取时间'}, + {templet: '#row-received_map', title: '领取位置'}, {templet: '#row-state', title: '状态'}, diff --git a/view/manager/coupon/add.html b/view/manager/coupon/add.html index 9f812d9..b59f91f 100644 --- a/view/manager/coupon/add.html +++ b/view/manager/coupon/add.html @@ -149,9 +149,9 @@