joinInfo.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <view class="container">
  3. <view class="main">
  4. <view class="list">
  5. <view class="list-left">
  6. <text class="list-left-name">姓名:</text>
  7. </view>
  8. <view class="list-right">
  9. <input type="text" v-model="name" placeholder="请输入姓名" class="list-right-input" />
  10. </view>
  11. </view>
  12. <view class="list">
  13. <view class="list-left">
  14. <text class="list-left-name">电话:</text>
  15. </view>
  16. <view class="list-right ">
  17. <input type="text" v-model="phone" placeholder="请输入电话" class="list-right-input" />
  18. <button type="default" open-type="getPhoneNumber" @click="userPhone" class="cu-btn yellowBtn">获取手机号</button>
  19. </view>
  20. </view>
  21. <view class="list">
  22. <view class="list-left">
  23. <text class="list-left-name">所属区域:</text>
  24. </view>
  25. <view class="list-right">
  26. <picker mode="multiSelector" class="picker-container" @change="bindMultiPickerChange" @columnchange="bindMultiPickerColumnChange"
  27. :value="multiIndex" :range="multiArray" range-key="name">
  28. <view class="picker">
  29. <view class="energy">
  30. {{areaname}}
  31. <!-- {{multiArray[0].length>0? multiArray[0][multiIndex[0]].name:'所在省份'}}, {{ multiArray[1].length>0? multiArray[1][multiIndex[1]].name:'所属区域' }} -->
  32. </view>
  33. <view class="energy-img">
  34. <uni-icons :size="30" class="uni-icon-wrapper" color="#F5CC57" type="arrowdown" style="padding-left:5px" />
  35. </view>
  36. </view>
  37. </picker>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="foot-btn">
  42. <view class="sub" @click="submit">
  43. 提交
  44. </view>
  45. <view class="quxiao" @click="cancel">
  46. 取消
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. export default {
  53. data() {
  54. return {
  55. name: '',
  56. phone: '',
  57. multiArray: [
  58. [],
  59. []
  60. ], // 绑定数据
  61. multiIndex: [0, 0], // 绑定的下标
  62. partners: [], // 加盟商
  63. areaname: "请选择"
  64. }
  65. },
  66. onLoad(option) {
  67. this.getArea(0);
  68. },
  69. methods: {
  70. userPhone:function(e) {
  71. // console.log(e)
  72. // let data = await this.$request.post('/api/Common/getPhoneNumber', {
  73. // encryptData: e.detail.encryptedData,
  74. // iv: e.detail.iv
  75. // })
  76. // console.log(data)
  77. // if (data.code == 200) {
  78. // this.phone = data.data.phoneNumber
  79. // } else {
  80. // uni.showToast({
  81. // title: '获取手机号失败'
  82. // })
  83. // }
  84. this.phone = uni.getStorageSync('phone')
  85. },
  86. // 获取数据
  87. getArea: async function(parent_id) {
  88. let res = await this.$request.post('/api/common/areaList', {
  89. parent_id: parent_id
  90. });
  91. console.log(res)
  92. if (res.code == 200) {
  93. if (parent_id == 0) {
  94. this.$set(this.multiArray, 0, res.data);
  95. console.log(this.multiArray)
  96. this.getArea(this.multiArray[0][this.multiIndex[0]].id);
  97. } else {
  98. this.$set(this.multiArray, 1, res.data);
  99. // this.gePartners(this.multiArray[1][this.multiIndex[1]].id,2);
  100. }
  101. } else {
  102. uni.showToast({
  103. icon: 'none',
  104. title: data.message
  105. });
  106. }
  107. },
  108. // gePartners: async function(area_id,level){
  109. // let data = await this.$request.post('/api/common/partnerList',{area_id:area_id,level:2});
  110. // if (data.code==200) {
  111. // this.partners=data.data;
  112. // } else {
  113. // uni.showToast({
  114. // icon: 'none',
  115. // title: data.message
  116. // });
  117. // }
  118. // },
  119. // 选中后的值
  120. bindMultiPickerChange(e) {
  121. console.log(e)
  122. this.multiIndex = e.detail.value;
  123. this.areaname = this.multiArray[0][this.multiIndex[0]].name + ',' + this.multiArray[1][this.multiIndex[1]].name
  124. },
  125. // 选中切换后调用值
  126. bindMultiPickerColumnChange(e) {
  127. console.log(e)
  128. if (e.detail.column == 0) {
  129. this.$set(this.multiIndex, 1, 0);
  130. this.$set(this.multiIndex, e.detail.column, e.detail.value);
  131. this.getArea(this.multiArray[0][this.multiIndex[0]].id);
  132. } else {
  133. this.$set(this.multiIndex, e.detail.column, e.detail.value);
  134. // this.gePartners(this.multiArray[1][this.multiIndex[1]].id,2);
  135. }
  136. },
  137. // 提交
  138. submit: async function() {
  139. if (this.$util.isEmpty(this.name)) {
  140. uni.showModal({
  141. title: '错误信息',
  142. content: '姓名必须填写',
  143. showCancel: false
  144. });
  145. return false;
  146. }
  147. if (!this.$util.isPhoneNumber(this.phone)) {
  148. uni.showModal({
  149. title: '错误信息',
  150. content: '请输入正确格式的手机号码',
  151. showCancel: false
  152. });
  153. return false;
  154. }
  155. let params = {
  156. nick: this.name,
  157. phone: this.phone,
  158. province: this.multiArray[0][this.multiIndex[0]].id,
  159. city: this.multiArray[1][this.multiIndex[1]].id
  160. }
  161. let res = await this.$request.post('/api/PartnerAplye/addAplye', params);
  162. // console.log(res.code)
  163. console.log(res)
  164. if (res.code == 200) {
  165. uni.showToast({
  166. title: '提交申请信息成功',
  167. content: res.message,
  168. duration: 1500
  169. })
  170. setTimeout(() => {
  171. uni.navigateBack({
  172. delta: 1
  173. })
  174. }, 1500)
  175. } else {
  176. console.log(res)
  177. uni.showToast({
  178. title: res.message
  179. })
  180. }
  181. },
  182. // 取消订单
  183. cancel: function() {
  184. uni.navigateBack()
  185. }
  186. }
  187. }
  188. </script>
  189. <style>
  190. .container {
  191. width: 100vw;
  192. height: auto;
  193. }
  194. .container .main {
  195. width: 100%;
  196. height: auto;
  197. background: #fff;
  198. margin-bottom: 20px;
  199. }
  200. .list {
  201. width: 100%;
  202. height: 110rpx;
  203. line-height: 110rpx;
  204. padding: 5px 15px;
  205. border-bottom: 1px solid #eee;
  206. display: flex;
  207. justify-content: space-between;
  208. align-items: center;
  209. }
  210. .list-left {
  211. width: 27%;
  212. flex-shrink: 0;
  213. }
  214. .list-left .list-left-name {
  215. height: 50rpx;
  216. line-height: 50rpx;
  217. font-size: 36rpx;
  218. font-weight: 300;
  219. font-family: PingFangSC-Regular, sans-serif;
  220. color: #555864;
  221. }
  222. .list-right {
  223. width: 73%;
  224. height: 40px;
  225. line-height: 40px;
  226. display: flex;
  227. justify-content: space-between;
  228. align-items: center;
  229. }
  230. .list-right .list-right-input {
  231. font-size: 30rpx;
  232. font-family: PingFangSC-Regular, sans-serif;
  233. font-weight: 300;
  234. color: rgba(143, 143, 144, 1);
  235. }
  236. .list-right .picker {
  237. width: 100%;
  238. height: auto;
  239. display: flex;
  240. justify-content: space-between;
  241. align-items: center;
  242. flex: 1
  243. }
  244. .list-right .picker .energy {
  245. font-size: 30rpx;
  246. font-family: PingFangSC-Regular, sans-serif;
  247. font-weight: 300;
  248. color: rgba(143, 143, 144, 1);
  249. }
  250. .list-right .picker-container {
  251. width: 100%;
  252. }
  253. .quxiao,
  254. .sub {
  255. width: auto;
  256. height: 40px;
  257. line-height: 40px;
  258. padding: 0 20px;
  259. float: right;
  260. border-radius: 5px;
  261. }
  262. .foot-btn {
  263. display: flex;
  264. justify-content: center;
  265. align-items: center;
  266. }
  267. .foot-btn .sub {
  268. background: #F5CC57;
  269. color: #fff;
  270. margin: 10px;
  271. }
  272. .foot-btn .quxiao {
  273. border: 1px solid #979797;
  274. color: #979797;
  275. margin: 10px;
  276. }
  277. .yellowBtn {
  278. width: 296rpx;
  279. color: #FFFFFF !important;
  280. background: #f5cc57 !important;
  281. }
  282. </style>