Commit 11d2b21b by lizhilin

更新

parent 09dfd7c4
......@@ -41,6 +41,30 @@ protected function grid()
$expand->button('查看');
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('is_hot', '是否推荐')->display(function ($val) {
return ($val == 1) ? '是' : '否';
......@@ -126,7 +150,7 @@ protected function form()
$form->text('second_commission', '简推佣金比例')->help("比例如:10");
$form->text('merchant_commission', '商家佣金比例')->help("比例如:10");
$form->text('sale', '销量');
$form->text('high_opinion', '好评');
$form->text('high_opinion', '好评');
//$form->text('box_size');
$form->image('cover_img')
->accept('jpg,jpeg,png')
......@@ -192,6 +216,9 @@ protected function form()
})->tab('详情', function (Form $form) {
$form->editor('goods_desc');
})->tab('购买须知', function (Form $form) {
$form->editor('intro_desc');
});
});
......
......@@ -30,6 +30,7 @@ public function getList()
$data['list'][] = [
'id' => $item->id,
'title' => $item->title,
'brief' => $item->brief,
'cover' => $item->cover ? env('IMAGE_URL') . $item->cover : '',
'content' => $item->content,
'created_at' => $item->created_at,
......@@ -51,6 +52,7 @@ public function getDetail(Request $request)
$data = [
'id' => $aid,
'title' => $aObj->title,
'brief' => $aObj->brief ?? '',
'content' => $aObj->content,
'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)
$count = OrderGoods::where('order_id', $oid)->where('is_comment', 0)->count();
//Log::add('订单商品评论' . $og_id, ['num' => $count]);
if ($count == 0) {
$this->dispatch(new AutoCompleteOrder($orderObj, 120));
//$this->dispatch(new AutoCompleteOrder($orderObj, 120));
}
return $this->JsonResponse('');
} catch (\Exception $exception) {
......
......@@ -80,7 +80,7 @@ public function getList(Request $request)
'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]);
if ($kw) {
$model = $model->where("goods_name", 'like', "%" . $kw . "%");
......@@ -108,11 +108,14 @@ public function getList(Request $request)
if (isset($skufield['sku'][0]['market_price'])) {
$market_price = $skufield['sku'][0]['market_price'];
}
//标签
$tags = $item->tags ? json_decode($item->tags, true) : [];
$data['list'][] = [
'id' => $item->id,
'goods_name' => $item->goods_name,
'dg_price' => sprintf("%.2f", $cg_price),
'market_price' => sprintf("%.2f", $market_price),
'tags' => $tags,
'cover_img' => (isset($goodsObj->cover_img) ? env('IMAGE_URL') . $goodsObj->cover_img : ''),
];
}
......@@ -130,7 +133,7 @@ public function getIndexGoods(Request $request)
$limit = $request->limit ?? 10;
$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]);
if ($kw) {
$model = $model->where("goods_name", 'like', "%" . $kw . "%");
......@@ -162,12 +165,15 @@ public function getIndexGoods(Request $request)
if (isset($skufield['sku'][0]['market_price'])) {
$market_price = $skufield['sku'][0]['market_price'];
}
//标签
$tags = $datum->tags ? json_decode($datum->tags, true) : [];
$data['list'][] = [
'id' => $datum->id,
'goods_name' => $datum->goods_name,
'is_hot' => $datum->is_hot,
'dg_price' => sprintf("%.2f", $dg_price),
'market_price' => sprintf("%.2f", $market_price),
'tags' => $tags,
'cover_img' => ($datum->cover_img) ? env('IMAGE_URL') . $datum->cover_img : '',
];
}
......
......@@ -42,16 +42,20 @@ public function checkDistance(Request $request)
$lat1 = $request->lat ?? '';
$lng1 = $request->lng ?? '';
$flag = false;
$list = Store::where(['merchant_id' => $mid])
->select(['id', 'title', 'lat_lng', 'distance'])->get();
foreach ($list as $key => $val) {
$atng = $val->lat_lng ? explode(',', $val->lat_lng) : [];
$lat2 = $atng[1];
$lng2 = $atng[0];
$res = ($lat1 && $lat2) ? $this->haversineDistance($lat1, $lng1, $lat2, $lng2) : '';
if ($res <= $val->distance) {
$flag = true;
if ($mid) {
$list = Store::where(['merchant_id' => $mid])
->select(['id', 'title', 'lat_lng', 'distance'])->get();
foreach ($list as $key => $val) {
$atng = $val->lat_lng ? explode(',', $val->lat_lng) : [];
$lat2 = $atng[1];
$lng2 = $atng[0];
$res = ($lat1 && $lat2) ? $this->haversineDistance($lat1, $lng1, $lat2, $lng2) : '';
if ($res <= $val->distance) {
$flag = true;
}
}
} else {
$flag = true;
}
return $this->JsonResponse(['flag' => $flag]);
}
......
......@@ -59,16 +59,18 @@ public function collectList(Request $request)
if ($listData->toArray()) {
foreach ($listData as $datum) {
$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;
$attrRowObj = GoodSku::where("goods_id", $goods_id)->first();
$attrcon = $attrRowObj ? json_decode($attrRowObj->content, true) : [];
$jd_price = isset($attrcon['jd_price']) ? (float)$attrcon['jd_price'] : 0;
$market_price = isset($attrcon['market_price']) ? (float)$attrcon['market_price'] : 0;
$tags = $goodObj->tags ? json_decode($goodObj->tags, true) : [];
$data['list'][] = [
'goods_id' => $goods_id,
'goods_name' => $goodObj->goods_name ?? '',
'attr' => $attrRowObj ? $attrRowObj->attr_val : '',
'tags' => $tags,
'goods_price' => $is_jd ? sprintf("%.2f", $jd_price) : sprintf("%.2f", $market_price),
'cover_img' => ($goodObj->cover_img ? env('IMAGE_URL') . $goodObj->cover_img : ''),
'addtime' => date('Y-m-d H:i:s', strtotime($datum->created_at))
......
......@@ -204,7 +204,6 @@ public function editUser(Request $request)
{
$name = $request->name ?? '';
$avatar = $request->avatar ?? null;
$company = $request->company ?? '';
$user = $request->user();
if ($name) {
$user->name = $name;
......@@ -215,9 +214,7 @@ public function editUser(Request $request)
}
$user->avatar = $avatar ? str_replace(env('IMAGE_URL'), '', $avatar) : '';
}
if ($company) {
$user->company = $company;
}
if ($name) {
$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