lvhao il y a 18 heures
Parent
commit
6772a72d12
2 fichiers modifiés avec 696 ajouts et 0 suppressions
  1. 110 0
      core/CoreApp/controllers/Returns.php
  2. 586 0
      template/erp/returns_scanwaybill.html

Fichier diff supprimé car celui-ci est trop grand
+ 110 - 0
core/CoreApp/controllers/Returns.php


+ 586 - 0
template/erp/returns_scanwaybill.html

@@ -0,0 +1,586 @@
+{Template header}
+<body>
+<div class="warp">
+<div class="title winnone">扫运单录入</div>
+<ul class="setting">
+<li class="length"  style="margin-left: 40px;">
+    <input type="text"  id="scan_waybill" value="" placeholder="输入框的‘|’一闪一闪的才可以扫码,如果没有请点击后在扫码" style="border-radius: 3px;height: 35px;" autocomplete="off">
+</li>
+
+</ul>
+<div class="button"><font class="datasavezy">提 交</font> <font class="fh">关 闭</font></div>
+</div>
+<div style="display:none;">
+<input id="upload-file" name="files" accept="image/xls,image/xlsx" type="file">
+</div>
+<script>
+var scwd = "/fullorderexcel/scwd";
+var addedit="/returns/edit/";
+
+$("#scan_waybill").focus()
+$('#scan_waybill').on('keydown', function(e) {
+    const key = e.key;
+    // 回车表示扫码结束
+    if (key === 'Enter') {
+        let scan_waybill = $(this).val();
+        if(scan_waybill.length == 0){
+            return layx.msg("运单号为空", {
+						dialogIcon: 'warn',
+						position: 'cc'
+					});
+        }
+        getInfoByWaybill(scan_waybill)
+    }
+});
+
+function getInfoByWaybill(scan_waybill){
+    $.post("/returns/scan_waybill",{
+        action:'getinfobywaybill',
+        waybill:scan_waybill
+    },function(res){
+        if(!res.success){
+            return layx.msg(res.msg, {
+						dialogIcon: 'warn',
+						position: 'cc'
+					});
+        }else{
+            showEditContent(res.data)
+        }
+    },'json')
+}
+function showEditContent(data){
+    let tplStr = document.getElementById('edit_content').innerHTML;
+   
+    // 4. 传递数据进行渲染,并将结果插入 DOM
+    //let outputHtml = compiledTemplate.fetch({ data: data });
+    let outputHtml =  ejs.render(tplStr, {data: data.data,shoplist:data.shop_list,degreetext:data.data.degreetext,imgs:data.data.img});
+    $("#scan_waybill").closest("li").after(outputHtml)
+    readFunction()
+}
+
+
+function readFunction(){
+    $("select[name='sl']").change(function() {
+        var t = $(this).find("option:selected").val();
+        var f = 0;
+        $(".dxh .xntj").each(function() {
+            f = f + 1;
+        });
+        //$(".dxh").html("");
+        if (t > f) {
+            for (i = 0; i < t - f; i++) {
+                $(".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><span class="ckrows"><label><input name="degree' +
+                    (f + i + 1) +
+                    '" type="radio" value="6"><font>(化纤)可用</font></label></span><span class="ckrows"><label><input name="degree' +
+                    (f + i + 1) +
+                    '" type="radio" value="7"><font>(化纤)待确认</font></label></span><span class="ckrows"><label><input name="degree' +
+                    (f + i + 1) +
+                    '" type="radio" value="5"><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>'
+                    );
+            }
+        } else if (t < f) {
+            for (i = 0; i < f - t + 1; i++) {
+                $(".dxh .xntj:eq(" + (f - i) + ")").remove();
+            }
+        }
+    });
+    
+
+    
+
+
+
+    $(".datasavezy").click(function() {
+        $(".ts p").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 正在添加中,请稍后...");
+        $(".ts").show();
+        var f = "";
+        var e = "";
+        var x = '';
+        $(".select").each(function() {
+            f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
+        });
+        $("input:text").each(function() {
+            var str = $(this).val().replace(/\+/g, "%2B");
+            var str = str.replace(/&/g, "%26");
+            f = f + $(this).attr("name") + "=" + str + "&";
+        });
+        $("input:password").each(function() {
+            f = f + $(this).attr("name") + "=" + $(this).val() + "&";
+        });
+        $("input:hidden").each(function() {
+            f = f + $(this).attr("name") + "=" + $(this).val() + "&";
+        });
+        $("textarea").each(function() {
+            var str2 = $(this).val().replace(/\+/g, "%2B");
+            var str2 = str2.replace(/&/g, "%26");
+            f = f + $(this).attr("name") + "=" + str2 + "&";
+        });
+        if ($(".deldata img").length > 0 || $(".deldata video").length > 0) {
+            var a = '';
+            for (var b = 0; b < $(".deldata img").length; b++) {
+                a = a + $(".deldata img")[b].src + "|";
+            }
+            for (var b = 0; b < $(".deldata video").length; b++) {
+                a = a + $('.deldata video')[b].src + "|";
+            }
+            f = f + "img=" + a + "&";
+        }
+        for (i = 0; i < $(".checkbox").length; i++) {
+            var checkid = "";
+            var checkname = "";
+            $(".checkbox:eq(" + i + ") .ckrows input:checked").each(function() {
+                checkname = $(this).attr("name");
+                checkid = checkid + $(this).val() + ",";
+            });
+            if (checkname == "") {
+                $(".ts p").text($(".checkbox:eq(" + i + ")").prevAll("em").text() + "为必填项");
+                $(".ts").show();
+                setTimeout('$(".ts").fadeOut()', 600);
+                return false;
+            }
+            f = f + checkname + "=" + checkid + "&";
+
+        }
+
+
+        $(".dxh .xntj").each(function() {
+            var str2 = $(this).find("textarea").val().replace(/\+/g, "%2B");
+            var str2 = str2.replace(/&/g, "%26");
+            x = x + $(this).find(".checkboxfbt .ckrows input:checked").val() + "~" + str2 + "|";
+        });
+        f = f + "degreetext=" + x + "&";
+
+        var ab = 0;
+        $(".must").each(function() {
+            if ($.trim($(this).val()).length == 0) {
+                $(this).css("border", "1px solid #F66");
+                ab = ab + 1;
+            }
+        });
+        if (ab > 0) {
+            $(".ts p").text("红框为必填项");
+            $(".ts").show();
+            setTimeout('$(".ts").fadeOut()', 600);
+            return false;
+        }
+        $.ajax({
+            url: addedit,
+            data: f,
+            type: "POST",
+            dataType: "json",
+            success: function(a) {
+                if (a && a.success) {
+                    $(".ts").hide();
+                    $(".express p:eq(0)").html(a.msg + "是否关闭?");
+                    $(".express p:eq(1)").html(
+                        "<font class='fh'>确 定</font><font class='esc'>取 消</font>");
+                    $(".express").show();
+                } else {
+                    $(".ts").hide();
+                    $(".ts p").html(a.msg);
+                    $(".ts").fadeIn();
+                    setTimeout('$(".ts").fadeOut()', 800);
+                }
+            }
+        });
+    });
+   
+    $("input[name='number']").on('blur', function() {
+        let order_no = $("input[name='number']").val()
+        if (!order_no) {
+            return;
+        }
+        let shop = $(".shopselect").val()
+        $.post("/returns/csao", {
+            shop: shop,
+            number: order_no,
+        }, function(res) {
+            if (res.code != 1) {
+                $(".ts").hide();
+                $(".ts p").html(res.msg);
+                $(".ts").fadeIn();
+                setTimeout('$(".ts").fadeOut()', 1200);
+            }
+        }, 'json')
+
+    })
+    $(".shopselect").on('change', function() {
+        let shop = $(".shopselect").val()
+        let order_no = $("input[name='number']").val()
+        if (!order_no) {
+            return;
+        }
+        $.post("/returns/csao", {
+            shop: shop,
+            number: order_no,
+        }, function(res) {
+            if (res.code != 1) {
+                $(".ts").hide();
+                $(".ts p").html(res.msg);
+                $(".ts").fadeIn();
+                setTimeout('$(".ts").fadeOut()', 1200);
+            }
+        }, 'json')
+    })
+
+    var button = $(".scimg font"),
+        interval;
+    var fileType = "pic",
+        fileNum = "one";
+    new AjaxUpload(button, {
+        action: "/img/",
+        name: "userfile",
+        onSubmit: function(file, ext) {
+            if (fileType == "pic") {
+                if (ext && /^(jpg|png|jpeg|gif)$/.test(ext)) {
+                    this.setData({
+                        info: "文件类型为图片"
+                    });
+                } else if (ext && /^(3gp|rmvb|flv|wmv|avi|mkv|mp4|mp3|wav)$/.test(ext)) {
+                    this.setData({
+                        info: "文件类型为视频"
+                    });
+                } else {
+                    alert("提示:您上传的是非图片或视频类型!");
+                    return false;
+                }
+            }
+            $(".scimg font").hide();
+            $(".loadimg").show();
+            layx.load('loadId', '上传中');
+            if (fileNum == "one") {
+                this.disable();
+            }
+        },
+        onComplete: function(file, response) {
+            eval("var obj=" + response);
+            if (obj.ok) {
+                layx.destroy('loadId');
+                if (/^(.jpg|.png|.jpeg|.gif)$/.test(obj.lx)) {
+
+                    button.before('<span class="deldata"><a href="'+obj.filename+'" target="_blank"><img style="max-width: 200px;max-height: 200px;" src="'+obj.filename+'" data-src="'+obj.filename+'"></a><em style="width:30px;height:30px;line-height:30px;text-align: center;display: inline-block;position: absolute;top: 0px;right: 20px;z-index: 10;background-color: #FFF;cursor: pointer;" title="点击删除" onclick="del(this)">X</em></span>')
+                } else if (/^(.3gp|.rmvb|.flv|.wmv|.avi|.mkv|.mp4|.mp3|.wav)$/.test(obj
+                    .lx)) {
+                        button.before('<span class="deldata"><video width="200" src="' + obj.filename +'" controls="controls"></video><em style="width:30px;height:30px;line-height:30px;text-align: center;display: inline-block;position: absolute;top: 0px;right: 20px;z-index: 10;background-color: #FFF;cursor: pointer;" title="点击删除" onclick="del(this)">X</em></span>');
+                }
+            } else {
+                layx.destroy('loadId');
+                $(".ts p").html("上传失败,请重试");
+                $(".ts").fadeIn();
+                setTimeout('$(".ts").fadeOut()', 800);
+            }
+            $(".loadimg").hide();
+            $(".scimg font").show();
+            window.clearInterval(interval);
+            this.enable();
+        }
+    });
+}
+function del(that){
+    $(that).closest(".deldata").remove();
+}
+
+
+
+
+
+function getInfo(){
+    let order_no = $("input[name='number']").val()
+    if(!order_no){
+        $(".ts").hide();
+        $(".ts p").html("请输入订单编号");
+        $(".ts").fadeIn();
+        setTimeout('$(".ts").fadeOut()', 1000);
+        return ;
+    }
+    $.ajax({
+        url: "/orderinfo/get_info/"+order_no,
+        type: "get",
+        dataType: "json",
+        success: function(a) {
+            if (a.code == 1) {
+				let info = a.data
+                $("input[name='orderinfo']").val(info.orderinfo)
+                $("input[name='name']").val(info.client)
+                $("input[name='name']").val(info.client)
+                $("textarea[name='goods']").val(info.shipremarks)
+                $("textarea[name='u9_sku']").val(info.u9_sku)
+            } else {
+				$(".ts").hide();
+                $(".ts p").html(a.msg);
+                $(".ts").fadeIn();
+                setTimeout('$(".ts").fadeOut()', 800);
+            }
+        }
+    });
+
+}
+</script>
+<script id="edit_content" type="text/html">
+<li class="remark">
+    <em>收货地址:</em>
+    <div class="checkbox">
+        <span class="ckrows"><label><input name="region" type="radio" value="1" 
+            <% if(data.region == 1) { %> checked <% } %>
+            ><font>国 内</font></label></span>
+        <span class="ckrows"><label><input name="region" type="radio" value="2" 
+            <% if(data.region == 2) { %> checked <% } %>
+            ><font>美国</font></label></span>
+    </div>
+</li>
+<li>
+    <em>财务退货结算:</em>
+    <div class="checkbox">
+    <span class="ckrows"><label><input name="cwjs" type="radio" value="0" 
+        <% if(data.cwjs != 1) { %> checked <% } %>
+        ><font>否</font></label></span>
+    <span class="ckrows"><label><input name="cwjs" type="radio" value="1" 
+        <% if(data.cwjs == 1) { %> checked <% } %>
+        ><font>是</font></label></span>
+    </div>
+</li>
+<li>
+    <em>店铺:</em>
+    <select name="shop" class="select class shopselect">
+        <% for(let key in shoplist){ %>
+        <option value="<%= key  %>" 
+        <% if(data.shop == key) { %>  selected="selected" <% } %>
+         > <%= shoplist[key] %>
+        </option>
+        <% } %>
+        <option value="0" 
+        <% if(data.shop == 0) { %>  selected="selected" <% } %>
+        >不确定</option>
+    </select>
+</li>
+<li>
+    <em>退件物流方式:</em>
+    <select name="express" class="select class">
+        <option value="" 
+        <% if(data.express == '') { %>  selected="selected" <% } %>
+        >请选择</option>
+        <option value="USPS" 
+        <% if(data.express == 'USPS') { %>  selected="selected" <% } %>
+        >USPS</option>
+        <option value="UPS"
+        <% if(data.express == 'UPS') { %>  selected="selected" <% } %>
+        >UPS</option>
+        <option value="Fedex" 
+        <% if(data.express == 'Fedex') { %>  selected="selected" <% } %>
+        >Fedex</option>
+        <option value="DHL"
+        <% if(data.express == 'DHL') { %>  selected="selected" <% } %>
+        >DHL</option>
+        <option value="Royal Mail" 
+        <% if(data.express == 'Royal Mail') { %>  selected="selected" <% } %>
+        >Royal Mail</option>
+        <option value="Canada Post" 
+        <% if(data.express == 'Canada Post') { %>  selected="selected" <% } %>
+        >Canada Post
+        </option>
+        <option value="France Post" 
+        <% if(data.express == 'France Post') { %>  selected="selected" <% } %>
+        >France Post
+        </option>
+        <option value="Germany Post" 
+        <% if(data.express == 'Germany Post') { %>  selected="selected" <% } %>
+        >Germany Post
+        </option>
+        <option value="Australia Post" 
+        <% if(data.express == 'Australia Post') { %>  selected="selected" <% } %>
+        >Australia
+            Post</option>
+        <option value="TNT" 
+        <% if(data.express == 'TNT') { %>  selected="selected" <% } %>
+        >TNT</option>
+        <option value="邮政" 
+        <% if(data.express == '邮政') { %>  selected="selected" <% } %>
+        >邮政</option>
+        <option value="其它"
+        <% if(data.express == '其它') { %>  selected="selected" <% } %>
+        >其它</option>
+    </select>
+</li>
+
+<li>
+    <em>订单编号:</em>
+    <input value="<%= data.number %>" name="number" type="text" placeholder="国内填写">
+</li>
+
+<li>
+    <em>网站订单号:</em>
+    <input value="<%= data.orderinfo %>" name="orderinfo" type="text" placeholder="国内填写">
+</li>
+
+<li>
+    <em>客户姓名:</em>
+    <input value="<%= data.name %>" name="name" type="text" placeholder="国内填写">
+</li>
+
+<li>
+    <em>退回运单号:</em>
+    <input value="<%= data.torderinfo %>" name="torderinfo" type="text" placeholder="国内或美国仓填写">
+</li>
+
+<li>
+    <em>发货日期:</em>
+    <input value="<%= data.ftime %>"
+        onClick="laydate({istime: true,format:'YYYY-MM-DD'})" name="ftime" autocomplete="off" type="text"
+        placeholder="国内填写">
+</li>
+
+<li>
+    <em>收到日期:</em>
+    <input value="<%= data.stime %>"
+        onClick="laydate({istime: true,format:'YYYY-MM-DD'})" name="stime" autocomplete="off" type="text">
+</li>
+
+<li class="length remark">
+    <em>原单料号:</em>
+    <textarea name="u9_sku" style="height:55px;background-color: #efefef !important;" placeholder=""
+        readonly><%= data.u9_sku %></textarea>
+</li>
+
+<li class="length remark">
+    <em>应退回货物:</em>
+    <textarea name="goods" style="height:55px;" placeholder="国内填写"><%= data.goods %></textarea>
+</li>
+
+<li class="length remark">
+    <em>实际收到货物:</em>
+    <textarea name="received" style="height:55px;" placeholder="美国仓填写"><%= data.received %></textarea>
+</li>
+
+<li>
+    <em>退货登记编码:</em>
+    <input value="<%= data.ret_regist_no %>" name="ret_regist_no" type="text">
+</li>
+<li>
+    <em>退货箱号:</em>
+    <input value="<%= data.xh %>" name="xh" type="text">
+</li>
+<li class="remark length">
+    <em>选择产品数量: <%= data.sl %></em>
+    <select name="sl" class="select class">
+        <option value="0" 
+        <% if(data.sl == '0') { %>  selected="selected" <% } %>
+        >请选择</option>
+        <option value="1" 
+        <% if(data.sl == '1') { %>  selected="selected" <% } %>
+        >1个</option>
+        <option value="2" 
+        <% if(data.sl == '2') { %>  selected="selected" <% } %>
+        >2个</option>
+        <option value="3" 
+        <% if(data.sl == '3') { %>  selected="selected" <% } %>
+        >3个</option>
+        <option value="4" 
+        <% if(data.sl == '4') { %>  selected="selected" <% } %>
+        >4个</option>
+        <option value="5" 
+        <% if(data.sl == '5') { %>  selected="selected" <% } %>
+        >5个</option>
+    </select>
+</li>
+<div class="dxh">
+    <% for(let key in degreetext) { %>
+    <div class="xntj">
+        <li class="length remark">
+            <em>完好程度-<%= key*1+1 %>:</em>
+            <div class="checkboxfbt">
+               
+                <span class="ckrows">
+                    <label>
+                        <input name="degree<%= key*1+1 %>" type="radio"
+                        <% if(degreetext[key]['val'] == 1) { %> checked  <% } %>
+                        value="1"><font>(人发)可用</font>
+                    </label>
+                </span>
+                <span class="ckrows">
+                    <label>
+                        <input name="degree<%= key*1+1 %>" type="radio"
+                        <% if(degreetext[key]['val'] == 2) { %> checked  <% } %>
+                        value="2"><font>(人发)精打理</font>
+                    </label>
+                </span>
+                <span class="ckrows">
+                    <label>
+                        <input name="degree<%= key*1+1 %>" type="radio"
+                        <% if(degreetext[key]['val'] == 3) { %> checked  <% } %>
+                        value="3"><font>(人发)不可用</font>
+                    </label>
+                </span>
+                <span class="ckrows">
+                    <label>
+                        <input name="degree<%= key*1+1 %>" type="radio" 
+                        <% if(degreetext[key]['val'] == 4) { %> checked  <% } %>
+                        value="4"><font>非假发/非我司头发</font>
+                    </label>
+                </span>
+                <span class="ckrows">
+                    <label>
+                        <input name="degree<%= key*1+1 %>" type="radio" 
+                        <% if(degreetext[key]['val'] == 6) { %> checked  <% } %>
+                        value="6"><font>(化纤)可用</font>
+                    </label>
+                </span>
+                <span class="ckrows">
+                    <label>
+                        <input name="degree<%= key*1+1 %>" type="radio" 
+                        <% if(degreetext[key]['val'] == 7) { %> checked  <% } %>
+                        value="7"><font>(化纤)待确认</font>
+                    </label>
+                </span>
+                <span class="ckrows">
+                    <label>
+                        <input name="degree<%= key*1+1 %>" type="radio" 
+                        <% if(degreetext[key]['val'] == 5) { %> checked  <% } %>
+                        value="5"><font>(化纤)不可用</font>
+                    </label>
+                </span>
+            </div>
+        </li>
+        <li class="length remark">
+            <em>完好程度补充-:</em>
+            <textarea name="degreetext" style="height:55px;" placeholder="美国仓填写"><%= degreetext[key]['text'] %></textarea>
+        </li>
+    </div>
+    <% } %>
+</div>
+
+<li class="length scimg">
+    <span class="upimg">
+        <% for(let key in imgs) {%>
+            
+            <% if(imgs[key]['type'] == 'video'){ %>
+                <span class="deldata"><video width="200" src="<%= imgs[key]['url'] %>" controls="controls"></video><em style='width:30px;height:30px;line-height:30px;text-align: center;display: inline-block;position: absolute;top: 0px;right: 20px;z-index: 10;background-color: #FFF;cursor: pointer;' title='点击删除' onclick="del(this)">X</em></span>
+            <% } else { %>
+                <span class="deldata"><a href="<%= imgs[key]['url'] %>" target="_blank"><img style="max-width: 200px;max-height: 200px;" src="<%= imgs[key]['url'] %>" data-src="<%= imgs[key]['url'] %>"></a><em style='width:30px;height:30px;line-height:30px;text-align: center;display: inline-block;position: absolute;top: 0px;right: 20px;z-index: 10;background-color: #FFF;cursor: pointer;' title='点击删除' onclick="del(this)">X</em></span>
+            <% } %>
+        <% } %>
+       
+    
+    </span>
+    <font>+</font>
+</li>
+
+<input type="hidden" name="id" value="<%= data.id %>" />   
+    
+    <div style="clear:both;"></div>
+</script>
+<script type="text/javascript" src="{$theme}js/ejs.min.js"></script>
+<script type="text/javascript" src="{$theme}js/ajaxupload.3.5.js"></script>
+<script type="text/javascript" src="{$theme}js/laydate.js"></script>
+{Template footer}