function.js 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. //点击列表弹出框
  2. function contentHide(obj){
  3. if($(obj).find(".hide_content").hasClass("show_content")){
  4. init();
  5. } else {
  6. init();
  7. $(obj).find(".hide_content").addClass("show_content");
  8. $(obj).find("i").addClass("layui-icon-triangle-d");
  9. $(obj).find(".content_div_input").addClass("content_div_input_click");
  10. }
  11. }
  12. //列表恢复初始化
  13. function init(){
  14. $(".hide_content").removeClass("show_content");
  15. $(".content_div_input i").removeClass("layui-icon-triangle-d");
  16. $(".content_column i").addClass("layui-icon-triangle-r");
  17. $(".content_div_input").removeClass("content_div_input_click");
  18. }
  19. //查询报价单
  20. function getQuotation(page, limit, startTime, endTime, destination){
  21. layer.load(3);
  22. $.ajax({
  23. url: "/privateOrder/getPrivateOrder",
  24. type: "get",
  25. data: {
  26. "page": page,
  27. "limit": limit,
  28. "startTime": startTime,
  29. "endTime": endTime,
  30. "destination": destination,
  31. "orderType": idVal
  32. },
  33. headers: {"token": token},
  34. dataType: "json",
  35. success: (data) => {
  36. if(data.msg == "200"){
  37. $(".content_div div").remove();
  38. $.each(data.data, (index, item) => {
  39. var type = "待回答";
  40. var buttonElem = "<button class=\"ignore_button button_div_head\" onclick='ignoreClick(this)'><img src=\"/images/demandForSingle/ban.png\"/><span data-locale=\"hulue\">"+ paramReturn("忽略", parent.type) +"</span></button>\n" +
  41. "<button class=\"offer_button button_div_head\" onclick='offerClick(this)'><img src=\"/images/demandForSingle/offer.png\"/><span data-locale=\"tigongbaojia\">"+ paramReturn("提供报价", parent.type) +"</span></button>\n"
  42. if(item.orderType == 0){
  43. type = "待回答";
  44. }else if(item.orderType == 1){
  45. type = "已回答";
  46. buttonElem = "<button class=\"offer_button button_div_head\" onclick='offerClick(this)'><img src=\"/images/demandForSingle/offer.png\"/><span data-locale=\"xiugai\">"+ paramReturn("修改报价", parent.type) +"</span></button>\n";
  47. }else if(item.orderType == 5){
  48. type = "已完成";
  49. buttonElem = "<button class=\"offer_button button_div_head\" onclick='offerClick(this)'><img src=\"/images/demandForSingle/offer.png\"/><span data-locale=\"chakan\">"+ paramReturn("查看", parent.type) +"</span></button>\n";
  50. }else if(item.orderType == 3){
  51. type = "行程开始";
  52. buttonElem = "<button class=\"offer_button button_div_head\" onclick='offerClick(this)'><img src=\"/images/demandForSingle/offer.png\"/><span data-locale=\"chakan\">"+ paramReturn("查看", parent.type) +"</span></button>\n" +
  53. "<button class=\"offer_button button_div_head\" onclick='offerClick(this)' name='交通信息'><img src=\"/images/demandForSingle/offer.png\"/><span data-locale=\"jiaotongxinxi\">"+ paramReturn("交通信息", parent.type) +"</span></button>\n";
  54. }else if(item.orderType == 2){
  55. type = "已付费";
  56. buttonElem = "<button class=\"offer_button button_div_head\" onclick='offerClick(this)'><img src=\"/images/demandForSingle/offer.png\"/><span data-locale=\"chakan\">"+ paramReturn("查看", parent.type) +"</span></button>\n" +
  57. "<button class=\"offer_button button_div_head\" onclick='offerClick(this)' name='交通信息'><img src=\"/images/demandForSingle/offer.png\"/><span data-locale=\"jiaotongxinxi\">"+ paramReturn("交通信息", parent.type) +"</span></button>\n";
  58. }else if(item.orderType == 4){
  59. type = "行程结束";
  60. buttonElem = "<button class=\"offer_button button_div_head\" onclick='offerClick(this)'><img src=\"/images/demandForSingle/offer.png\"/><span data-locale=\"chakan\">"+ paramReturn("查看", parent.type) +"</span></button>\n" +
  61. "<button class=\"offer_button button_div_head\" onclick='offerClick(this)' name='交通信息'><img src=\"/images/demandForSingle/offer.png\"/><span data-locale=\"jiaotongxinxi\">"+ paramReturn("交通信息", parent.type) +"</span></button>\n";
  62. }else if(item.orderType == 6){
  63. type = "不感兴趣";
  64. }else if(item.orderType == 9){
  65. type = "取消行程";
  66. buttonElem = "<button class=\"offer_button button_div_head\" onclick='offerClick(this)'><img src=\"/images/demandForSingle/offer.png\"/><span data-locale=\"chakan\">"+ paramReturn("查看", parent.type) +"</span></button>\n";
  67. } else if(item.orderType == 12){
  68. type = "已上传交通信息";
  69. buttonElem = "<button class=\"offer_button button_div_head\" onclick='offerClick(this)'><img src=\"/images/demandForSingle/offer.png\"/><span data-locale=\"chakan\">"+ paramReturn("查看", parent.type) +"</span></button>\n" +
  70. "<button class=\"offer_button button_div_head\" onclick='offerClick(this)' name='交通信息'><img src=\"/images/demandForSingle/offer.png\"/><span data-locale=\"jiaotongxinxi\">"+ paramReturn("交通信息", parent.type) +"</span></button>\n";
  71. }
  72. $(".content_div").append("<div uuid="+ item.uuid +" class=\"content_column\">\n" +
  73. "<div class=\"content_div_input\">\n" +
  74. "<div class=\"head_name\" style=\"width: 5%;\">"+ (index + 1) +"</div>\n" +
  75. // "<div class=\"head_name\" style=\"width: 5%;\">\n" +
  76. // "<i class=\"layui-icon layui-icon-triangle-r\"></i>\n" +
  77. // "</div>\n" +
  78. "<div class=\"head_name\" style=\"width: 15%;\">"+ item.origin +"</div>\n" +
  79. "<div class=\"head_name\" style=\"width: 10%;\">"+ item.destination +"</div>\n" +
  80. "<div class=\"head_name\" style=\"width: 15%;\">"+ item.startTime +" - "+ item.endTime +"</div>\n" +
  81. "<div class=\"head_name\" style=\"width: 15%;\">"+ item.peopleNum +"</div>\n" +
  82. "<div class=\"head_name\" style=\"width: 10%;\">"+ item.budgetMin +" - "+ item.budgetMax +"</div>\n" +
  83. "<div class=\"head_name\" style=\"width: 10%;\">"+ type +"</div>\n" +
  84. "<div class=\"head_name\" style=\"width: 20%;\">\n" +
  85. buttonElem +
  86. "</div>\n" +
  87. "</div>\n" +
  88. "</div>")
  89. });
  90. //自定义样式分页
  91. laypage.render({
  92. elem: 'demo2'
  93. ,count: data.count
  94. ,theme: '#1E9FFF'
  95. , limit: limit
  96. , curr: page
  97. , jump: function (obj,first) {
  98. if (!first) {
  99. getQuotation(obj.curr,obj.limit, startTime, endTime);
  100. }
  101. }
  102. , prev: '<em><i class="layui-icon">&#xe603;</i></em>'
  103. , next: '<em><i class="layui-icon">&#xe602;</i></em>'
  104. });
  105. if(data.count != 0){
  106. parent.$(".layui-nav-child .message_num").html(data.count).show();
  107. } else {
  108. parent.$(".layui-nav-child .message_num").html(0).hide();
  109. }
  110. }
  111. layer.closeAll("loading");
  112. },
  113. error: () => {
  114. layer.alert(paramReturn("服务器异常,请联系管理员", parent.type), {icon: 2});
  115. layer.closeAll("loading");
  116. }
  117. });
  118. }
  119. //忽略
  120. function ignoreClick(obj){
  121. var uuid = $(obj).parent().parent().parent().attr("uuid");
  122. window.event.cancelBubble = true;//阻止冒泡
  123. layer.confirm('确认忽略吗?', function (index) {
  124. layer.load(3);
  125. $.ajax({
  126. url: "/privateOrder/addIgnore",
  127. type: "post",
  128. data: {
  129. "orderingUuid": uuid
  130. },
  131. headers: {"token": token},
  132. dataType: "json",
  133. success: (data) => {
  134. layer.msg(paramReturn("忽略成功", parent.type), {icon: 1});
  135. getQuotation(0, 7, startTime, endTime);//查询报价单数据渲染
  136. layer.closeAll("loading");
  137. },
  138. error: () => {
  139. layer.alert(paramReturn("服务器异常,请联系管理员", parent.type), {icon: 2});
  140. layer.closeAll("loading");
  141. }
  142. });
  143. })
  144. }
  145. //提供报价
  146. function offerClick(obj){
  147. var uuid = $(obj).parent().parent().parent().attr("uuid");
  148. var name = $(obj).attr("name");
  149. if(idVal == "2" && name != "交通信息"){
  150. window.location.href="planLook?uuid=" + uuid
  151. } else if(idVal == "2" && name == "交通信息"){
  152. window.location.href="trafficUpload?uuid=" + uuid
  153. } else {
  154. var count = getDemandCount(uuid);
  155. if(count >= 11){
  156. layer.msg("此订单已超出最大报价次数", {icon: 2});
  157. return false;
  158. }
  159. window.location.href="demandForSingleOffer?uuid=" + uuid
  160. }
  161. }
  162. //查询当前定制单是否超过十个人报价
  163. function getDemandCount(uuid){
  164. var count = 0;
  165. $.ajax({
  166. async: false,
  167. url: "/privateOrder/getDemandCount",
  168. type: "get",
  169. data: {
  170. "uuid": uuid
  171. },
  172. headers: {"token": token},
  173. dataType: "json",
  174. success: (data) => {
  175. count = data.data;
  176. },
  177. error: () => {
  178. layer.alert(paramReturn("服务器异常,请联系管理员", parent.type), {icon: 2});
  179. layer.closeAll("loading");
  180. }
  181. });
  182. return count;
  183. }