businessFormal.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <view class="lifePhotosEdit">
  3. <view class="u-cell-group">
  4. <!-- <Upload :maxCount="1" @fileList="onUpload($event, 'cImgList')" /> -->
  5. <Upload :maxCount="maxCount" :width="76" :height="76" @fileList="onUpload"
  6. :fileList="fileList">
  7. <view class="upload-block" slot="content">
  8. <view class="icon-bg">
  9. <image src="/static/login/cameraIcon.png" mode="widthFix" style="width: 52rpx;height: 52rpx;">
  10. </image>
  11. <view style="font-weight: 400;font-size: 26rpx;color: #C9CDD4;margin-top: -13rpx;">上传</view>
  12. </view>
  13. </view>
  14. </Upload>
  15. <view class="tagText">请上传到达服务场所后的职业正装大小不超过 2MB 格式为 jpg/png 格式图片</view>
  16. <view class="footer-bar">
  17. <u-button :customStyle="{
  18. padding: '24rpx 48rpx',
  19. color: '#fff',
  20. background: 'var(--theme-color-gradient)',
  21. width: '654rpx',
  22. height: '88rpx',
  23. background: '#333335',
  24. borderRadius: '60rpx 60rpx 60rpx 60rpx',
  25. }" @click="onSubmit">确认</u-button>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import { startService } from '@/api/order.js'
  32. import clUpload from '@/components/cl-upload/cl-upload/cl-upload.vue'
  33. import Upload from '@/components/upload/index.vue';
  34. import { baseUrl } from '@/common/config.js'
  35. export default {
  36. components: { Upload, clUpload },
  37. data() {
  38. return {
  39. headers: {
  40. Authorization: `tf: ${uni.getStorageSync('access-token')}`,
  41. },
  42. orderId: '',
  43. fileList: [],
  44. fieldName: '',
  45. title: '',
  46. mediaType: 'all', // 默认为图片模式,上传第一个文件后确定类型
  47. uploadApi: baseUrl + '/common/upload', // 默认使用图片上传接口
  48. }
  49. },
  50. computed: {
  51. maxCount() {
  52. return 9
  53. },
  54. },
  55. onLoad(query) {
  56. if (query.orderId) {
  57. this.orderId = query.orderId
  58. }
  59. },
  60. onReady() {
  61. },
  62. onShow() {
  63. },
  64. methods: {
  65. // 处理媒体类型取消事件
  66. onCancel() {
  67. this.uploadApi = baseUrl + '/common/uploads'
  68. this.mediaType = 'all'
  69. },
  70. // upload事件
  71. onUpload(e) {
  72. this.fileList = e
  73. },
  74. goBack() {
  75. uni.navigateBack()
  76. },
  77. onSubmit() {
  78. console.log(this.fileList, 'fileList')
  79. if (this.fileList.length == 0) {
  80. uni.showToast({ title: '请至少上传1张', icon: 'none' });
  81. return
  82. }
  83. startService({
  84. orderId: this.orderId,
  85. imageUrls: this.fileList.map(item => item.url)
  86. }).then(res => {
  87. if (res.data.code === 200) {
  88. uni.showToast({ title: res.data.msg, icon: 'none' });
  89. setTimeout(() => {
  90. let str = uni.$u.queryParams({
  91. id: this.orderId
  92. });
  93. uni.navigateTo({
  94. url: `/pages/order/order_detail${str}`
  95. });
  96. }, 1000);
  97. }else{
  98. uni.showToast({ title: res.data.msg, icon: 'none' });
  99. }
  100. })
  101. }
  102. }
  103. }
  104. </script>
  105. <style scoped lang="scss">
  106. .lifePhotosEdit {
  107. height: 100vh;
  108. background-color: #F7F8FA;
  109. .tagText {
  110. margin-top: 32rpx;
  111. font-weight: 400;
  112. font-size: 26rpx;
  113. color: #86909C;
  114. }
  115. .checkBox {
  116. padding: 30rpx 32rpx 24rpx 32rpx;
  117. height: 134rpx;
  118. border-radius: 8rpx 8rpx 8rpx 8rpx;
  119. //color: #FF7D00;
  120. .checkStatus {
  121. font-weight: 500;
  122. font-size: 30rpx;
  123. text-align: left;
  124. display: flex;
  125. align-items: center;
  126. }
  127. .contactCustomer {
  128. width: 144rpx;
  129. height: 44rpx;
  130. border-radius: 24rpx 24rpx 24rpx 24rpx;
  131. font-weight: 400;
  132. font-size: 26rpx;
  133. text-align: center;
  134. }
  135. .text {
  136. margin-top: 8rpx;
  137. font-weight: 400;
  138. font-size: 26rpx;
  139. text-align: left;
  140. }
  141. }
  142. ::v-deep .u-cell-group {
  143. padding: 32rpx;
  144. background-color: #fff;
  145. .upload-block {
  146. width: 160rpx;
  147. height: 160rpx;
  148. background-color: #F7F8FA;
  149. display: flex;
  150. justify-content: center;
  151. align-items: center;
  152. border-radius: 12rpx;
  153. }
  154. .u-upload__wrap {
  155. display: flex;
  156. flex-wrap: wrap;
  157. justify-content: flex-start;
  158. gap: 14rpx;
  159. }
  160. .u-upload__button {
  161. margin: 0 !important;
  162. }
  163. .u-upload__wrap__preview {
  164. margin: 0 !important;
  165. }
  166. .u-upload__success {
  167. display: none;
  168. }
  169. }
  170. }
  171. ::v-deep .u-upload__success {
  172. display: none;
  173. }
  174. ::v-deep .u-upload__wrap__preview__image {
  175. border-radius: 12rpx !important;
  176. }
  177. ::v-deep .u-upload__deletable {
  178. border-top-right-radius: 12rpx;
  179. border-bottom-left-radius: 12rpx;
  180. }
  181. ::v-deep .u-upload__deletable__icon {
  182. position: static !important;
  183. -webkit-transform: scale(0.8) !important;
  184. }
  185. .media-area {
  186. margin: 20rpx 0 20rpx;
  187. justify-content: space-between;
  188. position: relative;
  189. width: 340upx;
  190. height: 240upx;
  191. .icon-cuo {
  192. width: 40rpx;
  193. height: 40rpx;
  194. position: absolute;
  195. right: 0;
  196. top: 0;
  197. color: #ffffff !important;
  198. z-index: 999;
  199. border-bottom-left-radius: 12rpx;
  200. display: flex;
  201. justify-content: center;
  202. align-items: center;
  203. }
  204. .video-container {
  205. width: 340upx;
  206. height: 240upx;
  207. border-radius: 12rpx;
  208. }
  209. }
  210. </style>