cm-ross-popup.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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-mssg">
  9. <view class="tui-popup-mssg-img">
  10. <image :src="advertData.image">
  11. </view>
  12. <view class="tui-popup-mssg-text">
  13. <view class="tui-popup-mssg-text-t">
  14. <view class="text">{{ advertData.guidingOne }}</view>
  15. <view class="text">{{ advertData.guidingTwo }}</view>
  16. </view>
  17. <view class="tui-popup-mssg-text-b">
  18. <view class="text">
  19. <text class="iconfont icon-xiangxia1"></text>
  20. </view>
  21. <view class="text">请留下您的姓名和手机号,采美会安排咨询顾问联系您!</view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="tui-popup-main" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
  26. <view class="tui-popup-from">
  27. <input
  28. class="input"
  29. type="text"
  30. v-model="consultParams.consultName"
  31. @input="handleInputName"
  32. placeholder="请输入名字"
  33. placeholder-style="color:#FFFFFF;"
  34. maxlength="10"
  35. cursor-spacing="40"
  36. />
  37. </view>
  38. <view class="tui-popup-from none">
  39. <input
  40. class="input"
  41. type="text"
  42. v-model="consultParams.consultMobile"
  43. @input="handleInputPhone"
  44. placeholder="请输入手机号"
  45. placeholder-style="color:#FFFFFF;"
  46. maxlength="11"
  47. cursor-spacing="40"
  48. />
  49. </view>
  50. </view>
  51. <view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
  52. <view class="tui-modal-flex">
  53. <button class="tui-modal-button" :class="isDisabled ? 'disabled' : ''" @click="handleSubmit">
  54. 提交
  55. </button>
  56. </view>
  57. <view class="tui-modal-text">
  58. <view class="tui-modal-left" @click.stop="this.$api.navigateTo('/pages/login/register-select')">立即注册</view>
  59. <view class="tui-modal-right" @click.stop="this.$api.navigateTo('/pages/login/login')">登录</view>
  60. </view>
  61. </view>
  62. </view>
  63. </tui-bottom-popup>
  64. </template>
  65. <script>
  66. import { mapState, mapMutations } from 'vuex'
  67. import cmSrsMixins from '@/utils/cmSrsMixins.js'
  68. export default {
  69. name: 'cm-ross-popup',
  70. mixins: [cmSrsMixins],
  71. props: {
  72. popupShow: {
  73. type: Boolean,
  74. default: true
  75. },
  76. advertisement:{
  77. type: Object,
  78. default: {}
  79. }
  80. },
  81. data() {
  82. return {
  83. userId: 0, // 用户Id
  84. consultParams: {
  85. ip:'',
  86. shopId:'',
  87. createTime:'',
  88. consultMobile: '',
  89. consultName: '',
  90. isClick:1
  91. },
  92. advertData:{},
  93. isDisabled: true
  94. }
  95. },
  96. created() {
  97. this.initData(this.advertisement)
  98. },
  99. computed: {
  100. ...mapState(['hasLogin'])
  101. },
  102. methods: {
  103. async initData(data) {
  104. const userInfo = await this.$api.getStorage()
  105. this.userId = userInfo.userId ? userInfo.userId : 0
  106. this.advertData = data
  107. this.consultParams.shopId = data.shopId
  108. },
  109. handleInputName(e) {
  110. this.consultParams.name = e.detail.value
  111. this.handldeCheckInput()
  112. },
  113. handleInputPhone(e) {
  114. this.consultParams.phone = e.detail.value
  115. this.handldeCheckInput()
  116. },
  117. handldeCheckInput() {
  118. if (this.consultParams.name !== '' && this.consultParams.phone !== '') {
  119. this.isDisabled = false
  120. } else {
  121. this.isDisabled = true
  122. }
  123. },
  124. handleSubmit() {
  125. // 提交联系人信息
  126. if (this.isDisabled) {
  127. return
  128. }
  129. const reg = RegExp(/^1\d{10}$/)
  130. if(!reg.test(this.consultParams.consultMobile)){
  131. this.$util.msg('请输入正确的手机号');
  132. return
  133. }
  134. this.userInformationInsertRoos(this.consultParams)
  135. },
  136. userInformationInsertRoos(params){
  137. // 游客关闭广告弹窗
  138. this.UserService.userInformationInsertRoos(params)
  139. .then(response => {
  140. this.$parent.showRossHtml = false
  141. })
  142. .catch(error => {
  143. console.log('游客关闭广告弹窗失败~')
  144. })
  145. },
  146. hidePopup() {
  147. this.userInformationInsertRoos(this.consultParams)
  148. }
  149. }
  150. }
  151. </script>
  152. <style lang="scss">
  153. .tui-popup-box {
  154. width: 100%;
  155. height: 852rpx;
  156. background: linear-gradient(0deg, #FFA86E, #FF5B00);
  157. padding:30rpx 30rpx 75rpx 30rpx;
  158. box-sizing: border-box;
  159. .tui-popup-close{
  160. width: 80rpx;
  161. height: 80rpx;
  162. line-height: 80rpx;
  163. text-align: center;
  164. position: absolute;
  165. top: 0;
  166. right: 0;
  167. .icon-iconfontguanbi{
  168. color: #ffffff;
  169. font-size: 40rpx;
  170. }
  171. }
  172. .tui-popup-mssg{
  173. width: 100%;
  174. height: 220rpx;
  175. margin-bottom: 75rpx;
  176. .tui-popup-mssg-img{
  177. width: 220rpx;
  178. height: 220rpx;
  179. float: left;
  180. image{
  181. width: 220rpx;
  182. height: 220rpx;
  183. display: block;
  184. }
  185. }
  186. .tui-popup-mssg-text{
  187. width: 470rpx;
  188. height: 100%;
  189. box-sizing: border-box;
  190. padding: 0 0 0 30rpx;
  191. float: left;
  192. .tui-popup-mssg-text-t{
  193. width: 100%;
  194. height: auto;
  195. margin-bottom: 30rpx;
  196. .text{
  197. font-size: 30rpx;
  198. height: 52rpx;
  199. line-height: 52rpx;
  200. color: #ffffff;
  201. }
  202. }
  203. .tui-popup-mssg-text-b{
  204. width: 100%;
  205. height: auto;
  206. .text{
  207. font-size: 18rpx;
  208. line-height: 40rpx;
  209. color: #ffffff;
  210. .icon-xiangxia1{
  211. color: rgba(255, 255, 255, .7);
  212. font-size: 36rpx;
  213. }
  214. }
  215. }
  216. }
  217. }
  218. .tui-popup-main{
  219. width: 100%;
  220. height: auto;
  221. .tui-popup-from{
  222. width: 100%;
  223. height: 80rpx;
  224. margin-bottom: 30rpx;
  225. &.none{
  226. margin-bottom: 0;
  227. }
  228. .input{
  229. width: 100%;
  230. height: 80rpx;
  231. box-sizing: border-box;
  232. line-height: 80rpx;
  233. font-size: 28rpx;
  234. color: #ffffff;
  235. border-bottom: 1px solid #ffffff;
  236. }
  237. }
  238. }
  239. }
  240. .tui-popup-btn {
  241. width: 100%;
  242. float: left;
  243. .tui-modal-flex {
  244. width: 100%;
  245. height: 84rpx;
  246. margin-top: 40rpx;
  247. display: flex;
  248. .tui-modal-button {
  249. flex: 1;
  250. line-height: 84rpx;
  251. font-size: $font-size-28;
  252. text-align: center;
  253. border-radius: 42rpx;
  254. padding: 0;
  255. margin: 0 15rpx;
  256. box-sizing: border-box;
  257. background: #202020;
  258. color: #ffffff;
  259. &.disabled {
  260. background: #cbcbcb;
  261. }
  262. }
  263. }
  264. .tui-modal-text{
  265. width: 100%;
  266. height: 68rpx;
  267. box-sizing: border-box;
  268. padding: 0 30rpx;
  269. .tui-modal-left{
  270. float: left;
  271. line-height: 68rpx;
  272. font-size: 28rpx;
  273. color: #ffffff;
  274. }
  275. .tui-modal-right{
  276. float: right;
  277. line-height: 68rpx;
  278. font-size: 28rpx;
  279. color: #ffffff;
  280. }
  281. }
  282. }
  283. </style>