MecRegister.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <template>
  2. <view class="content">
  3. <view class="content_box">
  4. <view class="row b-b">
  5. <text class="tit">机构名称</text>
  6. <input class="input" type="text" v-model="name" placeholder="请输入机构名称" placeholder-class="placeholder" />
  7. </view>
  8. <view class="row b-b">
  9. <text class="tit">联系电话</text>
  10. <input class="input" type="text" v-model="phone" placeholder="请输入联系电话"
  11. placeholder-class="placeholder" />
  12. </view>
  13. <view class="row b-b">
  14. <text class="tit">负责人</text>
  15. <input class="input" type="text" v-model="leader" placeholder="请输入负责人姓名"
  16. placeholder-class="placeholder" />
  17. </view>
  18. </view>
  19. <view class="content_box">
  20. <view class="row b-b" @tap="showPicker('region')">
  21. <text class="tit">省市区</text>
  22. <input class="input" @focus='outFocus' v-model="addr" placeholder="请选择省市区"></input>
  23. </view>
  24. <w-picker mode="region" :value="defaultRegion" default-type="value" @confirm="onConfirm($event,'region')"
  25. @cancel="handleCancel" ref="region"></w-picker>
  26. <view class="row b-b">
  27. <text class="tit">详细地址</text>
  28. <input class="input" type="text" v-model="address" placeholder="请输入商家地址"
  29. placeholder-class="placeholder" />
  30. </view>
  31. </view>
  32. <!-- <view class="content_box">
  33. <view class="examine_list">
  34. <view class="examine_name">营业执照</view>
  35. <view class="examine_img"><image :src="img" @click="scImg('img')"></image></view>
  36. </view>
  37. </view> -->
  38. <view class="check_box flex_item">
  39. <view>
  40. <radio style="transform: scale(0.75)" @click="Getcheckbox" color="#6786FB" :checked="checked" />
  41. </view>
  42. <view class="">我已阅读并同意<text @click="TOprivacy">《预约平台用户协议》</text></view>
  43. </view>
  44. <view class="check_box flex_item" style="font-size: 26rpx;">
  45. <view class="">注册完成后,务必关注公众号<text style="color:#6786FB ;">【共享预约平台】</text>,否则无法接收到消息推送!</view>
  46. </view>
  47. <view class="add-btn" @click="confirm">提交申请</view>
  48. </view>
  49. </template>
  50. <script>
  51. import {
  52. mapState,
  53. mapMutations
  54. } from 'vuex';
  55. import uniList from '@/components/uni-list/uni-list.vue';
  56. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  57. import wPicker from "@/components/w-picker/w-picker.vue"
  58. import {
  59. setOrgan
  60. } from "@/api/index.js"
  61. import {
  62. getUserInfo
  63. } from '@/api/login.js';
  64. // import { upload } from '@/api/index.js';
  65. export default {
  66. components: {
  67. uniList,
  68. uniListItem,
  69. wPicker
  70. },
  71. data() {
  72. return {
  73. loading: false,
  74. checked: false,
  75. name: '', //机构名称
  76. phone: "",
  77. region: '',
  78. defaultRegion: [],
  79. defaultRegion1: [],
  80. options: [],
  81. leader: '', //负责人
  82. addr: '', //省市区
  83. address: '', //详细地址
  84. // img:'/static/img/add.png',
  85. };
  86. },
  87. onLoad(option) {
  88. let jginfo = uni.getStorageSync('jginfo') || ''
  89. console.log(jginfo, '获取jginfo')
  90. if (jginfo) {
  91. this.name = jginfo.name
  92. this.phone = jginfo.phone
  93. this.province = jginfo.province
  94. this.province_id = jginfo.province_id
  95. this.city = jginfo.city
  96. this.city_id = jginfo.city_id
  97. this.district = jginfo.district
  98. this.district_id = jginfo.district_id
  99. this.leader = jginfo.leader
  100. this.address = jginfo.address
  101. this.addr = jginfo.addr
  102. }
  103. },
  104. methods: {
  105. ...mapMutations(['setUserInfo']),
  106. TOprivacy() {
  107. uni.navigateTo({
  108. url: '/pages/public/uagreement'
  109. })
  110. },
  111. //省市区弹窗
  112. showPicker(type) {
  113. this.$refs[type].show();
  114. },
  115. // scImg(item) {
  116. // upload({
  117. // file: ''
  118. // }).then(e => {
  119. // }).catch((e) => {
  120. // });
  121. // },
  122. //阅读并同意
  123. Getcheckbox() {
  124. let obj = this;
  125. obj.checked = !obj.checked;
  126. },
  127. //取消弹窗
  128. handleCancel() {
  129. },
  130. outFocus(e) {
  131. console.log(event.target)
  132. event.target.blur()
  133. },
  134. //省市区选择确定
  135. onConfirm(res, type) {
  136. let obj = this;
  137. obj.result = res;
  138. console.log(res, 'res')
  139. obj.addr = res.result;
  140. if (res.name) {
  141. obj.province = res.name[0];
  142. obj.city = res.name[1];
  143. obj.district = res.name[2];
  144. } else {
  145. obj.province = '北京市';
  146. obj.city = '北京市';
  147. obj.district = '东城区';
  148. }
  149. obj.province_id = res.value[0];
  150. obj.city_id = res.value[1];
  151. obj.district_id = res.value[2];
  152. obj.hospital = ''; //重置医院
  153. },
  154. //提交
  155. confirm() {
  156. let obj = this;
  157. if (obj.loading) {
  158. return
  159. }
  160. if (!obj.name) {
  161. obj.$api.msg('请填写机构名称');
  162. return;
  163. }
  164. if (!obj.phone) {
  165. obj.$api.msg('请填写联系电话');
  166. return;
  167. }
  168. if (!obj.leader) {
  169. obj.$api.msg('请填写负责人姓名');
  170. return;
  171. }
  172. if (!obj.addr) {
  173. obj.$api.msg('请选择省市区');
  174. return;
  175. }
  176. if (!obj.address) {
  177. obj.$api.msg('请填写详细地址');
  178. return;
  179. }
  180. if (obj.checked == false) {
  181. obj.$api.msg('请阅读并同意机构入驻协议');
  182. return;
  183. }
  184. obj.loading = true
  185. // let jginfo = {
  186. // name: obj.name,
  187. // phone: obj.phone,
  188. // province: obj.province,
  189. // province_id: obj.province_id,
  190. // city: obj.city,
  191. // city_id: obj.city_id,
  192. // district: obj.district,
  193. // district_id: obj.district_id,
  194. // leader: obj.leader,
  195. // address: obj.address,
  196. // addr: obj.addr
  197. // }
  198. // console.log(jginfo, 'jginfo++++++++++++++')
  199. // uni.setStorageSync('jginfo', jginfo)
  200. setOrgan({
  201. name: obj.name,
  202. mobile: obj.phone,
  203. province: obj.province,
  204. province_id: obj.province_id,
  205. city: obj.city,
  206. city_id: obj.city_id,
  207. district: obj.district,
  208. district_id: obj.district_id,
  209. leader: obj.leader,
  210. detail_address: obj.address,
  211. latitude: 1,
  212. longitude: 1
  213. })
  214. .then(function(e) {
  215. obj.loading = false
  216. obj.$api.msg(e.msg);
  217. obj.userInfo();
  218. let jginfo = {
  219. name: obj.name,
  220. phone: obj.phone,
  221. province: obj.province,
  222. province_id: obj.province_id,
  223. city: obj.city,
  224. city_id: obj.city_id,
  225. district: obj.district,
  226. district_id: obj.district_id,
  227. leader: obj.leader,
  228. address: obj.address,
  229. addr: obj.addr
  230. }
  231. console.log(jginfo, 'jginfo++++++++++++++')
  232. uni.setStorageSync('jginfo', jginfo)
  233. if (e.msg == '已提交,请等待审核!') {
  234. setTimeout(function() {
  235. // uni.switchTab({
  236. // url: '/pages/index/home'
  237. // })
  238. // document.addEventListener(
  239. // "WeixinJSBridgeReady",
  240. // function() {
  241. // WeixinJSBridge.call("closeWindow");
  242. // },
  243. // false
  244. // );
  245. // //ios手机
  246. // WeixinJSBridge.call("closeWindow");
  247. uni.navigateTo({
  248. url: '/pages/public/erweima'
  249. })
  250. }, 2000);
  251. }
  252. })
  253. .catch(e => {
  254. obj.loading = false
  255. console.log(e)
  256. });
  257. },
  258. //选择身份后更新用户信息
  259. userInfo() {
  260. getUserInfo({})
  261. .then(function(e) {
  262. console.log(e);
  263. uni.setStorageSync('userInfo', e.data);
  264. })
  265. .catch(function(e) {
  266. console.log(e);
  267. });
  268. },
  269. //跳转机构入驻协议
  270. // toagreement(){
  271. // uni.navigateTo({
  272. // url: '/pages/public/agreement'
  273. // });
  274. // },
  275. }
  276. };
  277. </script>
  278. <style lang="scss">
  279. page {
  280. background: $page-color-base;
  281. padding-top: 25rpx;
  282. }
  283. .content_box {
  284. background-color: #ffffff;
  285. width: 92%;
  286. margin: 0rpx auto;
  287. border-radius: 15rpx;
  288. margin-bottom: 25rpx;
  289. }
  290. .row {
  291. display: flex;
  292. align-items: center;
  293. // position: relative;
  294. padding: 0 30rpx;
  295. height: 110rpx;
  296. background: #fff;
  297. border-bottom: 1rpx solid #f8f6f6;
  298. .tit {
  299. flex-shrink: 0;
  300. width: 180rpx;
  301. font-size: 30rpx;
  302. color: $font-color-dark;
  303. }
  304. .input {
  305. flex: 1;
  306. font-size: 30rpx;
  307. color: $font-color-dark;
  308. }
  309. .iconlocation {
  310. font-size: 36rpx;
  311. color: $font-color-light;
  312. }
  313. }
  314. .examine_name {
  315. color: #171717;
  316. font-size: 28rpx;
  317. padding: 25rpx 25rpx;
  318. }
  319. .examine_img {
  320. width: 100%;
  321. text-align: center;
  322. padding-bottom: 25rpx;
  323. }
  324. .examine_img image {
  325. width: 200rpx;
  326. height: 200rpx;
  327. }
  328. .default-row {
  329. margin-top: 16rpx;
  330. .tit {
  331. flex: 1;
  332. }
  333. switch {
  334. transform: translateX(16rpx) scale(0.9);
  335. }
  336. }
  337. .add-btn {
  338. position: fixed;
  339. bottom: 0rpx;
  340. width: 100%;
  341. height: 100rpx;
  342. font-size: $font-lg;
  343. color: #fff;
  344. background-color: #6786FB;
  345. line-height: 100rpx;
  346. text-align: center;
  347. }
  348. .img_box {
  349. padding: 35rpx 35rpx;
  350. width: 250rpx;
  351. height: 250rpx;
  352. }
  353. .img_box image {
  354. width: 100%;
  355. height: 100%;
  356. }
  357. .alert-box {
  358. background-color: #ffffff;
  359. }
  360. .b-b:after {
  361. position: relative !important;
  362. }
  363. .check_box {
  364. padding: 25rpx 25rpx;
  365. font-size: 28rpx;
  366. text {
  367. color: #6786FB;
  368. }
  369. }
  370. </style>