index.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <view>
  3. <view class="hehuo_view" v-if="XCXIsSelect=='是'">
  4. <image src="../../static/images/my/hezuobg.png"></image>
  5. <view class="text_view">
  6. <view class="item_view">
  7. <view class="item_title">意向代理城市</view>
  8. <input @click="goCity" type="text" disabled 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. export default {
  65. data() {
  66. return {
  67. hotCitys: ['杭州', '天津', '北京', '上海', '深圳', '广州', '成都', '重庆', '厦门'],
  68. locationValue: '正在定位...',
  69. // auditContent: '',
  70. city: '',
  71. money: '',
  72. teamNumber: '',
  73. userName: '',
  74. phone: '',
  75. age: '',
  76. headImg: [],
  77. bb:true,
  78. XCXIsSelect: '是',
  79. }
  80. },
  81. onLoad() {
  82. this.XCXIsSelect = this.$queue.getData('XCXIsSelect');
  83. if (this.XCXIsSelect == '否') {
  84. uni.setNavigationBarTitle({
  85. title: '隐私政策'
  86. });
  87. } else {
  88. uni.setNavigationBarTitle({
  89. title: '骑手招募'
  90. });
  91. }
  92. this.getChannel();
  93. },
  94. methods: {
  95. // 头像删除
  96. headImgremove(index) {
  97. this.headImg = ''
  98. },
  99. getChannel() {
  100. let userId = this.$queue.getData('userId');
  101. this.$Request.getT('/app/artificer/selectAgencyById?userId=' + userId).then(res => {
  102. if (res.code == 0) {
  103. if (res.data == null) {
  104. this.bb = 1;
  105. } else {
  106. this.bb = res.data.status;
  107. this.city = res.data.city;
  108. this.age = res.data.age;
  109. this.headImg = res.data.img;
  110. this.userName = res.data.name;
  111. this.phone = res.data.phone;
  112. }
  113. console.log(this.bb)
  114. // this.auditContent = res.data.auditContent;
  115. }
  116. });
  117. },
  118. //获取省市区
  119. Getcity(latitude, longitude) {
  120. this.$Request.get("/app/Login/selectCity", {
  121. lat: latitude,
  122. lng: longitude
  123. }).then(res => {
  124. console.log(res)
  125. this.city = res.data.city
  126. console.log(this.address)
  127. });
  128. },
  129. goCity() {
  130. let that = this
  131. uni.chooseLocation({
  132. success: function(res) {
  133. console.log('位置名称:' + res.name);
  134. console.log('详细地址:' + res.address);
  135. console.log('纬度:' + res.latitude);
  136. console.log('经度:' + res.longitude);
  137. // that.city = res.address || '郑州'
  138. that.Getcity(res.latitude, res.longitude)
  139. }
  140. });
  141. // uni.getLocation({
  142. // type: 'gcj02',
  143. // geocode: true,
  144. // success: function(res) {
  145. // console.log('当前位置:' + res.address.city);
  146. // that.city = res.address.city || '郑州'
  147. // }
  148. // });
  149. },
  150. save() {
  151. // let isStudent = this.$queue.getData("isStudent");
  152. // if (isStudent != 2) {
  153. // uni.showModal({
  154. // title: '温馨提示',
  155. // content: '您还没有进行实名认证,请认证完成之后再来操作吧!',
  156. // showCancel: true,
  157. // cancelText: '取消',
  158. // confirmText: '确认',
  159. // success: res => {
  160. // if (res.confirm) {
  161. // uni.navigateTo({
  162. // url: '/offlinetask/pages/public/authentication'
  163. // });
  164. // }
  165. // }
  166. // });
  167. // return;
  168. // }
  169. // this.form.headImg = this.headImg
  170. // this.headImg = this.headImg.toString();
  171. if (this.city === '') {
  172. this.$queue.showToast('请输入代理城市')
  173. return;
  174. }
  175. if (this.userName === '') {
  176. this.$queue.showToast('请输入姓名')
  177. return;
  178. }
  179. if (this.phone === '' || this.phone.length != 11) {
  180. this.$queue.showToast('请输入正确的手机号!')
  181. return;
  182. }
  183. if (this.age === '') {
  184. this.$queue.showToast('请输入年龄')
  185. return;
  186. }
  187. if (this.headImg == '') {
  188. this.$queue.showToast('请上传头像')
  189. return;
  190. }
  191. let userId = this.$queue.getData('userId');
  192. let data = {
  193. userId: userId,
  194. name: this.userName,
  195. phone: this.phone,
  196. age: this.age,
  197. city: this.city,
  198. img: this.headImg,
  199. }
  200. this.$Request.postJson('/app/artificer/insertAgency', data).then(res => {
  201. if (res.code == 0) {
  202. uni.hideLoading();
  203. this.$queue.showToast('提交成功!');
  204. setTimeout(d => {
  205. uni.navigateBack();
  206. }, 1000);
  207. } else {
  208. uni.hideLoading();
  209. this.$queue.showToast(res.msg);
  210. }
  211. });
  212. },
  213. addImage() {
  214. let that = this
  215. uni.chooseImage({
  216. count: 1,
  217. sourceType: ['album', 'camera'],
  218. success: res => {
  219. for (let i = 0; i < 1; i++) {
  220. that.$queue.showLoading("上传中...");
  221. uni.uploadFile({ // 上传接口
  222. url: that.config("APIHOST1") + '/alioss/upload', //真实的接口地址
  223. // url: 'https://anmo.xianmxkj.com/sqx_fast/alioss/upload',
  224. filePath: res.tempFilePaths[i],
  225. name: 'file',
  226. success: (uploadFileRes) => {
  227. console.log(uploadFileRes.data)
  228. that.headImg = JSON.parse(uploadFileRes.data).data
  229. console.log(that.headImg)
  230. uni.hideLoading();
  231. }
  232. });
  233. }
  234. }
  235. })
  236. },
  237. }
  238. }
  239. </script>
  240. <style lang="less">
  241. // @import '../../static/less/index.less';
  242. // @import '../../static/css/index.css';
  243. .hehuo_view {
  244. width: 750rpx;
  245. height: 1830upx;
  246. image {
  247. width: 750rpx;
  248. height: 1830upx;
  249. background-size: 100%;
  250. position: absolute;
  251. }
  252. .text_view {
  253. position: absolute;
  254. z-index: 1;
  255. width: 84%;
  256. margin: 660rpx 50rpx 30rpx;
  257. .audit_message {
  258. color: red;
  259. width: 650rpx;
  260. height: 50rpx;
  261. margin-top: 50rpx;
  262. }
  263. .save_btn {
  264. width: 650rpx;
  265. height: 88rpx;
  266. background: #FFFFFF;
  267. border-radius: 10rpx;
  268. text-align: center;
  269. line-height: 88rpx;
  270. /* #ifdef MP-WEIXIN */
  271. margin-top: 150rpx;
  272. /* #endif */
  273. /* #ifdef H5 */
  274. margin-top: 100rpx;
  275. /* #endif */
  276. /* #ifdef APP-PLUS */
  277. margin-top: 180rpx;
  278. /* #endif */
  279. }
  280. .save_btn1 {
  281. width: 650rpx;
  282. height: 88rpx;
  283. background: #FFFFFF;
  284. border-radius: 10rpx;
  285. margin-top: 100rpx;
  286. text-align: center;
  287. line-height: 88rpx;
  288. }
  289. .item_view {
  290. margin-top: 30rpx;
  291. .item_title {
  292. font-size: 28rpx;
  293. font-family: PingFang SC Heavy, PingFang SC Heavy-Heavy;
  294. font-weight: 800;
  295. color: #333333;
  296. }
  297. input {
  298. margin-top: 20rpx;
  299. height: 40rpx;
  300. font-size: 24rpx;
  301. font-family: PingFang SC Regular, PingFang SC Regular-Regular;
  302. font-weight: 400;
  303. color: #333333;
  304. }
  305. .xian {
  306. width: 630rpx;
  307. height: 1rpx;
  308. border: 1rpx solid #77D7B0;
  309. margin-top: 10rpx;
  310. }
  311. }
  312. }
  313. }
  314. </style>