Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

device-install-photo.vue 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <!-- 设备激活2-上传图片 -->
  2. <template>
  3. <view class="main">
  4. <view class="item-row">
  5. <view class="item-left">
  6. <view class="title">安装照</view>
  7. <view class="desc">上传安装照片</view>
  8. <view class="flag"><text>拍摄示例</text> </view>
  9. </view>
  10. <view class="item-right" @click="chooseImage">
  11. <image v-if="state.installPhoto" :src="getFullImageUrl(state.installPhoto)" mode="aspectFill"></image>
  12. <image v-else :src="defInstallImg" mode="aspectFill"></image>
  13. </view>
  14. </view>
  15. <view class="hint" style="margin-top: 40rpx;">
  16. <image :src="`${$imgUrl}common/icon-hint.png`" class="icon"></image>
  17. <view>运营和服务规则中:车载单元(OBU),安装在车辆内部(风挡玻璃或仪表台上)。</view>
  18. </view>
  19. <FixedFooter>
  20. <button type="default" class="ui-btn" @click="gotoNextStep">
  21. 下一步
  22. </button>
  23. </FixedFooter>
  24. </view>
  25. </template>
  26. <script setup lang="ts">
  27. import { reactive, ref } from "vue";
  28. import { msg, navTo, uploadFile, objectToQueryString, getFullImageUrl } from '@/utils/utils';
  29. import { fileURL } from "@/datas/fileURL.js";
  30. import { getItem } from "@/utils/storage";
  31. const imgURL = `${fileURL}image/`;
  32. import { requestNew } from "@/utils/network/request.js";
  33. import { issueUploadInstallPhoto } from "@/utils/network/api.js";
  34. import { onLoad, onPageScroll } from '@dcloudio/uni-app'
  35. import FixedFooter from '@/components/common/FixedFooter.vue'
  36. import navBar from "@/components/nav-bar/nav-bar2.vue";
  37. const defInstallImg = imgURL + "bluetooth/device-active-img2.png";
  38. const scrollTop = ref(0);
  39. const state = reactive({
  40. installPhoto: null, //车头照
  41. id: null,
  42. orderId: null,
  43. clientFee: '',
  44. isValueCard: '',
  45. vehicleId: ''
  46. });
  47. interface Option {
  48. orderId: string,
  49. clientFee: string,
  50. id: string,
  51. isValueCard: string,
  52. vehicleId: string
  53. }
  54. interface uploadRes {
  55. imageUrl: string
  56. }
  57. onLoad((option: Option) => {
  58. //读取传入 存储的数据orderInfo
  59. state.orderId = option.orderId;
  60. state.clientFee = option.clientFee;
  61. state.id = option.id;
  62. state.isValueCard = option.isValueCard;
  63. state.vehicleId = option.vehicleId;
  64. console.log(state);
  65. })
  66. //选择图片
  67. const chooseImage = () => {
  68. uni.chooseImage({
  69. count: 1,
  70. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  71. success: function (res) {
  72. uploadFile(res.tempFilePaths[0], 100).then((uploadRes: uploadRes) => {
  73. console.log(uploadRes)
  74. state.installPhoto = uploadRes.imageUrl
  75. let option = {
  76. type: 2,
  77. data: {
  78. orderNo: state.orderId,
  79. url: state.installPhoto
  80. },
  81. method: "POST",
  82. showLoading: true,
  83. }
  84. requestNew(issueUploadInstallPhoto, option)
  85. })
  86. }
  87. })
  88. }
  89. //下一步
  90. const gotoNextStep = () => {
  91. if (!state.installPhoto) {
  92. msg("请上传安装照");
  93. return;
  94. }
  95. let params = {
  96. orderId: state.orderId,
  97. clientFee: state.clientFee,
  98. id: state.id,
  99. isValueCard: state.isValueCard,
  100. vehicleId: state.vehicleId
  101. }
  102. navTo(
  103. `/subpackage/orders/product-detail?${objectToQueryString(params)}`,
  104. );
  105. }
  106. //监听页面滚动
  107. onPageScroll((e) => {
  108. scrollTop.value = e.scrollTop;
  109. });
  110. </script>
  111. <style>
  112. page {
  113. background: #F3F3F3;
  114. }
  115. </style>
  116. <style lang="scss" scoped>
  117. .main {
  118. padding-bottom:160rpx;
  119. box-sizing: border-box;
  120. .item-row {
  121. width: 690rpx;
  122. height: 240rpx;
  123. margin: 30rpx auto 0;
  124. display: flex;
  125. justify-content: space-between;
  126. background: white;
  127. padding: 30rpx;
  128. border-radius: 20rpx;
  129. box-sizing: border-box;
  130. .item-left {
  131. .title {
  132. margin-top: 24rpx;
  133. font-size: 32rpx;
  134. color: #111;
  135. font-weight: bold;
  136. }
  137. .desc {
  138. font-size: 24rpx;
  139. color: #999;
  140. margin-top: 6rpx;
  141. }
  142. .flag {
  143. width: 100rpx;
  144. height: 30rpx;
  145. line-height: 30rpx;
  146. margin-top: 20rpx;
  147. border-radius: 5rpx;
  148. text-align: center;
  149. font-size: 20rpx;
  150. border: 1rpx solid #CCB375;
  151. font-family: SourceHanSansSC, SourceHanSansSC;
  152. color: #CCB375;
  153. }
  154. }
  155. .item-right {
  156. width: 288rpx;
  157. height: 174rpx;
  158. position: relative;
  159. image {
  160. position: relative;
  161. z-index: 10;
  162. width: 100%;
  163. height: 174rpx;
  164. }
  165. }
  166. .empty-node {
  167. position: absolute;
  168. z-index: 0;
  169. width: 100%;
  170. height: 100%;
  171. }
  172. }
  173. .hint {
  174. display: flex;
  175. flex-direction: row;
  176. justify-content: center;
  177. font-size: 28rpx;
  178. color: #545454;
  179. padding: 0px 30rpx;
  180. margin-top: 20rpx;
  181. align-items: center;
  182. .icon {
  183. width: 30rpx;
  184. height: 30rpx;
  185. margin-right: 10rpx;
  186. }
  187. view {
  188. width: calc(100% - 36rpx);
  189. }
  190. }
  191. .btn {
  192. margin: 60rpx 40rpx;
  193. }
  194. }
  195. .open-tips {
  196. width: 94%;
  197. margin: 20rpx auto;
  198. font-size: 30rpx;
  199. .tip-title {
  200. font-family: MicrosoftYaHei;
  201. font-size: 32rpx;
  202. color: #111111;
  203. line-height: 35px;
  204. }
  205. }
  206. .item-tips {
  207. margin-top: 10rpx;
  208. overflow: hidden;
  209. .item-title {
  210. font-family: MicrosoftYaHei;
  211. font-size: 28rpx;
  212. color: #111111;
  213. line-height: 35rpx;
  214. }
  215. .item {
  216. font-family: MicrosoftYaHei;
  217. font-size: 28rpx;
  218. color: #999999;
  219. line-height: 48rpx;
  220. display: flex;
  221. align-items: center;
  222. margin-top: 10rpx;
  223. .point {
  224. flex-shrink: 0;
  225. width: 10rpx;
  226. height: 10rpx;
  227. background: #A0A0A0;
  228. margin-right: 16rpx;
  229. border-radius: 50%;
  230. }
  231. }
  232. }
  233. </style>