hehuo.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. <template>
  2. <view>
  3. <view class="hehuo_view">
  4. <image src="/static/image/high_zmjs.png"></image>
  5. <view class="text_view">
  6. <view class="item_view">
  7. <view class="item_title">服务城市 </view>
  8. <input @click="goCity" type="text" v-model="city" placeholder="请输入服务城市 " />
  9. <view class="xian"></view>
  10. </view>
  11. <view class="item_view">
  12. <view class="item_title">姓名</view>
  13. <input type="text" v-model="userName" placeholder="请输入姓名" />
  14. <view class="xian"></view>
  15. </view>
  16. <view class="item_view">
  17. <view class="item_title">联系电话</view>
  18. <input type="number" v-model="phone" maxlength="11" placeholder="请输入联系电话" />
  19. <view class="xian"></view>
  20. </view>
  21. <view class="item_view">
  22. <view class="item_title">年龄</view>
  23. <input type="number" v-model="age" maxlength="11" placeholder="请输入年龄" />
  24. <view class="xian"></view>
  25. </view>
  26. <view class="item_view">
  27. <view class="item_title">头像上传</view>
  28. <view class="flex" style="overflow: hidden;flex-direction: initial;">
  29. <view v-if="headImg.length">
  30. <view class="margin-top flex margin-right-sm">
  31. <view class="flex"
  32. style="width: 150upx;height: 150upx;margin-right: 10rpx;position: relative;">
  33. <image :src="headImg" style="width: 100%;height: 100%;"></image>
  34. <view style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;"
  35. @click="headImgremove(index)">
  36. <u-icon name="close-circle-fill" color="#2979ff" size="50rpx"></u-icon>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="margin-top" @click="addImage()" v-if="headImg.length<=0">
  42. <view style="width: 150upx;height: 150upx;background: #F5F5F5;"
  43. class="flex justify-center align-center">
  44. <view>
  45. <view class="text-center">
  46. <image src="../../static/images/my/add.png"
  47. style="width: 54upx;height: 47upx;position: relative;">
  48. </image>
  49. </view>
  50. <view class="text-center text-xs margin-top-xs">上传图片</view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <!-- <view class="audit_message" v-if="auditContent != '' && bb == 3">拒绝原因:{{auditContent}}</view> -->
  57. <view class="save_btn" @tap="save" v-if="bb !=0">提交申请</view>
  58. <!-- <view class="save_btn" v-if="status == 0">审核中</view> -->
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. import configdata from '../../common/config.js';
  65. export default {
  66. data() {
  67. return {
  68. hotCitys: ['杭州', '天津', '北京', '上海', '深圳', '广州', '成都', '重庆', '厦门'],
  69. locationValue: '正在定位...',
  70. // auditContent: '',
  71. city: '',
  72. money: '',
  73. teamNumber: '',
  74. userName: '',
  75. phone: '',
  76. age: '',
  77. headImg: [],
  78. bb:true,
  79. }
  80. },
  81. onLoad() {
  82. this.getChannel();
  83. },
  84. methods: {
  85. // 本人近期照删除
  86. headImgremove(index) {
  87. this.headImg = ''
  88. },
  89. getChannel() {
  90. let userId = this.$queue.getData('userId');
  91. this.$Request.getT('/app/artificer/selectAgencyById?userId=' + userId).then(res => {
  92. if (res.code == 0) {
  93. if (res.data == null) {
  94. this.bb = 1;
  95. } else {
  96. this.bb = res.data.status;
  97. this.city = res.data.city;
  98. this.age = res.data.age;
  99. this.headImg = res.data.img;
  100. this.userName = res.data.name;
  101. this.phone = res.data.phone;
  102. }
  103. console.log(this.bb)
  104. // this.auditContent = res.data.auditContent;
  105. }
  106. });
  107. },
  108. //获取省市区
  109. Getcity(latitude, longitude) {
  110. this.$Request.get("/app/Login/selectCity", {
  111. lat: latitude,
  112. lng: longitude
  113. }).then(res => {
  114. console.log(res)
  115. this.city = res.data.city
  116. console.log(this.address)
  117. });
  118. },
  119. goCity() {
  120. let that = this
  121. uni.chooseLocation({
  122. success: function(res) {
  123. console.log('位置名称:' + res.name);
  124. console.log('详细地址:' + res.address);
  125. console.log('纬度:' + res.latitude);
  126. console.log('经度:' + res.longitude);
  127. // that.city = res.address || '郑州'
  128. that.Getcity(res.latitude, res.longitude)
  129. }
  130. });
  131. // uni.getLocation({
  132. // type: 'wgs84',
  133. // geocode: true,
  134. // success: function(res) {
  135. // console.log('当前位置:' + res.address.city);
  136. // that.city = res.address.city || '郑州'
  137. // }
  138. // });
  139. },
  140. save() {
  141. // let isStudent = this.$queue.getData("isStudent");
  142. // if (isStudent != 2) {
  143. // uni.showModal({
  144. // title: '温馨提示',
  145. // content: '您还没有进行实名认证,请认证完成之后再来操作吧!',
  146. // showCancel: true,
  147. // cancelText: '取消',
  148. // confirmText: '确认',
  149. // success: res => {
  150. // if (res.confirm) {
  151. // uni.navigateTo({
  152. // url: '/offlinetask/pages/public/authentication'
  153. // });
  154. // }
  155. // }
  156. // });
  157. // return;
  158. // }
  159. // this.form.headImg = this.headImg
  160. // this.headImg = this.headImg.toString();
  161. if (this.city === '') {
  162. this.$queue.showToast('请输入服务城市 ')
  163. return;
  164. }
  165. if (this.userName === '') {
  166. this.$queue.showToast('请输入姓名')
  167. return;
  168. }
  169. if (this.phone === '' || this.phone.length != 11) {
  170. this.$queue.showToast('请输入正确的手机号!')
  171. return;
  172. }
  173. if (this.age === '') {
  174. this.$queue.showToast('请输入年龄')
  175. return;
  176. }
  177. if (this.headImg == '') {
  178. this.$queue.showToast('请上传头像')
  179. return;
  180. }
  181. let userId = this.$queue.getData('userId');
  182. let data = {
  183. userId: userId,
  184. name: this.userName,
  185. phone: this.phone,
  186. age: this.age,
  187. city: this.city,
  188. img: this.headImg,
  189. }
  190. this.$Request.postJson('/app/artificer/insertAgency', data).then(res => {
  191. if (res.code == 0) {
  192. uni.hideLoading();
  193. this.$queue.showToast('提交成功!');
  194. setTimeout(d => {
  195. uni.navigateBack();
  196. }, 1000);
  197. } else {
  198. uni.hideLoading();
  199. this.$queue.showToast(res.msg);
  200. }
  201. });
  202. },
  203. config: function(name) {
  204. var info = null;
  205. if (name) {
  206. var name2 = name.split("."); //字符分割
  207. if (name2.length > 1) {
  208. info = configdata[name2[0]][name2[1]] || null;
  209. } else {
  210. info = configdata[name] || null;
  211. }
  212. if (info == null) {
  213. let web_config = cache.get("web_config");
  214. if (web_config) {
  215. if (name2.length > 1) {
  216. info = web_config[name2[0]][name2[1]] || null;
  217. } else {
  218. info = web_config[name] || null;
  219. }
  220. }
  221. }
  222. }
  223. return info;
  224. },
  225. addImage() {
  226. let that = this
  227. uni.chooseImage({
  228. count: 1,
  229. sourceType: ['album', 'camera'],
  230. success: res => {
  231. for (let i = 0; i < 1; i++) {
  232. that.$queue.showLoading("上传中...");
  233. uni.uploadFile({ // 上传接口
  234. url: that.config("APIHOST1") + '/alioss/upload', //真实的接口地址
  235. filePath: res.tempFilePaths[i],
  236. name: 'file',
  237. success: (uploadFileRes) => {
  238. console.log(uploadFileRes.data)
  239. that.headImg = JSON.parse(uploadFileRes.data).data
  240. console.log(that.headImg)
  241. uni.hideLoading();
  242. }
  243. });
  244. }
  245. }
  246. })
  247. },
  248. }
  249. }
  250. </script>
  251. <style lang="less">
  252. @import '../../static/less/index.less';
  253. @import '../../static/css/index.css';
  254. .hehuo_view {
  255. width: 750rpx;
  256. height: 1830upx;
  257. image {
  258. width: 750rpx;
  259. height: 1830upx;
  260. background-size: 100%;
  261. position: absolute;
  262. }
  263. .text_view {
  264. position: absolute;
  265. z-index: 1;
  266. width: 84%;
  267. margin: 660rpx 50rpx 30rpx;
  268. .audit_message {
  269. color: red;
  270. width: 650rpx;
  271. height: 50rpx;
  272. margin-top: 50rpx;
  273. }
  274. .save_btn {
  275. width: 650rpx;
  276. height: 88rpx;
  277. background: #FFFFFF;
  278. border-radius: 10rpx;
  279. text-align: center;
  280. line-height: 88rpx;
  281. /* #ifdef MP-WEIXIN */
  282. margin-top: 150rpx;
  283. /* #endif */
  284. /* #ifdef H5 */
  285. margin-top: 100rpx;
  286. /* #endif */
  287. /* #ifdef APP-PLUS */
  288. margin-top: 180rpx;
  289. /* #endif */
  290. }
  291. .save_btn1 {
  292. width: 650rpx;
  293. height: 88rpx;
  294. background: #FFFFFF;
  295. border-radius: 10rpx;
  296. margin-top: 100rpx;
  297. text-align: center;
  298. line-height: 88rpx;
  299. }
  300. .item_view {
  301. margin-top: 30rpx;
  302. .item_title {
  303. font-size: 28rpx;
  304. font-family: PingFang SC Heavy, PingFang SC Heavy-Heavy;
  305. font-weight: 800;
  306. color: #333333;
  307. }
  308. input {
  309. margin-top: 20rpx;
  310. height: 40rpx;
  311. font-size: 24rpx;
  312. font-family: PingFang SC Regular, PingFang SC Regular-Regular;
  313. font-weight: 400;
  314. color: #333333;
  315. }
  316. .xian {
  317. width: 630rpx;
  318. height: 1rpx;
  319. border: 1rpx solid #77D7B0;
  320. margin-top: 10rpx;
  321. }
  322. }
  323. }
  324. }
  325. </style>