goods-table.js 646 B

1234567891011121314151617181920212223242526272829303132333435
  1. $(document).ready(function() {
  2. initSelectData()
  3. })
  4. function initSelectData() {
  5. //加载机构类型
  6. var res=getData('/goods/type');
  7. $.each(res.data, function(index, item) {
  8. $('#goods-type-select').append(new Option(item.type, item.id)); // 下拉菜单里添加元素
  9. });
  10. layui.form.render("select");
  11. }
  12. /**
  13. * 按照id删除商品
  14. * @param {Integer} goodsId 商品id
  15. */
  16. function deleteGoodsById(goodsId){
  17. $.ajax({
  18. url:getRootUrl()+'/goods/delete',
  19. method:'GET',
  20. headers:{
  21. token:getToken()
  22. },
  23. dataType:'json',
  24. data:{
  25. goodsId:goodsId
  26. },
  27. success(e){
  28. if (e.success) {
  29. layer.msg("删除成功")
  30. }
  31. }
  32. })
  33. }