|
@@ -3,7 +3,7 @@ const app = {};
|
|
|
import downloadBtnIcon from '../../static/images/download.png';
|
|
|
import { mapState } from 'vuex';
|
|
|
import uni from '@/utils/uniHooks';
|
|
|
-import { invoicesAgainSandEmail } from '@/api/parking';
|
|
|
+import { invoicesAgainSandEmail, invoiceEmails } from '@/api/parking';
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
@@ -14,6 +14,7 @@ export default {
|
|
|
setTime: 60,
|
|
|
timer: null,
|
|
|
order: {},
|
|
|
+ res: {},
|
|
|
preUrl: '',
|
|
|
};
|
|
|
},
|
|
@@ -22,13 +23,7 @@ export default {
|
|
|
// this.order = {
|
|
|
// mailbox: '1212'
|
|
|
// }
|
|
|
- console.log('获取的发票信息', this.order);
|
|
|
- // 埋点本地化
|
|
|
- this.preUrl = uni.getStorageSync('previousUrl');
|
|
|
- uni.setStorageSync(
|
|
|
- 'previousUrl',
|
|
|
- '/pages/parkingFee/parkingReceipt/parkingInvoiceImage.vue'
|
|
|
- );
|
|
|
+ this.getEmail()
|
|
|
},
|
|
|
mounted() {
|
|
|
setTimeout(() => {
|
|
@@ -49,99 +44,88 @@ export default {
|
|
|
}),
|
|
|
},
|
|
|
methods: {
|
|
|
- downloadOrder(url) {
|
|
|
- uni.downloadFile({
|
|
|
- url: url,
|
|
|
- success: function (res) {
|
|
|
- console.log('下载文档成功');
|
|
|
- var filePath = res.tempFilePath;
|
|
|
- uni.openDocument({
|
|
|
- filePath: filePath,
|
|
|
- success: function (res) {
|
|
|
- console.log('打开文档成功');
|
|
|
- },
|
|
|
- });
|
|
|
- },
|
|
|
- });
|
|
|
- },
|
|
|
- pushAgain: async function (url) {
|
|
|
- const self = this;
|
|
|
- if (self.setTime >= 0 && self.timer) {
|
|
|
+ getEmail: async function () {
|
|
|
+ try {
|
|
|
+ const res = await invoiceEmails()
|
|
|
+ this.res = res
|
|
|
+ } catch {
|
|
|
uni.showToast({
|
|
|
- title: '邮件已发送,请于1分钟后再试',
|
|
|
+ title: '未请求到邮箱信息',
|
|
|
icon: 'none',
|
|
|
});
|
|
|
- return false;
|
|
|
}
|
|
|
- if (self.timer && self.setTime < 0) {
|
|
|
- clearTimeout(self.timer);
|
|
|
- self.timer = null;
|
|
|
- }
|
|
|
- self.timer = setTimeout(() => {
|
|
|
- self.setTime--;
|
|
|
- }, 1000);
|
|
|
- const data = {
|
|
|
- attachments: [
|
|
|
- {
|
|
|
- name: '嘉里停车发票.pdf',
|
|
|
- invoiceId: self.order.id,
|
|
|
- url: url,
|
|
|
- },
|
|
|
- ],
|
|
|
- html: true,
|
|
|
- sendTo: 'string',
|
|
|
- sendTos: [self.order.mailbox],
|
|
|
- subject: self.order.invoiceTitleName + '的电子发票',
|
|
|
- text: '停车发票',
|
|
|
- };
|
|
|
- self.$md(data);
|
|
|
+ },
|
|
|
+ pushAgain: async function (id) {
|
|
|
+ const self = this;
|
|
|
+ // if (self.setTime >= 0 && self.timer) {
|
|
|
+ // uni.showToast({
|
|
|
+ // title: '邮件已发送,请于1分钟后再试',
|
|
|
+ // icon: 'none',
|
|
|
+ // });
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+ // if (self.timer && self.setTime < 0) {
|
|
|
+ // clearTimeout(self.timer);
|
|
|
+ // self.timer = null;
|
|
|
+ // }
|
|
|
+ // self.timer = setTimeout(() => {
|
|
|
+ // self.setTime--;
|
|
|
+ // }, 1000);
|
|
|
+ // const data = {
|
|
|
+ // attachments: [
|
|
|
+ // {
|
|
|
+ // name: '嘉里停车发票.pdf',
|
|
|
+ // invoiceId: self.order.id,
|
|
|
+ // url: url,
|
|
|
+ // },
|
|
|
+ // ],
|
|
|
+ // html: true,
|
|
|
+ // sendTo: 'string',
|
|
|
+ // sendTos: [self.order.mailbox],
|
|
|
+ // subject: self.order.invoiceTitleName + '的电子发票',
|
|
|
+ // text: '停车发票',
|
|
|
+ // };
|
|
|
+ // self.$md(data);
|
|
|
try {
|
|
|
const res = await invoicesAgainSandEmail(id)
|
|
|
- if (res) {
|
|
|
uni.showToast({
|
|
|
title: '邮件已发送邮箱,请注意查收',
|
|
|
icon: 'none',
|
|
|
+ duration: 2000
|
|
|
});
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: res.data.msg,
|
|
|
- duration: 2000,
|
|
|
- icon: 'none',
|
|
|
- });
|
|
|
- }
|
|
|
} catch {
|
|
|
uni.showToast({
|
|
|
title: '服务器开小差了呢,请您稍后再试',
|
|
|
icon: 'none',
|
|
|
});
|
|
|
}
|
|
|
- uni.request({
|
|
|
- url: self.$baseURL + 'sms/email',
|
|
|
- method: 'POST',
|
|
|
- data: data,
|
|
|
- header: JSON.parse(uni.getStorageSync('handleUser')),
|
|
|
- success: (res) => {
|
|
|
- console.log('推送', res.data);
|
|
|
- if (res.data.code === 0) {
|
|
|
- uni.showToast({
|
|
|
- title: '邮件已发送邮箱,请注意查收',
|
|
|
- icon: 'none',
|
|
|
- });
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: res.data.msg,
|
|
|
- duration: 2000,
|
|
|
- icon: 'none',
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- fail: () => {
|
|
|
- uni.showToast({
|
|
|
- title: '服务器开小差了呢,请您稍后再试',
|
|
|
- icon: 'none',
|
|
|
- });
|
|
|
- },
|
|
|
- });
|
|
|
+ // uni.request({
|
|
|
+ // url: self.$baseURL + 'sms/email',
|
|
|
+ // method: 'POST',
|
|
|
+ // data: data,
|
|
|
+ // header: JSON.parse(uni.getStorageSync('handleUser')),
|
|
|
+ // success: (res) => {
|
|
|
+ // console.log('推送', res.data);
|
|
|
+ // if (res.data.code === 0) {
|
|
|
+ // uni.showToast({
|
|
|
+ // title: '邮件已发送邮箱,请注意查收',
|
|
|
+ // icon: 'none',
|
|
|
+ // });
|
|
|
+ // } else {
|
|
|
+ // uni.showToast({
|
|
|
+ // title: res.data.msg,
|
|
|
+ // duration: 2000,
|
|
|
+ // icon: 'none',
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // fail: () => {
|
|
|
+ // uni.showToast({
|
|
|
+ // title: '服务器开小差了呢,请您稍后再试',
|
|
|
+ // icon: 'none',
|
|
|
+ // });
|
|
|
+ // },
|
|
|
+ // });
|
|
|
},
|
|
|
},
|
|
|
};
|