Переглянути джерело

【Add】产品状态增加多个

liuxiangxin 4 місяців тому
батько
коміт
214c222a35

+ 4 - 4
app/Console/Commands/ProductDelist.php

@@ -54,10 +54,10 @@ class ProductDelist extends Command
         $Model          = New Model();
 		// 限购自动下架
 		$Model->query()->where([['quota_end','>',0],['quota_end','<=',time()],['status','=',0]])->update(['status'=>1,'update_time'=>time()]);
-        // 自动上架
-		$Model->query()->where([['puton_time','>',0],['puton_time','<=',time()],['status','=',1],['putoff_time','>=',time()]])->update(['status'=>0,'update_time'=>time()]);
-        // 自动下架
-		$Model->query()->where([['putoff_time','>',0],['putoff_time','<=',time()],['status','=',0]])->update(['status'=>1,'update_time'=>time()]);
+        // 预上架的产品自动上架
+		$Model->query()->where([['puton_time','>',0],['puton_time','<=',time()],['status','=',2]])->update(['status'=>0,'update_time'=>time()]);
+        // 已上架并且需要自动下架的产品,自动下架
+		$Model->query()->where([['putoff_time','>',0],['putoff_time','<=',time()],['status','=',0]])->update(['status'=>4,'update_time'=>time()]);
 	}
 
 }

+ 4 - 4
resources/views/admin/business/add.blade.php

@@ -5,8 +5,8 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 @section('content')
 <form class="post-form" action="" method="post">
 	<div class="form-group col-sm-12">
-		<label class="control-label">商店名称</label>
-		<input class="form-control" required="required" type="text" placeholder="店铺名称" name="name" maxlength="20" value="" />
+		<label class="control-label">商业公司</label>
+		<input class="form-control" required="required" type="text" placeholder="商业公司" name="name" maxlength="20" value="" />
 	</div>
 	<div class="form-group col-sm-2">
 		<label class="control-label">Logo图</label>
@@ -34,8 +34,8 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<input class="form-control" required="required" type="text" placeholder="简介说明" maxlength="255" name="address" value="" />
 	</div>
 	<div class="form-group col-sm-12">
-		<label class="control-label">店铺介绍</label>
-		<input class="form-control" required="required" type="text" placeholder="简介说明" maxlength="255" name="desc" value="" />
+		<label class="control-label">商业公司介绍</label>
+		<input class="form-control" required="required" type="text" placeholder="商业公司简介说明" maxlength="255" name="desc" value="" />
 	</div>
 	<div class="form-group col-sm-2">
 		<label class="control-label">上级代表</label>

+ 2 - 2
resources/views/admin/business/edit.blade.php

@@ -38,8 +38,8 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		<input class="form-control" required="required" type="text" placeholder="简介说明" maxlength="255" name="address" value="{{$oldData['address']}}" />
 	</div>
 	<div class="form-group col-sm-12">
-		<label class="control-label">店铺介绍</label>
-		<input class="form-control" required="required" type="text" placeholder="简介说明" maxlength="255" name="desc" value="{{$oldData['desc']}}" />
+		<label class="control-label">商业公司介绍</label>
+		<input class="form-control" required="required" type="text" placeholder="商业公司简介说明" maxlength="255" name="desc" value="{{$oldData['desc']}}" />
 	</div>
 	<div class="form-group col-sm-2">
 		<label class="control-label">上级代表</label>

+ 3 - 3
resources/views/admin/business/index.blade.php

@@ -37,9 +37,9 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			<table class="table table-striped table-bordered table-hover">
 				<thead>
 					<tr>
-						<th>商店编码</th>
-						<th>商店状态</th>
-						<th>商店名称</th>
+						<th>编码</th>
+						<th>状态</th>
+						<th>商业公司</th>
 						<th>联系方式</th>
 						<th>城市</th>
 						<th>详细地址</th>

+ 2 - 2
resources/views/admin/orders/index.blade.php

@@ -42,7 +42,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	</div>
 	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-12" style="margin-right: 2px;">
 		<select name="business_id" class="form-control">
-			<option value="" >店铺</option>
+			<option value="" >商业公司</option>
 			@foreach ($businessList as $business)
 				<option value="{{$business['id']}}" @if (request('business_id') === $business['id'] ) selected="selected" @endif >{{$business['name']}}</option>
 			@endforeach
@@ -95,7 +95,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<th>订单编号</th>
 						<th>产品编码</th>
 						<th>下单用户</th>
-						<th>店铺</th>
+						<th>商业公司</th>
 						<th>产品名称</th>
 						<th>产品规格</th>
 						<th>产品数量</th>

+ 1 - 1
resources/views/admin/product/edit.blade.php

@@ -304,7 +304,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	<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" />
+		<input id="send" type="submit" @if( !$oldData['status'] ) disabled="" value="上架产品 仅查看" @else value="提交" @endif  class="btn btn-primary btn-block" />
 	</div>
 </form>
 @endsection

+ 35 - 7
resources/views/admin/product/index.blade.php

@@ -35,7 +35,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 	</div>
 	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-12" style="margin-right: 2px;">
 		<select name="business_id" class="form-control">
-			<option value="" >店铺</option>
+			<option value="" >商业公司</option>
 			@foreach ($businessList as $business)
 			<option value="{{$business['id']}}" @if (request('business_id') === $business['id'] ) selected="selected" @endif >{{$business['name']}}</option>
 			@endforeach
@@ -60,11 +60,11 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<th>剩余库存</th>
 						<th>产品销量</th>
 						<th>产品库存</th>
-						<th>产品状态</th>
 						<th>服务城市</th>
-						<th>店铺</th>
+						<th>商业公司</th>
 						<th>排序</th>
 						<th>限购数量</th>
+						<th>产品状态</th>
 						<th>修改时间</th>
 						<th>操作</th>
 					</tr>
@@ -79,7 +79,6 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<td>{{$a['stock']}}</td>
 						<td>{{$a['sales_total']}}</td>
 						<td>{{$a['stock_total']}}</td>
-						<td> {{$a['status']?'已下架':'已上架'}} </td>
 						<td> {{$a['city_name']}}</td>
 						<td> {{$a['business_name']}}</td>
 						<td>
@@ -90,11 +89,33 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 							@endif
 						</td>
 						<td> {{$a['quota']}} </td>
+						<td> 
+							@switch($a['status'])
+								@case(1)
+									编辑中
+								@break
+								@case(0)
+									已上架
+								@break
+								@case(2)
+									预上架
+								@break
+								@case(3)
+									已中止
+								@break
+								@case(4)
+									已结束
+								@break
+								@default
+									无
+								@break
+							@endswitch
+						</td>
 						<td> {{date('Y/m/d H:i:s',$a['update_time'])}}</td>
 						<td>
 							@if(check_auth('admin/product/edit'))
 							<a class="btn btn-sm btn-warning" href="{{url('admin/product/edit?'.http_build_query(['id'=>$a['id']]))}}" title="查看">
-								编辑
+								@if ($a['status']) 编辑 @else 查看 @endif
 							</a>
 							@endif
 							@if(check_auth('admin/product/copy'))
@@ -104,12 +125,19 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 							@endif
 							@if(check_auth('admin/product/set_status'))
 								@if ($a['status'])
+									<!-- 判断是不是有上架时间 -->
+									@if ( $a['puton_time'] )
+									<a class="delete btn btn-sm btn-success" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'2']))}}">
+										预上架
+									</a>
+									@else
 									<a class="delete btn btn-sm btn-success" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'0']))}}">
 										上架
 									</a>
+									@endif
 								@else
-									<a class="delete btn btn-sm btn-danger" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'1']))}}">
-										下架
+									<a class="delete btn btn-sm btn-danger" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'3']))}}">
+										中止
 									</a>
 								@endif
 							@endif

+ 1 - 1
resources/views/admin/regiment/index.blade.php

@@ -43,7 +43,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<th>参与活动/活动编码</th>
 						<th>产品名称/产品编码</th>
 						<th>发起客户昵称/发起客户编码</th>
-						<th>店铺</th>
+						<th>商业公司</th>
 						<th>拼团状态</th>
 						<th>开始时间</th>
 						<th>结束时间</th>

+ 1 - 1
resources/views/admin/regiment_active/add.blade.php

@@ -80,7 +80,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 		</div>
 	</div>
 	<div class="form-group col-sm-6">
-		<label class="control-label">店铺</label>
+		<label class="control-label">商业公司</label>
 		<select name="business_id" class="form-control selectpicker" data-live-search="true" data-live-search-placeholder="搜索商业公司" data-none-results-text="未搜索到 {0}" title="选择商业公司">
 			@foreach ($businessList as $value)
 				<option value="{{$value['id']}}" selected >{{$value['name']}}</option>

+ 1 - 1
resources/views/admin/regiment_active/edit.blade.php

@@ -80,7 +80,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			</div>
 		</div>
 		<div class="form-group col-sm-6">
-			<label class="control-label">店铺</label>
+			<label class="control-label">商业公司</label>
 			<select name="business_id" required class="form-control selectpicker" data-live-search="true" data-live-search-placeholder="搜索商业公司" data-none-results-text="未搜索到 {0}" title="选择商业公司">
 				@foreach ($businessList as $value)
 					<option value="{{$value['id']}}" @if( $value['id'] == $oldData['business_id']) selected @endif >{{$value['name']}}</option>

+ 1 - 1
resources/views/admin/regiment_active/index.blade.php

@@ -50,7 +50,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<th>拼团人数(人)</th>
 						<th>活动价格(元)</th>
 						<th>拼团有效期</th>
-						<th>店铺</th>
+						<th>商业公司</th>
 						<th>状态</th>
 						<th>活动时间</th>
 						<th>创建时间</th>

+ 1 - 1
resources/views/admin/regiment_record/index.blade.php

@@ -40,7 +40,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<th>参与活动/活动编码</th>
 						<th>产品名称/产品编码</th>
 						<th>发起客户昵称/发起客户编码</th>
-						<th>店铺</th>
+						<th>商业公司</th>
 						<th>拼团状态</th>
 						<th>订单生成时间</th>
 					</tr>