renwuwx.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. $(document).ready(function () {
  2. let url = window.location.search;
  3. var theRequest = new Object();
  4. if (url.indexOf("?") != -1) {
  5. var str = url.substr(1);
  6. strs = str.split("&");
  7. for (var i = 0; i < strs.length; i++) {
  8. theRequest[strs[i].split("=")[0]] = unescape(
  9. decodeURI(strs[i].split("=")[1])
  10. );
  11. }
  12. }
  13. // var TypeArr = ["抖音视频发布", "快手视频发布", "抖音评论", "快手评论"];
  14. var Ptid = theRequest.id;
  15. // var TypeArr = [
  16. // {
  17. // "name": "视频号发布50元",
  18. // "price": 50
  19. // },
  20. // {
  21. // "name": "视频号发布50元",
  22. // "price": 100
  23. // }
  24. // ]
  25. // console.log(Ptid);
  26. var TypeName = "", TypePrice = 15, ScBolean = false, jd_huati = "X话题";
  27. // $(".HoutaiContainerBoxChildFabu").on("click", function () {
  28. // if (Ptid == undefined) {
  29. // $(".HoutaiContainerBoxChildFabu").removeClass("HoutaiContainerBoxChildFabuActive");
  30. // $(this).addClass("HoutaiContainerBoxChildFabuActive");
  31. // TypeName = TypeArr[$(this).index() - 1].name;
  32. // TypePrice = TypeArr[$(this).index() - 1].price;
  33. // }
  34. // })
  35. const img = new Image();
  36. var TypeImgArr1 = [], TypeImgArr2 = [];
  37. if (Ptid != undefined) {
  38. ScBolean = true;
  39. var ListHtml1 = "", ListHtml2 = "", ListHtml3 = "", ListHtml5 = "", TypeImgArr3 = [], TypeImgArr5 = [];
  40. $.ajax({
  41. type: "post",
  42. url: window.baseUrl.requestApi + "/Admin/Taskorder/detail_video_wxqun_account",
  43. dataType: "json",
  44. data: {
  45. token: "b8e3bb6ef8747d7",
  46. t_id: Ptid
  47. },
  48. success: function (res) {
  49. if (res.code == "200") {
  50. var Data = res.data;
  51. // $(".HoutaiContainerBoxChildFabu:eq(1)").addClass("HoutaiContainerBoxChildFabuActive");
  52. TypePrice = 15;
  53. $("#ShipinRenwuYaoqiu").val(Data.task_require);
  54. TypeImgArr1.push(Data.task_require_img);
  55. TypeImgArr2 = Data.task_img_material;
  56. $.each(TypeImgArr1, function (index, value) {
  57. ListHtml2 += '<div class="HoutaiContainerDialogLine3ImgFile2" houchuan="' + 1 + '" imgurl=' + value + '>';
  58. ListHtml2 += '<img id="HoutaiContainerDialog3TPImg' + index + '" class="HoutaiContainerDialogTPImg" src="' + value + '" alt="">';
  59. ListHtml2 += '<div class="del2Imgs btn" ids="' + index + '" id="del3Img' + index + '">删除</div>';
  60. ListHtml2 += '</div>';
  61. })
  62. $("#uploaderImgContent2").before(ListHtml2);
  63. $.each(TypeImgArr2, function (index, value) {
  64. ListHtml3 += '<div class="HoutaiContainerDialogLine3ImgFile3" houchuan="' + 1 + '" imgurl=' + value + '>';
  65. ListHtml3 += '<img id="HoutaiContainerDialog3TPImg' + index + '" class="HoutaiContainerDialogTPImg" src="' + value + '" alt="">';
  66. ListHtml3 += '<div class="del3Imgs btn" ids="' + index + '" id="del3Img' + index + '">删除</div>';
  67. ListHtml3 += '</div>';
  68. })
  69. $("#uploaderImgContent3").before(ListHtml3);
  70. }
  71. }
  72. })
  73. }
  74. $("#TPImg2").on("click", function () {
  75. $("#uploadImg2").click();
  76. });
  77. $("#GTPImg2").on("click", function () {
  78. $("#uploadImg2").click();
  79. });
  80. let tpFilesNum1 = 0;
  81. let tpallUploaderNum1 = 0;
  82. let tpInputFile1 = document.getElementById("uploadImg2");
  83. let tpTheFile1;
  84. let tpFilesArr1 = [];
  85. let TpFilesArrChild1 = [];
  86. tpInputFile1.addEventListener('change', function () {
  87. tpTheFile1 = [];
  88. TpFilesArrChild1 = [];
  89. tpTheFile1 = tpInputFile1.files;
  90. TpFilesArrChild1.push(tpTheFile1[0]);
  91. tpFilesArr1 = TpFilesArrChild1;
  92. $(".HoutaiContainerDialogLine3ImgFile2").remove();
  93. async function processFiles(files) {
  94. for (let i = 0; i < files.length; i++) {
  95. const reader = new FileReader();
  96. const result = await new Promise((resolve, reject) => {
  97. reader.onload = () => resolve(reader.result);
  98. reader.onerror = reject;
  99. reader.readAsDataURL(files[i]);
  100. });
  101. let imgDataHtml = `<div class="HoutaiContainerDialogLine3ImgFile2" houchuan="2" imgurl = ${result}>
  102. <img id="HoutaiContainerDialog3TPImg${i}" class="HoutaiContainerDialogTPImg" src="${result}" alt="">
  103. <div class="del2Img btn" ids="${i}" id="del3Img${i}">删除</div>
  104. </div>`;
  105. $("#uploaderImgContent2").before(imgDataHtml);
  106. }
  107. }
  108. processFiles(tpFilesArr1);
  109. $("#uploadImg2").val("");
  110. });
  111. $(".HoutaiContainerDialogLineAddRight").on("click", ".del2Imgs", function (e) {
  112. e.stopPropagation();
  113. TypeImgArr1.splice($(this).attr("ids"), 1)
  114. $(this).parent().remove();
  115. $('div.del2Imgs').each(function (index) {
  116. $(this).attr('ids', index);
  117. });
  118. })
  119. $(".HoutaiContainerDialogLineAddRight").on("click", ".del2Img", function (e) {
  120. e.stopPropagation();
  121. var _this = $(this);
  122. tpFilesArr1.splice($(this).attr("ids"), 1)
  123. $(this).parent().remove();
  124. $('div.del2Img').each(function (index) {
  125. $(this).attr('ids', index);
  126. });
  127. });
  128. $(".HoutaiContainerDialogLineAddRight").on("click", ".HoutaiContainerDialogLine3ImgFile2", function (e) {
  129. img.src = $(this).attr("imgurl");
  130. if (!$(e.target).closest('.del1Img').length) {
  131. $(".bannerImgBJ").show();
  132. let imgurl = $(this).attr("imgurl");
  133. $(".bannerImg").attr("src", imgurl);
  134. }
  135. });
  136. $(".bannerImgBJ").on("click", function () {
  137. $(this).fadeOut(300);
  138. })
  139. // tupian 2
  140. $("#TPImg3").on("click", function () {
  141. $("#uploadImg3").click();
  142. });
  143. $("#GTPImg3").on("click", function () {
  144. $("#uploadImg3").click();
  145. });
  146. let tpFilesNum3 = 0;
  147. let tpallUploaderNum3 = 0;
  148. let tpInputFile3 = document.getElementById("uploadImg3");
  149. let tpTheFile3;
  150. let tpFilesArr3 = [];
  151. let TpFilesArrChild3 = [];
  152. console.log(tpFilesArr3)
  153. tpInputFile3.addEventListener('change', function () {
  154. if (TypeImgArr2.length > 0) {
  155. TypeImgArr2.forEach(item => {
  156. tpFilesArr3.push(item)
  157. })
  158. }
  159. tpTheFile3 = [];
  160. // 获取用户上传的文件对象
  161. tpTheFile3 = Array.from(tpInputFile3.files);
  162. //获取选择图片的个数
  163. let length = tpTheFile3.length;
  164. tpallUploaderNum3 += length;
  165. if (tpFilesArr3.length >= 2) {
  166. alert("超过图片上传最大数量");
  167. return
  168. } else {
  169. for (let j = 0; j < tpTheFile3.length; j++) {
  170. const file = tpTheFile3[j];
  171. TpFilesArrChild3.push(file);
  172. };
  173. if (TpFilesArrChild3.length > 2) {
  174. tpFilesArr3 = TpFilesArrChild3.slice(-2);
  175. } else {
  176. tpFilesArr3 = TpFilesArrChild3;
  177. }
  178. // }
  179. $(".HoutaiContainerDialogLine3ImgFile3").remove();
  180. if (Ptid != undefined) {
  181. ListHtml3 = ""
  182. if (tpFilesArr3.length == 1) {
  183. if (TypeImgArr2.length == 2) {
  184. TypeImgArr2.splice(0, 1)
  185. }
  186. } else if (tpFilesArr3.length == 2) {
  187. TypeImgArr2 = []
  188. }
  189. $.each(TypeImgArr2, function (index, value) {
  190. ListHtml3 += '<div class="HoutaiContainerDialogLine3ImgFile3" houchuan="' + 1 + '" imgurl=' + value + '>';
  191. ListHtml3 += '<img id="HoutaiContainerDialog3TPImg' + index + '" class="HoutaiContainerDialogTPImg" src="' + value + '" alt="">';
  192. ListHtml3 += '<div class="del3Imgs btn" ids="' + index + '" id="del3Img' + index + '">删除</div>';
  193. ListHtml3 += '</div>';
  194. })
  195. $("#uploaderImgContent3").before(ListHtml3);
  196. }
  197. async function processFiles(files) {
  198. for (let i = 0; i < files.length; i++) {
  199. const reader = new FileReader();
  200. const result = await new Promise((resolve, reject) => {
  201. reader.onload = () => resolve(reader.result);
  202. reader.onerror = reject;
  203. reader.readAsDataURL(files[i]);
  204. });
  205. let imgDataHtml = `<div class="HoutaiContainerDialogLine3ImgFile3" houchuan="2" imgurl = ${result}>
  206. <img id="HoutaiContainerDialog3TPImg${i}" class="HoutaiContainerDialogTPImg" src="${result}" alt="">
  207. <div class="del3Img btn" ids="${i}" id="del3Img${i}">删除</div>
  208. </div>`;
  209. $("#uploaderImgContent3").before(imgDataHtml);
  210. }
  211. }
  212. processFiles(tpFilesArr3);
  213. $("#uploadImg3").val("");
  214. }
  215. });
  216. $(".HoutaiContainerDialogLineAddRight").on("click", ".del3Imgs", function (e) {
  217. e.stopPropagation();
  218. TypeImgArr2.splice($(this).attr("ids"), 1)
  219. $(this).parent().remove();
  220. $('div.del3Imgs').each(function (index) {
  221. $(this).attr('ids', index);
  222. });
  223. })
  224. $(".HoutaiContainerDialogLineAddRight").on("click", ".del3Img", function (e) {
  225. e.stopPropagation();
  226. var _this = $(this);
  227. tpFilesArr3.splice($(this).attr("ids"), 1)
  228. $(this).parent().remove();
  229. $('div.del3Img').each(function (index) {
  230. $(this).attr('ids', index);
  231. });
  232. });
  233. $(".HoutaiContainerDialogLineAddRight").on("click", ".del3Img", function (e) {
  234. e.stopPropagation();
  235. var _this = $(this);
  236. tpFilesArr3.splice($(this).attr("ids"), 1)
  237. $(this).parent().remove();
  238. $('div.del3Img').each(function (index) {
  239. $(this).attr('ids', index);
  240. });
  241. });
  242. $(".HoutaiContainerDialogLineAddRight").on("click", ".HoutaiContainerDialogLine3ImgFile3", function (e) {
  243. img.src = $(this).attr("imgurl");
  244. img.onload = function () {
  245. };
  246. if (!$(e.target).closest('.del1Img').length) {
  247. $(".bannerImgBJ").show();
  248. let imgurl = $(this).attr("imgurl");
  249. $(".bannerImg").attr("src", imgurl);
  250. }
  251. });
  252. $(".bannerImgBJ").on("click", function () {
  253. $(this).fadeOut(300);
  254. })
  255. if (Ptid != undefined) {
  256. $(".HoutaiContainerBoxChildYaoqiuBtnSure").on("click", function () {
  257. if (!$("#ShipinRenwuYaoqiu").val()) {
  258. alert("请输入任务要求")
  259. } else {
  260. if ($(this).text() == "正在上传中") {
  261. alert("正在上传中!请耐心等待!!!");
  262. return;
  263. }
  264. $(this).text("正在上传中");
  265. $(this).css("background", "#575f6e");
  266. var formFile = new FormData();
  267. formFile.append("token", "b8e3bb6ef8747d7");
  268. formFile.append("task_require", $("#ShipinRenwuYaoqiu").val());
  269. formFile.append("t_id", Ptid);
  270. formFile.append("task_img_material_two", TypeImgArr2.join(","));
  271. if (tpFilesArr1.length != 0) {
  272. for (let i in tpFilesArr1) {
  273. formFile.append("task_require_img[]", tpFilesArr1[i]);
  274. }
  275. }
  276. if (tpFilesArr3.length != 0) {
  277. for (let i in tpFilesArr3) {
  278. formFile.append("task_img_material[]", tpFilesArr3[i]);
  279. }
  280. }
  281. $.ajax({
  282. type: "post",
  283. url: window.baseUrl.uploadApi + "/Admin/Taskorder/savetask_wxshare_account",
  284. dataType: "json",
  285. data: formFile,
  286. async: true,
  287. cache: false,
  288. contentType: false,
  289. processData: false,
  290. success: function (res) {
  291. if (res.code == "200") {
  292. window.history.back();
  293. } else {
  294. alert("上传失败,请重新上传");
  295. }
  296. },
  297. });
  298. }
  299. })
  300. } else {
  301. // 功能-新增-反差内容-确认新增
  302. $(".HoutaiContainerBoxChildYaoqiuBtnSure").on("click", function () {
  303. if (!$("#ShipinRenwuYaoqiu").val()) {
  304. alert("请输入任务要求")
  305. } else {
  306. if ($(this).text() == "正在上传中") {
  307. alert("正在上传中!请耐心等待!!!");
  308. return;
  309. }
  310. $(this).text("正在上传中");
  311. $(this).css("background", "#575f6e");
  312. var formFile = new FormData();
  313. formFile.append("token", "b8e3bb6ef8747d7");
  314. formFile.append("amount", TypePrice);
  315. formFile.append("task_require", $("#ShipinRenwuYaoqiu").val());
  316. if (tpFilesArr1.length != 0) {
  317. for (let i in tpFilesArr1) {
  318. formFile.append("task_require_img[]", tpFilesArr1[i]);
  319. }
  320. }
  321. if (tpFilesArr3.length != 0) {
  322. for (let i in tpFilesArr3) {
  323. formFile.append("task_img_material[]", tpFilesArr3[i]);
  324. }
  325. }
  326. $.ajax({
  327. type: "post",
  328. url: window.baseUrl.uploadApi + "/Admin/Taskorder/addtask_wxshare_account",
  329. dataType: "json",
  330. data: formFile,
  331. async: true,
  332. cache: false,
  333. contentType: false,
  334. processData: false,
  335. success: function (res) {
  336. if (res.code == "200") {
  337. window.history.back();
  338. } else {
  339. alert("上传失败,请重新上传");
  340. }
  341. },
  342. });
  343. }
  344. });
  345. }
  346. $(".HoutaiContainerBoxChildYaoqiuBtnCancel").on("click", function () {
  347. window.history.back();
  348. })
  349. // $("#SucaiKuID")
  350. $('#SucaiKuID').blur(function () {
  351. if ($('#SucaiKuID').val() != "") {
  352. $.ajax({
  353. type: "post",
  354. url: window.baseUrl.requestApi + "/Admin/Taskorder/find_douyin_sucaiid_name",
  355. dataType: "json",
  356. data: {
  357. token: "b8e3bb6ef8747d7",
  358. sc_id: $('#SucaiKuID').val()
  359. },
  360. success: function (res) {
  361. console.log(res);
  362. if (res.code == "200") {
  363. $("#SucaiKuIDShibie").val(res.sc_name);
  364. ScBolean = true;
  365. } else {
  366. alert(res.msg);
  367. ScBolean = false;
  368. }
  369. }
  370. })
  371. }
  372. });
  373. })