| | |
| | | form = layui.form, |
| | | laydate = layui.laydate, |
| | | eleTree = layui.eleTree, |
| | | member = [[${member}]], |
| | | $view = $('#score-goods-add'), |
| | | layedit = layui.layedit, |
| | | upload = layui.upload, |
| | |
| | | form.render(); |
| | | laydate.render({ |
| | | elem: '#febs-form-group-date' |
| | | }); |
| | | |
| | | formSelects.render(); |
| | | |
| | | formSelects.config('user-add-goods', { |
| | | searchUrl: ctx + 'admin/goodsCategory/categorys', |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | beforeSuccess: function (id, url, searchVal, result) { |
| | | var data = result.data; |
| | | var tranData = []; |
| | | for (var i = 0; i < data.length; i++) { |
| | | tranData.push({ |
| | | name: data[i].name, |
| | | value: data[i].id |
| | | }) |
| | | } |
| | | result.data = tranData; |
| | | return result; |
| | | }, |
| | | success: function () { |
| | | // formSelects.value('user-add-goods', result.id); |
| | | }, |
| | | error: function (id, url, searchVal, err) { |
| | | console.error(err); |
| | | febs.alert.error('获取分类列表失败'); |
| | | } |
| | | }); |
| | | |
| | | //普通图片上传 |
| | |
| | | |
| | | form.on('submit(score-goods-add-form-submit)', function (data) { |
| | | data.field.goodsType = 2; |
| | | // febs.post(ctx + 'admin/goods/addMallGoods', data.field, function () { |
| | | // layer.closeAll(); |
| | | // febs.alert.success('新增成功'); |
| | | // $('#febs-score-goods').find('#query').click(); |
| | | // }); |
| | | |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/goods/addMallGoods', |
| | |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==0){ |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success('新增成功'); |
| | | $('#febs-score-goods').find('#query').click(); |