order.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. <template>
  2. <view class="content">
  3. <view class="tab-menu">
  4. <view :class="orderState==0?'tab-item active':'tab-item'" @click="orderStatus(0)">全部</view>
  5. <view :class="orderState==2?'tab-item active':'tab-item'" @click="orderStatus(2)">待使用</view>
  6. <view :class="orderState==3?'tab-item active':'tab-item'" @click="orderStatus(3)">已完成</view>
  7. <view :class="orderState==4?'tab-item active':'tab-item'" @click="orderStatus(4)">已退款</view>
  8. <view :class="orderState==8?'tab-item active':'tab-item'" @click="orderStatus(8)">履约中</view>
  9. </view>
  10. <scroll-view class="order-body" scroll-y scroll-with-animation @scrolltoupper="scrolltoupper" @scrolltolower="scrolltolower" upper-threshold="80">
  11. <view class="order-list" v-if="orderList.length == 0 && orderData.loading">
  12. <view class="order-item" v-for="(item,indx) in 3" :key="indx">
  13. <view class="item-header">
  14. <view class="item-store" style="flex: 1;"><view class="skeleton-line animate"></view></view>
  15. </view>
  16. <view class="item-goods">
  17. <view class="image">
  18. <view class="skeleton-line animate"></view>
  19. </view>
  20. <view class="info">
  21. <view class="title">
  22. <view class="skeleton-line animate"></view>
  23. </view>
  24. <view class="tags">
  25. <view class="skeleton-line animate"></view>
  26. </view>
  27. <view class="tags">
  28. <view class="skeleton-line animate"></view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="mt15">
  33. <view class="skeleton-line animate"></view>
  34. </view>
  35. <view class="item-footer mt15">
  36. <view class="footer-left" style="width: 30%;">
  37. <view class="skeleton-line animate"></view>
  38. </view>
  39. <view class="footer-group-btn" style="width: 30%;">
  40. <view class="skeleton-line animate"></view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="order-list" v-else>
  46. <view class="empty-body" v-if="orderList.length == 0">
  47. <view class="imgs">
  48. <image src="/static/image/empty.png" mode="widthFix"></image>
  49. <view class="tip">没有更多数据啦~</view>
  50. <view class="re-btn" @click="toLogin" v-if="!isLogin">立即登录</view>
  51. </view>
  52. </view>
  53. <view class="order-item" v-for="(item,indx) in orderList" :key="item.id" v-else>
  54. <view class="item-header" @click="toDetail(item.out_order_no)">
  55. <view class="item-store">
  56. <image src="/static/image/store.svg"></image>
  57. <text>{{item.poi.poi_name}}</text>
  58. </view>
  59. <view class="item-status danger" v-if="item.status == 1">待使用</view>
  60. <view class="item-status success" v-if="item.status == 2">已完成</view>
  61. <view class="item-status fail" v-if="item.status == 3">已退款</view>
  62. <view class="item-status warn" v-if="item.status == 4">退款中</view>
  63. <view class="item-status fail" v-if="item.status == 5">已关闭</view>
  64. <view class="item-status warn" v-if="item.status == 6">部分退款</view>
  65. <view class="item-status success" v-if="item.status == 7">履约中</view>
  66. <view class="item-status warn" v-if="item.status == 8">退款审核中</view>
  67. <view class="item-status warn" v-if="item.status == 9">退款审核中</view>
  68. </view>
  69. <view class="item-goods" @click="toDetail(item.out_order_no)">
  70. <view class="image">
  71. <image :src="item.img"></image>
  72. </view>
  73. <view class="info">
  74. <view class="title">
  75. <view class="name" v-if="item.product.is_new == 1">{{item.product.price}}元代{{item.product.line_price}}元商场权益券{{ item.product.product_name }}</view>
  76. <view class="name" v-else>{{ item.product.product_name }}</view>
  77. <view class="num">x{{ item.number }}</view>
  78. </view>
  79. <view class="tags">
  80. {{item.sku_name?item.sku_name:'默认'}}
  81. <view class="price">{{ $dialog.formatMoney(item.price,true) }}</view>
  82. </view>
  83. </view>
  84. </view>
  85. <view class="item-time">
  86. <view class="time-list">订单编号:{{ item.order_sn }}</view>
  87. <view class="time-list">下单时间:{{item.create_at}}</view>
  88. </view>
  89. <view class="item-footer" @click="toDetail(item.out_order_no)">
  90. <view class="footer-left">实付 <text>{{ $dialog.formatMoney(item.pay_money,true) }}</text></view>
  91. <view class="footer-group-btn">
  92. <view v-if="item.status == 0" class="button warn">继续支付</view>
  93. <view v-if="item.status == 1" class="button success">立即预约</view>
  94. <view v-if="item.status == 1" class="button border">申请退款</view>
  95. <view v-if="item.status == 2" class="button warn">再来一单</view>
  96. <view v-if="item.status == 7" class="button warn">申请退款</view>
  97. <view v-if="item.status == 4||item.status == 3" class="button border">再次购买</view>
  98. <view v-if="item.status == 5||item.status == 6||item.status == 7||item.status == 8 ||item.status == 9" class="button fail">查看详情</view>
  99. </view>
  100. </view>
  101. </view>
  102. <uni-load-more status="loading" v-if="orderData.loading"></uni-load-more>
  103. <uni-load-more status="noMore" v-if="orderList.length > 0 && orderData.isDone"></uni-load-more>
  104. </view>
  105. <view class="line-height"></view>
  106. </scroll-view>
  107. <halfLogin ref="loginCom" @success="loginSuccess"></halfLogin>
  108. </view>
  109. </template>
  110. <script>
  111. var app;
  112. const pageSize = 10;
  113. export default {
  114. data() {
  115. return {
  116. orderState:0,
  117. orderData:{
  118. size:pageSize,
  119. page:1,
  120. loading:false,
  121. isDone:false
  122. },
  123. orderList:[],
  124. isLogin:true
  125. }
  126. },
  127. onLoad() {
  128. app = this;
  129. app.getOrder()
  130. },
  131. methods: {
  132. scrolltoupper(){},
  133. scrolltolower(e){
  134. if (app.orderData.isDone || app.orderList.length == 0) return ;
  135. app.getOrder()
  136. },
  137. toDetail(order){
  138. uni.navigateTo({
  139. url:"/pages/order/detail?order="+order
  140. })
  141. },
  142. loginSuccess(){
  143. app.getOrder()
  144. },
  145. toLogin(){
  146. app.$refs.loginCom.open();
  147. },
  148. orderStatus(state) {
  149. app.orderState = state
  150. app.orderList = [];
  151. app.orderData = {
  152. size:pageSize,
  153. page:1,
  154. loading:false,
  155. isDone:false
  156. };
  157. app.getOrder()
  158. },
  159. async getOrder(){
  160. app.orderData.loading = true;
  161. var formData = {};
  162. const tokenPoi = uni.getStorageSync("contact");
  163. formData.poi = tokenPoi.poi_id;
  164. formData.page = app.orderData.page;
  165. formData.size = app.orderData.size;
  166. formData.status = app.orderState;
  167. var resp = await app.$api.order.list.get(formData)
  168. app.orderData.loading = false;
  169. if (resp.code == 401) {
  170. app.isLogin = false;
  171. return ;
  172. }
  173. if (resp.code == 0) {
  174. return app.$dialog.showSuccess(resp.msg)
  175. }
  176. app.isLogin = true;
  177. if (resp.data.rows.length > 0) {
  178. app.orderData.page ++;
  179. app.orderList = [...app.orderList,...resp.data.rows];
  180. } else {
  181. app.orderData.isDone = true;
  182. }
  183. }
  184. }
  185. }
  186. </script>
  187. <style lang="scss" scoped>
  188. .content{
  189. position: fixed;
  190. z-index: 1;
  191. top: 0;
  192. left: 0;
  193. bottom: 0;
  194. right: 0;
  195. background-color: #ededed;
  196. display: flex;
  197. flex-direction: column;
  198. .line-height{
  199. height: 40rpx;
  200. width: 100%;
  201. }
  202. }
  203. .empty-body{
  204. display: flex;align-items: center;justify-content: center;flex-direction: column;height: calc(100vh - 100upx);
  205. .imgs{
  206. text-align: center;font-size: 28upx;color: #666;
  207. image{height: 160upx;width: 160upx;}
  208. .tip{margin-top: 20upx;}
  209. }
  210. .re-btn{
  211. width: 180upx;
  212. height: 80upx;
  213. line-height: 80upx;
  214. text-align: center;
  215. font-size: 28upx;
  216. color: #fff;
  217. background-color: $main-color;
  218. border-radius: 10upx;
  219. margin-top: 60upx;
  220. }
  221. }
  222. .tab-menu{
  223. height: 80rpx;
  224. line-height: 80rpx;
  225. background-color: #fff;
  226. display: flex;
  227. align-items: center;
  228. font-size: 28rpx;
  229. color: #666;
  230. justify-content: space-around;
  231. .tab-item{
  232. position: relative;
  233. color: $main-text-color;
  234. &.active{
  235. color: $main-color;
  236. font-weight: 700;
  237. &::after{
  238. position: absolute;
  239. content: "";
  240. width: 30%;
  241. left: 35%;
  242. height: 4rpx;
  243. bottom: 0;
  244. background-color: $main-color;
  245. }
  246. }
  247. }
  248. }
  249. .order-body{
  250. height: 0;
  251. flex: 1;
  252. .order-list{
  253. .order-item{
  254. width: 95%;
  255. margin: 0 auto;
  256. background-color: #fff;
  257. padding: 20rpx;
  258. margin-top: 20rpx;
  259. border-radius: 10rpx;
  260. .item-footer{
  261. display: flex;
  262. align-items: center;
  263. justify-content: space-between;
  264. color: $main-text-color;
  265. font-size: 28rpx;
  266. .footer-left{
  267. text {
  268. font-size: 30rpx;
  269. font-weight: bold;
  270. color: $main-color;
  271. }
  272. }
  273. .footer-group-btn{
  274. display: flex;
  275. align-items: center;
  276. gap: 20rpx;
  277. .button{
  278. font-size: 24rpx;
  279. padding: 10rpx 20rpx;
  280. border-radius: 40rpx;
  281. display: flex;
  282. align-items: center;
  283. &.border{
  284. background-color: #fff;
  285. border: 2rpx solid #fed7aa;
  286. color: #f26428;
  287. }
  288. &.success{
  289. background-color: #d1fae5;
  290. color: #059669;
  291. }
  292. &.fail{
  293. background-color: #f1f5f9;
  294. color: #64748b;
  295. }
  296. &.danger{
  297. background-color: #fef3c7;
  298. color: #b45309;
  299. }
  300. &.warn{
  301. background-color: #fef3c7;
  302. color: #b45309;
  303. }
  304. }
  305. }
  306. }
  307. .item-time{
  308. background-color: #fff8f1;
  309. border-radius: 10rpx;
  310. margin: 20rpx 0;
  311. padding: 20rpx;
  312. .time-list{
  313. line-height: 48rpx;
  314. font-size: 24rpx;
  315. color: #64748b;
  316. }
  317. }
  318. .item-goods{
  319. display: flex;
  320. align-items: center;
  321. gap: 20rpx;
  322. background-color: #fff;
  323. margin-top: 20rpx;
  324. border-radius: 20rpx;
  325. .stock{
  326. text-align: right;
  327. }
  328. .image {
  329. height: 180rpx;
  330. overflow: hidden;display: flex;align-items: center;min-width: 180rpx;
  331. position: relative;
  332. image {
  333. width: 180rpx;
  334. border-radius: 10upx;
  335. height: 100%;
  336. }
  337. }
  338. .info{
  339. flex: 1 1 0%;
  340. overflow: hidden;
  341. .title{
  342. display: flex;
  343. align-items: center;
  344. justify-content: space-between;
  345. .name {
  346. overflow: hidden;
  347. text-overflow: ellipsis;
  348. font-size: 32rpx;
  349. display: -webkit-box;
  350. -webkit-line-clamp: 2;
  351. -webkit-box-orient: vertical;
  352. color: #333;
  353. font-weight: 900;
  354. }
  355. }
  356. .tags {
  357. color: #94a3b8;
  358. font-size: 24rpx;
  359. margin: 10rpx 0;
  360. display: flex;
  361. align-items: center;
  362. justify-content: space-between;
  363. .price {
  364. font-size: 28rpx;
  365. color: $main-text-color;
  366. font-weight: 600;
  367. }
  368. }
  369. }
  370. }
  371. .item-header{
  372. display: flex;
  373. align-items: center;
  374. justify-content: space-between;
  375. border-bottom: 2rpx solid #fff7ed;
  376. padding-bottom: 10rpx;
  377. .item-status{
  378. font-size: 24rpx;
  379. padding: 10rpx 20rpx;
  380. border-radius: 30rpx;
  381. &.success{
  382. background-color: #d1fae5;
  383. color: #059669;
  384. }
  385. &.fail{
  386. background-color: #f1f5f9;
  387. color: #64748b;
  388. }
  389. &.danger{
  390. background-color: #fef3c7;
  391. color: #b45309;
  392. }
  393. &.warn{
  394. background-color: #ffedd5;
  395. color: #e95b22;
  396. }
  397. }
  398. .item-store{
  399. display: flex;
  400. align-items: center;
  401. gap: 15rpx;
  402. image {
  403. width: 40rpx;
  404. height: 40rpx;
  405. }
  406. }
  407. }
  408. }
  409. }
  410. }
  411. </style>