<div class="layui-form-item stock">
            <label class="layui-form-label required">标题</label>
            <div class="layui-input-block">
                <input type="text" name="title" id="title" lay-verify="required" placeholder="输入标题" autocomplete="off" class="layui-input"  value="<?=$row['title']?>" >
              <tip id="demo" class="goods" ts-selected="<?=$row['bid']?>">点击获取商品</tip>
            </div>
 </div>

 <script>
 	
    layui.use(['table', 'form', 'tableSelect'], function () {
        var $ = layui.jquery,
            table = layui.table,
            form = layui.form,
            tableSelect = layui.tableSelect;

        var a=tableSelect.render({
            elem: '#demo',
            searchKey: 'title',
            checkedKey: 'id',
            searchPlaceholder: '输入商品名称',
            table: {
                url: "<?=u("app","list",array("table"=>"goods","status"=>1,"oid"=>$row['id']?$row['id']:0))?>",
                cols: [[
                    { type: 'radio' },
                    { field: 'id', title: 'ID', width: 50 },
                    { field: 'title', title: '商品名称' },
                    { field: 'sku', title: 'sku' },
                  
                ]]
            },
            done: function (elem, data) {
            	form.render()
                var NEWJSON = []
                var sdata=[]
                
                //tableSelect.render("#demo"); //表格重载
                layui.each(data.data, function (index, item) {
                	var temp={}
                    sku=item.sku?"_"+item.sku:"";
                    NEWJSON.push(item.title+sku)
                    $("#bid").val(item.id);
                })
            
                $("#title").val(NEWJSON.join(","))
            }
        })


      

    });

</script>

<style>
	
#demo{cursor: pointer;}
</style>