最近项目中要对接订单信息,打印快递面单。这里记录下开发流程。

前端方面流程还是很简单的。

1.电脑安装 连接好打印机  并安装对应打印机驱动

2.电脑安装 菜鸟打印组件   
  下载地址:http://cloudprint.cainiao.com/cloudprint/client/CNPrintSetup.exe?spm=a219a.7629140.0.0.YJQX7O&file=CNPrintSetup.exe

3.在开始打印前 要注意你的快递面单尺寸,在打印组件中需要设置对应打印机的纸张尺寸

4.现在开始使用代码打印了

文档:
开放平台-文档中心

下面贴上我的代码:

<template><div><el-button @click="onStart">打印</el-button><el-button @click="getPrints">获取打印机列表</el-button><el-button @click="setPrinterConfig">设置打印机配置</el-button><el-button @click="getPrinterConfig">获取打印机配置</el-button><el-button @click="getExpressCompaniesPrinter">获取快递设置的打印机</el-button></div>
</template><script>let socket, defaultPrinter;let num = [{waybillCode: "3738460008834",printData: {data: '',// templateURL: 'http://cloudprint.cainiao.com/template/standard/101/123'templateURL: 'http://cloudprint.cainiao.com/template/standard/101/635'},objectId: "1"}];let jsonObject = {content: {"data": {"_dataFrom": "waybill","adsInfo": {"adId": "556","advertisementType": "COMMERCIAL","bannerUrl": "http://ad-cdn.cainiao.com/361/1607308583670.JPG","miniBannerUrl": "http://ad-cdn.cainiao.com/361/1607308576681.JPG","trackUrl": "https://ad.cainiao.com/9kESOzk"},"cpCode": "ZTO",        //不同快递 cpCode不同"needEncrypt": false,"packageInfo": {"currentPackageSequence": 0,"id": "-1","totalPackagesCount": 0,"volume": 0,"weight": 0},"parent": false,"recipient": {"address": {"city": "杭州市","detail": "文一西路969号","district": "余杭区","province": "浙江省"},"mobile": "13100000001","name": "李四"},"routingInfo": {"blockCode": "969","consolidation": {"code": "571901"},"origin": {"code": "731091","name": "湖南省长沙市岳麓三部"},"receiveBranch": {"code": "571937","name": "浙江省杭州市余杭区桃花港直营"},"routeCode": "342-075-00 250","sortation": {"name": "余杭"},"startCenter": {},"terminalCenter": {"code": "571901","name": "杭州转运中心"}},"sender": {"address": {"city": "长沙市","detail": "东方红中路175号","district": "岳麓区","province": "湖南省"},"mobile": "13000000000","name": "张三"},"shippingOption": {"code": "STANDARD_EXPRESS","title": "标准快递"},"waybillCode": "YT5202203890344"},"signature": "MD:U1Pw5p49tvW2JMD0HlRIEA==",//templateURL  每个快递的模板都不同"templateURL":"http://cloudprint.cainiao.com/template/standard/308812/7"}};export default {name: "frm_orders_ship",mounted() {const that = this;socket = new WebSocket('ws://127.0.0.1:13528');socket.onopen = function (event) {// 监听消息socket.onmessage = function (event) {console.log('Client received a message', event);console.log(JSON.parse(event.data).defaultPrinter);defaultPrinter = JSON.parse(event.data).defaultPrinter;that.subscribe(JSON.parse(event.data))};// 监听Socket的关闭socket.onclose = function (event) {console.log('Client notified socket has closed', event);};};},methods: {subscribe: function (data) {switch (data.cmd) {case 'getPrinters':console.log("获取打印机列表");console.log(data.printers);break;case 'getPrinterConfig':console.log("获取打印机配置");console.log(data.printer);break;case 'print':console.log("发送打印");console.log(data);break;case 'notifyPrintResult':console.log("打印通知");console.log(data);break;case 'setPrinterConfig':console.log("设置打印机配置");console.log(data);break;}},getPrints: function () {this.getPrintList()//打印机列表},getExpressCompaniesPrinter: function () {let express_companies_printer = localStorage.getItem("rmt_set_express_companies_printer");console.log(express_companies_printer)},getPrinterConfig: function () {let request = this.getRequestObject("getPrinterConfig");request.printer = "KM-118";if (socket.readyState === 1) {console.log(request);socket.send(JSON.stringify(request));}},setPrinterConfig: function () {let request = this.getRequestObject("setPrinterConfig");request.printer = {"name": "KM-118","needTopLogo": true}if (socket.readyState === 1) {console.log(request)socket.send(JSON.stringify(request));}},onStart: function () {this.doPrint(defaultPrinter, num)},getPrintList: function () {let request = this.getRequestObject("getPrinters");if (socket.readyState === 1) {console.log(request)socket.send(JSON.stringify(request));}},getRequestObject: function (cmd) {let request = new Object();request.requestID = this.getUUID(8, 16);request.version = "1.0";request.cmd = cmd;return request;},getUUID: function (len, radix) {let chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');let uuid = [], i;radix = radix || chars.length;if (len) {for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix];} else {let r;uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';uuid[14] = '4';for (i = 0; i < 36; i++) {if (!uuid[i]) {r = 0 | Math.random() * 16;uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];}}}return uuid.join('');},//printer 指定打印机doPrint: function (printer, waybillArray) {let request = this.getRequestObject("print");request.task = new Object();request.task.taskID = this.getUUID(8, 10);request.task.preview = false;request.task.printer = printer;let documents = new Array();for (let i = 0; i < waybillArray.length; i++) {let doc = new Object();doc.documentID = waybillArray[i];let content = new Array();let waybillJson = this.getWaybillJson(waybillArray[i]);let customAreaData = this.getCustomAreaData(waybillArray[i]);content.push(waybillJson, customAreaData);doc.contents = content;documents.push(doc);}request.task.documents = documentssocket.send(JSON.stringify(request));},getWaybillJson: function (waybillNO) {//获取waybill对应的json object,此处的ajaxGet函数是伪代码// let jsonObject = ajaxGet(waybillNO);return jsonObject;},getCustomAreaData: function (waybillNO) {//获取waybill对应的自定义区的JSON object,此处的ajaxGet函数是伪代码// let jsonObject = ajaxGet(waybillNO);let ret = new Object();ret.templateURL = jsonObject.content.templateURL;ret.data = jsonObject.content.data;return ret;}}}
</script><style scoped></style>

不同快递的模板都不相同,当然可以在自己的菜鸟服务平台自定义模板。下面贴上多家快递定义好的模板,自定义的时候可以将这些模板里面的代码copy过去,修改下就ok拉

{"data": [{"cpCode": "ZTKY","standardTemplateDOs": [{"standardWaybillType": "4","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/407120/1","standardTemplateName": "中铁快运标准面单"}]},{"cpCode": "GTO","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/1101/109","standardTemplateName": "国通快递标准模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/75504/30","standardTemplateName": "国通快递标准三联模板"}]},{"cpCode": "5000000007756","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/82710/25","standardTemplateName": "中国邮政国内标快标准模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/84011/26","standardTemplateName": "中国邮政国内标快标准三联模板"},{"standardWaybillType": "3","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/288617/4","standardTemplateName": "中国邮政国内标快便携式模板"}]},{"cpCode": "DBKD","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/1301/123","standardTemplateName": "德邦快递标准模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/75304/39","standardTemplateName": "德邦快递标准三联模板"},{"standardWaybillType": "3","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286604/5","standardTemplateName": "德邦快递便携式模板"},{"standardWaybillType": "7","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286355/3","standardTemplateName": "德邦快递标准模板(蓝牙版)"},{"standardWaybillType": "6","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/293905/21","standardTemplateName": "德邦一联单模板"},{"standardWaybillType": "8","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/300104/9","standardTemplateName": "德邦快递蓝牙一联单"}]},{"cpCode": "QFKD","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/1401/120","standardTemplateName": "全峰快递标准模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/76802/31","standardTemplateName": "全峰快递标准三联模板"}]},{"cpCode": "2460304407_385","standardTemplateDOs": [{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/190602/7","standardTemplateName": "远成快运三联标准模板"},{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/190302/8","standardTemplateName": "远成快运标准模板"}]},{"cpCode": "UC","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/1001/135","standardTemplateName": "优速快递标准模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/75105/41","standardTemplateName": "优速快递标准三联模板"},{"standardWaybillType": "3","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286605/5","standardTemplateName": "优速快递便携式模板"},{"standardWaybillType": "7","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286187/3","standardTemplateName": "优速快递标准模板(蓝牙版)"}]},{"cpCode": "STO","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/201/211","standardTemplateName": "申通快递标准模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/75402/54","standardTemplateName": "申通快递标准三联模板"},{"standardWaybillType": "3","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/269738/14","standardTemplateName": "申通快递便携式模板"},{"standardWaybillType": "7","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/285415/4","standardTemplateName": "申通快递标准模板(蓝牙版)"},{"standardWaybillType": "6","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/288948/49","standardTemplateName": "申通快递一联单"},{"standardWaybillType": "8","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/300002/14","standardTemplateName": "申通蓝牙一联单"}]},{"cpCode": "EYB","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/1601/124","standardTemplateName": "EMS经济快递标准模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/75404/29","standardTemplateName": "EMS经济快递标准三联模板"}]},{"cpCode": "CP457538","standardTemplateDOs": [{"standardWaybillType": "4","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/285042/3","standardTemplateName": "卡行天下快运标准模板"}]},{"cpCode": "SF","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/1501/69","standardTemplateName": "顺丰速运标准模板"}]},{"cpCode": "ZTO","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/301/221","standardTemplateName": "中通快递标准模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/74805/47","standardTemplateName": "中通快递标准三联模板"},{"standardWaybillType": "7","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/285198/2","standardTemplateName": "中通快递标准模板(蓝牙版)"},{"standardWaybillType": "3","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/278404/3","standardTemplateName": "中通便携式模板"},{"standardWaybillType": "3","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/288345/4","standardTemplateName": "中通便携式模板(高度200mm)"},{"standardWaybillType": "6","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/300336/32","standardTemplateName": "中通一联单"},{"standardWaybillType": "8","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/308812/7","standardTemplateName": "中通蓝牙一联单"}]},{"cpCode": "YTO","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/101/635","standardTemplateName": "圆通快递标准模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/72417/106","standardTemplateName": "圆通快递标准三联模板"},{"standardWaybillType": "3","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/269439/13","standardTemplateName": "圆通快递便携式模板"},{"standardWaybillType": "7","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/285423/10","standardTemplateName": "圆通快递标准模板(蓝牙版)"},{"standardWaybillType": "6","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/290659/43","standardTemplateName": "圆通一联单"},{"standardWaybillType": "8","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/300502/12","standardTemplateName": "圆通蓝牙一联单"}]},{"cpCode": "TTKDEX","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/601/162","standardTemplateName": "天天快递标准模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/76403/58","standardTemplateName": "天天快递标准三联模板"},{"standardWaybillType": "3","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/270135/15","standardTemplateName": "天天快递便携式模板"},{"standardWaybillType": "7","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/285703/2","standardTemplateName": "天天快递标准模板(蓝牙版)"},{"standardWaybillType": "6","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/298499/17","standardTemplateName": "天天一联单"},{"standardWaybillType": "8","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/300401/11","standardTemplateName": "天天快递蓝牙一联单"}]},{"cpCode": "SNWL","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/266904/4","standardTemplateName": "苏宁标准面单"},{"standardWaybillType": "3","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286484/3","standardTemplateName": "苏宁快递便携式模板"}]},{"cpCode": "CN7000001017817","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/238398/3","standardTemplateName": "申通快运标准模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/238614/4","standardTemplateName": "申通快运三联模板"}]},{"cpCode": "HOAU","standardTemplateDOs": [{"standardWaybillType": "4","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/291152/15","standardTemplateName": "天地华宇快运"}]},{"cpCode": "HTKY","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/501/168","standardTemplateName": "百世快递标准模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/74606/49","standardTemplateName": "百世快递标准三联模板"},{"standardWaybillType": "6","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/278716/35","standardTemplateName": "百世快递一联单(新)"},{"standardWaybillType": "3","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/278380/8","standardTemplateName": "百世快递便携式模板"},{"standardWaybillType": "7","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/285199/4","standardTemplateName": "百世快递标准模板(蓝牙版)"}]},{"cpCode": "100004928","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/34725/47","standardTemplateName": "如风达标准模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/75603/23","standardTemplateName": "如风达标准三联模板"}]},{"cpCode": "CN7000001009020","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/194938/6","standardTemplateName": "德邦快运标准模板(即将下线)"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/194434/5","standardTemplateName": "德邦快运三联模板(即将下线)"},{"standardWaybillType": "4","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/250621/4","standardTemplateName": "德邦快递(物流)"}]},{"cpCode": "CP443514","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/280999/1","standardTemplateName": "百世云配标准面单"}]},{"cpCode": "YUNDA","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/401/198","standardTemplateName": "韵达快递标准模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/76303/59","standardTemplateName": "韵达快递标准三联模板"},{"standardWaybillType": "3","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/278831/13","standardTemplateName": "韵达快递便携式模板"},{"standardWaybillType": "7","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/285424/5","standardTemplateName": "韵达快递标准模板(蓝牙版)"},{"standardWaybillType": "3","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/288357/3","standardTemplateName": "韵达便携式(高度160)"},{"standardWaybillType": "6","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/288658/29","standardTemplateName": "韵达快递一联单"},{"standardWaybillType": "8","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/300202/16","standardTemplateName": "韵达蓝牙一联单"}]},{"cpCode": "ZJS","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/901/130","standardTemplateName": "宅急送标准模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/75104/28","standardTemplateName": "宅急送标准三联模板"},{"standardWaybillType": "3","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286607/5","standardTemplateName": "宅急送快递便携式模板"},{"standardWaybillType": "7","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286705/1","standardTemplateName": "宅急送快递标准模板(蓝牙版)"},{"standardWaybillType": "6","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/309188/4","standardTemplateName": "宅急送一联单"}]},{"cpCode": "FEDEX","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/261503/4","standardTemplateName": "联邦快递标准面单"}]},{"cpCode": "3108002701_1011","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/191833/8","standardTemplateName": "中通快运标准模板(即将下线)"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/192140/5","standardTemplateName": "中通快运三联模板(即将下线)"},{"standardWaybillType": "4","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/256771/9","standardTemplateName": "中通快运标准面单"}]},{"cpCode": "BESTQJT","standardTemplateDOs": [{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/83910/75","standardTemplateName": "百世快运标准三联模板(即将下线)"},{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/84010/27","standardTemplateName": "百世快运标准模板(即将下线)"},{"standardWaybillType": "4","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/250934/8","standardTemplateName": "百世快运(电商)"}]},{"cpCode": "CP471906","standardTemplateDOs": [{"standardWaybillType": "4","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/327512/1","standardTemplateName": "顺心捷达快运标准面单"}]},{"cpCode": "CN7000001000869","standardTemplateDOs": [{"standardWaybillType": "4","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/251315/6","standardTemplateName": "安能快运"}]},{"cpCode": "2744832184_543","standardTemplateDOs": [{"standardWaybillType": "4","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/251413/6","standardTemplateName": "壹米滴答"}]},{"cpCode": "EMS","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/701/137","standardTemplateName": "EMS标准模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/76503/40","standardTemplateName": "EMS标准三联模板"},{"standardWaybillType": "3","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286353/6","standardTemplateName": "EMS快递便携式模板"},{"standardWaybillType": "7","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286356/1","standardTemplateName": "EMS快递标准模板(蓝牙版)"},{"standardWaybillType": "6","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/345208/2","standardTemplateName": "EMS一联单"}]},{"cpCode": "XFWL","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/249128/7","standardTemplateName": "信丰物流标准二联模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/249422/7","standardTemplateName": "信丰物流三联模板"}]},{"cpCode": "2383545689_32","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/188729/9","standardTemplateName": "九曳标准模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/188817/7","standardTemplateName": "九曳标准三联模板"}]},{"cpCode": "POSTB","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/801/148","standardTemplateName": "中国邮政快递包裹标准模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/75704/41","standardTemplateName": "中国邮政快递包裹标准三联模板"},{"standardWaybillType": "6","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/275609/14","standardTemplateName": "中国邮政快递包裹一联单"},{"standardWaybillType": "3","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286704/5","standardTemplateName": "中国邮政快递包裹便携式模板"},{"standardWaybillType": "7","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286357/1","standardTemplateName": "中国邮政快递包裹标准面单(蓝牙版)"},{"standardWaybillType": "6","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/304351/5","standardTemplateName": "快递包裹一联单(高度130)"},{"standardWaybillType": "8","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/308720/5","standardTemplateName": "邮政包裹蓝牙一联单"}]},{"cpCode": "CN7000001021040","standardTemplateDOs": [{"standardWaybillType": "4","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/256622/10","standardTemplateName": "韵达快运标准面单"}]},{"cpCode": "CN7000001003751","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/181603/10","standardTemplateName": "跨越速运标准模版"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/182004/9","standardTemplateName": "跨越速运标准三联模版"},{"standardWaybillType": "3","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286606/5","standardTemplateName": "跨越速运便携式模板"},{"standardWaybillType": "7","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286188/2","standardTemplateName": "跨越速运标准模板(蓝牙版)"}]},{"cpCode": "100007887","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/248932/3","standardTemplateName": "递速物流标准二联模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/249423/3","standardTemplateName": "递速物流三联模板"},{"standardWaybillType": "3","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/290472/1","standardTemplateName": "递速物流便携式模板"},{"standardWaybillType": "7","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/290473/1","standardTemplateName": "递速蓝牙标准模板"}]},{"cpCode": "SURE","standardTemplateDOs": [{"standardWaybillType": "4","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/281280/3","standardTemplateName": "速尔快递一票多件"}]},{"cpCode": "CP570969","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/279710/6","standardTemplateName": "丹鸟二联模板"},{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/309239/1","standardTemplateName": "丹鸟外单"},{"standardWaybillType": "8","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/393904/3","standardTemplateName": "蓝牙丹鸟一联单"}]},{"cpCode": "2608021499_235","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/183119/10","standardTemplateName": "安能快递标准模版"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/183020/9","standardTemplateName": "安能快递标准三联模版"},{"standardWaybillType": "3","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/288514/4","standardTemplateName": "安能快递便携式模板"},{"standardWaybillType": "7","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/289106/1","standardTemplateName": "安能快递标准模板(蓝牙版)"}]},{"cpCode": "CP446169","standardTemplateDOs": [{"standardWaybillType": "4","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/403974/1","standardTemplateName": "加运美快运二联单"}]},{"cpCode": "CP468398","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/272031/4","standardTemplateName": "圆通承诺达二联模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/272141/4","standardTemplateName": "圆通承诺达三联模板"},{"standardWaybillType": "3","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/283369/8","standardTemplateName": "承诺达便携式模板"}]},{"cpCode": "FAST","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/1201/108","standardTemplateName": "快捷快递标准模板"},{"standardWaybillType": "2","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/74806/31","standardTemplateName": "快捷快递标准三联模板"}]},{"cpCode": "CP449455","standardTemplateDOs": [{"standardWaybillType": "1","standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/403585/1","standardTemplateName": "京广速递二联单"}]}],"success": "true"
}

websocket的连接可以使用reconnecting-websocket.js

reconnecting websocket是一个javascript的websocket库,非常小,压缩后仅有3KB。它的功能是当websocket断线后自动帮你重连

使用也很简单

import ReconnectingWebSocket from "./reconnecting-websocket"
this.socket = new ReconnectingWebSocket('ws://127.0.0.1:13528');

vue项目中使用cn打印组件相关推荐

  1. vue项目中element-ui的分页器(组件封装)

    vue项目中element-ui的分页器组件 <template><el-col :span="24" class="toolbar" sty ...

  2. 如何在vue项目中使用lodop打印插件

    如何在vue项目中使用lodop打印插件 - 简书 先写了个webdemo <%--Created by IntelliJ IDEA.User: AdministratorDate: 2018/ ...

  3. 详解如何在vue项目中使用lodop打印插件,以及样式打印预览缺失的问题(底部)

    C-Lodop是一个免费云服务程序,可接受来自其它平台浏览器的JavaScrip语句实现远程打印. 目前是各家软件公司进行手机或微信远程打印的流行解决方案. 和其它"云打印"概念相 ...

  4. vue项目中可使用天气预报小组件推荐vue-mini-weather

    该部分内容引自 基于Vue开发的迷你实时天气预报组件 由于该组件在2021.4.24日刚上传到npm仓库,请用npm安装! 1.安装 npm i vue-mini-weather --save 2.引 ...

  5. 项目前端(一)、vue项目中引入vue-router路由组件

    1.在项目根目录下,执行 npm install vue-vouter 是否成功引入router路由组件,我们可以查看package.json文件中dependencies标签下是否有vue-rout ...

  6. vue项目中创建子路由组件

    1.项目目录src/pages 2.router.js {path: '/shop',component: Shop,children: [{path: '/shop/goods',component ...

  7. 在已有vue项目中半途引入cube ui组件库的使用遇到的坑(血泪)

    直接进入正题(我这儿是属于cube-ui普通编译) 1,在你的vue项目中找到package.json文件安装cube-ui 终端输入命令   npm install cube-ui --save 2 ...

  8. vue 项目中页面打印实现(去除页眉页脚)

    vue 项目中页面打印实现 参考文章: 13 Paged media 项目描述: 背景:框架vue.组件 element-ui,已有一个在用的后台管理系统 需求:现需在列表页面添加按钮-----打印协 ...

  9. vue 项目中实现pdf预览 pdf打印 pdf下载

    在Vue项目中实现PDF预览.打印和下载可以通过以下步骤来实现: 安装pdf.js pdf.js是一个JavaScript库,可以用于在Web上渲染PDF文件. 可以使用npm安装pdf.js,命令如 ...

  10. Vue项目中公用footer组件底部位置的适配问题

    vue项目中公用footer组件底部位置的适配问题 需求: footer为公用组件,其他页面都需要引入,这是会存在一种情况:有的页面高度很高,footer组件要放在内容的最后:有的页面内容很少,高度很 ...

最新文章

  1. python密码测试代码_python使用正则表达式检测密码强度源码分享
  2. 数据可视化教程来了!
  3. 获取本地公网ip_本地与远程linux服务器之间传输数据
  4. idea中实体类右击没有ptg_几个牛逼的IDEA插件,Java开发者撸码神器,还带动图的!...
  5. swagger2 集成无效_Springboot2 集成Swagger2,解决配置完成后不显示的坑
  6. SHELL相关的特殊字符总结
  7. java 视图对象转换_java-如何从onItemSelected()方法返回的视图对象...
  8. android js调试
  9. Java转置_Java实现单链表的逆转置
  10. VoIP:难以抵挡的灰色诱惑
  11. 深入浅出统计学-第一章
  12. 法定节假日调整方案公布
  13. HTMLCSS仿京东注册页面制作静态页面总结
  14. DIV+CSS+JavaScript技术制作网页(旅游主题网页设计与制作)云南大理
  15. VC+API模拟键盘按键(详解篇)
  16. 方便实用的串口调试工具/串口调试助手/串口精灵 (工具一)
  17. 映泰主板虚拟机AMD-V设置
  18. 20套各种风格影视动画公司响应式企业模电影上映影讯网站模板电影软件网页CSS模板html5网页静态模板Bootstrap扁平化网站源码css3手机seo自适响应
  19. 【已解决】office提示你的许可证不是正版,你可能是盗版软件的受害者?
  20. Lombok 新特性(idea插件)

热门文章

  1. 人脸识别有滥用风险,使用加密函数?
  2. c语言谭浩强第七章例题
  3. 技术指南 | 使用 mPaaS 配置 SM2 国密加密指南
  4. 吴恩达机器学习视频学习笔记(2)
  5. 2分钟教你部署2048小游戏到云服务器
  6. Ruijie SSL V P N 垂直越权漏洞
  7. Cobalt Strike 从入门到入狱(三)
  8. Java防御目录穿越漏洞方法_WinRAR目录穿越漏洞复现及防御
  9. dism命令使用教程_Dism命令教程修复Windows
  10. 基于MATLAB的无线视频传输