bztang-admin/addons/yun_shop/static/app/js/chunk-af9c00c8.a22fde52.js

1 line
6.3 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-af9c00c8"],{"172d":function(t,e,i){"use strict";i.d(e,"a",(function(){return a}));i("b64b"),i("e9c4"),i("99af"),i("b680");var a={data:function(){return{header:{},goodsData:[],isLoadMore:!0,page:1,goodsDetail:{},ratio_data:{}}},activated:function(){},methods:{getCPSLogin:function(t){var e=this;if(this.page=1,this.isLoadMore=!0,this.goodsData=[],window.localStorage.getItem("CPSHeader")){if(this.header=JSON.parse(window.localStorage.getItem("CPSHeader")),this.header.t+420>Math.round(new Date/1e3))return void("list"===t?this.searchCPSGood():"good"===t?this.getGoodDetail():"link"===t?this.getCPSLink():"bird_link"===t?this.getCPSBirdLink():this.getCPSGood(0,this.datas.list[0].text));window.localStorage.removeItem("CPSHeader")}$http.get("plugin.aggregation-cps.api.web.mergeLogin",{},"加载中").then((function(i){1===i.result?(e.header=i.data.header,window.localStorage.setItem("CPSHeader",JSON.stringify(e.header)),"list"===t?e.searchCPSGood():"good"===t?e.getGoodDetail():"link"===t?e.getCPSLink():"bird_link"===t?e.getCPSBirdLink():e.getCPSGood(0,e.datas.list[0].text)):e.$dialog.alert({message:i.msg})}))},getPDDLogin:function(t,e,i,a){var o=this;$http.fetchUrl("https://v3.biyingniao.com/api/v3/user/is_union_oauth",{params:{platform:e},headers:this.header},"加载中").then((function(s){0===s.code?s.data.is_oauth?"list"===t?o.searchCPSGood():"good"===t?o.getGoodDetail():o.getCPSGood(t,i,a):window.location.href=2==e?s.data.oauth_url_info.url:s.data.oauth_url.url:30004===s.code&&o.getCPSLogin(t,e,i,a)}))},getCPSGood:function(t,e,i){var a=this;if(this.isLoadMore){this.isLoadMore=!1,"more"!==i&&(this.show_page=!1,this.show_text="加载中...");var o="https://v3.biyingniao.com/api/v3/goods/pdd/search";2==this.datas.list[t].is_minApp?o="https://v3.biyingniao.com/api/v3/goods/jd/search":3==this.datas.list[t].is_minApp&&(o="https://v3.biyingniao.com/api/v3/goods/tb/search"),$http.fetchUrl(o,{params:{keyword:1==this.datas.list[t].is_minApp?e:e||"百货",page:this.page},headers:this.header},"加载中").then((function(o){0===o.code?(1===a.page&&a.getRatio(),a.isLoadMore=o.data.has_next,a.goodsData="more"!==i?o.data.data||[]:a.goodsData.concat(o.data.data||[]),a.show_page=!0):30009===o.code||30007===o.code||1e4===o.code?(a.isLoadMore=!0,1==a.datas.list[t].is_minApp?a.getPDDLogin(t,2,e,i):3==a.datas.list[t].is_minApp&&a.getPDDLogin(t,1,e,i)):30004===o.code?a.getCPSLogin(t):(a.isLoadMore=!0,a.show_page=!1,a.show_text="数据报错",a.$dialog.alert({message:o.message}))}))}},searchCPSGood:function(){var t=this;if(this.isLoadMore){this.isLoadMore=!1;var e="https://v3.biyingniao.com/api/v3/goods/pdd/search";"jd"===this.searchActive?e="https://v3.biyingniao.com/api/v3/goods/jd/search":"tb"===this.searchActive&&(e="https://v3.biyingniao.com/api/v3/goods/tb/search");var i={keyword:"pdd"===this.searchActive?this.searchKey:this.searchKey||"百货",page:this.page};!this.searchKey&&this.channel_type&&(i={channel_type:this.channel_type,page:this.page},e="https://v3.biyingniao.com/api/v3/goods/pdd/recommend","jd"===this.searchActive&&(e="https://v3.biyingniao.com/api/v3/goods/jd/jf")),"tb"===this.searchActive&&!this.searchKey&&this.material_id&&(e="https://v3.biyingniao.com/api/v3/goods/tb/matter",i={material_id:this.material_id,page:this.page}),this.searchKey?this.channel_type_name="搜索":this.$route.query.channel_type_name&&(this.channel_type_name="".concat(this.$route.query.channel_type_name).concat("jd"===this.searchActive?"-京东":"tb"===this.searchActive?"-淘宝":"-拼多多")||"商品列表"),this.fun.setWXTitle(this.channel_type_name),this.fun.wxShare("",{},{title:this.channel_type_name}),$http.fetchUrl(e,{params:i,headers:this.header},"加载中").then((function(e){0===e.code?(1===t.page&&t.getRatio(),t.page+=1,t.isLoadMore=e.data.has_next,t.goodsData=t.goodsData.concat(e.data.data||[])):30009===e.code||30007===e.code||1e4===e.code?(t.isLoadMore=!0,"pdd"===t.searchActive?t.getPDDLogin("list",2):"jd"===t.searchActive?t.getCPSLogin("list"):"tb"===t.searchActive&&t.getPDDLogin("list",1)):30004===e.code?t.getCPSLogin("list"):(t.isLoadMore=!0,t.$dialog.alert({message:e.message}))}))}},getGoodDetail:function(){var t=this;$http.fetchUrl("https://v3.biyingniao.com/api/v3/goods/detail",{params:{item_id:this.good.item_id,platform_id:this.good.platform_id,activity_id:this.good.activity_id},headers:this.header},"加载中").then((function(e){0===e.code?(t.goodsDetail=e.data||{},t.fun.wxShare("",{mid:t.fun.getKeyByMid()},{title:t.goodsDetail.title,imgUrl:t.goodsDetail.cover_image,description:t.goodsDetail.title}),t.getRatio()):30009===e.code||30007===e.code||1e4===e.code?30007===e.code?t.getCPSLogin("good"):t.getPDDLogin("good",t.good.platform_id):30004===e.code?t.getCPSLogin("good"):t.$dialog.alert({message:e.message})}))},getCPSLink:function(){var t=this;$http.fetchUrl("https://v3.biyingniao.com/api/v3/popularize/cps",{params:{id:this.id,phone:this.phone},headers:this.header},"加载中").then((function(e){0===e.code?window.location.href=e.data.click_url:t.$dialog.alert({message:e.message})}))},getRatio:function(){var t=this;this.ratio_data&&this.ratio_data.ratio||$http.get("plugin.aggregation-cps.api.setting.index").then((function(e){1==e.result&&(t.ratio_data=e.data,t.ratioCommissionAmount=(t.goodsDetail.discount_price*(t.goodsDetail.tk_rate/100)*.78*.97*(t.ratio_data.ratio/100)).toFixed(2),t.shareCommissionAmount=(t.goodsDetail.discount_price*(t.goodsDetail.tk_rate/100)*.78*.97*(t.ratio_data.agent_ratio/100)).toFixed(2))}))},getCPSBirdLink:function(){window.location.href=decodeURIComponent(this.$route.query.bird_link)+"&token="+this.header.authorization}}}},e6b6:function(t,e,i){"use strict";i.r(e);var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div")},o=[],s=(i("14d9"),i("172d")),d={mixins:[s["a"]],data:function(){return{id:"",phone:"",need_mobile:""}},activated:function(){this.id=this.$route.query.plat_id,this.need_mobile=this.$route.query.need_mobile,this.$route.query.bird_link?this.getCPSLogin("bird_link"):1==this.need_mobile?this.getPhone():this.getCPSLogin("link")},methods:{getPhone:function(){var t=this;$http.get("plugin.aggregation-cps.api.web.getMobile").then((function(e){1==e.result?(t.phone=e.data.mobile,t.phone?t.getCPSLogin("link"):t.$router.push(t.fun.getUrl("editmobile"))):t.$dialog.alert({message:e.message})}))}}},n=d,h=i("2877"),r=Object(h["a"])(n,a,o,!1,null,"b5ba7df0",null);e["default"]=r.exports}}]);