goodsList.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <?php
  2. use yii\widgets\LinkPager;
  3. use common\components\stringUtil;
  4. ?>
  5. <div class="page-title">
  6. <div class="title-env">
  7. <h1 class="title"><?= $categoryName ?> 分类下的商品</h1>
  8. </div>
  9. <div class="breadcrumb-env">
  10. <ol class="breadcrumb bc-1">
  11. <li>
  12. <a href="/"><i class="fa-home"></i>Home</a>
  13. </li>
  14. <li>
  15. <a href="javascript:void(0)">商城管理</a>
  16. </li>
  17. <li class="active">
  18. <strong>分类管理</strong>
  19. </li>
  20. </ol>
  21. </div>
  22. </div>
  23. <div class="panel panel-default">
  24. <div class="panel-body">
  25. <div class="dataTables_wrapper form-inline dt-bootstrap no-footer">
  26. <div name="xhQrTip" style="position:absolute;border-color: #8dc63f;width:110px;height:122px;z-index:9999;display:none;background:white;border:1px solid #ccc;">
  27. <div style="background:red;">
  28. <a href="javascript:void(0)" style="color:#68b828;float:right;z-index:9999;" <i="" class="fa-times"></a>
  29. </div>
  30. <div></div>
  31. </div>
  32. <div class="table-responsive">
  33. <table class="table table-bordered table-striped table-hover" >
  34. <thead>
  35. <tr class="active">
  36. <th class="no-sorting hidden-xs"><input type="checkbox"></th>
  37. <th class="hidden-xs">ID</th>
  38. <th>封面</th>
  39. <th>标题</th>
  40. <th class="hidden-xs">价格</th>
  41. <th class="hidden-xs">销量</th>
  42. <th class="hidden-xs">状态</th>
  43. <th class="hidden-xs">创建时间</th>
  44. <th>操作</th>
  45. </tr>
  46. </thead>
  47. <tbody class="middle-align">
  48. <?php foreach($list as $key => $val){ ?>
  49. <tr>
  50. <td class="hidden-xs"><input type="checkbox"></td>
  51. <td class="hidden-xs"><?php echo $val['id'];?></td>
  52. <td>
  53. <img src="/images/newGrey.gif" class="lazy" data-original="<?php echo Yii::$app->params['imgUrl'].$val['cover'];?>" onerror="javascript:this.src='/images/nopicture.png';" width="20" />
  54. </td>
  55. <td>
  56. <?= stringUtil::subStringUtf8($val['goodsName'],10,'…')?>&nbsp;
  57. <a data-urlqrcode="<?= $val['urlQrCode'] ?>" data-id="<?= $val['id'] ?>" name="qrShow" href="javascript:void(0)" style="color:#68b828;"><i class="fa-qrcode"></i></a>
  58. </td>
  59. <td class="hidden-xs"><?php echo $val['price'];?></td>
  60. <td class="hidden-xs"><?php echo $val['sold'];?></td>
  61. <td class="hidden-xs"><?php if($val['status'] == 0) echo '上架'; else echo '下架'; ?></td>
  62. <td class="hidden-xs"><?php echo $val['createTime'];?></td>
  63. <td>
  64. </td>
  65. </tr>
  66. <?php } ?>
  67. </tbody>
  68. </table>
  69. </div>
  70. <div class="row">
  71. <div>
  72. <!--
  73. <div style="display:inline-block;margin-left:15px;">
  74. <label><select name="example-1_length"
  75. aria-controls="example-1" class="form-control">
  76. <option value="0">批量操作</option>
  77. <option value="1">批量下架</option>
  78. <option value="2">批量删除</option>
  79. </select>
  80. </label>
  81. <input class="btn btn-secondary btn-single" type="submit" name="" value="确认" />
  82. </div>
  83. -->
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. <!-- footer -->
  90. <?php
  91. use backend\widgets\FooterWidget;
  92. ?>
  93. <?= FooterWidget::widget()?>
  94. <!-- footer -->
  95. <!-- modal 确认提醒框 -->
  96. <div class="modal fade" id="confirmMention">
  97. <div class="modal-dialog" style="height:300px;">
  98. <div class="modal-content">
  99. <div class="modal-header">
  100. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  101. <h4 class="modal-title">消息提示</h4>
  102. </div>
  103. <div class="modal-body">
  104. 确认<span></span>?<input type="hidden" name="requestUrl" value="" />
  105. </div>
  106. <div class="modal-footer">
  107. <button type="button" class="btn btn-info" name="confirmOk" >确认</button>
  108. <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. <!-- Modal 查看商品-->
  114. <div class="modal fade" id="modal-goodsDetail">
  115. <div class="modal-dialog">
  116. <div class="modal-content">
  117. <div class="modal-header">
  118. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  119. <h4 class="modal-title">商品详细</h4>
  120. </div>
  121. <div class="modal-body">
  122. </div>
  123. <div class="modal-footer">
  124. <button type="button" class="btn btn-info" data-dismiss="modal">确认</button>
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. <script>
  130. //确认提醒操作
  131. $(function(){
  132. jQuery("a[name=dealGoods]").click(function(){
  133. var url = $(this).attr('data-url');
  134. var msg = $(this).attr('data-msg');
  135. $("#confirmMention .modal-body span").text(msg);
  136. $("#confirmMention .modal-body input").val(url);
  137. jQuery('#confirmMention').modal('show', {backdrop: 'fade'}).css({
  138. 'margin-top': function () {
  139. var modalHeight = jQuery("#confirmMention").find('.modal-dialog').height();
  140. return ($(window).height() / 2 - (modalHeight / 2));
  141. }
  142. });
  143. });
  144. //点击确认操作
  145. jQuery("button[name=confirmOk]").click(function(){
  146. var url = $("#confirmMention .modal-body input").val();
  147. $.ajax({type:"GET",url:url,async:false,dataType:'json',success:function(data){
  148. if(data.code == 'A0001'){
  149. $('#confirmMention').modal('hide');
  150. window.location.reload();
  151. }
  152. }});
  153. });
  154. });
  155. //推荐商品
  156. $(function(){
  157. jQuery("a[name=recommendGoods]").click(function(){
  158. var url = $(this).attr('data-url');
  159. $.ajax({type:"GET",url:url,async:false,dataType:'json',success:function(data){
  160. if(data.code == 'A0001'){
  161. xhPopMsg(data.msg,1200);//调用定时浮层 XXX毫秒后消失
  162. }else{
  163. xhPopMsg(data.msg,2000);//调用定时浮层 XXX毫秒后消失
  164. }
  165. }});
  166. });
  167. });
  168. $("a[name=qrShow]").click(function(){
  169. var left = $(this).position().left;
  170. var top = $(this).position().top;
  171. var id = $(this).attr('data-id');
  172. var urlqrcode = $(this).attr('data-urlqrcode');
  173. var object = $(this);
  174. $("div[name=xhQrTip]").children('div').eq(1).html('<img src="/images/loading.gif" style="margin:47px 0 0 47px;" />');
  175. $("div[name=xhQrTip]").css('left',left).css('top',top - 110).css('display','block');
  176. if(urlqrcode.length > 0){
  177. $("div[name=xhQrTip]").children('div').eq(1).html('<img width="105" src="<?= Yii::$app->params['imgUrl'] ?>'+urlqrcode+'" />');
  178. $("div[name=xhQrTip]").css('left',left).css('top',top - 110).css("padding","2px").fadeIn();
  179. }else{
  180. $.ajax({type:"get",url:'/goods/show-goods-qrcode?id='+id,async:true,dataType:'json',success:function(data){
  181. if(data.code == 'A0001'){
  182. var imgUrl = data.data.url;
  183. object.attr('data-urlqrcode',imgUrl);
  184. $("div[name=xhQrTip]").children('div').eq(1).html('<img width="105" src="<?= Yii::$app->params['imgUrl'] ?>'+imgUrl+'" />');
  185. $("div[name=xhQrTip]").css('left',left).css('top',top - 110).css("padding","2px").fadeIn();
  186. }
  187. }});
  188. }
  189. });
  190. $("div[name=xhQrTip]").click(function(){
  191. $(this).css("display","none");
  192. });
  193. </script>