Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

add-company.vue 6.2KB

pirms 2 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <!-- 新增单位 -->
  2. <template>
  3. <view class="photo as-layout-horizontal">
  4. <view class="photo-item" @click="chooseImage(1)">
  5. <view class="photo-node"></view>
  6. <view class="photo-img as-gravity-center">
  7. <image v-if="state.creditCodeImgUrl" :src="state.creditCodeImgUrl" :data-url="state.creditCodeImgUrl" ></image>
  8. <image v-else :src="`${$imgUrl}issueActivation/icon-camera.png`" class="icon"></image>
  9. </view>
  10. <view class="photo-txt">社会统一信用代码照</view>
  11. </view>
  12. <view class="photo-item" @click="chooseImage(2)">
  13. <view class="photo-node"></view>
  14. <view class="photo-img as-gravity-center">
  15. <image v-if="state.missiveImgUrl" :src="state.missiveImgUrl" :data-url="state.missiveImgUrl" ></image>
  16. <image v-else :src="`${$imgUrl}issueActivation/icon-camera.png`" class="icon"></image>
  17. </view>
  18. <view class="photo-txt">办理公函照</view>
  19. </view>
  20. </view>
  21. <view class="form-box">
  22. <form-builder :config="config" :formData="state.formData"
  23. @inputChange="inputChange" @submit="submit"
  24. />
  25. </view>
  26. </template>
  27. <script setup lang="ts">
  28. import { reactive } from "vue";
  29. import { confirm, msg } from '@/utils/utils';
  30. import { TypeData } from '@/components/form-builder/tools';
  31. const config = ({
  32. submitName: '提交申请',
  33. titleWidth: 160,
  34. divider: true,
  35. })
  36. const state = reactive({
  37. //信用代码照片
  38. creditCodeImgUrl:null,
  39. //办理公函照片
  40. missiveImgUrl:null,
  41. //表单列表
  42. formData: [{
  43. 'title': '单办单位圈存:',
  44. 'type': 2,
  45. 'value': 'companyQC',
  46. 'maxlength': 30,
  47. 'hint': '请输入',
  48. 'emptyHint':'请输入单办单位圈存',
  49. 'divider': true,
  50. 'star': true,
  51. 'required':true,
  52. },
  53. {
  54. 'title': '申办单位简称:',
  55. 'type': 2,
  56. 'value': 'companyName',
  57. 'maxlength': 30,
  58. 'hint': '请输入',
  59. 'emptyHint':'请输入申办单位简称',
  60. 'divider': true,
  61. 'star': true,
  62. 'required':true,
  63. },
  64. {
  65. 'title': '统一社会信用代码:',
  66. 'type': 2,
  67. 'value': 'companyCode',
  68. 'maxlength': 18,
  69. 'hint': '请输入',
  70. 'emptyHint':'请输入统一社会信用代码',
  71. 'divider': true,
  72. 'star': true,
  73. 'required':true,
  74. },
  75. {
  76. 'title': '联系人名称:',
  77. 'type': 2,
  78. 'value': 'name',
  79. 'hint': '请输入',
  80. 'emptyHint':'请输入联系人名称',
  81. 'maxlength': 20,
  82. 'divider': true,
  83. 'star': true,
  84. 'required':true,
  85. },
  86. {
  87. 'title': '手机号:',
  88. 'type': 2,
  89. 'value': 'phone',
  90. 'inputType': 'number',
  91. 'maxlength': 11,
  92. 'hint': '请输入手机号',
  93. 'emptyHint':'请输入手机号',
  94. 'divider': true,
  95. 'star': true,
  96. 'required':true,
  97. },
  98. {
  99. 'title': '验证码:',
  100. 'type': 2,
  101. 'value': 'code',
  102. 'inputType': 'number',
  103. 'maxlength': 6,
  104. 'hint': '请输入验证码',
  105. 'emptyHint':'请输入验证码',
  106. 'divider': true,
  107. 'star': true,
  108. 'required':true,
  109. 'btn':true,
  110. 'btnTitle':'获取验证码',
  111. 'btnType':'code',
  112. 'codeValue':''
  113. },
  114. ],
  115. })
  116. //选择图片
  117. const chooseImage = (type:number) => {
  118. uni.chooseImage({
  119. count: 1,
  120. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  121. //sourceType: ['album','camera'],
  122. success: function (res) {
  123. console.log(res.tempFilePaths);
  124. if (type === 1) {//信用代码照片
  125. state.creditCodeImgUrl = res.tempFilePaths[0];
  126. } else{//办理公函照片
  127. state.missiveImgUrl = res.tempFilePaths[0];
  128. }
  129. }
  130. });
  131. }
  132. /* 文本输入框变化 */
  133. const inputChange = (e:any,item: TypeData) => {
  134. if(item.value === 'phone'){
  135. state.formData[5].codeValue = item[item.value];
  136. }
  137. }
  138. /* 提交 */
  139. const submit = (e: any) => {
  140. if(!state.creditCodeImgUrl || !state.missiveImgUrl){
  141. msg('请按照要求上传图片!');
  142. return;
  143. }
  144. confirm('是否确认提交?',()=>{
  145. msg('提交成功!')
  146. const params = {...e,creditCodeImgUrl:state.creditCodeImgUrl,missiveImgUrl:state.missiveImgUrl};
  147. console.log('提交内容', params);
  148. // const code = "IF01001202209060883" //请求编码
  149. // const options = {
  150. // type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  151. // data: e, //请求参数
  152. // method: 'POST|GET', //提交方式(默认POST)
  153. // showLoading: true, //是否显示加载中(默认显示)
  154. // }
  155. // request(code, options).then((res) => {
  156. // uni.showToast({
  157. // icon: 'none',
  158. // title: hint
  159. // })
  160. // })
  161. },'提交确认');
  162. }
  163. </script>
  164. <style>
  165. page{
  166. background-color: #EEF7F7;
  167. padding-bottom: 80rpx
  168. }
  169. </style>
  170. <style lang="scss" scoped>
  171. .photo{
  172. padding: 33rpx 33rpx 40rpx;
  173. justify-content: space-between;
  174. overflow: visible;
  175. .photo-img{
  176. width: 295rpx;
  177. height: 188rpx;
  178. background-color: #D9F8F1;
  179. text-align: center;
  180. border-radius: 14rpx;
  181. .icon{
  182. width: 88rpx;
  183. height: 88rpx;
  184. }
  185. }
  186. .photo-txt{
  187. font-size: 32rpx;
  188. color: #333333;
  189. font-weight: 600;
  190. margin-top: 30rpx;
  191. text-align: center;
  192. }
  193. .photo-item{
  194. width: 295rpx;
  195. height: 188rpx;
  196. position: relative;
  197. image{
  198. position: relative;
  199. z-index: 10;
  200. width: 100%;
  201. height: 188rpx;
  202. }
  203. &::before{
  204. content:'';
  205. position: absolute;
  206. width: 22rpx;
  207. height: 22rpx;
  208. border: 4rpx solid #21BEB1;
  209. border-bottom: none;
  210. border-right: none;
  211. z-index: 0;
  212. left:-4rpx;
  213. top: -4rpx;
  214. }
  215. &::after{
  216. content:'';
  217. position: absolute;
  218. width: 22rpx;
  219. height: 22rpx;
  220. border: 4rpx solid #21BEB1;
  221. border-top: none;
  222. border-right: none;
  223. z-index: 0;
  224. left: -4rpx;
  225. bottom: -4rpx;
  226. }
  227. }
  228. .photo-node{
  229. position: absolute;
  230. z-index: 0;
  231. width: 100%;
  232. height: 100%;
  233. &::before{
  234. content:'';
  235. position: absolute;
  236. width: 22rpx;
  237. height: 22rpx;
  238. border: 4rpx solid #21BEB1;
  239. border-left: none;
  240. border-bottom: none;
  241. z-index: 0;
  242. right:-4rpx;
  243. top: -4rpx;
  244. }
  245. &::after{
  246. content:'';
  247. position: absolute;
  248. width: 22rpx;
  249. height: 22rpx;
  250. border: 4rpx solid #21BEB1;
  251. border-top: none;
  252. border-left: none;
  253. z-index: 0;
  254. right: -4rpx;
  255. bottom: -4rpx;
  256. }
  257. }
  258. }
  259. .form-box{
  260. margin-top: 70rpx;
  261. background-color: white;
  262. padding:0 20rpx 20rpx;
  263. }
  264. </style>