"use strict";const e=require("../../common/vendor.js"),i=require("../../gen/Apis.js"),o=require("./model.js"),t=require("../../common/libraries/apiLoading.js"),l={getHouseDetail(e){},updateCoverInfo(){this.setCanvas(o.useModel.houseDetail.value)},setCanvas(o){const l=e.index.createCanvasContext("firstCanvas");((o,l)=>{t.getApiLoading(i.Apis.HouseOrder.HouseOrders.GetPayQrCode,{id:null==o?void 0:o.order_id}).then((i=>{var o;const t=e.index.getFileSystemManager();var a=(new Date).getTime(),n=e.wx$1.env.USER_DATA_PATH+"/"+a+".png";t.writeFile({filePath:n,data:null==(o=null==i?void 0:i.data)?void 0:o.qr_code.slice(22),encoding:"base64",success:()=>null==l?void 0:l(n)})}))})(o,(i=>{e.index.downloadFile({url:"https://jyw-dev-1322946948.cos.ap-guangzhou.myqcloud.com/uploads/cs-test/01K2GQ7CEB6DJ9BN8HMRV8SSWE.png",success(e){l.drawImage(e.tempFilePath,0,0,345,504),l.font="bold 18px Arial",l.setTextAlign("center"),l.fillText((null==o?void 0:o.name)||"-",172.5,45),l.font="bold 16px Arial",l.fillStyle="#DF3600",l.fillText(`缴费金额：${null==o?void 0:o.amount}元`,172.5,78),l.font="14px Arial",l.fillStyle="#333",l.fillText("请使用微信扫码支付",172.5,450),l.font="12px Arial",l.fillStyle="#666",l.fillText(`生成时间：${null==o?void 0:o.time}`,172.5,475),l.drawImage(i,72.5,150,200,200),l.restore(),l.draw()}}),console.log(i,"二维码路径")}))},onDownloadPosters(){e.index.showLoading({title:"正在保存中..."}),e.index.canvasToTempFilePath({x:0,y:0,width:345,height:504,destWidth:1380,destHeight:2016,canvasId:"firstCanvas",success:function(i){e.index.hideLoading(),e.index.saveImageToPhotosAlbum({filePath:i.tempFilePath,success:function(){console.log("save success"),e.index.hideLoading()},fail(){e.index.hideLoading()}}),console.log(i.tempFilePath)},fail(){e.index.hideLoading()}})},initActualImages:async e=>{},choiceImgPopControl(){var e;this.initActualImages(null==(e=o.useModel.houseDetail.value)?void 0:e.id)},copyLink(){}};exports.method=l;
