insuranceDialog.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <u-popup v-if="showData" mode="center" round="10" :show="showMod" :closeOnClickOverlay="false">
  3. <view class="dialog">
  4. <view class="close">
  5. <u-icon name="close" color="#9E9E9E" size="24" @tap="closeDialog"></u-icon>
  6. </view>
  7. <view class="top">
  8. <image
  9. v-if="[2, 3].includes(showData.remindIn)"
  10. src="@/static/images/dialog/insurance-icon1.png"
  11. mode="widthFix"
  12. ></image>
  13. <image
  14. v-if="[1, 4].includes(showData.remindIn)"
  15. src="@/static/images/dialog/insurance-icon2.png"
  16. mode="widthFix"
  17. ></image>
  18. </view>
  19. <view v-if="[1, 2, 3].includes(showData.remindIn)" class="title">保险购买提示</view>
  20. <view v-if="[4].includes(showData.remindIn)" class="title">入驻申请提示</view>
  21. <view class="text" v-if="[1].includes(showData.remindIn)"
  22. >您在{{ showData.websitName }}网点入驻申请已审核通过,请尽快购买意外保险,以免影响接单</view
  23. >
  24. <view class="text" v-if="[2].includes(showData.remindIn)"
  25. >您在{{ showData.websitName }}网点的意外险距离到期还有{{
  26. calculateDaysDifference(showData.endTime)
  27. }}天,请及时续保,以免影响接单</view
  28. >
  29. <view class="text" v-if="[3].includes(showData.remindIn)"
  30. >您在{{ showData.websitName }}网点的意外险已过期,为了您的安全保障,请及时续保,以免影响接单</view
  31. >
  32. <view class="text" v-if="[4].includes(showData.remindIn)"
  33. >您在{{ showData.websitName }}网点入驻申请正在审核中,请耐心等待。</view
  34. >
  35. <view class="btn">
  36. <u-button
  37. v-if="[1].includes(showData.remindIn)"
  38. text="去购买"
  39. shape="circle"
  40. type="primary"
  41. @click="clickButton()"
  42. >
  43. </u-button>
  44. <u-button
  45. v-if="[2, 3].includes(showData.remindIn)"
  46. text="去续保"
  47. shape="circle"
  48. type="primary"
  49. @click="clickButton()"
  50. >
  51. </u-button>
  52. <u-button
  53. v-if="[4].includes(showData.remindIn)"
  54. text="知道了"
  55. shape="circle"
  56. type="primary"
  57. @click="closeDialog"
  58. >
  59. </u-button>
  60. </view>
  61. </view>
  62. </u-popup>
  63. </template>
  64. <script>
  65. export default {
  66. props: {
  67. data: {
  68. type: Array,
  69. default: () => []
  70. }
  71. },
  72. data() {
  73. return {
  74. data_: []
  75. }
  76. },
  77. watch: {
  78. data(newVal, oldVal) {
  79. this.data_ = JSON.parse(JSON.stringify(newVal)).map(item => {
  80. return {
  81. ...item,
  82. show_: true
  83. }
  84. })
  85. }
  86. },
  87. computed: {
  88. showData() {
  89. return this.data_.find(item => item.show_)
  90. },
  91. showMod() {
  92. return !!this.showData
  93. }
  94. },
  95. methods: {
  96. closeDialog() {
  97. var index = this.data_.map(item => item.websitId).indexOf(this.showData.websitId)
  98. if (~index) {
  99. this.data_.splice(index, 1, {
  100. ...this.showData,
  101. show_: false
  102. })
  103. }
  104. },
  105. clickButton() {
  106. this.$navToPage({
  107. url: '/packageEnter/pages/insurance/myInsuranceBuy/index?websitId=' + this.showData.websitId
  108. })
  109. this.$nextTick(() => {
  110. setTimeout(() => {
  111. this.closeDialog()
  112. }, 500)
  113. })
  114. },
  115. calculateDaysDifference(timeString) {
  116. const inputDate = new Date(timeString)
  117. const currentDate = new Date()
  118. const timeDiff = currentDate - inputDate
  119. const daysDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24))
  120. return daysDiff
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="scss" scoped>
  126. .dialog {
  127. width: 640rpx;
  128. background: #ffffff;
  129. border-radius: 20rpx;
  130. overflow: hidden;
  131. position: relative;
  132. display: flex;
  133. flex-direction: column;
  134. align-items: center;
  135. padding: 0 70rpx 70rpx;
  136. box-sizing: border-box;
  137. .close {
  138. position: absolute;
  139. right: 40rpx;
  140. top: 40rpx;
  141. }
  142. .top {
  143. margin-top: 30rpx;
  144. image {
  145. width: 390rpx;
  146. height: 220rpx;
  147. }
  148. }
  149. .title {
  150. font-size: 44rpx;
  151. font-weight: 500;
  152. }
  153. .text {
  154. text-align: center;
  155. font-size: 32rpx;
  156. color: $sec-font;
  157. line-height: 48rpx;
  158. margin-top: 30rpx;
  159. }
  160. .btn {
  161. width: 100%;
  162. margin-top: 60rpx;
  163. }
  164. }
  165. </style>