brokerform.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. <template>
  2. <view>
  3. <view class="header" :style="'background-image:url('+$getImageUrl('static/images/applet/bg/broker.png')+');'">
  4. <image class="header-icon" :src="$getImageUrl('static/images/applet/index/topApplyIcon.png')"></image>
  5. </view>
  6. <view class="broKerForm">
  7. <view class="broKerForm-item">
  8. <view class="item-title">姓名</view>
  9. <view class="item-area">
  10. <input class="item-area-input" placeholder="请输入姓名" data-val="title" @input="bindInput"
  11. placeholder-style="color: #979797;"></input>
  12. </view>
  13. </view>
  14. <view class="broKerForm-item">
  15. <view class="item-title">手机号</view>
  16. <view class="item-area">
  17. <input class="item-area-input" placeholder="请输入手机号" data-val="mobile" @input="bindInput"
  18. placeholder-style="color: #979797;"></input>
  19. </view>
  20. </view>
  21. <view class="broKerForm-item">
  22. <view class="title">
  23. 类型
  24. </view>
  25. <view class="item-area">
  26. <picker @change="TypeChange" :value="typeIndex" :range="typeArray">
  27. <view class="picker">
  28. {{typeIndex>-1?typeArray[typeIndex]:'请选择类型'}}
  29. </view>
  30. </picker>
  31. </view>
  32. </view>
  33. <view class="broKerForm-item">
  34. <view class="item-title">代理门店</view>
  35. <view class="item-area">
  36. <picker mode="selector" @change="agentChange" :value="agentIndex" :range="agentArray"
  37. range-key="title">
  38. <view class="picker">
  39. {{agentArray[agentIndex].title}}
  40. </view>
  41. </picker>
  42. <!-- <u-icon name="arrow-right" color="#747474" size="15"></u-icon> -->
  43. </view>
  44. </view>
  45. <view class="broKerForm-item">
  46. <view class="item-title">镇/街道</view>
  47. <view class="item-area">
  48. <picker mode="multiSelector" @change="TownChange" @columnchange="TownColumnChange"
  49. :value="townIndex" :range="townArray">
  50. <view class="picker">
  51. {{townArray[0][townIndex[0]]}},{{townArray[1][townIndex[1]]}}
  52. </view>
  53. </picker>
  54. <!-- <u-icon name="arrow-right" color="#747474" size="15"></u-icon> -->
  55. </view>
  56. </view>
  57. <view class="broKerForm-item">
  58. <view class="item-title">区域</view>
  59. <view class="item-area">
  60. <input class="item-area-input" placeholder="请输入区域" data-val="region" @input="bindInput"
  61. placeholder-style="color: #979797;"></input>
  62. </view>
  63. </view>
  64. <view class="broKerForm-item">
  65. <view class="item-title">工作地点</view>
  66. <view class="item-area-column" style="background-color: #FFFFFF;">
  67. <view class="item-area-column-input">
  68. <input class="item-area-input" placeholder="详细地址" disabled :value="address"></input>
  69. <u-icon name="map-fill" color="#8e99a2" size="28" @tap="gpsmap()"></u-icon>
  70. </view>
  71. <!-- <button class="cu-btn bg-blue margin-tb-sm lg" style="width: 100%;" @tap="gpsmap()">地图选位置</button> -->
  72. </view>
  73. </view>
  74. </view>
  75. <view class="bottomEmpty"></view>
  76. <view class="bottomArea">
  77. <view class="bottomButton" @tap="submit">立即提交</view>
  78. </view>
  79. <form v-if="false">
  80. <view class="cu-form-group margin-top">
  81. <view class="title"><text class="text-red text-bold padding-right-xs">*</text>姓名</view>
  82. <input placeholder="请输入姓名" data-val="title" @input="bindInput"></input>
  83. </view>
  84. <view class="cu-form-group">
  85. <view class="title"><text class="text-red text-bold padding-right-xs">*</text>手机号</view>
  86. <input placeholder="请输入手机号" data-val="mobile" @input="bindInput"></input>
  87. </view>
  88. <view class="cu-form-group">
  89. <view class="title"><text class="text-red text-bold padding-right-xs">*</text>代理门店</view>
  90. <picker mode="selector" @change="agentChange" :value="agentIndex" :range="agentArray" range-key="title">
  91. <view class="picker">
  92. {{agentArray[agentIndex].title}}
  93. </view>
  94. </picker>
  95. </view>
  96. <view class="cu-form-group">
  97. <view class="title"><text class="text-red text-bold padding-right-xs">*</text>镇街</view>
  98. <picker mode="multiSelector" @change="TownChange" @columnchange="TownColumnChange" :value="townIndex"
  99. :range="townArray">
  100. <view class="picker">
  101. {{townArray[0][townIndex[0]]}},{{townArray[1][townIndex[1]]}}
  102. </view>
  103. </picker>
  104. </view>
  105. <view class="cu-form-group">
  106. <view class="title"><text class="text-red text-bold padding-right-xs">*</text>区域</view>
  107. <input placeholder="请输入区域" data-val="region" @input="bindInput"></input>
  108. </view>
  109. <view class="cu-form-group">
  110. <view class="title"> <text class="text-red text-bold padding-right-xs">*</text> 工作地点</view>
  111. <view style="flex: 1; font-size: 30rpx; color: #AAAAAA; line-height: 100rpx;">
  112. <input placeholder="详细地址" disabled :value="address" v-if="address"></input>
  113. <button class="cu-btn bg-blue margin-tb-sm lg" style="width: 100%;" @tap="gpsmap()">地图选位置</button>
  114. </view>
  115. </view>
  116. <view class="padding flex flex-direction bg-white">
  117. <button class="cu-btn bg-blue margin-tb-sm lg" @tap="submit">立即提交</button>
  118. </view>
  119. <view class="bg-white padding-lr padding-bottom">申请经济人后等待后台审核</view>
  120. </form>
  121. </view>
  122. </template>
  123. <script>
  124. var _this;
  125. export default {
  126. data() {
  127. return {
  128. isRotate: false,
  129. address: '',
  130. userinfo: {},
  131. forminfo: {
  132. title: '',
  133. mobile: '',
  134. region: '',
  135. latitude: 0,
  136. longitude: 0,
  137. },
  138. agentArray: [],
  139. agentIndex: 0,
  140. townArray: [
  141. [],
  142. [],
  143. ],
  144. townIndex: [0, 0],
  145. village: [],
  146. typeArray: ['经纪人','红色合伙人'],
  147. typeIndex: 0,
  148. };
  149. },
  150. onLoad: function() {
  151. _this = this;
  152. _this.userinfo = _this.checkLogin("/pages/my/myinfo");
  153. //公司
  154. _this.$req.ajax({
  155. path: "index/getAgent",
  156. data: {}
  157. }).then((data) => {
  158. _this.agentArray = data;
  159. }).catch((err) => {
  160. uni.showModal({
  161. title: '信息提示',
  162. content: err,
  163. showCancel: false
  164. });
  165. });
  166. //镇街
  167. _this.$req.ajax({
  168. path: "index/getTown",
  169. data: {}
  170. }).then((data) => {
  171. _this.townArray = [data.town, data.village[0]];
  172. _this.village = data.village
  173. }).catch((err) => {
  174. uni.showModal({
  175. title: '信息提示',
  176. content: err,
  177. showCancel: false
  178. });
  179. });
  180. },
  181. methods: {
  182. bindInput(e) {
  183. var dataval = e.currentTarget.dataset.val;
  184. _this.forminfo[dataval] = e.detail.value;
  185. },
  186. agentChange(e) {
  187. this.agentIndex = e.detail.value
  188. },
  189. TypeChange(e){
  190. this.typeIndex = e.detail.value
  191. },
  192. TownChange(e) {
  193. this.townIndex = e.detail.value
  194. },
  195. TownColumnChange(e) {
  196. let townIndex = _this.townIndex;
  197. //公司变更
  198. if (e.detail.column == 0) {
  199. _this.townArray[1] = _this.village[e.detail.value];
  200. _this.townIndex = [e.detail.value, 0];
  201. _this.$forceUpdate();
  202. }
  203. //街道变更
  204. if (e.detail.column == 1) {
  205. townIndex[1] = e.detail.value;
  206. _this.townIndex = townIndex;
  207. _this.$forceUpdate();
  208. }
  209. },
  210. RegionChange(e) {
  211. this.region = e.detail.value
  212. },
  213. //打开地图
  214. gpsmap: function() {
  215. uni.chooseLocation({
  216. success: function(res) {
  217. console.log("选择位置", res)
  218. _this.address = res.address;
  219. _this.forminfo.latitude = res.latitude;
  220. _this.forminfo.longitude = res.longitude;
  221. }
  222. });
  223. },
  224. submit() {
  225. if (_this.isRotate) {
  226. return false;
  227. }
  228. _this.isRotate = true;
  229. let data = _this.forminfo;
  230. let validate = {
  231. "title": "姓名",
  232. "mobile": "手机号",
  233. "region": "区域",
  234. "latitude": "请点击地图选择位置"
  235. };
  236. for (var i in validate) {
  237. if (data[i] == "") {
  238. uni.showModal({
  239. title: '信息提示',
  240. content: validate[i] + "不能为空",
  241. showCancel: false
  242. });
  243. _this.isRotate = false;
  244. return false;
  245. }
  246. }
  247. data.userid = _this.userinfo.id;
  248. data.workerid = _this.agentArray[_this.agentIndex].workerid;
  249. data.agentid = _this.agentArray[_this.agentIndex].id;
  250. data.town = _this.townArray[0][_this.townIndex[0]];
  251. data.village = _this.townArray[1][_this.townIndex[1]];
  252. data.type = _this.typeIndex - 0 + 1;
  253. _this.$req.ajax({
  254. path: "broker/apply",
  255. data: data
  256. }).then((data) => {
  257. uni.showModal({
  258. title: '信息提示',
  259. content: '提交成功,等待管理员审核',
  260. showCancel: false,
  261. success: function() {
  262. uni.reLaunch({
  263. url: '/pages/index/index'
  264. });
  265. },
  266. });
  267. }).catch((err) => {
  268. uni.showModal({
  269. title: '信息提示',
  270. content: err,
  271. showCancel: false
  272. });
  273. _this.isRotate = false;
  274. });
  275. },
  276. }
  277. }
  278. </script>
  279. <style lang="scss">
  280. .cu-form-group .title {
  281. min-width: calc(4em + 15px);
  282. }
  283. .header {
  284. width: 100%;
  285. height: 266rpx;
  286. padding-left: 46rpx;
  287. background: linear-gradient(270deg, #484353 0%, #6F6F6F 100%);
  288. opacity: 1;
  289. display: flex;
  290. align-items: center;
  291. background-size: cover;
  292. background-position: center;
  293. .header-icon {
  294. width: 97rpx;
  295. height: 97rpx;
  296. }
  297. }
  298. .broKerForm {
  299. padding: 40rpx 70rpx;
  300. background-color: #FFFFFF;
  301. .broKerForm-item {
  302. margin-bottom: 35rpx;
  303. .item-area-column {
  304. margin-top: 15rpx;
  305. width: 100%;
  306. font-size: 28rpx;
  307. color: #979797;
  308. display: flex;
  309. flex-direction: column;
  310. .item-area-column-input {
  311. margin-bottom: 20rpx;
  312. padding: 0 36rpx;
  313. height: 100rpx;
  314. background: #F7F7F7;
  315. display: flex;
  316. align-items: center;
  317. justify-content: space-between;
  318. .item-area-input {
  319. flex: 1;
  320. height: 100rpx;
  321. }
  322. }
  323. }
  324. .item-area {
  325. margin-top: 15rpx;
  326. padding: 0 36rpx;
  327. width: 100%;
  328. height: 100rpx;
  329. background: #F7F7F7;
  330. font-size: 28rpx;
  331. color: #979797;
  332. .item-area-input {
  333. height: 100rpx;
  334. }
  335. picker {
  336. flex: 1;
  337. padding-right: 40rpx;
  338. overflow: hidden;
  339. position: relative;
  340. .picker {
  341. line-height: 100rpx;
  342. font-size: 28rpx;
  343. text-overflow: ellipsis;
  344. white-space: nowrap;
  345. overflow: hidden;
  346. width: 100%;
  347. // text-align: right;
  348. }
  349. }
  350. picker::after {
  351. font-family: cuIcon;
  352. display: block;
  353. content: "\e6a3";
  354. position: absolute;
  355. font-size: 34rpx;
  356. color: #8799a3;
  357. line-height: 100rpx;
  358. width: 60rpx;
  359. text-align: center;
  360. top: 0;
  361. bottom: 0;
  362. right: -20rpx;
  363. margin: auto;
  364. }
  365. }
  366. }
  367. }
  368. .bottomEmpty {
  369. margin-top: 80rpx;
  370. height: 130rpx;
  371. }
  372. .bottomArea {
  373. position: fixed;
  374. bottom: 0;
  375. z-index: 100;
  376. width: 100%;
  377. height: 130rpx;
  378. display: flex;
  379. align-items: center;
  380. justify-content: center;
  381. background-color: #FFFFFF;
  382. box-shadow: -10rpx -12rpx 12rpx 2rpx rgba(52, 85, 73, 0.16);
  383. .bottomButton {
  384. margin: 0 28rpx;
  385. width: 696rpx;
  386. height: 90rpx;
  387. line-height: 90rpx;
  388. background: #CA151C;
  389. font-size: 33rpx;
  390. text-align: center;
  391. color: #FFFFFF;
  392. border-radius: 10rpx;
  393. }
  394. }
  395. </style>