albert_test1

emu脚本测试-offer面板

// ==UserScript==
// @name         albert_test1
// @namespace    http://tampermonkey.net/
// @version      1.0.2
// @description  emu脚本测试-offer面板
// @author       Albert
// @match        http://console.emusprint.com/*
// @match        http://console.doubletick.ink/*
// @match        http://console.apexmobi.site/*
// @match        http://console.powermob.top/*
// @match        http://console.snowywin.com/*
// @match        http://console.fortunecatclick.com/*
// @match        http://console.viloonmobi.com/*
// @match        http://console.innermobi.com/*
// @match        https://console.novabeyond.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant        none
// @run-at       document-end
// ==/UserScript==



(()=>{"use strict";var t={n:e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},d:(e,o)=>{for(var n in o)t.o(o,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:o[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};const e=Vue;var o=t.n(e),n=function(){var t=this,e=t._self._c;return e("div",{attrs:{id:"menu_drag"}},[e("el-dropdown",[e("el-button",{staticStyle:{"font-size":"30px",padding:"10px"},attrs:{type:"primary",icon:"el-icon-menu",circle:""}}),t._v(" "),e("el-dropdown-menu",{scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-dropdown-item",{nativeOn:{click:function(e){return t.showConfirmDialog.apply(null,arguments)}}},[t._v("offer操作")]),t._v(" "),e("el-dropdown-item",{nativeOn:{click:function(e){return t.test_dialog.apply(null,arguments)}}},[t._v("测试")])]}}])})],1),t._v(" "),e("confirm-dialog-component",{ref:"confirmDialog"})],1)};n._withStripped=!0;var a=function(){var t=this,e=t._self._c;return e("el-dialog",{staticStyle:{"background-color":"rgba(0, 0, 0, 0.5)"},attrs:{visible:t.dialogVisible,title:t.offerId||"选择操作",modal:!1},on:{"update:visible":function(e){t.dialogVisible=e}}},[e("el-input",{attrs:{placeholder:"请输入Offer ID",span:8},on:{blur:t.fetchOfferInfo},model:{value:t.offerId,callback:function(e){t.offerId=e},expression:"offerId"}},[e("template",{slot:"prepend"},[t._v("Offer ID")]),t._v(" "),e("el-button",{attrs:{slot:"append",icon:"el-icon-search"},on:{click:t.fetchOfferInfo},slot:"append"})],2),t._v(" "),t.offerInfo?e("div",{staticClass:"offer-info"},[e("div",{staticStyle:{"font-size":"14px","line-height":"1.7"}},[t._v("\n        "+t._s(t.offerInfo.offerName)+" | "+t._s(t.offerInfo.prodName)+"\n      ")]),t._v(" "),e("el-card",[e("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[e("span",[t._v("批单操作:")])]),t._v(" "),e("el-row",{attrs:{gutter:20}},[e("el-col",{attrs:{span:8}},[e("el-select",{attrs:{placeholder:"选择渠道",clearable:""},model:{value:t.selectedOption,callback:function(e){t.selectedOption=e},expression:"selectedOption"}},t._l(t.options,(function(t){return e("el-option",{key:t.id,attrs:{label:`${t.id} - ${t.company}`,value:t.id}})})),1)],1),t._v(" "),e("el-col",{attrs:{span:8}},[e("el-input",{attrs:{placeholder:"Payout"},model:{value:t.payout,callback:function(e){t.payout=t._n(e)},expression:"payout"}},[e("template",{slot:"prepend"},[t._v("Payout")])],2)],1),t._v(" "),e("el-col",{attrs:{span:8}},[e("el-input",{attrs:{placeholder:"Adjust"},model:{value:t.adjust,callback:function(e){t.adjust=t._n(e)},expression:"adjust"}},[e("template",{slot:"prepend"},[t._v("Adjust")])],2)],1)],1),t._v(" "),e("el-row",[e("el-col",{attrs:{span:24}},[e("el-button",{attrs:{type:"success"},on:{click:t.confirm_offer}},[t._v("确认批单")])],1)],1)],1),t._v(" "),e("el-card",[e("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[e("span",[t._v("其他操作:")]),t._v(" "),e("el-row",[e("el-col",{attrs:{span:24}},[e("el-button",{on:{click:function(e){return t.changStatus("active")}}},[t._v("Active")]),t._v(" "),e("el-button",{on:{click:function(e){return t.changStatus("hold")}}},[t._v("Hold")])],1)],1)],1)])],1):t._e(),t._v(" "),e("span",{staticStyle:{display:"flex","justify-content":"flex-end"},attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.dialogVisible=!1}}},[t._v("取消")])],1)],1)};async function r(t,e){const o=`${window.location.protocol}//${window.location.host}`+e;try{const e=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json","access-control-allow-origin":"*"},body:JSON.stringify(t)});return await e.json()}catch(t){throw console.error("Error: ",t),t}}function i(t,e,o,n,a,r,i,l){var s,f="function"==typeof t?t.options:t;if(e&&(f.render=e,f.staticRenderFns=o,f._compiled=!0),n&&(f.functional=!0),r&&(f._scopeId="data-v-"+r),i?(s=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),a&&a.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(i)},f._ssrRegister=s):a&&(s=l?function(){a.call(this,(f.functional?this.parent:this).$root.$options.shadowRoot)}:a),s)if(f.functional){f._injectStyles=s;var c=f.render;f.render=function(t,e){return s.call(e),c(t,e)}}else{var d=f.beforeCreate;f.beforeCreate=d?[].concat(d,s):[s]}return{exports:t,options:f}}a._withStripped=!0;var l=i({data:()=>({dialogVisible:!1,offerId:"",offerInfo:null,selectedOption:null,options:[],payout:"0.004",adjust:"0"}),methods:{async show(){this.options=await async function(){try{const t=await r({page:{page:1,rows:1e4}},"/api/affiliate/affiliateList");return Array.isArray(t.data.dataList)?t.data.dataList:(alert("err err"),[])}catch(t){return[]}}(),this.dialogVisible=!0,this.offerId=function(t){var e=document.querySelectorAll("label.el-form-item__label");for(var o of e)if("OfferId"===o.textContent.trim()){var n=o.closest(".el-form-item").querySelector("input.el-input__inner");if(n)return n.value}return!1}()||"",this.offerId&&await this.fetchOfferInfo()},async fetchOfferInfo(){this.offerInfo=await async function(t){var e={data:{offerId:t}};try{return(await r(e,"/api/offer/detail")).data.offer}catch(t){return null}}(this.offerId)},async confirm_offer(){this.offerId?confirm(`您确定要确认批单吗?单号: ${this.offerId}`)&&await async function(t,e,o,n){var a={data:{affiliateIds:t,cap:null,payout:o,rate:n,payoutPercent:null,dailyCap:null,clickCap:null,offerId:e.join(",")}};0===(await r(a,"/api/affiliate/addAffOfferWhitelistRecord")).status.code&&alert("操作成功")}([this.selectedOption],[this.offerId],this.payout,this.adjust):alert("请输入Offer ID")},async changStatus(t){this.offerId?confirm(`您确定要${t}吗?单号: ${this.offerId}`)&&await async function(t,e){var o={data:{offerIds:t,status:e}};0===(await r(o,"/api/offer/batchModifyStatus")).status.code&&alert("操作成功")}([this.offerId],t):alert("请输入Offer ID")},resetForm(){this.selectedOption=null,this.payout="",this.adjust=""}}},a,[],!1,null,null,null);const s=i({components:{ConfirmDialogComponent:l.exports},data:()=>({x:0,y:0,left:100,top:100}),mounted(){this.makeDraggable()},methods:{showConfirmDialog(){this.$refs.confirmDialog.show()},test_dialog(){alert("waiting....")},makeDraggable(){const t=document.querySelector("#menu_drag");let e=!1,o=0,n=0;const a=a=>{e&&(t.style.position="absolute",t.style.left=a.pageX-o+"px",t.style.top=a.pageY-n+"px")},r=()=>{e=!1,document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",r)};t.addEventListener("mousedown",(i=>{e=!0,o=i.pageX-t.offsetLeft,n=i.pageY-t.offsetTop,document.addEventListener("mousemove",a),document.addEventListener("mouseup",r)}))}}},n,[],!1,null,null,null).exports,f=ELEMENT;var c=t.n(f),d=document.createElement("div");d.style.position="fixed",d.style.bottom="20px",d.style.right="20px",d.style.zIndex="1000",d.style.width="150px",d.style.height="150px";const u=document.createElement("div");u.id="plugin-app",d.appendChild(u),document.body.appendChild(d),o().use(c()),new(o())({el:"#plugin-app",components:{MenuComponent:s},template:"<MenuComponent/>"})})();