cm-ross-popup.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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-class="placeholder"
  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-class="placeholder"
  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. advertisInfo:{
  77. type: Object,
  78. default: {}
  79. }
  80. },
  81. data() {
  82. return {
  83. userId: 0, // 用户Id
  84. consultParams: {
  85. ip:'',
  86. shopProductId:'',
  87. createTime:'',
  88. consultMobile: '',
  89. consultName: '',
  90. isClick:1
  91. },
  92. advertData:{},
  93. isDisabled: true
  94. }
  95. },
  96. watch: {
  97. advertisInfo:{
  98. deep: true,
  99. handler(val) {
  100. this.initData(val)
  101. }
  102. }
  103. },
  104. created() {
  105. this.initData(this.advertisInfo)
  106. },
  107. computed: {
  108. ...mapState(['hasLogin'])
  109. },
  110. methods: {
  111. async initData(data) {
  112. const userInfo = await this.$api.getStorage()
  113. this.userId = userInfo.userId ? userInfo.userId : 0
  114. this.advertData = data
  115. this.consultParams.shopProductId = data.shopProductId
  116. },
  117. handleInputName(e) {
  118. this.consultParams.name = e.detail.value
  119. this.handldeCheckInput()
  120. },
  121. handleInputPhone(e) {
  122. this.consultParams.phone = e.detail.value
  123. this.handldeCheckInput()
  124. },
  125. handldeCheckInput() {
  126. if (this.consultParams.name !== '' && this.consultParams.phone !== '') {
  127. this.isDisabled = false
  128. } else {
  129. this.isDisabled = true
  130. }
  131. },
  132. handleSubmit() {
  133. // 提交联系人信息
  134. if (this.isDisabled) {
  135. return
  136. }
  137. const reg = RegExp(/^1\d{10}$/)
  138. if(!reg.test(this.consultParams.consultMobile)){
  139. this.$util.msg('请输入正确的手机号');
  140. return
  141. }
  142. this.userInformationInsertRoos(this.consultParams)
  143. },
  144. async userInformationInsertRoos(params){
  145. // 游客关闭广告弹窗
  146. try{
  147. await this.UserService.userInformationInsertRoos(params)
  148. this.$parent.showRossHtml = false
  149. }catch(e){
  150. //TODO handle the exception
  151. console.log('游客关闭广告弹窗失败~')
  152. }
  153. },
  154. hidePopup() {
  155. this.userInformationInsertRoos(this.consultParams)
  156. }
  157. }
  158. }
  159. </script>
  160. <style lang="scss">
  161. .tui-popup-box {
  162. width: 100%;
  163. height: 852rpx;
  164. background: linear-gradient(0deg, #FFA86E, #FF5B00);
  165. padding:30rpx 30rpx 75rpx 30rpx;
  166. box-sizing: border-box;
  167. .tui-popup-close{
  168. width: 80rpx;
  169. height: 80rpx;
  170. line-height: 80rpx;
  171. text-align: center;
  172. position: absolute;
  173. top: 0;
  174. right: 0;
  175. .icon-iconfontguanbi{
  176. color: #ffffff;
  177. font-size: 40rpx;
  178. }
  179. }
  180. .tui-popup-mssg{
  181. width: 100%;
  182. height: 220rpx;
  183. margin-bottom: 75rpx;
  184. .tui-popup-mssg-img{
  185. width: 220rpx;
  186. height: 220rpx;
  187. float: left;
  188. image{
  189. width: 220rpx;
  190. height: 220rpx;
  191. display: block;
  192. }
  193. }
  194. .tui-popup-mssg-text{
  195. width: 470rpx;
  196. height: 100%;
  197. box-sizing: border-box;
  198. padding: 0 0 0 30rpx;
  199. float: left;
  200. .tui-popup-mssg-text-t{
  201. width: 100%;
  202. height: auto;
  203. margin-bottom: 30rpx;
  204. .text{
  205. font-size: 30rpx;
  206. height: 52rpx;
  207. line-height: 52rpx;
  208. color: #ffffff;
  209. }
  210. }
  211. .tui-popup-mssg-text-b{
  212. width: 100%;
  213. height: auto;
  214. .text{
  215. font-size: 18rpx;
  216. line-height: 40rpx;
  217. color: #ffffff;
  218. .icon-xiangxia1{
  219. color: rgba(255, 255, 255, .7);
  220. font-size: 36rpx;
  221. }
  222. }
  223. }
  224. }
  225. }
  226. .tui-popup-main{
  227. width: 100%;
  228. height: auto;
  229. .tui-popup-from{
  230. width: 100%;
  231. height: 80rpx;
  232. margin-bottom: 30rpx;
  233. &.none{
  234. margin-bottom: 0;
  235. }
  236. .input{
  237. width: 100%;
  238. height: 80rpx;
  239. box-sizing: border-box;
  240. line-height: 80rpx;
  241. font-size: 28rpx;
  242. color: #ffffff;
  243. border-bottom: 1px solid #ffffff;
  244. }
  245. .placeholder{
  246. color: #FFFFFF;
  247. }
  248. }
  249. }
  250. }
  251. .tui-popup-btn {
  252. width: 100%;
  253. float: left;
  254. .tui-modal-flex {
  255. width: 100%;
  256. height: 84rpx;
  257. margin-top: 40rpx;
  258. display: flex;
  259. .tui-modal-button {
  260. flex: 1;
  261. line-height: 84rpx;
  262. font-size: $font-size-28;
  263. text-align: center;
  264. border-radius: 42rpx;
  265. padding: 0;
  266. margin: 0 15rpx;
  267. box-sizing: border-box;
  268. background: #202020;
  269. color: #ffffff;
  270. &.disabled {
  271. background: #cbcbcb;
  272. }
  273. }
  274. }
  275. .tui-modal-text{
  276. width: 100%;
  277. height: 68rpx;
  278. box-sizing: border-box;
  279. padding: 0 30rpx;
  280. .tui-modal-left{
  281. float: left;
  282. line-height: 68rpx;
  283. font-size: 28rpx;
  284. color: #ffffff;
  285. }
  286. .tui-modal-right{
  287. float: right;
  288. line-height: 68rpx;
  289. font-size: 28rpx;
  290. color: #ffffff;
  291. }
  292. }
  293. }
  294. </style>