category2.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <image src="../../static/img/jiuzai.png" mode="widthFix" class="bgi"></image>
  5. </view>
  6. <view class="pop-box">
  7. 参与人数({{count}}人)
  8. </view>
  9. <view class="pop-list">
  10. <view class="list-box1" v-for="(item,index) in peoplelist" :key='index' v-if="index<20">
  11. <view class="list-top">
  12. <image :src="item.avatar" mode="" class="avatar-img"></image>
  13. </view>
  14. <view class="nickname">
  15. {{item.name}}
  16. </view>
  17. </view>
  18. </view>
  19. <view class="red-box">
  20. 报名参与
  21. </view>
  22. <!-- <view class="people">
  23. </view> -->
  24. <view class="list-box">
  25. <view class="list">
  26. <view class="list-left">
  27. 姓名:
  28. </view>
  29. <input type="text" v-model="name" class="list-input" placeholder="请输入您的姓名"/>
  30. </view>
  31. <view class="list">
  32. <view class="list-left">
  33. 手机:
  34. </view>
  35. <input type="text" v-model="phone" class="list-input" placeholder='请填写您的联系方式'/>
  36. </view>
  37. <view class="list" @click="getLocation">
  38. <view class="list-left">
  39. 地址:
  40. </view>
  41. <!-- <picker-address class="box-right" @change="onCityClick">{{ address }}</picker-address> -->
  42. <input type="text" v-model="showaddress" class="list-input" placeholder='请选择定位地址'/>
  43. </view>
  44. <view class="list" @click="Toshow">
  45. <view class="list-left">
  46. 机构:
  47. </view>
  48. <!-- <input type="text" v-model="mechanism" @click="tosearch" class="list-input" placeholder='请输入机构关键字'/> -->
  49. <input type="text" v-model="mechanism" class="list-input" placeholder='请输入机构关键字'disabled />
  50. </view>
  51. <view class="upload-box">
  52. <view class="upload-left">
  53. 请上传救护员证书或身份证:
  54. </view>
  55. <view class="upload-right">
  56. <image :src="certificates" mode="" class="upload-img" @click.stop="imgsub" v-if="certificates"></image>
  57. <image src="../../static/images/upload.png" class="upload-img" mode="" v-if="!certificates" @click.stop="imgsub"></image>
  58. </view>
  59. </view>
  60. <zhilin-picker
  61. v-model="show"
  62. :title="title"
  63. :data="list"
  64. :initSelected="initSelected"
  65. :showSearch="true"
  66. @change="onChange"
  67. @searchInput='onSearchInput'
  68. @confirm="onConfirm1"
  69. />
  70. </view>
  71. <view class="sub" :class="{ action: loding }" @click="!loding?join():''">
  72. 马上报名
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. import {
  78. mechanism
  79. } from '@/api/ask.js'
  80. import {
  81. getNumber
  82. } from '@/api/index.js';
  83. import pickerAddress from '@/components/wangding-pickerAddress/wangding-pickerAddress.vue';
  84. import zhilinPicker from "@/components/zhilin-picker/zhilin-picker.vue"
  85. import {
  86. upload,
  87. addrescuer
  88. } from '@/api/ask.js';
  89. export default {
  90. components: {
  91. pickerAddress,
  92. },
  93. computed: {
  94. },
  95. data() {
  96. return {
  97. longitude: '',
  98. latitude: '',
  99. name: '',
  100. phone: '',
  101. mechanism: '',
  102. title: '选择机构',
  103. show: false,
  104. list:[],
  105. initSelected: [],
  106. searchVal:'',
  107. address: '',
  108. certificates: '',
  109. loding: false, //是否提交中
  110. showaddress: '', //显示用的地址
  111. count: 0,
  112. peoplelist: [],
  113. addressData: {
  114. name: '',
  115. mobile: '',
  116. latitude: 0, //纬度
  117. longitude: 0, //经度
  118. address: {
  119. province: '',
  120. city: '',
  121. district: '',
  122. detail: '',
  123. },
  124. area: '',
  125. default: false
  126. },
  127. }
  128. },
  129. onShow() {
  130. this.loadData();
  131. },
  132. watch:{
  133. searchVal(){
  134. this.ListDate();
  135. },
  136. },
  137. methods: {
  138. tosearch(){
  139. console.log(123)
  140. uni.navigateTo({
  141. url:'/pages/category/search'
  142. })
  143. },
  144. async loadData() {
  145. let obj = this;
  146. getNumber({}).then(({
  147. data
  148. }) => {
  149. // console.log(12)
  150. // console.log(data)
  151. obj.count = data.count;
  152. obj.peoplelist = data.data;
  153. })
  154. },
  155. // 选择当前位置
  156. getLocation() {
  157. console.log('选择当前位置');
  158. let obj = this;
  159. uni.chooseLocation({
  160. success: function(res) {
  161. obj.addressData.area = res.name;
  162. console.log('位置名称:' + res.name);
  163. console.log('详细地址:' + res.address);
  164. console.log('纬度:' + res.latitude);
  165. console.log('经度:' + res.longitude);
  166. obj.addressData.latitude = res.latitude;
  167. obj.addressData.longitude = res.longitude;
  168. // let dizhi = obj.addressData.latitude + ','+ obj.addressData.longitude;
  169. obj.showaddress = res.address;
  170. }
  171. });
  172. },
  173. // 机构
  174. Toshow(){
  175. console.log('点击选择机构')
  176. this.show = true;
  177. },
  178. onChange(val){
  179. let obj = this;
  180. console.log(val,'onChange')
  181. // let arr = val.split(',');
  182. // console.log(999,arr)
  183. // obj.hospital = arr[1];
  184. // obj.hospital_id = arr[0];
  185. // obj.city = arr[2];
  186. // obj.city_id = arr[3];
  187. // obj.district = arr[4];
  188. // obj.district_id = arr[5];
  189. // obj.province = arr[6];
  190. // obj.province_id = arr[7];
  191. // obj.addr = obj.province + obj.city + obj.district;
  192. // console.log(obj.hospital,obj.hospital_id)
  193. // console.log(obj.city,obj.city_id)
  194. // console.log(obj.district,obj.district_id)
  195. // console.log(obj.province,obj.province_id)
  196. },
  197. onSearchInput(val){
  198. this.searchVal = val.value;
  199. },
  200. // 选择机构
  201. ListDate() {
  202. let obj = this;
  203. let data = '';
  204. console.log('obj.searchVal',obj.searchVal)
  205. if(!obj.searchVal){
  206. console.log('!obj.searchVal')
  207. data={
  208. keyword:'',
  209. // sort:'id desc',
  210. page:1,
  211. limit:1500,
  212. }
  213. }else{
  214. console.log('else')
  215. console.log('当前input值',obj.searchVal)
  216. data={
  217. keyword:obj.searchVal,
  218. // sort:'id desc',
  219. page:1,
  220. limit:1500,
  221. }
  222. }
  223. mechanism(
  224. data
  225. ).then(data => {
  226. console.log('请求成功',data)
  227. this.list = data.data.map(item => item)
  228. // this.show = true
  229. })
  230. // getHospitalList(data).then(e => {
  231. // obj.list = e.data.list;
  232. // }).catch((e) => {
  233. // console.log(e)
  234. // });
  235. },
  236. onConfirm1(e) {
  237. console.log('点击确认')
  238. // let arr = e
  239. this.mechanism = e.split(',')[1]
  240. this.list = []
  241. },
  242. imgsub() {
  243. console.log('imgsub')
  244. upload({
  245. filename: ''
  246. }).then(data => {
  247. this.certificates = data[0].url;
  248. })
  249. },
  250. join() {
  251. let obj = this;
  252. if (obj.name == '') {
  253. obj.$api.msg('请输入您的姓名');
  254. return
  255. }
  256. const reg = /^(\+?0?86-?)?1[\d]\d{9}$/;
  257. if (!reg.test(obj.phone)) {
  258. obj.$api.msg('请填写正确的手机号码');
  259. return;
  260. }
  261. if (obj.showaddress == '') {
  262. obj.$api.msg('请选择您的所在地区');
  263. return
  264. }
  265. if (obj.mechanism == '') {
  266. obj.$api.msg('请输入机构关键字');
  267. return
  268. }
  269. if (obj.certificates == '') {
  270. obj.$api.msg('请上传救护员证书或身份证');
  271. return
  272. }
  273. obj.loding = true;
  274. addrescuer({
  275. name: obj.name,
  276. phone: obj.phone,
  277. address: obj.showaddress,
  278. latitude:obj.addressData.latitude,
  279. longitude:obj.addressData.longitude,
  280. mechanism:obj.mechanism,
  281. certificates: obj.certificates
  282. }).then(data => {
  283. obj.loding = false;
  284. if (data.status == 200) {
  285. obj.name = '',
  286. obj.phone = '',
  287. obj.showaddress = '',
  288. obj.certificates = '',
  289. obj.mechanism = '',
  290. obj.addressData.latitude = '',
  291. obj.addressData.longitude = '',
  292. uni.navigateTo({
  293. url: '../joinSuc/joinNow'
  294. });
  295. } else if (data.status == 400) {
  296. obj.$api.msg(data.msg);
  297. }
  298. }).catch(err => {
  299. console.log(err);
  300. });
  301. }
  302. }
  303. }
  304. </script>
  305. <style lang="scss">
  306. .content {
  307. line-height: 1;
  308. background-color: #FFABAB;
  309. padding-bottom: 20rpx;
  310. .sub {
  311. width: 660rpx;
  312. line-height: 100rpx;
  313. // background: linear-gradient(0deg, #C90F1B, #F14D33);
  314. background: $motif-color;
  315. border-radius: 50rpx;
  316. font-size: 36rpx;
  317. font-weight: 400;
  318. color: #FFFFFF;
  319. text-align: center;
  320. margin: 60rpx auto 0;
  321. &.action {
  322. background: #999999;
  323. }
  324. }
  325. .top {
  326. width: 750rpx;
  327. .bgi {
  328. width: 750rpx;
  329. }
  330. }
  331. .pop-box {
  332. width: 405rpx;
  333. line-height: 66rpx;
  334. text-align: center;
  335. // background: linear-gradient(0deg, #C90F1B, #F14D33);
  336. background: $motif-color;
  337. border-radius: 10rpx;
  338. font-size: 30rpx;
  339. font-weight: 500;
  340. color: #FFFFFF;
  341. margin: -110rpx auto 0;
  342. position: relative;
  343. z-index: 1;
  344. }
  345. .red-box {
  346. width: 405rpx;
  347. line-height: 66rpx;
  348. text-align: center;
  349. // background: linear-gradient(0deg, #C90F1B, #F14D33);
  350. background: $motif-color;
  351. border-radius: 10rpx;
  352. font-size: 30rpx;
  353. font-weight: 500;
  354. color: #FFFFFF;
  355. margin: 0rpx auto 0;
  356. position: relative;
  357. z-index: 1;
  358. }
  359. .red-box2 {
  360. position: relative;
  361. width: 405rpx;
  362. line-height: 66rpx;
  363. text-align: center;
  364. background: linear-gradient(0deg, #C90F1B, #F14D33);
  365. border-radius: 10rpx;
  366. font-size: 30rpx;
  367. font-weight: 500;
  368. color: #FFFFFF;
  369. margin: -80rpx auto 0;
  370. position: relative;
  371. z-index: 1;
  372. }
  373. .pop-list {
  374. width: 686rpx;
  375. background: #FFFFFF;
  376. border-radius: 29rpx;
  377. position: relative;
  378. margin: -33rpx auto 78rpx;
  379. padding: 80rpx 0rpx 30rpx 30rpx;
  380. display: flex;
  381. flex-wrap: wrap;
  382. .list-box1 {
  383. text-align: center;
  384. margin-right: 30rpx;
  385. margin-bottom: 30rpx;
  386. .list-top {
  387. width: 100rpx;
  388. height: 100rpx;
  389. .avatar-img {
  390. width: 100rpx;
  391. height: 100rpx;
  392. border-radius: 50%;
  393. }
  394. }
  395. .nickname{
  396. margin-top: 12rpx;
  397. }
  398. }
  399. }
  400. .list-box {
  401. width: 686rpx;
  402. background: #FFFFFF;
  403. border-radius: 29rpx;
  404. position: relative;
  405. margin: -33rpx auto;
  406. padding: 100rpx 30rpx 0rpx 30rpx;
  407. display: flex;
  408. flex-wrap: wrap;
  409. .upload-box {
  410. width: 100%;
  411. height: 247rpx;
  412. background: #FFFFFF;
  413. // border: 1px solid #E63931;
  414. border-radius: 27rpx;
  415. display: flex;
  416. flex-direction: column;
  417. padding: 30rpx 40rpx 30rpx 0;
  418. margin: 0 auto 30rpx;
  419. .upload-left {
  420. font-weight: 400;
  421. color: #E63931;
  422. }
  423. .upload-right {
  424. flex: 1;
  425. display: flex;
  426. align-items: center;
  427. justify-content: center;
  428. .upload-img {
  429. width: 133rpx;
  430. height: 133rpx;
  431. margin-top: 44rpx;
  432. }
  433. }
  434. }
  435. .list {
  436. display: flex;
  437. flex-direction: column;
  438. align-items: center;
  439. width: 100%;
  440. margin-top: 32rpx;
  441. // height: 133rpx;
  442. .list-left {
  443. width: 100%;
  444. text-align: left;
  445. color: #E63931;
  446. }
  447. input {
  448. height: 66rpx;
  449. line-height: 66rpx;
  450. margin-top: 32rpx;
  451. // height: 88rpx;
  452. }
  453. .list-input {
  454. padding-left: 24rpx;
  455. // margin: 12rpx 0 ;
  456. // line-height: 66rpx;
  457. display: flex;
  458. align-items: center;
  459. width: 100%;
  460. font-size: 36rpx;
  461. flex: 1;
  462. color: #FF9797;
  463. border: 1rpx solid #f3afad;
  464. border-radius: 22rpx;
  465. text-align: left;
  466. padding-right: 24rpx;
  467. .input-placeholder {
  468. height: 70rpx;
  469. color: #FF9797;
  470. }
  471. }
  472. .box-right {
  473. display: flex;
  474. align-items: center;
  475. padding-left: 24rpx;
  476. height: 66rpx;
  477. line-height: 66rpx;
  478. border: 1rpx solid #f3afad;
  479. border-radius: 22rpx;
  480. margin: 32rpx 36rpx 0 36rpx;
  481. width: 96%;
  482. font-size: 36rpx;
  483. color: #FF9797;
  484. text-align: left;
  485. // line-height: 1;
  486. }
  487. }
  488. }
  489. }
  490. </style>