order.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  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. <view class="float-kefu" @click="kfPop">
  108. <image src="/static/tabbar/kf.png"></image>
  109. </view>
  110. <halfLogin ref="loginCom" @success="loginSuccess"></halfLogin>
  111. <kfService ref="kfService"></kfService>
  112. </view>
  113. </template>
  114. <script>
  115. var app;
  116. const pageSize = 10;
  117. export default {
  118. data() {
  119. return {
  120. orderState:0,
  121. orderData:{
  122. size:pageSize,
  123. page:1,
  124. loading:false,
  125. isDone:false
  126. },
  127. orderList:[],
  128. isLogin:true
  129. }
  130. },
  131. onLoad() {
  132. app = this;
  133. app.getOrder()
  134. },
  135. methods: {
  136. scrolltoupper(){},
  137. scrolltolower(e){
  138. if (app.orderData.isDone || app.orderList.length == 0) return ;
  139. app.getOrder()
  140. },
  141. toDetail(order){
  142. uni.navigateTo({
  143. url:"/pages/order/detail?order="+order
  144. })
  145. },
  146. loginSuccess(){
  147. app.getOrder()
  148. },
  149. toLogin(){
  150. app.$refs.loginCom.open();
  151. },
  152. async kfPop(){
  153. if (!app.isLogin) {
  154. app.$refs.loginCom.open();
  155. return ;
  156. }
  157. var resp = await app.$api.goods.check.get();
  158. if (resp.code == 0) {
  159. return app.$dialog.showSuccess(resp.msg);
  160. }
  161. if (resp.data.user == 0) {
  162. app.$refs.loginCom.open(2);
  163. return ;
  164. }
  165. const data = uni.getStorageSync("contact");
  166. app.$refs.kfService.open(data);
  167. },
  168. orderStatus(state) {
  169. app.orderState = state
  170. app.orderList = [];
  171. app.orderData = {
  172. size:pageSize,
  173. page:1,
  174. loading:false,
  175. isDone:false
  176. };
  177. app.getOrder()
  178. },
  179. async getOrder(){
  180. app.orderData.loading = true;
  181. var formData = {};
  182. const tokenPoi = uni.getStorageSync("contact");
  183. formData.poi = tokenPoi.poi_id;
  184. formData.page = app.orderData.page;
  185. formData.size = app.orderData.size;
  186. formData.status = app.orderState;
  187. var resp = await app.$api.order.list.get(formData)
  188. app.orderData.loading = false;
  189. if (resp.code == 401) {
  190. app.isLogin = false;
  191. return ;
  192. }
  193. if (resp.code == 0) {
  194. return app.$dialog.showSuccess(resp.msg)
  195. }
  196. app.isLogin = true;
  197. if (resp.data.rows.length > 0) {
  198. app.orderData.page ++;
  199. app.orderList = [...app.orderList,...resp.data.rows];
  200. } else {
  201. app.orderData.isDone = true;
  202. }
  203. }
  204. }
  205. }
  206. </script>
  207. <style lang="scss" scoped>
  208. .content{
  209. position: fixed;
  210. z-index: 1;
  211. top: 0;
  212. left: 0;
  213. bottom: 0;
  214. right: 0;
  215. background-color: #ededed;
  216. display: flex;
  217. flex-direction: column;
  218. .line-height{
  219. height: 40rpx;
  220. width: 100%;
  221. }
  222. }
  223. .float-kefu{position: fixed;right: 20upx;bottom: 15%;width: 100upx;height: 100upx;background-color: #fff;border-radius: 100%;display: flex;align-items: center;justify-content: center;}
  224. .float-kefu image{width: 60upx;height: 60upx;}
  225. .empty-body{
  226. display: flex;align-items: center;justify-content: center;flex-direction: column;height: calc(100vh - 100upx);
  227. .imgs{
  228. text-align: center;font-size: 28upx;color: #666;
  229. image{height: 160upx;width: 160upx;}
  230. .tip{margin-top: 20upx;}
  231. }
  232. .re-btn{
  233. width: 180upx;
  234. height: 80upx;
  235. line-height: 80upx;
  236. text-align: center;
  237. font-size: 28upx;
  238. color: #fff;
  239. background-color: $main-color;
  240. border-radius: 10upx;
  241. margin-top: 60upx;
  242. }
  243. }
  244. .tab-menu{
  245. height: 80rpx;
  246. line-height: 80rpx;
  247. background-color: #fff;
  248. display: flex;
  249. align-items: center;
  250. font-size: 28rpx;
  251. color: #666;
  252. justify-content: space-around;
  253. .tab-item{
  254. position: relative;
  255. color: $main-text-color;
  256. &.active{
  257. color: $main-color;
  258. font-weight: 700;
  259. &::after{
  260. position: absolute;
  261. content: "";
  262. width: 30%;
  263. left: 35%;
  264. height: 4rpx;
  265. bottom: 0;
  266. background-color: $main-color;
  267. }
  268. }
  269. }
  270. }
  271. .order-body{
  272. height: 0;
  273. flex: 1;
  274. .order-list{
  275. .order-item{
  276. width: 95%;
  277. margin: 0 auto;
  278. background-color: #fff;
  279. padding: 20rpx;
  280. margin-top: 20rpx;
  281. border-radius: 10rpx;
  282. .item-footer{
  283. display: flex;
  284. align-items: center;
  285. justify-content: space-between;
  286. color: $main-text-color;
  287. font-size: 28rpx;
  288. .footer-left{
  289. text {
  290. font-size: 30rpx;
  291. font-weight: bold;
  292. color: $main-color;
  293. }
  294. }
  295. .footer-group-btn{
  296. display: flex;
  297. align-items: center;
  298. gap: 20rpx;
  299. .button{
  300. font-size: 24rpx;
  301. padding: 10rpx 20rpx;
  302. border-radius: 40rpx;
  303. display: flex;
  304. align-items: center;
  305. &.border{
  306. background-color: #fff;
  307. border: 2rpx solid #fed7aa;
  308. color: #f26428;
  309. }
  310. &.success{
  311. background-color: #d1fae5;
  312. color: #059669;
  313. }
  314. &.fail{
  315. background-color: #f1f5f9;
  316. color: #64748b;
  317. }
  318. &.danger{
  319. background-color: #fef3c7;
  320. color: #b45309;
  321. }
  322. &.warn{
  323. background-color: #fef3c7;
  324. color: #b45309;
  325. }
  326. }
  327. }
  328. }
  329. .item-time{
  330. background-color: #fff8f1;
  331. border-radius: 10rpx;
  332. margin: 20rpx 0;
  333. padding: 20rpx;
  334. .time-list{
  335. line-height: 48rpx;
  336. font-size: 24rpx;
  337. color: #64748b;
  338. }
  339. }
  340. .item-goods{
  341. display: flex;
  342. align-items: center;
  343. gap: 20rpx;
  344. background-color: #fff;
  345. margin-top: 20rpx;
  346. border-radius: 20rpx;
  347. .stock{
  348. text-align: right;
  349. }
  350. .image {
  351. height: 180rpx;
  352. overflow: hidden;display: flex;align-items: center;min-width: 180rpx;
  353. position: relative;
  354. image {
  355. width: 180rpx;
  356. border-radius: 10upx;
  357. height: 100%;
  358. }
  359. }
  360. .info{
  361. flex: 1 1 0%;
  362. overflow: hidden;
  363. .title{
  364. display: flex;
  365. align-items: center;
  366. justify-content: space-between;
  367. .name {
  368. overflow: hidden;
  369. text-overflow: ellipsis;
  370. font-size: 32rpx;
  371. display: -webkit-box;
  372. -webkit-line-clamp: 2;
  373. -webkit-box-orient: vertical;
  374. color: #333;
  375. font-weight: 900;
  376. }
  377. }
  378. .tags {
  379. color: #94a3b8;
  380. font-size: 24rpx;
  381. margin: 10rpx 0;
  382. display: flex;
  383. align-items: center;
  384. justify-content: space-between;
  385. .price {
  386. font-size: 28rpx;
  387. color: $main-text-color;
  388. font-weight: 600;
  389. }
  390. }
  391. }
  392. }
  393. .item-header{
  394. display: flex;
  395. align-items: center;
  396. justify-content: space-between;
  397. border-bottom: 2rpx solid #fff7ed;
  398. padding-bottom: 10rpx;
  399. .item-status{
  400. font-size: 24rpx;
  401. padding: 10rpx 20rpx;
  402. border-radius: 30rpx;
  403. &.success{
  404. background-color: #d1fae5;
  405. color: #059669;
  406. }
  407. &.fail{
  408. background-color: #f1f5f9;
  409. color: #64748b;
  410. }
  411. &.danger{
  412. background-color: #fef3c7;
  413. color: #b45309;
  414. }
  415. &.warn{
  416. background-color: #ffedd5;
  417. color: #e95b22;
  418. }
  419. }
  420. .item-store{
  421. display: flex;
  422. align-items: center;
  423. gap: 15rpx;
  424. image {
  425. width: 40rpx;
  426. height: 40rpx;
  427. }
  428. }
  429. }
  430. }
  431. }
  432. }
  433. </style>