repairs.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. <template>
  2. <view class="container">
  3. <!-- 公告区域 -->
  4. <view class="notice">
  5. <uni-notice-bar show-icon single speed="50" :scrollable="true" background-color="#fff" color="#000" text="今日14:00系统更新请不要进行报修!" />
  6. </view>
  7. <view class="gap"></view>
  8. <!-- 报修区域 -->
  9. <view class="box_item">
  10. <view class="item_title">
  11. 报修区域
  12. <text>*</text>
  13. </view>
  14. <view class="item_info" @click="handleSelectArea">请选择报修区域</view>
  15. <view class="item_icon" @click="handleSelectArea">
  16. <img src="../../static/images/repairsImg/right.png" />
  17. </view>
  18. </view>
  19. <!-- 详细地址区域 -->
  20. <view class="box_item">
  21. <view class="item_title">
  22. 详细地址
  23. <text>*</text>
  24. </view>
  25. <view class="item_info">
  26. <view class="item_input">
  27. <input placeholder-style="color:#CCCCCC" type="text" placeholder="请输入详细地址" />
  28. </view>
  29. </view>
  30. </view>
  31. <!-- 报修物品区域 -->
  32. <view class="box_item">
  33. <view class="item_title">
  34. 报修物品
  35. <text>*</text>
  36. </view>
  37. <view class="item_info" @click="handleSelectGoods">请选择报修物品</view>
  38. <view class="item_icon" @click="handleSelectGoods">
  39. <img src="../../static/images/repairsImg/right.png" />
  40. </view>
  41. </view>
  42. <!-- 故障描述 -->
  43. <view class="box_item2">
  44. <view class="item2_title">
  45. 故障描述
  46. <text>*</text>
  47. </view>
  48. <view class="item2_info">
  49. <view class="item2_textarea">
  50. <textarea placeholder-style="color:#CCCCCC" placeholder="请输入故障描述"></textarea>
  51. </view>
  52. </view>
  53. </view>
  54. <!-- 报修录音区域 -->
  55. <view class="box_item">
  56. <view class="item_title">报修录音</view>
  57. <view class="item_info">
  58. <view class="info_icon">
  59. <img src="../../static/images/repairsImg/voice.png" />
  60. </view>
  61. <view class="info_tips">点击录音</view>
  62. </view>
  63. </view>
  64. <!-- 上传照片区域 -->
  65. <view class="box_item3">
  66. <view class="item3_title">
  67. 上传照片
  68. <text>(可上传三张,请上传局部图和区域图)</text>
  69. </view>
  70. <uni-file-picker
  71. ref="filePicker"
  72. limit="3"
  73. v-model="imgList"
  74. fileMediatype="image"
  75. :image-styles="imageStyles"
  76. mode="grid"
  77. @select="select"
  78. @delete="handleDelete"
  79. ></uni-file-picker>
  80. </view>
  81. <!-- 报修姓名区域 -->
  82. <view class="box_item">
  83. <view class="item_title">
  84. 报修姓名
  85. <text>*</text>
  86. </view>
  87. <view class="item_info">
  88. <view class="item_input">
  89. <input placeholder-style="color:#CCCCCC" type="text" placeholder="请输入报修姓名" />
  90. </view>
  91. </view>
  92. </view>
  93. <!-- 联系电话区域 -->
  94. <view class="box_item">
  95. <view class="item_title">
  96. 联系电话
  97. <text>*</text>
  98. </view>
  99. <view class="item_info">
  100. <view class="item_input">
  101. <input placeholder-style="color:#CCCCCC" type="text" placeholder="请输入联系电话" />
  102. </view>
  103. </view>
  104. </view>
  105. <!-- 底部区域 -->
  106. <view class="foot">
  107. <view class="foot_btn">确认提交</view>
  108. <view class="foot_phone" @click="handleCallPhone('13820846714')">紧急电话 5661626</view>
  109. <view class="foot_phone" @click="handleCallPhone('13820846714')">服务监督电话 5661626</view>
  110. </view>
  111. <!-- 消息通知按钮区域 -->
  112. <view class="fixed" @tap="handleClickFixed">
  113. <view class="fixed_box">
  114. <img src="../../static/images/repairsImg/message.png" />
  115. 消息通知
  116. </view>
  117. </view>
  118. <!-- 用于图片压缩的canvas画布 -->
  119. <canvas
  120. :style="{
  121. width: cw + 'px',
  122. height: cw + 'px',
  123. position: 'absolute',
  124. zIndex: -1,
  125. left: '-10000rpx',
  126. top: '-10000rpx'
  127. }"
  128. canvas-id="zipCanvas"
  129. ></canvas>
  130. <!--画布结束-->
  131. </view>
  132. </template>
  133. <script>
  134. // 图片压缩方法
  135. import getLessLimitSizeImage from '../util/imageCompress.js'
  136. export default {
  137. data() {
  138. return {
  139. // 显示的图片数据
  140. imgList: [],
  141. // 上传的图片数据
  142. subImgList: [],
  143. // 图片上传框的样式
  144. imageStyles: {
  145. width: 60,
  146. height: 60,
  147. border: {
  148. color: '#ccc',
  149. width: 1,
  150. style: 'dashed',
  151. radius: '9px'
  152. }
  153. },
  154. //画板边长默认是屏幕宽度,正方形画布
  155. cw: uni.getSystemInfoSync().windowWidth
  156. }
  157. },
  158. methods: {
  159. // 选择图片回调
  160. select(e) {
  161. console.log(e)
  162. e.tempFiles.forEach((item) => {
  163. //这里的id和页面中写的html代码的canvas的id要一致
  164. let canvasId = 'zipCanvas'
  165. //原图的路径
  166. let imagePath = item.path
  167. //大小限制1024kb
  168. let limitSize = 1024
  169. //初始绘画区域是画布自身的宽度也就是屏幕宽度
  170. let drawWidth = uni.getSystemInfoSync().windowWidth
  171. getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, (resPath) => {
  172. uni.showLoading({
  173. title: '上传中'
  174. })
  175. uni.uploadFile({
  176. url: `https://jiangxih3cpartner.com/reporting/file/fileUpDown`,
  177. filePath: resPath,
  178. name: 'file',
  179. success: (uploadFileRes) => {
  180. subImgList.value.push(JSON.parse(uploadFileRes.data).data.join())
  181. imgList.value.push({
  182. url: item.path,
  183. name: ''
  184. })
  185. uni.hideLoading()
  186. },
  187. fail: () => {
  188. uni.showToast({
  189. title: '上传失败',
  190. icon: 'error'
  191. })
  192. }
  193. })
  194. })
  195. })
  196. },
  197. // 删除图片回调
  198. handleDelete(e) {
  199. // console.log(e);
  200. const num = imgList.value.findIndex((v) => v.url === e.tempFilePath)
  201. subImgList.value.splice(num, 1)
  202. imgList.value.splice(num, 1)
  203. },
  204. // 点击报修区域回调
  205. handleSelectArea() {
  206. uni.navigateTo({
  207. url: '/pagesRepairs/selectArea/selectArea'
  208. })
  209. },
  210. // 点击报修物品回调
  211. handleSelectGoods() {
  212. uni.navigateTo({
  213. url: '/pagesRepairs/selectGoods/selectGoods'
  214. })
  215. },
  216. // 点击消息通知按钮回调
  217. handleClickFixed() {
  218. uni.navigateTo({
  219. url: '/pagesRepairs/message/message'
  220. })
  221. },
  222. // 点击电话号码回调
  223. handleCallPhone(phone) {
  224. console.log(phone)
  225. uni.makePhoneCall({
  226. phoneNumber: phone
  227. })
  228. }
  229. }
  230. }
  231. </script>
  232. <style lang="scss" scoped>
  233. .container {
  234. width: 100vw;
  235. height: calc(100vh - 102rpx);
  236. overflow-y: auto;
  237. .notice {
  238. height: 90rpx;
  239. }
  240. .gap {
  241. height: 12rpx;
  242. background-color: #f2f2f2;
  243. }
  244. .box_item {
  245. display: flex;
  246. align-items: center;
  247. margin: 0 30rpx;
  248. height: 105rpx;
  249. font-size: 28rpx;
  250. border-bottom: 1rpx solid #e6e6e6;
  251. .item_title {
  252. width: 190rpx;
  253. font-weight: bold;
  254. text {
  255. margin-left: 5rpx;
  256. color: #d43030;
  257. }
  258. }
  259. .item_info {
  260. flex: 1;
  261. display: flex;
  262. padding: 0 10rpx;
  263. color: #cccccc;
  264. .item_input {
  265. width: 100%;
  266. height: 105rpx;
  267. input {
  268. height: 105rpx;
  269. line-height: 105rpx;
  270. color: #000;
  271. }
  272. }
  273. .info_icon {
  274. display: flex;
  275. justify-content: center;
  276. align-items: center;
  277. width: 79rpx;
  278. height: 37rpx;
  279. border-radius: 33rpx;
  280. border: 1rpx solid #e6e6e6;
  281. img {
  282. width: 26rpx;
  283. height: 26rpx;
  284. }
  285. }
  286. .info_tips {
  287. margin-left: 33rpx;
  288. font-size: 28rpx;
  289. color: #cccccc;
  290. }
  291. }
  292. .item_icon {
  293. width: 38rpx;
  294. height: 38rpx;
  295. img {
  296. width: 100%;
  297. height: 100%;
  298. }
  299. }
  300. }
  301. .box_item2 {
  302. display: flex;
  303. align-items: center;
  304. margin: 0 30rpx;
  305. height: 237rpx;
  306. font-size: 28rpx;
  307. border-bottom: 1rpx solid #e6e6e6;
  308. .item2_title {
  309. width: 190rpx;
  310. font-weight: bold;
  311. text {
  312. margin-left: 5rpx;
  313. color: #d43030;
  314. }
  315. }
  316. .item2_info {
  317. flex: 1;
  318. padding: 0 10rpx;
  319. .item2_textarea {
  320. display: flex;
  321. align-items: center;
  322. width: 100%;
  323. height: 237rpx;
  324. textarea {
  325. box-sizing: border-box;
  326. padding: 20rpx;
  327. width: 500rpx;
  328. height: 176rpx;
  329. border: 1rpx solid #e6e6e6;
  330. border-radius: 6rpx;
  331. }
  332. }
  333. }
  334. }
  335. .box_item3 {
  336. margin: 0 30rpx;
  337. height: 246rpx;
  338. border-bottom: 1rpx solid #e6e6e6;
  339. .item3_title {
  340. height: 95rpx;
  341. line-height: 95rpx;
  342. font-size: 28rpx;
  343. font-weight: bold;
  344. text {
  345. font-size: 24rpx;
  346. color: #808080;
  347. font-weight: 400;
  348. }
  349. }
  350. }
  351. .foot {
  352. display: flex;
  353. flex-direction: column;
  354. align-items: center;
  355. margin: 0 30rpx;
  356. height: 407rpx;
  357. .foot_btn {
  358. margin-top: 167rpx;
  359. width: 100%;
  360. height: 100rpx;
  361. line-height: 100rpx;
  362. text-align: center;
  363. color: #fff;
  364. font-size: 32rpx;
  365. border-radius: 12rpx;
  366. background-color: #6fb6b8;
  367. }
  368. .foot_phone {
  369. margin-top: 30rpx;
  370. color: #b3b3b3;
  371. font-size: 24rpx;
  372. }
  373. }
  374. .fixed {
  375. z-index: 2;
  376. position: fixed;
  377. right: 0;
  378. bottom: 382rpx;
  379. display: flex;
  380. justify-content: center;
  381. align-items: center;
  382. width: 211rpx;
  383. height: 90rpx;
  384. border-radius: 150rpx 0 0 150rpx;
  385. border: 1rpx solid #d9d9d9;
  386. background-color: #fff;
  387. box-shadow: 0 0 7rpx #d9d9d9;
  388. .fixed_box {
  389. display: flex;
  390. align-items: center;
  391. font-size: 28rpx;
  392. img {
  393. margin-right: 10rpx;
  394. width: 38rpx;
  395. height: 38rpx;
  396. }
  397. }
  398. }
  399. }
  400. </style>