regize_body.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. <!DOCTYPE html>
  2. <html>
  3. <head lang="en">
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
  6. <meta name="viewport" content="height=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
  7. <title></title>
  8. <link rel="stylesheet" href="../../css/common.css"/>
  9. <link rel="stylesheet" href="../../css/login.css"/>
  10. <link rel="stylesheet" href="../../css/html.css"/>
  11. <link rel="stylesheet" href="../../css/dropdown.min.css"/>
  12. <style>
  13. body, html {
  14. width: 100%;
  15. }
  16. .submit {
  17. text-align: center;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22. <div class="register" id="app">
  23. <div class="content">
  24. <form class="zmq-form zmq-width-90 zmq-margin-top-15" action="">
  25. <div class="userName zmq-input-parent">
  26. <img src="../../image/drawable-xhdpi/22.png" class="zmq-input-img"/>
  27. <input class="zmq-input" type="text" name="name" placeholder="请输入手机号" required v-model = "info.phone" />
  28. </div>
  29. <!-- <div class="passWord zmq-input-parent">
  30. <img src="../../image/drawable-xhdpi/pass.png" class="zmq-input-img"/>
  31. <input class="zmq-input" type="password" name="password" placeholder="请输入密码" required v-model="info.password" />
  32. </div>-->
  33. <!--<div class="passWord zmq-input-parent-margin zmq-flex zmq-flex-between">
  34. <img src="../../image/drawable-xhdpi/pass2.png" class="zmq-input-img zmq-input-ru" style="margin-top: 3%"/>
  35. <input class="zmq-input zmq-margin-auto" type="number" name="phoneCode" placeholder="请输入验证码" required v-model="info.code" style="width: 40%"/>
  36. <div class="zmq-text-font-07 zmq-btn-getCode">获取验证码</div>
  37. </div>-->
  38. <div class="passWord zmq-input-parent">
  39. <img src="../../image/drawable-xhdpi/33.png" class="zmq-input-img"/>
  40. <input class="zmq-input" type="text" name="name" placeholder="请输入门店名称" required v-model="info.storeName" />
  41. </div>
  42. <div class="passWord zmq-input-parent">
  43. <img src="../../image/drawable-xhdpi/11.png" class="zmq-input-img"/>
  44. <input class="zmq-input" type="text" name="name" placeholder="请输入经营者姓名" required v-model="info.name" />
  45. </div>
  46. <div class="passWord zmq-input-parent" v-cloak>
  47. <img src="../../image/drawable-xhdpi/wj.png" class="zmq-input-img"/>
  48. <input class="zmq-input" type="text" name="brand" placeholder="请选择销售品牌" readonly="readonly" required id="multipleSelect" v-on:click="chooseBrand" />
  49. <div class="zmq-flex zmq-border-top-1 zmq-padding-vertical-5 zmq-margin-top-5" v-show = "chooseBrandList.length > 0">
  50. <div class="zmq-bg-success zmq-padding-doneBtn zmq-text-white zmq-text-font-08 zmq-margin-level-5 zmq-margin-vertical-5 zmq-radius-5" v-for="(b,i) in chooseBrandList" v-on:click="deleteBrand(i)">
  51. {{b.cont}} <img class="zmq-close" src="../../image/close.png" />
  52. </div>
  53. </div>
  54. </div>
  55. <div class="passWord zmq-input-parent">
  56. <img src="../../image/drawable-xhdpi/location.png" class="zmq-input-img"/>
  57. <input class="zmq-input" type="text" name="location" placeholder="请点击选择省市" required readonly="readonly" v-model = "info.area" v-on:click="chooseArea"/>
  58. </div>
  59. <div class="passWord zmq-input-parent">
  60. <img src="../../image/drawable-xhdpi/address.png" class="zmq-input-img"/>
  61. <input class="zmq-input" type="text" name="address" placeholder="请输入详细地址" required v-model = "info.address"/>
  62. </div>
  63. <div class="passWord zmq-input-parent" v-show="upChoose == true" v-cloak>
  64. <img src="../../image/drawable-xhdpi/jjs.png" class="zmq-input-img"/>
  65. <input class="zmq-input" type="text" name="jjs" placeholder="点击选择上级代理商名称" required id="supplierList" readonly="readonly" v-on:click="chooseUpuser" />
  66. <div class="zmq-flex zmq-border-top-1 zmq-padding-vertical-5 zmq-margin-top-5" v-show = "upChooseList.length > 0">
  67. <div class="zmq-bg-success zmq-padding-doneBtn zmq-text-white zmq-text-font-07 zmq-margin-level-5 zmq-margin-vertical-5 zmq-radius-5" v-for="(b,i) in upChooseList" v-on:click="deleteSupplier(i)">
  68. {{b.cont}} <img class="zmq-close" src="../../image/close.png" />
  69. </div>
  70. </div>
  71. </div>
  72. <div class="zmq-btn zmq-btn-img zmq-margin-top-15" v-on:click="regize">
  73. 注&nbsp;&nbsp;册
  74. </div>
  75. </form>
  76. </div>
  77. </div>
  78. </body>
  79. <script type="text/javascript" src="../../script/api.js"></script>
  80. <script type="text/javascript" src="../../script/jquery-1.11.0.min.js"></script>
  81. <script type="text/javascript" src="../../script/dropdown.min.js"></script>
  82. <script type="text/javascript" src="../../script/vue.js"></script>
  83. <script type="text/javascript" src="../../script/httpRequest.js"></script>
  84. <script type="text/javascript" src="../../script/vue_plugins.js"></script>
  85. <script type="text/javascript">
  86. // 获取所在省市,然后填写详细地址
  87. apiready = function() {
  88. new Vue({
  89. el : '#app',
  90. data : {
  91. // 选择省市区
  92. UIActionSelector : '',
  93. // 选择省市区的文件
  94. file : 'widget://res/city.json',
  95. // 提交的数据
  96. info : {
  97. phone : '', // 手机号
  98. code : '', // 手机验证码
  99. password : '', // 密码
  100. name : '', // 门店经营者姓名
  101. area : '', // 选择的省市区
  102. address : '', // 填入的详细地址
  103. upUser : [], // 上级经销商
  104. upCode : '', // 上级经销商id
  105. province : '', // 选择的省
  106. city : '', // 选择的市
  107. district : '', // 选择的区
  108. brand : ["金宇"],
  109. storeName : '', // 门店名称
  110. },
  111. // 是否显示上级经销商
  112. upChoose : false,
  113. // 根据省市获取上级经销商
  114. getUrl : 'getUpuserByProvideUrl',
  115. upChooseList : [], // 选中的经销商列表
  116. // 上级经销商列表
  117. upUserList : [],
  118. // 开始注册用户
  119. regizeUrl : 'regizeUrl',
  120. // 获取销售品牌接口
  121. BrandUrl : 'chooseBrandUrl',
  122. brandList : [],
  123. chooseBrandList : [], // 选中的品牌
  124. clickDom : '',
  125. // 品牌顺序
  126. brandSort : ["金宇","黑狮","玉祺麟","金路","盛凯","万宝"],
  127. // 根据品牌获取代理商
  128. getUpByIds : 'getUpByBrand',
  129. // 根据品牌和地理位置获取代理商
  130. getUpByBrandUrl : 'getUpByBrandAndArea',
  131. },
  132. methods : {
  133. init : function() {
  134. this.UIActionSelector = api.require('UIActionSelector');
  135. this.getBrand();
  136. },
  137. // 删除选中的轮胎品牌
  138. deleteBrand : function(index) {
  139. this.chooseBrandList.splice(index, 1);
  140. },
  141. // 删除选中代理商
  142. deleteSupplier : function(index) {
  143. this.upChooseList.splice(index, 1);
  144. },
  145. // 选择上级经销商
  146. chooseUpuser : function() {
  147. // alert(333);
  148. var _this = this;
  149. // this.chooseRegion(this.UIActionSelector, 1, this.upUserList, function(ret) {
  150. // _this.info.upUser = ret.selectedInfo[0].agentName;
  151. // _this.info.upCode = ret.selectedInfo[0].agentCode;
  152. // })
  153. // this.checkByDropdown(_this.upChooseList,this.upUserList,"请选择代理商名称","supplierList",function(res){
  154. // if(res.length > 0){
  155. // alert(333);
  156. // // 得确保已经选中的里面没有新选的
  157. // _this.upChooseList = res;
  158. // }
  159. // })
  160. this.clickDom = "supplierList";
  161. document.body.style.overflow = 'hidden';
  162. },
  163. // 选择轮胎品牌 data title dom c
  164. chooseBrand : function() {
  165. var _this = this;
  166. // this.checkByDropdown1(this.chooseBrandList, this.brandList, "请选择经营品牌", "multipleSelect", function(res) {
  167. // if (res.length > 0) {
  168. // alert(222);
  169. // _this.chooseBrandList = res;
  170. // // res.map(function(item,index){
  171. // // if(_this.chooseBrandList.indexOf(item) < 0){
  172. // // _this.chooseBrandList.push(item);
  173. // // }
  174. // // })
  175. // }
  176. // })
  177. this.clickDom = "multipleSelect";
  178. document.body.style.overflow = 'hidden';
  179. },
  180. // 获取销售品牌
  181. getBrand : function() {
  182. var _this = this;
  183. this.$post(this.BrandUrl, "", function(ret) {
  184. if (ret.code == 0) {
  185. var list = new Array();
  186. ret.list.map(function(brand, index) {
  187. var ids = _this.brandSort.indexOf(brand.brandName);
  188. var option = {
  189. cont : brand.brandName,
  190. id : brand.id,
  191. code : brand.brandCode
  192. }
  193. list[ids] = option;
  194. })
  195. _this.brandList = list;
  196. new Dropdown({
  197. dom : "multipleSelect", //点击触发下拉的选择框的id
  198. type : 'multiple', //是单选还是多选 单选 single 多选 multiple
  199. title : "请选择经营品牌", //选择框title
  200. required : false, //是否必填
  201. dataArr : _this.brandList,
  202. success : function(resp) {// 回调函数
  203. if (resp.length > 0) {
  204. if (resp.length > 0) {
  205. if (_this.clickDom == "multipleSelect") {
  206. // 品牌
  207. resp.map(function(item, index) {
  208. var has = false;
  209. _this.chooseBrandList.map(function(ir, ids) {
  210. if (item.id == ir.id) {
  211. has = true;
  212. }
  213. })
  214. if (has == false) {
  215. _this.chooseBrandList.push(item);
  216. _this.getUpUserByBrandList();
  217. }
  218. })
  219. } else {
  220. // 上级
  221. resp.map(function(item, index) {
  222. var has = false;
  223. _this.upChooseList.map(function(ir, ids) {
  224. if (item.id == ir.id) {
  225. has = true;
  226. }
  227. })
  228. if (has == false) {
  229. _this.upChooseList.push(item);
  230. }
  231. })
  232. }
  233. }
  234. }
  235. }
  236. })
  237. }
  238. })
  239. },
  240. // 点击选择省市区
  241. chooseArea : function() {
  242. var _this = this;
  243. this.chooseRegion(this.UIActionSelector, 3, this.file, function(ret) {
  244. _this.info.area = ret.level1 + ret.level2 + ret.level3;
  245. _this.info.province = ret.level1;
  246. _this.info.city = ret.level2;
  247. _this.info.district = ret.level3;
  248. _this.getUpUserByBrandList();
  249. })
  250. },
  251. // 根据品牌获取代理
  252. getUpUserByBrandList : function(){
  253. if(this.chooseBrandList.length == 0 || this.info.province == ''){
  254. return;
  255. }
  256. // 循环获取品牌id
  257. var ids = new Array();
  258. this.chooseBrandList.map(function(c,i){
  259. if(c){
  260. ids.push(c.id);
  261. }
  262. })
  263. var data = {
  264. ids : ids,
  265. area : this.info.province,
  266. type : 'body',
  267. url : 'json'
  268. }, _this = this;
  269. this.$post(this.getUpByBrandUrl, data, function(ret) {
  270. // 遍历数组,添加key为name的键值对,value为agentName
  271. var list = new Array();
  272. _this.upChoose = true;
  273. ret.data.map(function(upItem, index) {
  274. var option = {
  275. id : upItem.agent_id,
  276. cont : upItem.agent_name
  277. }
  278. list.push(option);
  279. })
  280. _this.upUserList = list;
  281. new Dropdown({
  282. dom : "supplierList", //点击触发下拉的选择框的id
  283. type : 'multiple', //是单选还是多选 单选 single 多选 multiple
  284. title : "请选择代理商名称", //选择框title
  285. required : false, //是否必填
  286. dataArr : _this.upUserList,
  287. success : function(resp) {// 回调函数
  288. if (resp.length > 0) {
  289. if (_this.clickDom == "multipleSelect") {
  290. // 品牌
  291. resp.map(function(item, index) {
  292. var has = false;
  293. _this.chooseBrandList.map(function(ir, ids) {
  294. if (item.id == ir.id) {
  295. has = true;
  296. }
  297. })
  298. if (has == false) {
  299. _this.chooseBrandList.push(item);
  300. _this.getUpUserByBrandList();
  301. }
  302. })
  303. } else {
  304. // 上级
  305. resp.map(function(item, index) {
  306. var has = false;
  307. _this.upChooseList.map(function(ir, ids) {
  308. if (item.id == ir.id) {
  309. has = true;
  310. }
  311. })
  312. if (has == false) {
  313. _this.upChooseList.push(item);
  314. }
  315. })
  316. }
  317. }
  318. }
  319. })
  320. })
  321. },
  322. // 获取该省的经销商
  323. getUpUserList : function(provide) {
  324. var data = {
  325. area : provide
  326. }, _this = this;
  327. this.$post(this.getUrl, data, function(ret) {
  328. // 遍历数组,添加key为name的键值对,value为agentName
  329. var list = new Array();
  330. _this.upChoose = true;
  331. ret.list.map(function(upItem, index) {
  332. var option = {
  333. id : upItem.id,
  334. cont : upItem.agentName
  335. }
  336. list.push(option);
  337. })
  338. _this.upUserList = list;
  339. new Dropdown({
  340. dom : "supplierList", //点击触发下拉的选择框的id
  341. type : 'multiple', //是单选还是多选 单选 single 多选 multiple
  342. title : "请选择代理商名称", //选择框title
  343. required : false, //是否必填
  344. dataArr : _this.upUserList,
  345. success : function(resp) {// 回调函数
  346. if (resp.length > 0) {
  347. if (_this.clickDom == "multipleSelect") {
  348. // 品牌
  349. resp.map(function(item, index) {
  350. var has = false;
  351. _this.chooseBrandList.map(function(ir, ids) {
  352. if (item.id == ir.id) {
  353. has = true;
  354. }
  355. })
  356. if (has == false) {
  357. _this.chooseBrandList.push(item);
  358. _this.getUpUserByBrandList();
  359. }
  360. })
  361. } else {
  362. // 上级
  363. resp.map(function(item, index) {
  364. var has = false;
  365. _this.upChooseList.map(function(ir, ids) {
  366. if (item.id == ir.id) {
  367. has = true;
  368. }
  369. })
  370. if (has == false) {
  371. _this.upChooseList.push(item);
  372. }
  373. })
  374. }
  375. }
  376. }
  377. })
  378. // _this.upUserList = ret.list;
  379. // _this.upChoose = true;
  380. // _this.upUserList.map(function(upItem, index) {
  381. // _this.$set(upItem, "name", upItem.agentName);
  382. // })
  383. })
  384. },
  385. // 注册用户
  386. regize : function() {
  387. // this.info.brand = this.chooseBrandList;
  388. // this.info.upUser = this.upChooseList;
  389. var brandList = new Array(),upUserList = new Array();
  390. this.chooseBrandList.map(function(brand,index){
  391. var option = {
  392. id : brand.id,
  393. brandName : brand.cont
  394. }
  395. brandList.push(option);
  396. })
  397. this.upChooseList.map(function(upUser,index){
  398. var option = {
  399. id : upUser.id,
  400. agentName : upUser.cont
  401. }
  402. upUserList.push(option);
  403. })
  404. if(this.phoneExg(this.info.phone) == false ) {
  405. return;
  406. }
  407. if(this.checkInfo(this.info.province) == false){
  408. return;
  409. }
  410. if(this.checkInfo(this.info.city) == false){
  411. return;
  412. }
  413. if(this.checkInfo(this.info.district) == false){
  414. return;
  415. }
  416. if(this.checkInfo(this.info.name) == false){
  417. return;
  418. }
  419. if(this.checkArray(upUserList) == false){
  420. return;
  421. }
  422. if(this.checkArray(brandList) == false){
  423. return;
  424. }
  425. if(this.checkInfo(this.info.storeName) == false){
  426. return;
  427. }
  428. var data = {
  429. mobile : this.info.phone,
  430. password : this.info.password,
  431. province : this.info.province,
  432. city : this.info.city,
  433. district : this.info.district,
  434. storeJl : this.info.name,
  435. agentDtoList : upUserList,
  436. brandDtoList : brandList,
  437. storeName : this.info.storeName,
  438. addressInfo : this.info.address,
  439. type : 'body',
  440. url : 'json'
  441. }, _this = this;
  442. this.$post(this.regizeUrl, data, function(ret) {
  443. // 注册成功,请等待审核
  444. _this.showToast("注册成功");
  445. setTimeout(function() {
  446. _this.closeWin();
  447. }, 200);
  448. })
  449. },
  450. },
  451. mounted : function() {
  452. this.init();
  453. }
  454. })
  455. }
  456. </script>
  457. </html>