thinkerDetail.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import '../../css/bootstrap.less';
  2. import 'bootstrap/dist/js/bootstrap.js';
  3. import '../../css/public.css';
  4. import '../../js/public.js';
  5. import '../../css/thinkTank/thinkerDetail.css';
  6. import {
  7. message
  8. } from '../tools.js';
  9. var addConsultorder = function () {
  10. let userId = $('#userId').val();
  11. $.ajax({
  12. method: "post",
  13. dataType: "json",
  14. crossDomain: false,
  15. url: globalConfig.context + '/api/user/consultorder/add',
  16. data: {
  17. toUserId: userId
  18. },
  19. success: function (data) {
  20. if (data.error && data.error.length) {
  21. message(data.error[0].message);
  22. } else {
  23. message('提交会员服务订单成功!');
  24. setTimeout("window.location.href = globalConfig.context + '/user/account/index.html#consultList'", 3000);
  25. };
  26. }.bind(this),
  27. });
  28. };
  29. var consultClick = function () {
  30. $.ajax({
  31. method: "get",
  32. dataType: "json",
  33. url: globalConfig.context + "/api/user/consultorder/price"
  34. }).done(function (data) {
  35. if (data.error && data.error.length) {
  36. message(data.error[0].message);
  37. } else {
  38. $('#modal-content').empty();
  39. $('#modal-content').append("预约该专家的线下咨询需要支付 " + data.data + " 元的咨询费,是否确认提交预约订单?");
  40. $('#myModal').modal('show');
  41. }
  42. });
  43. };
  44. $(function () {
  45. $('#consultBtn').click(function () {
  46. if (userData && userData.mobile) {
  47. if (userData.lvl > 0) {
  48. consultClick()
  49. } else {
  50. message('请先进行实名认证,通过以后才能申请高级会员!');
  51. setTimeout("window.location.href = globalConfig.context + '/user/account/index.html#normal'", 3000);
  52. }
  53. } else {
  54. $('.login').fadeIn(800)
  55. }
  56. });
  57. $('#submitOrder').click(function () {
  58. addConsultorder()
  59. });
  60. })