| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
- <title>点亮五菱</title>
- <!--引入 element-ui 的样式,-->
- <link rel="stylesheet"
- href="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742018383195/element-ui.css">
- <!-- 必须先引入vue, 后使用element-ui -->
- <script
- src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017957144/vue.js"></script>
- <!-- 引入element 的组件库-->
- <script
- src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017747738/element-ui.js"></script>
- <script src="https://unpkg.com/vconsole/dist/vconsole.min.js"></script>
- <!-- <script>
- var vConsole = new window.VConsole();
- </script> -->
- </head>
- <style>
- body {
- margin: 0;
- padding: 0;
- }
- .box {
- width: 100vw;
- height: 100vh;
- box-sizing: border-box;
- background: #FAFAFA;
- }
- .page6 {
- width: 100vw;
- height: 100vh;
- background: url('./img/wl_carOwner.png') no-repeat center;
- background-size: 100vw 100vh;
- background-repeat: no-repeat;
- }
- .page6s {
- width: 100vw;
- height: 100vh;
- background: url('./img/wl_bg.png') no-repeat center;
- background-size: 100vw 100vh;
- background-repeat: no-repeat;
- }
- .page_title {
- font-weight: bold;
- font-size: 16px;
- color: #FFFFFF;
- padding-top: 98px;
- padding-left: 30px;
- }
- .page_tip {
- font-weight: bold;
- font-size: 24px;
- color: #FFFFFF;
- padding: 20px 0 20px 30px;
- }
- .select_box {
- display: flex;
- align-items: center;
- margin: 20px 25px 0;
- background: #FFFFFF;
- border-radius: 20px;
- opacity: 0.5;
- }
- .show_active {
- opacity: 1;
- }
- .option_img {
- width: 60px;
- height: 60px;
- }
- .option_text {
- font-weight: 500;
- font-size: 16px;
- color: #222222;
- padding-left: 20px;
- }
- .page_foot {
- position: fixed;
- bottom: 20px;
- width: 100%;
- }
- .foot_btn {
- font-weight: 500;
- font-size: 16px;
- color: #222222;
- padding: 15px 0;
- margin: 0 35px;
- background: #FFFFFF;
- text-align: center;
- border-radius: 20px;
- }
- .prize_form {
- background: #FFFFFF;
- border-radius: 15px;
- padding: 20px;
- margin: 0 15px;
- }
- .prize_form .el-form-item {
- margin-bottom: 0;
- padding: 10px 0;
- }
- .prize_form .el-input {
- width: 220px;
- }
- .prize_form .el-input__inner {
- border: none;
- text-align: end;
- }
- .no_testDrive {
- font-size: 16px;
- color: #FFFFFF;
- line-height: 30px;
- padding-top: 140px;
- text-align: center;
- }
- .qw_name {
- font-weight: bold;
- font-size: 16px;
- color: #FFF96E;
- }
- .isWlCar_title {
- font-weight: 400;
- font-size: 18px;
- color: #744620;
- line-height: 36px;
- padding-top: 323px;
- text-align: center;
- }
- .qrcode_box {
- width: 201px;
- height: 201px;
- margin: 0 auto;
- padding: 15px;
- background: #FFFFFF;
- border-radius: 20px;
- box-sizing: border-box;
- margin-top: 40px;
- }
- .qrcode_img {
- width: 100%;
- }
- .qrcode_tip {
- height: 60px;
- font-size: 14px;
- color: #744620;
- text-align: center;
- background: #FEC99D;
- }
- .testDrive_title {
- font-weight: bold;
- font-size: 24px;
- color: #FFFFFF;
- padding-top: 100px;
- padding-left: 30px;
- }
- .testDrive_tip {
- font-weight: 400;
- font-size: 14px;
- color: #FFFFFF;
- padding-top: 10px;
- padding-left: 30px;
- padding-bottom: 40px;
- }
- .noTestDrive_tip {
- font-weight: 400;
- font-size: 14px;
- color: #744620;
- padding-top: 10px;
- text-align: center;
- }
- </style>
- <body>
- <div id="box" class="box">
- <div v-if="isWlCar">
- <div class="page6s">
- <div class="isWlCar_title">
- <div>您是车主暂不能给朋友点亮哦~</div>
- <div>请添加菱骏服务官发起点亮活动</div>
- </div>
- <div class="qrcode_box">
- <img class="qrcode_img" src="./img/down.png" alt="">
- </div>
- </div>
- <div class="qrcode_tip">扫码添加菱骏服务官</div>
- </div>
- <div class="page6" v-else-if="noTestDrive">
- <div class="no_testDrive">
- <div>扫码添加<span class="qw_name"> Ling号玩家企微</span></div>
- <div>0元抽睛雨伞、量子香薰机等好礼</div>
- </div>
- <div class="qrcode_box">
- <img class="qrcode_img" src="./img/down.png" alt="">
- </div>
- <div class="noTestDrive_tip">扫码添加Ling号玩家</div>
- </div>
- <div class="page6" v-else>
- <div v-if="filter==1 || filter==2">
- <div class="page_title">帮助好友点亮五菱,即可参与现金抽奖</div>
- <div class="page_tip">{{filter==1 ? '请问您是五菱车主吗?' : '五菱汽车诚邀您参与试驾'}}</div>
- </div>
- <div v-if="filter==1">
- <div class="select_box" style="padding: 19px;" :class="selectData === 'one' ? 'show_active' : ''"
- @click="selectItem('one')">
- <img class="option_img" src="./img/wl_car.png" />
- <div class="option_text">我是五菱车主</div>
- </div>
- <div class="select_box" style="padding: 19px;" :class="selectData === 'two' ? 'show_active' : ''"
- @click="selectItem('two')">
- <img class="option_img" src="./img/wl_car.png" />
- <div class="option_text">还没有购入五菱汽车</div>
- </div>
- </div>
- <div v-else-if="filter==2">
- <div class="select_box" style="padding: 38px 35px;" :class="selectData === 'three' ? 'show_active' : ''"
- @click="selectItem('three')">
- <div class="option_text">预约试驾,帮好友点亮五菱</div>
- </div>
- <div class="select_box" style="padding: 38px 35px;" :class="selectData === 'four' ? 'show_active' : ''"
- @click="selectItem('four')">
- <div class="option_text">暂不预约</div>
- </div>
- </div>
- <div v-else-if="filter==3">
- <div class="testDrive_title">预约试驾</div>
- <div class="testDrive_tip">预约试驾即可帮助好友点亮五菱</div>
- <el-form :model="getInfoForm" class="prize_form">
- <el-form-item label="意向车型:">
- <el-select v-model="getInfoForm.intenModel" placeholder="请选择车型">
- <el-option v-for="item in allCarList" :key="item" :label="item" :value="item">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="所在城市:">
- <el-cascader v-model="cityData" placeholder="请选择您所在的城市" :options="transformedData" @change="handleInfoCity">
- </el-cascader>
- </el-form-item>
- <el-form-item label="联系方式:">
- <el-input v-model="getInfoForm.phone" placeholder="请输入您的手机号" autocomplete="off" maxlength="11"
- oninput="value=value.replace(/[^\d]/g,'')"
- @blur="$event => {getInfoForm.phone = Number($event.target.value) || '';}"></el-input>
- </el-form-item>
- </el-form>
- </div>
- <div class="page_foot">
- <div class="foot_btn" @click="handleOk" v-if="filter==3">确认预约,马上抽奖</div>
- <div class="foot_btn" @click="handleOk" v-else>确认</div>
- </div>
- </div>
- </div>
- </body>
- <script>
- new Vue({
- el: '#box',
- data () {
- return {
- httpUrl: '',
- bId: null,
- env: '',
- allCarList: [],
- getInfoForm: {
- intenModel: '',
- province: '',
- city: '',
- phone: ''
- },
- cityData: '',
- transformedData: [],
- selectData: 'one',
- isWlCar: false,
- filter: 1,
- noTestDrive: false
- }
- },
- created () {
- this.bId = this.getQueryParam('bId')
- this.env = this.getQueryParam('env')
- if (!this.env || this.env === 'prod') {
- this.httpUrl = 'https://wlapi.wefanbot.com'
- } else {
- // this.httpUrl = 'http://test.wefanbot.com:18993'
- this.httpUrl = 'http://192.168.1.147:18993'
- }
- this.ifH5Type()
- // this.getAllCar()
- // this.getCityLevel()
- },
- methods: {
- ifH5Type () {
- if (this.getQueryParam('openId') || localStorage.getItem('openId')) {
- if (!this.getQueryParam('externalUserid')) {
- this.gerQwAuth(this.bId);
- } else {
- this.lightenOwner()
- }
- } else {
- // 走授权操作
- this.getAuth();
- }
- },
- getAuth () {
- // 获取url上的code
- let code = this.getQueryParam('code')
- if (code) {
- fetch(this.httpUrl + `/scrm/v1/mp-client/p/getInfoByh5Code?code=${code}&bId=${this.bId}`)
- .then(res => {
- return res.json()
- }).then(result => {
- let { data, code, msg } = result
- if (code === 1) {
- localStorage.setItem('openId', data.openId)
- this.ifH5Type()
- }
- })
- } else {
- let redirect_uri = window.location.href
- // code 不存在,走微信网页授权逻辑
- let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appId=wx99ec0d0828a4d2d3&redirect_uri=${redirect_uri}&scope=snsapi_userinfo&state=STATE#wechat_redirect`
- window.location.replace(url)
- }
- },
- // 企微授权
- gerQwAuth (bId) {
- let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
- fetch(this.httpUrl + `/p/insuite/p/getOAUrl?openId=${openId}&bId=${bId}`)
- .then(res => {
- return res.json()
- }).then(result => {
- let { data, code, msg } = result
- if (code === 1) {
- window.location.replace(data)
- } else {
- this.$message({
- message: msg,
- type: 'warning'
- })
- }
- })
- },
- lightenOwner () {
- let externalUserid = this.getQueryParam('externalUserid')
- let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
- const headers = new Headers();
- headers.append('police', 110);
- fetch(this.httpUrl + `/scrm/v1/wxcp-lighten-owner/p/lottery?externalUserid=${externalUserid}&openId=${openId}&bId=${this.bId}`, {
- method: 'GET',
- headers: headers
- })
- .then(res => {
- return res.json()
- }).then(result => {
- let { data, code, msg } = result
- if (code === 1) {
- this.lightData = data
- } else {
- this.$message({
- message: msg,
- })
- }
- })
- },
- // 获取全部车型
- getAllCar () {
- fetch(this.httpUrl + `/scrm/v1/wxcp-raffle/p/getCarList?bId=${this.bId}`)
- .then(res => {
- return res.json()
- }).then(result => {
- let { data, code, msg } = result
- if (code === 1) {
- this.allCarList = data
- }
- })
- },
- // 获取城市数据
- getCityLevel () {
- fetch('https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/1000/1720161853377/pc-code.json')
- .then(res => {
- return res.json()
- }).then(result => {
- this.transformedData = this.transformData(result)
- })
- },
- handleInfoCity (value) {
- this.getInfoForm.province = value[0]
- this.getInfoForm.city = value[1]
- },
- // 省市数据做转换
- transformData (data) {
- return data.map(item => {
- // 创建一个新对象,避免直接修改原始对象
- const newItem = { ...item };
- // 重命名 text 为 label
- if (newItem.text) {
- newItem.label = newItem.text;
- newItem.value = newItem.text;
- delete newItem.text;
- }
- // 如果存在 children 数组,则递归处理每个子项
- if (newItem.children && Array.isArray(newItem.children)) {
- newItem.children = this.transformData(newItem.children);
- }
- return newItem;
- })
- },
- selectItem (type) {
- this.selectData = type
- },
- handleOk () {
- if (this.selectData === 'one') {
- this.isWlCar = true
- } else if (this.selectData === 'two') {
- this.filter = 2
- this.selectData = 'three'
- } else if (this.selectData === 'three') {
- this.filter = 3
- } else if (this.selectData === 'four') {
- this.noTestDrive = true
- }
- },
- // 截取url中的数据
- getQueryParam (paramName) {
- // 获取当前URL的查询字符串部分
- const queryString = window.location.search;
- // 创建一个URLSearchParams对象
- const urlParams = new URLSearchParams(queryString);
- // 返回指定参数的值,如果不存在则返回null
- return urlParams.get(paramName);
- },
- }
- })
- </script>
- </html>
|