carOwnerScreening.html 13 KB

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