正在显示
5 个修改的文件
包含
35 行增加
和
35 行删除
@@ -136,6 +136,9 @@ class SalesmanController extends AdminBaseController{ | @@ -136,6 +136,9 @@ class SalesmanController extends AdminBaseController{ | ||
136 | public function salesman_goods_add(){ | 136 | public function salesman_goods_add(){ |
137 | 137 | ||
138 | if($this -> request -> isPost()){ | 138 | if($this -> request -> isPost()){ |
139 | + if($_POST['money'] > $_POST['price']){ | ||
140 | + $this -> error('佣金不能大于售价'); | ||
141 | + } | ||
139 | $goods_data = Db::name('goods') -> where('uid',$_POST['uid']) -> select() -> toArray(); | 142 | $goods_data = Db::name('goods') -> where('uid',$_POST['uid']) -> select() -> toArray(); |
140 | if(count($goods_data) >= 8){ | 143 | if(count($goods_data) >= 8){ |
141 | $this -> error('添加失败'); | 144 | $this -> error('添加失败'); |
@@ -182,6 +185,9 @@ class SalesmanController extends AdminBaseController{ | @@ -182,6 +185,9 @@ class SalesmanController extends AdminBaseController{ | ||
182 | public function salesman_goods_edit(){ | 185 | public function salesman_goods_edit(){ |
183 | 186 | ||
184 | if($this -> request -> isPost()){ | 187 | if($this -> request -> isPost()){ |
188 | + if($_POST['money'] > $_POST['price']){ | ||
189 | + $this -> error('佣金不能大于售价'); | ||
190 | + } | ||
185 | if(!empty($_POST['det_img'])){ | 191 | if(!empty($_POST['det_img'])){ |
186 | $_POST['det_img'] = json_encode($_POST['det_img']); | 192 | $_POST['det_img'] = json_encode($_POST['det_img']); |
187 | $_POST['det_name'] = json_encode($_POST['det_name']); | 193 | $_POST['det_name'] = json_encode($_POST['det_name']); |
@@ -101,6 +101,14 @@ class SalesmangoodsController extends WeChatBaseController{ | @@ -101,6 +101,14 @@ class SalesmangoodsController extends WeChatBaseController{ | ||
101 | public function Salesman_goods_add(){ | 101 | public function Salesman_goods_add(){ |
102 | 102 | ||
103 | if($this -> request -> isPost()){ | 103 | if($this -> request -> isPost()){ |
104 | + $uid = cmf_get_current_user_id(); | ||
105 | + $salesman_goods = Db::name('goods') -> where("uid=".$uid." and type = 2") -> select(); | ||
106 | + if(count($salesman_goods)>=8){ | ||
107 | + return 3; | ||
108 | + } | ||
109 | + if($_POST['money']>$_POST['price']){ | ||
110 | + return 2; | ||
111 | + } | ||
104 | $data['show_img'] = $_POST['show_img']; | 112 | $data['show_img'] = $_POST['show_img']; |
105 | $data['thumbnail'] = $_POST['thumbnail']; | 113 | $data['thumbnail'] = $_POST['thumbnail']; |
106 | $data['book_name'] = $_POST['book_name']; | 114 | $data['book_name'] = $_POST['book_name']; |
@@ -33,7 +33,7 @@ | @@ -33,7 +33,7 @@ | ||
33 | <li><a href="{:url('Salesman/salesman_goods_list',array('uid'=>$good_uid))}">商品管理列表</a></li> | 33 | <li><a href="{:url('Salesman/salesman_goods_list',array('uid'=>$good_uid))}">商品管理列表</a></li> |
34 | <li class="active"><a href="#">添加商品</a></li> | 34 | <li class="active"><a href="#">添加商品</a></li> |
35 | </ul> | 35 | </ul> |
36 | - <form action="{:url('Salesman/salesman_goods_add')}" method="post" class="form-horizontal js-ajax-form margin-top-20"> | 36 | + <form id="AddProductPicture" action="{:url('Salesman/salesman_goods_add')}" method="post" class="form-horizontal js-ajax-form margin-top-20" > |
37 | <div class="row"> | 37 | <div class="row"> |
38 | <div class="col-md-9"> | 38 | <div class="col-md-9"> |
39 | <table class="table table-bordered"> | 39 | <table class="table table-bordered"> |
@@ -56,11 +56,7 @@ | @@ -56,11 +56,7 @@ | ||
56 | <td><input class="form-control" type="text" name="price" id="source" value="" | 56 | <td><input class="form-control" type="text" name="price" id="source" value="" |
57 | placeholder="请输入售价"></td> | 57 | placeholder="请输入售价"></td> |
58 | </tr> | 58 | </tr> |
59 | - <tr> | ||
60 | - <th>定价</th> | ||
61 | - <td><input class="form-control" type="text" name="pricing" value="" | ||
62 | - placeholder="请输入定价"></td> | ||
63 | - </tr> | 59 | + |
64 | <tr> | 60 | <tr> |
65 | <th>商品说明</th> | 61 | <th>商品说明</th> |
66 | <td> | 62 | <td> |
@@ -144,6 +140,11 @@ | @@ -144,6 +140,11 @@ | ||
144 | class="btn btn-default btn-sm">选择图片</a> | 140 | class="btn btn-default btn-sm">选择图片</a> |
145 | </td> | 141 | </td> |
146 | </tr> | 142 | </tr> |
143 | + <tr> | ||
144 | + <th>定价</th> | ||
145 | + <td><input class="form-control" type="text" name="pricing" value="" | ||
146 | + placeholder="请输入定价"></td> | ||
147 | + </tr> | ||
147 | </table> | 148 | </table> |
148 | <div class="form-group"> | 149 | <div class="form-group"> |
149 | <div class="col-sm-offset-2 col-sm-10"> | 150 | <div class="col-sm-offset-2 col-sm-10"> |
@@ -185,6 +186,7 @@ | @@ -185,6 +186,7 @@ | ||
185 | </div> | 186 | </div> |
186 | </td> | 187 | </td> |
187 | </tr> | 188 | </tr> |
189 | + | ||
188 | </table> | 190 | </table> |
189 | </div> | 191 | </div> |
190 | </div> | 192 | </div> |
@@ -197,29 +199,7 @@ | @@ -197,29 +199,7 @@ | ||
197 | </script> | 199 | </script> |
198 | <script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script> | 200 | <script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script> |
199 | <script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script> | 201 | <script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script> |
200 | -<script type="text/javascript"> | ||
201 | - $(function () { | ||
202 | - | ||
203 | - editorcontent = new baidu.editor.ui.Editor(); | ||
204 | - editorcontent.render('content'); | ||
205 | - try { | ||
206 | - editorcontent.sync(); | ||
207 | - } catch (err) { | ||
208 | - } | ||
209 | - | ||
210 | - $('.btn-cancel-thumbnail').click(function () { | ||
211 | - $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png'); | ||
212 | - $('#thumbnail').val(''); | ||
213 | - }); | ||
214 | - | ||
215 | - }); | ||
216 | - $(function () { | ||
217 | - $('.btn-cancel-thumbnails').click(function () { | ||
218 | - $('#thumbnails-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png'); | ||
219 | - $('#thumbnails').val(''); | ||
220 | - }); | ||
221 | - | ||
222 | - }); | 202 | +<script> |
223 | 203 | ||
224 | </script> | 204 | </script> |
225 | </body> | 205 | </body> |
@@ -55,11 +55,7 @@ | @@ -55,11 +55,7 @@ | ||
55 | <td><input class="form-control" type="text" name="price" id="source" value="{$data.price}" | 55 | <td><input class="form-control" type="text" name="price" id="source" value="{$data.price}" |
56 | placeholder="请输入售价"></td> | 56 | placeholder="请输入售价"></td> |
57 | </tr> | 57 | </tr> |
58 | - <tr> | ||
59 | - <th>定价</th> | ||
60 | - <td><input class="form-control" type="text" name="pricing" value="{$data.pricing}" | ||
61 | - placeholder="请输入定价"></td> | ||
62 | - </tr> | 58 | + |
63 | <tr> | 59 | <tr> |
64 | <th>商品说明</th> | 60 | <th>商品说明</th> |
65 | <td> | 61 | <td> |
@@ -162,6 +158,11 @@ | @@ -162,6 +158,11 @@ | ||
162 | class="btn btn-default btn-sm">选择图片</a> | 158 | class="btn btn-default btn-sm">选择图片</a> |
163 | </td> | 159 | </td> |
164 | </tr> | 160 | </tr> |
161 | + <tr> | ||
162 | + <th>定价</th> | ||
163 | + <td><input class="form-control" type="text" name="pricing" value="{$data.pricing}" | ||
164 | + placeholder="请输入定价"></td> | ||
165 | + </tr> | ||
165 | </table> | 166 | </table> |
166 | <div class="form-group"> | 167 | <div class="form-group"> |
167 | <div class="col-sm-offset-2 col-sm-10"> | 168 | <div class="col-sm-offset-2 col-sm-10"> |
@@ -215,6 +216,7 @@ | @@ -215,6 +216,7 @@ | ||
215 | </div> | 216 | </div> |
216 | </td> | 217 | </td> |
217 | </tr> | 218 | </tr> |
219 | + | ||
218 | </table> | 220 | </table> |
219 | </div> | 221 | </div> |
220 | </div> | 222 | </div> |
@@ -503,7 +503,11 @@ | @@ -503,7 +503,11 @@ | ||
503 | } | 503 | } |
504 | 504 | ||
505 | $.post("{:url('Salesmangoods/Salesman_goods_add')}",{show_img:show_img,thumbnail:thumbnail,book_name:book_name,money:money,price:price,pricing:pricing,instr:instr,book_number:book_number,paper:paper,book_size:book_size,binding:binding,author:author,press:press,press_time:press_time,suit:suit,grade:grade,img0:img0,img1:img1,img2:img2,printing:printing},function(data){ | 505 | $.post("{:url('Salesmangoods/Salesman_goods_add')}",{show_img:show_img,thumbnail:thumbnail,book_name:book_name,money:money,price:price,pricing:pricing,instr:instr,book_number:book_number,paper:paper,book_size:book_size,binding:binding,author:author,press:press,press_time:press_time,suit:suit,grade:grade,img0:img0,img1:img1,img2:img2,printing:printing},function(data){ |
506 | - if(data){ | 506 | + if(data == 3){ |
507 | + alert('添加失败,业务员书籍不能超过8本'); | ||
508 | + }else if(data == 2){ | ||
509 | + alert('佣金不能大于售价'); | ||
510 | + }else if(data){ | ||
507 | window.location.href = "{:url('salesmangoods/salesman_goods')}"; | 511 | window.location.href = "{:url('salesmangoods/salesman_goods')}"; |
508 | }else{ | 512 | }else{ |
509 | alert('添加失败'); | 513 | alert('添加失败'); |
-
请 注册 或 登录 后发表评论