自动加收货人名

try to take over the world!

目前为 2021-03-06 提交的版本。查看 最新版本

// ==UserScript==
// @name         自动加收货人名
// @namespace    http://tampermonkey.net/
// @version      2.1
// @description  try to take over the world!
// @author       You
// @match        https://pdropship.jd.com/orderManage/initListPage
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
var anniu=`<button type="button" id="add_name"class="pui-button ui-widget ui-state-default ui-corner-all pui-button-text-icon-left" role="button" aria-disabled="false">
<span class="pui-button-icon-left ui-icon ui-icon-key"></span>
<span class="pui-button-text">添加收货人</span>
</button>`
    var kefu = "涵";
    var timer3 = "";
    var ccc=''
 timer3=setInterval(func1,1000)

    function func1() {
        if( $(".pui-dialog-buttonpane").length>7){
        clearInterval(timer3)
             console.log("找到了了")
            $(".pui-dialog-buttonpane").eq(5).append(anniu)

        }
        $("#add_name").click(function(){
            var user='1'
            var remark=   $('#addRemark').val()
            var _id= $("#tr_1").text()
            $.get("https://pdropship.jd.com/outBound/outboundList?orderIdList=&orderId="+_id,function(data){
                user=data.rows[0].customerName
                let pinming=data.rows[0].orderDetailList[0].wareName.indexOf("桌垫") //如果大于0 就是桌垫

                if(pinming>=0){
                    if( $('#addRemark').val().indexOf("桌垫可定制:")>0){

                      let bz= $('#addRemark').val()

                      let shan_zd=  bz.replace("桌垫可定制:",'').replace(kefu,'').replace(user,'').replace(',','');
                         $('#addRemark').val(shan_zd)
                    }else{
                      $('#addRemark').val(user+',桌垫可定制:'+remark+' '+kefu)
                    }

                }else{
                     if( $('#addRemark').val().indexOf("可定制:")>0){
                      let bz= $('#addRemark').val()
                      let shan_zd=  bz.replace("可定制:",'').replace(kefu,'').replace(user,'').replace(',','');
                         $('#addRemark').val(shan_zd)
                    }else{
                      $('#addRemark').val(user+',可定制:'+remark+' '+kefu)
                    }
                }
                console.log(user)
            })
        })
        }

    // Your code here...














})();