jun vor 2 Wochen
Ursprung
Commit
72db6a5c26

+ 103 - 0
app/Http/Controllers/Admin/PayCity.php

@@ -0,0 +1,103 @@
+<?php namespace App\Http\Controllers\Admin;
+
+use App\Models\PayCity as Model;
+use App\Models\City;
+
+/**
+ * banner管理
+ *
+ * @author    刘相欣
+ *
+ */
+class PayCity extends Auth{
+	
+	protected function _initialize(){
+		parent::_initialize();
+		$this->assign('breadcrumb1','营销管理');
+		$this->assign('breadcrumb2','支付地区');
+	}
+
+    /**
+     * 列表页
+     *
+     * */
+    public function index(Model $Model, City $City){
+        // 查询用户
+        $list			= $Model->query()->get();
+        foreach($list as &$value){
+            if( $value['city_ids'] ) {
+                // 解析数组
+                $cityids			= explode(',',$value['city_ids']);
+                // 获取城市
+                foreach ($cityids as $kk=>$vv) 	{
+                    // 获取值
+                    $vv				= $City->getOne($vv,'name');
+                    // 获取城市名
+                    $cityids[$kk]	= $vv;
+                }
+                // 城市列表
+                $value['city_ids']	= implode('、',$cityids);
+            }
+        }
+        // 分配数据
+        $this->assign('list',$list);
+        $this->assign('empty', '<tr><td colspan="20">~~暂无数据</td></tr>');
+        // 加载模板
+        return 			$this->fetch();
+    }
+
+    /**
+     * 修改
+     *
+     * */
+    public function edit(Model $Model, City $City){
+        // 接受参数
+        $id						= request('id',0);
+        // 查询数据
+        $oldData				= $Model->query()->find($id);
+        // 如果是没有数据
+        if( !$oldData ) 			return $this->error('查无数据');
+        // 修改
+        if(request()->isMethod('post')){
+            // 组合数据
+            $cityIds			= request('city_ids',[]);
+            $data['city_ids']	= implode(',',$cityIds);
+            // 写入
+            $result				= $Model->edit($id,$data);
+            // 提示新增失败
+            if( !$result )		return json_send(['code'=>'error','msg'=>'修改失败']);
+            // 记录行为
+            $this->addAdminHistory(admin('uid'),$Model->getTable(),$id,2,$oldData,$data);
+            // 告知结果
+            return				json_send(['code'=>'success','msg'=>'修改成功','action'=>'edit']);
+        }
+        // 获取城市ID
+        $oldData['city_ids']		= explode(',',$oldData['city_ids']);
+        // 获取列表
+        $cityList					= $City->getCityList();
+        // 分配数据
+        $this->assign('oldData',$oldData);
+        $this->assign('cityList',$cityList);
+        $this->assign('crumbs','修改');
+        // 加载模板
+        return 						$this->fetch();
+    }
+
+    /**
+     * 状态
+     *
+     * */
+    public function set_status( Model $Model){
+        // 接收参数
+        $id				= request('id',0);
+        $status			= request('status',0);
+        // 查询数据
+        $result			= $Model->edit($id,['status'=>$status]);
+        // 提示新增失败
+        if( !$result )	return json_send(['code'=>'error','msg'=>'设置失败']);
+        // 记录行为
+        $this->addAdminHistory(admin('uid'),$Model->getTable(),$id,2,[],['status'=>$status]);
+        // 告知结果
+        return			json_send(['code'=>'success','msg'=>'设置成功','path'=>'']);
+    }
+}

+ 12 - 1
app/Http/Controllers/Api/Custom.php

@@ -7,6 +7,7 @@ use App\Models\WeiBan\Qrcode as WeiBanQrcode;
 use Vinkla\Hashids\Facades\Hashids;
 use App\Http\Requests\Api\Custom as Request;
 use App\Models\City;
+use App\Models\PayCity;
 use App\Models\WeiBan\Follow as WeiBanFollow;
 use App\Models\CustomAmount;
 use App\Models\Video\VideoVip;
@@ -26,7 +27,7 @@ class Custom extends Api{
 	 * @param	string		$code		授权码
 	 * 
 	 * */
-	public function get_info(Model $Model,WeiBanQrcode $WeiBanQrcode,City $City,WeiBanFollow $WeiBanFollow,CustomAmount $CustomAmount,VideoVip $VideoVip){
+	public function get_info(Model $Model,WeiBanQrcode $WeiBanQrcode,City $City,WeiBanFollow $WeiBanFollow,CustomAmount $CustomAmount,VideoVip $VideoVip,PayCity $PayCity){
 		// 接口验签
 		// $this->verify_sign();
 		// 检查登录
@@ -64,6 +65,15 @@ class Custom extends Api{
 		$followQrcode					= $custom['weiban_extid'] ?  ['thumb'=>'','link_url'=>''] : $WeiBanQrcode->getFollowQrcode($custom['city_id']);
 		// 城市ID换城市名
 		$cityName						= (string) $City->getOne($custom['city_id'],'name');
+        //判断用户所在城市是否设置了支付
+        $payCity                        = $PayCity->where([['status','=',0]])->first();
+        $isPay                          = 0;
+        if ($payCity && $payCity['city_ids']) {
+            $cityIds = explode(',',$payCity['city_ids']);
+            if (in_array($custom['city_id'], $cityIds)) {
+                $isPay                  = 1;
+            }
+        }
         //获取用户余额
         $amountInfo                     = $CustomAmount::query()->where([['custom_uid','=',$uid]])->first(['amount','transfer_amount']);
 		// 如果没有余额,获取默认值
@@ -78,6 +88,7 @@ class Custom extends Api{
 											'userpic'=>$custom['userpic'],
 											'phone'=>$custom['phone'],
 											'is_manager'=>$custom['is_manager'],
+											'is_pay'=>$isPay,
 											'company_id'=>1, // 无需验证资质
 											'show_price'=>$cityName?1:0, // 是否选择了城市处理
 											'city_id'=>$cityName,

+ 15 - 7
app/Http/Controllers/Api/Orders.php

@@ -45,6 +45,7 @@ class Orders extends Api{
 		$productList					= request('product_list','[]');
 		$customCouponId					= request('custom_coupon_id',0);
 		$addrId							= request('addr_id',0);
+		$isPay							= request('is_pay',0);
 		// 如果不存在数据
 		if( !$addrId )					return json_send(['code'=>'error','msg'=>'请选择收货地址','data'=>['error'=>'请选择收货地址']]);
 		// 解码购买信息
@@ -338,6 +339,8 @@ class Orders extends Api{
 				// 删除非必要数据
 				unset($order['product_list']);
                 $order['snowflake_id']  = $SnowflakeId;
+                $order['is_pay']        = $isPay;
+                $order['status']        = $isPay ? 0 : 1;
 				// 创建总订单
 				$orderId				= $Model->add($order);
 				// 如果订单写入失败
@@ -351,6 +354,7 @@ class Orders extends Api{
 				foreach ($productItem as $key=>$value) {
 					// 增加订单ID
 					$value['order_id']	= $orderId;
+                    $value['status']    = $isPay ? 0 : 1;
 					// 增加订单ID
 					$value['insert_time']= $time;
 					$value['update_time']= $time;
@@ -377,12 +381,14 @@ class Orders extends Api{
 					// 提示信息
 					return				json_send(['code'=>'error','msg'=>'地址写入失败','data'=>['error'=>'地址写入失败']]);
 				}
-				// 赠送积分
-				if( $order['order_score'] > 0 ) $CustomScore->trade($order['custom_uid'],$orderId,$order['order_score'],5,1);
+                if ($isPay == 0) {
+                    // 赠送积分
+                    if( $order['order_score'] > 0 ) $CustomScore->trade($order['custom_uid'],$orderId,$order['order_score'],5,1);
+                }
 				// 如果使用了优惠券
 				if( $usedCoupon )		$CustomCoupon->edit($usedCoupon,['status'=>1,'order_id'=>$orderId]);
 				// 购物车
-				if( $isCart )			$ShopCart->query()->where([['custom_uid','=',$uid]])->whereIn('skuid',array_column($buyList,'product_skuid'))->delete();
+				if( $isCart )			$ShopCart->query()->whereIn('id',array_column($buyList,'shop_cart_id'))->delete();
 			}
 			// 自动发放优惠券
 			$this->autoCoupon($uid);
@@ -430,7 +436,7 @@ class Orders extends Api{
 		// 查询状态
 		if( $status )				$map[] = ['status','=',$status];
 		// 查询
-		$Paginator					= $Model->query()->where($map)->orderByDesc('id')->paginate($limit,['id','pay_total','status','price_total','coupon_total','business_id','pay_total','weizan_orderid','insert_time']);
+		$Paginator					= $Model->query()->where($map)->orderByDesc('id')->paginate($limit,['id','regiment_id','is_pay','pay_total','status','price_total','coupon_total','business_id','pay_total','weizan_orderid','insert_time']);
 		// 订单产品
 		$productList 				= $OrdersProduct->query()->whereIn('order_id', array_column($Paginator->items(),'id'))->select(['id as item_id','order_id','product_id','buy_num','is_rebate','sku_attr_names as product_spec','product_name','product_thumb'])->get()->toArray();
 		// 循环处理
@@ -656,6 +662,7 @@ class Orders extends Api{
         $regimentId					    = request('regiment_id',0);
         $regimentActiveId				= request('regiment_active_id',0);
         $btnType					    = request('btn_type',0);
+        $isPay					        = request('is_pay',0);
         $Snowflake                      = new Snowflake();
         $SnowflakeId                    = $Snowflake->next();
         // 如果不存在数据
@@ -837,8 +844,8 @@ class Orders extends Api{
                     'custom_uid'    =>  $uid,
                     'active_id'     =>  $regimentActiveInfo['id'],
                     'product_id'    =>  $buyInfo['product_id'],
-                    'people_number' =>  1,
-                    'status'        =>  1,
+                    'people_number' =>  $isPay ? 0 : 1,
+                    'status'        =>  $isPay ? 4 : 0,
                     'start_time'    =>  $time,
                     'end_time'      =>  $time + $regimentActiveInfo['expiration']*3600,
                     'update_time'   =>  $time,
@@ -890,10 +897,11 @@ class Orders extends Api{
                 'active_id'     =>  $regimentActiveInfo['id'],
                 'product_id'    =>  $buyInfo['product_id'],
                 'order_id'      =>  $orderId,
+                'status'        =>  $isPay ? 4 : 0,
                 'update_time'   =>  $time,
                 'insert_time'   =>  $time,
             ];
-            if($btnType == 4){
+            if($btnType == 4 && $isPay == 0){
                 // 拼团人数加1
                 $inc				=   Regiment::query()->where('id','=',$regimentId)->increment('people_number',1);
                 if( !$inc )			{

+ 13 - 2
app/Http/Controllers/Api/Product.php

@@ -13,6 +13,7 @@ use App\Models\ProductPhoto;
 use App\Models\PromoProduct;
 use App\Models\PromoRebate;
 use App\Models\RegimentActive;
+use App\Models\PayCity;
 use App\Models\Regiment;
 use App\Models\WeiBan\Tags as WeiBanTags;
 
@@ -177,7 +178,7 @@ class Product extends Api{
 	 * @param	int     $id		        产品id
 	 * 
 	 * */
-	public function get_detail(Request $request, Model $Model, ProductPhoto $ProductPhoto,ProductCity $ProductCity, Business $Business, ProductAttr $ProductAttr, ProductSpec $ProductSpec, ProductSkus $ProductSkus, RegimentActive $RegimentActive, Regiment $Regiment, Custom $Custom, WeiBanTags $WeiBanTags, PromoProduct $PromoProduct){
+	public function get_detail(Request $request, Model $Model, ProductPhoto $ProductPhoto,ProductCity $ProductCity, Business $Business, ProductAttr $ProductAttr, ProductSpec $ProductSpec, ProductSkus $ProductSkus, RegimentActive $RegimentActive, Regiment $Regiment, Custom $Custom, WeiBanTags $WeiBanTags, PromoProduct $PromoProduct,PayCity $PayCity){
 		// 接口验签
 		// $this->verify_sign();
         // 验证参数
@@ -198,9 +199,19 @@ class Product extends Api{
         $allowCity                  = $ProductCity->where([['product_id','=',$id]])->pluck('city_id')->toArray();
         // 如果不是全国城市 也不是服务城市范围
         if ( !in_array(1,$allowCity) &&  ( isset($custom['city_id']) && !in_array($custom['city_id'],$allowCity)) ) return json_send(['code'=>'error','msg'=>'您的城市不在该产品服务范围','data'=>['error'=>'您的城市不在该产品服务范围']]);
-		// 转数组
+        //判断产品城市是否设置了支付
+        $payCity                        = $PayCity->where([['status','=',0]])->first();
+        $isPay                          = 0;
+        if ($payCity && $payCity['city_ids']) {
+            $cityIds = explode(',',$payCity['city_ids']);
+            foreach ($allowCity as $item) {
+                if ($item == 1 || in_array($item,$cityIds))     $isPay                  = 1;
+            }
+        }
+        // 转数组
 		$data						= $data->toArray();
 		// 处理数据
+        $data['is_pay'] 			= $isPay;
 		$data['thumb'] 				= path_compat($data['thumb']);
 		$data['poster'] 			= $data['poster'] ? path_compat($data['poster']) : '';
 		$data['description'] 		= $Model->getDesc($id);

+ 28 - 2
app/Http/Controllers/Api/ShopCart.php

@@ -7,6 +7,8 @@ use App\Models\Product\Skus as ProductSkus;
 use App\Models\PromoRebate;
 use App\Models\ShopCart as Model;
 use App\Models\PromoProduct as PromoProduct;
+use App\Models\PayCity;
+use App\Models\Product\City as ProductCity;
 use App\Models\Custom as Custom;
 use App\Models\WeiBan\Tags as WeiBanTags;
 
@@ -102,7 +104,7 @@ class ShopCart extends Api{
 	 * @param	int     $id		        购物车id
 	 * 
 	 * */
-	public function get_list(Request $request,Model $Model,ProductSkus $ProductSkus,Business $Business,PromoProduct $PromoProduct,Custom $Custom,WeiBanTags $WeiBanTags){
+	public function get_list(Request $request,Model $Model,ProductSkus $ProductSkus,Business $Business,PromoProduct $PromoProduct,Custom $Custom,WeiBanTags $WeiBanTags,ProductCity $ProductCity,PayCity $PayCity){
 		// 接口验签
 		// $this->verify_sign();
         // 验证参数
@@ -198,6 +200,18 @@ class ShopCart extends Api{
 			$value['thumb']			= path_compat($value['thumb']);
 			// 库存超出的时候
 			if($value['buy_num'] > $value['stock'] ) $value['buy_num'] = $value['stock'];
+            // 允许城市
+            $allowCity                  = $ProductCity->where([['product_id','=',$value['product_id']]])->pluck('city_id')->toArray();
+            //判断产品城市是否设置了支付
+            $payCity                        = $PayCity->where([['status','=',0]])->first();
+            $isPay                          = 0;
+            if ($payCity && $payCity['city_ids']) {
+                $cityIds = explode(',',$payCity['city_ids']);
+                foreach ($allowCity as $item) {
+                    if ($item == 1 || in_array($item,$cityIds))     $isPay                  = 1;
+                }
+            }
+            $value['is_pay']        = $isPay;
 			// 重组
 			$list[$key]				= $value;
 		}
@@ -213,7 +227,7 @@ class ShopCart extends Api{
 	 * @param	int     $id		        购物车id
 	 * 
 	 * */
-	public function check_list(Request $request,Model $Model,ProductSkus $ProductSkus,Business $Business,PromoProduct $PromoProduct,Custom $Custom,WeiBanTags $WeiBanTags){
+	public function check_list(Request $request,Model $Model,ProductSkus $ProductSkus,Business $Business,PromoProduct $PromoProduct,Custom $Custom,WeiBanTags $WeiBanTags,PayCity $PayCity,ProductCity $ProductCity){
 		// 接口验签
 		// $this->verify_sign();
         // 验证参数
@@ -331,6 +345,18 @@ class ShopCart extends Api{
 			$value['thumb']			= path_compat($value['thumb']);
 			// 库存超出的时候
 			if($value['buy_num'] > $value['stock'] ) $value['buy_num'] = $value['stock'];
+            // 允许城市
+            $allowCity                  = $ProductCity->where([['product_id','=',$value['product_id']]])->pluck('city_id')->toArray();
+            //判断产品城市是否设置了支付
+            $payCity                        = $PayCity->where([['status','=',0]])->first();
+            $isPay                          = 0;
+            if ($payCity && $payCity['city_ids']) {
+                $cityIds = explode(',',$payCity['city_ids']);
+                foreach ($allowCity as $item) {
+                    if ($item == 1 || in_array($item,$cityIds))     $isPay                  = 1;
+                }
+            }
+            $value['is_pay']        = $isPay;
 			// 重组
 			$list[$key]				= $value;
 		}

+ 40 - 0
app/Models/PayCity.php

@@ -0,0 +1,40 @@
+<?php namespace App\Models;
+
+use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Illuminate\Database\Eloquent\Model;
+use App\Models\Traits\Custom\Login;
+
+/**
+ * 设置支付城市模型
+ * 
+ */
+class PayCity extends Model
+{
+    use HasFactory,Login;
+
+    // 与模型关联的表名
+    protected $table = 'pay_city';
+    // 是否主动维护时间戳
+    public $timestamps = false;
+    // 定义时间戳字段名
+    // const CREATED_AT = 'insert_time';
+    // const UPDATED_AT = 'update_time';
+
+    /**
+     * 编辑城市
+     * 
+     */
+    public function edit($id,$data)
+    {
+        // 更新时间
+        $data['update_time']                = time();
+        // 写入数据表
+        $result						        = $this->query()->where([['id','=',$id]])->update($data);
+        // 失败返回0
+        if( !$result )                      return 0;
+        // 返回结果
+        return                              $id;
+    }
+
+
+}

+ 2 - 2
app/Models/Traits/Orders/Status.php

@@ -13,8 +13,8 @@ trait Status
     // 交易类型  与 支付方式
     private     $statusList        =   ['0'=>[
                                         'id'            =>0,
-                                        'name'          =>'创建订单',// 未付款
-                                        'state'         =>'待付款', 
+                                        'name'          =>'创建订单',// 未付款,系统报单不走支付流程的状态
+                                        'state'         =>'待付款',
                                     ],'1'=>[
                                         'id'            =>1,
                                         'name'          =>'创建订单',// 未付款,系统报单不走支付流程的状态

+ 114 - 0
resources/views/admin/pay_city/add.blade.php

@@ -0,0 +1,114 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<form class="post-form" action="" method="post" enctype="multipart/form-data">
+	<div class="form-group col-sm-3">
+		<label class="control-label">优惠券名称 <span class="text-red">*</span></label>
+		<input class="form-control" required="required" type="text" placeholder="优惠券名称" maxlength="20" name="name" value="" />
+	</div>
+	<div class="form-group col-sm-3">
+		<label class="control-label">优惠券类型 <span class="text-red">*</span></label>
+		<select class="form-control" required="required" name="rebate_type" id="rebate_type">
+			<option value="1" >满减券</option>
+			<option value="2" >折扣券</option>
+			<option value="3" >赠品券</option>
+		</select>
+	</div>
+	<div class="form-group col-sm-6">
+		<label class="control-label">优惠力度 <span class="text-red">*</span></label>
+		<div class="form-group col-sm-12">
+			<label class="control-label"> </label>
+			<div class="form-group col-sm-6">
+				<input  required="required" class="form-control" type="text" placeholder="满多少元" name="std_pay" value="" />
+			</div>
+			<div class="form-group col-sm-6">
+				<input  required="required" class="form-control" id="rebate" type="text" placeholder="减多少元" name="rebate" value="" />
+			</div>
+		</div>
+	</div>
+	<div class="form-group col-sm-6">
+		<label class="control-label">发放时间 <span class="text-red">*</span></label>
+		<div class="form-group col-sm-12">
+			<div class="form-group col-sm-6">
+				<label class="control-label">开始时间 <span class="text-red">*</span></label>
+				<input  required="required" class="form-control" type="datetime-local" placeholder="开始时间" name="start_time" value="" />
+			</div>
+			<div class="form-group col-sm-6">
+			<label class="control-label">结束时间 <span class="text-red">*</span></label>
+				<input  required="required" class="form-control" type="datetime-local" placeholder="结束时间" name="end_time" value="" />
+			</div>
+		</div>
+	</div>
+	<div class="form-group col-sm-6">
+		<label class="control-label">到期时间 <span class="text-red">*</span></label>
+		<div class="form-group col-sm-12">
+			<div class="form-group col-sm-12">
+				<div class="form-group col-sm-6">
+					<label class="control-label"><input type="radio" checked name="exp_type" value="1" > 领取后X天有效 </label>
+					<input class="form-control" type="number" placeholder="天数" name="exp_days" value="" max="999" />
+				</div>
+				<div class="form-group col-sm-6">
+					<label class="control-label"><input type="radio" name="exp_type"  value="2"> 固定到期时间</label>
+					<input class="form-control" type="datetime-local" placeholder="到期时间" name="exp_time" value="" />
+				</div>
+			</div>
+		</div>
+	</div>
+	<div class="form-group col-sm-2">
+		<label class="control-label">发放类型</label>
+		<select name="grant_type" class="form-control" >
+			@foreach ($grantList as $value)
+			<option value="{{$value['id']}}" >{{$value['name']}}</option>
+			@endforeach
+		</select>
+	</div>
+	<div class="form-group col-sm-2">
+		<label class="control-label">商品范围</label>
+		<select name="type_id" class="form-control" >
+			<option value="2" >全部商品</option>
+			<option value="1" >指定商品</option>
+			<option value="3" >排除商品</option>
+		</select>
+	</div>
+	<div class="form-group col-sm-2">
+		<label class="control-label">发行数量 <span class="text-red">*</span> </label>
+		<input class="form-control" required="required" type="number" placeholder="优惠券发行数量" min="0" max="999999" name="issue_total" value="" />
+	</div>
+	<div class="form-group col-sm-6">
+		<label class="control-label">活动城市</label>
+		<select name="city_ids[]" class="form-control selectpicker" data-max-options="20" data-live-search="true" data-live-search-placeholder="搜索城市" data-none-results-text="未搜索到 {0}" title="选择城市" multiple>
+			@foreach ($cityList as $group)
+			<optgroup label="{{$group['name']}}">
+				@foreach ($group['city'] as $city)
+				<option value="{{$city['id']}}" >{{$city['name']}}</option>
+				@endforeach
+			</optgroup>
+			@endforeach
+		</select>
+	</div>
+	<div class="form-group col-sm-12">
+		@csrf
+		<input id="send" type="submit" value="提交" class="btn btn-primary btn-block" />
+	</div>
+</form>
+@endsection
+
+@section('javascript')
+<script>
+	$(function(){
+		// 类型变更
+		$('#rebate_type').change(function(){
+			// 获取值
+			var rebateType = $(this).val();
+			// 如果是满减
+			if( rebateType == 1 ) $('#rebate').attr('placeholder','减多少元');
+			// 如果是折扣
+			if( rebateType == 2 ) $('#rebate').attr('placeholder','打几折');
+			// 如果是赠品
+			if( rebateType == 3 ) $('#rebate').attr('placeholder','产品编码');
+		})
+	})
+</script>
+@endsection

+ 28 - 0
resources/views/admin/pay_city/edit.blade.php

@@ -0,0 +1,28 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<form class="post-form" action="" method="post">
+	<div class="form-group col-sm-6">
+		<label class="control-label">城市</label>
+		<select name="city_ids[]" class="form-control selectpicker" data-max-options="20" data-live-search="true" data-live-search-placeholder="搜索城市" data-none-results-text="未搜索到 {0}" title="选择城市" multiple>
+			@foreach ($cityList as $group)
+			<optgroup label="{{$group['name']}}">
+				@foreach ($group['city'] as $city)
+				<option value="{{$city['id']}}" @if ( in_array($city['id'],$oldData['city_ids']) ) selected="selected" @endif >{{$city['name']}}</option>
+				@endforeach
+			</optgroup>
+			@endforeach
+		</select>
+	</div>
+	<div class="form-group col-sm-12">
+		@csrf
+		<input type="hidden" name="id" value="{{$oldData['id']}}" />
+		<input id="send" type="submit" value="提交" class="btn btn-primary btn-block" />
+	</div>
+</form>
+@endsection
+@section('javascript')
+
+@endsection

+ 58 - 0
resources/views/admin/pay_city/index.blade.php

@@ -0,0 +1,58 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<div class="row">
+	<div class="col-xs-12">
+		<div class="table-responsive">
+			<table class="table table-striped table-bordered table-hover">
+				<thead>
+					<tr>
+						<th>名称</th>
+						<th>活动城市</th>
+						<th>状态</th>
+						<th>修改时间</th>
+						<th>新增时间</th>
+						<th>操作</th>
+					</tr>
+				</thead>
+				<tbody>
+					@foreach ($list as $a)
+					<tr>
+						<td> {{$a['name']}}</td>
+						<td> {{$a['city_ids']}}</td>
+						<td>
+							@if ($a['status'] == 0) 启用 @endif
+							@if ($a['status'] == 1) 停用 @endif
+						</td>
+						<td> {{date('Y/m/d H:i',$a['start_time'])}} ~ {{date('Y/m/d H:i:s',$a['end_time'])}}</td>
+						<td> {{date('Y/m/d H:i',$a['update_time'])}}</td>
+						<td>
+							@if( check_auth('admin/pay_city/edit') )
+							<a class="btn btn-sm btn-warning" href="{{url('admin/pay_city/edit?'.http_build_query(['id'=>$a['id']]))}}" title="查看">
+								编辑
+							</a>
+							@endif
+								@if( check_auth('admin/pay_city/set_status') )
+									@if ( $a['status'] == 1)
+										<a class="delete btn btn-sm btn-success" data-url="{{url('admin/pay_city/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'0']))}}">
+											启用
+										</a>
+									@endif
+									@if( $a['status'] == 0)
+										<a class="delete btn btn-sm btn-danger" data-url="{{url('admin/pay_city/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'1']))}}">
+											停用
+										</a>
+									@endif
+								@endif
+						</td>
+					</tr>
+					@endforeach
+				</tbody>
+
+			</table>
+		</div>
+	</div>
+</div>
+@endsection

+ 8 - 0
routes/web.php

@@ -823,5 +823,13 @@ Route::middleware('admin')->prefix('admin')->group(function(){
     // 状态
     Route::any('redpacket_active_record/down_excel',[App\Http\Controllers\Admin\RedpacketActiveRecord::class,'down_excel']);
 
+    /* 设置支付地址 */
+    // 列表
+    Route::any('pay_city/index',[App\Http\Controllers\Admin\PayCity::class,'index']);
+    // 编辑
+    Route::any('pay_city/edit',[App\Http\Controllers\Admin\PayCity::class,'edit']);
+    // 状态
+    Route::any('pay_city/set_status',[App\Http\Controllers\Admin\PayCity::class,'set_status']);
+
 
 });