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.
 
 
 
 

119 lines
2.4 KiB

  1. var urlstr = base_api + 'index.php';
  2. var user_id = '';
  3. var prod_id = '';
  4. window.onload = function(){
  5. user_id = getPar('user_id');
  6. prod_id = getPar('prod_id');
  7. var data = {
  8. tp:'supply_dataInfo_execUser',
  9. user_id:user_id,
  10. operate:'detail'
  11. }
  12. console.log(data);
  13. $.ajax({
  14. url: urlstr, //请求地址
  15. type: "post", //请求方式
  16. data: data,
  17. async: false,
  18. dataType: "json",
  19. success: function(data) {
  20. if(data.code == 0) {
  21. console.log(data);
  22. reloadData(data);
  23. }else{
  24. console.log(data.info);
  25. }
  26. }
  27. });
  28. }
  29. //加载内容
  30. function reloadData(data){
  31. $('#user_name').val(data.list[0].user_name);
  32. $('#real_name').val(data.list[0].true_name);
  33. $('#tel').val(data.list[0].phone_no);
  34. $('#change_pwd').attr('resetid',data.list[0].id);
  35. $('#total_save_btn').attr('saveid',data.list[0].id);
  36. }
  37. //重置密码
  38. function changePassword(obj){
  39. var value = $(obj).attr('resetid');
  40. var data = {
  41. tp:'supply_dataInfo_execUser',
  42. user_id:value,
  43. operate:'update_password'
  44. }
  45. console.log('重置参数');
  46. console.log(data);
  47. $.ajax({
  48. url: urlstr, //请求地址
  49. type: "post", //请求方式
  50. data: data,
  51. async: false,
  52. dataType: "json",
  53. success: function(data) {
  54. if(data.code == 0) {
  55. ZZAlertInfo(data.info);
  56. }else{
  57. ZZAlertInfo(data.info);
  58. }
  59. }
  60. });
  61. }
  62. //保存按钮
  63. function saveInfo(obj){
  64. var value = $(obj).attr('saveid');
  65. var user_name = $('#user_name').val();
  66. var real_name = $('#real_name').val();
  67. var tel = $('#tel').val();
  68. var data = {
  69. tp:'supply_dataInfo_execUser',
  70. user_id:value,
  71. operate:'update',
  72. phone_no:tel,
  73. true_name:real_name,
  74. user_name:user_name
  75. }
  76. console.log('更新参数');
  77. console.log(data);
  78. $.ajax({
  79. url: urlstr, //请求地址
  80. type: "post", //请求方式
  81. data: data,
  82. async: false,
  83. dataType: "json",
  84. success: function(data) {
  85. if(data.code == 0) {
  86. ZZAlertInfo(data.info,function(){
  87. window.location.href = './account_list.html?prod_id='+prod_id;
  88. });
  89. }else{
  90. ZZAlertInfo(data.info);
  91. }
  92. }
  93. });
  94. }
  95. //得到url上的参数
  96. function getPar(par){
  97. var local_url = document.location.href;
  98. local_url = decodeURI(local_url);
  99. var get = local_url.indexOf(par +"=");
  100. if(get == -1){
  101. return false;
  102. }
  103. var get_par = local_url.slice(par.length + get + 1);
  104. var nextPar = get_par.indexOf("&");
  105. if(nextPar != -1){
  106. get_par = get_par.slice(0, nextPar);
  107. }
  108. return get_par;
  109. }