You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

74 lines
1.4 KiB

  1. var urlstr = base_api + 'index.php';
  2. var prod_id = '';
  3. window.onload = function(){
  4. prod_id = getPar('prod_id');
  5. }
  6. function saveBtnDidClicked(){
  7. var user_name = $('#user_name').val();
  8. var name = $('#name').val();
  9. var tel = $('#tel').val();
  10. if (user_name == '') {
  11. ZZAlertInfo('用户名不能为空!');
  12. return;
  13. }
  14. if (name == '') {
  15. ZZAlertInfo('真实姓名不能为空!');
  16. return;
  17. }
  18. if (tel == '') {
  19. ZZAlertInfo('手机号不能为空!');
  20. return;
  21. }
  22. var data = {
  23. tp:'supply_dataInfo_execUser',
  24. supplier_id:prod_id,
  25. user_name:user_name,
  26. true_name:name,
  27. phone_no:tel,
  28. operate:'insert'
  29. }
  30. $.ajax({
  31. url:urlstr, //请求地址
  32. data:data,
  33. type: "post",
  34. dataType: "json",
  35. success: function (data) {
  36. if(data.code == "0"){
  37. console.log(data);
  38. ZZAlertInfo(data.info,function(){
  39. window.location.href = './account_list.html?prod_id='+prod_id;
  40. });
  41. }else{
  42. ZZAlertInfo(data.info);
  43. }
  44. }
  45. });
  46. }
  47. //得到url上的参数
  48. function getPar(par){
  49. var local_url = document.location.href;
  50. local_url = decodeURI(local_url);
  51. var get = local_url.indexOf(par +"=");
  52. if(get == -1){
  53. return false;
  54. }
  55. var get_par = local_url.slice(par.length + get + 1);
  56. var nextPar = get_par.indexOf("&");
  57. if(nextPar != -1){
  58. get_par = get_par.slice(0, nextPar);
  59. }
  60. return get_par;
  61. }