buy.blade.php 18 KB

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