You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

343 lines
8.4 KiB

8 months ago
8 months ago
  1. <template>
  2. <view class="content" style="padding-bottom: 90rpx;">
  3. <mNavbar title="订单详情"
  4. :leftClick="toLeft"
  5. />
  6. <view class="banner"></view>
  7. <view class="b-relative" style="width: 710rpx;height: 310rpx; margin: -174rpx auto 0;">
  8. <image src="/static/ms/settled.png" style="width: 710rpx;height: 310rpx;"></image>
  9. <view class="banner-font">
  10. <image style="width: 380rpx;height: 98rpx;" src="/static/ms/fontjszm.png"></image>
  11. </view>
  12. <view class="font-3">打造专业的技术服务</view>
  13. <view class="banner-button">立即联系我们>></view>
  14. </view>
  15. <view>
  16. <view class="item-card">
  17. <view class="item-line flex">
  18. <view class="before"></view>
  19. <view class="label">技师姓名</view>
  20. <input placeholder="请输入姓名" v-model="technician.name" />
  21. </view>
  22. <view class="item-line flex">
  23. <view class="before"></view>
  24. <view class="label">技师性别</view>
  25. <input placeholder="请选择性别" v-model="technician.sex"/>
  26. </view>
  27. <view class="item-line flex">
  28. <view class="before"></view>
  29. <view class="label">联系方式</view>
  30. <input placeholder="请输入联系方式" v-model="technician.phone" />
  31. </view>
  32. <view class="item-line flex">
  33. <view class="before"></view>
  34. <view class="label">技师年龄</view>
  35. <input placeholder="请输入技师年龄" type="number" v-model.number="technician.age" />
  36. </view>
  37. <view class="item-line flex">
  38. <view class="before"></view>
  39. <view class="label">意向城市</view>
  40. <input placeholder="请输入意向工作城市" v-model="technician.city" />
  41. </view>
  42. <view class="item-line flex">
  43. <view class="before"></view>
  44. <view class="label" style="width: 100%">请上传本人近期照片</view>
  45. </view>
  46. <view v-if="!technician.image" @click="fileUploads" class="upload b-relative">
  47. <uni-icons type="plusempty" size="80rpx" color="#37bea7"
  48. style="position: absolute; top: 50rpx; left: 60rpx;" />
  49. </view>
  50. <view v-else @click="fileUploads" class="upload b-relative">
  51. <image class="upload-img" :src="technician.image" mode="aspectFill"></image>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="b-fiexd">
  56. <view @click="addOrUpdateMsgTer" class="button-submit">提交</view>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import OSS from "ali-oss"
  62. import { v4 as uuidv4 } from 'uuid';
  63. import mNavbar from '@/components/base/m-navbar.vue'
  64. export default {
  65. components : {
  66. mNavbar
  67. },
  68. data() {
  69. return {
  70. technician: {
  71. name : '',
  72. sex : '',
  73. phone : '',
  74. age : '',
  75. city : '',
  76. image : ''
  77. },
  78. ossOption: {
  79. region : 'oss-cn-shenzhen',
  80. accessKey: 'LTAI5tMan18fjJPUtr3Aim2W',
  81. secretKey: 'lhALqqgYijc115wY8c1KfTYkbSnq5I',
  82. endpoint: 'oss-cn-shenzhen.aliyuncs.com',
  83. bucketName: 'mangoimageapplet',
  84. staticDomain: 'https://dianpin-img.xzaiyp.top'
  85. },
  86. imgs : []
  87. }
  88. },
  89. onShow(){
  90. },
  91. methods: {
  92. getUserInfo() { //获取用户信息
  93. this.$api('getUserInfo', {}, res => {
  94. if (res.code == 200) {
  95. this.userInfo = res.result;
  96. }
  97. })
  98. },
  99. addOrUpdateMsgTer() { //新增修改技师入驻信息
  100. let isOk = this.parameterVerification()
  101. if(!isOk.auth){
  102. return uni.showToast({
  103. title : isOk.title,
  104. icon : 'none'
  105. })
  106. }
  107. this.$api('addOrUpdateMsgTer', this.technician, res => {
  108. if (res.code == 200) {
  109. uni.showModal({
  110. title: '技师入驻',
  111. content: '技师入驻提交成功',
  112. confirmText : '确认',
  113. cancelText : '取消',
  114. showCancel: false,//没有取消按钮的弹框
  115. success: function (res) {
  116. if (res.confirm) {
  117. uni.switchTab({
  118. url: '/pages/index/center'
  119. })
  120. } else if (res.cancel) {}
  121. }
  122. });
  123. }
  124. })
  125. },
  126. parameterVerification(){ //验证用户参数合法性
  127. let { name , sex , phone , age , city , image } = this.technician
  128. if(name.trim() == ''){
  129. return { title : '请填写用户名' , auth : false }
  130. }else if(sex.trim() == ''){
  131. return { title : '请选择性别' , auth : false }
  132. }else if(phone.trim() == ''){
  133. return { title : '请填写手机号' , auth : false }
  134. }else if(phone){
  135. if(!/^1(3|4[0-9]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9\d)\d{8}$/.test(phone)){
  136. return { title : '手机号格式不合法' , auth : false }
  137. }
  138. }else if(age){
  139. return { title : '请填写手机号' , auth : false }
  140. }else if(city.trim() == ''){
  141. return { title : '请填写意向城市' , auth : false }
  142. }else if(image.trim() == ''){
  143. return { title : '请上传近期照片' , auth : false }
  144. }
  145. return { title : '验证通过' , auth : true }
  146. },
  147. fileUploads() { //上传文件
  148. uni.chooseImage({
  149. count: 1, // 默认9,设置为1表示单选
  150. sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
  151. sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
  152. success: (res) => {
  153. let resultPromise = [];
  154. //上传多张图片逻辑
  155. // res.tempFiles.forEach(file => {
  156. // resultPromise.push(this.uploadFileToOSS(file));
  157. // })
  158. // Promise.all(resultPromise).then(imgPathArr => {
  159. // this.imgs = imgPathArr
  160. // })
  161. //上传单张图片逻辑
  162. this.uploadFileToOSS(res.tempFiles[0]).then(imgPath => {
  163. this.technician.image = imgPath;
  164. })
  165. }
  166. });
  167. },
  168. toLeft(){
  169. uni.switchTab({
  170. url: '/pages/index/center'
  171. })
  172. }
  173. }
  174. }
  175. </script>
  176. <style scoped>
  177. body {
  178. background-color: #f5f5f5;
  179. }
  180. .banner {
  181. width: 100vw;
  182. height: calc(392rpx - 160rpx);
  183. background: linear-gradient(38deg, #4899a6 44%, #60bda2 100%);
  184. }
  185. .banner-font {
  186. width: 292rpx;
  187. height: 142rpx;
  188. font-size: 72rpx;
  189. line-height: 66rpx;
  190. font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  191. font-weight: 400;
  192. text-align: left;
  193. color: #ffffff;
  194. letter-spacing: -1;
  195. text-shadow: 0px 6px 6px 0px rgba(0, 165, 141, 0.70);
  196. position: absolute;
  197. left: 52rpx;
  198. top: 34rpx;
  199. }
  200. .font-3 {
  201. height: 28rpx;
  202. line-height: 28rpx;
  203. font-size: 24rpx;
  204. font-family: PingFang SC, PingFang SC-Regular;
  205. font-weight: 400;
  206. text-align: left;
  207. color: #ffffff;
  208. text-shadow: 0 4rpx 6rpx 0 rgba(0, 165, 141, 0.70);
  209. position: absolute;
  210. left: 52rpx;
  211. top: 138rpx;
  212. }
  213. .banner-button {
  214. width: 240rpx;
  215. height: 56rpx;
  216. line-height: 56rpx;
  217. background: #ffdb75;
  218. border-radius: 24rpx;
  219. box-shadow: 0 6rpx 6rpx 0 rgba(17, 106, 93, 0.23);
  220. position: absolute;
  221. left: 52rpx;
  222. top: 220rpx;
  223. font-size: 24rpx;
  224. font-family: PingFang SC, PingFang SC-Bold;
  225. font-weight: 700;
  226. text-align: center;
  227. color: #26c591;
  228. }
  229. .item-card {
  230. width: calc(710rpx - 40rpx);
  231. height: 840rpx;
  232. background: #ffffff;
  233. border-radius: 16rpx;
  234. margin: 40rpx auto 20rpx;
  235. padding: 1rpx 20rpx;
  236. }
  237. .item-line {
  238. height: 60rpx;
  239. font-size: 28rpx;
  240. font-family: PingFang SC, PingFang SC-Bold;
  241. font-weight: 700;
  242. text-align: left;
  243. color: #333333;
  244. margin-top: 40rpx;
  245. }
  246. .item-line .before {
  247. content: "";
  248. width: 8rpx;
  249. height: 30rpx;
  250. background: #4fd3bc;
  251. border-radius: 4rpx;
  252. margin-right: 10rpx;
  253. margin-top: 15rpx;
  254. }
  255. .item-line .label {
  256. display: flex;
  257. align-items: center;
  258. width: 152rpx;
  259. height: 60rpx;
  260. }
  261. .item-line input {
  262. width: 456rpx;
  263. height: 60rpx;
  264. line-height: 60rpx;
  265. background: #f5f5f5;
  266. border-radius: 12rpx;
  267. font-size: 24rpx;
  268. font-family: PingFang SC, PingFang SC-Medium;
  269. font-weight: 500;
  270. text-align: left;
  271. color: #939393;
  272. padding: 0 20rpx;
  273. }
  274. .upload {
  275. display: flex;
  276. align-items: center;
  277. justify-content: center;
  278. width: 200rpx;
  279. height: 200rpx;
  280. background: rgba(245, 245, 245, 0.82);
  281. border: 2rpx dashed #99dcd0;
  282. border-radius: 16rpx;
  283. margin: 10rpx 12rpx;
  284. }
  285. .upload-img{
  286. width: calc(100% - 4rpx);
  287. height: calc(100% - 4rpx);
  288. border: 2rpx dashed #ccc;
  289. margin: 2rpx;
  290. }
  291. .button-submit {
  292. display: flex;
  293. align-items: center;
  294. justify-content: center;
  295. width: 596rpx;
  296. height: 90rpx;
  297. background: linear-gradient(180deg, #6fdfbe, #5ac796);
  298. border-radius: 46rpx;
  299. margin: 20rpx auto;
  300. font-size: 28rpx;
  301. font-family: PingFang SC, PingFang SC-Regular;
  302. font-weight: 400;
  303. text-align: center;
  304. color: #ffffff;
  305. }
  306. </style>