myRent.vue 6.9 KB

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