lightUpWl.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878
  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"
  7. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no, viewport-fit=cover" />
  8. <title>点亮五菱</title>
  9. <!--引入 element-ui 的样式,-->
  10. <link rel="stylesheet"
  11. href="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742018383195/element-ui.css">
  12. <!-- 必须先引入vue, 后使用element-ui -->
  13. <script
  14. src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017957144/vue.js"></script>
  15. <!-- 引入element 的组件库-->
  16. <script
  17. src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017747738/element-ui.js"></script>
  18. <!-- <script src="js/vconsole.min.js"></script>
  19. <script>
  20. var vConsole = new window.VConsole();
  21. </script> -->
  22. </head>
  23. <style>
  24. body {
  25. margin: 0;
  26. padding: 0;
  27. }
  28. .box {
  29. width: 100vw;
  30. height: 100%;
  31. box-sizing: border-box;
  32. background: #FAFAFA;
  33. }
  34. .page6 {
  35. width: 100vw;
  36. height: 100%;
  37. background: url('./img/wl_bg.png') no-repeat;
  38. background-size: 100%;
  39. background-repeat: no-repeat;
  40. }
  41. .wl_no {
  42. width: 100%;
  43. margin-top: 260px;
  44. }
  45. .wl_btn {
  46. width: 100%;
  47. display: flex;
  48. justify-content: center;
  49. align-items: center;
  50. position: relative;
  51. margin-top: 108px;
  52. }
  53. .image_wrapper {
  54. position: relative;
  55. display: inline-block;
  56. }
  57. .image_wrapper img {
  58. height: 68px;
  59. display: block;
  60. /* 移除图片底部间隙 */
  61. }
  62. .btn_text {
  63. position: absolute;
  64. top: 46%;
  65. left: 50%;
  66. transform: translate(-50%, -46%);
  67. font-weight: 500;
  68. font-size: 20px;
  69. color: #FFFFFF;
  70. width: 100%;
  71. text-align: center;
  72. }
  73. .ask {
  74. background: #FEC99D;
  75. margin-top: -22px;
  76. }
  77. .ask_rule {
  78. font-size: 12px;
  79. color: #E30628;
  80. text-align: center;
  81. padding-top: 30px;
  82. }
  83. .step {
  84. display: flex;
  85. justify-content: center;
  86. align-items: center;
  87. padding-top: 20px;
  88. }
  89. .step span {
  90. font-size: 14px;
  91. color: #BC7E4B;
  92. }
  93. .step_line {
  94. width: 30px;
  95. height: 1px;
  96. background: #BC7E4B;
  97. margin: 0 5px;
  98. }
  99. /*
  100. .ask_btn {
  101. display: flex;
  102. justify-content: center;
  103. align-items: center;
  104. margin-top: 20px;
  105. }
  106. .ask_btn img {
  107. width: 50px;
  108. height: 50px;
  109. margin-right: 10px;
  110. border-radius: 50%;
  111. }
  112. .ask_btn img:last-child {
  113. margin-right: 0;
  114. } */
  115. .person_module {
  116. display: flex;
  117. justify-content: space-between;
  118. align-items: center;
  119. background: rgba(254, 232, 208, 0.8);
  120. border-radius: 15px;
  121. margin: 20px 10px 0;
  122. padding: 15px 35px;
  123. }
  124. .person_box {
  125. display: flex;
  126. flex-direction: column;
  127. justify-content: center;
  128. align-items: center;
  129. font-weight: 400;
  130. font-size: 12px;
  131. color: #896F5A;
  132. }
  133. .person_num {
  134. font-weight: bold;
  135. font-size: 18px;
  136. color: #6A401D;
  137. line-height: 26px;
  138. padding-bottom: 5px;
  139. }
  140. .person_line {
  141. width: 1px;
  142. height: 48px;
  143. background: #6A401D;
  144. opacity: 0.2;
  145. }
  146. .ask_list {
  147. margin: 15px 10px;
  148. padding: 15px;
  149. background: rgba(254, 232, 208, 0.8);
  150. border-radius: 15px;
  151. }
  152. .ask_title {
  153. font-weight: bold;
  154. font-size: 16px;
  155. color: #6A401D;
  156. line-height: 24px;
  157. text-align: center;
  158. }
  159. .ask_user_box {
  160. max-height: 338px;
  161. overflow-y: auto;
  162. }
  163. .ask_user {
  164. display: flex;
  165. justify-content: space-between;
  166. align-items: center;
  167. padding: 10px 0;
  168. border-bottom: 1px solid rgba(106, 64, 29, 0.1);
  169. }
  170. .user_msg {
  171. display: flex;
  172. justify-content: center;
  173. align-items: center;
  174. font-weight: 400;
  175. font-size: 14px;
  176. color: #222222;
  177. white-space: nowrap;
  178. }
  179. .user_name {
  180. overflow: hidden;
  181. white-space: nowrap;
  182. text-overflow: ellipsis;
  183. width: 124px;
  184. }
  185. .user_msg img {
  186. width: 40px;
  187. height: 40px;
  188. border-radius: 50%;
  189. margin-right: 10px;
  190. }
  191. .ask_status1 {
  192. font-weight: 400;
  193. font-size: 12px;
  194. color: #FF4646;
  195. max-width: 46%;
  196. text-align: right;
  197. }
  198. .ask_status2 {
  199. font-weight: 400;
  200. font-size: 12px;
  201. color: #C98146;
  202. }
  203. .ask_status3 {
  204. font-weight: 400;
  205. font-size: 12px;
  206. color: #2885FF;
  207. }
  208. .activity_box {
  209. background: #FEE8D0;
  210. border-radius: 20px 20px 0 0;
  211. padding: 20px 15px;
  212. box-sizing: border-box;
  213. }
  214. .lottery {
  215. display: flex;
  216. justify-content: space-between;
  217. align-items: center;
  218. padding: 10px;
  219. box-sizing: border-box;
  220. background: #FFFFFF;
  221. border-radius: 15px;
  222. margin-bottom: 15px;
  223. }
  224. .award {
  225. display: flex;
  226. align-items: center;
  227. gap: 10px;
  228. }
  229. .award_ac {
  230. width: 58px;
  231. height: 58px;
  232. border-radius: 10px;
  233. background: #F5E3D4;
  234. }
  235. .award_tip {
  236. font-size: 14px;
  237. color: #999999;
  238. }
  239. .award_title {
  240. font-weight: 500;
  241. font-size: 16px;
  242. color: #FF765B;
  243. padding-bottom: 5px;
  244. }
  245. .award_btn {
  246. font-weight: 500;
  247. font-size: 14px;
  248. color: #FFFFFF;
  249. padding: 3px 8px;
  250. background: #CCCCCC;
  251. border-radius: 13px;
  252. }
  253. .award_btn_ac {
  254. font-weight: 500;
  255. font-size: 14px;
  256. color: #FFFFFF;
  257. padding: 3px 8px;
  258. background: #FF7979;
  259. border-radius: 13px;
  260. }
  261. .prize_dialog {
  262. position: fixed;
  263. top: 0;
  264. left: 0;
  265. width: 100%;
  266. height: 100%;
  267. background-color: rgba(0, 0, 0, 0.5);
  268. /* 半透明黑色 */
  269. z-index: 1000;
  270. /* 确保遮罩层在顶部 */
  271. transition: opacity 0.5s ease;
  272. /* 可选:添加透明度过渡效果 */
  273. }
  274. .dialog_body {
  275. width: 100%;
  276. height: 100%;
  277. z-index: 1001;
  278. /* 确保遮罩层在顶部 */
  279. display: flex;
  280. flex-direction: column;
  281. align-items: center;
  282. justify-content: center;
  283. }
  284. .dialog_bg {
  285. max-width: 275px;
  286. height: 370px;
  287. border-radius: 20px;
  288. position: relative;
  289. object-fit: contain;
  290. }
  291. .save_btn {
  292. padding: 15px 77px;
  293. background: #FFFFFF;
  294. border-radius: 29px;
  295. font-weight: 500;
  296. font-size: 14px;
  297. color: #222222;
  298. margin-top: 20px;
  299. }
  300. .activity_title {
  301. font-weight: bold;
  302. font-size: 14px;
  303. color: #CB4E35;
  304. padding-top: 5px;
  305. padding-bottom: 15px;
  306. }
  307. .activity_msg {
  308. font-size: 14px;
  309. color: #CB4E35;
  310. }
  311. .activity_msg p {
  312. margin: 0;
  313. line-height: 24px;
  314. }
  315. .el-dialog {
  316. width: 335px;
  317. border-radius: 20px;
  318. }
  319. .el-dialog__header {
  320. text-align: center;
  321. }
  322. .el-dialog__title {
  323. font-weight: 500;
  324. font-size: 16px;
  325. color: #222222;
  326. }
  327. .prize_form .el-form-item {
  328. padding: 0;
  329. margin-bottom: 10px;
  330. }
  331. .prize_form .el-input__inner {
  332. text-align: left;
  333. }
  334. .prize_form .el-form-item__label {
  335. line-height: 20px;
  336. }
  337. .el-select {
  338. width: 100%;
  339. }
  340. .dialog-footer {
  341. text-align: center;
  342. }
  343. .dialog-footer button {
  344. width: 119px;
  345. height: 46px;
  346. background: #FFB34B;
  347. border-radius: 20px;
  348. font-weight: 500;
  349. font-size: 16px;
  350. color: #FFFFFF;
  351. border: none;
  352. }
  353. .carousel-container {
  354. position: relative;
  355. width: 100vw;
  356. overflow: hidden;
  357. }
  358. .carousel-wrapper {
  359. display: flex;
  360. transition: transform 0.4s ease-out;
  361. height: 100%;
  362. }
  363. .carousel-item {
  364. min-width: 100%;
  365. height: 100%;
  366. display: flex
  367. }
  368. .arrow {
  369. position: absolute;
  370. top: 347px;
  371. transition: opacity 0.3s;
  372. user-select: none;
  373. z-index: 2;
  374. width: 30px;
  375. height: 26px;
  376. }
  377. .arrow-left {
  378. left: 15px;
  379. }
  380. .arrow-right {
  381. right: 15px;
  382. }
  383. .progress {
  384. font-weight: 400;
  385. font-size: 12px;
  386. color: #E83636;
  387. text-align: center;
  388. }
  389. </style>
  390. <body>
  391. <div id="box" class="box">
  392. <div class="page6">
  393. <div class="carousel-container">
  394. <div class="carousel-wrapper" :style="{ transform: `translateX(-${currentIndex * 100}%)` }">
  395. <div class="carousel-item" v-if="lightData.wxcpLightenClientList.length < 5">
  396. <img class="carousel wl_no" v-if="!lightData.wxcpLightenClientList.length" src="./img/wl_no.png" />
  397. <img class="carousel wl_no" v-if="lightData.wxcpLightenClientList.length === 1" src="./img/light_one.png" />
  398. <img class="carousel wl_no" v-else-if="lightData.wxcpLightenClientList.length === 2"
  399. src="./img/light_two.png" />
  400. <img class="carousel wl_no" v-else-if="lightData.wxcpLightenClientList.length === 3"
  401. src="./img/light_three.png" />
  402. <img class="carousel wl_no" v-else-if="lightData.wxcpLightenClientList.length === 4"
  403. src="./img/light_four.png" />
  404. </div>
  405. <div v-else class="carousel-item">
  406. <img class="carousel wl_no" v-for="i in parseInt(lightData.wxcpLightenClientList.length/5)" :key="i"
  407. src="./img/light_five.png" />
  408. <img class="carousel wl_no" v-if="parseInt(lightData.wxcpLightenClientList.length%5) === 1"
  409. src="./img/light_one.png" />
  410. <img class="carousel wl_no" v-else-if="parseInt(lightData.wxcpLightenClientList.length%5) === 2"
  411. src="./img/light_two.png" />
  412. <img class="carousel wl_no" v-else-if="parseInt(lightData.wxcpLightenClientList.length%5) === 3"
  413. src="./img/light_three.png" />
  414. <img class="carousel wl_no" v-else-if="parseInt(lightData.wxcpLightenClientList.length%5) === 4"
  415. src="./img/light_four.png" />
  416. </div>
  417. </div>
  418. <!-- 左箭头 -->
  419. <img v-show="lightData.wxcpLightenClientList.length>5 && currentIndex > 0" src="./img/wl-left.png" alt=""
  420. class="arrow arrow-left" @click="prevSlide">
  421. <!-- 右箭头 -->
  422. <img
  423. v-show="lightData.wxcpLightenClientList.length>5 && currentIndex < lightData.wxcpLightenClientList.length/5 - 1"
  424. src="./img/wl-right.png" alt="" class="arrow arrow-right" @click="nextSlide"></img>
  425. </div>
  426. <div class="progress">
  427. <span v-if="getChunkData.length < 5">点亮进度:{{getChunkData.length}}/5</span>
  428. <span v-if="lightData.wxcpLightenClientList.length>5 && getChunkData.length === 5">您已成功点亮,左右切换查看更多</span>
  429. </div>
  430. <div class="wl_btn" @click="handleAsk">
  431. <div class="image_wrapper">
  432. <img class="btn_img" src="./img/wl_btn.png" />
  433. <div class="btn_text">{{lightData.raffle2.leftNum ? '成功点亮' : '邀请好友点亮'}}</div>
  434. </div>
  435. </div>
  436. </div>
  437. <div class="ask">
  438. <div class="ask_rule">参与活动前请仔细阅读页面底部活动规则</div>
  439. <div class="step">
  440. <span>1.生成海报</span>
  441. <span class="step_line"></span>
  442. <span>2.邀请好友</span>
  443. <span class="step_line"></span>
  444. <span>3.完成任务</span>
  445. </div>
  446. <!-- <div class="ask_btn">
  447. <img v-for="item in getChunkData.slice(0, 5)" :key="item.id"
  448. :src="item.head || './img/ask_btn.png'" />
  449. <div v-if="getChunkData.length < 5">
  450. <img v-for="i in (5-getChunkData.length)" :key="i" src="./img/ask_btn.png" />
  451. </div>
  452. </div> -->
  453. <div class="person_module">
  454. <div class="person_box">
  455. <div class="person_num">{{lightData.clientCount}}</div>
  456. <div>邀请人数</div>
  457. </div>
  458. <div class="person_line"></div>
  459. <div class="person_box">
  460. <div class="person_num">{{lightData.formCount}}</div>
  461. <div>报名人数</div>
  462. </div>
  463. <div class="person_line"></div>
  464. <div class="person_box">
  465. <div class="person_num">{{lightData.testDriveCount}}</div>
  466. <div>试驾人数</div>
  467. </div>
  468. </div>
  469. <div class="ask_list">
  470. <div class="ask_title">已邀请用户</div>
  471. <div class="ask_user_box">
  472. <div class="ask_user" v-for="item in lightData.wxcpLightenClientList" :key="item.id">
  473. <div class="user_msg">
  474. <img :src="item.head || './img/ask_btn.png'" />
  475. <div class="user_name">{{item.name}}</div>
  476. </div>
  477. <div v-if="item.auditStatus === 1" class="ask_status2">审核中</div>
  478. <div v-if="item.auditStatus === 2" class="ask_status1">
  479. <div>未通过</div>
  480. <div>{{item.rejectionReason}}</div>
  481. </div>
  482. <div v-if="item.auditStatus === 3" class="ask_status2">待下发</div>
  483. <div v-if="item.auditStatus === 4 || item.auditStatus === 6" class="ask_status2">下发中</div>
  484. <div v-if="item.auditStatus === 5" class="ask_status3">已下发</div>
  485. </div>
  486. </div>
  487. </div>
  488. <div class="activity_box">
  489. <div v-if="lightData.wxcpLighten.raffeSwitch">
  490. <div class="lottery">
  491. <div class="award">
  492. <img class="award_ac" src="img/lottery1.png" />
  493. <div class="award_tip">
  494. <div class="award_title">好运抽奖</div>
  495. <div>每邀{{lightData.wxcpLighten.raffle1ClientNum}}人抽1次奖,最多{{lightData.wxcpLighten.raffle1NumMax}}次</div>
  496. </div>
  497. </div>
  498. <div v-if="lightData.wxcpLighten.raffle1NumMax === lightData.raffle1.useNum" class="award_btn">已完成</div>
  499. <div v-else>
  500. <div v-if="lightData.raffle1.leftNum" class="award_btn_ac" @click="handleLottery(lightData.raffle1BizId)">
  501. 去抽奖</div>
  502. <div v-else class="award_btn">未完成</div>
  503. </div>
  504. </div>
  505. <div class="lottery">
  506. <div class="award">
  507. <img class="award_ac" src="img/lottery2.png" />
  508. <div class="award_tip">
  509. <div class="award_title">终极大奖</div>
  510. <div>完全点亮即可抽取终极大奖!</div>
  511. </div>
  512. </div>
  513. <div v-if="lightData.wxcpLighten.raffle2NumMax === lightData.raffle2.useNum" class="award_btn">已完成</div>
  514. <div v-else>
  515. <div v-if="lightData.raffle2.leftNum" class="award_btn_ac" @click="handleLottery(lightData.raffle2BizId)">
  516. 去抽奖</div>
  517. <div v-else class="award_btn">未完成</div>
  518. </div>
  519. </div>
  520. </div>
  521. <div class="activity_title">活动信息</div>
  522. <div class="activity_msg" v-html="lightData.wxcpLighten.activityInfo"></div>
  523. </div>
  524. </div>
  525. <!-- 邀请弹窗 -->
  526. <div class="prize_dialog" v-if="showAskDialog">
  527. <div class="dialog_body">
  528. <img class="dialog_bg" :src="lightData.urlPost" />
  529. <div class="save_btn" @click="showAskDialog = false">长按图片保存</div>
  530. </div>
  531. </div>
  532. <el-dialog title="填写信息" :visible.sync="showDialog" :show-close="false" :close-on-click-modal="false"
  533. :close-on-press-escape="false">
  534. <el-form :model="lightData" class="prize_form" label-position="top">
  535. <el-form-item label="顾问所属门店" required>
  536. <el-select v-if="Number(lightData.lightenId) === 117466319110001" v-model="lightData.store" placeholder="请选择">
  537. <el-option v-for="item in storeList1" :key="item" :label="item" :value="item">
  538. </el-option>
  539. </el-select>
  540. <el-select v-else-if="Number(lightData.lightenId) === 117466527210041" v-model="lightData.store" placeholder="请选择">
  541. <el-option v-for="item in storeList2" :key="item" :label="item" :value="item">
  542. </el-option>
  543. </el-select>
  544. <el-select v-else-if="Number(lightData.lightenId) === 117481774010051" v-model="lightData.store" placeholder="请选择">
  545. <el-option v-for="item in storeList3" :key="item" :label="item" :value="item">
  546. </el-option>
  547. </el-select>
  548. <el-input v-else v-model="lightData.store"></el-input>
  549. </el-form-item>
  550. <el-form-item label="顾问姓名" required>
  551. <el-input v-model="lightData.referrer"></el-input>
  552. </el-form-item>
  553. <el-form-item label="车主手机号" required>
  554. <el-input type="number" v-model="lightData.referrerPhone"></el-input>
  555. </el-form-item>
  556. </el-form>
  557. <div slot="footer" class="dialog-footer">
  558. <el-button type="warning" :loading="loading" @click="handleSaveRefer">确 定</el-button>
  559. </div>
  560. </el-dialog>
  561. </div>
  562. </body>
  563. <script>
  564. new Vue({
  565. el: '#box',
  566. data() {
  567. return {
  568. httpUrl: '',
  569. bId: null,
  570. env: '',
  571. showAskDialog: false,
  572. lightData: {
  573. urlPost: '',
  574. wxcpLightenClientList: [],
  575. wxcpLighten: {
  576. activityInfo: '',
  577. raffeSwitch: 0,
  578. raffle1ClientNum: null,
  579. raffle1NumMax: null, // 抽奖1总次数
  580. raffle2NumMax: null, // 抽奖2总次数
  581. type: null,
  582. },
  583. raffle1: {
  584. leftNum: null, // 抽奖1剩余次数
  585. useNum: null, // 抽奖1已使用次数
  586. },
  587. raffle2: {
  588. leftNum: null, // 抽奖2剩余次数
  589. useNum: null, // 抽奖2已使用次数
  590. },
  591. raffle1BizId: null,
  592. raffle2BizId: null,
  593. referrer: '', // 顾问姓名
  594. store: '', // 门店
  595. referrerPhone: '', // 领取奖励手机号
  596. lightenId: null, // 点亮id
  597. },
  598. showDialog: false, // 填写顾问姓名信息弹窗
  599. loading: false, // 提交按钮loading
  600. currentIndex: 0, // 当前显示的图片索引
  601. getChunkData: [], // 分割数据
  602. clientCount: null, // 邀请人数
  603. formCount: null, // 报名人数
  604. testDriveCount: null, // 试驾人数
  605. storeList1: ['广州华贵', '海珠五菱', '广州菱森', '广州菱邦', '广州富骋'],
  606. storeList2: ['茂物机电', '高州分公司', '化州分公司', '电白分公司', '信宜分公司', '茂名菱利'],
  607. storeList3: ['长沈路店', '东环店', '军华店'],
  608. }
  609. },
  610. created() {
  611. this.bId = this.getQueryParam('bId')
  612. this.env = this.getQueryParam('env')
  613. if (!this.env || this.env === 'prod') {
  614. this.httpUrl = 'https://wlapi.wefanbot.com'
  615. } else {
  616. this.httpUrl = 'https://test.wefanbot.com:28993'
  617. // this.httpUrl = 'http://192.168.1.147:18993'
  618. }
  619. localStorage.removeItem('openId')
  620. this.ifH5Type()
  621. },
  622. methods: {
  623. ifH5Type() {
  624. if (this.getQueryParam('openId') || localStorage.getItem('openId')) {
  625. if (!this.getQueryParam('externalUserid')) {
  626. this.gerQwAuth(this.bId);
  627. } else {
  628. this.lightenShare()
  629. }
  630. } else {
  631. // 走授权操作
  632. this.getAuth();
  633. }
  634. },
  635. getAuth() {
  636. // 获取url上的code
  637. let code = this.getQueryParam('code')
  638. if (code) {
  639. // 判断业务id是否生产环境业务id
  640. fetch(this.httpUrl + `/p/insuite/p/isProdId?id=${this.bId}`)
  641. .then(res => {
  642. return res.json()
  643. }).then(result => {
  644. let { data, msg } = result
  645. if (typeof data === 'boolean' && data) {
  646. this.httpUrl = 'https://wlapi.wefanbot.com'
  647. } else {
  648. this.httpUrl = 'http://test.wefanbot.com:18993'
  649. }
  650. this.getInfoByh5Code(this.getQueryParam('code'))
  651. })
  652. } else {
  653. let redirect_uri = window.location.href
  654. // code 不存在,走微信网页授权逻辑
  655. let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appId=wx99ec0d0828a4d2d3&redirect_uri=${redirect_uri}&scope=snsapi_userinfo&state=STATE#wechat_redirect`
  656. window.location.replace(url)
  657. }
  658. },
  659. getInfoByh5Code(code) {
  660. fetch(this.httpUrl + `/scrm/v1/mp-client/p/getInfoByh5Code?code=${code}&bId=${this.bId}`)
  661. .then(res => {
  662. return res.json()
  663. }).then(result => {
  664. let { data, code, msg } = result
  665. if (code === 1) {
  666. localStorage.setItem('openId', data.openId)
  667. this.ifH5Type()
  668. }
  669. })
  670. },
  671. // 企微授权
  672. gerQwAuth(bId) {
  673. let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
  674. fetch(this.httpUrl + `/p/insuite/p/getOAUrl?openId=${openId}&bId=${bId}`)
  675. .then(res => {
  676. return res.json()
  677. }).then(result => {
  678. let { data, code, msg } = result
  679. if (code === 1) {
  680. window.location.replace(data)
  681. } else {
  682. this.$message({
  683. message: msg,
  684. type: 'warning'
  685. })
  686. }
  687. })
  688. },
  689. lightenShare() {
  690. let externalUserid = this.getQueryParam('externalUserid')
  691. let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
  692. const headers = new Headers();
  693. headers.append('police', 110);
  694. fetch(this.httpUrl + `/scrm/v1/wxcp-lighten-share/p/lottery?externalUserid=${externalUserid}&openId=${openId}&bId=${this.bId}`, {
  695. method: 'GET',
  696. headers: headers
  697. })
  698. .then(res => {
  699. return res.json()
  700. }).then(result => {
  701. let { data, code, msg } = result
  702. if (code === 1) {
  703. this.lightData = data
  704. this.currentIndex = Math.ceil(this.lightData.wxcpLightenClientList.length / 5) ? Math.ceil(this.lightData.wxcpLightenClientList.length / 5) - 1 : 0
  705. this.getChunkData = this.getChunk(this.lightData.wxcpLightenClientList, this.currentIndex)
  706. if (data.wxcpLighten.type === 2 && (!data.referrer || !data.referrerPhone)) {
  707. this.showDialog = true
  708. }
  709. if (!data.raffle1) {
  710. this.lightData.raffle1 = {
  711. leftNum: 0,
  712. useNum: 0,
  713. }
  714. }
  715. if (!data.raffle2) {
  716. this.lightData.raffle2 = {
  717. leftNum: 0,
  718. useNum: 0,
  719. }
  720. }
  721. } else {
  722. this.$message({
  723. message: msg,
  724. })
  725. }
  726. })
  727. },
  728. handleAsk() {
  729. this.showAskDialog = true
  730. },
  731. handleLottery(bizId) {
  732. let url = ''
  733. if (!this.env || this.env === 'prod') {
  734. url = `https://lottery2.camlook.cn/?bId=${bizId}&h5Type=30`
  735. } else {
  736. url = `https://lottery2.camlook.cn/?bId=${bizId}&env=dev&h5Type=30`
  737. }
  738. window.location.replace(url)
  739. },
  740. handleSaveRefer() {
  741. if (!this.lightData.store) {
  742. this.$message({
  743. message: '请填写顾问所属门店',
  744. type: 'warning'
  745. })
  746. return
  747. }
  748. if (!this.lightData.referrer) {
  749. this.$message({
  750. message: '请填写顾问姓名',
  751. type: 'warning'
  752. })
  753. return
  754. }
  755. if (!this.lightData.referrerPhone) {
  756. this.$message({
  757. message: '请填写车主手机号',
  758. type: 'warning'
  759. })
  760. return
  761. }
  762. this.loading = true
  763. let openId = this.getQueryParam('openId') || localStorage.getItem('openId')
  764. fetch(this.httpUrl + `/scrm/v1/wxcp-lighten-owner/p/updateReferrer?openId=${openId}&bId=${this.bId}`, {
  765. method: 'post',
  766. body: JSON.stringify({
  767. referrer: this.lightData.referrer, // 顾问姓名
  768. store: this.lightData.store, // 门店
  769. referrerPhone: this.lightData.referrerPhone, // 领取奖励手机号
  770. }),
  771. headers: {
  772. 'Content-Type': 'application/json'
  773. }
  774. }).then(res => {
  775. return res.json()
  776. }).then(result => {
  777. let { data, code, msg } = result
  778. if (code === 1) {
  779. this.$message({
  780. message: '提交成功!',
  781. type: 'success'
  782. })
  783. this.showDialog = false
  784. this.lightenShare()
  785. }
  786. }).finally(() => {
  787. this.loading = false
  788. })
  789. },
  790. // 截取url中的数据
  791. getQueryParam(paramName) {
  792. // 获取当前URL的查询字符串部分
  793. const queryString = window.location.search;
  794. // 创建一个URLSearchParams对象
  795. const urlParams = new URLSearchParams(queryString);
  796. // 返回指定参数的值,如果不存在则返回null
  797. return urlParams.get(paramName);
  798. },
  799. prevSlide() {
  800. if (this.currentIndex > 0) {
  801. this.currentIndex--
  802. this.getChunkData = this.getChunk(this.lightData.wxcpLightenClientList, this.currentIndex)
  803. }
  804. },
  805. nextSlide() {
  806. if (this.currentIndex >= this.lightData.wxcpLightenClientList.length - 1) {
  807. return
  808. }
  809. if (this.currentIndex < this.lightData.wxcpLightenClientList.length - 1) {
  810. this.currentIndex++
  811. this.getChunkData = this.getChunk(this.lightData.wxcpLightenClientList, this.currentIndex)
  812. }
  813. },
  814. getChunk(arr, chunkIndex) {
  815. const chunkSize = 5
  816. const start = chunkIndex * chunkSize
  817. const end = start + chunkSize
  818. return arr.slice(start, end)
  819. }
  820. }
  821. })
  822. </script>
  823. </html>