order.html 15 KB

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