113 lines
3.1 KiB
JavaScript
113 lines
3.1 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const api_booking_userInvoice_index = require("../../api/booking/userInvoice/index.js");
|
|
const utils_common = require("../../utils/common.js");
|
|
const _sfc_main = {
|
|
data() {
|
|
return {
|
|
isLogin: false,
|
|
logo: "",
|
|
imgUrls: "",
|
|
pdfUrl: ""
|
|
};
|
|
},
|
|
onLoad(e) {
|
|
this.reload(e.id);
|
|
},
|
|
methods: {
|
|
async reload(orderNo) {
|
|
const app = this;
|
|
await api_booking_userInvoice_index.showInvoice(orderNo).then((res) => {
|
|
if (res) {
|
|
const json = JSON.parse(res);
|
|
if (json.code) {
|
|
const result = json.result;
|
|
console.log("json: ", json);
|
|
console.log("json: ", json.code);
|
|
console.log("result: ", result);
|
|
if (result.length > 0) {
|
|
app.imgUrls = result[0].imgUrls;
|
|
app.pdfUrl = result[0].pdfUrl;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
},
|
|
navTo(item) {
|
|
if (!this.isLogin) {
|
|
this.$refs.login.open("bottom");
|
|
return false;
|
|
}
|
|
utils_common.openUrl(item);
|
|
},
|
|
// 弹出登录提示框
|
|
openLogin() {
|
|
if (!this.isLogin) {
|
|
this.$refs.login.open("bottom");
|
|
return false;
|
|
}
|
|
},
|
|
onDown(text) {
|
|
const app = this;
|
|
console.log(text);
|
|
common_vendor.index.setClipboardData({
|
|
data: app.pdfUrl,
|
|
success: function() {
|
|
console.log("success");
|
|
},
|
|
complete: function(res) {
|
|
console.log(1, res);
|
|
}
|
|
});
|
|
common_vendor.index.getClipboardData({
|
|
success: function(res) {
|
|
console.log(2, res.data);
|
|
},
|
|
complete: function(res) {
|
|
console.log(3, res);
|
|
}
|
|
});
|
|
console.log("复制发票222", app.pdfUrl);
|
|
},
|
|
saveFile(tempFilePath) {
|
|
common_vendor.index.saveFile({
|
|
tempFilePath,
|
|
//临时路径
|
|
success: function(res) {
|
|
common_vendor.index.showToast({
|
|
icon: "none",
|
|
mask: true,
|
|
title: "文件已保存:" + res.savedFilePath,
|
|
//保存路径
|
|
duration: 3e3
|
|
});
|
|
setTimeout(() => {
|
|
common_vendor.index.openDocument({
|
|
filePath: res.savedFilePath,
|
|
success: function(res2) {
|
|
}
|
|
});
|
|
}, 3e3);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_uv_button2 = common_vendor.resolveComponent("uv-button");
|
|
_easycom_uv_button2();
|
|
}
|
|
const _easycom_uv_button = () => "../../uni_modules/uv-button/components/uv-button/uv-button.js";
|
|
if (!Math) {
|
|
_easycom_uv_button();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return {
|
|
a: $data.imgUrls,
|
|
b: common_vendor.o(($event) => $options.onDown($data.pdfUrl)),
|
|
c: common_vendor.o(($event) => $options.onDown($data.pdfUrl))
|
|
};
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/package/user/invoice-show.vue"]]);
|
|
wx.createPage(MiniProgramPage);
|