order.html 15 KB

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