|
@@ -1,183 +1,181 @@
|
|
|
export default {
|
|
|
- install(Vue){
|
|
|
+ install(Vue) {
|
|
|
Vue.prototype.getOpenid = function(page) {
|
|
|
- //var host='http://www.kzmos.com/tianzong';
|
|
|
- var host='http://47.101.145.23/tianzong';
|
|
|
- if (localStorage.getItem("openid") != 'undefined' && localStorage.getItem("openid") != null)
|
|
|
- return;
|
|
|
- var code = this.getUrlParam("code");
|
|
|
- if (code == 'undefined' || code == null || code == "") {
|
|
|
- //alert("参数异常,请返回首页重试");
|
|
|
- this.urlredirect(page);
|
|
|
- return;
|
|
|
- }
|
|
|
- this.$http.post(host + "/weixin/getWxUserInfo", {
|
|
|
- code: code,
|
|
|
- userId:localStorage.getItem("userId")
|
|
|
- }, {
|
|
|
- emulateJSON: true
|
|
|
- })
|
|
|
- .then(res => {
|
|
|
- //发送成功
|
|
|
- console.log(res);
|
|
|
-
|
|
|
- if (res.body.code == '0') {
|
|
|
- localStorage.setItem("openid", res.body.openId);
|
|
|
- localStorage.setItem("headimgurl", res.body.headimgurl);
|
|
|
- //this.$store.commit("getId",res.body.data)
|
|
|
- } else {
|
|
|
- //console.log(res);
|
|
|
- this.urlredirect(page);
|
|
|
- }
|
|
|
+ // var host='http://www.kzmos.com/tianzong';
|
|
|
+ // http://47.101.145.23/tianzong
|
|
|
+ var host = ''
|
|
|
+ if (localStorage.getItem('openid') !== 'undefined' && localStorage.getItem('openid') != null) { return }
|
|
|
+ var code = this.getUrlParam('code')
|
|
|
+ if (code === 'undefined' || code == null || code === '') {
|
|
|
+ // alert("参数异常,请返回首页重试");
|
|
|
+ this.urlredirect(page)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$http.post(host + '/weixin/getWxUserInfo', {
|
|
|
+ code: code,
|
|
|
+ userId: localStorage.getItem('userId')
|
|
|
+ }, {
|
|
|
+ emulateJSON: true
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ // 发送成功
|
|
|
+ console.log(res)
|
|
|
|
|
|
- //if()
|
|
|
- }, res => {
|
|
|
- //发送失败
|
|
|
- })
|
|
|
+ if (res.body.code === '0') {
|
|
|
+ localStorage.setItem('openid', res.body.openId)
|
|
|
+ localStorage.setItem('headimgurl', res.body.headimgurl)
|
|
|
+ // this.$store.commit("getId",res.body.data)
|
|
|
+ } else {
|
|
|
+ // console.log(res);
|
|
|
+ this.urlredirect(page)
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ // if()
|
|
|
+ }, res => {
|
|
|
+ // 发送失败
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
- Vue.prototype.urlredirect=function(page) {
|
|
|
- var host='http://47.101.145.23/wuliu';
|
|
|
- window.location.href =
|
|
|
- "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx3d3b98cc26425f40&redirect_uri=" + host + page + "&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect";
|
|
|
- }
|
|
|
- Vue.prototype.getUrlParam=function(name) {
|
|
|
- var vars = [],
|
|
|
- hash;
|
|
|
- var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
|
|
- for (var i = 0; i < hashes.length; i++) {
|
|
|
- hash = hashes[i].split('=');
|
|
|
- vars.push(hash[0]);
|
|
|
- vars[hash[0]] = hash[1];
|
|
|
- }
|
|
|
- return decodeURIComponent(vars[name]);
|
|
|
+ Vue.prototype.urlredirect = function(page) {
|
|
|
+ var host = 'http://47.101.145.23/wuliu'
|
|
|
+ window.location.href =
|
|
|
+ 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx3d3b98cc26425f40&redirect_uri=' + host + page + '&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect'
|
|
|
+ }
|
|
|
+ Vue.prototype.getUrlParam = function(name) {
|
|
|
+ var vars = []
|
|
|
+ var hash
|
|
|
+ var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&')
|
|
|
+ for (var i = 0; i < hashes.length; i++) {
|
|
|
+ hash = hashes[i].split('=')
|
|
|
+ vars.push(hash[0])
|
|
|
+ vars[hash[0]] = hash[1]
|
|
|
}
|
|
|
- Vue.prototype.getUser=function(){
|
|
|
- this.$http.post(this.$store.state.host+"/personal/getPersonalInfoByUserId.do",{userId:this.userId},{emulateJSON:true})
|
|
|
- .then(res=>{
|
|
|
- //发送成功
|
|
|
- if(res.body.msg=='success'){
|
|
|
- this.user=res.body.personalInfo;
|
|
|
- }
|
|
|
- },res=>{
|
|
|
- //发送失败
|
|
|
- })
|
|
|
- }
|
|
|
- //代收人列表
|
|
|
- Vue.prototype.findCollectAgentList=function(){
|
|
|
- this.$http.post(this.$store.state.host+"/sendMail/findCollectAgentList.do",{},{emulateJSON:true})
|
|
|
- .then(res=>{
|
|
|
- //发送成功
|
|
|
- if(res.body.msg=='success'){
|
|
|
- this.dsList = res.body.list
|
|
|
- for(var i=0;i<this.dsList.length;i++){
|
|
|
- this.dsList[i].text = this.dsList[i].name+' '+this.dsList[i].phone + ' '+this.dsList[i].department
|
|
|
- }
|
|
|
- }
|
|
|
- },res=>{
|
|
|
- //发送失败
|
|
|
- })
|
|
|
- }
|
|
|
- //获取对应人的地址
|
|
|
- Vue.prototype.getPersonalAddressById=function(id){
|
|
|
- this.$http.post(this.$store.state.host+"/personal/getPersonalAddress.do",{userId:id},{emulateJSON:true})
|
|
|
- .then(res=>{
|
|
|
- //发送成功
|
|
|
- if(res.body.msg=='success'){
|
|
|
- this.address = res.body.address
|
|
|
- }
|
|
|
- },res=>{
|
|
|
- //发送失败
|
|
|
- })
|
|
|
- }
|
|
|
- //代收人列表
|
|
|
- Vue.prototype.getLogisticsList=function(){
|
|
|
- this.$http.post(this.$store.state.host+"/sendMail/getLogisticsList.do",{},{emulateJSON:true})
|
|
|
- .then(res=>{
|
|
|
- //发送成功
|
|
|
- if(res.body.msg=='success'){
|
|
|
- this.columns = res.body.list
|
|
|
+ return decodeURIComponent(vars[name])
|
|
|
+ }
|
|
|
+ Vue.prototype.getUser = function() {
|
|
|
+ this.$http.post(this.$store.state.host + '/personal/getPersonalInfoByUserId.do', { userId: this.userId }, { emulateJSON: true })
|
|
|
+ .then(res => {
|
|
|
+ // 发送成功
|
|
|
+ if (res.body.msg === 'success') {
|
|
|
+ this.user = res.body.personalInfo
|
|
|
+ }
|
|
|
+ }, res => {
|
|
|
+ // 发送失败
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 代收人列表
|
|
|
+ Vue.prototype.findCollectAgentList = function() {
|
|
|
+ this.$http.post(this.$store.state.host + '/sendMail/findCollectAgentList.do', {}, { emulateJSON: true })
|
|
|
+ .then(res => {
|
|
|
+ // 发送成功
|
|
|
+ if (res.body.msg === 'success') {
|
|
|
+ this.dsList = res.body.list
|
|
|
+ for (var i = 0; i < this.dsList.length; i++) {
|
|
|
+ this.dsList[i].text = this.dsList[i].name + ' ' + this.dsList[i].phone + ' ' + this.dsList[i].department
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, res => {
|
|
|
+ // 发送失败
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 获取对应人的地址
|
|
|
+ Vue.prototype.getPersonalAddressById = function(id) {
|
|
|
+ this.$http.post(this.$store.state.host + '/personal/getPersonalAddress.do', { userId: id }, { emulateJSON: true })
|
|
|
+ .then(res => {
|
|
|
+ // 发送成功
|
|
|
+ if (res.body.msg === 'success') {
|
|
|
+ this.address = res.body.address
|
|
|
+ }
|
|
|
+ }, res => {
|
|
|
+ // 发送失败
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 代收人列表
|
|
|
+ Vue.prototype.getLogisticsList = function() {
|
|
|
+ this.$http.post(this.$store.state.host + '/sendMail/getLogisticsList.do', {}, { emulateJSON: true })
|
|
|
+ .then(res => {
|
|
|
+ // 发送成功
|
|
|
+ if (res.body.msg === 'success') {
|
|
|
+ this.columns = res.body.list
|
|
|
|
|
|
- for(var i=0;i<this.columns.length;i++){
|
|
|
- if(this.columns[i].companyFlag == '' ||this.columns[i].companyFlag == undefined){
|
|
|
- this.columns[i].text = this.columns[i].expressCompany
|
|
|
- }else{
|
|
|
- this.columns[i].text = this.columns[i].expressCompany+'('+this.columns[i].companyFlag+')'
|
|
|
- }
|
|
|
- }
|
|
|
- //默认顺丰快递
|
|
|
- this.expressInfoShow=this.columns[0].text
|
|
|
- this.expressInfo=this.columns[0].id
|
|
|
- this.expressPhone=this.columns[0].phone
|
|
|
- }
|
|
|
- },res=>{
|
|
|
- //发送失败
|
|
|
- })
|
|
|
- }
|
|
|
+ for (var i = 0; i < this.columns.length; i++) {
|
|
|
+ if (this.columns[i].companyFlag === '' || this.columns[i].companyFlag === undefined) {
|
|
|
+ this.columns[i].text = this.columns[i].expressCompany
|
|
|
+ } else {
|
|
|
+ this.columns[i].text = this.columns[i].expressCompany + '(' + this.columns[i].companyFlag + ')'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 默认顺丰快递
|
|
|
+ this.expressInfoShow = this.columns[0].text
|
|
|
+ this.expressInfo = this.columns[0].id
|
|
|
+ this.expressPhone = this.columns[0].phone
|
|
|
+ }
|
|
|
+ }, res => {
|
|
|
+ // 发送失败
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
- //成本中心列表
|
|
|
- Vue.prototype.getCostCenterList=function(){
|
|
|
- this.$http.post(this.$store.state.host+"/sendMail/getCostCenterList.do",{mailRoomId:this.mailRoomId},{emulateJSON:true})
|
|
|
- .then(res=>{
|
|
|
- //发送成功
|
|
|
- if(res.body.msg=='success'){
|
|
|
+ // 成本中心列表
|
|
|
+ Vue.prototype.getCostCenterList = function() {
|
|
|
+ this.$http.post(this.$store.state.host + '/sendMail/getCostCenterList.do', { mailRoomId: this.mailRoomId }, { emulateJSON: true })
|
|
|
+ .then(res => {
|
|
|
+ // 发送成功
|
|
|
+ if (res.body.msg === 'success') {
|
|
|
this.costCenterList = res.body.list
|
|
|
- for(var i=0;i<this.costCenterList.length;i++){
|
|
|
- this.costCenterList[i].text = this.costCenterList[i].costCenterName
|
|
|
- }
|
|
|
- this.costCenterInfoShow=this.costCenterList[0].text
|
|
|
- this.costCenterName=this.costCenterList[0].costCenterName
|
|
|
- this.costCenterId=this.costCenterList[0].id
|
|
|
+ for (var i = 0; i < this.costCenterList.length; i++) {
|
|
|
+ this.costCenterList[i].text = this.costCenterList[i].costCenterName
|
|
|
+ }
|
|
|
+ this.costCenterInfoShow = this.costCenterList[0].text
|
|
|
+ this.costCenterName = this.costCenterList[0].costCenterName
|
|
|
+ this.costCenterId = this.costCenterList[0].id
|
|
|
}
|
|
|
- },res=>{
|
|
|
- //发送失败
|
|
|
+ }, res => {
|
|
|
+ // 发送失败
|
|
|
})
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- //代收人列表
|
|
|
- Vue.prototype.getDefaultAddress=function(){
|
|
|
- this.$http.post(this.$store.state.host+"/solic/getDefaultAddress.do",{
|
|
|
- userId:localStorage.getItem("userId"),
|
|
|
- mailRoomId:localStorage.getItem("roomId")
|
|
|
- },{emulateJSON:true})
|
|
|
- .then(res=>{
|
|
|
- //发送成功
|
|
|
- if(res.body.msg=='success'){
|
|
|
- this.jjname=res.body.personalInfo.name+' '+res.body.personalInfo.phone
|
|
|
- this.jjadd=res.body.mailRoomInfo.province+" "+res.body.mailRoomInfo.city+" "+res.body.mailRoomInfo.area+' '+res.body.mailRoomInfo.address
|
|
|
- this.jjInfo.jjname = this.jjname
|
|
|
- this.jjInfo.jjadd = this.jjadd
|
|
|
- this.jjInfo.senderMobile = res.body.personalInfo.telephone
|
|
|
- this.jjInfo.sender = res.body.personalInfo.name
|
|
|
- this.jjInfo.senderPhone = res.body.personalInfo.phone
|
|
|
- this.jjInfo.sendAddr = res.body.mailRoomInfo.province+" "+res.body.mailRoomInfo.city+" "+res.body.mailRoomInfo.area
|
|
|
- this.jjInfo.sendAddress = res.body.mailRoomInfo.address
|
|
|
- this.$store.commit("getJjInfo",this.jjInfo)
|
|
|
- }
|
|
|
- },res=>{
|
|
|
- //发送失败
|
|
|
- })
|
|
|
- }
|
|
|
+ // 代收人列表
|
|
|
+ Vue.prototype.getDefaultAddress = function() {
|
|
|
+ this.$http.post(this.$store.state.host + '/solic/getDefaultAddress.do', {
|
|
|
+ userId: localStorage.getItem('userId'),
|
|
|
+ mailRoomId: localStorage.getItem('roomId')
|
|
|
+ }, { emulateJSON: true })
|
|
|
+ .then(res => {
|
|
|
+ // 发送成功
|
|
|
+ if (res.body.msg === 'success') {
|
|
|
+ this.jjname = res.body.personalInfo.name + ' ' + res.body.personalInfo.phone
|
|
|
+ this.jjadd = res.body.mailRoomInfo.province + ' ' + res.body.mailRoomInfo.city + ' ' + res.body.mailRoomInfo.area + ' ' + res.body.mailRoomInfo.address
|
|
|
+ this.jjInfo.jjname = this.jjname
|
|
|
+ this.jjInfo.jjadd = this.jjadd
|
|
|
+ this.jjInfo.senderMobile = res.body.personalInfo.telephone
|
|
|
+ this.jjInfo.sender = res.body.personalInfo.name
|
|
|
+ this.jjInfo.senderPhone = res.body.personalInfo.phone
|
|
|
+ this.jjInfo.sendAddr = res.body.mailRoomInfo.province + ' ' + res.body.mailRoomInfo.city + ' ' + res.body.mailRoomInfo.area
|
|
|
+ this.jjInfo.sendAddress = res.body.mailRoomInfo.address
|
|
|
+ this.$store.commit('getJjInfo', this.jjInfo)
|
|
|
+ }
|
|
|
+ }, res => {
|
|
|
+ // 发送失败
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
- //登录判断
|
|
|
- Vue.prototype.isLogin=function(){
|
|
|
- // this.$http.post(this.$store.state.host+"/appSysUser/isLogin.do",{
|
|
|
- // },{emulateJSON:true})
|
|
|
- // .then(res=>{
|
|
|
- // //console.log(res.body)
|
|
|
- // //发送成功
|
|
|
- // if(res.body.msg=='success'){
|
|
|
+ // 登录判断
|
|
|
+ Vue.prototype.isLogin = function() {
|
|
|
+ // this.$http.post(this.$store.state.host+"/appSysUser/isLogin.do",{
|
|
|
+ // },{emulateJSON:true})
|
|
|
+ // .then(res=>{
|
|
|
+ // //console.log(res.body)
|
|
|
+ // //发送成功
|
|
|
+ // if(res.body.msg=='success'){
|
|
|
|
|
|
- // }else{
|
|
|
- // //本地(服务器下面这个要放开)
|
|
|
- // localStorage.clear();
|
|
|
- // }
|
|
|
- // },res=>{
|
|
|
- // //发送失败
|
|
|
- // })
|
|
|
- }
|
|
|
+ // }else{
|
|
|
+ // //本地(服务器下面这个要放开)
|
|
|
+ // localStorage.clear();
|
|
|
+ // }
|
|
|
+ // },res=>{
|
|
|
+ // //发送失败
|
|
|
+ // })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|