shoppingCart.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  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>Proceed to Checkout</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. // const VAPES_TOKEN = "vapes_token"
  281. //
  282. // //未登录处理
  283. // function isLogin() {
  284. // //用户token
  285. // const vapesToken = localStorage.getItem("vapes_token")
  286. // if (!vapesToken || vapesToken === "") {
  287. // setTimeout(() => {
  288. // window.location.href = "./login.html?return=1"
  289. // }, 80)
  290. // }
  291. // return vapesToken && vapesToken !== "";
  292. // }
  293. //
  294. // isLogin();
  295. //支付方法
  296. const orderPayment = (params) => {
  297. console.log(params)
  298. //const vapesToken = localStorage.getItem("vapes_token");
  299. return new Promise(function (resolve, reject) {
  300. $.ajax({
  301. url: "/index/checkout/submit?payType=30&mode=cart&address_id=2",
  302. method: "POST",
  303. data: JSON.stringify(params),
  304. headers: {
  305. "Content-Type": "application/json",
  306. "storeId": "10001",
  307. "platform": "H5",
  308. // "Access-Token": vapesToken
  309. },
  310. dataType: "json",
  311. success: function (response) {
  312. resolve(response);
  313. },
  314. error: function (xhr, status, error) {
  315. reject(error);
  316. }
  317. });
  318. });
  319. }
  320. /**
  321. * 商品操作方法
  322. * @param _this $(this)
  323. * @param type 类型:add || reduce || delete
  324. * @returns
  325. */
  326. function productOperate(_this, type) {
  327. //商品id
  328. const productId = _this.closest(".productItem").attr("data-id");
  329. const goodsId = _this.closest(".productItem").attr("goods-id");
  330. const goodsSkuId = _this.closest(".productItem").attr("goods-sku-id");
  331. let goodsNum = parseInt(_this.closest(".productItem").attr("data-goods-num"));
  332. console.log(productId, goodsId, goodsSkuId)
  333. //商品增加
  334. if (type === "add" || type === "reduce") {
  335. if (type === "add") {
  336. goodsNum += 1
  337. } else {
  338. goodsNum -= 1
  339. }
  340. console.log("商品增加")
  341. $.ajax({
  342. url: "/index/cart/update?goodsId=" + goodsId + "&goodsSkuId=" + goodsSkuId + "&goodsNum=" + goodsNum,
  343. method: "POST",
  344. headers: {
  345. "Content-Type": "application/json",
  346. "storeId": "10001",
  347. "platform": "H5",
  348. "Accept": "*/*"
  349. // "Access-Token": vapesToken
  350. },
  351. dataType: "json",
  352. success: function (obj) {
  353. if (obj.status === 200 || obj.status === '200') {
  354. showToast("Successful")
  355. window.location.href = '../cart/shoppingCart';
  356. } else if (obj.status === 401 || obj.status === '401') {
  357. window.location.replace('../passport/logIn.html')
  358. } else {
  359. showToast(obj.message)
  360. }
  361. //window.location.replace( '/index/cart/shoppingCart.html')
  362. },
  363. error: function (xhr, status, error) {
  364. showToast("Please enter the quantity of products")
  365. //reject(error);
  366. }
  367. });
  368. return
  369. }
  370. //商品减少
  371. //商品删除
  372. if (type === "delete") {
  373. var params = {"cartIds": [productId]}
  374. console.log("商品删除")
  375. $.ajax({
  376. url: "/index/cart/clear",
  377. method: "POST",
  378. headers: {
  379. "Content-Type": "application/json",
  380. "storeId": "10001",
  381. "platform": "H5",
  382. // "Access-Token": vapesToken
  383. },
  384. data: JSON.stringify(params),
  385. dataType: "json",
  386. success: function (obj) {
  387. if (obj.status === 200 || obj.status === '200') {
  388. //showToast("Successful")
  389. window.location.href = '../cart/shoppingCart';
  390. } else if (obj.status === 401 || obj.status === '401') {
  391. window.location.replace('../passport/logIn.html')
  392. } else {
  393. showToast(obj.message)
  394. }
  395. return;
  396. resolve(response);
  397. window.location.href = "./shoppingCart.html"
  398. },
  399. error: function (xhr, status, error) {
  400. reject(error);
  401. }
  402. });
  403. return
  404. }
  405. }
  406. //支付
  407. $(".payPalButton").on(tap, async function () {
  408. console.log("paypaing")
  409. const params = {
  410. //"cartIds": "10002",
  411. "delivery": 10,
  412. "address_id": 2
  413. }
  414. console.log(params)
  415. const res = await orderPayment(params)
  416. console.log(res)
  417. const {status, message, data} = res || {}
  418. if (status === 200 || status === "200") {
  419. window.open(data.payment.approval_link, "_blank");
  420. } else if (status === 401 || status === "401") {
  421. window.location.replace('../passport/logIn.html')
  422. } else {
  423. showToast(message)
  424. }
  425. });
  426. //商品减少
  427. $(".numberReduce").on(tap, function () {
  428. productOperate($(this), "reduce")
  429. })
  430. //商品增加
  431. $(".numberAdd").on(tap, function () {
  432. productOperate($(this), "add")
  433. })
  434. //商品删除
  435. $(".productDelete").on(tap, function () {
  436. productOperate($(this), "delete")
  437. })
  438. //前往购物车
  439. $(".shoppingCartIcon").on(tap, function () {
  440. window.location.href = "./shoppingCart.html"
  441. // const state = isLogin()
  442. // if (state) {
  443. // }
  444. });
  445. })
  446. </script>
  447. </html>