index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. <template>
  2. <view class="container">
  3. <uv-list>
  4. <uv-list-item
  5. clickable show-arrow v-for="(item,index) in state.orderList" :key="index" @click="handleClickDetail(item)">
  6. <template #default>
  7. <view class="wallet-item">
  8. <view class="wallet-item_header">
  9. <view class="flex-inline">
  10. <text class="wallet-item_header-type">洗车消费</text>
  11. <uv-text class="ml10" style="margin-left: 10px;" plain :size="12"
  12. :type="item.payStatus==0?'primary':(item.payStatus==1?'success':'error')"
  13. :text="fmtDictName('Order.pay', item.payStatus)"></uv-text>
  14. <!-- <uv-tags class="ml10" style="margin-left: 10px;" size="mini" plain
  15. :type="item.orderStatus==0?'primary':(item.orderStatus==1?'success':'error')"
  16. :text="fmtDictName('Order.status', item.orderStatus)"></uv-tags>-->
  17. </view>
  18. <text class="wallet-item_header-amt">{{ (item.amount / 100).toFixed(2) }}元</text>
  19. </view>
  20. <view class="wallet-item_body">
  21. <text class="wallet-item_body-order">{{ item.orderId }}</text>
  22. <text class="wallet-item_body-time">{{ fmtDateTime(item.startTime) }}</text>
  23. </view>
  24. </view>
  25. </template>
  26. </uv-list-item>
  27. </uv-list>
  28. <uv-load-more :status="computedLoadMoreStatus"
  29. bgColor="#fff"
  30. @loadmore="loadMore" dashed :height="30"/>
  31. <!-- <login-bar class="w100 text-center"></login-bar>-->
  32. <!-- <tab-bar :index="3"/>-->
  33. </view>
  34. </template>
  35. <script lang="ts" setup>
  36. import {computed, reactive} from 'vue'
  37. import {onHide, onShow, onPullDownRefresh, onReachBottom,} from "@dcloudio/uni-app";
  38. import {get} from "@/utils/https";
  39. import {fmtDictName, fmtDateTime} from "@/utils/common";
  40. const initState = () => ({
  41. orderList: [],
  42. query: {
  43. pageNum: 1,
  44. pageSize: 10
  45. },
  46. hasNext: false
  47. })
  48. const state = reactive(initState())
  49. onShow(() => {
  50. uni.setNavigationBarTitle({title: '洗车订单'})
  51. let gd = getApp<any>().globalData;
  52. if (!gd.token) {
  53. console.error(gd)
  54. return;
  55. }
  56. loadOrderList();
  57. });
  58. onHide(() => {
  59. Object.assign(state, initState());
  60. })
  61. const computedLoadMoreStatus =computed(()=>{
  62. return state.hasNext?'loadmore':'nomore'
  63. })
  64. onPullDownRefresh(() => {
  65. console.log("onPullDownRefresh")
  66. setTimeout(function () {
  67. state.query.pageNum = 1;
  68. loadOrderList()
  69. }, 100);
  70. })
  71. onReachBottom(() => {
  72. console.log("onReachBottom")
  73. loadMore()
  74. })
  75. const loadMore = () => {
  76. if (state.hasNext) {
  77. state.query.pageNum++
  78. loadOrderList()
  79. }
  80. }
  81. const loadOrderList = () => {
  82. //load order list
  83. get(`/wash-order/listMyWashOrder`, state.query).then((res: any) => {
  84. if(res.list){
  85. state.orderList = state.orderList.concat(res.list);
  86. state.hasNext = res.pages>state.query.pageNum;
  87. }
  88. uni.stopPullDownRefresh();
  89. }).catch(e => {
  90. uni.stopPullDownRefresh();
  91. })
  92. }
  93. const handleClickDetail = (orderDetail: any) => {
  94. uni.navigateTo({
  95. url: `/pages-order/detail/index?id=${orderDetail.id}&type=3&orderNo=${orderDetail.orderId}`,
  96. });
  97. };
  98. </script>
  99. <style lang="scss" scoped>
  100. .container {
  101. background-color: #f6f6f6;
  102. }
  103. .wallet-item {
  104. display: flex;
  105. flex-direction: column;
  106. padding: 14rpx;
  107. border-radius: 8rpx;
  108. margin: 10rpx 16 prx 10rpx 10rpx;
  109. &_header {
  110. display: inline-flex;
  111. flex-wrap: nowrap;
  112. justify-content: space-between;
  113. &-type {
  114. font-weight: 500;
  115. font-size: 16px;
  116. margin-right: 15rpx;
  117. }
  118. &-status {
  119. font-size: 12px;
  120. margin-left: 6px;
  121. border: 1px solid $uni-color-primary;
  122. border-radius: 2rpx;
  123. }
  124. &-amt {
  125. font-weight: 500;
  126. font-size: 17px;
  127. }
  128. }
  129. &_body {
  130. padding: 10rpx 0;
  131. display: inline-flex;
  132. justify-content: space-between;
  133. &-order, &-time {
  134. font-size: 12px;
  135. color: $uni-color-subtitle
  136. }
  137. }
  138. }
  139. .font-size-lg {
  140. border: none;
  141. background-color: var(--theme_color);
  142. }
  143. .navbar {
  144. height: calc(44px + var(--status-bar-height));
  145. display: flex;
  146. background-color: #ffffff;
  147. }
  148. .talk-btn {
  149. height: 32px;
  150. margin-left: 10px;
  151. margin-top: 26px;
  152. display: flex;
  153. align-items: center;
  154. justify-content: center;
  155. font-size: 16px !important;
  156. padding: 0 20rpx;
  157. border-radius: 50rem !important;
  158. image {
  159. width: 40rpx;
  160. height: 40rpx;
  161. margin-right: 10px;
  162. }
  163. }
  164. .tabbar {
  165. /* #ifdef MP-WEIXIN */
  166. // margin-top: 60px;
  167. /* #endif */
  168. height: 100rpx;
  169. background-color: #ffffff;
  170. display: flex;
  171. align-items: center;
  172. justify-content: space-around;
  173. // margin-top: 100rpx;
  174. .item {
  175. height: 100%;
  176. font-size: 32rpx;
  177. color: #999;
  178. font-weight: 400 !important;
  179. display: flex;
  180. align-items: center;
  181. &.active {
  182. color: #343434;
  183. border-bottom: 4rpx solid #343434;
  184. }
  185. }
  186. }
  187. .swiper {
  188. width: 100%;
  189. height: calc(100vh - 44px);
  190. }
  191. .history-order {
  192. width: 100%;
  193. height: 100%;
  194. position: relative;
  195. .menu {
  196. padding: 18rpx 30rpx;
  197. display: flex;
  198. align-items: center;
  199. color: #FFFFFF;
  200. position: fixed;
  201. top: 0;
  202. left: 0;
  203. right: 0;
  204. z-index: 10;
  205. .item {
  206. padding: 14rpx 30rpx;
  207. display: flex;
  208. align-items: center;
  209. justify-content: center;
  210. image {
  211. width: 40rpx;
  212. height: 40rpx;
  213. margin-right: 10rpx;
  214. }
  215. &.active {
  216. color: var(--theme_color);
  217. background-color: #ffffff;
  218. }
  219. }
  220. }
  221. .history-order-swiper {
  222. width: 100%;
  223. height: 100%;
  224. }
  225. }
  226. .store-order-wrapper {
  227. width: 100%;
  228. height: 100%;
  229. display: flex;
  230. flex-direction: column;
  231. align-items: center;
  232. justify-content: center;
  233. color: #999;
  234. line-height: 1.3rem !important;
  235. image {
  236. width: 400rpx;
  237. height: 333rpx;
  238. margin-bottom: 40rpx;
  239. }
  240. }
  241. .orders-scroll {
  242. width: 100%;
  243. height: 100%;
  244. padding-top: 104rpx;
  245. }
  246. .orders-scroll1 {
  247. width: 100%;
  248. height: 100%;
  249. padding-top: 20rpx;
  250. }
  251. .good_name {
  252. padding-left: 30rpx;
  253. padding-top: 15rpx;
  254. color: #555;
  255. font-weight: 600;
  256. font-size: 14px;
  257. }
  258. .order-list {
  259. display: flex;
  260. width: 100%;
  261. flex-direction: column;
  262. .order {
  263. background-color: #ffffff;
  264. padding: 30rpx 40rpx;
  265. margin-bottom: 18rpx;
  266. .header {
  267. display: flex;
  268. justify-content: space-between;
  269. align-items: center;
  270. .status {
  271. font-size: 14px;
  272. color: #595959;
  273. display: flex;
  274. align-items: center;
  275. image {
  276. width: 30rpx;
  277. height: 30rpx;
  278. margin-left: 10px;
  279. }
  280. }
  281. }
  282. .images {
  283. display: flex;
  284. padding: 30rpx 0;
  285. image {
  286. flex-shrink: 0;
  287. width: 150rpx;
  288. height: 112.5rpx;
  289. }
  290. }
  291. .info {
  292. display: flex;
  293. align-items: center;
  294. margin-bottom: 30rpx;
  295. .left {
  296. flex: 1;
  297. display: flex;
  298. flex-direction: column;
  299. font-size: 12px;
  300. color: #7a7a7a;
  301. // view {
  302. // margin-bottom: 10rpx;
  303. // font-size: 12px;
  304. // &:last-child {
  305. // margin-bottom: 0;
  306. // }
  307. // }
  308. }
  309. .right {
  310. font-size: 32rpx;
  311. color: #343434;
  312. }
  313. }
  314. .action {
  315. display: flex;
  316. justify-content: flex-end;
  317. align-items: center;
  318. button {
  319. margin-left: 30rpx;
  320. font-size: 16px;
  321. }
  322. }
  323. }
  324. .button {
  325. margin-left: 30rpx;
  326. padding: 15rpx 20rpx;
  327. font-size: 16px;
  328. border-radius: 70rpx;
  329. background-color: #eee;
  330. &_pay {
  331. background-color: var(--theme_color);
  332. color: white;
  333. border: none;
  334. border-radius: 70rpx;
  335. }
  336. &_del {
  337. color: white;
  338. background-color: #F56C6C;
  339. }
  340. &_re {
  341. color: white;
  342. background-color: #5CB87A;
  343. }
  344. }
  345. }
  346. </style>