order.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  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=21">
  18. <link rel="stylesheet" href="/assets/index/css/order.css?t=10">
  19. </head>
  20. <body>
  21. <!-- 头部导航栏 -->
  22. <header class="headerContainer" id="headerContainer">
  23. <!-- 顶部提示 -->
  24. <div class="warnContainer">
  25. <h4 class="warnText">WARNING: This product contains nicotine. Nicotine is an addictive chemical.</h4>
  26. </div>
  27. <!-- pc端头部 -->
  28. <div id="computerEndHeader">
  29. <a href="/index/index/index.html">
  30. <h1 class="computerLogo">
  31. <img src="/assets/index/asstes/icon/logo.png" alt="Free Shipping Vapes" title="Free Shipping Vapes">
  32. </h1>
  33. </a>
  34. <div class="headIconContainer">
  35. <!-- 购物车 -->
  36. <a href="/index/cart/shoppingCart.html">
  37. <div class="headIconItem shoppingCartIcon">
  38. <img src="/assets/index/asstes/icon/shoppingCart.png" alt="shoppingCart" tabindex="shoppingCart">
  39. </div>
  40. </a>
  41. <!-- 收藏 -->
  42. <!-- <div class="headIconItem collectIcon">-->
  43. <!-- <img src="/assets/index/asstes/icon/collect.png" alt="collect" tabindex="collect">-->
  44. <!-- </div>-->
  45. <!-- 个人中心 -->
  46. <a href="/index/user/order.html">
  47. <div class="headIconItem userIcon">
  48. <img src="/assets/index/asstes/icon/user.png" alt="user" tabindex="user">
  49. </div>
  50. </a>
  51. </div>
  52. </div>
  53. <!-- 移动端头部 -->
  54. <div id="mobileEndHeader">
  55. <div class="mobileEndHeaderConten">
  56. <a href="/index/index/index.html">
  57. <h1 class="mobileLogo">
  58. <img src="/assets/index/asstes/icon/logo.png" alt="Free Shipping Vapes" title="Free Shipping Vapes">
  59. </h1>
  60. </a>
  61. <div class="mobileUserIconList">
  62. <div class="mobileUserIcon userIcon">
  63. <img src="/assets/index/asstes/icon/user.png" alt="user" tabindex="user">
  64. </div>
  65. </div>
  66. <div class="mobileMenu">
  67. <p id="mobileMenuBot">
  68. <span id="mobileMenuLink"></span>
  69. </p>
  70. </div>
  71. </div>
  72. <!-- 移动端菜单 -->
  73. <section class="mobileMenuFixed">
  74. <div class="mobileMenuItem">
  75. <a href="/index/index/index.html">
  76. <h2 class="menuItemTitle">NEW VAPES</h2>
  77. </a>
  78. </div>
  79. <!-- <div class="mobileMenuItem">
  80. <h2 class="menuItemTitle">DISPOSABLES</h2>
  81. </div>-->
  82. <div class="mobileMenuItem">
  83. <a href="/index/cart/shoppingCart.html">
  84. <h2 class="menuItemTitle shoppingCartIcon">Shopping Cart</h2>
  85. </a>
  86. </div>
  87. <!-- <div class="mobileMenuItem">-->
  88. <!-- <h2 class="menuItemTitle collectIcon">Collect</h2>-->
  89. <!-- </div>-->
  90. <div class="mobileMenuItem active">
  91. <a href="/index/user/order.html">
  92. <h2 class="menuItemTitle userIcon">Personal</h2>
  93. </a>
  94. </div>
  95. </section>
  96. </div>
  97. </header>
  98. <main id="main">
  99. <section class="pageContainer">
  100. <div class="pageMain">
  101. <!-- 页面菜单 -->
  102. <div class="navContainer" id="userNavContainer">
  103. <a href="/index/index/index.html">
  104. <nav class="navItem">
  105. <div class="navItemFlex">
  106. <img src="/assets/index/asstes/icon/hm.png" alt="">
  107. <h2 class="navTitle">Home</h2>
  108. </div>
  109. </nav>
  110. </a>
  111. <nav class="navItem">
  112. <div class="navItemFlex">
  113. <img src="/assets/index/asstes/icon/order.png" alt="">
  114. <h2 class="navTitle">My orders</h2>
  115. </div>
  116. <div class="sunNavBox">
  117. <a href="#">
  118. <nav class="sunNavItem orderNavItem" id="unpaid" data-type="payment">
  119. <h3 class="sunNavTitle">Unpaid</h3>
  120. </nav>
  121. </a>
  122. <a href="#">
  123. <nav class="sunNavItem orderNavItem" id="treat" data-type="delivery">
  124. <h3 class="sunNavTitle">To be shipped</h3>
  125. </nav>
  126. </a>
  127. <a href="#">
  128. <nav class="sunNavItem orderNavItem" data-type="received">
  129. <h3 class="sunNavTitle">Shipped</h3>
  130. </nav>
  131. </a>
  132. <a href="#">
  133. <nav class="sunNavItem orderNavItem" data-type="comment">
  134. <h3 class="sunNavTitle">Received</h3>
  135. </nav>
  136. </a>
  137. </div>
  138. </nav>
  139. <a href="/index/user/myScores.html">
  140. <nav class="navItem">
  141. <div class="navItemFlex">
  142. <img src="/assets/index/asstes/icon/jf.png" alt="">
  143. <h2 class="navTitle">My points</h2>
  144. </div>
  145. </nav>
  146. </a>
  147. </div>
  148. <div class="pageConten">
  149. <div class="orderContainer" id="orderContainer">
  150. <!-- <div class="orderItem">
  151. <h2 class="orderTitle">#某某电子烟</h2>
  152. <p class="orderTime">创建时间:2019-07-03 12:00:00</p>
  153. </div> -->
  154. </div>
  155. <div id="loadingIndicator">loading...</div>
  156. </div>
  157. </div>
  158. </section>
  159. </main>
  160. <!-- 底部 -->
  161. <footer class="footerContainer" id="footerContainer">
  162. <section class="sectionContainer">
  163. <div class="elementorContainer">
  164. <div class="footerConter">
  165. <div class="leftText">
  166. <p class="ltK">NEWALETTER</p>
  167. <p class="ltV">Sign up for the Free Shipping Vapes</p>
  168. </div>
  169. <div class="footerInuptBox">
  170. <img class="mailIcon" src="/assets/index/asstes/icon/mailIcon.png" alt="">
  171. <input class="footerInupt" type="text">
  172. <img class="arrowIcon" src="/assets/index/asstes/icon/arrowIcon.png" alt="">
  173. </div>
  174. <div class="footerIconContainer">
  175. <div class="footerIconList">
  176. <a href="#">
  177. <div class="footerIconItem">
  178. <img src="/assets/index/asstes/icon/whatsapp.png" alt="">
  179. </div>
  180. </a>
  181. <a href="#">
  182. <div class="footerIconItem">
  183. <img src="/assets/index/asstes/icon/facebook.png" alt="">
  184. </div>
  185. </a>
  186. <a href="#">
  187. <div class="footerIconItem">
  188. <img src="/assets/index/asstes/icon/instagram.png" alt="">
  189. </div>
  190. </a>
  191. </div>
  192. <div class="footerVlsaImg">
  193. <a href="#">
  194. <div class="footerVlsaItem">
  195. <img src="https://img2.baidu.com/it/u=1367821108,121397947&fm=253&fmt=auto&app=138&f=JPEG?w=1200&h=500"
  196. alt="">
  197. </div>
  198. </a>
  199. <a href="#">
  200. <div class="footerVlsaItem">
  201. <img src="https://img2.baidu.com/it/u=1367821108,121397947&fm=253&fmt=auto&app=138&f=JPEG?w=1200&h=500"
  202. alt="">
  203. </div>
  204. </a>
  205. <a href="#">
  206. <div class="footerVlsaItem">
  207. <img src="https://img2.baidu.com/it/u=1367821108,121397947&fm=253&fmt=auto&app=138&f=JPEG?w=1200&h=500"
  208. alt="">
  209. </div>
  210. </a>
  211. </div>
  212. </div>
  213. </div>
  214. </div>
  215. </section>
  216. <section class="sectionContainer warningContainer">
  217. <div class="elementorContainer">
  218. <div class="warningBox">
  219. <p class="warningText">WARNING: Our products contain nicotine, a poisonous and addictive substance.
  220. Our products are only intended for committed smokers of legal smoking age and not by
  221. non-smokers, children, women who are pregnant or may become pregnant or any person with an
  222. elevated risk of, or preexisting condition of, any medical condition which includes, but is not
  223. limited to, heart disease, diabetes, high blood pressure or asthma. If you experience any side
  224. effects or possible side effects, stop using the product immediately and consult a physician.
  225. Product may be poisonous if orally ingested. Our products are not smoking cessation products and
  226. have not been tested or guaranteed as such. Our products have not been evaluated by the Food and
  227. Drug Administration nor is it intended to treat, prevent or cure any disease or condition. For
  228. their protection, please keep out of reach of children and pets. Read our terms of use page
  229. before purchasing our products.</p>
  230. </div>
  231. </div>
  232. </section>
  233. </footer>
  234. <a href="/cn">Freeimages.com</a>的图片
  235. <!-- 年龄提示层 -->
  236. <section class="maskContainer">
  237. <div class="ageReminderBox">
  238. <img class="ageReminderBack"
  239. 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"
  240. alt="">
  241. <div class="ageReminderInfo">
  242. <h3>ARE YOU OF LEAAL SMOKIND AGE?</h3>
  243. <div class="ageReminderButBox">
  244. <div class="ageRBut ageReminderNo"><span>NO</span></div>
  245. <div class="ageRBut ageReminderYes"><span>Yes, I am 21+</span></div>
  246. </div>
  247. </div>
  248. </div>
  249. </section>
  250. </body>
  251. <script src="/assets/index/js/jquery-1.12.0.js"></script>
  252. <script src="/assets/index/js/flexible.js"></script>
  253. <script src="/assets/index/js/public.js?t=11"></script>
  254. <script src="/assets/index/js/swiper.js?t=6"></script>
  255. <script src="/assets/index/js/jquery.lazyload.js"></script>
  256. <script>
  257. $(document).ready(function () {
  258. //触屏事件 || 点击事件
  259. const tap = "ontouchstart" in window ? "touchstart" : "click";
  260. //页码
  261. let page = 1;
  262. //页数
  263. let itemsPerPage = 20;
  264. //加载中
  265. let isLoading = false;
  266. //订单类型
  267. let orderType = ""
  268. //初始化菜单选中状态
  269. function initNavState() {
  270. const url = window.location.href;
  271. const searchParams = new URLSearchParams(new URL(url).search);
  272. orderType = searchParams.get("orderType");
  273. // 初始加载第一页数据
  274. loadData(orderType);
  275. //订单中心菜单列表
  276. const orderNavItemList = $(".orderNavItem")
  277. //是否存在匹配项
  278. let exist = false
  279. if (orderNavItemList) {
  280. orderNavItemList.each(function (index, element) {
  281. const type = $(this).attr('data-type');
  282. if (type === orderType) {
  283. $(this).addClass("active")
  284. exist = true
  285. }
  286. })
  287. }
  288. //如果未匹配中默认选中待发货
  289. if (!exist) {
  290. $('#treat').addClass("active")
  291. }
  292. }
  293. // 加载数据函数
  294. function loadData(orderType) {
  295. if (isLoading) {
  296. return;
  297. }
  298. isLoading = true;
  299. // 显示加载指示器
  300. $('#loadingIndicator').show();
  301. //调试后记得去除这段代码
  302. if (!orderType) {
  303. orderType = "delivery"
  304. }
  305. $.ajax({
  306. url: '/index/order/list?dataType=' + orderType,
  307. type: 'GET',
  308. data: {
  309. page: page,
  310. per_page: itemsPerPage
  311. },
  312. success: function (response) {
  313. // 处理成功响应
  314. const data = response.data.list.data;
  315. console.log('.xxx', data)
  316. // 在页面中添加数据
  317. const container = $('#orderContainer');
  318. data.forEach(function (item) {
  319. console.log(item)
  320. container.append(`
  321. <div class="orderItem" data-id="${item.order_id}">
  322. <h2 class="orderTitle">${item.goods[0].goods_name}(${item.order_no})</h2>
  323. <p class="orderTime">Created at:${item.create_time}</p>
  324. </div> `);
  325. });
  326. // 更新当前页数
  327. page++;
  328. // 隐藏加载指示器
  329. $('#loadingIndicator').hide();
  330. isLoading = false;
  331. //事件委托给父级
  332. container.on(tap, '.orderItem', function () {
  333. const id = $(this).attr('data-id');
  334. window.location.href = `/index/user/orderDetails.html?orderId=${id}&orderType=${orderType}`
  335. });
  336. },
  337. error: function () {
  338. // 处理错误情况
  339. console.log('请求数据失败');
  340. // 隐藏加载指示器
  341. $('#loadingIndicator').hide();
  342. isLoading = false;
  343. }
  344. });
  345. }
  346. //菜单切换
  347. $(".orderNavItem").on(tap, function () {
  348. const type = $(this).attr('data-type');
  349. window.location.replace(`/index/user/order.html?orderType=${type}`)
  350. });
  351. //订单点击进入详情
  352. $(".orderItem").on(tap, function () {
  353. const id = $(this).attr('id');
  354. window.location.href = `/index/user/orderDetails.html?orderId=${id}&orderType=${orderType}`
  355. });
  356. // 监听页面滚动事件
  357. $(window).on('scroll', function () {
  358. const scrollBottom = $(window).height() + $(window).scrollTop();
  359. if (scrollBottom + 20 >= $(document).height()) {
  360. loadData();
  361. }
  362. });
  363. initNavState()
  364. })
  365. </script>
  366. </html>