ui-tarpty.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <view class="all_box">
  3. <u-popup :show="show" @close="onClose(2)" round="20rpx">
  4. <view class="all_box_1">
  5. <view class="all_box_2" v-if="type==1">《租赁协议》</view>
  6. <view class="all_box_2" v-if="type==2">《认养协议》</view>
  7. <scroll-view scroll-y="true" class="popup_three" @scrolltolower="scrolltolower">
  8. <view class="popup_three_one">
  9. <u-parse v-html="list" :style="styles"></u-parse>
  10. </view>
  11. </scroll-view>
  12. <view class="all_box_4" @click="yudutap">
  13. <view v-if="tap==1" class="all_box_4_1">请上滑看完协议在同意</view>
  14. <view v-if="tap==2" class="all_box_4_2"> 我已阅读并知晓本协议</view>
  15. </view>
  16. </view>
  17. </u-popup>
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. name: "tarpty",
  23. props: {
  24. list: String,
  25. tarptyshow: Boolean,
  26. type:Number
  27. },
  28. data() {
  29. return {
  30. styles: {
  31. img: 'max-width: 95%; padding: 20rpx;',
  32. p: 'font-size:30rpx;padding:250rpx',
  33. span: 'font-size: 30rpx;padding:10rpx'
  34. },
  35. show: false,
  36. tap: 1,
  37. };
  38. },
  39. watch: {
  40. //因为是单项数据流,v-modal控制的组件显示隐藏,
  41. //父组件不可以通过props内的参数直接改变子元素参数,
  42. //所以我们通过watch来监控数据的变化,间接修改show的数据
  43. tarptyshow(val) {
  44. console.log('valzzz', val)
  45. this.show = val
  46. }
  47. },
  48. methods: {
  49. scrolltolower() {
  50. this.tap=2
  51. this.onClose(1)
  52. },
  53. yudutap(){
  54. this.tap=2
  55. this.onClose(2)
  56. },
  57. onClose(e) {
  58. if(e==2){
  59. this.show = false
  60. }
  61. this.$emit('tarptycolse', {
  62. show: this.show,
  63. tap:this.tap
  64. }) //通知父组件隐藏了
  65. },
  66. }
  67. }
  68. </script>
  69. <style lang='scss'>
  70. .all_box {
  71. min-height:0;
  72. .all_box_1 {
  73. display: flex;
  74. flex-direction: column;
  75. .popup_three {
  76. padding: 0 30rpx;
  77. width: 95%;
  78. max-height: 55vh;
  79. min-height: 30vh;
  80. display: flex;
  81. align-items: center;
  82. flex-direction: column;
  83. margin: 20rpx auto;
  84. overflow: hidden;
  85. .popup_three_one {
  86. -webkit-overflow-scrolling: touch;
  87. }
  88. }
  89. .all_box_2 {
  90. padding: 30rpx 0 0 20rpx;
  91. font-weight: 600;
  92. }
  93. .all_box_3 {
  94. padding: 0 30rpx;
  95. .all_box_3_1 {
  96. padding: 30rpx;
  97. min-height: 400rpx;
  98. max-width: 700rpx;
  99. background-color: #f5f5f5;
  100. }
  101. }
  102. .all_box_4 {
  103. background-color: #f5f5f5;
  104. display: flex;
  105. justify-content: center;
  106. /* line-height: 70rpx; */
  107. /* border-radius:100rpx; */
  108. padding: 20rpx 0rpx 20rpx 0rpx;
  109. .all_box_4_1 {
  110. background-color: darkgray;
  111. line-height: 70rpx;
  112. width: 60%;
  113. color: #fff;
  114. border-radius: 100rpx;
  115. text-align: center;
  116. }
  117. .all_box_4_2 {
  118. background-color: limegreen;
  119. line-height: 70rpx;
  120. width: 60%;
  121. color: #fff;
  122. border-radius: 100rpx;
  123. text-align: center;
  124. }
  125. }
  126. }
  127. }
  128. </style>