order.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view>
  3. <uni-popup ref="orderPop" type="bottom" border-radius="10px 10px 0 0" background-color="#f1f1f1" :mask-click="false">
  4. <view class="order-popup">
  5. <view class="order-title">
  6. <view class="name">我的订单</view>
  7. <view class="close" @click="closeOrder()"><image src="/static/image/close.png"></image></view>
  8. </view>
  9. <view class="order-body-con" v-if="orderList.length > 0">
  10. <scroll-view class="order-body" scroll-y scroll-with-animation @scrolltoupper="scrolltoupper" @scrolltolower="scrolltolower" upper-threshold="80">
  11. <view class="m-order-s" v-for="(items,index) in orderList" :key="index">
  12. <view class="order-img"><image :src="items.img" mode="widthFix"></image></view>
  13. <view class="order-info">
  14. <view class="title">{{items.product.product_name}}</view>
  15. <view class="desc">{{items.out_order_no}}</view>
  16. <view class="price">{{ $dialog.formatMoney(items.price,true) }}</view>
  17. </view>
  18. <view class="status-btn-group">
  19. <view class="status info" v-if="items.status=='0'">未支付</view>
  20. <view class="status primary" v-if="items.status=='1'">待使用</view>
  21. <view class="status success" v-if="items.status=='2'">已完成</view>
  22. <view class="status danger" v-if="items.status=='3'">已退款</view>
  23. <view class="status warn" v-if="items.status=='4'">退款中</view>
  24. <view class="status info" v-if="items.status=='5'">已关闭</view>
  25. <view class="status danger" @click="sendOrder(items)">发送</view>
  26. </view>
  27. </view>
  28. <view class="view-more" v-if="orderData.loading">
  29. <uni-load-more status="loading"></uni-load-more>
  30. </view>
  31. </scroll-view>
  32. </view>
  33. <view class="order-body" v-else>
  34. <view class="empty-body">暂无数据...</view>
  35. </view>
  36. </view>
  37. </uni-popup>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. data () {
  43. return {
  44. orderList:[],
  45. orderData:{
  46. page:1,
  47. size:10,
  48. loading:false,
  49. isDone:false
  50. }
  51. }
  52. },
  53. methods: {
  54. open() {
  55. this.$nextTick(()=>{
  56. this.$refs.orderPop.open()
  57. })
  58. return this;
  59. },
  60. closeOrder(){
  61. this.$nextTick(()=>{
  62. this.$refs.orderPop.close()
  63. })
  64. },
  65. setData(data) {
  66. this.orderData.page = 1;
  67. this.orderData.loading = false;
  68. this.orderData.isDone = false;
  69. this.getOrder();
  70. },
  71. sendOrder(data){
  72. this.$refs.orderPop.close()
  73. this.$emit("send",data)
  74. },
  75. scrolltoupper(){},
  76. scrolltolower(e){
  77. if (this.orderData.isDone || this.orderList.length == 0) return ;
  78. this.getOrder()
  79. },
  80. async getOrder(){
  81. this.orderData.loading = true;
  82. var formData = {};
  83. const tokenPoi = uni.getStorageSync("contact");
  84. formData.poi = tokenPoi.poi_id;
  85. formData.page = this.orderData.page;
  86. formData.size = this.orderData.size;
  87. // formData.status = 1;
  88. var resp = await this.$api.order.chat.get(formData)
  89. this.orderData.loading = false;
  90. if (resp.code == 0) {
  91. return this.$dialog.showSuccess(resp.msg)
  92. }
  93. if (resp.data.rows.length > 0) {
  94. this.orderData.page ++;
  95. this.orderList = [...this.orderList,...resp.data.rows];
  96. } else {
  97. this.orderData.isDone = true;
  98. }
  99. }
  100. }
  101. }
  102. </script>
  103. <style>
  104. .order-popup .order-title{display: flex;align-items: center;justify-content: space-between;font-size: 32upx;padding: 20upx;font-weight: bold;}
  105. .order-popup .input-value-border{border: 0;}
  106. .order-popup .order-title.bb1{border-bottom: 2upx solid #efefef;}
  107. .order-popup .order-title image{width: 40upx;height: 40upx;}
  108. .order-popup .order-body{
  109. height: 50vh;overflow: auto;background-color: #fff;border-radius: 20rpx;
  110. }
  111. .order-popup.address .order-body{height: 60vh;overflow: auto;padding: 20upx;}
  112. .order-body-con{margin: 20rpx;}
  113. .view-more{text-align: center;font-size: 24upx;color: #666;padding: 20upx;}
  114. .order-popup .u-input {height: 60upx;}
  115. .order-popup .submit-btn{
  116. border-top: 2upx solid #efefef;
  117. border-radius: 0;
  118. }
  119. .m-order-s{border-bottom:2rpx solid #f1f1f1;border-radius: 10upx;display: flex;font-size: 28upx;position: relative;padding: 20upx;}
  120. .m-order-s .order-img {display: flex;align-items: center;justify-content: center;}
  121. .m-order-s .order-img image{width: 150upx;height: 150upx;}
  122. .m-order-s .order-info {padding: 15upx;flex:1;overflow: hidden;}
  123. .m-order-s .order-info .title{font-size: 28upx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}
  124. .m-order-s .order-info .desc{font-size: 24upx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;color: #999;}
  125. .m-order-s .order-info .price{font-size: 28upx;color: #f00;}
  126. .m-order-s .status-btn-group{position: absolute;right: 10rpx;bottom: 10rpx;display: flex;align-items: center;gap: 15upx;}
  127. .m-order-s .status{border-radius: 10upx 0 10upx 0;background-color: #909399;font-size: 24upx;color: #fff;padding: 10upx;}
  128. .m-order-s .status.info{background-color: #909399;}
  129. .m-order-s .status.primary{background-color: #409eff;}
  130. .m-order-s .status.success{background-color: #67c23a;}
  131. .m-order-s .status.danger{background-color: #f56c6c;}
  132. .m-order-s .status.warn{background-color: #e6a23c;}
  133. .empty-body{display: flex;align-items: center;justify-content: center;height: 100%;}
  134. </style>