myRent.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <template>
  2. <view class="content">
  3. <view v-for="(item, index) in list" :key="index" class="order-item">
  4. <view class="i-top b-b">
  5. <text class="time">订单编号:{{ item.order_id }}</text>
  6. <text class="state">{{ item.status == 1?'待核销':(item.status == 2 ? '已核销': '') }}</text>
  7. <text v-if="item.status === 4" class="del-btn iconfont icondelete" @click="deleteOrder(index)"></text>
  8. </view>
  9. <view class="goods-box-single">
  10. <image class="goods-img" src="../../static/icon/in1.png" mode="scaleToFill"></image>
  11. <view class="right">
  12. <view class="flex flextop">
  13. <text class="title clamp2">租电订单</text>
  14. <text class="price">{{ moneyNum(item.price) }}</text>
  15. </view>
  16. <view class="row flex">
  17. <text class="row_title">{{ item.month ? (item.month + '月') : '' }}</text>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="price-box">
  22. 实付款
  23. <text class="price">{{ moneyNum(item.pay_price)}}</text>(押金{{moneyNum(item.deposit)}})
  24. </view>
  25. <view class="action-box b-t">
  26. <button v-if="item.status == 1" class="action-btn btn-base"
  27. @click.stop="navTo('/pages/order/hxqm?id=' + item.verify_code + '&type=2' + '&dcode=' + userInfo.battery_number)">出示券码</button>
  28. <!-- <button v-if="item.status == 2" class="action-btn btn-base"
  29. @click.stop="navTo('/pages/order/hxqm?id=' + item.verify_code + '&type=2')">续费</button> -->
  30. </view>
  31. </view>
  32. <uni-load-more :status="loadingType"></uni-load-more>
  33. </view>
  34. </template>
  35. <script>
  36. import { mapState } from 'vuex'
  37. import {
  38. getMyRent
  39. } from '@/api/user.js'
  40. export default {
  41. data() {
  42. return {
  43. page: 1,
  44. limit: 10,
  45. loadingType: 'more',
  46. loaded: false,
  47. list: []
  48. }
  49. },
  50. onLoad() {
  51. this.getMyRent()
  52. },
  53. onShow() {
  54. },
  55. onReachBottom() {
  56. this.getMyRent()
  57. },
  58. onReady() {
  59. },
  60. computed: {
  61. ...mapState('user',['userInfo'])
  62. },
  63. methods: {
  64. navTo(url) {
  65. uni.navigateTo({
  66. url,
  67. fail() {
  68. uni.switchTab({
  69. url
  70. })
  71. }
  72. })
  73. },
  74. moneyNum(val) {
  75. return (val * 1).toFixed(2)
  76. },
  77. getMyRent() {
  78. let that = this
  79. if (that.loadingType == 'loading' || that.loadingType == 'noMore') {
  80. return
  81. }
  82. that.loadingType = 'loading'
  83. getMyRent({
  84. page: that.page,
  85. limit: that.limit,
  86. status: 0
  87. }).then(res => {
  88. let arr = res.data.list
  89. that.list = that.list.concat(arr)
  90. that.page++
  91. if (arr.length == that.limit) {
  92. that.loadingType = 'more'
  93. } else {
  94. that.loadingType = 'noMore'
  95. }
  96. that.loaded = true
  97. })
  98. }
  99. }
  100. }
  101. </script>
  102. <style lang="scss" scoped>
  103. .content {
  104. padding-top: 20rpx;
  105. }
  106. .order-item {
  107. display: flex;
  108. flex-direction: column;
  109. padding-left: 30rpx;
  110. background: #fff;
  111. margin: 0 $page-row-spacing;
  112. margin-bottom: 30rpx;
  113. border-radius: 20rpx;
  114. padding-bottom: 10rpx;
  115. .i-top {
  116. display: flex;
  117. align-items: center;
  118. height: 80rpx;
  119. padding-right: 30rpx;
  120. font-size: $font-base;
  121. color: $font-color-dark;
  122. position: relative;
  123. .time {
  124. flex: 1;
  125. }
  126. .state {
  127. color: $base-color;
  128. }
  129. .del-btn {
  130. padding: 10rpx 0 10rpx 36rpx;
  131. font-size: $font-lg;
  132. color: $font-color-light;
  133. position: relative;
  134. &:after {
  135. content: '';
  136. width: 0;
  137. height: 30rpx;
  138. border-left: 1px solid $border-color-dark;
  139. position: absolute;
  140. left: 20rpx;
  141. top: 50%;
  142. transform: translateY(-50%);
  143. }
  144. }
  145. }
  146. /* 多条商品 */
  147. .goods-box {
  148. height: 160rpx;
  149. padding: 20rpx 0;
  150. white-space: nowrap;
  151. .goods-item {
  152. width: 120rpx;
  153. height: 120rpx;
  154. display: inline-block;
  155. margin-right: 24rpx;
  156. }
  157. .goods-img {
  158. display: block;
  159. width: 100%;
  160. height: 100%;
  161. }
  162. }
  163. /* 单条商品 */
  164. .goods-box-single {
  165. display: flex;
  166. padding: 20rpx 0;
  167. .goods-img {
  168. display: block;
  169. width: 170rpx;
  170. height: 170rpx;
  171. border-radius: 20rpx;
  172. }
  173. .right {
  174. flex: 1;
  175. display: flex;
  176. flex-direction: column;
  177. padding: 0 30rpx 0 24rpx;
  178. overflow: hidden;
  179. .flextop {
  180. align-items: flex-start;
  181. line-height: 1.3;
  182. }
  183. .row {
  184. margin-top: 10rpx;
  185. }
  186. .row_title {
  187. padding: 5rpx 10rpx;
  188. background-color: #dddddd;
  189. border-radius: 10rpx;
  190. font-size: 22rpx;
  191. color: #ffffff;
  192. }
  193. .title {
  194. font-size: $font-base + 2rpx;
  195. color: $font-color-dark;
  196. width: 80%;
  197. min-height: 2rem;
  198. }
  199. .attr-box {
  200. display: flex;
  201. justify-content: flex-end;
  202. font-size: $font-sm + 2rpx;
  203. color: $font-color-light;
  204. }
  205. .price {
  206. display: inline;
  207. font-size: $font-base + 2rpx;
  208. color: $font-color-light;
  209. &:before {
  210. content: '¥';
  211. font-size: $font-sm;
  212. }
  213. }
  214. }
  215. }
  216. .price-box {
  217. display: flex;
  218. justify-content: flex-end;
  219. align-items: baseline;
  220. padding: 20rpx 30rpx;
  221. font-size: $font-sm + 2rpx;
  222. color: $font-color-light;
  223. .num {
  224. margin: 0 8rpx;
  225. color: $font-color-dark;
  226. }
  227. .price {
  228. font-size: $font-lg;
  229. color: $font-color-dark;
  230. &:before {
  231. content: '¥';
  232. font-size: $font-sm;
  233. margin: 0 2rpx 0 8rpx;
  234. }
  235. }
  236. }
  237. .action-box {
  238. display: flex;
  239. justify-content: flex-end;
  240. align-items: center;
  241. height: 100rpx;
  242. position: relative;
  243. padding-right: 30rpx;
  244. }
  245. .action-btn {
  246. width: 160rpx;
  247. height: 60rpx;
  248. margin: 0;
  249. margin-left: 24rpx;
  250. padding: 0;
  251. text-align: center;
  252. line-height: 60rpx;
  253. font-size: $font-sm + 2rpx;
  254. color: $font-color-dark;
  255. background: #fff;
  256. border-radius: 100px;
  257. &.btn-red {
  258. color: $color-red;
  259. border: 1px solid $color-red;
  260. }
  261. &.btn-base {
  262. color: $base-color;
  263. border: 1px solid $base-color;
  264. }
  265. &:after {
  266. border-radius: 100px;
  267. }
  268. &.recom {
  269. color: $base-color;
  270. &:after {
  271. border-color: $base-color;
  272. }
  273. }
  274. &.evaluate {
  275. color: $color-yellow;
  276. &:after {
  277. border-color: $color-yellow;
  278. }
  279. }
  280. }
  281. }
  282. </style>