orderDetail.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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' @click="carDateil.machine_no?'':bind()">
  48. {{carDateil.machine_no?carDateil.machine_no:'未绑定'}}
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </form>
  54. <view class="monthslist" v-for="(item,ind) in carDateil.info">
  55. <view class="item acea-row row-between-wrapper row-middle">
  56. <view class="title">
  57. <view class="info">
  58. 支付第{{item.months}}月租金
  59. </view>
  60. <view class="time">
  61. {{item.pay_time}}
  62. </view>
  63. </view>
  64. <view class="right">
  65. <view class="money">
  66. {{item.pay_price}}
  67. </view>
  68. <block v-if="item.paid!=0">
  69. <view class="peytype" v-if="item.pay_type=='yue'">
  70. 余额支付
  71. </view>
  72. <view class="peytype" v-if="item.pay_type=='alipay'">
  73. 支付宝支付
  74. </view>
  75. <view class="peytype" v-if="item.pay_type=='weixin'">
  76. 微信支付
  77. </view>
  78. </block>
  79. <view v-else class="peytype">
  80. 未支付
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. </template>
  87. <script>
  88. import {
  89. toLogin
  90. } from '@/libs/login.js';
  91. import {
  92. getRentOrderDteail,
  93. rentSetcar
  94. } from '@/api/rent.js';
  95. import {
  96. mapGetters
  97. } from "vuex";
  98. import colors from '@/mixins/color.js';
  99. export default {
  100. mixins: [colors],
  101. data() {
  102. return {
  103. id: '',
  104. carDateil: {
  105. machine_no: '',
  106. }
  107. };
  108. },
  109. computed: mapGetters(['isLogin']),
  110. watch: {
  111. isLogin: {
  112. handler: function(newV, oldV) {
  113. if (newV) {
  114. this.getRentOrderDteail();
  115. }
  116. },
  117. deep: true
  118. }
  119. },
  120. onLoad(options) {
  121. this.id = options.id
  122. if (this.isLogin) {
  123. this.getRentOrderDteail();
  124. } else {
  125. toLogin();
  126. }
  127. },
  128. methods: {
  129. // #ifndef APP-PLUS
  130. // 打开二维码
  131. openQr() {
  132. const that = this;
  133. uni.scanCode({
  134. onlyFromCamera: true,
  135. scanType: ['barCode', 'qrCode', 'datamatrix', 'pdf417'],
  136. success(res) {
  137. that.carDateil.machine_no = res.result;
  138. }
  139. })
  140. },
  141. // #endif
  142. bind() {
  143. const that = this;
  144. // #ifndef H5
  145. uni.showModal({
  146. title: '提示',
  147. content: '请选择绑定方式',
  148. showCancel: false,
  149. cancelText: '扫码',
  150. confirmText: '手填',
  151. success: res => {
  152. if (res.confirm) {
  153. that.bindImport(that.id)
  154. }
  155. if (res.cancel) {
  156. that.bindQr(that.id)
  157. }
  158. },
  159. fail: () => {},
  160. complete: () => {}
  161. });
  162. // #endif
  163. // #ifdef H5
  164. that.bindImport(that.id)
  165. // #endif
  166. },
  167. // 手输
  168. bindImport(id) {
  169. const that = this;
  170. uni.showModal({
  171. title: '绑定车辆',
  172. placeholderText: '请输入车辆编号',
  173. editable: true,
  174. cancelText: '取消',
  175. confirmText: '确定',
  176. success: res => {
  177. if (res.confirm) {
  178. if (res.content) {
  179. that.rentSetcar(res.content, id)
  180. } else {
  181. uni.showToast({
  182. title: '请输入车辆编号',
  183. icon: 'error'
  184. })
  185. that.bindImport(id)
  186. }
  187. }
  188. },
  189. fail: () => {},
  190. complete: () => {}
  191. });
  192. },
  193. // 扫码绑定
  194. bindQr(id) {
  195. uni.scanCode({
  196. onlyFromCamera: true,
  197. scanType: ['barCode', 'qrCode', 'datamatrix', 'pdf417'],
  198. success(res) {
  199. that.rentSetcar(res.result, id)
  200. }
  201. })
  202. },
  203. // 提交绑定
  204. rentSetcar(content, id) {
  205. rentSetcar({
  206. id,
  207. machine_no: content
  208. }).then((res) => {
  209. }).catch((res) => {
  210. console.log(res);
  211. })
  212. },
  213. // 查询车辆详情
  214. getRentOrderDteail() {
  215. getRentOrderDteail(this.id).then((res) => {
  216. console.log(res, 'fh');
  217. this.carDateil = res.data;
  218. }).catch((res) => {
  219. console.log(res);
  220. })
  221. },
  222. }
  223. }
  224. </script>
  225. <style scoped lang="scss">
  226. .personal-data .list {
  227. /* #ifndef H5 */
  228. margin-top: 15rpx;
  229. /* #endif */
  230. background-color: #fff;
  231. .item {
  232. padding: 30rpx 30rpx 30rpx 0;
  233. border-bottom: 1rpx solid #f2f2f2;
  234. margin-left: 30rpx;
  235. font-size: 28rpx;
  236. color: #282828;
  237. .input {
  238. max-width: 400rpx;
  239. text-align: right;
  240. color: #868686;
  241. .icon-suozi {
  242. margin-left: 10rpx;
  243. }
  244. .id {
  245. // width: 180rpx;
  246. }
  247. .iconfont {
  248. font-size: 24rpx;
  249. }
  250. }
  251. }
  252. }
  253. .monthslist {
  254. background-color: #FFF;
  255. border-radius: 10rpx;
  256. margin: 20rpx 20rpx 0rpx 20rpx;
  257. padding: 20rpx;
  258. .time,
  259. .peytype {
  260. font-size: 24rpx;
  261. color: #999;
  262. }
  263. .info {
  264. color: var(--view-theme);
  265. }
  266. .right {
  267. text-align: right;
  268. .money {
  269. color: var(--view-theme);
  270. }
  271. }
  272. }
  273. </style>