選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

operation-upload.vue 7.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <!-- 设备激活2-上传图片 -->
  2. <template>
  3. <view class="main" :style="{minHeight: height+'px'}">
  4. <view class="item-row">
  5. <view class="item-left">
  6. <view class="title">车身照</view>
  7. <view class="desc">汽车的45度车身照片</view>
  8. <view class="flag"><text>拍摄示例</text> </view>
  9. </view>
  10. <view class="item-right">
  11. <image :src="state.headstockImg ?state.headstockImg: defHeadstockImg"
  12. :data-url="state.headstockImg ?state.headstockImg: defHeadstockImg">
  13. </image>
  14. </view>
  15. </view>
  16. <view class="item-row" v-if="state.orderDetail.promotionModes == 1">
  17. <view class="item-left">
  18. <view class="title">安装照</view>
  19. <view class="desc">上传安装照片</view>
  20. <view class="flag"><text>拍摄示例</text> </view>
  21. </view>
  22. <view class="item-right" @click="chooseImage">
  23. <image v-if="state.installPhoto" :src="getFullImageUrl(state.installPhoto)" mode="aspectFill"></image>
  24. <image v-else :src="defInstallImg" mode="aspectFill"></image>
  25. </view>
  26. </view>
  27. <view class="hint" style="margin-top: 40rpx;">
  28. <image :src="`${$imgUrl}common/icon-hint.png`" class="icon"></image>
  29. <view>请打开手机蓝牙后再进行下一步操作。</view>
  30. </view>
  31. <view class="hint">
  32. <image :src="`${$imgUrl}common/icon-hint.png`" class="icon"></image>
  33. <view>运营和服务规则中:车载单元(OBU),安装在车辆内部(风挡玻璃或仪表台上)。</view>
  34. </view>
  35. <view class="open-tips">
  36. <view class="tip-title">开启蓝牙</view>
  37. <view class="item-tips">
  38. <view class="item-title">方式一</view>
  39. <view class="item">
  40. <view class="point"></view>打开手机的【设置】菜单。
  41. </view>
  42. <view class="item">
  43. <view class="point"></view>在【设置】菜单中,找到【蓝牙】选项。
  44. </view>
  45. <view class="item">
  46. <view class="point"></view>点击【蓝牙】选项,然后打开蓝牙开关。
  47. </view>
  48. </view>
  49. <view class="item-tips">
  50. <view class="item-title">方式二</view>
  51. <view class="item">
  52. <view class="point"></view>下拉打开通知栏。
  53. </view>
  54. <view class="item">
  55. <view class="point"></view>然后打开蓝牙开关。
  56. </view>
  57. </view>
  58. </view>
  59. <!-- <view class="action">
  60. <button type="default" class="ui-btn" @click="gotoNextStep">
  61. 下一步
  62. </button>
  63. </view> -->
  64. <FixedFooter>
  65. <button type="default" class="ui-btn" @click="gotoNextStep">
  66. 下一步
  67. </button>
  68. </FixedFooter>
  69. </view>
  70. </template>
  71. <script setup>
  72. import {
  73. reactive
  74. } from "vue";
  75. import {
  76. msg,
  77. navTo,
  78. uploadFile,
  79. getFullImageUrl
  80. } from '@/utils/utils';
  81. import {
  82. fileURL
  83. } from "@/datas/fileURL.js";
  84. import {
  85. getItem
  86. } from "@/utils/storage";
  87. const imgURL = `${fileURL}image/`;
  88. import {
  89. requestNew
  90. } from "@/utils/network/request.js";
  91. import {
  92. activeImgUpload,orderDetailQuery, issueUploadInstallPhoto
  93. } from "@/utils/network/api.js";
  94. import {
  95. onLoad
  96. } from '@dcloudio/uni-app'
  97. import FixedFooter from '@/components/common/FixedFooter.vue'
  98. const height = uni.getSystemInfoSync().windowHeight
  99. const defHeadstockImg = imgURL + "issuance/chetou.png";
  100. const defInstallImg = imgURL + "bluetooth/device-active-img2.png";
  101. const state = reactive({
  102. headstockImg: null, //车头照
  103. id: null,
  104. orderId: null,
  105. openId: null,
  106. transfer: 0,
  107. isAfter: '',
  108. installPhoto: null,
  109. orderDetail: {}
  110. });
  111. onLoad((option) => {
  112. //读取传入 存储的数据orderInfo
  113. let orderData = getItem("orderInfo");
  114. state.orderId = orderData.orderId;
  115. state.openId = getItem("openId");
  116. state.transfer = option.transfer
  117. state.isAfter = option.isAfter
  118. console.log(state);
  119. if(option.transfer == '1' || !state.transfer) {
  120. getOrderDetails(orderData.orderId)
  121. }else{
  122. let vehicleData = getItem("currentActivateData");
  123. console.log("我的车辆信息:",vehicleData)
  124. state.headstockImg = vehicleData.vehBodyUrl
  125. }
  126. })
  127. //获取订单详情
  128. const getOrderDetails = (orderId) => {
  129. console.log('======获取订单信息======')
  130. const options = {
  131. type: 2,
  132. data: {
  133. orderNo:orderId
  134. },
  135. method: "POST",
  136. showLoading: false,
  137. };
  138. state.disabled = false
  139. requestNew(orderDetailQuery, options).then((res) => {
  140. console.log("orderInfo", res);
  141. state.orderDetail = res
  142. state.headstockImg='https://qtzl.etcjz.cn/'+res['vehBodyUrl']
  143. });
  144. };
  145. //下一步
  146. const gotoNextStep = () => {
  147. if (state.orderDetail.promotionModes == 1 && !state.installPhoto) {
  148. msg('请上传安装照片')
  149. return
  150. }
  151. uni.openBluetoothAdapter()
  152. /* 判断是否打开蓝牙 */
  153. uni.getBluetoothAdapterState({
  154. success(res) {
  155. //如果res.avaliable==false 说明没打开蓝牙 反之则打开
  156. if (res.available == false) {
  157. uni.showToast({
  158. title: '请打开手机蓝牙',
  159. icon: "error",
  160. duration: 2000
  161. })
  162. return
  163. } else {
  164. navTo(`/pages/bluetooth/bluetooth?routeType=1&transfer=${state.transfer}&isAfter=${state.isAfter}`)
  165. }
  166. }
  167. })
  168. }
  169. //选择图片
  170. const chooseImage = () => {
  171. uni.chooseImage({
  172. count: 1,
  173. sizeType: ['original', 'compressed'],
  174. success: (res) => {
  175. uploadFile(res.tempFilePaths[0], 100).then((uploadRes) => {
  176. state.installPhoto = uploadRes.imageUrl
  177. let option = {
  178. type: 2,
  179. data: {
  180. orderNo: state.orderId,
  181. url: state.installPhoto
  182. },
  183. method: "POST",
  184. showLoading: true,
  185. }
  186. requestNew(issueUploadInstallPhoto, option)
  187. })
  188. }
  189. })
  190. }
  191. </script>
  192. <style>
  193. page {
  194. background: #F3F3F3;
  195. }
  196. </style>
  197. <style lang="scss" scoped>
  198. .main {
  199. background: #E9EDF0;
  200. padding-bottom:160rpx;
  201. position: relative;
  202. box-sizing: border-box;
  203. .action {
  204. position: absolute;
  205. bottom: 0rpx;
  206. left: 0;
  207. height: 128rpx;
  208. background-color: #fff;
  209. border-radius: 30rpx 30rpx 0 0;
  210. width: 100vw;
  211. display: flex;
  212. align-items: center;
  213. justify-content: center;
  214. flex-direction: column;
  215. }
  216. .item-row {
  217. width: 690rpx;
  218. height: 240rpx;
  219. margin: 30rpx auto 0;
  220. display: flex;
  221. justify-content: space-between;
  222. background: white;
  223. padding: 30rpx;
  224. border-radius: 20rpx;
  225. box-sizing: border-box;
  226. .item-left {
  227. .title {
  228. margin-top: 24rpx;
  229. font-size: 32rpx;
  230. color: #111;
  231. font-weight: bold;
  232. }
  233. .desc {
  234. font-size: 24rpx;
  235. color: #999;
  236. margin-top: 6rpx;
  237. }
  238. .flag {
  239. width: 100rpx;
  240. height: 30rpx;
  241. line-height: 30rpx;
  242. margin-top: 20rpx;
  243. border-radius: 5rpx;
  244. text-align: center;
  245. font-size: 20rpx;
  246. border: 1rpx solid #CCB375;
  247. font-family: SourceHanSansSC, SourceHanSansSC;
  248. color: #CCB375;
  249. }
  250. }
  251. .item-right {
  252. width: 288rpx;
  253. height: 174rpx;
  254. position: relative;
  255. image {
  256. position: relative;
  257. z-index: 10;
  258. width: 100%;
  259. height: 174rpx;
  260. }
  261. }
  262. .empty-node {
  263. position: absolute;
  264. z-index: 0;
  265. width: 100%;
  266. height: 100%;
  267. }
  268. }
  269. .hint {
  270. display: flex;
  271. flex-direction: row;
  272. justify-content: center;
  273. font-size: 28rpx;
  274. color: #545454;
  275. padding: 0px 30rpx;
  276. margin-top: 20rpx;
  277. align-items: center;
  278. .icon {
  279. width: 30rpx;
  280. height: 30rpx;
  281. margin-right: 10rpx;
  282. }
  283. view {
  284. width: calc(100% - 36rpx);
  285. }
  286. }
  287. .btn {
  288. margin: 60rpx 40rpx;
  289. }
  290. }
  291. .open-tips {
  292. width: 94%;
  293. margin: 20rpx auto;
  294. font-size: 30rpx;
  295. .tip-title {
  296. font-family: MicrosoftYaHei;
  297. font-size: 32rpx;
  298. color: #111111;
  299. line-height: 35px;
  300. }
  301. }
  302. .item-tips {
  303. margin-top: 10rpx;
  304. overflow: hidden;
  305. .item-title {
  306. font-family: MicrosoftYaHei;
  307. font-size: 28rpx;
  308. color: #111111;
  309. line-height: 35rpx;
  310. }
  311. .item {
  312. font-family: MicrosoftYaHei;
  313. font-size: 28rpx;
  314. color: #999999;
  315. line-height: 48rpx;
  316. display: flex;
  317. align-items: center;
  318. margin-top: 10rpx;
  319. .point {
  320. flex-shrink: 0;
  321. width: 10rpx;
  322. height: 10rpx;
  323. background: #A0A0A0;
  324. margin-right: 16rpx;
  325. border-radius: 50%;
  326. }
  327. }
  328. }
  329. </style>