Contact.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840
  1. <template>
  2. <view>
  3. <scroll-view scroll-y="true" :scroll-top="scrollTop" @scroll="scrollTopFun" :scroll-into-view="jump" class='styleheight'
  4. :croll-top="scrollTop">
  5. <!-- styleheight class=""-->
  6. <image class="banner" :src="toppic" mode="widthFix"></image>
  7. <view class='contact_d'>
  8. <rich-text class="richtext" :nodes='effectPic'></rich-text>
  9. <!-- <import src="../../wxParse/wxParse.wxml" />
  10. <view style="display:block;">
  11. <template is="wxParse" data="{{wxParseData:conten_text.nodes}}" />
  12. </view> -->
  13. </view>
  14. <!-- swiper -->
  15. <form @submit="formBindsubmit" @reset="dsubmit">
  16. <view class='form'>
  17. <view class="section">
  18. <picker @change="mySelect" :value="index" :range="cooper" :data-type="cooperation1" name="cooperation1">
  19. <image class='images' src='../../../static/images/switch-2.png'></image>
  20. <!-- wx:if="{{picker?'{{firstPerson}}':'{{cooper[index]}}'}}" -->
  21. <view class="picker">
  22. <view class='color'>{{firstPerson}}</view>
  23. <view class='cooper'>{{cooper[index]}}</view>
  24. </view>
  25. </picker>
  26. </view>
  27. <view class='user username'>
  28. <image class='images_user' src='../../../static/images/user.png'></image>
  29. <input name="name" :data-names="names" class='inpu_t ' :value="name" type='text' :placeholder="placeholder1"
  30. placeholder-class="phcolor"></input>
  31. <!-- <view class=' nput' wx:if="{{tis?'nput':''}}">
  32. <view class='nput_l'>{{tis}}</view>
  33. </view> -->
  34. </view>
  35. <view class='user phone'>
  36. <image class='images_user' src='../../../static/images/datl.png'></image>
  37. <input name="phone" :data-phones="phones" class='inpu_t' :value="phone" type='text' :placeholder="placeholder2"
  38. placeholder-class="phcolor"></input>
  39. <!-- <view class=' nput' wx:if="{{tid?'nput':''}}">
  40. <view class='nput_l'>{{tid}}</view>
  41. </view> -->
  42. </view>
  43. <view class='user address'>
  44. <image class='images_user' src='../../../static/images/address.png'></image>
  45. <input name="address" class='inpu_t' :value="address" type='text' :placeholder="placeholder3" placeholder-class="phcolor"></input>
  46. <!-- <view class=' nput' wx:if="{{tif?'nput':''}}">
  47. <view class='nput_l'>{{tif}}</view>
  48. </view> -->
  49. </view>
  50. <view class="masklayer" v-show="iSshow">
  51. <image class='prosperit_y' src='../../../static/images/prosperity.png'></image>
  52. <view class="presen_t">信息提交成功</view>
  53. <view class='xinxi_t'>我们会在1-2个工作日内给您回复,</view>
  54. <view class='xinxi_t'>请注意接听。</view>
  55. </view>
  56. <button form-type="submit" class='button' hover-class="none" id="wengao" type="primary">提交</button>
  57. </view>
  58. </form>
  59. <!--
  60. <view class='biaoshi'>
  61. <image class='form_img' src='/images/form_img.png'></image>
  62. </view> -->
  63. <!--悬浮框 jump: 'wengao',-->
  64. <!-- style="display:{{viewButton ? 'block' : 'none'}}" -->
  65. <view class='suspension' :style="{display:viewButton ? 'block' : 'none'}">
  66. <view>
  67. <view class='affairs' @tap="jump1">
  68. <view class='text-s'>
  69. 商务合作
  70. </view>
  71. </view>
  72. <view class='contact'>
  73. <!-- wx:if="{{ showhide ?'true':''}}" -->
  74. <!-- <button class='clickbtn' open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber"></button> -->
  75. <view class='text_d' @tap="dial">
  76. 立即联系
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. </scroll-view>
  82. </view>
  83. </template>
  84. <script>
  85. var graceRichText = require("../../../components/richText.js");
  86. var height = 700;
  87. export default {
  88. data() {
  89. return {
  90. pageData: [],
  91. banner1: '',
  92. cooperation1: [],
  93. selectPerson: true,
  94. firstPerson: '请选择合作意向',
  95. selectArea: false,
  96. color: '#000',
  97. showView: false,
  98. hideView: true,
  99. forminfo: '',
  100. name: '',
  101. phone: '',
  102. address: '',
  103. // cooperation:'',
  104. cooper: [],
  105. plan: 'default',
  106. height: '700',
  107. viewButton: true,
  108. placeholder1: '请输入姓名',
  109. placeholder2: '请输入联系方式',
  110. placeholder3: '请输入所在地',
  111. toppic: '',
  112. showhide: false,
  113. scrollTop: 0,
  114. effectPic: '',
  115. index: '',
  116. iSshow: false,
  117. jump: '',
  118. telephone: ''
  119. }
  120. },
  121. onLoad() {
  122. this.getap()
  123. this.getaps()
  124. },
  125. methods: {
  126. getap() {
  127. var that = this;
  128. var params = new Object()
  129. params.appid = uni.getStorageSync('appid')
  130. uni.showLoading({
  131. title: '加载中'
  132. });
  133. uni.request({
  134. url: 'https://cm.5dev.cn/applet_on/content/v1/contact.view_news',
  135. data: params,
  136. method: 'GET',
  137. header: {
  138. 'content-type': 'application/json' // 默认值
  139. },
  140. success(res) {
  141. uni.hideLoading();
  142. var cooperation = res.data.data.cooperation;
  143. var cooper = [];
  144. for (var i in cooperation) {
  145. cooper[i] = cooperation[i]['name'];
  146. }
  147. console.log(222, res.data.data.contact.tel.phone)
  148. that.cooperation1 = res.data.data.cooperation,
  149. that.cooper = cooper,
  150. that.telephone = res.data.data.contact.tel.phone
  151. // that.toppic = res.data.data.contact.top
  152. // that.effectPic = graceRichText.format(res.data.data.contact.content)
  153. }
  154. })
  155. },
  156. getaps() {
  157. var that = this;
  158. var params = new Object()
  159. // params.appid = uni.getStorageSync('appid')
  160. // uni.showLoading({
  161. // title: '加载中'
  162. // });
  163. uni.request({
  164. url: 'https://trade.5dev.cn/dudaowenlv/content/?api.config_news',
  165. data: params,
  166. method: 'GET',
  167. header: {
  168. 'content-type': 'application/json' // 默认值
  169. },
  170. success(res) {
  171. console.log(3333333,res)
  172. that.toppic = res.data.data.top
  173. that.effectPic = graceRichText.format(res.data.data.content)
  174. uni.hideLoading();
  175. }
  176. })
  177. },
  178. mySelect(e) {
  179. var that = this;
  180. console.log(9999, e)
  181. that.firstPerson = '',
  182. that.cooperations = that.cooperation1[e.detail.value]['id'],
  183. that.index = e.detail.value
  184. // })
  185. },
  186. // 表单验证
  187. formBindsubmit(e) {
  188. var that = this;
  189. console.log(7777, e)
  190. // return
  191. console.log(8888, that.cooperations)
  192. // return
  193. // 手机号
  194. var ph = /^1[34578]\d{9}$/;
  195. var mb = /^(0[0-9]{2,3}\-)([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$/;
  196. // 姓名
  197. if (!that.cooperations) {
  198. uni.showToast({
  199. title: '提示:请选择合作意向!',
  200. icon: 'none',
  201. duration: 1000
  202. })
  203. return
  204. } else {
  205. }
  206. if (e.detail.value.name.length == 0) {
  207. uni.showToast({
  208. title: '提示:请输入姓名!',
  209. icon: 'none',
  210. duration: 1000
  211. })
  212. return
  213. } else {
  214. };
  215. // 手机号
  216. if (e.detail.value.phone.length == 0) {
  217. uni.showToast({
  218. title: '提示:请输入电话或者手机号!',
  219. icon: 'none',
  220. duration: 1000
  221. })
  222. return
  223. } else if (!ph.test(e.detail.value.phone) && !mb.test(e.detail.value.phone)) {
  224. uni.showToast({
  225. title: '*电话格式有误,请重新输入',
  226. icon: 'none',
  227. duration: 1000
  228. })
  229. return
  230. } else {
  231. };
  232. // 地址
  233. if (e.detail.value.address.length == 0) {
  234. uni.showToast({
  235. title: '提示:请输入所在地!',
  236. icon: 'none',
  237. duration: 1000
  238. })
  239. return
  240. } else {
  241. };
  242. // &&
  243. // if (e.detail.value.name && e.detail.value.phone && e.detail.value.address && that.cooperations != 0) {
  244. // if (ph.test(e.detail.value.phone) && mb.test(e.detail.value.phone) != true) {
  245. that.iSshow = true
  246. var params = new Object()
  247. params.appid = uni.getStorageSync('appid')
  248. params.name = e.detail.value.name,
  249. params.phone = e.detail.value.phone,
  250. params.address = e.detail.value.address,
  251. params.cooperation = that.cooperations,
  252. // console.log(111111, that.data.cooperation)
  253. console.log(1111, that.forminfo)
  254. console.log(3333, that.name = e.detail.value.name)
  255. console.log(4444, that.phone = e.detail.value.phone)
  256. console.log(5555, that.address = e.detail.value.address)
  257. that.name = e.detail.value.name
  258. that.phone = e.detail.value.phone
  259. that.address = e.detail.value.address
  260. // return
  261. uni.request({
  262. url: 'https://cm.5dev.cn/applet_on/content/v1/contact.submit',
  263. // url: this.host + 'l=api.desc',
  264. data: params,
  265. method: 'GET',
  266. header: {
  267. 'content-type': 'application/json' // 默认值
  268. },
  269. success(res) {
  270. console.log(99999, that.forminfo)
  271. that.name = ''
  272. that.phone = ''
  273. that.address = ''
  274. that.firstPerson = '请选择合作意向',
  275. that.index = '',
  276. that.cooperations = ''
  277. setTimeout(function() {
  278. that.iSshow = false
  279. }, 3000);
  280. }
  281. })
  282. },
  283. dial() {
  284. var that = this;
  285. uni.makePhoneCall({
  286. phoneNumber: that.telephone
  287. });
  288. },
  289. // 点击跳转
  290. jump1() {
  291. // this.setData({
  292. this.jump = 'wengao'
  293. // })
  294. },
  295. // 距离底部隐藏
  296. scrollTopFun(e) {
  297. console.log(22222, e)
  298. var h = height;
  299. console.log(9999, e.detail.scrollTop + h)
  300. // this.setData({
  301. // showView: ''
  302. // })
  303. var that = this;
  304. // var h = height;
  305. if (e.detail.scrollTop + h >= e.detail.scrollHeight) {
  306. if (that.viewButton == true) {
  307. // this.setData({
  308. that.viewButton = false
  309. that.jump = ''
  310. // })
  311. }
  312. } else {
  313. if (that.viewButton == false) {
  314. // this.setData({
  315. that.jump = ''
  316. that.viewButton = true
  317. // })
  318. }
  319. }
  320. },
  321. }
  322. }
  323. </script>
  324. <style>
  325. /* @import "/wxParse/wxParse.wxss"; */
  326. .styleheight {
  327. height: 610px;
  328. }
  329. .banner {
  330. width: 100%;
  331. margin-bottom: 80upx;
  332. }
  333. .banner1 {
  334. position: absolute;
  335. left: 0;
  336. top: 455upx;
  337. width: 631upx;
  338. height: 276upx;
  339. z-index: 9999;
  340. }
  341. .banner1_t {
  342. width: 631upx;
  343. height: 276upx;
  344. margin-left: 84upx;
  345. }
  346. .introduce {
  347. margin-left: 84upx;
  348. margin-bottom: 120upx;
  349. margin-top: -110upx;
  350. /* clear: both; */
  351. }
  352. .intr_left {
  353. height: 470upx;
  354. width: 578upx;
  355. box-shadow: -1px 7px 20px #ccc;
  356. float: left;
  357. overflow: hidden;
  358. }
  359. .intr_text {
  360. padding-left: 40upx;
  361. padding-right: 40upx;
  362. /* height: 470upx;
  363. width: 578upx; Thisisasmallprogram
  364. */
  365. padding-top: 40upx;
  366. font-size: 30upx;
  367. color: rgb(25, 25, 25);
  368. /* text-indent: 60upx; */
  369. overflow: hidden;
  370. }
  371. .intr_right {
  372. width: 88upx;
  373. height: 470upx;
  374. background: #5397e4;
  375. margin-left: 578upx;
  376. /* margin-left: */
  377. /* float: left; */
  378. /* position: absolute;
  379. top: 462upx;
  380. right: 0; */
  381. }
  382. /*下拉框 */
  383. .select {
  384. margin-bottom: 20upx;
  385. }
  386. .phone_one {
  387. display: flex;
  388. position: relative;
  389. height: 64upx;
  390. border-radius: 10upx;
  391. border: 1upx solid #666;
  392. margin: 0upx 74upx;
  393. /* margin-bottom: 80upx; */
  394. }
  395. .phone_personal {
  396. color: rgb(153, 153, 153);
  397. font-size: 30upx;
  398. height: 64upx;
  399. line-height: 64upx;
  400. margin-left: 20upx;
  401. }
  402. .personal_image {
  403. z-index: 100;
  404. width: 40upx;
  405. height: 32upx;
  406. position: absolute;
  407. right: 20upx;
  408. top: 16upx;
  409. }
  410. .person_box {
  411. position: relative;
  412. }
  413. .phone_select {
  414. margin-top: 0;
  415. z-index: 100;
  416. }
  417. .select_one {
  418. /* background-color: rgb(239, 239, 239); */
  419. margin: 0upx 74upx;
  420. height: 64upx;
  421. line-height: 64upx;
  422. border-bottom: 1upx solid #ccc;
  423. padding-left: 20upx;
  424. font-size: 30upx;
  425. color: rgb(153, 153, 153);
  426. }
  427. .hide {
  428. display: none;
  429. }
  430. .show {
  431. display: block;
  432. }
  433. .form {
  434. position: relative;
  435. /* height: 592upx; */
  436. /* margin-left:40upx; */
  437. margin-bottom: 36upx;
  438. /* margin: 0 88upx; */
  439. }
  440. .form_left {
  441. height: 592upx;
  442. width: 88upx;
  443. background: #d259ce;
  444. position: absolute;
  445. left: -40upx;
  446. top: 0upx;
  447. }
  448. .form_text1 {
  449. text-align: center;
  450. font-size: 28upx;
  451. color: rgb(102, 102, 102)
  452. }
  453. .form_text2 {
  454. text-align: center;
  455. font-size: 28upx;
  456. color: rgb(102, 102, 102)
  457. }
  458. /*验证 */
  459. /* .calc{
  460. position: relative;
  461. } */
  462. .nput {
  463. position: absolute;
  464. left: 0;
  465. top: -180upx;
  466. right: 0;
  467. bottom: 0;
  468. margin: auto;
  469. }
  470. .nput_l {
  471. z-index: 9999;
  472. padding: 38upx 60upx;
  473. text-align: center;
  474. font-size: 30upx;
  475. background: #333333;
  476. color: rgb(254, 254, 254);
  477. border-radius: 20upx;
  478. }
  479. /*遮罩层 */
  480. .masklayer {
  481. border-radius: 20upx;
  482. position: absolute;
  483. left: 180upx;
  484. top: -166upx;
  485. margin: auto;
  486. width: 392upx;
  487. height: 326upx;
  488. background: #f4f4f4;
  489. z-index: 9;
  490. }
  491. .prosperit_y {
  492. width: 72upx;
  493. height: 72upx;
  494. margin-top: 56upx;
  495. padding: 0 160upx;
  496. }
  497. .presen_t {
  498. margin-top: 30upx;
  499. margin-bottom: 20upx;
  500. text-align: center;
  501. font-size: 28upx;
  502. color: rgb(51, 51, 51);
  503. }
  504. .xinxi_t {
  505. text-align: center;
  506. margin-bottom: 20upx;
  507. font-size: 28upx;
  508. color: rgb(51, 51, 51);
  509. }
  510. .xinxi_t {
  511. text-align: center;
  512. font-size: 22upx;
  513. margin-bottom: 20upx;
  514. }
  515. /*botton按钮 */
  516. button[type=default] {
  517. color: rgb(253, 251, 251);
  518. border: none;
  519. background: #ccc;
  520. font-size: 36upx;
  521. }
  522. button {
  523. display: block;
  524. margin-left: auto;
  525. margin-right: auto;
  526. padding-left: 14px;
  527. padding-right: 14px;
  528. font-size: 18px;
  529. text-align: center;
  530. text-decoration: none;
  531. border-radius: 10upx;
  532. overflow: hidden;
  533. border: none;
  534. }
  535. button::after {
  536. border: none;
  537. }
  538. .color {
  539. color: rgb(153, 153, 153);
  540. font-size: 30upx;
  541. margin-left: 20upx;
  542. }
  543. .cooper {
  544. font-size: 30upx;
  545. /* background: red; */
  546. color: rgb(51, 51, 51);
  547. margin-left: 20upx;
  548. }
  549. .images {
  550. position: absolute;
  551. width: 36upx;
  552. height: 18upx;
  553. right: 88upx;
  554. top: 32upx;
  555. }
  556. .phcolor {
  557. color: rgb(153, 153, 153)
  558. }
  559. .biaoshi {
  560. margin-bottom: 84upx;
  561. height: 34upx;
  562. }
  563. .form_img {
  564. width: 654upx;
  565. height: 34upx;
  566. position: absolute;
  567. right: 0;
  568. }
  569. .btn_images {
  570. width: 100%;
  571. height: 247upx;
  572. float: left;
  573. }
  574. .contact_d {
  575. margin: 0 66upx;
  576. margin-bottom: 40upx;
  577. /* font-size: 30upx; */
  578. color: #333333;
  579. /* line-height: 45upx; */
  580. }
  581. .contact_d_2 {
  582. margin: 0 66upx;
  583. margin-bottom: 80upx;
  584. font-size: 30upx;
  585. color: #333333;
  586. line-height: 45upx;
  587. }
  588. .picker {
  589. width: 622upx;
  590. height: 80upx;
  591. border: 1upx solid #666666;
  592. margin: 0 64upx;
  593. box-sizing: border-box;
  594. line-height: 80upx;
  595. border-radius: 10upx;
  596. }
  597. /*下拉框 */
  598. .user {
  599. height: 98upx;
  600. margin: 0 64upx;
  601. border-bottom: 1upx solid #eee;
  602. clear: both;
  603. position: relative;
  604. width: 622upx;
  605. box-sizing: border-box;
  606. }
  607. .section {
  608. height: 80upx;
  609. position: relative;
  610. /* margin: 0 88upx; */
  611. }
  612. .images_user {
  613. width: 48upx;
  614. height: 48upx;
  615. margin-left: 18upx;
  616. float: left;
  617. margin-top: 26upx;
  618. /* background: orange */
  619. }
  620. .inpu_t {
  621. float: left;
  622. margin-left: 64upx;
  623. margin-top: 26upx;
  624. /* border: 1upx solid #333; */
  625. width: 400upx;
  626. position: relative;
  627. font-size: 30upx;
  628. color: rgb(51, 51, 51)
  629. }
  630. .button {
  631. width: 622upx;
  632. height: 80upx;
  633. line-height: 80upx;
  634. margin: 0upx 66upx;
  635. margin-top: 60upx;
  636. margin-bottom: 80upx;
  637. border: none;
  638. background: #ccc;
  639. font-size: 36upx;
  640. color: rgb(253, 251, 251);
  641. }
  642. /*悬浮框 */
  643. .suspension {
  644. z-index: 2;
  645. position: fixed;
  646. bottom: 100upx;
  647. right: 0;
  648. }
  649. .affairs {
  650. width: 100upx;
  651. height: 98upx;
  652. color: rgb(255, 255, 255);
  653. font-size: 24upx;
  654. background: #474747;
  655. opacity: 0.5;
  656. text-align: center;
  657. margin-bottom: 6upx;
  658. border-top-left-radius: 10upx;
  659. border-bottom-left-radius: 10upx;
  660. }
  661. .text-s {
  662. margin-left: 30upx;
  663. margin-right: 24upx;
  664. width: 50upx;
  665. color: rgb(255, 255, 255);
  666. padding-top: 18upx;
  667. }
  668. .contact {
  669. width: 100upx;
  670. height: 98upx;
  671. color: rgb(255, 255, 255);
  672. font-size: 24upx;
  673. background: #474747;
  674. opacity: 0.5;
  675. text-align: center;
  676. border-top-left-radius: 10upx;
  677. border-bottom-left-radius: 10upx;
  678. }
  679. .text_d {
  680. margin-left: 30upx;
  681. margin-right: 24upx;
  682. width: 50upx;
  683. color: rgb(255, 255, 255);
  684. padding-top: 18upx;
  685. }
  686. .clickbtn {
  687. position: fixed;
  688. bottom: 100upx;
  689. right: 0;
  690. width: 100upx;
  691. height: 98upx;
  692. opacity: 0;
  693. }
  694. </style>