order.html 14 KB

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