confirmBinding.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <view style="background-color: #fff;">
  3. <ujp-navbar :title="newsDetail.title">
  4. </ujp-navbar>
  5. <u-alert-tips type="warning"
  6. :descStyle="{
  7. fontSize: '28rpx',
  8. color: '#ef7a30',
  9. }"
  10. :show-icon="true" description="阅读至底部进入绑定页面"></u-alert-tips>
  11. <view class="main">
  12. <view class="news-content" v-html="newsDetail.value">
  13. </view>
  14. </view>
  15. <button class="btn" @click="submit">我已阅读并同意</button>
  16. </view>
  17. </template>
  18. <script>
  19. import * as newsApi from '@/apis/news.js'
  20. import * as API from '@/apis/finance.js'
  21. export default {
  22. data() {
  23. return {
  24. id: '',
  25. code:"",
  26. stationId:"",
  27. newsDetail: '',
  28. obj1:{},
  29. }
  30. },
  31. onLoad(op) {
  32. if(op.id){
  33. this.id=op.id
  34. this.getInfo()
  35. }
  36. if(op.stationId){
  37. this.stationId=op.stationId;
  38. }
  39. },
  40. methods: {
  41. submit(){
  42. var url="/pagesFinance/user/confirmBindingStep2?id="+this.id;
  43. if(this.stationId){
  44. url+="&stationId="+this.stationId;
  45. }
  46. uni.redirectTo({
  47. url:url
  48. })
  49. },
  50. getNewsInfoDetail() {
  51. uni.showLoading({
  52. title: "加载中",
  53. mask: true,
  54. })
  55. var list=["","buyType1","buyType2"]
  56. newsApi.findConfigureByKey({
  57. key:"buyType"+this.code
  58. }).then((res) => {
  59. uni.hideLoading()
  60. this.newsDetail = res.data;
  61. this.$nextTick(()=>{
  62. var list =document.getElementsByClassName("news-content")[0].getElementsByTagName("img");
  63. var table =document.getElementsByClassName("news-content")[0].getElementsByTagName("table");
  64. for(var i=0;i<list.length;i++){
  65. list[i].style='width: 100%;height: 100%;'
  66. }
  67. for(var i=0;i<table.length;i++){
  68. var t=table[i].style.width="100%;"
  69. t= t.replace("width:","width-1:")
  70. table[i].style="width: 100%;"+t
  71. }
  72. })
  73. }).catch(error => {
  74. uni.showToast({
  75. title: error,
  76. icon: "none"
  77. })
  78. })
  79. },
  80. getInfo(){
  81. uni.showLoading({
  82. title: "加载中",
  83. mask: true,
  84. })
  85. var obj={
  86. deviceNo:this.id
  87. }
  88. API.findByDeviceNo(obj).then((res) => {
  89. this.obj1 = res.data.chargingDevice
  90. this.code=this.obj1.buyType
  91. if(this.code){
  92. this.getNewsInfoDetail();
  93. }else{
  94. this.submit()
  95. }
  96. uni.hideLoading()
  97. }).catch(error => {
  98. uni.showToast({
  99. title: error
  100. })
  101. })
  102. }
  103. }
  104. }
  105. </script>
  106. <style lang="scss" scoped>
  107. .main{
  108. margin: 0px 16px ;
  109. padding-bottom: 34px;
  110. .new-title{
  111. color: #101010;
  112. font-size: 18px;
  113. height: 48px;
  114. margin: 16px 0 35px;
  115. }
  116. .time{
  117. display: flex;
  118. justify-content: space-between;
  119. color: #888888;
  120. .num{
  121. margin-left: 4px;
  122. }
  123. }
  124. .news-content{
  125. margin-top: 13px;
  126. font-size: 14px;
  127. line-height: 28px;
  128. color: #101010;
  129. }
  130. }
  131. .btn{
  132. width: 91.4%;
  133. line-height: 44px;
  134. border-radius: 8px;
  135. background-color: rgba(24, 90, 198, 1);
  136. color: rgba(255, 255, 255, 1);
  137. font-size: 16px;
  138. }
  139. </style>