sms_index.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. $(document).ready(function(){
  2. switch_sms_type();
  3. switch_send_type();
  4. $("select[name='sms_type']").bind("change",function(){
  5. switch_sms_type();
  6. });
  7. $("select[name='send_type']").bind("change",function(){
  8. switch_send_type();
  9. });
  10. });
  11. //切换sms_type, 短信类型
  12. function switch_sms_type()
  13. {
  14. var sms_type = $("select[name='sms_type']").val();
  15. if(sms_type==0) //普通短信
  16. {
  17. $("#deal_id").hide();
  18. $("input[name='deal_id']").val('');
  19. }
  20. else
  21. {
  22. $("#deal_id").show();
  23. }
  24. }
  25. //切换发送方式
  26. function switch_send_type()
  27. {
  28. var send_type = $("select[name='send_type']").val();
  29. if(send_type==0) //按会员组
  30. {
  31. $("#city_id").hide();
  32. $("#group_id").hide();
  33. $("#send_define_data").hide();
  34. $("#group_id").show();
  35. $("select[name='city_id']").val(0);
  36. $("textarea[name='send_define_data']").val('');
  37. }
  38. else if(send_type==1) //按地区
  39. {
  40. $("#city_id").hide();
  41. $("#group_id").hide();
  42. $("#send_define_data").hide();
  43. $("#city_id").show();
  44. $("select[name='group_id']").val(0);
  45. $("textarea[name='send_define_data']").val('');
  46. }
  47. else
  48. {
  49. //只发送自定义
  50. $("#city_id").hide();
  51. $("#group_id").hide();
  52. $("#send_define_data").hide();
  53. $("#send_define_data").show();
  54. $("select[name='city_id']").val(0);
  55. $("select[name='group_id']").val(0);
  56. }
  57. }
  58. function gen_deal_sms()
  59. {
  60. var deal_id = $("input[name='deal_id']").val();
  61. $.ajax({
  62. url: ROOT+"?"+VAR_MODULE+"="+MODULE_NAME+"&"+VAR_ACTION+"=gen_deal_sms&id="+deal_id,
  63. data: "ajax=1",
  64. dataType: "json",
  65. success: function(obj){
  66. if(obj.status==0)
  67. {
  68. alert(LANG['NO_EXIST_DEAL']);
  69. $("input[name='deal_id']").val('');
  70. }
  71. else
  72. {
  73. if($("textarea[name='content']").val()=='')
  74. {
  75. $("textarea[name='content']").val(obj.data);
  76. }
  77. }
  78. }
  79. });
  80. }