shoppingCart.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport"
  6. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  7. <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  8. <meta name='apple-touch-fullscreen' content='yes'>
  9. <meta name="apple-mobile-web-app-capable" content="yes"/>
  10. <meta content="fullscreen=yes,preventMove=no" name="ML-Config">
  11. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  12. <meta name="renderer" content="webkit">
  13. <meta name="apple-mobile-web-app-capable" content="yes"/>
  14. <meta name="keywords" content="电子烟,关键字"/>
  15. <meta name="Description" content="网站描述"/>
  16. <title>购物车</title>
  17. <link rel="stylesheet" href="/assets/index/css/common.css?t=18">
  18. <link rel="stylesheet" href="/assets/index/css/shoppingCart.css?t=5">
  19. </head>
  20. <body>
  21. <!-- 头部导航栏 -->
  22. <header class="headerContainer" id="headerContainer">
  23. <!-- 顶部提示 -->
  24. <div class="warnContainer">
  25. <h4 class="warnText">containscontainscontainsWARNING: This product contains nicotine. Nicotine is an addicti
  26. </h4>
  27. </div>
  28. <!-- pc端头部 -->
  29. <div id="computerEndHeader">
  30. <a href="/index/index/index.html">
  31. <h1 class="computerLogo">
  32. <img src="/assets/index/asstes/icon/logo.png" alt="Free Shipping Vapes" title="Free Shipping Vapes">
  33. </h1>
  34. </a>
  35. <div class="headNavContainer">
  36. <nav class="headNavItem active">
  37. <h2 class="headNavTitle">NEW VAPES</h2>
  38. <p class="back"></p>
  39. </nav>
  40. <nav class="headNavItem">
  41. <h2 class="headNavTitle">DISPOSABLES</h2>
  42. <p class="back"></p>
  43. </nav>
  44. </div>
  45. <div class="headIconContainer">
  46. <!-- 购物车 -->
  47. <a href="/index/cart/shoppingCart.html">
  48. <div class="headIconItem shoppingCartIcon">
  49. <img src="/assets/index/asstes/icon/shoppingCart.png" alt="shoppingCart" tabindex="shoppingCart">
  50. </div>
  51. </a>
  52. <!-- 收藏 -->
  53. <!-- <div class="headIconItem collectIcon">-->
  54. <!-- <img src="/assets/index/asstes/icon/collect.png" alt="collect" tabindex="collect">-->
  55. <!-- </div>-->
  56. <!-- 个人中心 -->
  57. <a href="/index/user/personal.html">
  58. <div class="headIconItem userIcon">
  59. <img src="/assets/index/asstes/icon/user.png" alt="user" tabindex="user">
  60. </div>
  61. </a>
  62. </div>
  63. </div>
  64. <!-- 移动端头部 -->
  65. <div id="mobileEndHeader">
  66. <div class="mobileEndHeaderConten">
  67. <a href="../index/index.html">
  68. <h1 class="mobileLogo">
  69. <img src="/assets/index/asstes/icon/logo.png" alt="Free Shipping Vapes" title="Free Shipping Vapes">
  70. </h1>
  71. </a>
  72. <div class="mobileUserIconList">
  73. <div class="mobileUserIcon userIcon">
  74. <img src="/assets/index/asstes/icon/user.png" alt="user" tabindex="user">
  75. </div>
  76. </div>
  77. <div class="mobileMenu">
  78. <p id="mobileMenuBot">
  79. <span id="mobileMenuLink"></span>
  80. </p>
  81. </div>
  82. </div>
  83. <!-- 移动端菜单 -->
  84. <section class="mobileMenuFixed">
  85. <div class="mobileMenuItem active">
  86. <a href="#">
  87. <h2 class="menuItemTitle">NEW VAPES</h2>
  88. </a>
  89. </div>
  90. <div class="mobileMenuItem">
  91. <a href="#">
  92. <h2 class="menuItemTitle">DISPOSABLES</h2>
  93. </a>
  94. </div>
  95. <div class="mobileMenuItem">
  96. <a href="/index/cart/shoppingCart.html">
  97. <h2 class="menuItemTitle shoppingCartIcon">Shopping Cart</h2>
  98. </a>
  99. </div>
  100. <!-- <div class="mobileMenuItem">
  101. <h2 class="menuItemTitle collectIcon">Collect</h2>
  102. </div>-->
  103. <div class="mobileMenuItem">
  104. <a href="/index/user/personal.html">
  105. <h2 class="menuItemTitle userIcon">Personal</h2>
  106. </a></div>
  107. </section>
  108. </div>
  109. </header>
  110. <main id="main">
  111. <section class="pageContainer">
  112. <h1 class="pageTitle">Shopping Cart</h1>
  113. <div class="pageDataBox">
  114. <!-- 商品模块 -->
  115. <section class="productConatiner">
  116. <h3 class="productModelTitle">Product</h3>
  117. <div class="productList">
  118. {foreach $list as $cart}
  119. <div class="productItem" data-id="{$cart['id']}" goods-id="{$cart['goods']['goods_id']}"
  120. goods-sku-id="{$cart['goods']['skuInfo']['goods_sku_id']}"
  121. data-goods-num="{$cart['goods_num']}">
  122. <div class="productImgBox">
  123. <img class="lazy" src="/assets/index/asstes/icon/transparent.png"
  124. data-original="{$cart['goods']['goods_image']}" alt="提示信息seo"
  125. title="提示信息seo">
  126. </div>
  127. <div class="productInfo">
  128. <div class="lfBox">
  129. <h2 class="productTitle">{$cart['goods']['goods_name']}</h2>
  130. <p class="specs">specs</p>
  131. </div>
  132. <div class="nunberBox">
  133. <p class="numberReduce">-</p>
  134. <p class="numberInput">{$cart['goods_num']}</p>
  135. <p class="numberAdd">+</p>
  136. </div>
  137. <p class="productPrice">${$cart['goods']['goods_price_min']}</p>
  138. <div class="productDelete">
  139. <img src="/assets/index/asstes/icon/productDelete.png" alt="">
  140. </div>
  141. </div>
  142. </div>
  143. {/foreach}
  144. </div>
  145. </section>
  146. <!-- 结算模块 -->
  147. <section class="windContainer">
  148. <div class="windTBox">
  149. <p class="lt">Add a coupon</p>
  150. <p class="cartTotals">CART TOTALS</p>
  151. </div>
  152. <div class="linkItem">
  153. <div class="windInfoBox">
  154. <p class="key">Subtotal</p>
  155. <p class="val">${$cartMoney}</p>
  156. </div>
  157. </div>
  158. <div class="mbItem">
  159. <div class="windInfoBox">
  160. <p class="key">Shipping</p>
  161. <p class="val">$0.00</p>
  162. </div>
  163. <div class="windInfoBox">
  164. <p class="key">Free shipping</p>
  165. </div>
  166. </div>
  167. <div class="mbItem">
  168. <div class="windInfoBox">
  169. <p class="key">Shipping to California, United States (us)</p>
  170. </div>
  171. <div class="windInfoBox">
  172. <p class="key changeAddress">Change address</p>
  173. </div>
  174. </div>
  175. <div class="totalBox">
  176. <p class="totalT">Total</p>
  177. <p class="totalVal">${$cartMoney}</p>
  178. </div>
  179. <div class="payPalButton">
  180. <span>PayPal</span>
  181. </div>
  182. <div class="orBox">
  183. <div class="link"></div>
  184. <p class="or">OR</p>
  185. <div class="link"></div>
  186. </div>
  187. <div class="checkoutButton">
  188. <span>Redemption using Points</span>
  189. </div>
  190. </section>
  191. </div>
  192. </section>
  193. </main>
  194. <!-- 底部 -->
  195. <footer class="footerContainer" id="footerContainer">
  196. <section class="sectionContainer">
  197. <div class="elementorContainer">
  198. <div class="footerConter">
  199. <div class="leftText">
  200. <p class="ltK">NEWALETTER</p>
  201. <p class="ltV">Sign up for the Vapesourcing newsletter</p>
  202. </div>
  203. <div class="footerInuptBox">
  204. <img class="mailIcon" src="/assets/index/asstes/icon/mailIcon.png" alt="">
  205. <input class="footerInupt" type="text">
  206. <img class="arrowIcon" src="/assets/index/asstes/icon/arrowIcon.png" alt="">
  207. </div>
  208. <div class="footerIconContainer">
  209. <div class="footerIconList">
  210. <a href="#">
  211. <div class="footerIconItem">
  212. <img src="https://i1.branchcn.com/social_media/Wechat.png" alt="">
  213. </div>
  214. </a>
  215. <a href="#">
  216. <div class="footerIconItem">
  217. <img src="https://i1.branchcn.com/social_media/Wechat.png" alt="">
  218. </div>
  219. </a>
  220. <a href="#">
  221. <div class="footerIconItem">
  222. <img src="https://i1.branchcn.com/social_media/Wechat.png" alt="">
  223. </div>
  224. </a>
  225. </div>
  226. <div class="footerVlsaImg">
  227. <a href="#">
  228. <div class="footerVlsaItem">
  229. <img src="https://img2.baidu.com/it/u=1367821108,121397947&fm=253&fmt=auto&app=138&f=JPEG?w=1200&h=500"
  230. alt="">
  231. </div>
  232. </a>
  233. <a href="#">
  234. <div class="footerVlsaItem">
  235. <img src="https://img2.baidu.com/it/u=1367821108,121397947&fm=253&fmt=auto&app=138&f=JPEG?w=1200&h=500"
  236. alt="">
  237. </div>
  238. </a>
  239. <a href="#">
  240. <div class="footerVlsaItem">
  241. <img src="https://img2.baidu.com/it/u=1367821108,121397947&fm=253&fmt=auto&app=138&f=JPEG?w=1200&h=500"
  242. alt="">
  243. </div>
  244. </a>
  245. </div>
  246. </div>
  247. </div>
  248. </div>
  249. </section>
  250. </footer>
  251. <!-- 年龄提示层 -->
  252. <section class="maskContainer">
  253. <div class="ageReminderBox">
  254. <img class="ageReminderBack"
  255. src="https://img1.baidu.com/it/u=3449617615,1431463931&fm=253&app=138&size=w931&n=0&f=JPEG&fmt=auto?sec=1709485200&t=489bafcac7c5bebed91cf50c14356269"
  256. alt="">
  257. <div class="ageReminderInfo">
  258. <h3>ARE YOU OF LEAAL SMOKIND AGE?</h3>
  259. <div class="ageReminderButBox">
  260. <div class="ageRBut ageReminderNo"><span>NO</span></div>
  261. <div class="ageRBut ageReminderYes"><span>Yes, I am 21+</span></div>
  262. </div>
  263. </div>
  264. </div>
  265. </section>
  266. <div id="toastContainer"></div>
  267. </body>
  268. <script src="/assets/index/js/jquery-1.12.0.js"></script>
  269. <script src="/assets/index/js/flexible.js"></script>
  270. <script src="/assets/index/js/public.js?t=11"></script>
  271. <script src="/assets/index/js/swiper.js?t=6"></script>
  272. <script src="/assets/index/js/jquery.lazyload.js"></script>
  273. <script>
  274. $(document).ready(function () {
  275. function showToast(message) {
  276. var toastElement = $('#toastContainer');
  277. toastElement.text(message);
  278. toastElement.stop(true, true).fadeIn(200).delay(2000).fadeOut(200);
  279. }
  280. //支付方法
  281. const orderPayment = (params) => {
  282. console.log(params)
  283. return new Promise(function (resolve, reject) {
  284. $.ajax({
  285. url: "/index/checkout/submit?payType=30&mode=cart&address_id=2",
  286. method: "POST",
  287. data: JSON.stringify(params),
  288. headers: {
  289. "Content-Type": "application/json",
  290. "storeId": "10001",
  291. "platform": "H5",
  292. // "Access-Token": vapesToken
  293. },
  294. dataType: "json",
  295. success: function (response) {
  296. resolve(response);
  297. },
  298. error: function (xhr, status, error) {
  299. reject(error);
  300. }
  301. });
  302. });
  303. }
  304. const orderPaymentPoints = (params) => {
  305. console.log(params)
  306. return new Promise(function (resolve, reject) {
  307. $.ajax({
  308. url: "/index/checkout/submit?payType=50&mode=cart&address_id=2",
  309. method: "POST",
  310. data: JSON.stringify(params),
  311. headers: {
  312. "Content-Type": "application/json",
  313. "storeId": "10001",
  314. "platform": "H5",
  315. // "Access-Token": vapesToken
  316. },
  317. dataType: "json",
  318. success: function (response) {
  319. resolve(response);
  320. },
  321. error: function (xhr, status, error) {
  322. reject(error);
  323. }
  324. });
  325. });
  326. }
  327. /**
  328. * 商品操作方法
  329. * @param _this $(this)
  330. * @param type 类型:add || reduce || delete
  331. * @returns
  332. */
  333. function productOperate(_this, type) {
  334. //商品id
  335. const productId = _this.closest(".productItem").attr("data-id");
  336. const goodsId = _this.closest(".productItem").attr("goods-id");
  337. const goodsSkuId = _this.closest(".productItem").attr("goods-sku-id");
  338. let goodsNum = parseInt(_this.closest(".productItem").attr("data-goods-num"));
  339. console.log(productId, goodsId, goodsSkuId)
  340. //商品增加
  341. if (type === "add" || type === "reduce") {
  342. if (type === "add") {
  343. goodsNum += 1
  344. } else {
  345. goodsNum -= 1
  346. }
  347. console.log("商品增加")
  348. $.ajax({
  349. url: "/index/cart/update?goodsId=" + goodsId + "&goodsSkuId=" + goodsSkuId + "&goodsNum=" + goodsNum,
  350. method: "POST",
  351. headers: {
  352. "Content-Type": "application/json",
  353. "storeId": "10001",
  354. "platform": "H5",
  355. "Accept": "*/*"
  356. // "Access-Token": vapesToken
  357. },
  358. dataType: "json",
  359. success: function (obj) {
  360. if (obj.status === 200 || obj.status === '200') {
  361. showToast("Successful")
  362. window.location.href = '../cart/shoppingCart';
  363. } else if (obj.status === 401 || obj.status === '401') {
  364. window.location.replace('../passport/logIn.html')
  365. } else {
  366. showToast(obj.message)
  367. }
  368. //window.location.replace( '/index/cart/shoppingCart.html')
  369. },
  370. error: function (xhr, status, error) {
  371. showToast("Please enter the quantity of products")
  372. //reject(error);
  373. }
  374. });
  375. return
  376. }
  377. //商品减少
  378. //商品删除
  379. if (type === "delete") {
  380. var params = {"cartIds": [productId]}
  381. console.log("商品删除")
  382. $.ajax({
  383. url: "/index/cart/clear",
  384. method: "POST",
  385. headers: {
  386. "Content-Type": "application/json",
  387. "storeId": "10001",
  388. "platform": "H5",
  389. // "Access-Token": vapesToken
  390. },
  391. data: JSON.stringify(params),
  392. dataType: "json",
  393. success: function (obj) {
  394. if (obj.status === 200 || obj.status === '200') {
  395. //showToast("Successful")
  396. window.location.href = '../cart/shoppingCart';
  397. } else if (obj.status === 401 || obj.status === '401') {
  398. window.location.replace('../passport/logIn.html')
  399. } else {
  400. showToast(obj.message)
  401. }
  402. return;
  403. resolve(response);
  404. window.location.href = "./shoppingCart.html"
  405. },
  406. error: function (xhr, status, error) {
  407. reject(error);
  408. }
  409. });
  410. return
  411. }
  412. }
  413. //支付
  414. $(".payPalButton").on(tap, async function () {
  415. console.log("paypaing")
  416. const params = {
  417. //"cartIds": "10002",
  418. "delivery": 10,
  419. "address_id": 2
  420. }
  421. console.log(params)
  422. const res = await orderPayment(params)
  423. console.log(res)
  424. const {status, message, data} = res || {}
  425. if (status === 200 || status === "200") {
  426. window.open(data.payment.approval_link, "_blank");
  427. } else if (status === 401 || status === "401") {
  428. window.location.replace('../passport/logIn.html')
  429. } else {
  430. showToast(message)
  431. }
  432. });
  433. //支付
  434. $(".checkoutButton").on(tap, async function () {
  435. console.log("points")
  436. const params = {
  437. "delivery": 10,
  438. "address_id": 2
  439. }
  440. console.log(params)
  441. const res = await orderPaymentPoints(params)
  442. console.log(res)
  443. const {status, message, data} = res || {}
  444. if (status === 200 || status === "200") {
  445. window.location.replace('/index/user/order.html')
  446. } else if (status === 401 || status === "401") {
  447. window.location.replace('../passport/logIn.html')
  448. } else {
  449. showToast(message)
  450. }
  451. });
  452. //商品减少
  453. $(".numberReduce").on(tap, function () {
  454. productOperate($(this), "reduce")
  455. })
  456. //商品增加
  457. $(".numberAdd").on(tap, function () {
  458. productOperate($(this), "add")
  459. })
  460. //商品删除
  461. $(".productDelete").on(tap, function () {
  462. productOperate($(this), "delete")
  463. })
  464. //前往购物车
  465. $(".shoppingCartIcon").on(tap, function () {
  466. window.location.href = "./shoppingCart.html"
  467. // const state = isLogin()
  468. // if (state) {
  469. // }
  470. });
  471. })
  472. </script>
  473. </html>