onBindCar.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <view>
  3. <form @submit="formSubmit">
  4. <view class='personal-data' :style="colorStyle">
  5. <view class='list'>
  6. <view class='item acea-row row-between-wrapper'>
  7. <view>{{$t(`创建时间`)}}</view>
  8. <view class='input'>
  9. {{carDateil.add_time}}
  10. </view>
  11. </view>
  12. <view class='item acea-row row-between-wrapper'>
  13. <view>{{$t(`类型`)}}</view>
  14. <view class='input' v-if="carDateil.car_lease==1">
  15. 以租代购
  16. </view>
  17. <view class='input' v-if="carDateil.car_lease==0">
  18. 月租
  19. </view>
  20. </view>
  21. <view class='item acea-row row-between-wrapper' v-if="carDateil.car_lease==1">
  22. <view>{{$t(`总月份`)}}</view>
  23. <view class='input'>
  24. {{carDateil.several_months}}
  25. </view>
  26. </view>
  27. <view class='item acea-row row-between-wrapper' v-if="carDateil.car_lease==1">
  28. <view>{{$t(`已付月份`)}}</view>
  29. <view class='input'>
  30. {{carDateil.months}}
  31. </view>
  32. </view>
  33. <view class='item acea-row row-between-wrapper'>
  34. <view>{{$t(`月租`)}}</view>
  35. <view class='input'>
  36. {{carDateil.pay_price}}
  37. </view>
  38. </view>
  39. <view class='item acea-row row-between-wrapper'>
  40. <view>{{$t(`绑定人`)}}</view>
  41. <view class='input'>
  42. {{carDateil.real_name}}
  43. </view>
  44. </view>
  45. <view class='item acea-row row-between-wrapper'>
  46. <view>绑定车辆编号</view>
  47. <view class='input acea-row row-between-wrapper'>
  48. <input type='text' placeholder="请输入车辆编号" v-model='carDateil.machine_no' class='id'></input>
  49. <!-- #ifndef H5 -->
  50. <text @click="openQr" class='iconfont icon-saoma'></text>
  51. <!-- #endif -->
  52. </view>
  53. </view>
  54. </view>
  55. <button class='modifyBnt bg-color' formType="submit">{{$t(`绑定车辆`)}}</button>
  56. </view>
  57. </form>
  58. </view>
  59. </template>
  60. <script>
  61. import {
  62. toLogin
  63. } from '@/libs/login.js';
  64. import {
  65. getRentOrderDteail,
  66. rentSetcar
  67. } from '@/api/rent.js';
  68. import {
  69. mapGetters
  70. } from "vuex";
  71. import colors from '@/mixins/color.js';
  72. export default {
  73. mixins: [colors],
  74. data() {
  75. return {
  76. id: '',
  77. carDateil: {
  78. machine_no: '',
  79. }
  80. };
  81. },
  82. computed: mapGetters(['isLogin']),
  83. watch: {
  84. isLogin: {
  85. handler: function(newV, oldV) {
  86. if (newV) {
  87. this.getRentOrderDteail();
  88. }
  89. },
  90. deep: true
  91. }
  92. },
  93. onLoad(options) {
  94. this.id = options.id
  95. if (this.isLogin) {
  96. this.getRentOrderDteail();
  97. } else {
  98. toLogin();
  99. }
  100. },
  101. methods: {
  102. // #ifndef APP-PLUS
  103. // 打开二维码
  104. openQr() {
  105. const that = this;
  106. uni.scanCode({
  107. onlyFromCamera: true,
  108. scanType: ['barCode', 'qrCode', 'datamatrix', 'pdf417'],
  109. success(res) {
  110. that.carDateil.machine_no = res.result;
  111. }
  112. })
  113. },
  114. // #endif
  115. // 提交绑定
  116. formSubmit() {
  117. uni.showLoading({
  118. title: '提交中',
  119. mask: true
  120. });
  121. rentSetcar({
  122. id: this.carDateil.id,
  123. machine_no: this.carDateil.machine_no
  124. }).then((res) => {
  125. uni.hideLoading()
  126. uni.showToast({
  127. title: '绑定成功'
  128. });
  129. setTimeout(()=>{
  130. uni.redirectTo({
  131. url:'/pages/rent/order/orderList?status=1'
  132. })
  133. },1000)
  134. }).catch((res) => {
  135. console.log(res);
  136. uni.hideLoading()
  137. uni.showToast({
  138. title: res,
  139. icon:'error'
  140. });
  141. console.log(res);
  142. })
  143. },
  144. // 查询车辆详情
  145. getRentOrderDteail() {
  146. getRentOrderDteail(this.id).then((res) => {
  147. console.log(res, 'fh');
  148. this.carDateil = res.data;
  149. }).catch((res) => {
  150. console.log(res);
  151. })
  152. },
  153. }
  154. }
  155. </script>
  156. <style scoped lang="scss">
  157. .icon-saoma {
  158. font-size: $uni-font-size-lg !important;
  159. }
  160. .personal-data .list {
  161. /* #ifndef H5 */
  162. margin-top: 15rpx;
  163. /* #endif */
  164. background-color: #fff;
  165. }
  166. .personal-data .list .item {
  167. padding: 30rpx 30rpx 30rpx 0;
  168. border-bottom: 1rpx solid #f2f2f2;
  169. margin-left: 30rpx;
  170. font-size: 28rpx;
  171. color: #282828;
  172. }
  173. .personal-data .list .item .input {
  174. max-width: 400rpx;
  175. text-align: right;
  176. color: #868686;
  177. .icon-suozi {
  178. margin-left: 10rpx;
  179. }
  180. }
  181. .personal-data .list .item .input .id {
  182. // width: 180rpx;
  183. }
  184. .personal-data .list .item .input .iconfont {
  185. font-size: 24rpx;
  186. }
  187. .personal-data .modifyBnt {
  188. font-size: 32rpx;
  189. color: #fff;
  190. width: 690rpx;
  191. height: 90rpx;
  192. border-radius: 50rpx;
  193. text-align: center;
  194. line-height: 90rpx;
  195. margin: 76rpx auto 0 auto;
  196. }
  197. </style>