Commit 11d2b21b by lizhilin

更新

parent 09dfd7c4
...@@ -41,6 +41,30 @@ protected function grid() ...@@ -41,6 +41,30 @@ protected function grid()
$expand->button('查看'); $expand->button('查看');
return RenderGoodSku::make(['goods_id' => $this->id]); return RenderGoodSku::make(['goods_id' => $this->id]);
}); });
$grid->column('goods_desc', '内容详情')->if(function ($column) {
return $column->getValue();
})->display('点击查看')->modal(function ($modal) {
//设置弹窗标题
$modal->title('内容详情');
$card = new Card(null, $this->goods_desc);
return "<div style='padding:10px 10px 0;width:100%;'>$card</div>";
})->else(function ($column) {
return '';
});
$grid->column('intro_desc', '购买须知')->if(function ($column) {
return $column->getValue();
})->display('点击查看')->modal(function ($modal) {
//设置弹窗标题
$modal->title('内容详情');
$card = new Card(null, $this->intro_desc);
return "<div style='padding:10px 10px 0;width:100%;'>$card</div>";
})->else(function ($column) {
return '';
});
$grid->column('sort', '排序'); $grid->column('sort', '排序');
$grid->column('is_hot', '是否推荐')->display(function ($val) { $grid->column('is_hot', '是否推荐')->display(function ($val) {
return ($val == 1) ? '是' : '否'; return ($val == 1) ? '是' : '否';
...@@ -126,7 +150,7 @@ protected function form() ...@@ -126,7 +150,7 @@ protected function form()
$form->text('second_commission', '简推佣金比例')->help("比例如:10"); $form->text('second_commission', '简推佣金比例')->help("比例如:10");
$form->text('merchant_commission', '商家佣金比例')->help("比例如:10"); $form->text('merchant_commission', '商家佣金比例')->help("比例如:10");
$form->text('sale', '销量'); $form->text('sale', '销量');
$form->text('high_opinion', '好评'); $form->text('high_opinion', '好评');
//$form->text('box_size'); //$form->text('box_size');
$form->image('cover_img') $form->image('cover_img')
->accept('jpg,jpeg,png') ->accept('jpg,jpeg,png')
...@@ -192,6 +216,9 @@ protected function form() ...@@ -192,6 +216,9 @@ protected function form()
})->tab('详情', function (Form $form) { })->tab('详情', function (Form $form) {
$form->editor('goods_desc'); $form->editor('goods_desc');
})->tab('购买须知', function (Form $form) {
$form->editor('intro_desc');
}); });
}); });
......
...@@ -30,6 +30,7 @@ public function getList() ...@@ -30,6 +30,7 @@ public function getList()
$data['list'][] = [ $data['list'][] = [
'id' => $item->id, 'id' => $item->id,
'title' => $item->title, 'title' => $item->title,
'brief' => $item->brief,
'cover' => $item->cover ? env('IMAGE_URL') . $item->cover : '', 'cover' => $item->cover ? env('IMAGE_URL') . $item->cover : '',
'content' => $item->content, 'content' => $item->content,
'created_at' => $item->created_at, 'created_at' => $item->created_at,
...@@ -51,6 +52,7 @@ public function getDetail(Request $request) ...@@ -51,6 +52,7 @@ public function getDetail(Request $request)
$data = [ $data = [
'id' => $aid, 'id' => $aid,
'title' => $aObj->title, 'title' => $aObj->title,
'brief' => $aObj->brief ?? '',
'content' => $aObj->content, 'content' => $aObj->content,
'created_at' => $aObj->created_at ? date("Y-m-d H:i:s", strtotime($aObj->created_at)) : '', 'created_at' => $aObj->created_at ? date("Y-m-d H:i:s", strtotime($aObj->created_at)) : '',
]; ];
......
...@@ -49,7 +49,7 @@ public function add(Request $request) ...@@ -49,7 +49,7 @@ public function add(Request $request)
$count = OrderGoods::where('order_id', $oid)->where('is_comment', 0)->count(); $count = OrderGoods::where('order_id', $oid)->where('is_comment', 0)->count();
//Log::add('订单商品评论' . $og_id, ['num' => $count]); //Log::add('订单商品评论' . $og_id, ['num' => $count]);
if ($count == 0) { if ($count == 0) {
$this->dispatch(new AutoCompleteOrder($orderObj, 120)); //$this->dispatch(new AutoCompleteOrder($orderObj, 120));
} }
return $this->JsonResponse(''); return $this->JsonResponse('');
} catch (\Exception $exception) { } catch (\Exception $exception) {
......
...@@ -80,7 +80,7 @@ public function getList(Request $request) ...@@ -80,7 +80,7 @@ public function getList(Request $request)
'list' => [] 'list' => []
]; ];
$model = GoodModel::select(['id', 'goods_name', 'cover_img', 'goods_brief', 'sku']) $model = GoodModel::select(['id', 'goods_name', 'cover_img', 'goods_brief', 'sku', 'tags'])
->where(['is_show' => 1]); ->where(['is_show' => 1]);
if ($kw) { if ($kw) {
$model = $model->where("goods_name", 'like', "%" . $kw . "%"); $model = $model->where("goods_name", 'like', "%" . $kw . "%");
...@@ -108,11 +108,14 @@ public function getList(Request $request) ...@@ -108,11 +108,14 @@ public function getList(Request $request)
if (isset($skufield['sku'][0]['market_price'])) { if (isset($skufield['sku'][0]['market_price'])) {
$market_price = $skufield['sku'][0]['market_price']; $market_price = $skufield['sku'][0]['market_price'];
} }
//标签
$tags = $item->tags ? json_decode($item->tags, true) : [];
$data['list'][] = [ $data['list'][] = [
'id' => $item->id, 'id' => $item->id,
'goods_name' => $item->goods_name, 'goods_name' => $item->goods_name,
'dg_price' => sprintf("%.2f", $cg_price), 'dg_price' => sprintf("%.2f", $cg_price),
'market_price' => sprintf("%.2f", $market_price), 'market_price' => sprintf("%.2f", $market_price),
'tags' => $tags,
'cover_img' => (isset($goodsObj->cover_img) ? env('IMAGE_URL') . $goodsObj->cover_img : ''), 'cover_img' => (isset($goodsObj->cover_img) ? env('IMAGE_URL') . $goodsObj->cover_img : ''),
]; ];
} }
...@@ -130,7 +133,7 @@ public function getIndexGoods(Request $request) ...@@ -130,7 +133,7 @@ public function getIndexGoods(Request $request)
$limit = $request->limit ?? 10; $limit = $request->limit ?? 10;
$data = []; $data = [];
$model = GoodModel::select(['id', 'goods_name', 'is_hot', 'cover_img', 'goods_brief', 'sku']) $model = GoodModel::select(['id', 'goods_name', 'is_hot', 'cover_img', 'goods_brief', 'sku', 'tags'])
->where(['is_show' => 1]); ->where(['is_show' => 1]);
if ($kw) { if ($kw) {
$model = $model->where("goods_name", 'like', "%" . $kw . "%"); $model = $model->where("goods_name", 'like', "%" . $kw . "%");
...@@ -162,12 +165,15 @@ public function getIndexGoods(Request $request) ...@@ -162,12 +165,15 @@ public function getIndexGoods(Request $request)
if (isset($skufield['sku'][0]['market_price'])) { if (isset($skufield['sku'][0]['market_price'])) {
$market_price = $skufield['sku'][0]['market_price']; $market_price = $skufield['sku'][0]['market_price'];
} }
//标签
$tags = $datum->tags ? json_decode($datum->tags, true) : [];
$data['list'][] = [ $data['list'][] = [
'id' => $datum->id, 'id' => $datum->id,
'goods_name' => $datum->goods_name, 'goods_name' => $datum->goods_name,
'is_hot' => $datum->is_hot, 'is_hot' => $datum->is_hot,
'dg_price' => sprintf("%.2f", $dg_price), 'dg_price' => sprintf("%.2f", $dg_price),
'market_price' => sprintf("%.2f", $market_price), 'market_price' => sprintf("%.2f", $market_price),
'tags' => $tags,
'cover_img' => ($datum->cover_img) ? env('IMAGE_URL') . $datum->cover_img : '', 'cover_img' => ($datum->cover_img) ? env('IMAGE_URL') . $datum->cover_img : '',
]; ];
} }
......
...@@ -42,6 +42,7 @@ public function checkDistance(Request $request) ...@@ -42,6 +42,7 @@ public function checkDistance(Request $request)
$lat1 = $request->lat ?? ''; $lat1 = $request->lat ?? '';
$lng1 = $request->lng ?? ''; $lng1 = $request->lng ?? '';
$flag = false; $flag = false;
if ($mid) {
$list = Store::where(['merchant_id' => $mid]) $list = Store::where(['merchant_id' => $mid])
->select(['id', 'title', 'lat_lng', 'distance'])->get(); ->select(['id', 'title', 'lat_lng', 'distance'])->get();
foreach ($list as $key => $val) { foreach ($list as $key => $val) {
...@@ -53,6 +54,9 @@ public function checkDistance(Request $request) ...@@ -53,6 +54,9 @@ public function checkDistance(Request $request)
$flag = true; $flag = true;
} }
} }
} else {
$flag = true;
}
return $this->JsonResponse(['flag' => $flag]); return $this->JsonResponse(['flag' => $flag]);
} }
......
...@@ -59,16 +59,18 @@ public function collectList(Request $request) ...@@ -59,16 +59,18 @@ public function collectList(Request $request)
if ($listData->toArray()) { if ($listData->toArray()) {
foreach ($listData as $datum) { foreach ($listData as $datum) {
$goods_id = $datum->goods_id; $goods_id = $datum->goods_id;
$goodObj = GoodModel::select(['goods_name', 'cover_img'])->find($goods_id); $goodObj = GoodModel::select(['goods_name', 'cover_img', 'tags'])->find($goods_id);
$is_jd = (int)$goodObj->is_jd; $is_jd = (int)$goodObj->is_jd;
$attrRowObj = GoodSku::where("goods_id", $goods_id)->first(); $attrRowObj = GoodSku::where("goods_id", $goods_id)->first();
$attrcon = $attrRowObj ? json_decode($attrRowObj->content, true) : []; $attrcon = $attrRowObj ? json_decode($attrRowObj->content, true) : [];
$jd_price = isset($attrcon['jd_price']) ? (float)$attrcon['jd_price'] : 0; $jd_price = isset($attrcon['jd_price']) ? (float)$attrcon['jd_price'] : 0;
$market_price = isset($attrcon['market_price']) ? (float)$attrcon['market_price'] : 0; $market_price = isset($attrcon['market_price']) ? (float)$attrcon['market_price'] : 0;
$tags = $goodObj->tags ? json_decode($goodObj->tags, true) : [];
$data['list'][] = [ $data['list'][] = [
'goods_id' => $goods_id, 'goods_id' => $goods_id,
'goods_name' => $goodObj->goods_name ?? '', 'goods_name' => $goodObj->goods_name ?? '',
'attr' => $attrRowObj ? $attrRowObj->attr_val : '', 'attr' => $attrRowObj ? $attrRowObj->attr_val : '',
'tags' => $tags,
'goods_price' => $is_jd ? sprintf("%.2f", $jd_price) : sprintf("%.2f", $market_price), 'goods_price' => $is_jd ? sprintf("%.2f", $jd_price) : sprintf("%.2f", $market_price),
'cover_img' => ($goodObj->cover_img ? env('IMAGE_URL') . $goodObj->cover_img : ''), 'cover_img' => ($goodObj->cover_img ? env('IMAGE_URL') . $goodObj->cover_img : ''),
'addtime' => date('Y-m-d H:i:s', strtotime($datum->created_at)) 'addtime' => date('Y-m-d H:i:s', strtotime($datum->created_at))
......
...@@ -204,7 +204,6 @@ public function editUser(Request $request) ...@@ -204,7 +204,6 @@ public function editUser(Request $request)
{ {
$name = $request->name ?? ''; $name = $request->name ?? '';
$avatar = $request->avatar ?? null; $avatar = $request->avatar ?? null;
$company = $request->company ?? '';
$user = $request->user(); $user = $request->user();
if ($name) { if ($name) {
$user->name = $name; $user->name = $name;
...@@ -215,9 +214,7 @@ public function editUser(Request $request) ...@@ -215,9 +214,7 @@ public function editUser(Request $request)
} }
$user->avatar = $avatar ? str_replace(env('IMAGE_URL'), '', $avatar) : ''; $user->avatar = $avatar ? str_replace(env('IMAGE_URL'), '', $avatar) : '';
} }
if ($company) {
$user->company = $company;
}
if ($name) { if ($name) {
$user->save(); $user->save();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment