returns_add.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. {Template header}
  2. <body>
  3. <div class="warp">
  4. <div class="title winnone">退单信息 - 添加</div>
  5. <ul class="setting">
  6. <li class="length remark">
  7. <em>收货地址:</em>
  8. <div class="checkbox">
  9. <span class="ckrows"><label><input name="region" type="radio" value="1"><font>国 内</font></label></span>
  10. <span class="ckrows"><label><input name="region" type="radio" value="2"><font>美国店</font></label></span>
  11. </div>
  12. </li>
  13. <li>
  14. <em>店铺:</em>
  15. <select name="shop" class="select class shopselect">
  16. {loop usershop() as $val}
  17. <option value="{$val['id']}">{$val['shopname']}</option>
  18. {/loop}
  19. <option value="0">不确定</option>
  20. </select>
  21. </li>
  22. <li>
  23. <em>退件物流方式:</em>
  24. <select name="express" class="select class">
  25. <option value="">请选择</option>
  26. <option value="USPS">USPS</option>
  27. <option value="UPS">UPS</option>
  28. <option value="Fedex">Fedex</option>
  29. <option value="DHL">DHL</option>
  30. <option value="Royal Mail">Royal Mail</option>
  31. <option value="Canada Post">Canada Post</option>
  32. <option value="France Post">France Post</option>
  33. <option value="Germany Post">Germany Post</option>
  34. <option value="Australia Post">Australia Post</option>
  35. <option value="TNT">TNT</option>
  36. <option value="邮政">邮政</option>
  37. <option value="其它">其它</option>
  38. </select>
  39. </li>
  40. <li>
  41. <em>订单编号:</em>
  42. <input value="" name="number" type="text" placeholder="国内填写" >
  43. </li>
  44. <li>
  45. <span onclick="getInfo()" style="width: 260px;height: 30px;line-height: 30px;background: #2084db;text-align: center;color: #fff;
  46. border-radius: 5px;display: inline-block;cursor: pointer;">一键加入 订单号/客户姓名/仓库品名</span>
  47. </li>
  48. <li>
  49. <em>网站订单号:</em>
  50. <input value="" name="orderinfo" type="text" placeholder="国内填写" >
  51. </li>
  52. <li>
  53. <em>客户姓名:</em>
  54. <input value="" name="name" type="text" placeholder="国内填写" >
  55. </li>
  56. <li>
  57. <em>退回运单号:</em>
  58. <input value="" name="torderinfo" type="text" placeholder="国内或美国仓填写" >
  59. </li>
  60. <li>
  61. <em>发货日期:</em>
  62. <input value="" onClick="laydate({istime: true,format:'YYYY-MM-DD'})" name="ftime" type="text" placeholder="国内填写" >
  63. </li>
  64. <li>
  65. <em>收到日期:</em>
  66. <input value="" onClick="laydate({istime: true,format:'YYYY-MM-DD'})" name="stime" type="text" >
  67. </li>
  68. <li class="length remark">
  69. <em>原单料号:</em>
  70. <textarea class="textarea" name="u9_sku" style="height:55px;" placeholder="" readonly></textarea>
  71. </li>
  72. <li class="length remark">
  73. <em>应退回货物:</em>
  74. <textarea class="textarea" name="goods" style="height:55px;" placeholder="国内填写"></textarea>
  75. </li>
  76. <li class="length remark">
  77. <em>实际收到货物:</em>
  78. <textarea class="textarea" name="received" style="height:55px;" placeholder="美国仓填写"></textarea>
  79. </li>
  80. <li>
  81. <em>退货登记编码:</em>
  82. <input value="" name="ret_regist_no" type="text">
  83. </li>
  84. <li>
  85. <em>退货箱号:</em>
  86. <input value="" name="xh" type="text">
  87. </li>
  88. <li class="remark length">
  89. <em>选择产品数量:</em>
  90. <select name="sl" class="select class">
  91. <option value="0">请选择</option>
  92. <option value="1">1个</option>
  93. <option value="2">2个</option>
  94. <option value="3">3个</option>
  95. </select>
  96. </li>
  97. <!--<li>-->
  98. <!--<em>退货箱号:</em>-->
  99. <!--<input value="" name="xh" type="text">-->
  100. <!--</li>-->
  101. <div class="dxh">
  102. </div>
  103. <li class="length scimg">
  104. <span class="upimg"></span>
  105. <font>+</font>
  106. </li>
  107. <div style="clear:both;"></div>
  108. </ul>
  109. <div class="button"><font class="datasavezy">提 交</font> <font class="fh">关 闭</font></div>
  110. </div>
  111. <div style="display:none;">
  112. <input id="upload-file" name="files" accept="image/xls,image/xlsx" type="file">
  113. </div>
  114. <script>
  115. var scwd = "/fullorderexcel/scwd";
  116. var addedit="/returns/add/";
  117. $(document).ready(function() {
  118. $("select[name='sl']").change(function() {
  119. var t = $(this).find("option:selected").val();
  120. var f = 0;
  121. $(".dxh .xntj").each(function() {
  122. f = f + 1;
  123. });
  124. //$(".dxh").html("");
  125. if(t > f)
  126. {
  127. for(i=0;i<t-f;i++)
  128. {
  129. $(".dxh").append('<div class="xntj"><li class="length remark"><em>完好程度-'+(f+i+1)+':</em><div class="checkboxfbt"><span class="ckrows"><label><input name="degree'+(f+i+1)+'" type="radio" value="1"><font>可 用</font></label></span><span class="ckrows"><label><input name="degree'+(f+i+1)+'" type="radio" value="2"><font>精打理</font></label></span><span class="ckrows"><label><input name="degree'+(f+i+1)+'" type="radio" value="3"><font>不可用</font></label></span><span class="ckrows"><label><input name="degree'+(f+i+1)+'" type="radio" value="4" checked><font>其 它</font></label></span></div></li><li class="length remark"><em>完好程度补充-'+(f+i+1)+':</em><textarea name="degreetext" style="height:55px;" placeholder="美国仓填写"></textarea></li></div>');
  130. }
  131. }
  132. else if (t < f)
  133. {
  134. for(i=0;i<f-t+1;i++)
  135. {
  136. $(".dxh .xntj:eq("+(f-i)+")").remove();
  137. }
  138. }
  139. });
  140. $("select[name='sl']").change();
  141. var button = $(".scimg font"), interval;
  142. var fileType = "pic", fileNum = "one";
  143. new AjaxUpload(button, {
  144. action: "/img/",
  145. name: "userfile",
  146. onSubmit: function(file, ext) {
  147. if (fileType == "pic") {
  148. if (ext && /^(jpg|png|jpeg|gif)$/.test(ext)) {
  149. this.setData({
  150. info: "文件类型为图片"
  151. });
  152. }
  153. else if (ext && /^(3gp|rmvb|flv|wmv|avi|mkv|mp4|mp3|wav)$/.test(ext)) {
  154. this.setData({
  155. info: "文件类型为视频"
  156. });
  157. } else {
  158. alert("提示:您上传的是非图片类型!");
  159. return false;
  160. }
  161. }
  162. $(".scimg font").hide();
  163. $(".loadimg").show();
  164. layx.load('loadId','上传中');
  165. if (fileNum == "one") {
  166. this.disable();
  167. }
  168. },
  169. onComplete: function(file, response) {
  170. eval("var obj=" + response);
  171. if (obj.ok) {
  172. layx.destroy('loadId');
  173. if (/^(.jpg|.png|.jpeg|.gif)$/.test(obj.lx)) {
  174. $(".scimg span").append('<img src="' + obj.filename + '" title="点击图片删除">');
  175. }
  176. else if (/^(.3gp|.rmvb|.flv|.wmv|.avi|.mkv|.mp4|.mp3|.wav)$/.test(obj.lx)) {
  177. $(".scimg span").append('<video src="' + obj.filename + '" controls="controls"></video>');
  178. }
  179. } else {
  180. layx.destroy('loadId');
  181. $(".ts p").html("上传失败,请重试");
  182. $(".ts").fadeIn();
  183. setTimeout('$(".ts").fadeOut()', 800);
  184. }
  185. $(".loadimg").hide();
  186. $(".scimg font").show();
  187. window.clearInterval(interval);
  188. this.enable();
  189. }
  190. });
  191. });
  192. $(".datasavezy").click(function() {
  193. $(".ts p").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 正在添加中,请稍后...");
  194. $(".ts").show();
  195. var f = "";
  196. var e = "";
  197. var x = '';
  198. $(".select").each(function() {
  199. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  200. });
  201. $("input:text").each(function() {
  202. var str = $(this).val().replace(/\+/g,"%2B");
  203. var str = str.replace(/&/g,"%26");
  204. f = f + $(this).attr("name") + "=" + str + "&";
  205. });
  206. $("input:password").each(function() {
  207. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  208. });
  209. $("input:hidden").each(function() {
  210. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  211. });
  212. $("textarea").each(function() {
  213. var str2 = $(this).val().replace(/\+/g,"%2B");
  214. var str2 = str2.replace(/&/g,"%26");
  215. f = f + $(this).attr("name") + "=" + str2 + "&";
  216. });
  217. if($(".scimg img").length > 0 || $(".scimg video").length > 0)
  218. {
  219. var a = '';
  220. for (var b = 0; b < $(".scimg .upimg img").length; b++)
  221. {
  222. a = a + $(".scimg .upimg img")[b].src + "|";
  223. }
  224. for (var b = 0; b < $(".scimg .upimg video").length; b++)
  225. {
  226. a = a + $('.scimg .upimg video')[b].src + "|";
  227. }
  228. f = f + "img=" + a + "&";
  229. }
  230. for(i=0;i<$(".checkbox").length;i++)
  231. {
  232. var checkid = ""; var checkname = "";
  233. $(".checkbox:eq("+i+") .ckrows input:checked").each(function(){
  234. checkname = $(this).attr("name");
  235. checkid = checkid + $(this).val()+",";
  236. });
  237. if(checkname == "")
  238. {
  239. $(".ts p").text($(".checkbox:eq("+i+")").prevAll("em").text()+"为必填项");
  240. $(".ts").show();
  241. setTimeout('$(".ts").fadeOut()', 600);
  242. return false;
  243. }
  244. f = f + checkname + "=" + checkid + "&";
  245. }
  246. $(".dxh .xntj").each(function() {
  247. var str2 = $(this).find("textarea").val().replace(/\+/g,"%2B");
  248. var str2 = str2.replace(/&/g,"%26");
  249. x = x + $(this).find(".checkboxfbt .ckrows input:checked").val()+ "~" + str2 + "|";
  250. });
  251. f = f + "degreetext="+x+"&";
  252. var ab = 0;
  253. $(".must").each(function() {
  254. if ($.trim($(this).val()).length == 0) {
  255. $(this).css("border", "1px solid #F66");
  256. ab = ab + 1;
  257. }
  258. });
  259. if (ab > 0) {
  260. $(".ts p").text("红框为必填项");
  261. $(".ts").show();
  262. setTimeout('$(".ts").fadeOut()', 600);
  263. return false;
  264. }
  265. $.ajax({
  266. url: addedit,
  267. data: f,
  268. type: "POST",
  269. dataType: "json",
  270. success: function(a) {
  271. if (a && a.success) {
  272. $(".ts").hide();
  273. $(".express p:eq(0)").html(a.msg+"是否关闭?");
  274. $(".express p:eq(1)").html("<font class='fh'>确 定</font><font class='esc'>取 消</font>");
  275. $(".express").show();
  276. } else {
  277. $(".ts").hide();
  278. $(".ts p").html(a.msg);
  279. $(".ts").fadeIn();
  280. setTimeout('$(".ts").fadeOut()', 800);
  281. }
  282. }
  283. });
  284. });
  285. $(document).on("click", ".scimg .upimg img", function() {
  286. $(this).remove();
  287. });
  288. $(document).on("click", ".scimg .upimg video", function() {
  289. $(this).remove();
  290. });
  291. $("input[name='number']").on('blur',function(){
  292. let order_no = $("input[name='number']").val()
  293. if(!order_no){
  294. return ;
  295. }
  296. let shop = $(".shopselect").val()
  297. $.post("/returns/csao",{
  298. shop:shop,
  299. number:order_no,
  300. },function(res){
  301. if(res.code != 1){
  302. $(".ts").hide();
  303. $(".ts p").html(res.msg);
  304. $(".ts").fadeIn();
  305. setTimeout('$(".ts").fadeOut()', 1200);
  306. }
  307. },'json')
  308. })
  309. $(".shopselect").on('change',function(){
  310. let shop = $(".shopselect").val()
  311. let order_no = $("input[name='number']").val()
  312. if(!order_no){
  313. return ;
  314. }
  315. $.post("/returns/csao",{
  316. shop:shop,
  317. number:order_no,
  318. },function(res){
  319. if(res.code != 1){
  320. $(".ts").hide();
  321. $(".ts p").html(res.msg);
  322. $(".ts").fadeIn();
  323. setTimeout('$(".ts").fadeOut()', 1200);
  324. }
  325. },'json')
  326. })
  327. function getInfo(){
  328. let order_no = $("input[name='number']").val()
  329. if(!order_no){
  330. $(".ts").hide();
  331. $(".ts p").html("请输入订单编号");
  332. $(".ts").fadeIn();
  333. setTimeout('$(".ts").fadeOut()', 1000);
  334. return ;
  335. }
  336. $.ajax({
  337. url: "/orderinfo/get_info/"+order_no,
  338. type: "get",
  339. dataType: "json",
  340. success: function(a) {
  341. if (a.code == 1) {
  342. let info = a.data
  343. $("input[name='orderinfo']").val(info.orderinfo)
  344. $("input[name='name']").val(info.client)
  345. $("input[name='name']").val(info.client)
  346. $("textarea[name='goods']").val(info.shipremarks)
  347. $("textarea[name='u9_sku']").val(info.u9_sku)
  348. } else {
  349. $(".ts").hide();
  350. $(".ts p").html(a.msg);
  351. $(".ts").fadeIn();
  352. setTimeout('$(".ts").fadeOut()', 800);
  353. }
  354. }
  355. });
  356. }
  357. </script>
  358. <script type="text/javascript" src="{$theme}js/ajaxupload.3.5.js"></script>
  359. <script type="text/javascript" src="{$theme}js/laydate.js"></script>
  360. {Template footer}