brokerform.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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" placeholder-style="color: #979797;"></input>
  11. </view>
  12. </view>
  13. <view class="broKerForm-item">
  14. <view class="item-title">手机号</view>
  15. <view class="item-area">
  16. <input class="item-area-input" placeholder="请输入手机号" data-val="mobile" @input="bindInput" placeholder-style="color: #979797;"></input>
  17. </view>
  18. </view>
  19. <view class="broKerForm-item">
  20. <view class="item-title">代理门店</view>
  21. <view class="item-area">
  22. <picker mode="multiSelector" @change="MultiChange" @columnchange="MultiColumnChange" :value="multiIndex" :range="multiArray" range-key="title">
  23. <view class="picker">
  24. {{multiArray[0][multiIndex[0]].title}},{{multiArray[1][multiIndex[1]].title}}
  25. </view>
  26. </picker>
  27. <u-icon name="arrow-right" color="#747474" size="15" @click="MultiColumnChange"></u-icon>
  28. </view>
  29. </view>
  30. <view class="broKerForm-item">
  31. <view class="item-title">镇/街道</view>
  32. <view class="item-area">
  33. <picker mode="multiSelector" @change="TownChange" @columnchange="TownColumnChange" :value="townIndex" :range="townArray">
  34. <view class="picker">
  35. {{townArray[0][townIndex[0]]}},{{townArray[1][townIndex[1]]}}
  36. </view>
  37. </picker>
  38. <u-icon name="arrow-right" color="#747474" size="15"></u-icon>
  39. </view>
  40. </view>
  41. <view class="broKerForm-item">
  42. <view class="item-title">区域</view>
  43. <view class="item-area">
  44. <input class="item-area-input" placeholder="请输入区域" data-val="region" @input="bindInput" placeholder-style="color: #979797;"></input>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="bottomArea"></view>
  49. <view class="bottomButton" @tap="submit">立即提交</view>
  50. <form v-if="false">
  51. <view class="cu-form-group margin-top">
  52. <view class="title">姓名</view>
  53. <input placeholder="请输入姓名" data-val="title" @input="bindInput"></input>
  54. </view>
  55. <view class="cu-form-group">
  56. <view class="title">手机号</view>
  57. <input placeholder="请输入手机号" data-val="mobile" @input="bindInput"></input>
  58. </view>
  59. <view class="cu-form-group">
  60. <view class="title">代理门店</view>
  61. <picker mode="multiSelector" @change="MultiChange" @columnchange="MultiColumnChange" :value="multiIndex" :range="multiArray" range-key="title">
  62. <view class="picker">
  63. {{multiArray[0][multiIndex[0]].title}},{{multiArray[1][multiIndex[1]].title}}
  64. </view>
  65. </picker>
  66. </view>
  67. <view class="cu-form-group">
  68. <view class="title">镇街</view>
  69. <picker mode="multiSelector" @change="TownChange" @columnchange="TownColumnChange" :value="townIndex" :range="townArray">
  70. <view class="picker">
  71. {{townArray[0][townIndex[0]]}},{{townArray[1][townIndex[1]]}}
  72. </view>
  73. </picker>
  74. </view>
  75. <view class="cu-form-group">
  76. <view class="title">区域</view>
  77. <input placeholder="请输入区域" data-val="region" @input="bindInput"></input>
  78. </view>
  79. <view class="padding flex flex-direction bg-white">
  80. <button class="cu-btn bg-blue margin-tb-sm lg" @tap="submit">立即提交</button>
  81. </view>
  82. </form>
  83. </view>
  84. </template>
  85. <script>
  86. var _this;
  87. export default {
  88. data() {
  89. return {
  90. isRotate: false,
  91. userinfo: {},
  92. forminfo: {
  93. title: '',
  94. mobile: '',
  95. region: '',
  96. },
  97. multiArray: [
  98. [],
  99. [],
  100. ],
  101. multiIndex: [0, 0],
  102. townArray: [
  103. [],
  104. [],
  105. ],
  106. townIndex: [0,0],
  107. village: [],
  108. };
  109. },
  110. onLoad: function(){
  111. _this = this;
  112. _this.userinfo = _this.checkLogin("/pages/my/myinfo");
  113. //公司
  114. _this.$req.ajax({
  115. path: "index/getWorker",
  116. data: {}
  117. }).then((data) => {
  118. _this.multiArray = data;
  119. }).catch((err) => {
  120. uni.showModal({
  121. title: '信息提示',
  122. content: err,
  123. showCancel: false
  124. });
  125. });
  126. //镇街
  127. _this.$req.ajax({
  128. path: "index/getTown",
  129. data: {}
  130. }).then((data) => {
  131. _this.townArray = [data.town,data.village[0]];
  132. _this.village = data.village
  133. }).catch((err) => {
  134. uni.showModal({
  135. title: '信息提示',
  136. content: err,
  137. showCancel: false
  138. });
  139. });
  140. },
  141. methods: {
  142. bindInput(e) {
  143. var dataval = e.currentTarget.dataset.val;
  144. _this.forminfo[dataval] = e.detail.value;
  145. },
  146. MultiChange(e) {
  147. this.multiIndex = e.detail.value
  148. },
  149. TownChange(e) {
  150. this.townIndex = e.detail.value
  151. },
  152. MultiColumnChange(e) {
  153. let multi = _this.multiIndex;
  154. //公司变更
  155. if (e.detail.column == 0) {
  156. let workerid = _this.multiArray[0][e.detail.value].id;
  157. _this.$req.ajax({
  158. path: "index/getAgentByWorker",
  159. data: {workerid:workerid}
  160. }).then((data) => {
  161. let multiArray = _this.multiArray;
  162. multiArray[1] = data;
  163. _this.multiArray = multiArray;
  164. multi = [e.detail.value,0];
  165. _this.multiIndex = multi;
  166. _this.$forceUpdate();
  167. }).catch((err) => {
  168. uni.showModal({
  169. title: '信息提示',
  170. content: err,
  171. showCancel: false
  172. });
  173. });
  174. }
  175. //门店变更
  176. if (e.detail.column == 1) {
  177. multi[1] = e.detail.value;
  178. _this.multiIndex = multi;
  179. _this.$forceUpdate();
  180. }
  181. },
  182. TownColumnChange(e) {
  183. let townIndex = _this.townIndex;
  184. //公司变更
  185. if (e.detail.column == 0) {
  186. _this.townArray[1] = _this.village[e.detail.value];
  187. _this.townIndex = [e.detail.value,0];
  188. _this.$forceUpdate();
  189. }
  190. //街道变更
  191. if (e.detail.column == 1) {
  192. townIndex[1] = e.detail.value;
  193. _this.townIndex = townIndex;
  194. _this.$forceUpdate();
  195. }
  196. },
  197. RegionChange(e) {
  198. this.region = e.detail.value
  199. },
  200. submit() {
  201. if (_this.isRotate) {
  202. return false;
  203. }
  204. _this.isRotate = true;
  205. let data = _this.forminfo;
  206. console.log(data,22);
  207. let validate = {"title":"姓名","mobile":"手机号","region":"区域"};
  208. for (var i in validate) {
  209. if (data[i] == "") {
  210. uni.showModal({
  211. title: '信息提示',
  212. content: validate[i]+"不能为空",
  213. showCancel: false
  214. });
  215. _this.isRotate = false;
  216. return false;
  217. }
  218. }
  219. data.userid = _this.userinfo.id;
  220. data.workerid = _this.multiArray[0][_this.multiIndex[0]].id;
  221. data.agentid = _this.multiArray[1][_this.multiIndex[1]].id;
  222. data.town = _this.townArray[0][_this.townIndex[0]];
  223. data.village = _this.townArray[1][_this.townIndex[1]];
  224. _this.$req.ajax({
  225. path: "broker/apply",
  226. data: data
  227. }).then((data) => {
  228. uni.showModal({
  229. title: '信息提示',
  230. content: '提交成功,等待管理员审核',
  231. showCancel: false,
  232. success: function() {
  233. uni.reLaunch({
  234. url: '/pages/index/index'
  235. });
  236. },
  237. });
  238. }).catch((err) => {
  239. uni.showModal({
  240. title: '信息提示',
  241. content: err,
  242. showCancel: false
  243. });
  244. _this.isRotate = false;
  245. });
  246. },
  247. }
  248. }
  249. </script>
  250. <style lang="scss">
  251. .cu-form-group .title {
  252. min-width: calc(4em + 15px);
  253. }
  254. page {
  255. background-color: #FFFFFF
  256. }
  257. .header {
  258. width: 100%;
  259. height: 266rpx;
  260. padding-left: 46rpx;
  261. background: linear-gradient(270deg, #484353 0%, #6F6F6F 100%);
  262. opacity: 1;
  263. display: flex;
  264. align-items: center;
  265. background-size: cover;
  266. background-position: center;
  267. .header-icon {
  268. width: 97rpx;
  269. height: 97rpx;
  270. }
  271. }
  272. .broKerForm {
  273. padding: 40rpx 70rpx;
  274. .broKerForm-item {
  275. margin-bottom: 35rpx;
  276. .item-area {
  277. margin-top: 15rpx;
  278. padding: 15rpx 36rpx;
  279. width: 100%;
  280. // height: 66rpx;
  281. background: #F7F7F7;
  282. display: flex;
  283. align-items: center;
  284. justify-content: space-between;
  285. font-size: 28rpx;
  286. color: #979797;
  287. line-height: 66rpx;
  288. .item-area-input {
  289. width: 100%;
  290. display: flex;
  291. align-items: center;
  292. }
  293. .picker {
  294. // width: 97%;
  295. overflow: hidden;
  296. text-overflow: ellipsis;
  297. -webkit-line-clamp: 1;
  298. display: -webkit-box;
  299. -webkit-box-orient: vertical;
  300. }
  301. }
  302. }
  303. }
  304. .bottomArea {
  305. height: 120rpx;
  306. }
  307. .bottomButton {
  308. position: fixed;
  309. bottom: 30rpx;
  310. z-index: 100;
  311. margin: 0 28rpx;
  312. width: 696rpx;
  313. height: 90rpx;
  314. line-height: 90rpx;
  315. background: #CA151C;
  316. font-size: 33rpx;
  317. text-align: center;
  318. color: #FFFFFF;
  319. border-radius: 10rpx;
  320. }
  321. </style>