Compare commits

...

2 Commits

15 changed files with 554 additions and 35 deletions

View File

@ -826,7 +826,9 @@ if (!function_exists('getEarthSquareRangePoint')) {
}
}
/**
* 获取两个地点之鉴的距离
* */
if (!function_exists('get_distance')) {
function get_distance($lat1, $lng1, $lat2, $lng2)
{
@ -842,4 +844,32 @@ if (!function_exists('get_distance')) {
$calculatedDistance = $earthRadius * $stepTwo;
return round($calculatedDistance);
}
}
}
/**
* 格式化优惠券的使用周期
* */
if (!function_exists('encodeCouponCycle')) {
function encodeCouponCycle(array $week)
{
$font =[
"0"=>"星期天",
"1"=>"星期一",
"2"=>"星期二",
"3"=>"星期三",
"4"=>"星期四",
"5"=>"星期五",
"6"=>"星期六",
];
$str = [];
foreach ($week as $value){
if (isset($font[$value])) {
$str[] = $font[$value];
}
}
return implode(",",$str);
}
}

View File

@ -6,13 +6,12 @@ use app\model\BusinessCircle;
use app\model\Category;
use app\repository\AccountRepository;
use app\repository\BusinessRepository;
use app\repository\CouponRepository;
use app\repository\DictionaryRepository;
use app\validate\BusinessValidate;
use think\Collection;
use think\exception\ValidateException;
use app\model\{
Business as BusinessModel,
Account as AccountModel
};
use app\model\{Business as BusinessModel, Account as AccountModel, CouponMain};
use think\response\Json;
/**
@ -23,6 +22,10 @@ use think\response\Json;
*/
class Business extends Base
{
protected $noNeedLogin = [
'couponDetail',
];
/**
* 商家认证注册
*
@ -217,6 +220,59 @@ class Business extends Base
$data = BusinessCircle::getList();
return $this->json(1,"ok",$data);
}
/**
* 商家优惠券详情
* */
public function couponDetail()
{
$accountId = $this->request->user['user_id'] ?? 0;
$account = AccountRepository::getInstance()->findById($accountId, [], function ($q) {
return $q->with(['business', 'parent']);
});
$couponMainId = input("id/d");
$couponMain = CouponMain::findOne(["id"=>$couponMainId]);
if(empty($couponMain)){
return $this->json(4001,"优惠券不存在");
}
if(!$business = BusinessRepository::getInstance()->findOneByWhere(["code"=>$couponMain["business_code"]])){
return $this->json(4001,"优惠券商家信息不存在");
}
$list = $business->toArray();
$list = DictionaryRepository::getInstance()->parseAreaText($list);
$data = [];
$data["businessAddress"] = $list['province_text'] . $list['city_text'] . $list['county_text'] . $business['business_address'];
$data["businessName"] = $list['business_name'];
$data["count"] = $couponMain->count;
$data["couponName"] = $couponMain->name;
$data["deductionMoney"] = $couponMain->deduction_money;
$data["startTime"] = $couponMain->start_time;
$data["endTime"] = $couponMain->end_time;
$data["id"] = $couponMain->id;
$data["imageUrl"] = $this->request->domain(). $couponMain->image_url;
$data["intro"] = $couponMain->intro;//简介
$data["lat"] = $couponMain->lat;
$data["lng"] = $couponMain->lng;
$data["money"] = $couponMain->money;
$data["usingRule"] = DictionaryRepository::getInstance()->getUsingRuleByCouponMainId($couponMain->id);
$data["punishRule"] = '';//处罚规则 已取消
//未登录可以领取 0可领取 1已领取
if (empty($account)) {
$data["receiveStatus"] = CouponMain::COMMON_OFF;//领取状态
}else{
$data["receiveStatus"] = AccountRepository::getInstance()->getCouponReceiveStatus($account->user_code,$couponMain);//领取状态
}
$data["receivedCount"] = $couponMain->received_count;//已领取数量
$data["typeName"] = $couponMain->type_name;
return $this->json(0,"success",$data);
}
}

View File

@ -3,9 +3,13 @@ namespace app\controller\api;
use app\model\CouponMain;
use app\model\Slide;
use app\repository\AccountRepository;
use app\repository\BusinessRepository;
use app\repository\CouponRepository;
use app\repository\OperationRepository;
use think\Collection;
use think\Exception;
use think\exception\ValidateException;
use think\response\Json;
/**
@ -30,6 +34,7 @@ class Consumer extends Base
$params = [
'businessType' => $this->request->param('businessType/d', 0), // 商家类型
'couponType' => $this->request->param('couponType/d', 0), // 优惠卷类型
'businessCode' => $this->request->param('businessCode/s'), // 商家code
'dis' => $this->request->param('dis/d', -1), // 距离,单位为km
'lng' => $this->request->param('lng/f', 0), // 经度 104.752890
'lat' => $this->request->param('lat/f', 0), // 纬度 31.465040
@ -51,12 +56,12 @@ class Consumer extends Base
$whereMap[] = ['status', '=', CouponMain::status_on];
$whereMap[] = ['on_shelf', '=', CouponMain::on_shelf_on];
$whereMap[] = ['start_time', '> TIME', $nowDate];
$whereMap[] = ['end_time', '< TIME', $nowDate];
//$whereMap[] = ['start_time', '< TIME', $nowDate];
$whereMap[] = ['end_time', '> TIME', $nowDate];
$whereMap[] = ['using_count', '>', 0];
if (!empty($params['keyword'])) {
$whereMap[] = ['name', 'like', "%{$params['keyword']}%"];
$whereMap[] = ['name', 'like', "%".$params['keyword']."%"];
}
if ($params['businessType'] > 0) {
$whereMap[] = ['business_type', '=', $params['businessType']];
@ -64,6 +69,9 @@ class Consumer extends Base
if ($params['couponType'] > 0) {
$whereMap[] = ['type', '=', $params['couponType']];
}
if (!empty($params['businessCode'])) {
$whereMap[] = ['business_code', '=', $params['businessCode']];
}
if ($params['dis'] > 0) {
$pointList = getEarthSquareRangePoint($params['lat'],$params['lng'], $params['dis']);
@ -76,7 +84,9 @@ class Consumer extends Base
}
}
$res = $repo->findCouponMainList($whereMap, [], $params['page'], $params['size'], function ($q) use($lngRange, $latRange, $params) {
$res = $repo->findCouponMainList($whereMap,[], $params['page'], $params['size'], function ($q) use($lngRange, $latRange, $params) {
return $q->when(!empty($lngRange) && !empty($latRange), function($query) use($lngRange, $latRange){
$query->where(function ($queryB) use($lngRange) {
$queryB->whereOr($lngRange);
@ -85,8 +95,20 @@ class Consumer extends Base
->field("*, abs( (IFNULL(lat,0) - {$params['lat']}) * (IFNULL(lng,0) - {$params['lng']}) ) as square");
}, $sortOrder);
$accountRepo= AccountRepository::getInstance();
$res['list']->each(function ($item)use($params){
$accountId = $this->request->user['user_id'] ?? 0;
$flowArray = [];
if ($accountId) {
$account = $accountRepo->findById($accountId, [], function ($q) {
return $q->with(['business', 'parent']);
});
if (!empty($account)) {
$flowArray = $accountRepo->getBusinessFlowCodeArray($account->user_code);
}
}
$res['list']->each(function ($item)use($params,$flowArray){
unset($item->square);
$distance = (get_distance($params["lat"], $params["lng"], $item["lat"],$item["lng"]));
if ($distance >= 1000) {
@ -95,6 +117,14 @@ class Consumer extends Base
$item->distance_text = $distance . "m";
}
//是否收藏了该优惠券的商家
$item->isFlow = in_array($item->business_code,$flowArray);
$item->couponId = $item->id;
$item->businessCode = $item->business_code;
$item->businessName = $item->business_name;
$item->cover = $this->request->domain().$item->image_url;
$item->couponName = $item->name;
});
return $this->json(0, 'success', $res);
@ -127,4 +157,47 @@ class Consumer extends Base
}, $orders);
return $this->json(1,"ok",$list["list"]);
}
/**
* 关注/取消关注一个商家
* */
public function flowBusiness()
{
$accountId = $this->request->user['user_id'] ?? 0;
$accountRepo = AccountRepository::getInstance();
try {
$account = $accountRepo->findById($accountId, [], function ($q) {
return $q->with(['business', 'parent']);
});
if (empty($account)) {
throw new ValidateException('用户无效!');
}
$businessCode = input("businessCode/s");
$business = BusinessRepository::getInstance()->findOneByWhere(["code"=>$businessCode]);
if(empty($business)){
throw new ValidateException('商家无效!');
}
$businessFlow = $accountRepo->hasBusinessFlow($account->user_code,$businessCode);
//如果关注了 就删除
if($businessFlow){
$businessFlow->delete();
}else{
//没有关注就添加
$accountRepo->createBusinessFlow($account->user_code,$businessCode,$business->business_name);
}
return $this->json();
} catch (ValidateException $e) {
return $this->json(4001, $e->getError());
} catch (Exception $e) {
return $this->json(5001, '服务器繁忙!');
}
}
}

View File

@ -2,7 +2,12 @@
namespace app\controller\api;
use app\exception\RepositoryException;
use app\model\CouponMain;
use app\repository\AccountRepository;
use app\repository\CouponRepository;
use think\Exception;
use think\facade\Db;
use think\facade\Log;
/**
* 优惠卷相关
@ -64,5 +69,87 @@ class Coupon extends Base
} catch (RepositoryException | \Exception $e) {
return $this->json(5001, '优惠卷查询失败!');
}
}
/**
* 领取优惠券
* */
public function receiveCoupon()
{
$accountId = $this->request->user['user_id'] ?? 0;
$lat = input("lat/f",0);
$lng = input("lng/f",0);
$account = AccountRepository::getInstance()->findById($accountId, [], function ($q) {
return $q->with(['business', 'parent']);
});
if(empty($account)){
return $this->json(6001,"无效的用户");
}
if ($lat <= 0 || $lng <= 0) {
return $this->json(4001, "请授权定位");
}
$couponMainId = input("couponId/d", 0);
$couponMain = CouponMain::findOne(["id" => $couponMainId],[],function ($q){
//执行领取 开启锁
return $q->with("business")->lock(true);
});
//检查优惠券状态
$checkCouponMainReceiveStatus = CouponRepository::getInstance()->checkCouponMainReceiveStatus($couponMain);
if( $checkCouponMainReceiveStatus !== true ){
return $checkCouponMainReceiveStatus;
}
try {
//检查是否可以领取 0可领取 1已领取
AccountRepository::getInstance()->getCouponReceiveStatusText($account->user_code,$couponMain);//领取状态
}catch (RepositoryException $e){
return $this->json(4001,$e->getMessage());
}
//检查通过 执行领取
$time = time();
Db::startTrans();
try {
//写入领取记录
$data = [
"coupon_id" =>$couponMain->id,
"name" =>$couponMain->name,
"type_id" =>$couponMain->type,
"type_name" =>$couponMain->type_name,
"business_code" =>$couponMain->business_code,
"business_name" =>$couponMain->business?$couponMain->business->business_name:'',
"consumer_code" =>$account->user_code,
"consumer_name" =>$account->nick_name,
"money" => $couponMain->money,
"content" => createUuid(),//未知作用
"received_time" => date("Y-m-d H:i:s",$time),
"lat" => $lat,
"lng" => $lng,
"end_time" => date($couponMain->end_time . " 00:00:00"),
"edition" => couponMain::COMMON_ON,//版本 未知作用
"is_verificated" => couponMain::COMMON_OFF,//版本 未知作用
];
CouponRepository::getInstance()->receiveCoupon($data);
Db::commit();
return $this->json();
}catch (RepositoryException $e){
Log::error("优惠券领取失败RepositoryException:".$e->getMessage());
Db::rollback();
return $this->json(5001,"领取失败");
}catch (Exception $e){
Log::error("优惠券领取失败:".$e->getMessage());
Db::rollback();
return $this->json(5001,"领取失败");
}
}
}

View File

@ -231,8 +231,25 @@ class User extends Base
* */
public function businessFlowList()
{
return false;
$page = $this->request->param('page/d', 1);
$size = $this->request->param('size/d', 30);
$accountRepo = AccountRepository::getInstance();
try {
$account = $accountRepo->findById($accountId, [], function ($q) {
return $q->with(['business', 'parent']);
});
if (empty($account)) {
throw new ValidateException('用户无效!');
}
}catch (ValidateException $e) {
return $this->json(4001, $e->getError());
} catch (Exception $e) {
return $this->json(5001, '服务器繁忙!获取用户个人信息失败');
}
$data = AccountRepository::getInstance()->getBusinessFlowList();
}
}

View File

@ -5,6 +5,7 @@ namespace app\model;
//用户关注的商家
class BusinessFlow extends Base
{
public function account()
{
return $this->hasOne(Account::class,"user_code","user_code");

View File

@ -9,6 +9,7 @@ use app\model\Deduction;
use app\model\Recharge;
use app\service\Repository;
use app\traits\CouponBillTrait;
use app\traits\CouponMainTrait;
use think\Collection;
use think\Model;
@ -22,6 +23,7 @@ use think\Model;
class BusinessRepository extends Repository
{
use CouponBillTrait;
use CouponMainTrait;
/**
* 根据条件查询列表

View File

@ -8,6 +8,7 @@ use app\model\CouponMain;
use app\model\CouponType;
use app\model\UsingRule;
use app\service\Repository;
use app\traits\CouponMainTrait;
use Exception;
use think\Collection;
use think\Db;
@ -23,6 +24,7 @@ use think\Model;
*/
class CouponRepository extends Repository
{
use CouponMainTrait;
/**
* 优惠券持有信息列表
*
@ -98,4 +100,18 @@ class CouponRepository extends Repository
return CouponMain::findList($where, $fields, $page, $size, $call, $sortOrder);
}
/**
* 写入一个领取优惠券
* @param array $data
* @return Coupon|Model
*/
public function receiveCoupon(array $data)
{
return Coupon::create($data);
}
}

View File

@ -6,6 +6,7 @@ use app\model\Area;
use app\model\BusinessCircle;
use app\model\Category;
use app\model\Model;
use app\model\UsingRule;
use app\service\Repository;
use think\Collection;
@ -74,6 +75,11 @@ class DictionaryRepository extends Repository
/**
* 获取商家分类数据
* @param array $where
* @param array $fields
* @param callable|null $call
* @param array $order
* @return mixed|Collection
*/
public function getBusinessTypeList(array $where=[], array $fields = [], callable $call=null, array $order = [])
{
@ -131,6 +137,9 @@ class DictionaryRepository extends Repository
/**
* 解析地址编码
* [province, city, county]
* @param array $list
* @param array $areaList
* @return array
*/
public function parseAreaText(array $list, array $areaList = []): array
{
@ -149,4 +158,23 @@ class DictionaryRepository extends Repository
return $list;
}
/**
* 获取一个优惠券的使用规则
* @param int $couponMainId
* @return string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getUsingRuleByCouponMainId(int $couponMainId)
{
$usingRule =UsingRule::where("coupon_id",$couponMainId)->find();
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->person_day_total ."</div>
<div class='disPaperList'><div class='circleOrange'></div>该优惠券每人总共可以领取". $usingRule->person_total ."</div>";
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace app\traits;
use app\model\CouponMain;
use app\model\UsingRule;
use app\model\Coupon;
trait CouponMainTrait
{
/**
* 检查优惠券状态是否可以领取
* @param CouponMain $couponMain
* @return bool
*/
public function checkCouponMainReceiveStatus(CouponMain $couponMain){
if (empty($couponMain)) {
return $this->json(4001, "优惠券不存在");
}
if ($couponMain->status != CouponMain::status_on) {
return $this->json(4002, "优惠券已停用");
}
if ($couponMain->on_shelf != CouponMain::on_shelf_on) {
return $this->json(4003, "优惠券已下架");
}
$time = time();
if (strtotime($couponMain->start_time) > $time) {
return $this->json(4004, "优惠券还未发行");
}
if (strtotime($couponMain->end_time) < $time) {
return $this->json(4004, "优惠券已结束使用");
}
if ($couponMain->using_count <= 0) {
return $this->json(4004, "优惠券已经被领完了");
}
return true;
}
}

View File

@ -2,6 +2,9 @@
namespace app\traits;
use app\exception\RepositoryException;
use app\model\CouponMain;
use app\model\UsingRule;
use think\Model;
use app\model\Coupon;
@ -21,8 +24,6 @@ trait CouponTrait
/**消费者已使用优惠券总数
* @param string $userCode
*
*
* @return int
*/
public function consumerUsedTotalCoupon($userCode)
@ -30,10 +31,9 @@ trait CouponTrait
return Coupon::where("consumer_code", $userCode)->where("is_verificated", Coupon::is_verificated_on)->count("id");
}
/**消费者已使用优惠券总数
/**
* 消费者已使用优惠券总数
* @param string $userCode
*
*
* @return int
*/
public function consumerNotUsedTotalCoupon($userCode)
@ -41,10 +41,9 @@ trait CouponTrait
return Coupon::where("consumer_code", $userCode)->where("is_verificated", Coupon::is_verificated_off)->count("id");
}
/**消费者已使用优惠券总数
/**
* 消费者已使用优惠券总数
* @param string $userCode
*
*
* @return array
* @throws \Exception
*/
@ -55,5 +54,112 @@ trait CouponTrait
}, ["id" => "desc"]);
}
/**
* 查看某个优惠券的是否可以领取 0 可以领取 1 已领取不能再领取
* @param $accountCode
* @param CouponMain $couponMain
* @return int
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getCouponReceiveStatus($accountCode,CouponMain $couponMain )
{
//没有领取记录就可以领取
$ReceiveCount = Coupon::where("coupon_id",$couponMain->id)
->where("consumer_code",$accountCode)
->count();
if($ReceiveCount <= 0){
return CouponMain::COMMON_OFF;
}
//确定使用规则
$usingRule =UsingRule::where("coupon_id",$couponMain->id)->find();
if(empty($usingRule)){
return CouponMain::COMMON_OFF;
}
//单人日限量
$todayReceivesCount = Coupon::where("coupon_id",$couponMain->id)
->where("consumer_code",$accountCode)
->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 ){
return CouponMain::COMMON_ON;
}
//单人总限量
if($ReceiveCount >= $usingRule->person_total ){
return CouponMain::COMMON_ON;
}
return CouponMain::COMMON_OFF;
}
/**
* 查看某个优惠券的是否可以领取 0 可以领取 1 已领取不能再领取
* @param $accountCode
* @param CouponMain $couponMain
* @return void
* @throws RepositoryException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getCouponReceiveStatusText($accountCode,CouponMain $couponMain )
{
//没有领取记录就可以领取
$ReceiveCount = Coupon::where("coupon_id",$couponMain->id)
->where("consumer_code",$accountCode)->count();
//确定使用规则
$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("单日领取总限量达到上限");
}
//单人日限量
$todayReceivesCount = Coupon::where("coupon_id",$couponMain->id)
->where("consumer_code",$accountCode)
->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("单人总限量达到上限");
}
$time = time();
//一天的开始时间
if(strtotime(date("Y-m-d " . $usingRule->day_start_time)) > $time){
throw new RepositoryException("请在当天{$usingRule->day_start_time}后来领取");
}
//一天的结束时间
if(strtotime(date("Y-m-d ".$usingRule->day_end_time)) < $time){
throw new RepositoryException("请在当天{$usingRule->day_start_time}前领取");
}
}
}

View File

@ -29,4 +29,49 @@ trait BusinessFlowTrait
->page($page,$size)
->select();
}
}
/**
* 获取关注的商家的code
* @param $accountCode
* @return array
*/
public function getBusinessFlowCodeArray($accountCode)
{
return BusinessFlow::where("user_code",$accountCode)
->column("business_code");
}
/**
* 获取关注的商家的code
* @param $accountCode
* @param $businessCode
* @return BusinessFlow|array|\think\Model|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function hasBusinessFlow($accountCode,$businessCode)
{
return BusinessFlow::where("user_code",$accountCode)
->where("business_code",$businessCode)
->find();
}
/**
* 关注一个商家
* @param $accountCode
* @param $businessCode
* @param $businessName
* @return BusinessFlow|\think\Model
*/
public function createBusinessFlow($accountCode,$businessCode,$businessName)
{
return BusinessFlow::create([
"user_code"=>$accountCode,
"business_code"=>$businessCode,
"business_name"=>$businessName,
"create_time"=>date("Y-m-d H:i:s")
]);
}
}

View File

@ -10,11 +10,12 @@
// +----------------------------------------------------------------------
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('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/getBusinessTypeList', "\\app\\controller\\api\\business@getBusinessTypeList");//首页获取商家类型
Route::rule('dic/getBusinessCircle', "\\app\\controller\\api\\business@getBusinessCircle");//首页获取商家商圈
//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('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/getBusinessTypeList', "\\app\\controller\\api\\business@getBusinessTypeList");//首页获取商家类型
//Route::rule('dic/getBusinessCircle', "\\app\\controller\\api\\business@getBusinessCircle");//首页获取商家商圈
//Route::rule('consumer/flowBusiness', "\\app\\controller\\api\\consumer@flowBusiness");//首页获取商家商圈

View File

@ -121,13 +121,13 @@
<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" id="using_rule_day_start_time" placeholder="HH:mm:ss">
<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" id="using_rule_day_end_time" placeholder="HH:mm:ss">
<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>
@ -176,8 +176,8 @@
<div class="layui-form-item">
<label class="layui-form-label">内容</label>
<div class="layui-input-block editor-text">
<div class="editor"></div>
<textarea name="item[intro]" id="ueditor" class="layui-textarea layui-hide"></textarea>
<!-- <div class="editor"></div>-->
<textarea name="item[intro]" id="ueditor" class="layui-textarea"></textarea>
</div>
</div>

View File

@ -178,8 +178,8 @@
<div class="layui-form-item">
<label class="layui-form-label">内容</label>
<div class="layui-input-block editor-text">
<div class="editor"></div>
<textarea name="item[intro]" id="ueditor" class="layui-textarea layui-hide">{$item["intro"]|raw}</textarea>
<!-- <div class="editor"></div>-->
<textarea name="item[intro]" id="ueditor" class="layui-textarea">{$item["intro"]}</textarea>
</div>
</div>
@ -234,4 +234,21 @@
</div>
</div>
</div>
<script src="__MANAGER__/js/coupon/index.js?v={:mt_rand()}"></script>
<script src="__MANAGER__/js/coupon/index.js?v={:mt_rand()}"></script>
<script>
layui.use(['laydate'], function () {
laydate = layui.laydate;
//日期时间选择器
laydate.render({
elem: '#using_rule_day_start_time'
,type: 'time'
});
//日期时间选择器
laydate.render({
elem: '#using_rule_day_end_time'
,type: 'time'
});
})
</script>