index.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896
  1. <template>
  2. <div class="togetherNew" id="temp">
  3. <div class="bannerBox" @click="bannerClick">
  4. <!-- 底层banner -->
  5. <img class="banner" v-if="pageData.mainProduct.bannerPics[0] && indexNum >= 0" :class="
  6. productJson.length > 0 &&
  7. productJson[0].dongHua &&
  8. productJson[0].dongHua == '1'
  9. ? 'cartoon1'
  10. : ''
  11. " :src="imgUrl + pageData.mainProduct.bannerPics[0]" alt="" />
  12. <!-- json动图 -->
  13. <div class="svgBanner">
  14. <div id="lottie_box"></div>
  15. </div>
  16. <!-- 上层png -->
  17. <div class="banner2" :class="productJson[0].dongHua && productJson[0].dongHua == '1'? 'cartoon2': ''" v-if="pageData.mainProduct.bannerPics[2] && pageData.mainProduct.bannerPics[2] !== '' && indexNum >= 0">
  18. <img :src="imgUrl + pageData.mainProduct.bannerPics[2]" alt="" />
  19. </div>
  20. <!-- 顶层png/gif -->
  21. <div class="banner2" v-if="
  22. pageData.mainProduct.bannerPics[3] &&
  23. pageData.mainProduct.bannerPics[3] !== ''
  24. ">
  25. <img :src="imgUrl + pageData.mainProduct.bannerPics[3]" alt="" />
  26. </div>
  27. <img @click.stop class="activity" v-if="
  28. pageData.strategyInfo.activityType !== 0 &&
  29. pageData.strategyInfo.activityLogo
  30. " :src="`${pageData.strategyInfo.activityLogo}`" @click="onGoLink()" />
  31. <div class="extend" v-if="pageData.remarks.extendImg" @click="extendClick">
  32. <img :src="pageData.remarks.extendImg" alt="" />
  33. </div>
  34. <!-- <div class="extend" @click="extendClick">
  35. <img src="../assets/huiyuan.png" alt="" />
  36. </div> -->
  37. </div>
  38. <div v-if="newProduct.length>0">
  39. <div class="productBox">
  40. <div class="product" v-for="(item,index) in newProduct" :key="index" :style="clickCss === index? { 'border-color': item.themeColor[0] }: {}" @click="productClick(item.id, index)">
  41. <div v-if="index === 0">
  42. <div class="i" v-if="pageData.remarks.mainTagText && pageData.remarks.mainTagText!==''">{{pageData.remarks.mainTagText}}</div>
  43. </div>
  44. <div v-else-if="index===1">
  45. <div class="i" v-if="pageData.remarks.viceTagText && pageData.remarks.viceTagText!==''">{{pageData.remarks.viceTagText}}</div>
  46. </div>
  47. <p class="productName">{{item.productName }}</p>
  48. <div v-if="index === 0">
  49. <p class="productPrice">
  50. ¥{{ pageData.remarks.mainPrice && pageData.remarks.mainPrice!==''?pageData.remarks.mainPrice:item.originalPrice }}
  51. </p>
  52. <p class="productSale" v-if="pageData.remarks.mainPrice && pageData.remarks.mainPrice!==''">
  53. ¥{{ item.originalPrice }}
  54. </p>
  55. </div>
  56. <div v-else-if="index===1">
  57. <p class="productPrice">
  58. ¥{{ pageData.remarks.vicePrice && pageData.remarks.vicePrice!==''?pageData.remarks.vicePrice:item.originalPrice }}
  59. </p>
  60. <p class="productSale" v-if="pageData.remarks.vicePrice && pageData.remarks.vicePrice!==''">
  61. ¥{{ item.originalPrice }}
  62. </p>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. <!-- 统一认证组件 -->
  68. <tong-ren ref="refs" v-if="pageData.remarks.attestation === 0" @btnClick="btnClick" :pageData="pageData" :isBuy="isBuy" :indexNum="indexNum">
  69. </tong-ren>
  70. <!-- 短信认证组件 -->
  71. <duan-ren v-else-if="pageData.remarks.attestation === 1" @btnClick="toBuy" :pageData="pageData" :checked="checked" :isBuy="isBuy" :indexNum="indexNum">
  72. </duan-ren>
  73. <!-- 简单认证组件 -->
  74. <jian-ren v-else-if="pageData.remarks.attestation === 2" @btnClick="toNewBuy" :pageData="pageData" :checked="checked" :isBuy="isBuy" :indexNum="indexNum">
  75. </jian-ren>
  76. <!-- 统一认证组件---升级 -->
  77. <unify-modal v-if="
  78. pageData.remarks.attestation === 3 ||
  79. pageData.remarks.attestation === 4 ||
  80. pageData.remarks.attestation === 5
  81. " @btnClick="btnUnify" :pageData="pageData" :isBuy="isBuy" @hideClick="showConceal = true" @ruleClick="ruleClick" @toBuy="toBuy" @toNewBuy="toNewBuy" :indexNum="indexNum" ref="modal">
  82. </unify-modal>
  83. <div v-if="
  84. pageData.remarks.attestation !== 3 &&
  85. pageData.remarks.attestation !== 4 &&
  86. pageData.remarks.attestation !== 5
  87. ">
  88. <div class="privacyBox">
  89. <van-checkbox v-model="checked" checked-color="#fc8940">
  90. <p style="margin: 0; padding: 0">我已阅读并同意</p>
  91. </van-checkbox>
  92. <span class="span" style="color: #fc8940" @click="showConceal = true">《隐私声明》</span>
  93. <span class="span" style="color: #fc8940" @click="ruleClick">《产品说明》</span>
  94. </div>
  95. <div class="textText" :style="
  96. productJson.length > 0 && productJson[0].rushC.e !== ''
  97. ? { color: `${productJson[0].rushC.e}` }
  98. : { color: '#000' }
  99. ">
  100. <span :style="
  101. productJson && productJson[0].rushC.e !== ''
  102. ? { color: `${productJson[0].rushC.s}` }
  103. : { color: '#ea1313' }
  104. ">{{ times }}</span>
  105. {{
  106. pageData.remarks.orderText !== "" && pageData.remarks.orderText
  107. ? pageData.remarks.orderText
  108. : "用户已抢购成功"
  109. }}
  110. </div>
  111. <div class="tips">
  112. {{ pageData.remarks.privacyText }}
  113. </div>
  114. </div>
  115. <!-- 用户状态 -->
  116. <div v-if="user.userid" class="memBox">
  117. {{ String(user.phone) | formatPhone }}({{ isBuy }})
  118. </div>
  119. <!-- 说明 -->
  120. <div class="descbox">
  121. <div class="main" v-html="pageData.mainProduct.givePhoneInfo"></div>
  122. </div>
  123. <!-- 推荐产品 -->
  124. <div v-if="pageData.recommend.length > 0">
  125. <div v-for="(item, index) in pageData.recommend" :key="index" class="probox" @click="recommend(item.id)" :style="{
  126. backgroundImage: `url(${item.promotePhoto})`,
  127. }"></div>
  128. </div>
  129. <!-- 活动图 -->
  130. <div v-if="
  131. pageData.strategyInfo.posterPhoto &&
  132. pageData.strategyInfo.activityType !== 0
  133. " class="probox" @click="onGoLink()" :style="{
  134. backgroundImage: `url(${pageData.strategyInfo.posterPhoto})`,
  135. }"></div>
  136. <!-- tab导航 -->
  137. <div class="tabBox">
  138. <div class="tab" v-if="pageData.remarks.jiluBtn === '1'" @click="beforeLogin('manual')">
  139. <img src="../assets/record.png" alt="" />
  140. <div>订购记录</div>
  141. </div>
  142. <div class="tab" v-if="pageData.remarks.jihuoBtn === '1'" @click="jihuo('点击激活')">
  143. <img src="../assets/liuliang.png" alt="" />
  144. <div>流量激活</div>
  145. </div>
  146. <div class="tab" v-if="pageData.remarks.memberBtn === '1' " @click="beforeLogin('member')">
  147. <img src="../assets/huiyuan.png" alt="" />
  148. <div>领取会员</div>
  149. </div>
  150. <div class="tab" v-if="pageData.remarks.chaxunBtn === '1'&&isApplet == false" @click="chaxun">
  151. <img src="../assets/guanzhu.png" alt="" />
  152. <div>剩余流量查询</div>
  153. </div>
  154. <div class="tab" v-if="pageData.remarks.guanzhuBtn === '1'" @click="toPhone()">
  155. <img src="../assets/fankui.png" alt="" />
  156. <div>一键反馈</div>
  157. </div>
  158. <div class="tab" v-if="pageData.remarks.tuidingBtn === '1'" @click="beforeLogin('unBUy')">
  159. <img src="../assets/tuiding.png" alt="" />
  160. <div>退订产品</div>
  161. </div>
  162. </div>
  163. <!-- 使用说明 -->
  164. <div class="rule" @click="ruleClick">
  165. <div class="icon"></div>
  166. <div class="text">产品说明</div>
  167. </div>
  168. <rule-modal v-if="showRule" @ruleShow="ruleShow" :pageData="pageData"></rule-modal>
  169. <!-- 反馈 -->
  170. <div class="tucaoModal" @click="showTucao = true">
  171. <div class="icon"></div>
  172. <div class="text">反馈</div>
  173. </div>
  174. <!-- 隐私条款 -->
  175. <conceal v-model="showConceal" :pageData="pageData"></conceal>
  176. <vent-modal v-model="showTucao"></vent-modal>
  177. <!-- 登录弹框组件 -->
  178. <login-modal v-model="showLogin" :type="type" @getIsBuy="getIsBuy"></login-modal>
  179. <!-- 退订弹框组件 -->
  180. <unbuy-modal v-model="showUnbuy" :pageData="pageData" @childData="getChildData" @jihuo="jihuo" @memberClick="beforeLogin"></unbuy-modal>
  181. <!-- 剩余流量查询 -->
  182. <account-modal v-model="showQr"></account-modal>
  183. <!-- 订购超时 -->
  184. <timeout-modal v-model="showTimeout"></timeout-modal>
  185. <!-- 遮罩 -->
  186. <newZheZhao v-if="showZhezhao" isZheZhao="1" :indexNum="indexNum"></newZheZhao>
  187. <!-- 退订挽留 -->
  188. <van-overlay :show="unBuyDrainage" :duration="0.1" @click="unBuyDrainage = false">
  189. <div class="other-modal modal" @click.stop>
  190. <img src="../../assets/img/close.png" class="close" @click="unBuyDrainage = false" />
  191. <div class="text-box">确定要放弃本服务吗?</div>
  192. <div class="text-box">
  193. {{ unBuyDrainageText }}
  194. </div>
  195. <div class="text-box">不要错过!</div>
  196. <div class="btn-box">
  197. <div class="btn left" @click="unBuySure">确定</div>
  198. <div class="btn right" @click="recommend(pageData.strategyInfo.unsubscribeStrategyList[0])">
  199. 去看看
  200. </div>
  201. </div>
  202. </div>
  203. </van-overlay>
  204. <!-- 重复订购引流 -->
  205. <repeat-modal @repeat="recommend" v-model="repeatShow"></repeat-modal>
  206. <!-- 合约产品退订提示 -->
  207. <opOut v-model="opoutShow" @opoutClick="showUnbuy = true"></opOut>
  208. </div>
  209. </template>
  210. <script>
  211. import {
  212. orderList,
  213. changeUserid,
  214. strategyGetID,
  215. detMainProduct,
  216. strategytemplate,
  217. } from "../../api";
  218. import { Dialog } from "vant";
  219. import common from "../../common/common";
  220. import loginModal from "../../components/login.vue";
  221. import addR from "../../common/addRecord";
  222. import ruleModal from "../../components/ruleModal002.vue";
  223. import ventModal from "../../components/helpModal.vue";
  224. import accountModal from "../../components/gongZongHao.vue";
  225. import timeoutModal from "../../components/timeoutModal.vue";
  226. import newZheZhao from "../../components/newZheZhao.vue";
  227. import unbuyModal from "../../components/unbuyModal.vue";
  228. import MgtvApi from "@/util/mgTvJssdk.js";
  229. import conceal from "../../components/hideModal.vue";
  230. import repeatModal from "../../components/repeatModal.vue";
  231. import tongRen from "./components/tongRen.vue";
  232. import duanRen from "./components/duanRen.vue";
  233. import jianRen from "./components/jianRen.vue";
  234. import unifyModal from "../../components/unifyModal.vue";
  235. import opOut from "../../components/opOut.vue";
  236. import lottie from "lottie-web";
  237. export default {
  238. name: "baseNew",
  239. mixins: [common],
  240. data () {
  241. return {
  242. lottie: {},
  243. imgUrl: process.env.VUE_APP_IMGS_URL,
  244. times: 0,
  245. numberNum: 0,
  246. showLogin: false,
  247. showRule: false,
  248. showTucao: false,
  249. showQr: false,
  250. type: "",
  251. showUnbuy: false,
  252. showScroll: false,
  253. unBuyDrainage: false,
  254. unBuyDrainageText: "",
  255. newProduct: [],
  256. clickCss: 0,
  257. showConceal: false,
  258. checked: false,
  259. repeatShow: false,
  260. isBuy: "未订购",
  261. phone: "",
  262. opoutShow: false,
  263. productJson: [],
  264. };
  265. },
  266. components: {
  267. loginModal,
  268. ruleModal,
  269. ventModal,
  270. accountModal,
  271. timeoutModal,
  272. newZheZhao,
  273. unbuyModal,
  274. conceal,
  275. repeatModal,
  276. tongRen,
  277. duanRen,
  278. jianRen,
  279. unifyModal,
  280. opOut,
  281. },
  282. filters: {
  283. formatPhone: (phone) => {
  284. phone = phone.toString();
  285. return phone.substr(0, 3) + "****" + phone.substr(7, 11);
  286. },
  287. },
  288. created () {
  289. // document.title = this.pageData.mainProduct.productName;
  290. this.phone = this.$route.query.phone;
  291. this.pageData.mainProduct.isTreaty = 0;
  292. if (this.pageData.strategyInfo.viceProductStrategyList !== null && this.pageData.strategyInfo.viceProductStrategyList.length > 0) {
  293. this.productList();
  294. } else {
  295. this.newProduct.push(this.pageData.mainProduct);
  296. }
  297. if (this.pageData.remarks.privacy && this.pageData.remarks.privacy !== "" && this.pageData.remarks.privacy !== null) {
  298. if (this.pageData.remarks.privacy === "1") {
  299. this.checked = true;
  300. }
  301. }
  302. if (this.pageData.mainProduct.cacheSeatOne && this.pageData.mainProduct.cacheSeatOne !== null) {
  303. this.productJson = this.pageData.mainProduct.cacheSeatOne;
  304. }
  305. let start = this.pageData.remarks.orderNum && this.pageData.remarks.orderNum !== "" ? Number(this.pageData.remarks.orderNum) : 0;
  306. let add = this.pageData.remarks.orderAdd && this.pageData.remarks.orderAdd !== "" ? Number(this.pageData.remarks.orderAdd) : 1;
  307. let now = new Date().getTime();
  308. let times = (now - 1600476800000) / 180000;
  309. this.times = String(Math.ceil(times * add) + start);
  310. },
  311. mounted () {
  312. addR.showSP();
  313. this.callSvg();
  314. },
  315. methods: {
  316. // 一键拨号反馈
  317. toPhone () {
  318. addR.dialNumber()
  319. let phone = 4000600611;
  320. window.location.href = "tel://" + phone;
  321. },
  322. extendClick () {
  323. if (this.pageData.remarks.extendVal && this.pageData.remarks.extendVal === "1") {
  324. if (this.isBuy === "未订购") {
  325. Dialog({
  326. message: "您还未订购成功,请继续通过此页面订购,即可领取会员;",
  327. theme: "round-button",
  328. });
  329. } else if (this.isBuy === "已订购") {
  330. Dialog({
  331. message:
  332. " 您已订购成功,请留意订购成功短信,点击其中链接领取会员;",
  333. theme: "round-button",
  334. });
  335. } else if (this.isBuy === "已退订") {
  336. Dialog({
  337. message: "您已退订",
  338. theme: "round-button",
  339. });
  340. }
  341. }
  342. },
  343. btnUnify (phone) {
  344. this.phone = phone;
  345. this.openIframe();
  346. },
  347. btnClick () {
  348. if (this.checked === false) {
  349. this.$toast.fail("请先勾选隐私声明");
  350. } else {
  351. this.openIframe();
  352. }
  353. },
  354. ruleShow () {
  355. this.showRule = false;
  356. },
  357. async productClick (val, index) {
  358. this.indexNum = -1;
  359. this.clickCss = index;
  360. this.pageData.mainProduct.isTreaty = index;
  361. setTimeout(() => {
  362. this.indexNum = index;
  363. }, 1);
  364. if (index === 0) {
  365. let start = this.pageData.remarks.orderNum && this.pageData.remarks.orderNum !== "" ? Number(this.pageData.remarks.orderNum) : 0;
  366. let add = this.pageData.remarks.orderAdd && this.pageData.remarks.orderAdd !== "" ? Number(this.pageData.remarks.orderAdd) : 1;
  367. let now = new Date().getTime();
  368. let times = (now - 1600476800000) / 180000;
  369. if (this.pageData.remarks.attestation === 3 || this.pageData.remarks.attestation === 4 || this.pageData.remarks.attestation === 5) {
  370. this.$refs.modal.times = String(Math.ceil(times * add) + start);
  371. }
  372. this.times = String(Math.ceil(times * add) + start);
  373. } else if (index === 1) {
  374. let start = this.pageData.remarks.orderNum && this.pageData.remarks.orderNum !== "" ? Number(this.pageData.remarks.orderNum) : 0;
  375. let add = this.pageData.remarks.orderAdd && this.pageData.remarks.orderAdd !== "" ? Number(this.pageData.remarks.orderAdd) : 1;
  376. let now = new Date().getTime();
  377. let times = (now - 1600476800000) / 200000;
  378. if (this.pageData.remarks.attestation === 3 || this.pageData.remarks.attestation === 4 || this.pageData.remarks.attestation === 5) {
  379. this.$refs.modal.times = String(Math.ceil(times * add) + start);
  380. }
  381. this.times = String(Math.ceil(times * add) + start);
  382. }
  383. if (this.pageData.channl.edition && this.pageData.channl.edition === 1) {
  384. let info = await detMainProduct({ productId: val });
  385. let viceProduct = this.pageData.viceJson;
  386. let mainJson = this.pageData.mainJson;
  387. if (index === 1) {
  388. let mainProduct = {
  389. activeType: info.data.activeType,
  390. bannerPics: [
  391. viceProduct.bannerImg,
  392. viceProduct.jsonImg,
  393. viceProduct.upImg,
  394. viceProduct.topImg,
  395. ],
  396. bgColor: [
  397. viceProduct.pageBgcol,
  398. "",
  399. viceProduct.orderBgcol,
  400. viceProduct.orderBdcol,
  401. ],
  402. cacheSeatOne: [
  403. {
  404. dongHua: viceProduct.drawVal,
  405. memberUrl: info.data.cacheSeatOne[0].memberUrl,
  406. proC: {
  407. e: viceProduct.hideCol,
  408. s: viceProduct.pageTextcol,
  409. },
  410. productV: viceProduct.productV,
  411. rushC: {
  412. e: viceProduct.orderTextcol,
  413. s: viceProduct.orderNumcol,
  414. },
  415. tabC: {
  416. e: viceProduct.tabVicecol,
  417. s: viceProduct.tabMaincol,
  418. },
  419. btnUrl: "",
  420. },
  421. ],
  422. cpid: info.data.cpid,
  423. discountInfo: null,
  424. flowJumpUrl: info.data.flowJumpUrl,
  425. givePhoneInfo: info.data.givePhoneInfo,
  426. guidancePic: {
  427. c: viceProduct.orderImg,
  428. p: viceProduct.explainImg,
  429. },
  430. id: info.data.id,
  431. isCompositeProduct: info.data.isCompositeProduct, //是否复合产品
  432. logoPic: mainJson.logoPic,
  433. manualInfo: info.data.manualInfo,
  434. memberName: info.data.memberName,
  435. orderingInfo: info.data.orderingInfo,
  436. originalPrice: info.data.originalPrice,
  437. pageTitle: mainJson.pageTitle,
  438. productName: info.data.productName,
  439. productType: info.data.productType,
  440. promotionPic: info.data.promotionPic,
  441. pushJumpUrl: info.data.pushJumpUrl,
  442. remark: info.data.remark,
  443. remark1: info.data.remark1,
  444. remark2: info.data.remark2,
  445. remark3: mainJson.remark3,
  446. spid: info.data.spid,
  447. themeColor: [viceProduct.btnTopcol, viceProduct.btnBotcol],
  448. };
  449. this.productJson = mainProduct.cacheSeatOne;
  450. this.pageData.mainProduct = mainProduct;
  451. } else if (index === 0) {
  452. let mainProduct = {
  453. activeType: info.data.activeType,
  454. bannerPics: [
  455. mainJson.bannerImg,
  456. mainJson.jsonImg,
  457. mainJson.upImg,
  458. mainJson.topImg,
  459. ],
  460. bgColor: [
  461. mainJson.pageBgcol,
  462. "",
  463. mainJson.orderBgcol,
  464. mainJson.orderBdcol,
  465. ],
  466. cacheSeatOne: [
  467. {
  468. dongHua: mainJson.drawVal,
  469. memberUrl: info.data.cacheSeatOne[0].memberUrl,
  470. proC: {
  471. e: mainJson.hideCol,
  472. s: mainJson.pageTextcol,
  473. },
  474. productV: mainJson.productV,
  475. rushC: {
  476. e: mainJson.orderTextcol,
  477. s: mainJson.orderNumcol,
  478. },
  479. tabC: {
  480. e: mainJson.tabVicecol,
  481. s: mainJson.tabMaincol,
  482. },
  483. btnUrl: "",
  484. },
  485. ],
  486. cpid: info.data.cpid,
  487. discountInfo: null,
  488. flowJumpUrl: info.data.flowJumpUrl,
  489. givePhoneInfo: info.data.givePhoneInfo,
  490. guidancePic: {
  491. c: mainJson.orderImg,
  492. p: mainJson.explainImg,
  493. },
  494. id: info.data.id,
  495. isCompositeProduct: 0, //是否复合产品
  496. logoPic: mainJson.logoPic,
  497. manualInfo: info.data.manualInfo,
  498. memberName: info.data.memberName,
  499. orderingInfo: info.data.orderingInfo,
  500. originalPrice: info.data.originalPrice,
  501. pageTitle: mainJson.pageTitle,
  502. productName: info.data.productName,
  503. productType: info.data.productType,
  504. promotionPic: info.data.promotionPic,
  505. pushJumpUrl: info.data.pushJumpUrl,
  506. remark: info.data.remark,
  507. remark1: info.data.remark1,
  508. remark2: info.data.remark2,
  509. remark3: mainJson.remark3,
  510. spid: info.data.spid,
  511. themeColor: [mainJson.btnTopcol, mainJson.btnBotcol],
  512. };
  513. this.productJson = mainProduct.cacheSeatOne;
  514. this.pageData.mainProduct = mainProduct;
  515. }
  516. this.param.cpid = info.data.cpid;
  517. this.param.spid = info.data.spid;
  518. let title = this.pageData.mainProduct.productName
  519. document.title = title;
  520. MgtvApi.setWebviewTitle({
  521. title: title,
  522. });
  523. this.getIsBuy()
  524. this.$store.commit("setPageData", this.pageData);
  525. } else {
  526. detMainProduct({
  527. productId: val,
  528. }).then(async (res) => {
  529. if (res.data.cacheSeatOne && res.data.cacheSeatOne !== null) {
  530. this.productJson = res.data.cacheSeatOne;
  531. }
  532. this.pageData.mainProduct = res.data;
  533. this.param.cpid = res.data.cpid;
  534. this.param.spid = res.data.spid;
  535. document.title = res.data.remark;
  536. this.$store.commit("setPageData", this.pageData);
  537. this.getIsBuy()
  538. });
  539. }
  540. this.callSvg();
  541. },
  542. result (a, b) {
  543. return (Number(a) - Number(b)).toFixed(2);
  544. },
  545. ruleClick () {
  546. this.showRule = true;
  547. localStorage.setItem("startTime", new Date().getTime());
  548. },
  549. bannerClick () {
  550. addR.clickBanner();
  551. },
  552. chaxun () {
  553. addR.clickFollow();
  554. this.showQr = true;
  555. },
  556. async beforeLogin (type) {
  557. this.type = type;
  558. if (this.user.userid) {
  559. if (type === "manual" || type === "member") {
  560. this.toLink(type);
  561. } else if (type === "unBUy") {
  562. addR.unBuyClick();
  563. if (
  564. this.pageData.strategyInfo.unsubscribeStrategyList !== null &&
  565. this.pageData.strategyInfo.unsubscribeStrategyList.length > 0
  566. ) {
  567. if (
  568. this.pageData.channl.edition &&
  569. this.pageData.channl.edition === 1
  570. ) {
  571. let productId = await strategytemplate(
  572. this.pageData.strategyInfo.unsubscribeStrategyList[0]
  573. );
  574. let drainageRes = await detMainProduct({
  575. productId: productId.data.primaryProductId,
  576. });
  577. this.unBuyDrainageText = drainageRes.data.productName;
  578. } else {
  579. let productId = await strategyGetID({
  580. id: this.pageData.strategyInfo.unsubscribeStrategyList[0],
  581. });
  582. let drainageRes = await detMainProduct({
  583. productId: productId.data.primaryProductId,
  584. });
  585. this.unBuyDrainageText = drainageRes.data.productName;
  586. }
  587. this.unBuyDrainage = true;
  588. } else {
  589. if (
  590. this.pageData.remarks.treaty &&
  591. this.pageData.remarks.treaty === "1"
  592. ) {
  593. this.opoutShow = true;
  594. } else {
  595. this.showUnbuy = true;
  596. }
  597. }
  598. }
  599. } else if (type === "unBUy") {
  600. addR.unBuyClick();
  601. if (
  602. this.pageData.strategyInfo.unsubscribeStrategyList !== null &&
  603. this.pageData.strategyInfo.unsubscribeStrategyList.length > 0
  604. ) {
  605. if (
  606. this.pageData.channl.edition &&
  607. this.pageData.channl.edition === 1
  608. ) {
  609. let productId = await strategytemplate(
  610. this.pageData.strategyInfo.unsubscribeStrategyList[0]
  611. );
  612. let drainageRes = await detMainProduct({
  613. productId: productId.data.primaryProductId,
  614. });
  615. this.unBuyDrainageText = drainageRes.data.productName;
  616. } else {
  617. let productId = await strategyGetID({
  618. id: this.pageData.strategyInfo.unsubscribeStrategyList[0],
  619. });
  620. let drainageRes = await detMainProduct({
  621. productId: productId.data.primaryProductId,
  622. });
  623. this.unBuyDrainageText = drainageRes.data.productName;
  624. }
  625. this.unBuyDrainage = true;
  626. } else {
  627. if (
  628. this.pageData.remarks.treaty &&
  629. this.pageData.remarks.treaty === "1"
  630. ) {
  631. this.opoutShow = true;
  632. } else {
  633. this.showUnbuy = true;
  634. }
  635. }
  636. } else {
  637. addR.loginClick();
  638. this.showLogin = true;
  639. }
  640. },
  641. // toLink (type) {
  642. // let cpid = this.$store.state.pageData.mainProduct.cpid;
  643. // let spid = this.$store.state.pageData.mainProduct.spid;
  644. // let isCompositeProduct =
  645. // this.$store.state.pageData.mainProduct.isCompositeProduct;
  646. // let activeType = this.$store.state.pageData.mainProduct.activeType;
  647. // let url;
  648. // if (type === "manual") {
  649. // addR.clickOrderRecord();
  650. // url = "/order001";
  651. // } else if (type === "member") {
  652. // addR.memberClick();
  653. // if (
  654. // this.productJson[0].memberUrl &&
  655. // this.productJson.length > 0 &&
  656. // this.pageData.mainProduct.cacheSeatOne[0].memberUrl !== ""
  657. // ) {
  658. // window.location.href = this.productJson[0].memberUrl;
  659. // return false;
  660. // } else {
  661. // if (this.pageData.mainProduct.isCompositeProduct === 2) {
  662. // url = "/member002";
  663. // } else {
  664. // url = "/member001";
  665. // }
  666. // }
  667. // }
  668. // this.$router.push({
  669. // path: url,
  670. // query: {
  671. // cpid: cpid,
  672. // spid: spid,
  673. // isCompositeProduct: isCompositeProduct,
  674. // activeType: activeType,
  675. // },
  676. // });
  677. // },
  678. // 推荐产品跳转
  679. recommend (val) {
  680. // this.$store.commit("setTempName", "loading");
  681. let edition = this.$store.state.pageData.channl.edition;
  682. if (edition && edition === 1) {
  683. strategytemplate(val).then(async (res) => {
  684. let info = await detMainProduct({
  685. productId: res.data.primaryProductId,
  686. });
  687. let productJson = JSON.parse(res.data.productJson).product;
  688. let mainProduct = {
  689. activeType: info.data.activeType,
  690. bannerPics: [
  691. productJson.bannerImg,
  692. productJson.jsonImg,
  693. productJson.upImg,
  694. productJson.topImg,
  695. ],
  696. bgColor: [
  697. productJson.pageBgcol,
  698. "",
  699. productJson.orderBgcol,
  700. productJson.orderBdcol,
  701. ],
  702. cacheSeatOne: [
  703. {
  704. dongHua: productJson.drawVal,
  705. memberUrl: info.data.cacheSeatOne[0].memberUrl,
  706. proC: {
  707. e: productJson.hideCol,
  708. s: productJson.pageTextcol,
  709. },
  710. productV: productJson.productV,
  711. rushC: {
  712. e: productJson.orderTextcol,
  713. s: productJson.orderNumcol,
  714. },
  715. tabC: {
  716. e: productJson.tabVicecol,
  717. s: productJson.tabMaincol,
  718. },
  719. btnUrl: "",
  720. },
  721. ],
  722. cpid: info.data.cpid,
  723. discountInfo: null,
  724. flowJumpUrl: info.data.flowJumpUrl,
  725. givePhoneInfo: info.data.givePhoneInfo,
  726. guidancePic: {
  727. c: productJson.orderImg,
  728. p: productJson.explainImg,
  729. },
  730. id: res.data.primaryProductId,
  731. isCompositeProduct: 0, //是否复合产品
  732. logoPic: productJson.logoPic,
  733. manualInfo: info.data.manualInfo,
  734. memberName: info.data.memberName,
  735. orderingInfo: info.data.orderingInfo,
  736. originalPrice: info.data.originalPrice,
  737. pageTitle: productJson.pageTitle,
  738. productName: info.data.productName,
  739. productType: info.data.productType,
  740. promotionPic: info.data.promotionPic,
  741. pushJumpUrl: info.data.pushJumpUrl,
  742. remark: info.data.remark,
  743. remark1: info.data.remark1,
  744. remark2: info.data.remark2,
  745. remark3: productJson.remark3,
  746. spid: info.data.spid,
  747. themeColor: [productJson.btnTopcol, productJson.btnBotcol],
  748. };
  749. let recommend = [];
  750. if (
  751. res.data.recommendStrategyIds.length > 0 &&
  752. res.data.recommendStrategyIds
  753. ) {
  754. res.data.recommendStrategyIds.forEach(async (val) => {
  755. let list = await strategytemplate(val);
  756. recommend.push(list.data);
  757. });
  758. }
  759. let pageData = {
  760. mainProduct: mainProduct,
  761. channl: {
  762. channelKey: this.pageData.channl.channelKey,
  763. channelName: this.pageData.channl.channelName,
  764. fullCode: this.pageData.channl.fullCode,
  765. edition: this.pageData.channl.edition,
  766. },
  767. recommend: recommend,
  768. remarks: JSON.parse(res.data.extJson), //策略信息
  769. // viceJson: JSON.parse(res.data.viceJson), //副产品json
  770. otherJson: JSON.parse(res.data.otherJson), //备用json
  771. strategyInfo: res.data,
  772. };
  773. pageData.strategyInfo.recommendStrategyList =
  774. res.data.recommendStrategyIds;
  775. pageData.strategyInfo.unsubscribeStrategyList =
  776. res.data.unsubscribeStrategyIds;
  777. pageData.strategyInfo.viceProductStrategyList =
  778. res.data.viceProductIds;
  779. if (JSON.parse(res.data.productJson).viceProduct) {
  780. pageData.viceJson = JSON.parse(res.data.productJson).viceProduct;
  781. }
  782. let title = mainProduct.pageTitle !== '' ? mainProduct.pageTitle : mainProduct.productName
  783. document.title = title;
  784. MgtvApi.setWebviewTitle({
  785. title: title,
  786. });
  787. pageData.mainJson = JSON.parse(res.data.productJson).product;
  788. this.$store.commit("setPageData", pageData);
  789. this.getIsBuy()
  790. setTimeout(() => {
  791. this.callSvg()
  792. }, 200)
  793. this.$store.commit("setTempName", res.data.templateCode);
  794. });
  795. } else {
  796. strategyGetID({ id: val }).then(async (res) => {
  797. if (res.data.strategyStatus === 1) {
  798. let data = res.data;
  799. let info = await detMainProduct({
  800. productId: data.primaryProductId,
  801. });
  802. let recommend = [];
  803. if (
  804. data.recommendStrategyList !== null &&
  805. data.recommendStrategyList.length > 0
  806. ) {
  807. for (let i = 0; i < data.recommendStrategyList.length; i++) {
  808. let list = await strategyGetID({
  809. id: data.recommendStrategyList[i],
  810. });
  811. recommend.push(list.data);
  812. }
  813. }
  814. let pageData = {
  815. mainProduct: info.data,
  816. strategyInfo: data,
  817. remarks: data.extJson,
  818. channl: {
  819. channelKey: localStorage.getItem("key"),
  820. },
  821. recommend: recommend,
  822. };
  823. MgtvApi.setWebviewTitle({
  824. title: pageData.mainProduct.productName,
  825. });
  826. document.title = pageData.mainProduct.productName;
  827. this.$store.commit("setPageData", pageData);
  828. this.getIsBuy()
  829. setTimeout(() => {
  830. this.callSvg()
  831. }, 200)
  832. this.$store.commit("setTempName", data.templateCode);
  833. } else {
  834. this.$toast.fail("当前策略未生效");
  835. }
  836. });
  837. }
  838. this.unBuyDrainage = false;
  839. },
  840. // 点击确定
  841. unBuySure () {
  842. addR.clickUnsubscribe();
  843. this.unBuyDrainage = false;
  844. if (
  845. this.pageData.remarks.treaty &&
  846. this.pageData.remarks.treaty === "1"
  847. ) {
  848. this.opoutShow = true;
  849. } else {
  850. this.showUnbuy = true;
  851. }
  852. },
  853. getChildData (data) {
  854. this.isBuy = data;
  855. },
  856. async productList () {
  857. this.newProduct.push(this.pageData.mainProduct);
  858. let list = this.pageData.strategyInfo.viceProductStrategyList;
  859. for (let i = 0; i < list.length; i++) {
  860. let res = await detMainProduct({
  861. productId: list[i],
  862. });
  863. this.newProduct.push(res.data);
  864. }
  865. },
  866. // 调用svg动画
  867. callSvg () {
  868. let lottieBox = document.getElementById("lottie_box");
  869. lottieBox.innerHTML = "";
  870. setTimeout(() => {
  871. if (
  872. this.pageData.mainProduct.bannerPics[1] &&
  873. this.pageData.mainProduct.bannerPics[1] !== ""
  874. ) {
  875. this.lottie = lottie.loadAnimation({
  876. container: lottieBox,
  877. renderer: "svg",
  878. loop: true,
  879. autoplay: true,
  880. path: this.imgUrl + this.pageData.mainProduct.bannerPics[1],
  881. });
  882. }
  883. }, 200);
  884. },
  885. },
  886. };
  887. </script>
  888. <style lang="scss">
  889. @import "./index.scss";
  890. </style>