certificate.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <view class="pages">
  3. <web-view v-if="loadWeb" :src="certificateUrl
  4. +'credentialNo='+item.credentialNo
  5. +'&year='+item.year
  6. +'&carbonAmount='+item.carbonAmount
  7. +'&orderAmount='+item.orderAmount
  8. +'&buyDate='+item.buyDate
  9. +'&farmerName='+item.farmerName
  10. +'&certName='+item.certName
  11. +'&isH5=true'
  12. ">
  13. </web-view>
  14. </web-view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. components:{
  20. },
  21. data() {
  22. return {
  23. $getimg:this.$getimg,
  24. certificateUrl:this.config.certificateUrl,
  25. thetoken:'',
  26. orderid:'',
  27. item:null,
  28. loadWeb:false,
  29. path:'',
  30. params:{},
  31. }
  32. },
  33. onShow() {
  34. },
  35. onLoad(e) {
  36. console.log('config',this.config);
  37. this.thetoken = 'Bearer' + ' ' + this.$store.state.token;
  38. this.orderid = e.orderid;
  39. uni.showLoading({
  40. title: '正在获取证书信息'
  41. });
  42. this.$api.http.get(this.config.apiBaseurl + '/carbon-h5/wap/order/getCredentialByOrderId?orderId='+this.orderid,{
  43. header: {
  44. Accept:'application/json',
  45. Authorization: this.thetoken,
  46. },
  47. }).then(res => {
  48. uni.hideLoading();
  49. this.item = res.data.retBody;
  50. this.item.certName = this.item.certType == 1 ? this.item.customerName : this.item.companyName //1普通用户 2企业用户
  51. var that = this;
  52. setTimeout(function () {
  53. that.loadWeb = true;
  54. }, 1000);
  55. // this.info = Object.assign(this.info, data);
  56. // this.info.url = '/static/html2canvas/index.html?key=' + this.orderid;
  57. // console.log('this.base.views',this.base.views);
  58. // this.base.views[1].text = `证书编号:${res.data.retBody.credentialNo}`;
  59. // this.base.views[2].text = `尊敬的 ${res.data.retBody.customerName}:`;
  60. // this.base.views[3].text = `感谢您对“碳汇+”生态产品价值实现的支持,您购买了 ${res.data.retBody.year}年度碳汇量${res.data.retBody.carbonAmount}kg,您购碳资金${res.data.retBody.orderAmount}元,已全额转入${res.data.retBody.farmerName}的银行账户。`;
  61. // console.log('res',JSON.parse(JSON.stringify(res.data.retBody)));
  62. }).catch(err =>{
  63. console.log('err',err)
  64. });
  65. },
  66. methods: {
  67. }
  68. }
  69. </script>
  70. <style>
  71. @import url("./certificate.css");
  72. </style>