brokerform.vue 10 KB

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