混凝土运输管理微信小程序、替班
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

234 lines
4.6 KiB

2 weeks ago
  1. <template>
  2. <view class="content">
  3. <navbar title="历史订单" leftClick @leftClick="$utils.navigateBack" />
  4. <!-- 空数据状态 -->
  5. <view v-if="runns.length < 1" class="re-empty">
  6. <view class="empty-icon">📋</view>
  7. <view class="empty-text">暂无历史订单数据</view>
  8. </view>
  9. <!-- 订单列表 -->
  10. <view v-for="(item, index) in runns" :key="index" class="item-card">
  11. <view class="item-header">
  12. <view class="item-address">{{ item.address }}</view>
  13. <view class="item-time">{{ $timeUtils.formatTime(item.create_time) }}</view>
  14. </view>
  15. <view class="item-info">
  16. <view class="info-item">到场时间{{ $timeUtils.formatTime2Day(item.in_time) }}</view>
  17. <view class="info-item">计划数量{{ item.mi }}m³/</view>
  18. </view>
  19. <view class="item-buttons">
  20. <view class="item-button" @click="clickDetail(item.id)">查看</view>
  21. <view class="item-button btn2" @click="clickStep(item.id)">进度</view>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import navbar from '@/components/base/navbar.vue'
  28. export default {
  29. name: 'UserHistory',
  30. components: {
  31. navbar
  32. },
  33. data() {
  34. return {
  35. status: 0,
  36. seacht: 0,
  37. waits: [],
  38. runns: [],
  39. endes: [],
  40. input: ""
  41. };
  42. },
  43. onLoad() {
  44. uni.setNavigationBarTitle({
  45. title: '历史订单'
  46. });
  47. },
  48. mounted() {
  49. this.seacht = 0;
  50. this.loadPage();
  51. },
  52. methods: {
  53. clickDetail(id) {
  54. uni.navigateTo({
  55. url: `/pages_order/user/orderd?id=${id}`
  56. });
  57. },
  58. clickStep(id) {
  59. uni.navigateTo({
  60. url: `/pages_order/user/steps?id=${id}`
  61. });
  62. },
  63. loadPage() {
  64. uni.showLoading({});
  65. // 模拟数据,实际项目中应该调用API
  66. setTimeout(() => {
  67. uni.hideLoading();
  68. // 模拟历史订单数据
  69. this.runns = [
  70. {
  71. id: 1,
  72. address: "北京市朝阳区建国门外大街1号",
  73. create_time: Date.now() - 86400000, // 1天前
  74. in_time: Date.now() + 3600000, // 1小时后
  75. mi: 25
  76. },
  77. {
  78. id: 2,
  79. address: "上海市浦东新区陆家嘴环路1000号",
  80. create_time: Date.now() - 172800000, // 2天前
  81. in_time: Date.now() - 86400000, // 1天前
  82. mi: 30
  83. },
  84. {
  85. id: 3,
  86. address: "广州市天河区珠江新城花城大道85号",
  87. create_time: Date.now() - 259200000, // 3天前
  88. in_time: Date.now() - 172800000, // 2天前
  89. mi: 20
  90. }
  91. ];
  92. }, 1000);
  93. // 实际API调用代码(注释掉)
  94. // this.$httpGet("/api/order/history", {}, (res) => {
  95. // uni.hideLoading({});
  96. // if (res.data) {
  97. // this.runns = this.$utils.toArray(res.data);
  98. // }
  99. // });
  100. }
  101. }
  102. }
  103. </script>
  104. <style scoped lang="scss">
  105. page {
  106. background-color: #f5f5f5;
  107. }
  108. .content {
  109. min-height: 100vh;
  110. background-color: #f5f5f5;
  111. padding: 0 30rpx;
  112. }
  113. // 空数据状态
  114. .re-empty {
  115. display: flex;
  116. flex-direction: column;
  117. align-items: center;
  118. justify-content: center;
  119. padding: 200rpx 0;
  120. text-align: center;
  121. .empty-icon {
  122. font-size: 120rpx;
  123. margin-bottom: 30rpx;
  124. opacity: 0.5;
  125. }
  126. .empty-text {
  127. font-size: 28rpx;
  128. color: #999;
  129. }
  130. }
  131. // 订单卡片
  132. .item-card {
  133. position: relative;
  134. width: calc(100vw - 60rpx);
  135. height: 236rpx;
  136. background: #ffffff;
  137. padding: 30rpx;
  138. margin: 20rpx 0;
  139. border-radius: 12rpx;
  140. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.1);
  141. font-size: 24rpx;
  142. line-height: 42rpx;
  143. color: #333333;
  144. }
  145. // 订单头部信息
  146. .item-header {
  147. display: flex;
  148. justify-content: space-between;
  149. align-items: flex-start;
  150. margin-bottom: 20rpx;
  151. }
  152. .item-address {
  153. flex: 1;
  154. font-size: 28rpx;
  155. font-weight: 500;
  156. color: #333;
  157. overflow: hidden;
  158. text-overflow: ellipsis;
  159. white-space: nowrap;
  160. margin-right: 20rpx;
  161. }
  162. .item-time {
  163. color: #aaa;
  164. width: 160rpx;
  165. text-align: right;
  166. font-size: 24rpx;
  167. flex-shrink: 0;
  168. }
  169. // 订单信息
  170. .item-info {
  171. margin-bottom: 30rpx;
  172. }
  173. .info-item {
  174. font-size: 24rpx;
  175. color: #666;
  176. line-height: 36rpx;
  177. margin-bottom: 8rpx;
  178. }
  179. // 按钮区域
  180. .item-buttons {
  181. position: absolute;
  182. right: 30rpx;
  183. bottom: 30rpx;
  184. display: flex;
  185. gap: 20rpx;
  186. }
  187. .item-button {
  188. width: 122rpx;
  189. height: 52rpx;
  190. line-height: 52rpx;
  191. border-radius: 8rpx;
  192. border: 2rpx solid #F70303;
  193. font-size: 28rpx;
  194. font-weight: normal;
  195. text-align: center;
  196. color: #F70303;
  197. background-color: transparent;
  198. cursor: pointer;
  199. transition: all 0.3s ease;
  200. &:active {
  201. background-color: #F70303;
  202. color: #fff;
  203. }
  204. }
  205. .btn2 {
  206. border-color: #007AFF;
  207. color: #007AFF;
  208. &:active {
  209. background-color: #007AFF;
  210. color: #fff;
  211. }
  212. }
  213. </style>