myRent.vue 6.7 KB

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