NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name XCADEY SYSTEM - 自动新建订单 // @namespace http://tampermonkey.net/ // @version 0.6 // @description try to take over the world! // @author You // @match http://192.168.1.229:8880/app/* // @match http://xcadey.natapp1.cc/app/* // @match http://xcadey.tpddns.cn:8880/* // @icon https://www.google.com/s2/favicons?domain=1.229 // @license MIT // ==/UserScript== (function() { 'use strict'; var ck = function() { var x = prompt("输入数据: ", ""); let jsonObject = JSON.parse(x); let orderDetailJson = { "appKey": "5c1d4c54d0ebd67b", "sign": "ZWFjNDRhNzg5YWEyZjMxMWI3MGVmYWRiNDA0YTk3NWI4OTQ5NWEzYmUwNzQxZDJjZmU1YzNiODRiZTVhNjNiMQ==", "worksheetId": "62d418282f553935daa7943a", "controls": [ { "controlId": "product", "value": jsonObject.model }, { "controlId": "total", "value": "0" }, { "controlId": "price", "value": "0" }, { "controlId": "count", "value": "1" }, { "controlId": "ownerid", "value": "788f7a8a-3a41-48db-9de8-6bae9d0991d5" } ] }; console.log(orderDetailJson); let headers = new Headers(); headers.append('Content-Type', 'application/json'); headers.append('Content-Type', 'gzip, deflate, br'); headers.append('Content-Type', 'keep-alive'); let orderDetailRequest = new Request('http://xcadey.tpddns.cn:8880/api/v2/open/worksheet/addRow', { method: 'POST', body: JSON.stringify(orderDetailJson), headers: headers }); //let url = 'http://xcadey.natapp1.cc/'; fetch(orderDetailRequest).then(response => response.json()) //定义返回的类型和数据格式 .then(function(orderDetailData) { console.log(orderDetailData.data); var date = new Date(); var year = date.getFullYear(); var month = date.getMonth() + 1; month = (month < 10 ? "0" + month: month); var date1 = date.getDate(); date1 = (date1 < 10 ? "0" + date1: date1); var myDate = year + "-" + month + "-" + date1; let orderJson = { "appKey": "5c1d4c54d0ebd67b", "sign": "ZWFjNDRhNzg5YWEyZjMxMWI3MGVmYWRiNDA0YTk3NWI4OTQ5NWEzYmUwNzQxZDJjZmU1YzNiODRiZTVhNjNiMQ==", "worksheetId": "62d418282f553935daa79446", "controls": [{ "controlId": "date", "value": myDate }, { "controlId": "customOrderId", "value": jsonObject.customOrderId }, { "controlId": "address", "value": jsonObject.url }, { "controlId": "orderType", "value": jsonObject.orderType }, { "controlId": "amount", "value": jsonObject.amount }, { "controlId": "currency", "value": jsonObject.currency }, { "controlId": "rmbAmount", "value": "0" }, { "controlId": "orderDetail", "value": orderDetailData.data }, { "controlId": "customer", "value": "dbe25f3d-8ffa-4cf7-9f05-39d925df8acb" }, { "controlId": "paidStatus", "value": "未付款" }, { "controlId": "shipStatus", "value": "未发货" }, { "controlId": "billStatus", "value": "未做账" }, { "controlId": "ownerid", "value": "788f7a8a-3a41-48db-9de8-6bae9d0991d5" }] }; console.log(orderJson); let orderRequest = new Request('http://xcadey.tpddns.cn:8880/api/v2/open/worksheet/addRow', { method: 'POST', body: JSON.stringify(orderJson), headers: headers }); //let url = 'http://xcadey.natapp1.cc/'; fetch(orderRequest).then(response => response.json()) //定义返回的类型和数据格式 .then(function(data) { console.log(data); if(data.success == true){ alert('添加成功'); document.getElementsByClassName('icon icon-task-later refresh Gray_bd Font18 pointer ThemeHoverColor3 mTop2')[0].click(); }else { alert(data.error_msg); } }) // 返回的数据 }) // 返回的数据 } let span1 = document.createElement('span'); span1.setAttribute('style', 'background-color: rgb(69, 90, 100);'); span1.setAttribute('class', 'addRow'); span1.onclick = function() { ck() }; let span2 = document.createElement('span'); span2.innerHTML = '自动新增订单'; span2.setAttribute('class', 'White bold'); span1.insertAdjacentElement('beforeend', span2); document.getElementsByClassName('sc-hZhUor bXnKmF')[0].insertAdjacentElement('beforeend', span1); // Your code here... })();