carOwnerScreening.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <title>点亮五菱</title>
  8. <!--引入 element-ui 的样式,-->
  9. <link rel="stylesheet"
  10. href="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742018383195/element-ui.css">
  11. <!-- 必须先引入vue, 后使用element-ui -->
  12. <script
  13. src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017957144/vue.js"></script>
  14. <!-- 引入element 的组件库-->
  15. <script
  16. src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017747738/element-ui.js"></script>
  17. <script src="https://unpkg.com/vconsole/dist/vconsole.min.js"></script>
  18. <!-- <script>
  19. var vConsole = new window.VConsole();
  20. </script> -->
  21. </head>
  22. <style>
  23. body {
  24. margin: 0;
  25. padding: 0;
  26. }
  27. .box {
  28. width: 100vw;
  29. height: 100vh;
  30. box-sizing: border-box;
  31. background: #FAFAFA;
  32. }
  33. .page6 {
  34. width: 100vw;
  35. height: 100vh;
  36. background: url('./img/wl_carOwner.png') no-repeat center;
  37. background-size: 100vw 100vh;
  38. background-repeat: no-repeat;
  39. }
  40. .page6s {
  41. width: 100vw;
  42. height: 100vh;
  43. background: url('./img/wl_bg.png') no-repeat center;
  44. background-size: 100vw 100vh;
  45. background-repeat: no-repeat;
  46. }
  47. .page_title {
  48. font-weight: bold;
  49. font-size: 16px;
  50. color: #FFFFFF;
  51. padding-top: 98px;
  52. padding-left: 30px;
  53. }
  54. .page_tip {
  55. font-weight: bold;
  56. font-size: 24px;
  57. color: #FFFFFF;
  58. padding: 20px 0 20px 30px;
  59. }
  60. .select_box {
  61. display: flex;
  62. align-items: center;
  63. margin: 20px 25px 0;
  64. background: #FFFFFF;
  65. border-radius: 20px;
  66. opacity: 0.5;
  67. }
  68. .show_active {
  69. opacity: 1;
  70. }
  71. .option_img {
  72. width: 60px;
  73. height: 60px;
  74. }
  75. .option_text {
  76. font-weight: 500;
  77. font-size: 16px;
  78. color: #222222;
  79. padding-left: 20px;
  80. }
  81. .page_foot {
  82. position: fixed;
  83. bottom: 20px;
  84. width: 100%;
  85. }
  86. .foot_btn {
  87. font-weight: 500;
  88. font-size: 16px;
  89. color: #222222;
  90. padding: 15px 0;
  91. margin: 0 35px;
  92. background: #FFFFFF;
  93. text-align: center;
  94. border-radius: 20px;
  95. }
  96. .prize_form {
  97. background: #FFFFFF;
  98. border-radius: 15px;
  99. padding: 20px;
  100. margin: 0 15px;
  101. }
  102. .prize_form .el-form-item {
  103. margin-bottom: 0;
  104. padding: 10px 0;
  105. }
  106. .prize_form .el-input {
  107. width: 220px;
  108. }
  109. .prize_form .el-input__inner {
  110. border: none;
  111. text-align: end;
  112. }
  113. .no_testDrive {
  114. font-size: 16px;
  115. color: #FFFFFF;
  116. line-height: 30px;
  117. padding-top: 140px;
  118. text-align: center;
  119. }
  120. .qw_name {
  121. font-weight: bold;
  122. font-size: 16px;
  123. color: #FFF96E;
  124. }
  125. .isWlCar_title {
  126. font-weight: 400;
  127. font-size: 18px;
  128. color: #744620;
  129. line-height: 36px;
  130. padding-top: 323px;
  131. text-align: center;
  132. }
  133. .qrcode_box {
  134. width: 201px;
  135. height: 201px;
  136. margin: 0 auto;
  137. padding: 15px;
  138. background: #FFFFFF;
  139. border-radius: 20px;
  140. box-sizing: border-box;
  141. margin-top: 40px;
  142. }
  143. .qrcode_img {
  144. width: 100%;
  145. }
  146. .qrcode_tip {
  147. height: 60px;
  148. font-size: 14px;
  149. color: #744620;
  150. text-align: center;
  151. background: #FEC99D;
  152. }
  153. .testDrive_title {
  154. font-weight: bold;
  155. font-size: 24px;
  156. color: #FFFFFF;
  157. padding-top: 100px;
  158. padding-left: 30px;
  159. }
  160. .testDrive_tip {
  161. font-weight: 400;
  162. font-size: 14px;
  163. color: #FFFFFF;
  164. padding-top: 10px;
  165. padding-left: 30px;
  166. padding-bottom: 40px;
  167. }
  168. .noTestDrive_tip {
  169. font-weight: 400;
  170. font-size: 14px;
  171. color: #744620;
  172. padding-top: 10px;
  173. text-align: center;
  174. }
  175. </style>
  176. <body>
  177. <div id="box" class="box">
  178. <div v-if="isWlCar">
  179. <div class="page6s">
  180. <div class="isWlCar_title">
  181. <div>您是车主暂不能给朋友点亮哦~</div>
  182. <div>请添加菱骏服务官发起点亮活动</div>
  183. </div>
  184. <div class="qrcode_box">
  185. <img class="qrcode_img" src="./img/down.png" alt="">
  186. </div>
  187. </div>
  188. <div class="qrcode_tip">扫码添加菱骏服务官</div>
  189. </div>
  190. <div class="page6" v-else-if="noTestDrive">
  191. <div class="no_testDrive">
  192. <div>扫码添加<span class="qw_name"> Ling号玩家企微</span></div>
  193. <div>0元抽睛雨伞、量子香薰机等好礼</div>
  194. </div>
  195. <div class="qrcode_box">
  196. <img class="qrcode_img" src="./img/down.png" alt="">
  197. </div>
  198. <div class="noTestDrive_tip">扫码添加Ling号玩家</div>
  199. </div>
  200. <div class="page6" v-else>
  201. <div v-if="filter==1 || filter==2">
  202. <div class="page_title">帮助好友点亮五菱,即可参与现金抽奖</div>
  203. <div class="page_tip">{{filter==1 ? '请问您是五菱车主吗?' : '五菱汽车诚邀您参与试驾'}}</div>
  204. </div>
  205. <div v-if="filter==1">
  206. <div class="select_box" style="padding: 19px;" :class="selectData === 'one' ? 'show_active' : ''"
  207. @click="selectItem('one')">
  208. <img class="option_img" src="./img/wl_car.png" />
  209. <div class="option_text">我是五菱车主</div>
  210. </div>
  211. <div class="select_box" style="padding: 19px;" :class="selectData === 'two' ? 'show_active' : ''"
  212. @click="selectItem('two')">
  213. <img class="option_img" src="./img/wl_car.png" />
  214. <div class="option_text">还没有购入五菱汽车</div>
  215. </div>
  216. </div>
  217. <div v-else-if="filter==2">
  218. <div class="select_box" style="padding: 38px 35px;" :class="selectData === 'three' ? 'show_active' : ''"
  219. @click="selectItem('three')">
  220. <div class="option_text">预约试驾,帮好友点亮五菱</div>
  221. </div>
  222. <div class="select_box" style="padding: 38px 35px;" :class="selectData === 'four' ? 'show_active' : ''"
  223. @click="selectItem('four')">
  224. <div class="option_text">暂不预约</div>
  225. </div>
  226. </div>
  227. <div v-else-if="filter==3">
  228. <div class="testDrive_title">预约试驾</div>
  229. <div class="testDrive_tip">预约试驾即可帮助好友点亮五菱</div>
  230. <el-form :model="getInfoForm" class="prize_form">
  231. <el-form-item label="意向车型:">
  232. <el-select v-model="getInfoForm.intenModel" placeholder="请选择车型">
  233. <el-option v-for="item in allCarList" :key="item" :label="item" :value="item">
  234. </el-option>
  235. </el-select>
  236. </el-form-item>
  237. <el-form-item label="所在城市:">
  238. <el-cascader v-model="cityData" placeholder="请选择您所在的城市" :options="transformedData" @change="handleInfoCity">
  239. </el-cascader>
  240. </el-form-item>
  241. <el-form-item label="联系方式:">
  242. <el-input v-model="getInfoForm.phone" placeholder="请输入您的手机号" autocomplete="off" maxlength="11"
  243. oninput="value=value.replace(/[^\d]/g,'')"
  244. @blur="$event => {getInfoForm.phone = Number($event.target.value) || '';}"></el-input>
  245. </el-form-item>
  246. </el-form>
  247. </div>
  248. <div class="page_foot">
  249. <div class="foot_btn" @click="handleOk" v-if="filter==3">确认预约,马上抽奖</div>
  250. <div class="foot_btn" @click="handleOk" v-else>确认</div>
  251. </div>
  252. </div>
  253. </div>
  254. </body>
  255. <script>
  256. new Vue({
  257. el: '#box',
  258. data () {
  259. return {
  260. httpUrl: '',
  261. bId: null,
  262. env: '',
  263. allCarList: [],
  264. getInfoForm: {
  265. intenModel: '',
  266. province: '',
  267. city: '',
  268. phone: ''
  269. },
  270. cityData: '',
  271. transformedData: [],
  272. selectData: 'one',
  273. isWlCar: false,
  274. filter: 1,
  275. noTestDrive: false
  276. }
  277. },
  278. created () {
  279. this.bId = this.getQueryParam('bId')
  280. this.env = this.getQueryParam('env')
  281. if (!this.env || this.env === 'prod') {
  282. this.httpUrl = 'https://wlapi.wefanbot.com'
  283. } else {
  284. // this.httpUrl = 'http://test.wefanbot.com:18993'
  285. this.httpUrl = 'http://192.168.1.147:18993'
  286. }
  287. this.ifH5Type()
  288. // this.getAllCar()
  289. // this.getCityLevel()
  290. },
  291. methods: {
  292. ifH5Type () {
  293. if (this.getQueryParam('openId') || localStorage.getItem('openId')) {
  294. if (!this.getQueryParam('externalUserid')) {
  295. this.gerQwAuth(this.bId);
  296. } else {
  297. this.lightenOwner()
  298. }
  299. } else {
  300. // 走授权操作
  301. this.getAuth();
  302. }
  303. },
  304. getAuth () {
  305. // 获取url上的code
  306. let code = this.getQueryParam('code')
  307. if (code) {
  308. fetch(this.httpUrl + `/scrm/v1/mp-client/p/getInfoByh5Code?code=${code}&bId=${this.bId}`)
  309. .then(res => {
  310. return res.json()
  311. }).then(result => {
  312. let { data, code, msg } = result
  313. if (code === 1) {
  314. localStorage.setItem('openId', data.openId)
  315. this.ifH5Type()
  316. }
  317. })
  318. } else {
  319. let redirect_uri = window.location.href
  320. // code 不存在,走微信网页授权逻辑
  321. let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appId=wx99ec0d0828a4d2d3&redirect_uri=${redirect_uri}&scope=snsapi_userinfo&state=STATE#wechat_redirect`
  322. window.location.replace(url)
  323. }
  324. },
  325. // 企微授权
  326. gerQwAuth (bId) {
  327. let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
  328. fetch(this.httpUrl + `/p/insuite/p/getOAUrl?openId=${openId}&bId=${bId}`)
  329. .then(res => {
  330. return res.json()
  331. }).then(result => {
  332. let { data, code, msg } = result
  333. if (code === 1) {
  334. window.location.replace(data)
  335. } else {
  336. this.$message({
  337. message: msg,
  338. type: 'warning'
  339. })
  340. }
  341. })
  342. },
  343. lightenOwner () {
  344. let externalUserid = this.getQueryParam('externalUserid')
  345. let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
  346. const headers = new Headers();
  347. headers.append('police', 110);
  348. fetch(this.httpUrl + `/scrm/v1/wxcp-lighten-owner/p/lottery?externalUserid=${externalUserid}&openId=${openId}&bId=${this.bId}`, {
  349. method: 'GET',
  350. headers: headers
  351. })
  352. .then(res => {
  353. return res.json()
  354. }).then(result => {
  355. let { data, code, msg } = result
  356. if (code === 1) {
  357. this.lightData = data
  358. } else {
  359. this.$message({
  360. message: msg,
  361. })
  362. }
  363. })
  364. },
  365. // 获取全部车型
  366. getAllCar () {
  367. fetch(this.httpUrl + `/scrm/v1/wxcp-raffle/p/getCarList?bId=${this.bId}`)
  368. .then(res => {
  369. return res.json()
  370. }).then(result => {
  371. let { data, code, msg } = result
  372. if (code === 1) {
  373. this.allCarList = data
  374. }
  375. })
  376. },
  377. // 获取城市数据
  378. getCityLevel () {
  379. fetch('https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/1000/1720161853377/pc-code.json')
  380. .then(res => {
  381. return res.json()
  382. }).then(result => {
  383. this.transformedData = this.transformData(result)
  384. })
  385. },
  386. handleInfoCity (value) {
  387. this.getInfoForm.province = value[0]
  388. this.getInfoForm.city = value[1]
  389. },
  390. // 省市数据做转换
  391. transformData (data) {
  392. return data.map(item => {
  393. // 创建一个新对象,避免直接修改原始对象
  394. const newItem = { ...item };
  395. // 重命名 text 为 label
  396. if (newItem.text) {
  397. newItem.label = newItem.text;
  398. newItem.value = newItem.text;
  399. delete newItem.text;
  400. }
  401. // 如果存在 children 数组,则递归处理每个子项
  402. if (newItem.children && Array.isArray(newItem.children)) {
  403. newItem.children = this.transformData(newItem.children);
  404. }
  405. return newItem;
  406. })
  407. },
  408. selectItem (type) {
  409. this.selectData = type
  410. },
  411. handleOk () {
  412. if (this.selectData === 'one') {
  413. this.isWlCar = true
  414. } else if (this.selectData === 'two') {
  415. this.filter = 2
  416. this.selectData = 'three'
  417. } else if (this.selectData === 'three') {
  418. this.filter = 3
  419. } else if (this.selectData === 'four') {
  420. this.noTestDrive = true
  421. }
  422. },
  423. // 截取url中的数据
  424. getQueryParam (paramName) {
  425. // 获取当前URL的查询字符串部分
  426. const queryString = window.location.search;
  427. // 创建一个URLSearchParams对象
  428. const urlParams = new URLSearchParams(queryString);
  429. // 返回指定参数的值,如果不存在则返回null
  430. return urlParams.get(paramName);
  431. },
  432. }
  433. })
  434. </script>
  435. </html>