index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. <template>
  2. <view class="flex-common-css iPhone-bottom box-border-box">
  3. <Nav :leftShow='false' :customNav='true' bgckgroundBox='#fff'>
  4. <template>
  5. <view slot="custom" class="text-align-center fw-600">
  6. 我的订单
  7. </view>
  8. </template>
  9. </Nav>
  10. <view class="nav-box box-border-box bgc-f display-flex">
  11. <view class="nav-item" :class="type == item.id?'fs-36 fw-600':'fs-34 fw-400'" v-for="(item,i) in navList"
  12. :key="i" @click="selectType(item.id)">
  13. {{item.name}}
  14. <view v-if="type == item.id" class="nav-item-x"></view>
  15. </view>
  16. </view>
  17. <scroll-view class="nav-type-box bgc-f p-12-24 box-border-box" :scroll-x="true">
  18. <view class="nav-type-item text-align-center fs-28" v-for="(item,index) in navTypeData"
  19. @click="navTypeClick(item.key)"
  20. :class="navTypeKey== item.key?'bgc-E4F3FD fw-600 fc-41ABF5':'bgc-F4F5F7 fw-400 fc-3'">
  21. {{item.name}}
  22. </view>
  23. </scroll-view>
  24. <view v-if="list.length == 0" class="scroll-view-css">
  25. <EnBlank :customSrc='true'>
  26. <template v-slot:blankImg>
  27. <image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
  28. </template>
  29. </EnBlank>
  30. </view>
  31. <scroll-view v-else :scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
  32. <view class="list-box">
  33. <view class="list-item bgc-f b-rad-20 mb-32 p-24 box-border-box" v-for="(item,index) in list">
  34. <view class="align-items-center flex-justify-space mb-24">
  35. <view class="align-items-center">
  36. <image v-if="item.site_logo" class="shops-img" :src="item.site_logo" mode="aspectFit">
  37. </image>
  38. <image v-else class="shops-img" src="@/static/img/logo/logo.png" mode=""></image>
  39. <view v-if="item.site_name" class="fs-32 fc-3 fw-600 shops-name text-overflow-ellipsis-one">
  40. {{item.site_name}}
  41. </view>
  42. <view v-else class="fs-32 fc-3 fw-600 shops-name text-overflow-ellipsis-one">
  43. 君子校园
  44. </view>
  45. <!-- <image class="icons" src="@/static/img/toRight.png" mode=""></image> -->
  46. </view>
  47. <view class="fc-41ABF5 fs-28">
  48. {{item.order_status_str}}
  49. </view>
  50. </view>
  51. <view class="align-items-center flex-justify-space mb-24">
  52. <view class="goods-box" v-if="type == 1 || type == 2 || type == 5">
  53. <view class="" v-if="item.item.length == 1">
  54. <view class="align-items-center" v-for="(itemGoods,indexGoods) in item.item">
  55. <image class="goods-img flex-shrink0" :src="itemGoods.goods_img" mode="">
  56. </image>
  57. <view class="fs-28 fc-6 text-overflow-ellipsis">
  58. {{itemGoods.goods_name}}
  59. </view>
  60. </view>
  61. </view>
  62. <view class="align-items-center goods-two" v-else>
  63. <view class="flex-direction" v-for="(itemGoods,indexGoods) in item.item">
  64. <image class="goods-img flex-shrink0" :src="itemGoods.goods_img" mode="">
  65. </image>
  66. <view
  67. class="fs-28 fc-6 text-overflow-ellipsis-one goods-two-name text-align-center">
  68. {{itemGoods.goods_name}}
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="goods-box" v-else>
  74. <view class="align-items-center">
  75. <image class="goods-img flex-shrink0" :src="item.goods_img" mode="">
  76. </image>
  77. <view class="fs-28 fc-6 text-overflow-ellipsis">
  78. {{item.goods_name}}
  79. </view>
  80. </view>
  81. </view>
  82. <view class="goods-num text-align-center">
  83. 共 {{item.goods_number}} 件
  84. </view>
  85. </view>
  86. <view class="align-items-center flex-justify-space mb-24">
  87. <view class="fs-24 fc-9">
  88. 下单时间:{{item.created_at}}
  89. </view>
  90. <view class="fs-28 fc-9">
  91. {{item.order_status == 1?'需付':'实付'}} <text
  92. class="fs-32 fc-3 fw-600">¥{{item.pay_money}}</text>
  93. </view>
  94. </view>
  95. <view class="align-items-center flex-justify-end">
  96. <view class="item-but but-class-two fs-28 mr-18"
  97. v-if="type == 1 && item.order_status == 7 && item.is_comment == 0">
  98. 评价
  99. </view>
  100. <view class="item-but but-class-two fs-28 mr-18" @click="cancel(item)" v-if="type == 5 && item.order_status == 2">
  101. <!-- 干洗 -->
  102. 取消订单
  103. </view>
  104. <view class="item-but but-class-two fs-28 mr-18" @click="expressCancel(item)" v-if="type == 2 && item.order_status == 2">
  105. <!-- 代取 -->
  106. 取消订单
  107. </view>
  108. <view class="item-but but-class-one fs-28" v-if="item.order_status == 1">
  109. 立即支付
  110. </view>
  111. <view class="item-but but-class-one fs-28" v-if="type == 2 && item.order_status == 4">
  112. <!-- 代取 -->
  113. 再来一单
  114. </view>
  115. <view class="item-but but-class-one fs-28" v-if="type == 3 && item.order_status == 2">
  116. <!-- 团购 -->
  117. 再来一单
  118. </view>
  119. <view class="item-but but-class-one fs-28" v-if="type == 4 && item.order_status == 2">
  120. <!-- 票务 -->
  121. 再来一单
  122. </view>
  123. <view class="item-but but-class-one fs-28" v-if="type == 5 && item.order_status == 5">
  124. <!-- 干洗 -->
  125. 再来一单
  126. </view>
  127. </view>
  128. </view>
  129. </view>
  130. </scroll-view>
  131. </view>
  132. </template>
  133. <script>
  134. import tools from '@/service/tools';
  135. import EnBlank from "@/components/en-utils/en-blank/en-blank";
  136. import {
  137. expressOrderStatus,
  138. expressOrderList,
  139. expressOrderCancel
  140. } from "@/api/expressOrder.js"
  141. import {
  142. orderStatus
  143. } from "@/api/order.js"
  144. import {
  145. groupOrderStatus,
  146. groupOrderList
  147. } from "@/api/groupOrder.js"
  148. import {
  149. ticketOrderStatus,
  150. ticketOrderList
  151. } from "@/api/ticketOrder.js"
  152. import {
  153. laundryOrderStatus,
  154. laundryOrderList,
  155. laundryOrderCancel
  156. } from "@/api/laundryOrder.js"
  157. export default {
  158. components: {
  159. EnBlank
  160. },
  161. data() {
  162. return {
  163. type: 1,
  164. navList: [{
  165. name: '外卖',
  166. id: 1
  167. },
  168. {
  169. name: '代取',
  170. id: 2
  171. },
  172. {
  173. name: '团购',
  174. id: 3
  175. },
  176. {
  177. name: '票务',
  178. id: 4
  179. },
  180. {
  181. name: '干洗',
  182. id: 5
  183. },
  184. ],
  185. page: 1,
  186. list: [],
  187. total: 0,
  188. navTypeData: [],
  189. navTypeKey: 0,
  190. isAjax: false
  191. };
  192. },
  193. onShow() {
  194. this.resetList();
  195. },
  196. methods: {
  197. navTypeClick(key) {
  198. if (this.navTypeKey != key) {
  199. this.navTypeKey = key
  200. this.page = 1
  201. this.list = []
  202. if (this.type === 1) {
  203. } else if (this.type === 2) {
  204. this.expressOrderList()
  205. } else if (this.type === 3) {
  206. this.groupOrderList()
  207. } else if (this.type === 4) {
  208. this.ticketOrderList()
  209. } else if (this.type === 5) {
  210. this.laundryOrderList()
  211. }
  212. }
  213. },
  214. resetList() {
  215. this.page = 1;
  216. this.list = [];
  217. this.getList();
  218. },
  219. selectType(type) {
  220. if (type != this.type) {
  221. this.type = type;
  222. this.navTypeKey = 0
  223. this.resetList();
  224. }
  225. },
  226. expressOrderCancel(item) {
  227. // 代取取消订单
  228. expressOrderCancel({order_id: item.id}).then((res) => {
  229. if(res.code == 1) {
  230. tools.success(res.msg)
  231. this.page = 1;
  232. this.list = [];
  233. this.expressOrderList()
  234. }else {
  235. tools.error(res.msg)
  236. }
  237. })
  238. },
  239. cancel(item) {
  240. // 干洗取消订单
  241. laundryOrderCancel({order_id: item.id}).then((res) => {
  242. if(res.code == 1) {
  243. tools.success(res.msg)
  244. this.page = 1;
  245. this.list = [];
  246. this.laundryOrderList()
  247. }else {
  248. tools.error(res.msg)
  249. }
  250. })
  251. },
  252. scrolltolower() {
  253. ++this.page
  254. if (this.type === 1) {
  255. } else if (this.type === 2) {
  256. this.expressOrderList()
  257. } else if (this.type === 3) {
  258. this.groupOrderList()
  259. } else if (this.type === 4) {
  260. this.ticketOrderList()
  261. } else if (this.type === 5) {
  262. this.laundryOrderList()
  263. }
  264. // console.log('触底');
  265. },
  266. getList() {
  267. if (this.type === 1) {
  268. this.orderStatus()
  269. } else if (this.type === 2) {
  270. this.expressOrderStatus()
  271. this.expressOrderList()
  272. } else if (this.type === 3) {
  273. this.groupOrderStatus()
  274. this.groupOrderList()
  275. } else if (this.type === 4) {
  276. this.ticketOrderStatus()
  277. this.ticketOrderList()
  278. } else if (this.type === 5) {
  279. this.laundryOrderStatus()
  280. this.laundryOrderList()
  281. }
  282. },
  283. expressOrderStatus() {
  284. // 代取订单状态
  285. expressOrderStatus().then((res) => {
  286. if (res.code == 1) {
  287. this.navTypeData = res.data
  288. }
  289. })
  290. },
  291. orderStatus() {
  292. // 外卖订单状态
  293. orderStatus().then((res) => {
  294. if (res.code == 1) {
  295. this.navTypeData = res.data
  296. }
  297. })
  298. },
  299. groupOrderStatus() {
  300. // 团购订单状态
  301. groupOrderStatus().then((res) => {
  302. if (res.code == 1) {
  303. this.navTypeData = res.data
  304. }
  305. })
  306. },
  307. ticketOrderStatus() {
  308. // 票务订单状态
  309. ticketOrderStatus().then((res) => {
  310. if (res.code == 1) {
  311. this.navTypeData = res.data
  312. }
  313. })
  314. },
  315. laundryOrderStatus() {
  316. // 干洗订单状态
  317. laundryOrderStatus().then((res) => {
  318. if (res.code == 1) {
  319. this.navTypeData = res.data
  320. }
  321. })
  322. },
  323. expressOrderList() {
  324. // 代取订单列表
  325. expressOrderList({
  326. status: this.navTypeKey,
  327. page: this.page
  328. }).then((res) => {
  329. if (res.code == 1) {
  330. if (res.data.items.length > 0) {
  331. this.list.push(...res.data.items)
  332. }
  333. }
  334. })
  335. },
  336. groupOrderList() {
  337. // 团购订单列表
  338. groupOrderList({
  339. status: this.navTypeKey,
  340. page: this.page
  341. }).then((res) => {
  342. if (res.code == 1) {
  343. if (res.data.items.length > 0) {
  344. this.list.push(...res.data.items)
  345. }
  346. }
  347. })
  348. },
  349. ticketOrderList() {
  350. // 票务订单列表
  351. ticketOrderList({
  352. status: this.navTypeKey,
  353. page: this.page
  354. }).then((res) => {
  355. if (res.code == 1) {
  356. if (res.data.items.length > 0) {
  357. this.list.push(...res.data.items)
  358. }
  359. }
  360. })
  361. },
  362. laundryOrderList() {
  363. // 干洗订单列表
  364. laundryOrderList({
  365. status: this.navTypeKey,
  366. page: this.page
  367. }).then((res) => {
  368. if (res.code == 1) {
  369. if (res.data.items.length > 0) {
  370. this.list.push(...res.data.items)
  371. }
  372. }
  373. })
  374. }
  375. },
  376. }
  377. </script>
  378. <style lang="scss" scoped>
  379. .nav-box {
  380. padding: 26rpx 44rpx;
  381. overflow-x: scroll;
  382. .nav-item {
  383. margin-right: 76rpx;
  384. white-space: nowrap;
  385. position: relative;
  386. .nav-item-x {
  387. position: absolute;
  388. width: 48rpx;
  389. height: 6rpx;
  390. border-radius: 20rpx;
  391. background-color: #41ABF5;
  392. left: 12rpx;
  393. bottom: -10rpx;
  394. }
  395. }
  396. }
  397. .nav-type-box {
  398. width: 100%;
  399. white-space: nowrap;
  400. }
  401. .nav-type-item {
  402. width: 144rpx;
  403. height: 64rpx;
  404. line-height: 64rpx;
  405. margin: 0 24rpx 0 0;
  406. border-radius: 200rpx;
  407. display: inline-block;
  408. }
  409. .nav-type-item:last-child {
  410. margin: 0;
  411. }
  412. .list-box {
  413. padding: 20rpx;
  414. box-sizing: border-box;
  415. }
  416. .shops-img {
  417. width: 48rpx;
  418. height: 48rpx;
  419. margin: 0 8rpx 0 0;
  420. border-radius: 50%;
  421. }
  422. .shops-name {
  423. max-width: 452rpx;
  424. margin: 0 8rpx 0 0;
  425. }
  426. .icons {
  427. width: 32rpx;
  428. height: 32rpx;
  429. }
  430. .goods-box {
  431. max-width: 506rpx;
  432. height: auto;
  433. }
  434. .goods-num {
  435. width: 24rpx;
  436. height: auto;
  437. }
  438. .goods-img {
  439. width: 144rpx;
  440. height: 144rpx;
  441. border-radius: 12rpx;
  442. margin: 0 16rpx 0 0;
  443. }
  444. .goods-two {
  445. overflow-x: scroll;
  446. overflow: auto;
  447. }
  448. .goods-two-name {
  449. width: 144rpx;
  450. }
  451. .item-but {
  452. width: 160rpx;
  453. height: 64rpx;
  454. line-height: 64rpx;
  455. text-align: center;
  456. border-radius: 200rpx;
  457. }
  458. .but-class-one {
  459. background: linear-gradient(225deg, #41ABF5 0%, #5BD8FB 100%);
  460. color: #fff;
  461. }
  462. .but-class-two {
  463. background: #fff;
  464. border: 2rpx solid #CCCCCC;
  465. color: #333;
  466. }
  467. </style>