cm-ross-popup.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template name="cm-parameter">
  2. <!-- 相关规格 -->
  3. <tui-bottom-popup :radius="false" :show="popupShow">
  4. <view class="tui-popup-box clearfix">
  5. <view class="tui-popup-close" @click.stop="hidePopup">
  6. <text class="iconfont icon-iconfontguanbi"></text>
  7. </view>
  8. <view class="tui-popup-main" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
  9. <view class="tui-popup-from">
  10. <input
  11. class="input"
  12. type="text"
  13. v-model="consultParams.consultName"
  14. @input="handleInputName"
  15. placeholder="请输入名字"
  16. placeholder-style="color:#FFFFFF;"
  17. maxlength="10"
  18. />
  19. </view>
  20. <view class="tui-popup-from none">
  21. <input
  22. class="input"
  23. type="text"
  24. v-model="consultParams.consultMobile"
  25. @input="handleInputPhone"
  26. placeholder="请输入手机号"
  27. placeholder-style="color:#FFFFFF;"
  28. maxlength="11"
  29. />
  30. </view>
  31. </view>
  32. <view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
  33. <view class="tui-modal-flex">
  34. <button class="tui-modal-button" :class="isDisabled ? 'disabled' : ''" @click="handleSubmit">
  35. 提交
  36. </button>
  37. </view>
  38. <view class="tui-modal-text">
  39. <view class="tui-modal-left" @click.stop="this.$api.navigateTo('/pages/login/register-select')">立即注册</view>
  40. <view class="tui-modal-right" @click.stop="this.$api.navigateTo('/pages/login/login')">登录</view>
  41. </view>
  42. </view>
  43. </view>
  44. </tui-bottom-popup>
  45. </template>
  46. <script>
  47. import { mapState, mapMutations } from 'vuex'
  48. export default {
  49. name: 'cm-ross-popup',
  50. props: {
  51. popupShow: {
  52. type: Boolean,
  53. default: true
  54. }
  55. },
  56. data() {
  57. return {
  58. userId: 0, // 用户Id
  59. consultParams: {
  60. ip:'',
  61. createTime:'',
  62. consultMobile: '',
  63. consultName: '',
  64. isClick:1
  65. },
  66. isDisabled: true
  67. }
  68. },
  69. created() {
  70. this.initData()
  71. },
  72. computed: {
  73. ...mapState(['hasLogin'])
  74. },
  75. methods: {
  76. async initData(data) {
  77. const userInfo = await this.$api.getStorage()
  78. this.userId = userInfo.userId ? userInfo.userId : 0
  79. },
  80. handleInputName(e) {
  81. this.consultParams.name = e.detail.value
  82. this.handldeCheckInput()
  83. },
  84. handleInputPhone(e) {
  85. this.consultParams.phone = e.detail.value
  86. this.handldeCheckInput()
  87. },
  88. handldeCheckInput() {
  89. if (this.consultParams.name !== '' && this.consultParams.phone !== '') {
  90. this.isDisabled = false
  91. } else {
  92. this.isDisabled = true
  93. }
  94. },
  95. handleSubmit() {
  96. // 提交联系人信息
  97. if (this.isDisabled) {
  98. return
  99. }
  100. const reg = RegExp(/^1\d{10}$/)
  101. if(!reg.test(this.consultParams.consultMobile)){
  102. this.$util.msg('请输入正确的手机号');
  103. return
  104. }
  105. this.userInformationInsertRoos(this.consultParams)
  106. },
  107. userInformationInsertRoos(params){
  108. // 游客关闭广告弹窗
  109. this.UserService.userInformationInsertRoos(params)
  110. .then(response => {
  111. this.$parent.showRossHtml = false
  112. })
  113. .catch(error => {
  114. console.log('游客关闭广告弹窗失败~')
  115. })
  116. },
  117. hidePopup() {
  118. this.userInformationInsertRoos(this.consultParams)
  119. }
  120. }
  121. }
  122. </script>
  123. <style lang="scss">
  124. .tui-popup-box {
  125. width: 100%;
  126. height: 852rpx;
  127. background: url(https://static.caimei365.com/app/img/ross/ross-bg@3x.png) no-repeat;
  128. background-size: cover;
  129. padding: 330rpx 75rpx 0 75rpx;
  130. box-sizing: border-box;
  131. .tui-popup-close{
  132. width: 80rpx;
  133. height: 80rpx;
  134. line-height: 80rpx;
  135. text-align: center;
  136. position: absolute;
  137. top: 0;
  138. right: 0;
  139. .icon-iconfontguanbi{
  140. color: #ffffff;
  141. font-size: 40rpx;
  142. }
  143. }
  144. .tui-popup-main{
  145. width: 100%;
  146. height: auto;
  147. .tui-popup-from{
  148. width: 100%;
  149. height: 80rpx;
  150. margin-bottom: 30rpx;
  151. &.none{
  152. margin-bottom: 0;
  153. }
  154. .input{
  155. width: 100%;
  156. height: 80rpx;
  157. box-sizing: border-box;
  158. line-height: 80rpx;
  159. font-size: 28rpx;
  160. color: #ffffff;
  161. border-bottom: 1px solid #ffffff;
  162. }
  163. }
  164. }
  165. }
  166. .tui-popup-btn {
  167. width: 100%;
  168. float: left;
  169. .tui-modal-flex {
  170. width: 100%;
  171. height: 84rpx;
  172. margin-top: 40rpx;
  173. display: flex;
  174. .tui-modal-button {
  175. flex: 1;
  176. line-height: 84rpx;
  177. font-size: $font-size-28;
  178. text-align: center;
  179. border-radius: 42rpx;
  180. padding: 0;
  181. margin: 0 15rpx;
  182. box-sizing: border-box;
  183. background: #202020;
  184. color: #ffffff;
  185. &.disabled {
  186. background: #cbcbcb;
  187. }
  188. }
  189. }
  190. .tui-modal-text{
  191. width: 100%;
  192. height: 68rpx;
  193. box-sizing: border-box;
  194. padding: 0 30rpx;
  195. .tui-modal-left{
  196. float: left;
  197. line-height: 68rpx;
  198. font-size: 28rpx;
  199. color: #ffffff;
  200. }
  201. .tui-modal-right{
  202. float: right;
  203. line-height: 68rpx;
  204. font-size: 28rpx;
  205. color: #ffffff;
  206. }
  207. }
  208. }
  209. </style>