Browse Source

添加京东订单同步功能,同步发货的订单

wangxiaoming 5 years ago
parent
commit
abf927333a

+ 80 - 5
watero-rst-web/src/main/webapp/WEB-INF/views/order/sync/order_sync.ftl

@@ -35,9 +35,12 @@
             <#--<button type="submit" class="my-btn-search" style="" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜索</button>-->
         <#--</form>-->
 
-        <button type="button" class="my-btn-search" onclick="sync_order_fun()" >拉取全部订单</button>
-        <input type="text" class="my-input trim_input" id="salesExOrderId" style="margin-top: -3px;width:118px;margin-left: 50px;height: 32px;padding: 0px 0px 0px 2px;" value="" placeholder="商城订单编号" />
+        <button type="button" class="my-btn-search" onclick="sync_order_fun()" >拉取代发货订单</button>
+        <button type="button" class="my-btn-search" onclick="sync_order_fun_jd()" >拉取京东订单</button>
+        <input type="text" class="my-input trim_input" id="salesExOrderId" style="margin-right: 0px;margin-top: -3px;width:118px;margin-left: 50px;height: 32px;padding: 0px 0px 0px 2px;" value="" placeholder="商城订单编号" />
         <button type="button" class="my-btn-search" onclick="sync_order_send()" >发货</button>
+        <input type="text" class="my-input trim_input" id="xytOrderId" style="margin-right: 0px;margin-top: -3px;width:118px;margin-left: 50px;height: 32px;padding: 0px 0px 0px 2px;" value="" placeholder="小亚通订单编号" />
+        <button type="button" class="my-btn-search" onclick="sync_order_send_once()" >拉取</button>
     </div>
 
     <div class="mt-20">
@@ -59,11 +62,13 @@
                             <#--<td>${orderSyncLog.syncPlatName!''}</td>-->
                             <td>
                                 <#if orderSyncLog.syncLogMode == 1>
-                                    定时同步
+                                    定时拉取
                                 <#elseif orderSyncLog.syncLogMode == 2>
-                                    手动同步
+                                    手动拉取
                                 <#elseif orderSyncLog.syncLogMode == 3>
                                     发货
+                                <#elseif orderSyncLog.syncLogMode == 4>
+                                    同步京东订单状态
                                 </#if>
                             </td>
                             <td>${orderSyncLog.syncLogRecentNum!''}</td>
@@ -120,12 +125,40 @@
     }
 
     /**
+     * 拉取订单
+     */
+    function sync_order_fun_jd(){
+        var loadIndex = layer.load(1, {
+            shade: [0.5,'#fff'] //0.1透明度的白色背景
+        });
+        $.ajax('${path}/admin/sync_order/pull_jd?dates=' + new Date().getTime(), {
+            data: {},
+            dataType: 'json',
+            type: 'post',
+            timeout: 15000,
+            success: function(dt) {
+                layer.msg("拉取成功", {icon: 1, time: 3000});
+                if(loadIndex != 0 ){
+                    layer.close(loadIndex);
+                }
+                location.reload();
+            },
+            error: function(xhr, type, errorThrown) {
+                layer.msg("拉取失败,请重试!", {icon: 5, time: 3000});
+                if(loadIndex != 0 ){
+                    layer.close(loadIndex);
+                }
+            }
+        });
+    }
+
+    /**
      * 订单发货
      */
     function sync_order_send(){
         var salesExOrderId = $("#salesExOrderId").val();
         if(!isEmpty(salesExOrderId)){
-            layer.msg("请输入商城订单编号", {icon: 2, time: 3000});
+            layer.msg("请输入订单编号", {icon: 2, time: 3000});
             return false;
         }
         var loadIndex = layer.load(1, {
@@ -160,6 +193,48 @@
             }
         });
     }
+
+    /**
+     * 订单拉取-单个
+     */
+    function sync_order_send_once(){
+        var xytOrderId = $("#xytOrderId").val();
+        if(!isEmpty(xytOrderId)){
+            layer.msg("请输入小亚通订单编号", {icon: 2, time: 3000});
+            return false;
+        }
+        var loadIndex = layer.load(1, {
+            shade: [0.5,'#fff'] //0.1透明度的白色背景
+        });
+        $.ajax('${path}/admin/sync_order/pullOrder?dates=' + new Date().getTime(), {
+            data: {
+                orderId:xytOrderId
+            },
+            dataType: 'json',
+            type: 'post',
+            timeout: 15000,
+            success: function(dt) {
+                if(loadIndex != 0 ){
+                    layer.close(loadIndex);
+                }
+                var index = layer.alert(dt.resultMsg, function (index) {
+                    if (dt.returnCode == 200) {
+                        layer.close(index);
+                        location.reload();
+                    }else {
+                        layer.close(index);
+                        location.reload();
+                    }
+                });
+            },
+            error: function(xhr, type, errorThrown) {
+                layer.msg("发货失败,请重试!", {icon: 5, time: 3000});
+                if(loadIndex != 0 ){
+                    layer.close(loadIndex);
+                }
+            }
+        });
+    }
 </script>
 </body>
 </html>