buy.blade.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="keywords" content="{{ $keywords ?: '星优办公' }}">
  5. <meta name="description" content="{{ $description ?: '星优办公软件' }}">
  6. <title>{{ $title ?: '星优办公软件' }}</title>
  7. @include('home.http.common.head')
  8. <style>
  9. /* 会员中心 */
  10. .vip-model {
  11. display: flex;
  12. flex-wrap: nowrap;
  13. justify-content: flex-start;
  14. border: 2px solid #ddd;
  15. padding: 20px 0;
  16. margin-top: 20px;
  17. margin-bottom: 100px;
  18. }
  19. .v-left {
  20. width: 180px;
  21. border-right: 1px solid #ddd;
  22. text-align: center;
  23. }
  24. .v-left .v-name {
  25. font-size: 16px;
  26. font-weight: 600;
  27. margin-bottom: 10px;
  28. }
  29. .v-left .v-logo {
  30. width: 100px;
  31. height: 100px;
  32. border-radius: 100px;
  33. border: 1px solid #ddd;
  34. }
  35. .v-left .vip-interest {
  36. margin: 20px 0;
  37. line-height: 2.8;
  38. }
  39. .v-left .vip-title {
  40. font-size: 24px;
  41. font-weight: 600;
  42. color: #ed4014;
  43. }
  44. .v-right {
  45. flex: 1;
  46. padding-left: 16px;
  47. }
  48. .vip-list {
  49. display: flex;
  50. flex-wrap: nowrap;
  51. justify-content: space-between;
  52. }
  53. .vip-list .vip-item {
  54. width: 20%;
  55. border: 1px solid #ddd;
  56. border-radius: 10px;
  57. text-align: center;
  58. padding-bottom: 10px;
  59. cursor: pointer;
  60. margin-bottom: 12px;
  61. }
  62. .vip-list .active {
  63. border: 2px solid #e12424;
  64. }
  65. .vip-list .vip-name {
  66. font-size: 20px;
  67. line-height: 80px;
  68. background-color: #eee;
  69. border-top-left-radius: 10px;
  70. border-top-right-radius: 10px;
  71. border-bottom: 1px solid #ddd;
  72. }
  73. .vip-list .vip-price {
  74. font-size: 16px;
  75. color: #666;
  76. }
  77. .vip-list .vip-market-price {
  78. margin-left: 10px;
  79. text-decoration: line-through;
  80. }
  81. .vip-list .price-value {
  82. color: #e12424;
  83. font-size: 26px;
  84. font-weight: 600;
  85. margin-left: 3px;
  86. }
  87. .vip-list .vip-desc {
  88. color: #999;
  89. font-size: 12px;
  90. }
  91. .vip-list .vip-red {
  92. color: #e12424;
  93. font-weight: 600;
  94. }
  95. .vip-tips {
  96. color: #999;
  97. font-size: 14px;
  98. margin-bottom: 15px;
  99. }
  100. .pay-line,
  101. .pay-type {
  102. display: flex;
  103. flex-wrap: nowrap;
  104. justify-content: flex-start;
  105. line-height: 35px;
  106. }
  107. .pay-item {
  108. border: 1px solid #ddd;
  109. padding: 0 15px;
  110. border-radius: 5px;
  111. cursor: pointer;
  112. height: 35px;
  113. margin-right: 15px;
  114. }
  115. .pay-type .active {
  116. border: 1px solid #e12424;
  117. color: #e12424;
  118. }
  119. .pay-item .iconfont {
  120. margin-right: 5px;
  121. }
  122. .pay-item .icon-zhifubaozhifu {
  123. color: #027AFF;
  124. }
  125. .pay-item .icon-weixinzhifu {
  126. color: #62b900;
  127. }
  128. .pay-cont {
  129. padding: 10px 0;
  130. display: flex;
  131. flex-wrap: nowrap;
  132. justify-content: flex-start;
  133. }
  134. .pay-cont .pay-img {
  135. width: 200px;
  136. height: 200px;
  137. background-color: #eee;
  138. position: relative;
  139. }
  140. .pay-cont .pay-desc {
  141. padding: 20px;
  142. line-height: 3;
  143. font-size: 16px;
  144. }
  145. .pay-cont .iconfont {
  146. vertical-align: middle;
  147. font-size: 16px;
  148. margin: 0 5px 0 10px;
  149. }
  150. .iconfont {
  151. vertical-align: middle;
  152. }
  153. .dis-agreement {
  154. text-align: center;
  155. height: 240px;
  156. line-height: 240px;
  157. font-size: 18px;
  158. font-weight: 600;
  159. color: #ed4014;
  160. }
  161. .pay-agreement span {
  162. font-size: 12px;
  163. color: #999;
  164. margin: 0 !important;
  165. }
  166. .agreement-txt {
  167. cursor: pointer;
  168. }
  169. .agreement-txt:hover {
  170. color: #ed4014;
  171. }
  172. .money-color {
  173. color: #ed4014;
  174. font-size: 18px;
  175. font-weight: 600;
  176. }
  177. .vip-banner {
  178. background-color: #eee;
  179. height: 60px;
  180. width: 100%;
  181. margin-bottom: 15px;
  182. }
  183. .payment-top {
  184. position: relative;
  185. width: 100%;
  186. height: 60px;
  187. background: #FFB703;
  188. color: #333333;
  189. font-size: 20px;
  190. }
  191. .payment-top img {
  192. width: 40px;
  193. height: 40px;
  194. display: inline-block;
  195. margin-right: 10px;
  196. }
  197. </style>
  198. <script type="text/javascript" src="/static/js/qrcode.js"></script>
  199. <script type="text/javascript">
  200. {{-- let target = '{{ $target ?? '' }}'; --}}
  201. let token = '{{ $token ?? '' }}';
  202. let pay_type = "wechat";
  203. let sku_type = 4;
  204. let pmid = "{{ $productInfo->mid ?? '' }}";
  205. let isLogin = "{{ $isLogin ? 'true' : 'false' }}"
  206. function selectTerm(type, price) {
  207. sku_type = type;
  208. document.getElementById("payMoney").innerText = price
  209. // 其他的去除
  210. let vipItem1 = document.getElementById("vip_item1").getAttribute("class").replace("active", " ");
  211. document.getElementById("vip_item1").setAttribute("class", vipItem1);
  212. let vipItem2 = document.getElementById("vip_item2").getAttribute("class").replace("active", " ");
  213. document.getElementById("vip_item2").setAttribute("class", vipItem2);
  214. let vipItem3 = document.getElementById("vip_item3").getAttribute("class").replace("active", " ");
  215. document.getElementById("vip_item3").setAttribute("class", vipItem3);
  216. let vipItem4 = document.getElementById("vip_item4").getAttribute("class").replace("active", " ");
  217. document.getElementById("vip_item4").setAttribute("class", vipItem4);
  218. let classVal = document.getElementById("vip_item" + type).getAttribute("class");
  219. document.getElementById("vip_item" + type).setAttribute("class", classVal.concat(" active"))
  220. //创建支付二维码
  221. createPayCode();
  222. }
  223. function createPayCode() {
  224. if (isLogin === 'false') {
  225. showModal();
  226. return false;
  227. }
  228. document.getElementById('spinnerShowBuy').style.display = ""
  229. document.getElementById("qrcode").innerHTML = ""
  230. document.getElementById('qrcode').style.display = "none"
  231. let data = {
  232. type: sku_type,
  233. pay_type: pay_type
  234. }
  235. axios.post(target + '/api/pay/getPayCode/' + pmid, data, {
  236. headers: {
  237. Authorization: token
  238. }
  239. }).then(function(response) {
  240. if (!response.data.error) {
  241. let code = response.data.result;
  242. createQrcode(code);
  243. }
  244. }).catch(function(error) {
  245. console.log(error);
  246. });
  247. }
  248. // 设置支付类型
  249. function selectPaytype(type) {
  250. pay_type = type
  251. if (type === 'wechat') {
  252. let str = document.getElementById("payAlipay").getAttribute("class").replace("active", " ")
  253. document.getElementById("payAlipay").setAttribute("class", str);
  254. let classVal = document.getElementById("payWechat").getAttribute("class");
  255. document.getElementById("payWechat").setAttribute("class", classVal.concat(" active"))
  256. } else {
  257. let str = document.getElementById("payWechat").getAttribute("class").replace("active", " ");
  258. document.getElementById("payWechat").setAttribute("class", str);
  259. let classVal = document.getElementById("payAlipay").getAttribute("class");
  260. document.getElementById("payAlipay").setAttribute("class", classVal.concat(" active"))
  261. }
  262. //创建支付二维码
  263. createPayCode();
  264. }
  265. // 创建二维码
  266. function createQrcode(code) {
  267. document.getElementById('qrcode').style.display = ""
  268. document.getElementById('spinnerShowBuy').style.display = "none"
  269. new QRCode(document.getElementById("qrcode"), {
  270. text: "https://www.xingyousoft.com/soft/pay/" + code,
  271. width: 200,
  272. height: 200,
  273. correctLevel: 0 // 二维码结构复杂性 0~3
  274. });
  275. // 开始检测支付扫描
  276. startScan(code);
  277. }
  278. let payScanInterval;
  279. let payEndInterval;
  280. function startScan(code) {
  281. if (payScanInterval) {
  282. clearInterval(payScanInterval);
  283. }
  284. if (payEndInterval) {
  285. clearInterval(payEndInterval);
  286. }
  287. payScanInterval = setInterval(() => {
  288. axios.post(target + '/api/pay/checkPayScan/' + code, {}, {
  289. headers: {
  290. Authorization: token
  291. }
  292. }).then((response) => {
  293. if (!response.data.error) {
  294. // 提示消息,扫描成功
  295. // 开始检测支付
  296. clearInterval(payScanInterval);
  297. startCheckPayEnd(code);
  298. }
  299. }).catch(function(error) {
  300. console.log(error);
  301. });
  302. }, 1000);
  303. }
  304. // 开始检测支付
  305. function startCheckPayEnd(code) {
  306. if (payEndInterval) {
  307. clearInterval(payEndInterval);
  308. }
  309. payEndInterval = setInterval(() => {
  310. axios.post(target + '/api/pay/checkPayEnd/' + code, {
  311. product_type: 1
  312. }, {
  313. headers: {
  314. Authorization: token
  315. }
  316. }).then((response) => {
  317. if (!response.data.code === 0 || !response.data.error) {
  318. // 关闭定时器
  319. clearInterval(payEndInterval);
  320. alert("恭喜你,支付成功!");
  321. }
  322. }).catch(function(error) {
  323. console.log(error);
  324. });
  325. }, 1000);
  326. }
  327. </script>
  328. </head>
  329. <body>
  330. <div class="header">
  331. @include('home.http.common.header')
  332. </div>
  333. <div style="height: 68px;"></div>
  334. <div class="payment-top" style="display: flex;align-items: center;justify-content: center;">
  335. <img src="{{ $productInfo->logo ?? '' }}" alt="{{ $productInfo->title ?? '' }}">
  336. <span>{{ $productInfo->title ?? '' }} - 会员充值</span>
  337. </div>
  338. <div class="container vip-model">
  339. <div class="v-left">
  340. <img src="{{ isset($userInfo->avatar) && $userInfo->avatar ? $userInfo->avatar : '/static/logo/logo_small.png' }}"
  341. class="v-logo" />
  342. <p class="v-name">{{ $userInfo->username ?? '' }}</p>
  343. @if (isset($billInfo['validity_type']) && $billInfo['validity_type'] == 2)
  344. <p>会员: 永久有效</p>
  345. @elseif(isset($billInfo['validity_type']) && $billInfo['validity_type'] == 1)
  346. <p>会员有效期</p>
  347. <p>
  348. {{ $billInfo['validity_end_time'] }}
  349. </p>
  350. @else
  351. <p>会员: 无</p>
  352. @endif
  353. <div class="vip-interest">
  354. <p class="vip-title">会员专享</p>
  355. <p>1、会员特权</p>
  356. <p>2、批量转换</p>
  357. <p>3、专属客服</p>
  358. <p>4、次数不限</p>
  359. </div>
  360. </div>
  361. <div class="v-right">
  362. @if (isset($ad) && $ad->logo)
  363. <div class="vip-banner">
  364. <img src="{{ $ad->logo }}" style="width: 100%; height: 100%;" />
  365. </div>
  366. @endif
  367. <div class="vip-list">
  368. @if (isset($productInfo) && $productInfo->price4)
  369. <div id="vip_item4" class="vip-item active" onclick="selectTerm(4,{{ $productInfo->price4 }})">
  370. <div class="vip-name">永久</div>
  371. <div>
  372. <p class="vip-price">
  373. ¥<span class="price-value">{{ $productInfo->price4 }}</span>
  374. @if ($productInfo->market_price4)
  375. <span class="vip-market-price">{{ $productInfo->market_price4 }}</span>
  376. @endif
  377. </p>
  378. <p class="vip-desc vip-red">
  379. {{ $productInfo->desc_price4 ?: '超划算,热销中' }}
  380. </p>
  381. </div>
  382. </div>
  383. @endif
  384. @if (isset($productInfo) && $productInfo->price1)
  385. <div id="vip_item1" class="vip-item" onclick="selectTerm(1,{{ $productInfo->price1 }})">
  386. <div class="vip-name">一个月</div>
  387. <div>
  388. <p class="vip-price">
  389. ¥<span class="price-value">{{ $productInfo->price1 }}</span>
  390. @if ($productInfo->market_price1)
  391. <span class="vip-market-price">¥{{ $productInfo->market_price1 }}</span>
  392. @endif
  393. </p>
  394. <p class="vip-desc vip-red">
  395. {{ $productInfo->desc_price1 ?: '有效期一个月' }}
  396. </p>
  397. </div>
  398. </div>
  399. @endif
  400. @if (isset($productInfo) && $productInfo->price2)
  401. <div id="vip_item2" class="vip-item" onclick="selectTerm(2,{{ $productInfo->price2 }})">
  402. <div class="vip-name">半年</div>
  403. <div>
  404. <p class="vip-price">
  405. ¥<span class="price-value">{{ $productInfo->price2 }}</span>
  406. @if ($productInfo->market_price2)
  407. <span class="vip-market-price">¥{{ $productInfo->market_price2 }}</span>
  408. @endif
  409. </p>
  410. <p class="vip-desc">
  411. {{ $productInfo->desc_price2 ?: '有效期半年' }}
  412. </p>
  413. </div>
  414. </div>
  415. @endif
  416. @if (isset($productInfo) && $productInfo->price3)
  417. <div id="vip_item3" class="vip-item" onclick="selectTerm(3,{{ $productInfo->price3 }})">
  418. <div class="vip-name">一年</div>
  419. <div>
  420. <p class="vip-price">
  421. ¥<span class="price-value">{{ $productInfo->price3 }}</span>
  422. @if ($productInfo->market_price3)
  423. <span class="vip-market-price">¥{{ $productInfo->market_price3 }}</span>
  424. @endif
  425. </p>
  426. <p class="vip-desc">
  427. {{ $productInfo->desc_price3 ?: '有效期一年' }}
  428. </p>
  429. </div>
  430. </div>
  431. @endif
  432. </div>
  433. <p class="vip-tips">温馨提示:VIP会员到期后将直接转为非VIP会员</p>
  434. <p class="pay-line">
  435. 支付金额:<span id="payMoney" class="money-color">0</span>元
  436. </p>
  437. <div class="pay-line">
  438. <p>支付方式:</p>
  439. <div class="pay-type">
  440. <div id="payWechat" class="pay-item active" onclick="selectPaytype('wechat')">
  441. <span class="iconfont icon-weixinzhifu"></span>微信支付
  442. </div>
  443. <div id="payAlipay" class="pay-item" onclick="selectPaytype('alipay')">
  444. <span class="iconfont icon-zhifubaozhifu"></span>支付宝支付
  445. </div>
  446. </div>
  447. <div class="pay-agreement">
  448. <label>
  449. <input disabled type="checkbox" checked />
  450. </label>
  451. <span>同意并接受</span>
  452. <span class="agreement-txt" onclick="agreementModel = true">《软件会员增值服务协议》</span>
  453. </div>
  454. </div>
  455. <div class="pay-cont">
  456. <div class="spinner-border m-5 text-primary" role="status" style="display: block" id="spinnerShowBuy">
  457. <span class="visually-hidden">Loading...</span>
  458. </div>
  459. <div id="qrcode" class="pay-img" style="display: none"></div>
  460. <div class="pay-desc">
  461. <div>
  462. 1、<span class="iconfont icon-saoma1"></span> 请打开微信扫一扫
  463. </div>
  464. <div>
  465. 2、<span class="iconfont icon-erweima1"></span> 扫描左侧二维码
  466. </div>
  467. <div>
  468. 3、<span class="iconfont icon-wancheng1"></span> 请完成支付
  469. </div>
  470. </div>
  471. </div>
  472. <template>
  473. <div class="dis-agreement">请同意服务协议后方可购买产品</div>
  474. </template>
  475. </div>
  476. </div>
  477. @include('home.http.common.footer')
  478. <script>
  479. document.getElementById("payMoney").innerText = "{{ $productInfo->price4 ?? 0 }}"
  480. // 创建支付二维码
  481. createPayCode();
  482. </script>
  483. </body>
  484. </html>