activation.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view class="container-view">
  3. <view class="return-info flex-row flex-between">
  4. <view class="return-top">
  5. <view>车牌:{{plate_number}}</view>
  6. </view>
  7. <view><img :src="model_image" /></view>
  8. </view>
  9. <view class="pictures-info">
  10. <view>车辆照片</view>
  11. <!-- <view>这里是关于激活车辆照片的文案描述,这里是关于激活车辆照片的文案描述</view> -->
  12. <uploader :car_info="car_imgs" @update-car-images="handleCarImagesUpdate"></uploader>
  13. <view @tap="submitEnabled" class="pictures-btn">激活车辆</view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import uploader from '@/component/uploader/uploader';
  19. const http = require('@/common/http.js');
  20. const config = require('@/common/config.js');
  21. const common = require('@/common/common.js');
  22. export default {
  23. components: {
  24. uploader
  25. },
  26. data() {
  27. return {
  28. carInfo: {},
  29. plate_number: '013657142736',
  30. sub_sn: '',
  31. model_image: '3',
  32. car_model: '',
  33. return_imgs: [],
  34. car_imgs: [{img_url: ''}],
  35. model_image_list: ''
  36. };
  37. },
  38. /**
  39. * 生命周期函数--监听页面加载
  40. */
  41. onLoad: function(options) {
  42. console.log(options,'options');
  43. this.sub_sn = options.sub_sn || ''
  44. },
  45. /**
  46. * 生命周期函数--监听页面显示
  47. */
  48. onShow: function() {
  49. },
  50. onUnload: function () {
  51. },
  52. methods: {
  53. handleCarImagesUpdate(updatedImages) {
  54. // 这里会接收到子组件传来的更新后的图片URL数组
  55. this.car_imgs = updatedImages
  56. },
  57. submitEnabled() {
  58. const me = this
  59. const _image_list = this.car_imgs.map(item => item.img_url)
  60. if (_image_list.includes('' || "")) return common.simpleToast('请上传车辆照片')
  61. const pData = {
  62. car_sn: this.plate_number,
  63. sub_sn: this.sub_sn,
  64. image_list: _image_list.join(', ')
  65. }
  66. http.postApi(config.API_FLK_CAR_ASSIGNMENT, pData, (resp) => {
  67. if (resp.data.code === 200) {
  68. common.simpleToast('车辆激活成功')
  69. setTimeout(function() {
  70. me.isCustomJump = false
  71. uni.switchTab({
  72. url: `/pages/index/index?plate_number=${me.plate_number}`,
  73. success: function(res) {},
  74. fail: function(res) {},
  75. complete: function(res) {}
  76. });
  77. }, 800)
  78. } else {
  79. common.simpleToast(resp.data.msg)
  80. }
  81. })
  82. }
  83. }
  84. };
  85. </script>
  86. <style>
  87. @import './activation.css';
  88. </style>