master
wangxinglong 2022-01-19 14:25:17 +08:00
parent 1751ec7592
commit 211774d08b
4 changed files with 59 additions and 6 deletions

View File

@ -14,6 +14,11 @@ use app\repository\AccountRepository;
use app\repository\BusinessRepository;
use app\repository\RechargeRepository;
use app\service\wx\WechatPay;
use Endroid\QrCode\Builder\Builder;
use Endroid\QrCode\Encoding\Encoding;
use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelHigh;
use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeMargin;
use Endroid\QrCode\Writer\PngWriter;
use Exception;
use think\exception\ValidateException;
@ -25,6 +30,8 @@ use think\response\View;
class Business extends Base
{
protected $noNeedLogin = ['downloadWriteOffCode'];
/**
* 商家列表列表
*
@ -432,5 +439,42 @@ class Business extends Base
return $this->view();
}
/**
* 下载商家核销二维码
* */
public function downloadWriteOffCode()
{
$businessCode = input("business_code/s");
if(empty($businessCode)){
return $this->error("商家信息错误");
}
$qrData = $this->request->domain() . "/business_code_to_coupon_list?business_code=" . $businessCode;
$w = 3000;//尺寸
$logoImg = app()->getRootPath().'public/static/images/icon-logo.jpg';
$result = Builder::create()
->writer(new PngWriter())
->writerOptions([])
->data($qrData)
->encoding(new Encoding('UTF-8'))
->errorCorrectionLevel(new ErrorCorrectionLevelHigh())
->size($w)
->margin(10)
->roundBlockSizeMode(new RoundBlockSizeModeMargin())
->logoPath($logoImg)
->logoResizeToHeight(ceil($w/6))
->logoResizeToWidth(ceil($w/6))
->logoPunchoutBackground(true)
->build();
header(
"Content-type: image/jpg"
);
$path = "/storage/business/" . $businessCode . ".jpg";
$result->saveToFile( public_path() . $path);
return download(public_path() . $path,$businessCode);
}
}

View File

@ -3,6 +3,7 @@
namespace app\controller\manager;
use app\model\Member;
use app\repository\AccountRepository;
use app\repository\CouponRepository;
@ -21,6 +22,7 @@ class Statistical extends Base
$agencyCode = input("agencyCode/s");
$this->data["startTime"] = $startTime;
$this->data["endTime"] = $endTime;
$this->data["agencyCode"] = $agencyCode;
$xDay = diffBetweenTwoDays($startTime, $endTime);
if ($xDay > 366) {
return $this->error("日期不要超过");
@ -69,8 +71,10 @@ class Statistical extends Base
$receiveDataArray[$item["received_time"]]++;
}
}
$receiveDataArray= array_values($receiveDataArray);
$this->data["receiveDataArray"]=json_encode($receiveDataArray);
$receiveDataArray = array_values($receiveDataArray);
$this->data["receiveDataArray"] = json_encode($receiveDataArray);
$this->data["agency"] = Member::getAgentAll();
return $this->view();
}

View File

@ -56,6 +56,7 @@
<a class="layui-btn layui-btn-primary layui-btn-xs" data-href="/manager/business/business-recharge-list.html?business_code={{d.business_code}}" data-title="【{{ d.business_name }}】充值记录" lay-event="">充值记录</a>
<a class="layui-btn layui-btn-primary layui-btn-xs" data-href="/manager/business/business-detail.html?business_code={{d.business_code}}" data-title="【{{ d.business_name }}】基本资料" lay-event="">基本资料</a>
<a class="layui-btn layui-btn-primary layui-btn-xs" data-href="/manager/business/assign.html?business_code={{d.business_code}}" data-title="给【{{ d.business_name }}】指派代理商" lay-event="">指派代理商</a>
<a class="layui-btn layui-btn-primary layui-btn-xs" target="_blank" href="/manager/business/downloadWriteOffCode?business_code={{d.business_code}}">下载核销二维码</a>
<a class="layui-btn layui-btn-xs" href="javascript:;" layuimini-content-href="/manager/business/recharge-behalf.html?business_code={{d.business_code}}" data-title="给【{{ d.business_name }}】充值" >代为充值</a>
</script>

View File

@ -7,7 +7,7 @@
<fieldset class="table-search-fieldset">
<legend>搜索信息</legend>
<div style="margin: 10px 10px 10px 10px">
<form class="layui-form layui-form-pane" action="">
<form class="layui-form layui-form-pane" method="post" action="#">
<div class="layui-form-item">
<div class="layui-inline">
时间段:
@ -23,9 +23,13 @@
<div class="layui-inline">
<label class="layui-form-label">平台商</label>
<div class="layui-input-block">
<select name="agency">
<select name="agencyCode">
<option value=""></option>
{foreach $agency as $avalue}
<option value="{$avalue['business_code']}"
{if $agencyCode == $avalue['business_code']}selected{/if}
>{$avalue['nickname']}</option>
{/foreach}
</select>
</div>
</div>
@ -42,7 +46,7 @@
<div class="layui-inline">
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
<button type="submit" class="layui-btn"><i class="layui-icon"></i> 搜 索</button>
</div>
</div>
</form>