宜轩到家/服务到家第三版,换个颜色
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.

319 lines
7.2 KiB

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