yijia-webman/app/view/goods/addSale.html

81 lines
2.7 KiB
HTML

<form class="layui-form eject-layuiBox" data-action="/goods/addSale">
<div class="layui-form-item">
<label class="layui-form-label">商品</label>
<div class="layui-input-block">
<div id="goods"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">销售总价</label>
<div class="layui-input-block">
<input class="layui-input" type="number" name="total_price" maxlength="60" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">销售时间</label>
<div class="layui-input-block">
<input type="text" name="sold_at" class="layui-input" id="sold_at" placeholder="yyyy-MM-dd HH:mm:ss">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">大包销量</label>
<div class="layui-input-block">
<input class="layui-input" type="number" name="num" maxlength="60" value="0" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">小包销量</label>
<div class="layui-input-block">
<input class="layui-input" type="number" name="num_small" maxlength="60" value="0" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">备注</label>
<div class="layui-input-block">
<input class="layui-input" type="text" name="remark" maxlength="200" />
</div>
</div>
<div class="layui-input-block">
<button type="button" class="layui-btn layui-btn-sm" lay-submit lay-filter="submitAll">保存</button>
</div>
</form>
<script src="/js/xm-select.js"></script>
<script>
$(document).ready(function(){
var laydate = layui.laydate;
laydate.render({
elem: '#sold_at'
});
var book = xmSelect.render({
el: '#goods',
filterable : true, //开启搜索
remoteSearch: true,
radio : true, //开启单选模式
clickClose : true, //是否点击选项后自动关闭下拉框
name: 'goods_id', //表单提交时的name
paging: true,
data : [],
remoteMethod: function(val, cb, show){
$.get('/goods/apiGetList', {'name':val, 'size': 50}, function(data){
var goodsList = [];
data.goodsList.data.forEach(element => {
goodsList.push({
name: element.name,
value: element.id
})
});
cb(goodsList);
})
}
});
});
</script>