brokerform.vue 9.6 KB

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