完善商城快讯

This commit is contained in:
wangxiaowei 2024-07-23 22:31:58 +08:00
parent 9189744da6
commit 5b575d2eca
5 changed files with 80 additions and 47 deletions

@ -182,12 +182,6 @@ class MallNewsLogic extends Logic
return false;
}
// 选择商品
public static function selectGoods()
{
}
private static function checkForm(&$form)
{
if (empty($form)) {
@ -197,30 +191,31 @@ class MallNewsLogic extends Logic
$file = [];
unset($form['file']);
if (!is_numeric($form['sort'])) {
if (!empty($form['sort']) && !is_numeric($form['sort'])) {
return ['code' => -1, 'msg' => '请输入整数'];
}
if ($form['type'] == 0 && isset($form['mall_news_images'])) {
if ($form['type'] == 0) {
// 文章类型
$file = $form['mall_news_images'];
if (count($form['mall_news_images']) > 6) {
return ['code' => -1, 'msg' => '上传图片数量超过限制'];
if (isset($form['mall_news_images'])) {
$file = $form['mall_news_images'];
if (count($form['mall_news_images']) > 6) {
return ['code' => -1, 'msg' => '上传图片数量超过限制'];
}
unset($form['mall_news_images']) ;
}
unset($form['mall_news_images']);
unset($form['video_file']);
} else if ($form['type'] == 1 && !empty($form['video_file'])) {
} else if ($form['type'] == 1) {
// 视频类型
$file = $form['video_file'];
if (!$form['video_file']) {
return ['code' => -1, 'msg' => '请上传视频'];
if (!empty($form['video_file'])) {
$file = $form['video_file'];
unset($form['video_file']);
}
unset($form['mall_news_images']);
unset($form['video_file']);
if (isset($form['mall_news_images'])) {
unset($form['mall_news_images']) ;
}
}
return ['code' => 1, 'data' => $file];

@ -22,6 +22,7 @@
border-radius: 50%;
background: hsla(0, 0%, 60%, .6)
}
.select-goods {margin-left: 10px}
</style>
<div class="layui-card layui-form">
@ -34,6 +35,14 @@
</div>
</div>
<div class="layui-form-item">
<label for="desc" class="layui-form-label"><span style="color:red;">*</span>文章概述:</label>
<div class="layui-input-inline">
<input type="text" name="desc" id="desc" lay-verType="tips" lay-verify="desc"
switch-tab="0" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">文章类型:</label>
<div class="layui-input-inline">
@ -227,7 +236,13 @@
switchTab($(item).attr("switch-tab"));
return "请填写标题";
}
}
},
desc: function (value, item) {
if (!value) {
switchTab($(item).attr("switch-tab"));
return "请填写文章概述";
}
},
});
function switchTab(number) {

@ -22,6 +22,7 @@
border-radius: 50%;
background: hsla(0, 0%, 60%, .6)
}
.select-goods {margin-left: 10px}
</style>
<div class="layui-card layui-form">
@ -35,6 +36,14 @@
</div>
</div>
<div class="layui-form-item">
<label for="desc" class="layui-form-label"><span style="color:red;">*</span>文章概述:</label>
<div class="layui-input-inline">
<input type="text" name="desc" id="desc" lay-verType="tips" lay-verify="desc"
switch-tab="0" autocomplete="off" class="layui-input" value="{$detail.desc}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">文章类型:</label>
<div class="layui-input-inline">
@ -80,7 +89,7 @@
<div class="layui-form-item">
<label class="layui-form-label">商品:</label>
<div class="layui-input-inline" style="display: flex">
<div id="shop_name">{$detail.shop['name']}</div>
<div id="shop_name">{$detail.shop ? $detail.shop['name'] : ''}</div>
<input type="hidden" id="shop_id" name="shop_id" style="margin-right: 10px;">
<a class="layui-btn layui-btn-normal select-goods">选择商品</a>
</div>
@ -260,7 +269,13 @@
switchTab($(item).attr("switch-tab"));
return "请填写标题";
}
}
},
desc: function (value, item) {
if (!value) {
switchTab($(item).attr("switch-tab"));
return "请填写文章概述";
}
},
});
function switchTab(number) {

@ -126,6 +126,7 @@
, {field: 'title', title: '标题', width: 300}
, {field: 'type', title: '文章类型', width: 200, align: 'center',templet: '#news-type'}
, {field: 'is_top', title: '是否置顶', width: 320, align: 'center', templet: '#news-top'}
, {field: 'sort', title: '排序', width: 320, align: 'center'}
, {fixed: 'right', title: '操作', width: 400, align: 'center', toolbar: '#operation'}
]);
}

@ -19,6 +19,7 @@ use app\api\logic\SeckillGoodsLogic;
use think\facade\Db;
use app\common\model\activity_area\ActivityArea;
use think\facade\Event;
use app\common\model\MallNews;
class IndexLogic extends Logic
@ -79,7 +80,7 @@ class IndexLogic extends Logic
$set_price_type = 3;
}
if ($set['set_pro'] != 0) {
// $set_price_type = 1;
// $set_price_type = 1;
if ($set['set_pro_type'] == 1) {
$hots[$key]['purchase_price'] = round($value['purchase_price'] * (100 + $set['set_pro']) / 100, 2);
}
@ -88,7 +89,7 @@ class IndexLogic extends Logic
}
}
if ($set['set_issued'] != 0) {
// $set_price_type = 2;
// $set_price_type = 2;
if ($set['set_issued_type'] == 1) {
$hots[$key]['issuing_price'] = round($value['issuing_price'] * (100 + $set['set_issued']) / 100, 2);
}
@ -97,7 +98,7 @@ class IndexLogic extends Logic
}
}
if ($set['set_wholesale'] != 0) {
// $set_price_type = 3;
// $set_price_type = 3;
if ($set['set_wholesale_type'] == 1) {
$hots[$key]['wholesale_price'] = round($value['wholesale_price'] * (100 + $set['set_wholesale']) / 100, 2);
}
@ -121,7 +122,7 @@ class IndexLogic extends Logic
$set_price_type = 3;
}
if ($set['set_pro'] != 0) {
// $set_price_type = 1;
// $set_price_type = 1;
if ($set['set_pro_type'] == 1) {
$news[$key]['purchase_price'] = round($value['purchase_price'] * (100 + $set['set_pro']) / 100, 2);
}
@ -130,7 +131,7 @@ class IndexLogic extends Logic
}
}
if ($set['set_issued'] != 0) {
// $set_price_type = 2;
// $set_price_type = 2;
if ($set['set_issued_type'] == 1) {
$news[$key]['issuing_price'] = round($value['issuing_price'] * (100 + $set['set_issued']) / 100, 2);
}
@ -139,7 +140,7 @@ class IndexLogic extends Logic
}
}
if ($set['set_wholesale'] != 0) {
// $set_price_type = 3;
// $set_price_type = 3;
if ($set['set_wholesale_type'] == 1) {
$news[$key]['wholesale_price'] = round($value['wholesale_price'] * (100 + $set['set_wholesale']) / 100, 2);
}
@ -166,7 +167,7 @@ class IndexLogic extends Logic
$set_price_type = 3;
}
if ($set['set_pro'] != 0) {
// $set_price_type = 1;
// $set_price_type = 1;
if ($set['set_pro_type'] == 1) {
$shopRecommend[$k]['goods_list'][$key]['purchase_price'] = round($value['purchase_price'] * (100 + $set['set_pro']) / 100, 2);
}
@ -175,7 +176,7 @@ class IndexLogic extends Logic
}
}
if ($set['set_issued'] != 0) {
// $set_price_type = 2;
// $set_price_type = 2;
if ($set['set_issued_type'] == 1) {
$shopRecommend[$k]['goods_list'][$key]['issuing_price'] = round($value['issuing_price'] * (100 + $set['set_issued']) / 100, 2);
}
@ -184,7 +185,7 @@ class IndexLogic extends Logic
}
}
if ($set['set_wholesale'] != 0) {
// $set_price_type = 3;
// $set_price_type = 3;
if ($set['set_wholesale_type'] == 1) {
$shopRecommend[$k]['goods_list'][$key]['wholesale_price'] = round($value['wholesale_price'] * (100 + $set['set_wholesale']) / 100, 2);
}
@ -507,15 +508,15 @@ class IndexLogic extends Logic
if($set['price_type']==3){
$set_price_type = 3;
}
// if ($set['set_pro'] != 0) {
// $set_price_type = 1;
// }
// if ($set['set_issued'] != 0) {
// $set_price_type = 2;
// }
// if ($set['set_wholesale'] != 0) {
// $set_price_type = 3;
// }
// if ($set['set_pro'] != 0) {
// $set_price_type = 1;
// }
// if ($set['set_issued'] != 0) {
// $set_price_type = 2;
// }
// if ($set['set_wholesale'] != 0) {
// $set_price_type = 3;
// }
}
}
return [
@ -618,7 +619,7 @@ class IndexLogic extends Logic
$set_price_type = 3;
}
if ($set['set_pro'] != 0) {
// $set_price_type = 1;
// $set_price_type = 1;
if ($set['set_pro_type'] == 1) {
$lists[$key]['purchase_price'] = round($value['purchase_price'] * (100 + $set['set_pro']) / 100, 2);
}
@ -627,7 +628,7 @@ class IndexLogic extends Logic
}
}
if ($set['set_issued'] != 0) {
// $set_price_type = 2;
// $set_price_type = 2;
if ($set['set_issued_type'] == 1) {
$lists[$key]['issuing_price'] = round($value['issuing_price'] * (100 + $set['set_issued']) / 100, 2);
}
@ -636,7 +637,7 @@ class IndexLogic extends Logic
}
}
if ($set['set_wholesale'] != 0) {
// $set_price_type = 3;
// $set_price_type = 3;
if ($set['set_wholesale_type'] == 1) {
$lists[$key]['wholesale_price'] = round($value['wholesale_price'] * (100 + $set['set_wholesale']) / 100, 2);
}
@ -706,7 +707,7 @@ class IndexLogic extends Logic
$set_price_type = 3;
}
if ($set['set_pro'] != 0) {
// $set_price_type = 1;
// $set_price_type = 1;
if ($set['set_pro_type'] == 1) {
$lists[$key]['purchase_price'] = round($value['purchase_price'] * (100 + $set['set_pro']) / 100, 2);
}
@ -715,7 +716,7 @@ class IndexLogic extends Logic
}
}
if ($set['set_issued'] != 0) {
// $set_price_type = 2;
// $set_price_type = 2;
if ($set['set_issued_type'] == 1) {
$lists[$key]['issuing_price'] = round($value['issuing_price'] * (100 + $set['set_issued']) / 100, 2);
}
@ -724,7 +725,7 @@ class IndexLogic extends Logic
}
}
if ($set['set_wholesale'] != 0) {
// $set_price_type = 3;
// $set_price_type = 3;
if ($set['set_wholesale_type'] == 1) {
$lists[$key]['wholesale_price'] = round($value['wholesale_price'] * (100 + $set['set_wholesale']) / 100, 2);
}
@ -762,6 +763,7 @@ class IndexLogic extends Logic
'mnp_share_title' => '',
'mnp_share_image' => ''
]);
if (empty($share_mnp['mnp_share_image'])) {
$share_mnp['mnp_share_image'] = '';
} else {
@ -780,6 +782,9 @@ class IndexLogic extends Logic
$center_top_bg = UrlServer::getFileUrl($center_top_bg);
}
// 商城快讯
$mall_news = MallNews::where('delete_time', 0)->order('sort desc, create_time desc')->limit(3)->select();
$config = [
'shop_hide_goods' => ConfigServer::get('decoration', 'shop_hide_goods', 0), //商品详细是否显示店铺
'shop_street_hide' => ConfigServer::get('decoration', 'shop_street_hide', 0), //是否显示店铺街
@ -805,6 +810,8 @@ class IndexLogic extends Logic
'android_download' => ConfigServer::get('app', 'line_android', ''),//安卓下载链接
'download_doc' => ConfigServer::get('app', 'download_doc', ''),//app下载文案
'cate_style' => ConfigServer::get('decoration', 'layout_no', 1),//分类页面风格
'mall_news' => $mall_news,
'show_mall_news' => true,
'index_setting' => [ // 首页设置
// 热销榜单
'host_show' => ConfigServer::get('decoration_index', 'host_show', 1),