receivingOrder.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <view class="content">
  3. <view class="box">
  4. <view class="hflex acenter jbetween cell">
  5. <view class="label">姓名</view>
  6. <u-input v-model="name" placeholder="请填写姓名" inputAlign="right" border="none"></u-input>
  7. </view>
  8. <view class="hflex acenter jbetween cell">
  9. <view class="label">所在单位</view>
  10. <u-input v-model="work" placeholder="请填写所在单位名称" inputAlign="right" border="none"></u-input>
  11. </view>
  12. <view class="cell">
  13. <view class="label">营业执照照片</view>
  14. <view class="upload hflex acenter jcenter">
  15. <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" :maxCount="1" name="1" multiple :previewFullImage="true" width="530rpx" height="324rpx">
  16. <image src="https://ship-expert.zhousi.hdlkeji.com/common/upload-business.png" style="width: 530rpx;height: 324rpx;"></image>
  17. <image class="upload_img" src="https://ship-expert.zhousi.hdlkeji.com/common/upload-top.png"></image>
  18. </u-upload>
  19. </view>
  20. </view>
  21. <view class="cell" style="border: none;">
  22. <view class="label">身份证正反面</view>
  23. <view class="hflex acenter jbetween" style="margin-top: 28rpx;">
  24. <u-upload :fileList="fileList2" @afterRead="afterRead" @delete="deletePic" :maxCount="1" name="2" multiple :previewFullImage="true" width="310rpx" height="188rpx">
  25. <image src="https://ship-expert.zhousi.hdlkeji.com/common/upload-just.png" style="width: 310rpx;height: 188rpx;"></image>
  26. </u-upload>
  27. <view class="upload2">
  28. <u-upload :fileList="fileList3" @afterRead="afterRead" @delete="deletePic" :maxCount="1" name="3" multiple :previewFullImage="true" width="310rpx" height="188rpx">
  29. <image src="https://ship-expert.zhousi.hdlkeji.com/common/upload-back.png" style="width: 310rpx;height: 188rpx;"></image>
  30. <image class="upload_img2" src="https://ship-expert.zhousi.hdlkeji.com/common/upload-top.png"></image>
  31. </u-upload>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="box">
  37. <view class="hflex acenter jbetween cell">
  38. <view class="label">手机号</view>
  39. <u-input v-model="phone" placeholder="请填写你的手机号" inputAlign="right" border="none"></u-input>
  40. </view>
  41. <view class="hflex acenter jbetween cell">
  42. <view class="label">邮箱</view>
  43. <u-input v-model="email" placeholder="请填写你的邮箱" inputAlign="right" border="none"></u-input>
  44. </view>
  45. <view class="hflex acenter jbetween cell" style="border: none;">
  46. <view class="label">地址</view>
  47. <u-input v-model="address" placeholder="请填写你的详细地址" inputAlign="right" border="none"></u-input>
  48. </view>
  49. </view>
  50. <view class="box" style="margin-bottom: 186rpx;">
  51. <view class="cell vflex jbetween">
  52. <view class="label">工作简历</view>
  53. <u-input v-model="resume" placeholder="请详细描述你的工作经历" border="none"></u-input>
  54. </view>
  55. <view class="cell vflex jbetween" style="border: none;">
  56. <view class="label">特长</view>
  57. <u-input v-model="speciality" placeholder="请简单叙述一下你的优点及特长" border="none"></u-input>
  58. </view>
  59. </view>
  60. <view class="bottom">
  61. <view class="bottom_btn" @click="open">立即发布</view>
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. import $api from '@/static/js/api.js'
  67. var that = ''
  68. export default {
  69. data() {
  70. return {
  71. name: '',
  72. work: '',
  73. fileList1: [],
  74. fileList2: [],
  75. fileList3: [],
  76. phone: '',
  77. email: '',
  78. address: '',
  79. resume: '',
  80. speciality: '',
  81. id: ''
  82. }
  83. },
  84. onLoad() {
  85. that = this
  86. },
  87. methods: {
  88. // 立即发布
  89. open() {
  90. uni.showLoading({
  91. title: '发布中',
  92. mask: true
  93. })
  94. if($api.formCheck(that.name,'required') && $api.formCheck(that.work,'required') && $api.formCheck(that.fileList1,'required') && $api.formCheck(that.fileList2,'required') && $api.formCheck(that.fileList3,'required')
  95. && $api.formCheck(that.phone,'mobile') && $api.formCheck(that.email,'required') && $api.formCheck(that.address,'required')&& $api.formCheck(that.resume,'required')&& $api.formCheck(that.speciality,'required')) {
  96. $api.req({
  97. url: '/data/api.auth.ShipEngineMaintenance/subacceptance',
  98. method: 'POST',
  99. data: {
  100. name: that.name,
  101. company_name: that.work,
  102. business_img: that.fileList1[0].url,
  103. id_card_zheng: that.fileList2[0].url,
  104. id_card_fan: that.fileList3[0].url,
  105. phone: that.phone,
  106. email: that.email,
  107. address: that.address,
  108. job_resume: that.resume,
  109. specialty: that.speciality,
  110. province: uni.getStorageSync('location').province,
  111. city: uni.getStorageSync('location').city,
  112. area: uni.getStorageSync('location').district,
  113. id: that.id
  114. }
  115. }, function(res) {
  116. uni.hideLoading()
  117. if(res.code == 1) {
  118. $api.info(res.info)
  119. }
  120. })
  121. }
  122. },
  123. // 删除图片
  124. deletePic(event) {
  125. this[`fileList${event.name}`].splice(event.index, 1)
  126. },
  127. // 新增图片
  128. async afterRead(event) {
  129. uni.showLoading({
  130. title: '上传中',
  131. mask: true
  132. })
  133. let lists = [].concat(event.file)
  134. let fileListLen = this[`fileList${event.name}`].length
  135. lists.map((item) => {
  136. this[`fileList${event.name}`].push({
  137. ...item,
  138. status: 'uploading',
  139. message: '上传中'
  140. })
  141. })
  142. for (let i = 0; i < lists.length; i++) {
  143. const result = await this.uploadFilePromise(lists[i].url)
  144. let item = this[`fileList${event.name}`][fileListLen]
  145. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  146. status: 'success',
  147. message: '',
  148. url: result.url
  149. }))
  150. fileListLen++
  151. if(lists.length - 1 == i) {
  152. uni.hideLoading()
  153. }
  154. }
  155. },
  156. uploadFilePromise(url) {
  157. return new Promise((resolve, reject) => {
  158. let a = uni.uploadFile({
  159. url: $api.config.baseUrl + '/data/api.auth.Center/upload',
  160. filePath: url,
  161. name: 'file',
  162. header: {
  163. 'content-type': 'application/x-www-form-urlencoded',
  164. 'api-token': uni.getStorageSync('token').token?uni.getStorageSync('token').token:'',
  165. 'api-name': 'wxapp'
  166. },
  167. formData: {
  168. user: 'test'
  169. },
  170. success: (res) => {
  171. setTimeout(() => {
  172. var data = JSON.parse(res.data)
  173. resolve(data.data)
  174. }, 1000)
  175. }
  176. });
  177. })
  178. },
  179. },
  180. }
  181. </script>
  182. <style lang="scss" scoped>
  183. .content::v-deep {
  184. background: #F4F4F4;
  185. .box {
  186. width: 690rpx;
  187. margin: 20rpx 30rpx 0;
  188. background: #FFFFFF;
  189. border-radius: 10px;
  190. box-sizing: border-box;
  191. padding: 20rpx;
  192. .cell {
  193. width: 100%;
  194. padding: 32rpx 0 24rpx;
  195. border-bottom: 1rpx solid #F4F4F4;
  196. .label {
  197. font-size: 28rpx;
  198. font-weight: 400;
  199. color: #222222;
  200. line-height: 40rpx;
  201. }
  202. .upload {
  203. box-sizing: border-box;
  204. padding: 40rpx 60rpx;
  205. position: relative;
  206. width: 100%;
  207. height: 400rpx;
  208. background: #F4F4F4;
  209. border-radius: 16rpx;
  210. margin-top: 24rpx;
  211. .upload_img {
  212. position: absolute;
  213. width: 120rpx;
  214. height: 120rpx;
  215. top: 142rpx;
  216. left: 266rpx;
  217. }
  218. }
  219. .upload2 {
  220. position: relative;
  221. .upload_img2 {
  222. position: absolute;
  223. width: 80rpx;
  224. height: 80rpx;
  225. top: 40rpx;
  226. left: 116rpx;
  227. }
  228. }
  229. }
  230. }
  231. .bottom {
  232. width: 100%;
  233. z-index: 9;
  234. position: fixed;
  235. bottom: 0;
  236. height: 166rpx;
  237. background: #FFFFFF;
  238. box-sizing: border-box;
  239. padding: 8rpx 40rpx 74rpx;
  240. .bottom_btn {
  241. width: 100%;
  242. height: 84rpx;
  243. background: #506DFF;
  244. border-radius: 42rpx;
  245. font-size: 36rpx;
  246. font-weight: 500;
  247. color: #FFFFFF;
  248. text-align: center;
  249. line-height: 84rpx;
  250. }
  251. }
  252. }
  253. </style>