newYear2024.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. <template>
  2. <view class="all">
  3. <u-mask :show="show" @click="show = false">
  4. <u-image width="100%" height="500px" :mode="'widthFix'" src="/static/img/guide_point2.png"></u-image>
  5. </u-mask>
  6. <ujp-navbar title="凭话费领年卡活动" :startGz="false" :isBack="back" ></ujp-navbar>
  7. <view class="InviteFriends" :class="{
  8. opacityClass:show
  9. }">
  10. <view class="text imgHead">
  11. <view class="imgHead1">
  12. <img style="width: 125px;" src="@/assets/img/piccShare/1.png"></img>
  13. </view>
  14. <view class="imgHead2">
  15. <img style="width: 252px;height: 40px;" src="@/assets/img/piccShare/5.png"></img>
  16. </view>
  17. </view>
  18. <view class="main">
  19. <view class="suited">
  20. <p class="title">活动对象 :</p>
  21. <view class="content">
  22. 不限
  23. </view>
  24. <p class="title">活动说明 :</p>
  25. <view class="content">
  26. 庆元旦,迎新年,用户凭手机号,免费领取<span style="color: rgb(12 11 11);font-weight: bold;">51充电联盟年卡</span>一张,最低可享<span style="color: #ec4f27;font-weight: bold;">两年免充电服务费</span>,最高可享万元礼包,老带新还能有额外红包大礼!
  27. </view>
  28. <view class="bottomView" v-if="false">
  29. <u-button class="button" shape="circle" @click="show=true" >分享活动
  30. <u-icon name="share"></u-icon>
  31. </u-button>
  32. </view>
  33. </view>
  34. <view class="application-form ">
  35. <view class="tel">
  36. <p><span style="color: red;">*</span>填写手机号</p>
  37. <u-input v-model="subForm.phone" :customStyle="placeholderStyle"
  38. :placeholderStyle="placeholderStyle" placeholder="请填写手机号"></u-input>
  39. </view>
  40. <view class="bottomView">
  41. <u-button class="button" type="warning" @click="submit">我要领卡</u-button>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <u-modal v-model="show1" @confirm="gotoGz" cancel-text="暂不关注" confirm-text="前往关注" :show-cancel-button="false"
  47. confirm-color="#53b56b" ref="uModal2" :asyncClose="true">
  48. <view style="padding: 15px;">请先关注<span style=" color: #53b56b;">{{projectName}}</span>公众号,然后进行填报</view>
  49. </u-modal>
  50. <u-mask :show="carTempBl" >
  51. <ucarkeyboard v-if="carTempBl" :tips="subForm.carNum" style="z-index: 9999;position: fixed !important;" ref="uKeyboard" mode="car"
  52. @confirm="carTempBl=false" @cancel="carTempBl=false" :showTips="true"
  53. :mask-close-able="false" @change="valChange" @backspace="backspace"></ucarkeyboard>
  54. </u-mask>
  55. </view>
  56. </template>
  57. <script>
  58. import wx from 'weixin-js-sdk'
  59. import {
  60. convertCanvasToImage,
  61. substrMb
  62. } from '@/utils'
  63. import {
  64. checkPhone
  65. } from '@/utils'
  66. import * as API from '@/apis/friends.js'
  67. import * as WxJsApi from '@/utils/wxJsApi.js'
  68. import * as API_weixin from '@/apis/weixin.js'
  69. import ucarkeyboard from '@/components/Ucarkeyboard.vue'
  70. export default {
  71. components: {
  72. ucarkeyboard
  73. },
  74. data() {
  75. return {
  76. isLogin:false,
  77. carAuthImg:"",
  78. id: "",
  79. carTempBl:false,
  80. code: "",
  81. show: false,
  82. uid: "",
  83. show1: false,
  84. show2: false,
  85. projectName: "",
  86. name: "",
  87. back: false,
  88. subForm: {
  89. realName:"",
  90. phone: "",
  91. carNum:"",
  92. licenseFileUrl: "",
  93. openId:"",
  94. shareUserId: ""
  95. },
  96. placeholderStyle: {
  97. 'font-size': '16px',
  98. 'padding': '4px 8px',
  99. },
  100. shareUserId:"",
  101. userInfo:null,
  102. carNum:'',
  103. carLicense:false,
  104. }
  105. },
  106. onLoad(op) {
  107. if(op.back){
  108. this.back=false
  109. }
  110. this.projectName = process.car.ProjectName;
  111. if(op.sid){
  112. this.shareUserId = op.sid
  113. this.carhelp.set("picc_shareUserId_1230",{
  114. sid:op.sid,
  115. time:new Date().getTime()
  116. });
  117. }else{
  118. var obj=this.carhelp.get("picc_shareUserId_1230")
  119. if(obj){
  120. var time1 =new Date().getTime()
  121. var time2 =obj.time;
  122. if(time1-time2<1000*60*5){
  123. this.shareUserId = obj.sid;
  124. }
  125. }
  126. }
  127. //console.log(this.shareUserId )
  128. if(this.shareUserId ){
  129. uni.showToast({
  130. title:"来自好友的分享"
  131. })
  132. }
  133. this.get_wx_config();
  134. },
  135. onReady() {
  136. var info = this.carhelp.getPersonInfo();
  137. if(info.id&&info.phone){
  138. //this.isLogin=true
  139. this.userInfo=info;
  140. this.subForm.phone=info.phone;
  141. }
  142. },
  143. onShow() {
  144. this.checkSubscribe()
  145. },
  146. methods: {
  147. checkSubscribe() {
  148. API_weixin.checkSubscribe({
  149. openId: this.carhelp.getOpenId()
  150. }).then((res) => {
  151. if (res.data == "0") {
  152. this.show1 = true
  153. } else {
  154. //this.init();
  155. this.show1 = false;
  156. this.show2 = true;
  157. //this.carhelp.setGzDate()
  158. }
  159. //setGzDate
  160. }).catch(error => {
  161. uni.showToast({
  162. title: error
  163. })
  164. })
  165. },
  166. gotoGz() {
  167. this.carhelp.setGzDate()
  168. // this.gotoGzShow = false;
  169. var url = "https://mp.weixin.qq.com/s/mCHz1nNvg0xAICiBeIyKRQ";
  170. window.location.href = url
  171. },
  172. submit(){
  173. this.subForm.openId=this.carhelp.getOpenId();
  174. this.subForm.shareUserId=this.shareUserId;
  175. this.subForm.event=1;
  176. if(!this.subForm.phone){
  177. uni.showToast({
  178. title:"请填写手机号"
  179. })
  180. return
  181. }
  182. var checkPhoneResult = checkPhone(this.subForm.phone);
  183. if (checkPhoneResult !== true) {
  184. uni.showToast({
  185. title: checkPhoneResult,
  186. })
  187. return;
  188. }
  189. uni.showLoading({
  190. title: "加载中",
  191. mask: true,
  192. })
  193. API.submitEventRegistration(this.subForm).then((res) => {
  194. uni.hideLoading()
  195. if(res.result){
  196. uni.showModal({
  197. //showCancel:false,
  198. title:"提示",
  199. content:"提交成功!",
  200. cancelText:"继续填写",
  201. confirmText:"前往主页",
  202. success:(me)=> {
  203. this.carAuthImg="";
  204. this.subForm={
  205. phone: "",
  206. }
  207. if(me.confirm){
  208. uni.reLaunch({
  209. url:"/"
  210. })
  211. }
  212. }
  213. })
  214. }
  215. }).catch(error => {
  216. uni.showToast({
  217. title: error,
  218. icon: "none"
  219. })
  220. })
  221. },
  222. //获取微信jssdk配置信息
  223. get_wx_config() {
  224. //("get_wx_configget_wx_configget_wx_configget_wx_config")
  225. var _this = this
  226. API_weixin.getConfig().then(response => {
  227. var wxconfig = response.data.wxConfig;
  228. wx.config({
  229. debug: false, // 开启调试模式,
  230. appId: wxconfig.appId, // 必填,企业号的唯一标识,此处填写企业号corpid
  231. timestamp: wxconfig.timestamp, // 必填,生成签名的时间戳
  232. nonceStr: wxconfig.nonceStr, // 必填,生成签名的随机串
  233. signature: wxconfig.signature, // 必填,签名,见附录1
  234. jsApiList: ['updateAppMessageShareData',
  235. 'updateTimelineShareData','onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareQZone'], // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
  236. });
  237. _this.wxShare()
  238. wx.error(function(res) {
  239. //('微信api配置出错');
  240. });
  241. }).catch(error => {
  242. //(error);
  243. })
  244. },
  245. //微信分享自定义
  246. wxShare() {
  247. var img =
  248. "http://oss.xiaoxinda.com/charging/chargingconfigure/2022/6/6/ec228c56-487a-4ae1-ac6f-37284060fbba/hongbao.jpg"
  249. // img="https://yktwechat.xiaoxinda.com/config/xxd2021.jpg"
  250. // if (indexLogo) {
  251. // this.indexLogo = indexLogo;
  252. // }
  253. var info = this.carhelp.getPersonInfo()
  254. //var img=require("@/static/img/aboutus.png")
  255. ////(this.nowItem);
  256. var ProjectName = process.car.ProjectName; //info.nickName+
  257. var nickName = info.nickName ? info.nickName : '好友';
  258. var title = nickName + "邀请你参加'凭话费领年卡活动'"
  259. //"["+ProjectName+"]"+'和好友一起领5元红包'
  260. var desc = ProjectName
  261. let joinUrl = window.location.href.split("/team51/")[0] + "/team51/#/pages/user/newYear2024?back=1"
  262. //this.joinUrl=joinUrl;
  263. if(info.id){
  264. joinUrl+="&sid=" + info.id;
  265. }
  266. var _this=this;
  267. wx.ready(function() {
  268. wx.onMenuShareAppMessage({
  269. title: title,
  270. desc: desc,
  271. link: joinUrl,
  272. imgUrl: img,
  273. success: function() {
  274. // 设置成功
  275. _this.$emit("wxShare",null);
  276. }
  277. })
  278. wx.onMenuShareTimeline({
  279. title: title,
  280. desc: desc,
  281. link: joinUrl,
  282. imgUrl: img,
  283. success: function() {
  284. // 设置成功
  285. _this.$emit("wxShare",null);
  286. }
  287. })
  288. wx.updateAppMessageShareData({
  289. title: title,
  290. desc: desc,
  291. link: joinUrl,
  292. imgUrl: img,
  293. success: function() {
  294. //("updateAppMessageShareData")
  295. // 设置成功
  296. _this.$emit("wxShare", null);
  297. }
  298. })
  299. wx.updateTimelineShareData({
  300. title: title,
  301. desc: desc,
  302. link: joinUrl,
  303. imgUrl: img,
  304. success: function() {
  305. //("updateTimelineShareData")
  306. // 设置成功
  307. _this.$emit("wxShare", null);
  308. }
  309. })
  310. console.log("readyreadyreadyreadyready")
  311. });
  312. }
  313. }
  314. }
  315. </script>
  316. <style>
  317. page {
  318. background: #c9382c;
  319. }
  320. </style>
  321. <style lang="scss" scoped>
  322. @import "@/_theme.scss";
  323. .all {
  324. @include themeify {
  325. font-size: themed('font-size1');
  326. }
  327. }
  328. .imgHead{
  329. padding-top: 72rpx;
  330. display: flex;
  331. flex-direction: column;
  332. align-items: center;
  333. .imgHead1{
  334. img{
  335. height: 24px;
  336. }
  337. display: flex;
  338. justify-content: center;
  339. }
  340. .imgHead2{
  341. display: flex;
  342. img{
  343. width: 100%;
  344. height: 40px;
  345. }
  346. margin-top: 16px;
  347. }
  348. }
  349. .main {
  350. padding: 22rpx 56rpx 170rpx;
  351. .text {
  352. color: rgba(255, 255, 255, 100);
  353. @include themeify {
  354. font-size: themed('font-size4');
  355. }
  356. /* font-size: 18px;*/
  357. text-align: justify;
  358. text-indent: 36px;
  359. }
  360. .suited {
  361. background-color: #fff;
  362. //background: linear-gradient(180deg, rgba(189,255,224,1) 0%,rgba(255,255,255,1) 14%);
  363. background: linear-gradient(180deg, rgba(255,224,223,1) 0%,rgba(255,255,255,1) 14%);
  364. margin-top: 24px;
  365. padding: 24px;
  366. border-radius: 16px;
  367. .title {
  368. /*height: 18px;*/
  369. color: rgba(16, 16, 16, 100);
  370. font-size: 18px;
  371. font-weight: 600;
  372. }
  373. .content {
  374. margin: 16rpx 0;
  375. //font-weight: 550;
  376. color: rgba(102, 102, 102, 1);
  377. line-height: 20px;
  378. font-size: 14px;
  379. p{
  380. margin: 8rpx 0;
  381. }
  382. }
  383. }
  384. .application-form {
  385. background-color: #fff;
  386. border-radius: 16px;
  387. margin-top: 24px;
  388. padding: 24px;
  389. .u-input {
  390. border-radius: 50px;
  391. background-color: rgba(232, 236, 234, 100);
  392. margin-top: 12px;
  393. }
  394. /deep/.uni-input-input {
  395. margin: 20px;
  396. }
  397. /deep/.u-input__right-icon {
  398. margin-right: 10px;
  399. }
  400. p {
  401. font-size:18px;
  402. @include themeify {
  403. line-height: themed('font-size4');
  404. height: themed('font-size4');
  405. }
  406. /* height: 18px;
  407. line-height: 18px;*/
  408. color: rgba(16, 16, 16, 100);
  409. /* font-size: 18px;*/
  410. }
  411. .tel,
  412. .place,
  413. .type,
  414. .want {
  415. //margin-top: 24px;
  416. }
  417. .textarea {
  418. width: 72.2vw;
  419. height: 140px;
  420. border-radius: 22px;
  421. background-color: rgba(232, 236, 234, 100);
  422. margin-top: 12px;
  423. overflow-y: scroll;
  424. @include themeify {
  425. font-size: themed('font-size2');
  426. line-height: themed('font-size2');
  427. }
  428. .uni-textarea-placeholder {
  429. padding: 12px 20px;
  430. @include themeify {
  431. font-size: themed('font-size2');
  432. line-height: themed('font-size2');
  433. }
  434. }
  435. /deep/.uni-textarea-textarea {
  436. width: 90%;
  437. padding: 10px 20px;
  438. }
  439. /deep/.u-input__right-icon {
  440. display: none;
  441. }
  442. }
  443. }
  444. .type {
  445. .checkbox {
  446. margin-top: 12px;
  447. /deep/.u-checkbox {
  448. width: 50% !important;
  449. margin-top: 4px;
  450. }
  451. }
  452. }
  453. .want {
  454. /deep/.u-checkbox {
  455. margin-top: 8px;
  456. }
  457. }
  458. .hint {
  459. margin-top: 12px;
  460. @include themeify {
  461. font-size: themed('font-size2');
  462. line-height: themed('font-size5');
  463. }
  464. /*
  465. font-size: 14px;
  466. line-height: 20px;
  467. */
  468. text-align: center;
  469. .tel-num {
  470. color: #9FC7FF;
  471. }
  472. }
  473. /deep/.u-btn {
  474. border-radius: 50px;
  475. margin-top: 24px;
  476. }
  477. }
  478. .InviteFriends {
  479. //background-image: linear-gradient(0deg, #a2e9c9, #01b963);
  480. background: #c9382c;
  481. }
  482. .opacityClass {
  483. opacity: 0.2;
  484. }
  485. // 底部
  486. .bottomView {
  487. border-radius: 50px;
  488. color:rgba(0, 185, 98, 100);
  489. // width: 100%;
  490. // height: 64px;
  491. // text-align: center;
  492. // background-color: #fff;
  493. .button{
  494. //width: 90%;
  495. border-radius: 50px;
  496. // background-color: #fff;
  497. color:#fff;
  498. font-size: 16px;
  499. background: linear-gradient(90deg, rgba(255,98,0,1) 0%,rgba(255,150,0,1) 100%);
  500. //border: 1px solid rgba(0, 163, 86, 1);
  501. }
  502. // button::after {
  503. // border: rgba(0, 185, 98, 100);
  504. // }
  505. }
  506. .carAuth{
  507. border-radius: 12px;
  508. background-color: rgba(255, 255, 255, 1);
  509. border: 2px dashed rgba(187, 187, 187, 1);
  510. //height: 400rpx;
  511. width: 100%;
  512. overflow: hidden;
  513. text-align: center;
  514. .carAuthImg{
  515. margin-top: 10px;
  516. margin-bottom: 10px;
  517. width: 510rpx;
  518. height: 360rpx;
  519. }
  520. .carAuthIcon{
  521. position: absolute;
  522. background: #6e7175;
  523. width: 44px;
  524. height: 44px;
  525. border-radius: 50px;
  526. /* left: 200px; */
  527. /* top: 200px; */
  528. margin: 160rpx 230rpx;
  529. z-index: 99;
  530. display: flex;
  531. justify-content: center;
  532. }
  533. }
  534. // .car-type{
  535. // display: flex;
  536. // flex-direction: row;
  537. // margin: 0 40rpx;
  538. // flex-wrap: wrap;
  539. // }
  540. .want{
  541. .wantView{
  542. display: flex;
  543. }
  544. button{
  545. width: 45%;
  546. color: rgba(51, 51, 51, 1);
  547. background-color: rgba(232, 236, 234, 1);
  548. }
  549. button::after {
  550. border: none;
  551. }
  552. .wantBtn{
  553. background-color: #fff;
  554. border:2px solid #00B962;
  555. }
  556. .wanttpis{
  557. position: relative;
  558. top: -100rpx;
  559. left: 180rpx;
  560. z-index: 99;
  561. background: #00B962 ;
  562. padding: 2px 3px;
  563. font-size: 10px;
  564. color:#fff;
  565. border-radius: 4px;
  566. }
  567. }
  568. .carTempBlInput{
  569. display: flex;
  570. align-items: center;
  571. font-size: 16px;
  572. min-height: 44px;
  573. padding: 4px 16px;
  574. border-radius:20px;
  575. background: #e9ecea ;
  576. color:#808080
  577. }
  578. </style>