index.vue 9.5 KB

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