123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- {extend name='admin@main'}
- {block name="button"}
- <a data-dbclick class="layui-btn layui-btn-sm" data-open='{:url("add")}'>添加盲盒</a>
- {/block}
- {block name="content"}
- <div class="think-box-shadow">
- {include file='goods1/index_search'}
- <table class="layui-table margin-top-10" lay-skin="line">
- {notempty name='list'}
- <thead>
- <tr>
- <th class='text-left nowrap'>盲盒名称</th>
- <th class='text-left nowrap'>封面</th>
- <th class='text-left nowrap'>售价</th>
- <th class='text-left nowrap'>库存</th>
- <th class='text-left nowrap'>剩余库存</th>
- <th class="text-left nowrap">发行时间</th>
- <th class="text-left nowrap">添加时间</th>
- <th class="text-left nowrap">状态</th>
- <th class="text-left nowrap">操作</th>
- </tr>
- </thead>
- {/notempty}
- <tbody>
- {foreach $list as $key=>$vo}
- <tr>
- <td class='text-left nowrap'>{$vo.name|default=''}</td>
- <td class='text-left nowrap'>
- <img data-tips-image="{$vo.cover|default=''}" src="{$vo.cover|default=''}" width="50px">
- </td>
- <td class='text-left nowrap'>{$vo.price|default=''}</td>
- <td class='text-left nowrap'>{$vo.inventory|default=''}</td>
- <td class='text-left nowrap'>{$vo.now_inventory|default=''}</td>
- <td class='text-left nowrap'>{$vo.sell_time|default=''}</td>
- <td class='text-left nowrap'>{$vo.create_at}</td>
- <td class='text-left nowrap'>
- {if $vo.status eq 0}已下架{else/}
- {eq name='vo.state' value='1'}抢购中{/eq}
- {eq name='vo.state' value='2'}即将开售{/eq}
- {eq name='vo.state' value='3'}已售罄{/eq}
- {/if}
- </td>
- <td class='text-left nowrap'>
- <a data-title="编辑盲盒" class="layui-btn layui-btn-sm" data-open='{:url("edit")}?id={$vo.id}'>编 辑</a>
- <a data-title="收藏记录" class="layui-btn layui-btn-sm" data-open='{:url("/store/collect_info/index")}?goods_id={$vo.id}'>收藏记录</a>
- {if $vo.status eq 1}
- <span class="layui-btn layui-btn-sm layui-btn-warm" onclick="btn_confirm('下架','down','{$vo.id}');">下 架</span>
- {else}
- <span class="layui-btn layui-btn-sm layui-btn-warm" onclick="btn_confirm('上架','up','{$vo.id}');">上 架</span>
- {/if}
- <a data-title="赠送" class="layui-btn layui-btn-sm" data-modal='{:url("send")}?id={$vo.id}'>赠送</a>
- <a class='layui-btn layui-btn-normal layui-btn-sm dr' id="dr" style="background-color:#DC2219;margin-right: 10px;width: 65px " onclick="changename('{$vo.id}')">
- 批量赠送
- </a>
- {if $vo.status eq 0}
- <span data-title="删除盲盒" class="layui-btn layui-btn-sm layui-btn-danger" onclick="btn_confirm('删除','del','{$vo.id}');" >删 除</span>
- {/if}
- <a data-title="藏品管理" class="layui-btn layui-btn-sm" data-open='{:url("store/blind_box/index")}?coll_id={$vo.id}'>藏品管理</a>
- </td>
- </tr>
- {/foreach}
- </tbody>
- </table>
- {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
- </div>
- <script>
- function btn_confirm(msg,fun,id) {
- layer.confirm('请确定是否'+msg, {btn: ['确定', '取消'], title: "提示"}, function () {
- var url = "/store/goods1/"+fun;
- layer.closeAll();
- $.ajax({
- type: "post",
- url: url,
- data: {id:id},
- dataType: "json",
- async: false,
- success: function (data) {
- layer.msg(data.info);
- setTimeout(function () {
- window.location.reload();
- },1000)
- }
- });
- });
- }
- var co_id = ''
- function changename(val){
- co_id = val
- }
- layui.use('upload', function(){
- var upload = layui.upload;
- //执行实例
- var uploadInst = upload.render({
- elem: '.dr' //绑定元素
- ,url: 'admin/api.plugs/upload'
- ,accept: 'file', //普通文件,
- before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
- console.log(obj)
- }
- ,done: function(res){
- console.log(co_id)
- console.log(res)
- if (res.uploaded == true){
- var value = {path:res.key,c_id:co_id,url:res.url}
- $.ajax({
- url:"/store/goods1/import",
- type:'get',
- data:value
- ,success:function(result){
- console.log(result);
- if (result.code==1){
- layer.msg('赠送成功',{time:2000,end:function () {
- location.reload();
- }});
- }else if (result.code==2){
- layer.open({
- type:1,
- area:['500px', '500px'],
- content:'成功:'+result.data.success+',失败:'+result.data.error+'<br />'+
- '错误号码:<br />'+result.data.phone_error,
- btn:['导出错误号码'],
- yes:function (index) {
- var url = '/store/goods1/get_excl';
- var params = {'phone': result.data.phone_error};
- jsSubmit(url, params);
- }
- });
- }else if (result.code==3){
- layer.msg(result.info,{icon: 5});
- }
- }
- });
- }else {
- layer.msg(res.error.message,{icon: 5});
- }
- }
- ,error: function(){
- layer.msg('上传失败');
- }
- });
- });
- function jsSubmit(url, params, method = "get")
- {
- var form = $("<form></form>");
- form.attr({"method": method, "action": url});
- params = JSON.stringify(params.phone)
- var input = $("<input type='hidden'>");
- input.attr("name", 'phone');
- input.val(params);
- form.append(input);
- $("html").append(form);
- form.submit();
- }
- </script>
- {/block}
|