setter
parent
d0e32a7a64
commit
1751ec7592
|
@ -846,7 +846,7 @@ if (!function_exists('get_distance')) {
|
|||
}
|
||||
|
||||
/**
|
||||
* 格式化优惠券的使用周期
|
||||
* 格式化商圈码的使用周期
|
||||
* */
|
||||
if (!function_exists('encodeCouponCycle')) {
|
||||
function encodeCouponCycle(array $week)
|
||||
|
|
|
@ -345,7 +345,7 @@ class Business extends Base
|
|||
}
|
||||
|
||||
/**
|
||||
* 商家优惠券详情
|
||||
* 商家商圈码详情
|
||||
* */
|
||||
public function couponDetail()
|
||||
{
|
||||
|
@ -357,10 +357,10 @@ class Business extends Base
|
|||
$couponMainId = input("id/d");
|
||||
$couponMain = CouponMain::findOne(["id"=>$couponMainId]);
|
||||
if(empty($couponMain)){
|
||||
return $this->json(4001,"优惠券不存在");
|
||||
return $this->json(4001,"商圈码不存在");
|
||||
}
|
||||
if(!$business = BusinessRepository::getInstance()->findOneByWhere(["code"=>$couponMain["business_code"]])){
|
||||
return $this->json(4001,"优惠券商家信息不存在");
|
||||
return $this->json(4001,"商圈码商家信息不存在");
|
||||
}
|
||||
|
||||
$list = $business->toArray();
|
||||
|
@ -843,15 +843,16 @@ class Business extends Base
|
|||
if (!isset($account->business) || empty($account->business)) {
|
||||
return $this->json(4001, "商家信息无效");
|
||||
}
|
||||
$businessCode = $account->business->code;
|
||||
$w = 3000;//尺寸
|
||||
|
||||
$qrData = $this->request->domain() . "/business_code_to_coupon_list?business_code=" . $account->business->code;
|
||||
$w = 3000;//尺寸
|
||||
|
||||
$logoImg = app()->getRootPath().'public/static/images/icon-logo.jpg';
|
||||
|
||||
$result = Builder::create()
|
||||
->writer(new PngWriter())
|
||||
->writerOptions([])
|
||||
->data($businessCode)
|
||||
->data($qrData)
|
||||
->encoding(new Encoding('UTF-8'))
|
||||
->errorCorrectionLevel(new ErrorCorrectionLevelHigh())
|
||||
->size($w)
|
||||
|
@ -865,7 +866,7 @@ class Business extends Base
|
|||
header(
|
||||
"Content-type: image/jpg"
|
||||
);
|
||||
$path = "/storage/business/" . $businessCode . ".jpg";
|
||||
$path = "/storage/business/" . $account->business->code . ".jpg";
|
||||
$result->saveToFile( public_path() . $path);
|
||||
return $this->json(0,"success",["url"=>$this->request->domain().$path]);
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ class Consumer extends Base
|
|||
$item->distance_text = $distance . "m";
|
||||
}
|
||||
|
||||
//是否收藏了该优惠券的商家
|
||||
//是否收藏了该商圈码的商家
|
||||
$item->isFlow = in_array($item->business_code,$flowArray);
|
||||
|
||||
$item->couponId = $item->id;
|
||||
|
|
|
@ -69,7 +69,7 @@ class Coupon extends Base
|
|||
$whereMap[] = ['consumer_code', '=', $accountCode];
|
||||
switch ($type) {
|
||||
case 'all':
|
||||
// 全部持有优惠券
|
||||
// 全部持有商圈码
|
||||
$sortOrder = ['sort_weight' => 'desc', 'end_time' => 'asc'];
|
||||
break;
|
||||
case 'notUsed':
|
||||
|
@ -94,7 +94,7 @@ class Coupon extends Base
|
|||
}, $sortOrder);
|
||||
$time = time();
|
||||
$res['list'] ->each(function ($item) use($time){
|
||||
//重置优惠券名称
|
||||
//重置商圈码名称
|
||||
if(isset($item->couponMain) && $item->couponMain){
|
||||
$item->couponName = $item->couponMain->name;
|
||||
$item->image_url = $this->request->domain() . $item->couponMain->image_url;
|
||||
|
@ -186,7 +186,7 @@ class Coupon extends Base
|
|||
}, $sortOrder);
|
||||
|
||||
$res['list'] ->each(function ($item){
|
||||
//重置优惠券名称
|
||||
//重置商圈码名称
|
||||
if(isset($item->couponMain) && $item->couponMain){
|
||||
$item->couponName = $item->couponMain->name;
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ class Coupon extends Base
|
|||
}
|
||||
|
||||
/**
|
||||
* 领取优惠券
|
||||
* 领取商圈码
|
||||
* */
|
||||
public function receiveCoupon()
|
||||
{
|
||||
|
@ -226,7 +226,7 @@ class Coupon extends Base
|
|||
return $q->with("business")->lock(true);
|
||||
});
|
||||
if(!isset($couponMain->business)||empty($couponMain->business)){
|
||||
return $this->json(4001, "优惠券所属商家不存在");
|
||||
return $this->json(4001, "商圈码所属商家不存在");
|
||||
}
|
||||
|
||||
if($couponMain->business->enable != BusinessModel::COMMON_OFF){
|
||||
|
@ -234,7 +234,7 @@ class Coupon extends Base
|
|||
}
|
||||
|
||||
try {
|
||||
//检查优惠券状态
|
||||
//检查商圈码状态
|
||||
CouponRepository::getInstance()->checkCouponMainReceiveStatus($couponMain);
|
||||
}catch (RepositoryException $e){
|
||||
return $this->json(4001,$e->getMessage());
|
||||
|
@ -277,11 +277,11 @@ class Coupon extends Base
|
|||
Db::commit();
|
||||
return $this->json();
|
||||
}catch (RepositoryException $e){
|
||||
Log::error("优惠券领取失败RepositoryException:".$e->getMessage());
|
||||
Log::error("商圈码领取失败RepositoryException:".$e->getMessage());
|
||||
Db::rollback();
|
||||
return $this->json(5001,"领取失败");
|
||||
}catch (Exception $e){
|
||||
Log::error("优惠券领取失败:".$e->getMessage());
|
||||
Log::error("商圈码领取失败:".$e->getMessage());
|
||||
Db::rollback();
|
||||
return $this->json(5001,"领取失败");
|
||||
}
|
||||
|
@ -289,11 +289,10 @@ class Coupon extends Base
|
|||
}
|
||||
|
||||
/**
|
||||
* 核验优惠券 程序----核心操作----
|
||||
* 核验商圈码 程序----核心操作----
|
||||
* */
|
||||
public function verification()
|
||||
{
|
||||
|
||||
$accountId = $this->request->user['user_id'] ?? 0;
|
||||
$lat = input("lat/f",0);
|
||||
$lng = input("lng/f",0);
|
||||
|
@ -316,47 +315,47 @@ class Coupon extends Base
|
|||
});
|
||||
|
||||
if(empty($coupon)){
|
||||
return $this->json(4001, "优惠券不存在");
|
||||
return $this->json(4001, "商圈码不存在");
|
||||
}
|
||||
if($coupon->consumer_code != $account->user_code ){
|
||||
return $this->json(4001, "参数错误");
|
||||
}
|
||||
if($coupon->is_verificated != CouponModel::is_verificated_off){
|
||||
return $this->json(4001, "优惠券验证");
|
||||
return $this->json(4001, "商圈码验证");
|
||||
}
|
||||
if($coupon->status != CouponMain::status_on){
|
||||
return $this->json(4001, "优惠券已停用");
|
||||
return $this->json(4001, "商圈码已停用");
|
||||
}
|
||||
if($coupon->on_shelf != CouponMain::on_shelf_on){
|
||||
return $this->json(4001, "优惠券下架");
|
||||
return $this->json(4001, "商圈码下架");
|
||||
}
|
||||
|
||||
|
||||
if(!isset($coupon->couponMain) || empty($coupon->couponMain)){
|
||||
return $this->json(4001, "商家优惠券信息错误");
|
||||
return $this->json(4001, "商家商圈码信息错误");
|
||||
}
|
||||
if(strtotime($coupon->couponMain->end_time) < $time){
|
||||
return $this->json(4001, "优惠券已过期");
|
||||
}
|
||||
$usingRule = UsingRule::findOne(["coupon_id"=>$coupon->couponMain->id]);
|
||||
if(empty($usingRule)){
|
||||
return $this->json(4001, "商家优惠券使用规则信息错误");
|
||||
return $this->json(4001, "商圈码已过期");
|
||||
}
|
||||
//$usingRule = UsingRule::findOne(["coupon_id"=>$coupon->couponMain->id]);
|
||||
//if(empty($usingRule)){
|
||||
// return $this->json(4001, "商家商圈码使用规则信息错误");
|
||||
//}
|
||||
|
||||
//一天的开始时间
|
||||
if(strtotime(date("Y-m-d " . $usingRule->day_start_time)) > $time){
|
||||
return $this->json(4001, "请在当天{$usingRule->day_start_time}-{$usingRule->day_start_time}使用");
|
||||
}
|
||||
//if(strtotime(date("Y-m-d " . $usingRule->day_start_time)) > $time){
|
||||
// return $this->json(4001, "请在当天{$usingRule->day_start_time}-{$usingRule->day_start_time}使用");
|
||||
//}
|
||||
//一天的结束时间
|
||||
if(strtotime(date("Y-m-d ".$usingRule->day_end_time)) < $time){
|
||||
return $this->json(4001, "请在当天{$usingRule->day_start_time}-{$usingRule->day_start_time}使用");
|
||||
}
|
||||
//if(strtotime(date("Y-m-d ".$usingRule->day_end_time)) < $time){
|
||||
// return $this->json(4001, "请在当天{$usingRule->day_start_time}-{$usingRule->day_start_time}使用");
|
||||
//}
|
||||
|
||||
//使用周期 周一到周天
|
||||
$newW = date("w");
|
||||
if(!in_array($newW,$usingRule->cycle)){
|
||||
return $this->json(4001, "请在".encodeCouponCycle($usingRule->cycle)."使用");
|
||||
}
|
||||
//$newW = date("w");
|
||||
//if(!in_array($newW,$usingRule->cycle)){
|
||||
// return $this->json(4001, "请在".encodeCouponCycle($usingRule->cycle)."使用");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
@ -403,7 +402,7 @@ class Coupon extends Base
|
|||
//开始数据操作
|
||||
Db::startTrans();
|
||||
try {
|
||||
// 1. 修改优惠券状态
|
||||
// 1. 修改商圈码状态
|
||||
$coupon->save([
|
||||
"is_verificated" => CouponModel::is_verificated_on,
|
||||
"used_time" => date("Y-m-d H:i:s" ,$time),
|
||||
|
@ -431,7 +430,7 @@ class Coupon extends Base
|
|||
$agencyMoney = 0; //四舍五入 精确到分
|
||||
}
|
||||
|
||||
// 2. 写入优惠券流水
|
||||
// 2. 写入商圈码流水
|
||||
$couponBillData = [
|
||||
"coupon_main_id" => $coupon->couponMain->id,
|
||||
"coupon_id" => $coupon->id,
|
||||
|
@ -458,7 +457,7 @@ class Coupon extends Base
|
|||
"business_code" => $business->code,
|
||||
"business_name" => $business->business_name,
|
||||
"balance" => $business->balance - $deductionMoney,
|
||||
"reason" => sprintf("[%s]验证优惠券[%s]扣除[%s]",$account->nick_name, $coupon->couponMain->name,$deductionMoney),
|
||||
"reason" => sprintf("[%s]验证商圈码[%s]扣除[%s]",$account->nick_name, $coupon->couponMain->name,$deductionMoney),
|
||||
"coupon_main_id" => $coupon->couponMain->id,
|
||||
"coupon_id" => $coupon->id,
|
||||
"bill_id" => $couponBill->id,
|
||||
|
@ -485,7 +484,7 @@ class Coupon extends Base
|
|||
//企业付款成功
|
||||
if(isset($result["status"]) && $result["status"]=="SUCCESS"){
|
||||
Db::commit();
|
||||
return $this->json(0,"优惠券签到使用成功,您获得{$consumerMoney}元红包,已存入您的零钱");
|
||||
return $this->json(0,"商圈码签到使用成功,您获得{$consumerMoney}元红包,已存入您的零钱");
|
||||
}
|
||||
Log::info("查询企业付款失败:".json_encode($result,JSON_UNESCAPED_UNICODE));
|
||||
}else{
|
||||
|
@ -496,7 +495,7 @@ class Coupon extends Base
|
|||
'openid' => $account->open_id,
|
||||
'check_name' => 'NO_CHECK',// NO_CHECK:不校验真实姓名, FORCE_CHECK:强校验真实姓名
|
||||
'amount' => $amount, //单位为分,不小于100
|
||||
'desc' => '验证优惠券签到',
|
||||
'desc' => '验证商圈码签到',
|
||||
];
|
||||
//不发起支付
|
||||
//$result = $payment->transfer->toBalance($toBalanceData);
|
||||
|
@ -506,7 +505,7 @@ class Coupon extends Base
|
|||
//付款成功才提交!!!!!伪装成功
|
||||
if(true||isset($result['payment_no']) ){
|
||||
Db::commit();
|
||||
return $this->json(0,"优惠券签到使用成功,您获得{$consumerMoney}元红包,已存入您的零钱");
|
||||
return $this->json(0,"商圈码签到使用成功,您获得{$consumerMoney}元红包,已存入您的零钱");
|
||||
}
|
||||
//Log::info("企业发起付款失败:" . json_encode($result,JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
@ -530,7 +529,7 @@ class Coupon extends Base
|
|||
|
||||
}
|
||||
/**
|
||||
* 发布优惠券
|
||||
* 发布商圈码
|
||||
* */
|
||||
public function add()
|
||||
{
|
||||
|
@ -569,17 +568,17 @@ class Coupon extends Base
|
|||
if ($hasCouponMax > 0) {
|
||||
$hasCouponCount = CouponRepository::getInstance()->getBusinessOnShelfOnCount($account->business->code);
|
||||
if ($hasCouponCount > $hasCouponMax) {
|
||||
return $this->json(4001, "商家持有商家优惠券不能超过{$hasCouponMax}");
|
||||
return $this->json(4001, "商家持有商家商圈码不能超过{$hasCouponMax}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//验证通过 不管是商家还是工作人员 都可以发布优惠券
|
||||
//验证通过 不管是商家还是工作人员 都可以发布商圈码
|
||||
$couponMain = [
|
||||
"name" => $data['name'] ?? '',
|
||||
"business_code" => $account->business->code,
|
||||
"money" => $data['money'] ?? 0,
|
||||
//"money" => $data['money'] ?? 0,
|
||||
"type" => $data['type'] ?? 0,
|
||||
"count" => $data['count'] ?? 0,
|
||||
"type_name" => $data['type_name'] ?? '',
|
||||
|
@ -597,7 +596,7 @@ class Coupon extends Base
|
|||
"commission_consumer" => $distributionProportion['consumer'],
|
||||
];
|
||||
|
||||
$usingRule = input("using_rule/a");
|
||||
//$usingRule = input("using_rule/a");
|
||||
|
||||
$validate = new CouponRelease();
|
||||
|
||||
|
@ -607,14 +606,14 @@ class Coupon extends Base
|
|||
return $this->json(4001, $validate->getError());
|
||||
}
|
||||
|
||||
$usingRuleValidate = new CouponUsingRule();
|
||||
if (!$usingRuleValidate->check($usingRule)) {
|
||||
return $this->json(4001, $usingRuleValidate->getError());
|
||||
}
|
||||
//$usingRuleValidate = new CouponUsingRule();
|
||||
//if (!$usingRuleValidate->check($usingRule)) {
|
||||
// return $this->json(4001, $usingRuleValidate->getError());
|
||||
//}
|
||||
|
||||
//检查类型
|
||||
if(CouponTypeModel::checkType($couponMain['type']) !== true){
|
||||
return $this->json(4001, '优惠券类型不存在');
|
||||
return $this->json(4001, '商圈码类型不存在');
|
||||
}
|
||||
|
||||
|
||||
|
@ -630,7 +629,7 @@ class Coupon extends Base
|
|||
$couponMain['money'] = floor($couponMain['money'] * 100) / 100;
|
||||
$totalMoney = $couponMain['money'] * $couponMain['count'];
|
||||
|
||||
//未领取的优惠券
|
||||
//未领取的商圈码
|
||||
$NotClaimedMoney = CouponRepository::getInstance()->getBusinessNotClaimedCoupon($account->business["code"]);
|
||||
if($account->business["model"] == BusinessModel::model_ordinary) {
|
||||
if ($account->business["balance"] < ($totalMoney + $NotClaimedMoney)) {
|
||||
|
@ -640,7 +639,8 @@ class Coupon extends Base
|
|||
|
||||
Db::startTrans();
|
||||
try {
|
||||
CouponRepository::getInstance()->releaseCouponMain($couponMain, $totalMoney, $usingRule);
|
||||
//CouponRepository::getInstance()->releaseCouponMain($couponMain, $totalMoney, $usingRule);
|
||||
CouponRepository::getInstance()->releaseCouponMain($couponMain);
|
||||
Db::commit();
|
||||
return $this->json();
|
||||
} catch (RepositoryException $e) {
|
||||
|
@ -653,7 +653,7 @@ class Coupon extends Base
|
|||
}
|
||||
|
||||
/**
|
||||
* 修改优惠券
|
||||
* 修改商圈码
|
||||
* */
|
||||
public function edit()
|
||||
{
|
||||
|
@ -675,18 +675,16 @@ class Coupon extends Base
|
|||
return $this->json(4001, "商家信息错误");
|
||||
}
|
||||
|
||||
$couponMain = CouponMain::findById($couponMainId,[],function ($q){
|
||||
return $q->with(["usingRule"]);
|
||||
});
|
||||
$couponMain = CouponMain::findById($couponMainId,[]);
|
||||
if (empty($couponMain)) {
|
||||
return $this->json(4001, "优惠券不存在");
|
||||
}
|
||||
if (!isset($couponMain->usingRule)||empty($couponMain->usingRule)) {
|
||||
return $this->json(4001, "优惠券信息错误");
|
||||
return $this->json(4001, "商圈码不存在");
|
||||
}
|
||||
//if (!isset($couponMain->usingRule)||empty($couponMain->usingRule)) {
|
||||
// return $this->json(4001, "商圈码信息错误");
|
||||
//}
|
||||
$data = input();
|
||||
|
||||
//验证通过 不管是商家还是工作人员 都可以修改优惠券 只能修改指定字段
|
||||
//验证通过 不管是商家还是工作人员 都可以修改商圈码 只能修改指定字段
|
||||
$couponMainData = [
|
||||
"name" => $data['name'] ?? '',
|
||||
"type" => $data['type'] ?? 0,
|
||||
|
@ -699,28 +697,28 @@ class Coupon extends Base
|
|||
"white_list" => $data['white_list'] ?? '',
|
||||
];
|
||||
|
||||
$usingRule = input("using_rule/a");
|
||||
//$usingRule = input("using_rule/a");
|
||||
|
||||
$validate = new CouponRelease();
|
||||
if (!$validate->scene("api_edit")->check($couponMainData)) {
|
||||
return $this->json(4001, $validate->getError());
|
||||
}
|
||||
|
||||
$usingRuleValidate = new CouponUsingRule();
|
||||
if (!$usingRuleValidate->check($usingRule)) {
|
||||
return $this->json(4001, $usingRuleValidate->getError());
|
||||
}
|
||||
//$usingRuleValidate = new CouponUsingRule();
|
||||
//if (!$usingRuleValidate->check($usingRule)) {
|
||||
// return $this->json(4001, $usingRuleValidate->getError());
|
||||
//}
|
||||
|
||||
//检查类型
|
||||
if(CouponTypeModel::checkType($couponMainData['type']) !== true){
|
||||
return $this->json(4001, '优惠券类型不存在');
|
||||
return $this->json(4001, '商圈码类型不存在');
|
||||
}
|
||||
|
||||
//验证通过
|
||||
Db::startTrans();
|
||||
try {
|
||||
$couponMain->save($couponMainData);
|
||||
$couponMain->usingRule->save($usingRule);
|
||||
//$couponMain->usingRule->save($usingRule);
|
||||
CouponRepository::getInstance()->getModel()->where("coupon_id",$couponMain->id)->update(["end_time"=>$couponMainData["end_time"]." 00:00:00"]);
|
||||
Db::commit();
|
||||
return $this->json();
|
||||
|
@ -734,7 +732,7 @@ class Coupon extends Base
|
|||
}
|
||||
|
||||
/**
|
||||
* 商家管理优惠券
|
||||
* 商家管理商圈码
|
||||
* */
|
||||
public function getPageList()
|
||||
{
|
||||
|
@ -768,7 +766,7 @@ class Coupon extends Base
|
|||
$whereMap[] = ["name" ,"like", "%{$keyword}%" ];
|
||||
}
|
||||
$res = CouponRepository::getInstance(new CouponMain())->findList($whereMap, [], $page, $size,function ($q){
|
||||
return $q->with(["usingRule","couponType"]);
|
||||
return $q->with(["couponType"]);
|
||||
}, $sortOrder);
|
||||
$time = time();
|
||||
$res['list'] ->each(function ($item) use($time){
|
||||
|
@ -790,7 +788,7 @@ class Coupon extends Base
|
|||
}
|
||||
|
||||
/**
|
||||
* 优惠券的领取 使用记录列表
|
||||
* 商圈码的领取 使用记录列表
|
||||
* */
|
||||
public function getShopCouponList()
|
||||
{
|
||||
|
@ -815,10 +813,10 @@ class Coupon extends Base
|
|||
$couponMain = CouponMain::findById($couponMainId);
|
||||
|
||||
if(empty($couponMain)){
|
||||
return $this->json(4001, "优惠券不存在");
|
||||
return $this->json(4001, "商圈码不存在");
|
||||
}
|
||||
if($couponMain->business_code != $account->business->code){
|
||||
return $this->json(4001, "优惠券参数信息错误");
|
||||
return $this->json(4001, "商圈码参数信息错误");
|
||||
}
|
||||
|
||||
$page = $this->request->param('page/d', 1);
|
||||
|
@ -835,7 +833,7 @@ class Coupon extends Base
|
|||
}
|
||||
switch ($type) {
|
||||
case 'all':
|
||||
// 全部持有优惠券
|
||||
// 全部持有商圈码
|
||||
$sortOrder = [ 'end_time' => 'asc'];
|
||||
break;
|
||||
case 'notUsed':
|
||||
|
@ -874,25 +872,25 @@ class Coupon extends Base
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取优惠券详情
|
||||
* 获取商圈码详情
|
||||
* */
|
||||
public function getCouponMainInfo()
|
||||
{
|
||||
$couponMainId = input("couponMainId/d");
|
||||
$couponMain = CouponMain::findById($couponMainId,[],function ($q){
|
||||
return $q->with(["usingRule","business"=>function($q){
|
||||
return $q->with(["business"=>function($q){
|
||||
$q->field("code,business_subtitle");
|
||||
}]);
|
||||
});
|
||||
if(empty($couponMain)){
|
||||
return $this->json(4001,"优惠券不存在");
|
||||
return $this->json(4001,"商圈码不存在");
|
||||
}
|
||||
|
||||
return $this->json(0,"success",$couponMain->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 已使用优惠券 评分
|
||||
* 已使用商圈码 评分
|
||||
* */
|
||||
public function score()
|
||||
{
|
||||
|
|
|
@ -320,4 +320,8 @@ class User extends Base
|
|||
return $this->json(5001,"获取手机号失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 静默登录
|
||||
* */
|
||||
|
||||
}
|
|
@ -306,7 +306,7 @@ class Agency extends Base
|
|||
$list["list"]->each(function ($item) {
|
||||
//管理的商家数
|
||||
$item->business_count = BusinessRepository::getInstance()->agencyHasBusinessCount($item['business_code']);
|
||||
//管理的商家的优惠券数
|
||||
//管理的商家的商圈码数
|
||||
$item->coupon_count = BusinessRepository::getInstance()->agencyHasCouponCount($item['business_code']);
|
||||
});
|
||||
return $this->json(0, 'success', $list);
|
||||
|
|
|
@ -53,12 +53,12 @@ class Business extends Base
|
|||
}
|
||||
$list = $repo->businessList($whereMap, $page, $size, $orders);
|
||||
$list["list"]->each(function ($item) {
|
||||
//得到当前商家的所有优惠券
|
||||
//得到当前商家的所有商圈码
|
||||
$date = date("Y-m-d H:i:s");
|
||||
//优惠券总数
|
||||
//商圈码总数
|
||||
$item->coupon_total_count = CouponMain::where(["business_code" => $item->business_code])->sum("count");
|
||||
|
||||
//进行中优惠券总数
|
||||
//进行中商圈码总数
|
||||
$item->coupon_doing_count = CouponMain::where(["business_code" => $item->business_code])
|
||||
->whereTime("start_time", "<", $date)
|
||||
->whereTime("end_time", ">", $date)
|
||||
|
@ -66,16 +66,16 @@ class Business extends Base
|
|||
->where("on_shelf", CouponMain::on_shelf_on)
|
||||
->sum("count");
|
||||
|
||||
//进行中优惠券总数
|
||||
//进行中商圈码总数
|
||||
$item->coupon_receive_count = CouponMain::where(["business_code" => $item->business_code])->sum("received_count");
|
||||
|
||||
//过期未使用优惠券总数
|
||||
//过期未使用商圈码总数
|
||||
$item->coupon_be_overdue_count = Coupon::where(["business_code" => $item->business_code])
|
||||
->where("is_verificated", "=", Coupon::is_verificated_off)
|
||||
->whereTime("end_time", "<", $date)
|
||||
->count();
|
||||
|
||||
//已使用优惠券总数
|
||||
//已使用商圈码总数
|
||||
$item->coupon_used_count = Coupon::where(["business_code" => $item->business_code])
|
||||
->where("is_verificated", "=", Coupon::is_verificated_on)
|
||||
->count();
|
||||
|
@ -95,7 +95,7 @@ class Business extends Base
|
|||
|
||||
|
||||
/**
|
||||
* 商家优惠券列表
|
||||
* 商家商圈码列表
|
||||
*
|
||||
* @return Json|View
|
||||
* @throws Exception
|
||||
|
|
|
@ -41,11 +41,11 @@ class Consumer extends Base
|
|||
return $q->with("tag");
|
||||
}, $orders);
|
||||
$list["list"]->each(function ($item) {
|
||||
//优惠券领取总数
|
||||
//商圈码领取总数
|
||||
$item->coupon_total_count = Coupon::where(["consumer_code" => $item->user_code])->count("id");
|
||||
//优惠券使用总数
|
||||
//商圈码使用总数
|
||||
$item->coupon_used_count = Coupon::where(["consumer_code" => $item->user_code])->where("is_verificated", Coupon::is_verificated_on)->count("id");
|
||||
//优惠券未使用总数
|
||||
//商圈码未使用总数
|
||||
$item->coupon_not_use_count = Coupon::where(["consumer_code" => $item->user_code])->where("is_verificated", Coupon::is_verificated_off)->count("id");
|
||||
|
||||
//优惠红包总金额
|
||||
|
@ -72,7 +72,7 @@ class Consumer extends Base
|
|||
$consumer = Account::findOne(["id" => $id], [], function ($q) {
|
||||
return $q->with("tag");
|
||||
});
|
||||
//只查询优惠券持有
|
||||
//只查询商圈码持有
|
||||
if ($this->request->isPost()) {
|
||||
$repo = AccountRepository::getInstance();
|
||||
$page = $this->request->param('page/d', 1);
|
||||
|
@ -103,12 +103,12 @@ class Consumer extends Base
|
|||
//评论总数数
|
||||
$this->data["totalTheMonthComment"] = $rep->consumerTheMonthTotalComment($consumer["user_code"]);
|
||||
|
||||
//优惠券领取总数
|
||||
//商圈码领取总数
|
||||
$this->data["couponTotalCount"] = $rep->consumerTotalCoupon($consumer["user_code"]);
|
||||
|
||||
//优惠券使用总数
|
||||
//商圈码使用总数
|
||||
$this->data["couponUsedTotalCount"] = $rep->consumerUsedTotalCoupon($consumer["user_code"]);
|
||||
//优惠券未使用总数
|
||||
//商圈码未使用总数
|
||||
$this->data["couponNotUsedTotalCount"] = $rep->consumerNotUsedTotalCoupon($consumer["user_code"]);
|
||||
|
||||
$this->data["consumer"] = $consumer->toArray();
|
||||
|
|
|
@ -20,7 +20,7 @@ use think\response\View;
|
|||
use think\facade\Config as CConfig;
|
||||
|
||||
/**
|
||||
* 优惠券相关
|
||||
* 商圈码相关
|
||||
**/
|
||||
class Coupon extends Base
|
||||
{
|
||||
|
@ -102,7 +102,7 @@ class Coupon extends Base
|
|||
$coupon = $repo->findById($id);
|
||||
|
||||
if (empty($coupon)) {
|
||||
return $this->json(4001, "优惠券不存在");
|
||||
return $this->json(4001, "商圈码不存在");
|
||||
}
|
||||
|
||||
if (!in_array($on_shelf, [CouponMain::COMMON_OFF, CouponMain::COMMON_ON])) {
|
||||
|
@ -149,14 +149,14 @@ class Coupon extends Base
|
|||
->with('category');
|
||||
}, "couponType"])->where("id", $id)->find();
|
||||
if (empty($coupon)) {
|
||||
return $this->error("优惠券不存在");
|
||||
return $this->error("商圈码不存在");
|
||||
}
|
||||
$this->data["coupon"] = $coupon;
|
||||
return $this->view();
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布优惠券
|
||||
* 发布商圈码
|
||||
*
|
||||
* @return Json|View
|
||||
* @throws Exception
|
||||
|
@ -166,7 +166,7 @@ class Coupon extends Base
|
|||
{
|
||||
if ($this->request->isPost()) {
|
||||
$data = input("item/a", []);
|
||||
$usingRule = input("using_rule/a", []);
|
||||
//$usingRule = input("using_rule/a", []);
|
||||
|
||||
|
||||
$business = BusinessRepository::getInstance()->getBusinessAccount($data["business_code"], true);
|
||||
|
@ -183,10 +183,10 @@ class Coupon extends Base
|
|||
return $this->json(4001, $validate->getError());
|
||||
}
|
||||
|
||||
$usingRuleValidate = new CouponUsingRule();
|
||||
if (!$usingRuleValidate->check($usingRule)) {
|
||||
return $this->json(4001, $usingRuleValidate->getError());
|
||||
}
|
||||
//$usingRuleValidate = new CouponUsingRule();
|
||||
//if (!$usingRuleValidate->check($usingRule)) {
|
||||
// return $this->json(4001, $usingRuleValidate->getError());
|
||||
//}
|
||||
|
||||
//持有限量
|
||||
Config::load("extra/wechat","wechat");
|
||||
|
@ -194,15 +194,16 @@ class Coupon extends Base
|
|||
if ($hasCouponMax > 0) {
|
||||
$hasCouponCount = CouponRepository::getInstance()->getBusinessOnShelfOnCount($business->code);
|
||||
if ($hasCouponCount > $hasCouponMax) {
|
||||
return $this->json(4001, "商家持有商家优惠券不能超过{$hasCouponMax}");
|
||||
return $this->json(4001, "商家持有商家商圈码不能超过{$hasCouponMax}");
|
||||
}
|
||||
}
|
||||
|
||||
//检查类型
|
||||
if(CouponTypeModel::checkType($data['type']) !== true){
|
||||
return $this->json(4001, '优惠券类型不存在');
|
||||
return $this->json(4001, '商圈码类型不存在');
|
||||
}
|
||||
|
||||
$type = CouponRepository::getInstance()->getCouponTypeAll();
|
||||
$data['type_name'] = $type[$data['type']]['name'];
|
||||
|
||||
$data['business_type'] = $business['type'];
|
||||
$data['business_name'] = $business['business_name'];
|
||||
|
@ -227,7 +228,7 @@ class Coupon extends Base
|
|||
|
||||
$totalMoney = $data['money'] * $data['count'];
|
||||
|
||||
//未领取的优惠券
|
||||
//未领取的商圈码
|
||||
$NotClaimedMoney = CouponRepository::getInstance()->getBusinessNotClaimedCoupon($business["code"]);
|
||||
|
||||
if($business["model"] == BusinessModel::model_ordinary){
|
||||
|
@ -236,7 +237,7 @@ class Coupon extends Base
|
|||
}
|
||||
}
|
||||
|
||||
$data['type_name'] = $type[$data['type']]['name'];
|
||||
|
||||
$date = date("Y-m-d H:i:s");
|
||||
$data['create_time'] = $date;
|
||||
$data['update_time'] = $date;
|
||||
|
@ -244,7 +245,8 @@ class Coupon extends Base
|
|||
|
||||
Db::startTrans();
|
||||
try {
|
||||
CouponRepository::getInstance()->releaseCouponMain($data, $totalMoney, $usingRule);
|
||||
//CouponRepository::getInstance()->releaseCouponMain($data, $totalMoney, $usingRule);
|
||||
CouponRepository::getInstance()->releaseCouponMain($data);
|
||||
Db::commit();
|
||||
return $this->json();
|
||||
} catch (RepositoryException $e) {
|
||||
|
@ -273,24 +275,22 @@ class Coupon extends Base
|
|||
|
||||
public function edit()
|
||||
{
|
||||
$couponMain = CouponMain::findOne(["id" => input("id/d", 0)], [], function ($q) {
|
||||
return $q->with("usingRule");
|
||||
});
|
||||
$couponMain = CouponMain::findOne(["id" => input("id/d", 0)], []);
|
||||
if ($this->request->isPost()) {
|
||||
$data = input("item/a", []);
|
||||
$usingRule = input("using_rule/a", []);
|
||||
//$usingRule = input("using_rule/a", []);
|
||||
if (empty($couponMain)) {
|
||||
return $this->json(4001, "优惠券不存在");
|
||||
return $this->json(4001, "商圈码不存在");
|
||||
}
|
||||
$validate = new CouponRelease();
|
||||
if (!$validate->scene("edit")->check($data)) {
|
||||
return $this->json(4001, $validate->getError());
|
||||
}
|
||||
|
||||
$usingRuleValidate = new CouponUsingRule();
|
||||
if (!$usingRuleValidate->check($usingRule)) {
|
||||
return $this->json(4001, $usingRuleValidate->getError());
|
||||
}
|
||||
//$usingRuleValidate = new CouponUsingRule();
|
||||
//if (!$usingRuleValidate->check($usingRule)) {
|
||||
// return $this->json(4001, $usingRuleValidate->getError());
|
||||
//}
|
||||
|
||||
$business = BusinessRepository::getInstance()->getBusinessAccount($data["business_code"], true);
|
||||
if (empty($business)) {
|
||||
|
@ -299,7 +299,7 @@ class Coupon extends Base
|
|||
|
||||
//检查类型
|
||||
if(CouponTypeModel::checkType($data['type']) !== true){
|
||||
return $this->json(4001, '优惠券类型不存在');
|
||||
return $this->json(4001, '商圈码类型不存在');
|
||||
}
|
||||
|
||||
//更新经纬度
|
||||
|
@ -322,7 +322,7 @@ class Coupon extends Base
|
|||
Db::startTrans();
|
||||
try {
|
||||
$couponMain->save($data);
|
||||
$couponMain->usingRule->save($usingRule);
|
||||
//$couponMain->usingRule->save($usingRule);
|
||||
CouponRepository::getInstance()->getModel()->where("coupon_id",$couponMain->id)->update(["end_time"=>$data["end_time"]." 00:00:00"]);
|
||||
Db::commit();
|
||||
return $this->json();
|
||||
|
@ -336,8 +336,8 @@ class Coupon extends Base
|
|||
|
||||
}
|
||||
|
||||
if (empty($couponMain)||empty($couponMain['usingRule'])) {
|
||||
return $this->error("优惠券不存在或关联属性不存在");
|
||||
if (empty($couponMain)) {
|
||||
return $this->error("商圈码不存在");
|
||||
}
|
||||
$this->data['business'] = BusinessRepository::getInstance()->getBusinessAll();
|
||||
$this->data['type'] = CouponRepository::getInstance()->getCouponTypeAll();
|
||||
|
|
|
@ -17,7 +17,7 @@ use think\response\Json;
|
|||
use think\response\View;
|
||||
|
||||
/**
|
||||
* 优惠券类型
|
||||
* 商圈码类型
|
||||
*
|
||||
* Class CouponType
|
||||
* @package app\controller\manager
|
||||
|
@ -110,7 +110,7 @@ class CouponType extends Base
|
|||
|
||||
$couponMain = CouponMain::findOne([["type","in",$ids]]);
|
||||
if(!empty($couponMain)){
|
||||
return $this->json(4001,"该优惠券绑定了该类型,不能删除");
|
||||
return $this->json(4001,"该商圈码绑定了该类型,不能删除");
|
||||
}
|
||||
|
||||
CouponTypeModel::destroy($ids);
|
||||
|
|
|
@ -58,7 +58,7 @@ class Index extends Base
|
|||
{
|
||||
$res = [];
|
||||
$res['homeInfo'] = ['title' => '控制台', 'href' => "manager/index/dashboard"];
|
||||
$res['logoInfo'] = ['title' => '优惠券', 'href' => "", 'image' => '/static/manager/image/logo.png'];
|
||||
$res['logoInfo'] = ['title' => '商圈码', 'href' => "", 'image' => '/static/manager/image/logo.png'];
|
||||
|
||||
$menus = CmsRepository::getInstance()->getMenuList(Menu::TYPE_MENU, Menu::SHOW_YES)->toArray();
|
||||
$userId = $this->auth['user_id'] ?? 0;
|
||||
|
|
|
@ -95,7 +95,7 @@ class Statistical extends Base
|
|||
}
|
||||
|
||||
/**
|
||||
* 领取优惠券位置
|
||||
* 领取商圈码位置
|
||||
* */
|
||||
public function receive(){
|
||||
if($this->request->isPost()){
|
||||
|
|
|
@ -8,7 +8,7 @@ use think\db\exception\DbException;
|
|||
use think\db\exception\ModelNotFoundException;
|
||||
|
||||
/**
|
||||
* 优惠券
|
||||
* 商圈码
|
||||
* Class Coupon
|
||||
* @package app\model
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@ use think\db\exception\DbException;
|
|||
use think\db\exception\ModelNotFoundException;
|
||||
|
||||
/**
|
||||
* 优惠券验证记录 各个角色的提成
|
||||
* 商圈码验证记录 各个角色的提成
|
||||
* Class Coupon
|
||||
* @package app\model
|
||||
*/
|
||||
|
|
|
@ -9,7 +9,7 @@ use think\db\exception\ModelNotFoundException;
|
|||
use think\Model;
|
||||
|
||||
/**
|
||||
* 优惠券主表
|
||||
* 商圈码主表
|
||||
* Class CouponMain
|
||||
* @package app\model
|
||||
*/
|
||||
|
@ -28,10 +28,10 @@ class CouponMain extends Base
|
|||
{
|
||||
return $this->hasOne(CouponType::class, 'id',"type_id");
|
||||
}
|
||||
public function usingRule()
|
||||
{
|
||||
return $this->hasOne(UsingRule::class, 'coupon_id',"id");
|
||||
}
|
||||
//public function usingRule()
|
||||
//{
|
||||
// return $this->hasOne(UsingRule::class, 'coupon_id',"id");
|
||||
//}
|
||||
//创建完成之后
|
||||
public static function onAfterInsert( $obj)
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ use think\db\exception\DbException;
|
|||
use think\db\exception\ModelNotFoundException;
|
||||
|
||||
/**
|
||||
* 优惠券类型
|
||||
* 商圈码类型
|
||||
* Class CouponType
|
||||
* @package app\model
|
||||
*/
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace app\model;
|
||||
/**
|
||||
* 优惠券使用后商家打分
|
||||
* 商圈码使用后商家打分
|
||||
* Class Score
|
||||
* @package app\model
|
||||
*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace app\model;
|
||||
//优惠券使用规则
|
||||
//商圈码使用规则
|
||||
class UsingRule extends Base
|
||||
{
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ class BusinessRepository extends Repository
|
|||
}
|
||||
|
||||
/**
|
||||
* 优惠券列表
|
||||
* 商圈码列表
|
||||
*
|
||||
* @param string $businessCode 商家code
|
||||
* @param int $page 默认第一页 0不限制
|
||||
|
@ -217,7 +217,7 @@ class BusinessRepository extends Repository
|
|||
}
|
||||
|
||||
/**
|
||||
* 平台商下商家 所持有的优惠券数量
|
||||
* 平台商下商家 所持有的商圈码数量
|
||||
* @param $agencyCode
|
||||
* @return int
|
||||
*/
|
||||
|
|
|
@ -17,7 +17,7 @@ use think\Db;
|
|||
use think\Model;
|
||||
|
||||
/**
|
||||
* 优惠券 相关操作
|
||||
* 商圈码 相关操作
|
||||
*
|
||||
* Class CouponRepository
|
||||
* @package app\repository
|
||||
|
@ -28,7 +28,7 @@ class CouponRepository extends Repository
|
|||
use CouponMainTrait;
|
||||
use CouponBillTrait;
|
||||
/**
|
||||
* 优惠券持有信息列表
|
||||
* 商圈码持有信息列表
|
||||
*
|
||||
* @param $id
|
||||
* @param $keyword
|
||||
|
@ -69,18 +69,18 @@ class CouponRepository extends Repository
|
|||
}
|
||||
|
||||
/**
|
||||
* 发布优惠券 扣除商家余额
|
||||
* 发布商圈码 扣除商家余额
|
||||
* @param $data
|
||||
* @param $totalMoney
|
||||
* @param $usingRule 使用规则
|
||||
*/
|
||||
public function releaseCouponMain($data, $totalMoney,array $usingRule)
|
||||
public function releaseCouponMain($data)
|
||||
{
|
||||
//创建优惠券根表
|
||||
//创建商圈码根表
|
||||
$couponMain = CouponMain::create($data);
|
||||
//创建优惠券使用规则
|
||||
$usingRule["coupon_id"] = $couponMain->id;
|
||||
UsingRule::create($usingRule);
|
||||
//创建商圈码使用规则
|
||||
//$usingRule["coupon_id"] = $couponMain->id;
|
||||
//UsingRule::create($usingRule);
|
||||
//Business::where("code", $data["business_code"])->dec("balance", $totalMoney)->update();
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ class CouponRepository extends Repository
|
|||
}
|
||||
|
||||
/**
|
||||
* 写入一个领取优惠券
|
||||
* 写入一个领取商圈码
|
||||
* @param array $data
|
||||
* @return Coupon|Model
|
||||
*/
|
||||
|
|
|
@ -159,7 +159,7 @@ class DictionaryRepository extends Repository
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取一个优惠券的使用规则
|
||||
* 获取一个商圈码的使用规则
|
||||
* @param int $couponMainId
|
||||
* @return string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
|
@ -172,10 +172,10 @@ class DictionaryRepository extends Repository
|
|||
if(empty($usingRule)){
|
||||
return '';
|
||||
}
|
||||
return "<div class='disPaperList'><div class='circleOrange'>●</div>该优惠券可以在" . encodeCouponCycle($usingRule->cycle) . "进行使用</div>
|
||||
<div class='disPaperList'><div class='circleOrange'>●</div>该优惠券可以在每天的" . $usingRule->day_start_time ."到" .$usingRule->day_end_time ."进行使用</div>
|
||||
<div class='disPaperList'><div class='circleOrange'>●</div>该优惠券每天一共可以领取". $usingRule->day_total ."张</div>
|
||||
<div class='disPaperList'><div class='circleOrange'>●</div>该优惠券每天每人可以领取". $usingRule->person_day_total ."张</div>
|
||||
<div class='disPaperList'><div class='circleOrange'>●</div>该优惠券每人总共可以领取". $usingRule->person_total ."张</div>";
|
||||
return "<div class='disPaperList'><div class='circleOrange'>●</div>该商圈码可以在" . encodeCouponCycle($usingRule->cycle) . "进行使用</div>
|
||||
<div class='disPaperList'><div class='circleOrange'>●</div>该商圈码可以在每天的" . $usingRule->day_start_time ."到" .$usingRule->day_end_time ."进行使用</div>
|
||||
<div class='disPaperList'><div class='circleOrange'>●</div>该商圈码每天一共可以领取". $usingRule->day_total ."张</div>
|
||||
<div class='disPaperList'><div class='circleOrange'>●</div>该商圈码每天每人可以领取". $usingRule->person_day_total ."张</div>
|
||||
<div class='disPaperList'><div class='circleOrange'>●</div>该商圈码每人总共可以领取". $usingRule->person_total ."张</div>";
|
||||
}
|
||||
}
|
|
@ -9,13 +9,13 @@ use think\facade\Log;
|
|||
class Coupon
|
||||
{
|
||||
/**
|
||||
* 检查过期的优惠券修改状态
|
||||
* 检查过期的商圈码修改状态
|
||||
* */
|
||||
public function onCouponStatusCheck()
|
||||
{
|
||||
$count = CouponMain::whereTime("end_time", "<", date("Y-m-d"))->where(["status" => CouponMain::status_on])->count();
|
||||
if ($count) {
|
||||
Log::info("修改了优惠券状态" . $count);
|
||||
Log::info("修改了商圈码状态" . $count);
|
||||
CouponMain::whereTime("end_time", "<", date("Y-m-d"))->update(["status" => CouponMain::status_off]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,37 +13,37 @@ use think\facade\Db;
|
|||
trait CouponMainTrait
|
||||
{
|
||||
/**
|
||||
* 检查优惠券状态是否可以领取
|
||||
* 检查商圈码状态是否可以领取
|
||||
* @param CouponMain $couponMain
|
||||
* @return bool
|
||||
*/
|
||||
public function checkCouponMainReceiveStatus(CouponMain $couponMain){
|
||||
if (empty($couponMain)) {
|
||||
throw new RepositoryException("优惠券不存在");
|
||||
throw new RepositoryException("商圈码不存在");
|
||||
}
|
||||
if ($couponMain->status != CouponMain::status_on) {
|
||||
throw new RepositoryException("优惠券已停用");
|
||||
throw new RepositoryException("商圈码已停用");
|
||||
}
|
||||
if ($couponMain->on_shelf != CouponMain::on_shelf_on) {
|
||||
throw new RepositoryException("优惠券已下架");
|
||||
throw new RepositoryException("商圈码已下架");
|
||||
}
|
||||
$time = time();
|
||||
if (strtotime($couponMain->start_time) > $time) {
|
||||
throw new RepositoryException("优惠券还未到开始使用时间");
|
||||
throw new RepositoryException("商圈码还未到开始使用时间");
|
||||
}
|
||||
|
||||
if (strtotime($couponMain->end_time) < $time) {
|
||||
throw new RepositoryException("优惠券已结束使用");
|
||||
throw new RepositoryException("商圈码已结束使用");
|
||||
}
|
||||
|
||||
if ($couponMain->using_count <= 0) {
|
||||
throw new RepositoryException("优惠券已经被领完了");
|
||||
throw new RepositoryException("商圈码已经被领完了");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计这个优惠券已经使用了多少张了
|
||||
* 统计这个商圈码已经使用了多少张了
|
||||
* @param $couponMainId
|
||||
* @return int
|
||||
*/
|
||||
|
@ -55,7 +55,7 @@ trait CouponMainTrait
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取商户没有被领取的优惠券 需要扣除多少钱
|
||||
* 获取商户没有被领取的商圈码 需要扣除多少钱
|
||||
* */
|
||||
public function getBusinessNotClaimedCoupon($businessCode)
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ trait CouponMainTrait
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取 发布优惠券的统计
|
||||
* 获取 发布商圈码的统计
|
||||
* 每条数据都走一遍
|
||||
*
|
||||
* */
|
||||
|
@ -102,7 +102,7 @@ trait CouponMainTrait
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取 验证优惠券的统计
|
||||
* 获取 验证商圈码的统计
|
||||
* 每条数据都走一遍
|
||||
*
|
||||
* */
|
||||
|
@ -126,7 +126,7 @@ trait CouponMainTrait
|
|||
;
|
||||
}
|
||||
/**
|
||||
* 获取 验证优惠券的统计
|
||||
* 获取 验证商圈码的统计
|
||||
* 每条数据都走一遍
|
||||
*
|
||||
* */
|
||||
|
@ -150,7 +150,7 @@ trait CouponMainTrait
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取商家商家的优惠券
|
||||
* 获取商家商家的商圈码
|
||||
* */
|
||||
public function getBusinessOnShelfOnCount($businessCode)
|
||||
{
|
||||
|
@ -217,7 +217,7 @@ trait CouponMainTrait
|
|||
|
||||
|
||||
/**
|
||||
* 优惠券列表
|
||||
* 商圈码列表
|
||||
* @param $whereMap
|
||||
* @param $page
|
||||
* @param $size
|
||||
|
|
|
@ -12,7 +12,7 @@ use app\model\Coupon;
|
|||
|
||||
trait CouponTrait
|
||||
{
|
||||
/**消费者持有优惠券总数
|
||||
/**消费者持有商圈码总数
|
||||
* @param string $userCode
|
||||
*
|
||||
*
|
||||
|
@ -23,7 +23,7 @@ trait CouponTrait
|
|||
return Coupon::where("consumer_code", $userCode)->count("id");
|
||||
}
|
||||
|
||||
/**消费者已使用优惠券总数
|
||||
/**消费者已使用商圈码总数
|
||||
* @param string $userCode
|
||||
* @return int
|
||||
*/
|
||||
|
@ -33,7 +33,7 @@ trait CouponTrait
|
|||
}
|
||||
|
||||
/**
|
||||
* 消费者已使用优惠券总数
|
||||
* 消费者已使用商圈码总数
|
||||
* @param string $userCode
|
||||
* @return int
|
||||
*/
|
||||
|
@ -43,7 +43,7 @@ trait CouponTrait
|
|||
}
|
||||
|
||||
/**
|
||||
* 消费者已使用优惠券总数
|
||||
* 消费者已使用商圈码总数
|
||||
* @param string $userCode
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
|
@ -56,7 +56,7 @@ trait CouponTrait
|
|||
}
|
||||
|
||||
/**
|
||||
* 查看某个优惠券的是否可以领取 0 可以领取 1 已领取不能再领取
|
||||
* 查看某个商圈码的是否可以领取 0 可以领取 1 已领取不能再领取
|
||||
* @param $accountCode
|
||||
* @param CouponMain $couponMain
|
||||
* @return int
|
||||
|
@ -102,7 +102,7 @@ trait CouponTrait
|
|||
|
||||
|
||||
/**
|
||||
* 查看某个优惠券的是否可以领取 0 可以领取 1 已领取不能再领取
|
||||
* 查看某个商圈码的是否可以领取 0 可以领取 1 已领取不能再领取
|
||||
* @param Account $account
|
||||
* @param CouponMain $couponMain
|
||||
* @return void
|
||||
|
@ -117,36 +117,39 @@ trait CouponTrait
|
|||
$ReceiveCount = Coupon::where("coupon_id",$couponMain->id)
|
||||
->where("consumer_code",$account->user_code)->count();
|
||||
|
||||
if(!empty($ReceiveCount)){
|
||||
throw new RepositoryException("您已经领取过了");
|
||||
}
|
||||
|
||||
//确定使用规则
|
||||
$usingRule =UsingRule::where("coupon_id",$couponMain->id)->find();
|
||||
if(empty($usingRule)){
|
||||
throw new RepositoryException("使用规则错误,不能领取");
|
||||
}
|
||||
//$usingRule =UsingRule::where("coupon_id",$couponMain->id)->find();
|
||||
//if(empty($usingRule)){
|
||||
// throw new RepositoryException("使用规则错误,不能领取");
|
||||
//}
|
||||
|
||||
|
||||
//一天的总限量
|
||||
$dayTotalReceivesCount = Coupon::where("coupon_id",$couponMain->id)
|
||||
->whereTime("received_time","between",[date("Y-m-d 00:00:00"),date("Y-m-d 23:59:59")])
|
||||
->count();
|
||||
if($dayTotalReceivesCount >= $usingRule->day_total){
|
||||
throw new RepositoryException("单日领取总限量达到上限");
|
||||
}
|
||||
//$dayTotalReceivesCount = Coupon::where("coupon_id",$couponMain->id)
|
||||
// ->whereTime("received_time","between",[date("Y-m-d 00:00:00"),date("Y-m-d 23:59:59")])
|
||||
// ->count();
|
||||
//if($dayTotalReceivesCount >= $usingRule->day_total){
|
||||
// throw new RepositoryException("单日领取总限量达到上限");
|
||||
//}
|
||||
|
||||
|
||||
//单人日限量
|
||||
$todayReceivesCount = Coupon::where("coupon_id",$couponMain->id)
|
||||
->where("consumer_code",$account->user_code)
|
||||
->whereTime("received_time","between",[date("Y-m-d 00:00:00"),date("Y-m-d 23:59:59")])
|
||||
->count();
|
||||
if($todayReceivesCount >= $usingRule->person_day_total ){
|
||||
throw new RepositoryException("单人日限量达到上限");
|
||||
}
|
||||
//$todayReceivesCount = Coupon::where("coupon_id",$couponMain->id)
|
||||
// ->where("consumer_code",$account->user_code)
|
||||
// ->whereTime("received_time","between",[date("Y-m-d 00:00:00"),date("Y-m-d 23:59:59")])
|
||||
// ->count();
|
||||
//if($todayReceivesCount >= $usingRule->person_day_total ){
|
||||
// throw new RepositoryException("单人日限量达到上限");
|
||||
//}
|
||||
|
||||
//单人总限量
|
||||
if($ReceiveCount >= $usingRule->person_total ){
|
||||
throw new RepositoryException("单人总限量达到上限");
|
||||
}
|
||||
//if($ReceiveCount >= $usingRule->person_total ){
|
||||
// throw new RepositoryException("单人总限量达到上限");
|
||||
//}
|
||||
|
||||
//白名单
|
||||
if(!empty($couponMain->white_list)){
|
||||
|
@ -154,23 +157,23 @@ trait CouponTrait
|
|||
throw new RepositoryException("请先授权手机号和真实姓名");
|
||||
}
|
||||
if (false === strpos($couponMain->white_list, $account->mobile . "-" . $account->real_name)) {
|
||||
throw new RepositoryException("您没有在该优惠券白名单内");
|
||||
throw new RepositoryException("您没有在该商圈码白名单内");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return ;
|
||||
//领取不做限制 使用才做限制
|
||||
return;
|
||||
$time = time();
|
||||
|
||||
//$time = time();
|
||||
//一天的开始时间
|
||||
if(strtotime(date("Y-m-d " . $usingRule->day_start_time)) > $time){
|
||||
throw new RepositoryException("请在当天{$usingRule->day_start_time}-{$usingRule->day_start_time}领取");
|
||||
}
|
||||
//if(strtotime(date("Y-m-d " . $usingRule->day_start_time)) > $time){
|
||||
// throw new RepositoryException("请在当天{$usingRule->day_start_time}-{$usingRule->day_start_time}领取");
|
||||
//}
|
||||
//一天的结束时间
|
||||
if(strtotime(date("Y-m-d ".$usingRule->day_end_time)) < $time){
|
||||
throw new RepositoryException("请在当天{$usingRule->day_start_time}-{$usingRule->day_start_time}前领取");
|
||||
}
|
||||
//if(strtotime(date("Y-m-d ".$usingRule->day_end_time)) < $time){
|
||||
// throw new RepositoryException("请在当天{$usingRule->day_start_time}-{$usingRule->day_start_time}前领取");
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
|
@ -8,28 +8,31 @@ class BusinessValidate extends Validate
|
|||
{
|
||||
protected $rule = [
|
||||
'type' => 'require|gt:0',
|
||||
'business_name|商家名称' => 'require|chsAlphaNum|max:150',
|
||||
'business_subtitle|商家简称' => 'require|graph|max:150',
|
||||
'business_license|营业执照' => 'require|max:250',
|
||||
'contact_name|联系人' => 'require|max:20',
|
||||
'contact_phone|联系电话' => 'require|max:20',
|
||||
'business_name|商家名称' => 'require|chs|length:3,32',
|
||||
'business_subtitle|商家简称' => 'require|chs|length:3,32',
|
||||
'business_license|营业执照' => 'require|length:3,150',
|
||||
'contact_name|联系人' => 'require|length:1,32',
|
||||
'contact_phone|联系电话' => 'require|mobile',
|
||||
'lat' => 'require|between:-90,90',
|
||||
'lng' => 'require|between:-180,180',
|
||||
|
||||
'province|所属省份' => 'require',
|
||||
'city|所属城市' => 'require',
|
||||
'county|所属区县' => 'require',
|
||||
'business_address|商家地址' => 'require|max:250',
|
||||
'business_address|商家地址' => 'require|length:1,250',
|
||||
|
||||
'characteristic|商家特色' => 'max:250',
|
||||
'background|商家背景图' => 'require|max:250',
|
||||
'characteristic|商家特色' => 'length:0,250',
|
||||
'background|商家背景图' => 'require|length:0,250',
|
||||
'business_circle_id|所属商圈' => 'egt:0',
|
||||
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'type.require' => '请选择商家分类!',
|
||||
'type.gt' => '请选择商家分类!',
|
||||
'type.require' => '请选择商家分类!',
|
||||
'type.gt' => '请选择商家分类!',
|
||||
'business_name' => '商家名称只能是3-32个汉字',
|
||||
'business_subtitle' => '商家简称称只能是3-32个汉字',
|
||||
|
||||
|
||||
'lat.require' => '地址定位信息错误,请重新定位!',
|
||||
'lat.between' => '地址定位信息错误,请重新定位!',
|
||||
|
|
|
@ -12,11 +12,11 @@ class CouponRelease extends Validate
|
|||
//'lng|经度' => 'require',
|
||||
//'lat|纬度' => 'require',
|
||||
'count|总数' => 'require|number|>:0',
|
||||
'type|优惠券类型' => 'require',
|
||||
'type|商圈码类型' => 'require',
|
||||
'start_time|开始时间' => 'require|date',
|
||||
'end_time|结束时间' => 'require|date|checkEndTime',
|
||||
'name|优惠券名称' => 'require|chsAlphaNum|length:3,32',
|
||||
'money|金额' => 'require|>:0|<=:5000',
|
||||
//'money|金额' => 'require|>:0|<=:5000',
|
||||
'deduction_money|扣除金额' => 'require|>=:0.1|<=:5000',
|
||||
'image_url|预览图' => 'require',
|
||||
//'using_rule|使用规则' => '',
|
||||
|
|
|
@ -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 =[];
|
||||
// 渲染表格
|
||||
|
@ -50,7 +50,7 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect',"laydate"]
|
|||
{type: 'checkbox'},
|
||||
{field: "nick_name",title: '用户昵称'},
|
||||
{field: "business_name", title: '商家名称'},
|
||||
{field: "coupon_main_name", title: '优惠券名称'},
|
||||
{field: "coupon_main_name", title: '商圈码名称'},
|
||||
{templet:"#row-commission", title: '持有比例(渠道商:平台:消费者)'},
|
||||
{field: 'deduction_money', minWidth: 200, title: '扣除金额'},
|
||||
{field: 'create_time', minWidth: 200, title: '时间'},
|
||||
|
|
|
@ -44,10 +44,10 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function
|
|||
{templet: '#row-cover', title: '头像', style: 'height: 90px;'},
|
||||
{field:"account_nick_name", title: '昵称'},
|
||||
{field: "business_name" ,title: '商家名称'},
|
||||
{field: 'coupon_total_count', title: '优惠券总数量'},
|
||||
{field: 'coupon_doing_count', title: '进行中优惠券数量'},
|
||||
{field: 'coupon_receive_count', title: '已领取优惠券数量'},
|
||||
{field: 'coupon_be_overdue_count', title: '过期未使用优惠券数量'},
|
||||
{field: 'coupon_total_count', title: '商圈码总数量'},
|
||||
{field: 'coupon_doing_count', title: '进行中商圈码数量'},
|
||||
{field: 'coupon_receive_count', title: '已领取商圈码数量'},
|
||||
{field: 'coupon_be_overdue_count', title: '过期未使用商圈码数量'},
|
||||
{field: 'coupon_used_count', title: '已使用优惠数量'},
|
||||
{field: 'coupon_profit_count', title: '为平台提供的总收益'},
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function
|
|||
return d.couponMain.name;
|
||||
}
|
||||
return '';
|
||||
}, title: '优惠券名称'},
|
||||
}, title: '商圈码名称'},
|
||||
{field: 'balance' , title: '当前余额'},
|
||||
]],
|
||||
done: function () {
|
||||
|
|
|
@ -40,7 +40,7 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function
|
|||
{field: 'id', width: 80, title: 'ID'},
|
||||
{field: 'nickname', title: '昵称'},
|
||||
{field: 'business_count', title: '下属商家数'},
|
||||
{field: 'coupon_count', title: '下属优惠券数'},
|
||||
{field: 'coupon_count', title: '下属商圈码数'},
|
||||
{field: 'create_time', title: '注册时间'},
|
||||
{templet: '#row-status', title: '状态'},
|
||||
|
||||
|
|
|
@ -44,9 +44,9 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function
|
|||
{templet: '#row-cover', title: '头像', style: 'height: 90px;'},
|
||||
{field: 'nick_name', title: '昵称'},
|
||||
{templet: '#row-gender', title: '性别'},
|
||||
{field: 'coupon_total_count', title: '优惠券领取数'},
|
||||
{field: 'coupon_used_count', title: '优惠券使用数'},
|
||||
{field: 'coupon_not_use_count', title: '优惠券未使用数'},
|
||||
{field: 'coupon_total_count', title: '商圈码领取数'},
|
||||
{field: 'coupon_used_count', title: '商圈码使用数'},
|
||||
{field: 'coupon_not_use_count', title: '商圈码未使用数'},
|
||||
{field: 'consumer_coupon_bill_total', title: '红包总收入'},
|
||||
{field: 'login_time', title: '最近登录'},
|
||||
|
||||
|
|
|
@ -38,10 +38,10 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function
|
|||
// {type: 'checkbox'},
|
||||
{field: 'id' , width: 80, title: 'ID'},
|
||||
{field: 'name', title: '名称'},
|
||||
{field: 'type_name', title: '优惠券类型'},
|
||||
{field: 'type_name', title: '商圈码类型'},
|
||||
{templet: '#row-received_map', title: '领取位置'},
|
||||
{field: 'received_time', title: '领取时间'},
|
||||
// {field: 'money', title: '优惠券金额'},
|
||||
// {field: 'money', title: '商圈码金额'},
|
||||
{templet: function (d) {
|
||||
if(d.couponBill!=undefined&&d.couponBill){
|
||||
return d.couponBill.consumer_money;
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
use think\facade\Route;
|
||||
|
||||
//Route::rule('account/loginByCode', "\\app\\controller\\api\\user@login");//用户登录
|
||||
//Route::rule('consumer/home', "\\app\\controller\\api\\consumer@home");//首页列表(优惠券列表)
|
||||
//Route::rule('consumer/bannerList', "\\app\\controller\\api\\consumer@bannerList");//首页列表(优惠券列表)
|
||||
//Route::rule('consumer/home', "\\app\\controller\\api\\consumer@home");//首页列表(商圈码列表)
|
||||
//Route::rule('consumer/bannerList', "\\app\\controller\\api\\consumer@bannerList");//首页列表(商圈码列表)
|
||||
//Route::rule('dic/getDisList', "\\app\\controller\\api\\dictionary@getDisList");//距离选项列表
|
||||
//Route::rule('dic/getBusinessTypeListByPid', "\\app\\controller\\api\\dictionary@getBusinessTypeList");//首页获取商家类型
|
||||
//Route::rule('dic/getCouponTypeList', "\\app\\controller\\api\\dictionary@getCouponTypeList");//首页获取优惠券类型
|
||||
//Route::rule('dic/getCouponTypeList', "\\app\\controller\\api\\dictionary@getCouponTypeList");//首页获取商圈码类型
|
||||
//Route::rule('dic/getBusinessTypeList', "\\app\\controller\\api\\business@getBusinessTypeList");//首页获取商家类型
|
||||
//Route::rule('dic/getBusinessCircle', "\\app\\controller\\api\\business@getBusinessCircle");//首页获取商家商圈
|
||||
//Route::rule('consumer/flowBusiness', "\\app\\controller\\api\\consumer@flowBusiness");//首页获取商家商圈
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
<div class="layui-inline">
|
||||
<label class="layui-form-label">关键词</label>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="keyword" class="layui-input" placeholder="平台商|商家名称|优惠券名称">
|
||||
<input type="text" name="keyword" class="layui-input" placeholder="平台商|商家名称|商圈码名称">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
<div class="layui-inline">
|
||||
<label class="layui-form-label">关键词</label>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="keyword" class="layui-input" placeholder="商家名称,用户昵称,优惠券名称">
|
||||
<input type="text" name="keyword" class="layui-input" placeholder="商家名称,用户昵称,商圈码名称">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">关键词</label>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="keyword" class="layui-input" placeholder="优惠券名称">
|
||||
<input type="text" name="keyword" class="layui-input" placeholder="商圈码名称">
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
|
||||
<!-- 操作列 -->
|
||||
<script type="text/html" id="row-operate">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" data-href="/manager/business/business-coupon-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-coupon-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-deduction-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-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>
|
||||
|
|
|
@ -114,20 +114,20 @@
|
|||
<div class="layui-input-inline">
|
||||
<input class="layui-input" type="text" name="balance" value="{$item.balance ?? ''}"/>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">商家余额不足以支付相应数量优惠券时,进行充值提醒(<span style="color: red">最小 0 不可为负数</span>)</div>
|
||||
<div class="layui-form-mid layui-word-aux">商家余额不足以支付相应数量商圈码时,进行充值提醒(<span style="color: red">最小 0 不可为负数</span>)</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-item-lg">
|
||||
<label class="layui-form-label">优惠券持有限量</label>
|
||||
<label class="layui-form-label">商圈码持有限量</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" type="text" name="hasCouponMax" value="{$item.hasCouponMax ?? 0}"/>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">商家可以同时上架的优惠券数量(<span style="color: red">最小 0 不可为负数</span>)</div>
|
||||
<div class="layui-form-mid layui-word-aux">商家可以同时上架的商圈码数量(<span style="color: red">最小 0 不可为负数</span>)</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item layui-form-item-lg layui-hide">
|
||||
<label class="layui-form-label">商家发布优惠券</label>
|
||||
<label class="layui-form-label">商家发布商圈码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" {if isset($item.directory) && $item.directory == 1} checked="" {/if} lay-skin="switch" lay-filter="switchDirectory" lay-text="开启|关闭">
|
||||
<input type="hidden" id="directory" name="directory" value="{$item.directory ?? 0}">
|
||||
|
@ -165,7 +165,7 @@
|
|||
<div class="layui-form-mid layui-word-aux">单位:毫秒,设置签到时用户上传的时间戳只差不能大于多少毫秒(<span style="color: red">0表示不限 不可为负数 1000毫秒=1秒</span>)</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-item-lg">
|
||||
<label class="layui-form-label">优惠券最小佣金</label>
|
||||
<label class="layui-form-label">商圈码最小佣金</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" type="text" name="minCouponDeductionMoney" value="{$item.minCouponDeductionMoney ?? 0}"/>
|
||||
</div>
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
<div class="layui-col-md4">
|
||||
<div class="layui-panel" style="border-radius: 8px;">
|
||||
<div class="layui-row" style="padding: 5% 0;text-align: center">
|
||||
<h3><strong>优惠券领取总数</strong></h3>
|
||||
<h3><strong>商圈码领取总数</strong></h3>
|
||||
<span style="font-size: 36px">{$couponTotalCount ?? 0}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -69,7 +69,7 @@
|
|||
<div class="layui-col-md4">
|
||||
<div class="layui-panel" style="border-radius: 8px;">
|
||||
<div class="layui-row" style="padding: 5% 0;text-align: center">
|
||||
<h3><strong>优惠券使用总数</strong></h3>
|
||||
<h3><strong>商圈码使用总数</strong></h3>
|
||||
<span style="font-size: 36px">{$couponUsedTotalCount ?? 0}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -77,7 +77,7 @@
|
|||
<div class="layui-col-md4">
|
||||
<div class="layui-panel" style="border-radius: 8px;">
|
||||
<div class="layui-row" style="padding: 5% 0;text-align: center">
|
||||
<h3><strong>优惠券未使用总数</strong></h3>
|
||||
<h3><strong>商圈码未使用总数</strong></h3>
|
||||
<span style="font-size: 36px">{$couponNotUsedTotalCount ?? 0}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">优惠券类型</label>
|
||||
<label class="layui-form-label required">商圈码类型</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="item[type]" lay-search="">
|
||||
<option value=""></option>
|
||||
|
@ -52,12 +52,12 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">金额</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="item[money]" lay-verify="required|number" value="" lay-reqtext="必须>0,不能为空" placeholder="请输入" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-form-item">-->
|
||||
<!-- <label class="layui-form-label required">金额</label>-->
|
||||
<!-- <div class="layui-input-block">-->
|
||||
<!-- <input type="number" name="item[money]" lay-verify="required|number" value="" lay-reqtext="必须>0,不能为空" placeholder="请输入" class="layui-input">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">扣除金额</label>
|
||||
|
@ -94,57 +94,57 @@
|
|||
<legend><a >使用规则</a></legend>
|
||||
</fieldset>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">每日领取总数</label>
|
||||
<div class="layui-input-block">
|
||||
<input class="layui-input" type="number" name="using_rule[day_total]" lay-verify="required|number" value=""/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-form-item">-->
|
||||
<!-- <label class="layui-form-label">每日领取总数</label>-->
|
||||
<!-- <div class="layui-input-block">-->
|
||||
<!-- <input class="layui-input" type="number" name="using_rule[day_total]" lay-verify="required|number" value=""/>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">使用周期限制</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="using_rule[cycle][0]" value="1" title="周一" />
|
||||
<input type="checkbox" name="using_rule[cycle][1]" value="2" title="周二" />
|
||||
<input type="checkbox" name="using_rule[cycle][2]" value="3" title="周三" />
|
||||
<input type="checkbox" name="using_rule[cycle][3]" value="4" title="周四" />
|
||||
<input type="checkbox" name="using_rule[cycle][4]" value="5" title="周五" />
|
||||
<input type="checkbox" name="using_rule[cycle][5]" value="6" title="周六" />
|
||||
<input type="checkbox" name="using_rule[cycle][6]" value="0" title="周天" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-form-item">-->
|
||||
<!-- <label class="layui-form-label">使用周期限制</label>-->
|
||||
<!-- <div class="layui-input-block">-->
|
||||
<!-- <input type="checkbox" name="using_rule[cycle][0]" value="1" title="周一" />-->
|
||||
<!-- <input type="checkbox" name="using_rule[cycle][1]" value="2" title="周二" />-->
|
||||
<!-- <input type="checkbox" name="using_rule[cycle][2]" value="3" title="周三" />-->
|
||||
<!-- <input type="checkbox" name="using_rule[cycle][3]" value="4" title="周四" />-->
|
||||
<!-- <input type="checkbox" name="using_rule[cycle][4]" value="5" title="周五" />-->
|
||||
<!-- <input type="checkbox" name="using_rule[cycle][5]" value="6" title="周六" />-->
|
||||
<!-- <input type="checkbox" name="using_rule[cycle][6]" value="0" title="周天" />-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">每日时段限制</label>
|
||||
<!-- <div class="layui-form-item">-->
|
||||
<!-- <label class="layui-form-label">每日时段限制</label>-->
|
||||
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">开始时间</label>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="using_rule[day_start_time]" class="layui-input" value="00:00:00" id="using_rule_day_start_time" placeholder="HH:mm:ss">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">结束</label>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="using_rule[day_end_time]" class="layui-input" value="23:59:59" id="using_rule_day_end_time" placeholder="HH:mm:ss">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-inline">-->
|
||||
<!-- <label class="layui-form-label">开始时间</label>-->
|
||||
<!-- <div class="layui-inline">-->
|
||||
<!-- <input type="text" name="using_rule[day_start_time]" class="layui-input" value="00:00:00" id="using_rule_day_start_time" placeholder="HH:mm:ss">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="layui-inline">-->
|
||||
<!-- <label class="layui-form-label">结束</label>-->
|
||||
<!-- <div class="layui-inline">-->
|
||||
<!-- <input type="text" name="using_rule[day_end_time]" class="layui-input" value="23:59:59" id="using_rule_day_end_time" placeholder="HH:mm:ss">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">单人日限制</label>
|
||||
<div class="layui-input-block">
|
||||
<input class="layui-input" type="number" name="using_rule[person_day_total]" lay-verify="required|number" value=""/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-form-item">-->
|
||||
<!-- <label class="layui-form-label">单人日限制</label>-->
|
||||
<!-- <div class="layui-input-block">-->
|
||||
<!-- <input class="layui-input" type="number" name="using_rule[person_day_total]" lay-verify="required|number" value=""/>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">单人总限制</label>
|
||||
<div class="layui-input-block">
|
||||
<input class="layui-input" type="number" name="using_rule[person_total]" lay-verify="required|number" value=""/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-form-item">-->
|
||||
<!-- <label class="layui-form-label">单人总限制</label>-->
|
||||
<!-- <div class="layui-input-block">-->
|
||||
<!-- <input class="layui-input" type="number" name="using_rule[person_total]" lay-verify="required|number" value=""/>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">白名单</label>
|
||||
|
@ -154,16 +154,16 @@
|
|||
<div class="layui-form-mid layui-word-aux">填写后只有白名单能领取 一排填写一个 如:手机号-姓名</div>
|
||||
</div>
|
||||
|
||||
<fieldset class="layui-elem-field layui-field-title site-title layui-hide">
|
||||
<legend><a >处罚规则</a></legend>
|
||||
</fieldset>
|
||||
<!-- <fieldset class="layui-elem-field layui-field-title site-title layui-hide">-->
|
||||
<!-- <legend><a >处罚规则</a></legend>-->
|
||||
<!-- </fieldset>-->
|
||||
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">处罚规则</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="item[using_rule]" cols="30" rows="10"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-form-item layui-hide">-->
|
||||
<!-- <label class="layui-form-label">处罚规则</label>-->
|
||||
<!-- <div class="layui-input-block">-->
|
||||
<!-- <textarea name="item[using_rule]" cols="30" rows="10"></textarea>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">优惠券类型</label>
|
||||
<label class="layui-form-label required">商圈码类型</label>
|
||||
<div class="layui-input-block">
|
||||
<select disabled lay-search="">
|
||||
<option value=""></option>
|
||||
|
@ -52,12 +52,12 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">金额</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" lay-verify="required|number" disabled value="{$item['money']}" lay-reqtext="必须>0,不能为空" placeholder="请输入" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-form-item">-->
|
||||
<!-- <label class="layui-form-label required">金额</label>-->
|
||||
<!-- <div class="layui-input-block">-->
|
||||
<!-- <input type="number" lay-verify="required|number" disabled value="{$item['money']}" lay-reqtext="必须>0,不能为空" placeholder="请输入" class="layui-input">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">扣除金额</label>
|
||||
|
@ -95,57 +95,58 @@
|
|||
<legend><a >使用规则</a></legend>
|
||||
</fieldset>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">每日领取总数</label>
|
||||
<div class="layui-input-block">
|
||||
<input class="layui-input" type="number" name="using_rule[day_total]" value="{$item['usingRule']['day_total']}" lay-verify="required|number" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-form-item">-->
|
||||
<!-- <label class="layui-form-label">每日领取总数</label>-->
|
||||
<!-- <div class="layui-input-block">-->
|
||||
<!-- <input class="layui-input" type="number" name="using_rule[day_total]" value="{ $item['usingRule']['day_total']}" lay-verify="required|number" />-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">使用周期限制</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" {if in_array(1,$item['usingRule']['cycle']) } checked {/if} name="using_rule[cycle][0]" value="1" title="周一" />
|
||||
<input type="checkbox" {if in_array(2,$item['usingRule']['cycle']) } checked {/if} name="using_rule[cycle][1]" value="2" title="周二" />
|
||||
<input type="checkbox" {if in_array(3,$item['usingRule']['cycle']) } checked {/if} name="using_rule[cycle][2]" value="3" title="周三" />
|
||||
<input type="checkbox" {if in_array(4,$item['usingRule']['cycle']) } checked {/if} name="using_rule[cycle][3]" value="4" title="周四" />
|
||||
<input type="checkbox" {if in_array(5,$item['usingRule']['cycle']) } checked {/if} name="using_rule[cycle][4]" value="5" title="周五" />
|
||||
<input type="checkbox" {if in_array(6,$item['usingRule']['cycle']) } checked {/if} name="using_rule[cycle][5]" value="6" title="周六" />
|
||||
<input type="checkbox" {if in_array(0,$item['usingRule']['cycle']) } checked {/if} name="using_rule[cycle][6]" value="0" title="周天" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-form-item">-->
|
||||
<!-- <label class="layui-form-label">使用周期限制</label>-->
|
||||
<!-- <div class="layui-input-block">-->
|
||||
<!-- <input type="checkbox" { if in_array(1,$item['usingRule']['cycle']) } checked { /if} name="using_rule[cycle][0]" value="1" title="周一" />-->
|
||||
<!-- <input type="checkbox" { if in_array(2,$item['usingRule']['cycle']) } checked { /if} name="using_rule[cycle][1]" value="2" title="周二" />-->
|
||||
<!-- <input type="checkbox" { if in_array(3,$item['usingRule']['cycle']) } checked { /if} name="using_rule[cycle][2]" value="3" title="周三" />-->
|
||||
<!-- <input type="checkbox" { if in_array(4,$item['usingRule']['cycle']) } checked { /if} name="using_rule[cycle][3]" value="4" title="周四" />-->
|
||||
<!-- <input type="checkbox" { if in_array(5,$item['usingRule']['cycle']) } checked { /if} name="using_rule[cycle][4]" value="5" title="周五" />-->
|
||||
<!-- <input type="checkbox" { if in_array(6,$item['usingRule']['cycle']) } checked { /if} name="using_rule[cycle][5]" value="6" title="周六" />-->
|
||||
<!-- <input type="checkbox" { if in_array(0,$item['usingRule']['cycle']) } checked { /if} name="using_rule[cycle][6]" value="0" title="周天" />-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">每日时段限制</label>
|
||||
<!-- <div class="layui-form-item">-->
|
||||
<!-- <label class="layui-form-label">每日时段限制</label>-->
|
||||
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">开始时间</label>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="using_rule[day_start_time]" value="{$item['usingRule']['day_start_time']}" class="layui-input" id="using_rule_day_start_time" placeholder="HH:mm:ss">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">结束</label>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="using_rule[day_end_time]" value="{$item['usingRule']['day_end_time']}" class="layui-input" id="using_rule_day_end_time" placeholder="HH:mm:ss">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-inline">-->
|
||||
<!-- <label class="layui-form-label">开始时间</label>-->
|
||||
<!-- <div class="layui-inline">-->
|
||||
<!-- <input type="text" name="using_rule[day_start_time]" value="{ $item['usingRule']['day_start_time']}" class="layui-input" id="using_rule_day_start_time" placeholder="HH:mm:ss">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="layui-inline">-->
|
||||
<!-- <label class="layui-form-label">结束</label>-->
|
||||
<!-- <div class="layui-inline">-->
|
||||
<!-- <input type="text" name="using_rule[day_end_time]" value="{ $item['usingRule']['day_end_time']}" class="layui-input" id="using_rule_day_end_time" placeholder="HH:mm:ss">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">单人日限制</label>
|
||||
<div class="layui-input-block">
|
||||
<input class="layui-input" type="number" name="using_rule[person_day_total]" value="{$item['usingRule']['person_day_total']}" lay-verify="required|number" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-form-item">-->
|
||||
<!-- <label class="layui-form-label">单人日限制</label>-->
|
||||
<!-- <div class="layui-input-block">-->
|
||||
<!-- <input class="layui-input" type="number" name="using_rule[person_day_total]" value="{ $item['usingRule']['person_day_total']}" lay-verify="required|number" />-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<!-- <div class="layui-form-item">-->
|
||||
<!-- <label class="layui-form-label">单人总限制</label>-->
|
||||
<!-- <div class="layui-input-block">-->
|
||||
<!-- <input class="layui-input" type="number" name="using_rule[person_total]" value="{ $item['usingRule']['person_total']}" lay-verify="required|number"/>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">单人总限制</label>
|
||||
<div class="layui-input-block">
|
||||
<input class="layui-input" type="number" name="using_rule[person_total]" value="{$item['usingRule']['person_total']}" lay-verify="required|number"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">白名单</label>
|
||||
<div class="layui-input-inline " style="width: 450px">
|
||||
|
@ -155,17 +156,17 @@
|
|||
</div>
|
||||
|
||||
|
||||
<fieldset class="layui-elem-field layui-field-title site-title layui-hide">
|
||||
<legend><a >处罚规则</a></legend>
|
||||
</fieldset>
|
||||
<!-- <fieldset class="layui-elem-field layui-field-title site-title layui-hide">-->
|
||||
<!-- <legend><a >处罚规则</a></legend>-->
|
||||
<!-- </fieldset>-->
|
||||
|
||||
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">处罚规则</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="item[using_rule]" cols="30" rows="10">{$item['using_rule']}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-form-item layui-hide">-->
|
||||
<!-- <label class="layui-form-label">处罚规则</label>-->
|
||||
<!-- <div class="layui-input-block">-->
|
||||
<!-- <textarea name="item[using_rule]" cols="30" rows="10">{ $item['using_rule']}</textarea>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">状态</label>
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<div class="layui-inline">
|
||||
<label class="layui-form-label">关键词</label>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="keyword" class="layui-input" placeholder="优惠券名称">
|
||||
<input type="text" name="keyword" class="layui-input" placeholder="商圈码名称">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -98,7 +98,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" data-href="/manager/coupon/release" lay-event="release" date-title="发布优惠券">发布优惠券</a>
|
||||
<a class="layui-btn layui-btn-primary layui-btn-sm" data-href="/manager/coupon/release" lay-event="release" date-title="发布商圈码">发布商圈码</a>
|
||||
</script>
|
||||
<!-- 列 性别 -->
|
||||
<script type="text/html" id="row-on_shelf">
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
</div>
|
||||
|
||||
<div class="layui-inline layui-col-md6">
|
||||
<label class="layui-form-label">优惠券类型</label>
|
||||
<label class="layui-form-label">商圈码类型</label>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="keyword" disabled class="layui-input" value="{$coupon['couponType']['name']??$coupon['type_name']}">
|
||||
</div>
|
||||
|
@ -58,13 +58,13 @@
|
|||
|
||||
|
||||
<div class="layui-inline layui-col-md6">
|
||||
<label class="layui-form-label">优惠券金额</label>
|
||||
<label class="layui-form-label">商圈码金额</label>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="keyword" disabled class="layui-input" value="{$coupon['money']}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline layui-col-md6">
|
||||
<label class="layui-form-label">优惠券数量</label>
|
||||
<label class="layui-form-label">商圈码数量</label>
|
||||
<div class="layui-inline">
|
||||
<input type="text" name="keyword" disabled class="layui-input" value="{$coupon['count']}">
|
||||
</div>
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
<div class="main-body">
|
||||
<div class="login-main">
|
||||
<div class="login-top">
|
||||
<span>优惠券后台登录</span>
|
||||
<span>商圈码后台登录</span>
|
||||
<span class="bg1"></span>
|
||||
<span class="bg2"></span>
|
||||
</div>
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<label class="layui-form-label required">跳转类型</label>
|
||||
<div class="layui-input-block">
|
||||
|
||||
<input type="radio" {if $item['url_type'] == 1}checked="checked"{/if} name="item[url_type]" value="1" title="小程序(跳转链接需传入优惠券id)" />
|
||||
<input type="radio" {if $item['url_type'] == 1}checked="checked"{/if} name="item[url_type]" value="1" title="小程序(跳转链接需传入商圈码id)" />
|
||||
<input type="radio" {if $item['url_type'] == 0}checked="checked"{/if} name="item[url_type]" value="0" title="网页" />
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue