diff --git a/app/admin/controller/MallNews.php b/app/admin/controller/MallNews.php index 051c94e1..434349a5 100644 --- a/app/admin/controller/MallNews.php +++ b/app/admin/controller/MallNews.php @@ -2,6 +2,7 @@ namespace app\admin\controller; +use app\admin\logic\goods\GoodsLogic; use app\admin\logic\live\LiveGoodsLogic; use app\admin\logic\live\LiveRoomLogic; use app\admin\logic\MallNewsLogic; @@ -91,4 +92,15 @@ class MallNews extends AdminBase return JsonServer::error('删除失败'); } } + + // 选择商品 + public function goods() + { + if ($this->request->isAjax()) { + $get = $this->request->get(); + return JsonServer::success('', GoodsLogic::lists($get)); + } + + return view(); + } } \ No newline at end of file diff --git a/app/admin/logic/MallNewsLogic.php b/app/admin/logic/MallNewsLogic.php index efd1860f..c5d39658 100644 --- a/app/admin/logic/MallNewsLogic.php +++ b/app/admin/logic/MallNewsLogic.php @@ -58,6 +58,7 @@ class MallNewsLogic extends Logic } } + $result['shop'] = Db::name('goods')->where('id', $result['shop_id'])->find(); return $result; } @@ -172,6 +173,12 @@ class MallNewsLogic extends Logic return false; } + // 选择商品 + public static function selectGoods() + { + + } + private static function checkForm(&$form) { if (empty($form)) { diff --git a/app/admin/view/mall_news/add.html b/app/admin/view/mall_news/add.html index b96eee24..7bea982f 100644 --- a/app/admin/view/mall_news/add.html +++ b/app/admin/view/mall_news/add.html @@ -71,9 +71,11 @@
- -
- + +
+
+ + 选择商品
@@ -203,6 +205,22 @@ }) }); + // 选择商品 + $(document).on('click','.select-goods',function () { + layer.open({ + type: 2 + ,title: '选择商品' + ,content: '{:url("mallNews/goods")}' + ,area: ['90%', '90%'] + ,btn: ['确认', '取消'] + ,yes: function(index, layero){ + var data = window["layui-layer-iframe" + index].callbackdata(); + $('#shop_name').html(data[0].name) + $('#shop_id').val(data[0].id) + } + }) + }) + form.verify({ title: function (value, item) { if (!value) { diff --git a/app/admin/view/mall_news/audit.html b/app/admin/view/mall_news/audit.html index 8938737c..5a0da55a 100644 --- a/app/admin/view/mall_news/audit.html +++ b/app/admin/view/mall_news/audit.html @@ -71,10 +71,18 @@
+ + + + + +
- -
- + +
+
{$detail.shop['name']}
+ + 选择商品
@@ -230,6 +238,22 @@ }) }); + // 选择商品 + $(document).on('click','.select-goods',function () { + layer.open({ + type: 2 + ,title: '选择商品' + ,content: '{:url("mallNews/goods")}' + ,area: ['90%', '90%'] + ,btn: ['确认', '取消'] + ,yes: function(index, layero){ + var data = window["layui-layer-iframe" + index].callbackdata(); + $('#shop_name').html(data[0].name) + $('#shop_id').val(data[0].id) + } + }) + }) + form.verify({ title: function (value, item) { if (!value) { diff --git a/app/admin/view/mall_news/goods.html b/app/admin/view/mall_news/goods.html new file mode 100644 index 00000000..375eb66f --- /dev/null +++ b/app/admin/view/mall_news/goods.html @@ -0,0 +1,105 @@ +{layout name="layout1" /} +
+
+
+
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+
+
+ +
+
+
+ +
+
+
+ +
+
+ + \ No newline at end of file