zhuanrang.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <template>
  2. <view>
  3. <!-- <view class="text-center text-red bg-white">{{form.remek}}</view> -->
  4. <view class=" padding">
  5. <view class=" padding bg">
  6. <u-form :model="forms" ref="uForm" label-position="top" :label-style='lableStyle'>
  7. <u-form-item label="本人手机号" :border-bottom='false'>
  8. <u-input :disabled="true" placeholder="请填写本人手机号" v-model="forms.phone" inputAlign="text-alight:left" />
  9. </u-form-item>
  10. <view class="margin-bottom" style="width: 100%;height: 1rpx;background: #F2F2F2;"></view>
  11. <u-form-item label="短信验证码" :border-bottom='false'>
  12. <view class="flex align-center justify-between" style="width: 100%;">
  13. <u-input placeholder="请填写(必填)" v-model="forms.code" inputAlign="text-alight:left" />
  14. <view class="buttons" @tap="getCode">
  15. {{tips}}
  16. <!-- <u-button class="buttons" @tap="getCode">{{tips}}</u-button> -->
  17. </view>
  18. <u-toast ref="uToast"></u-toast>
  19. <u-verification-code :seconds="seconds" @end="end" @start="start" ref="uCode"
  20. @change="codeChange"></u-verification-code>
  21. </view>
  22. </u-form-item>
  23. <view class="margin-bottom" style="width: 100%;height: 1rpx;background: #F2F2F2;"></view>
  24. <u-form-item label="转让人手机号" :border-bottom='false'>
  25. <u-input placeholder="请填写(必填) " v-model="forms.phone2" inputAlign="text-alight:left" />
  26. </u-form-item>
  27. </u-form>
  28. </view>
  29. <view class="margin-top padding bg">
  30. <u-form :model="forms" ref="uForm" label-position="top" :label-style='lableStyle'>
  31. <u-form-item label="企业名称" :border-bottom='false'>
  32. <u-input placeholder="请输入企业名称" :disabled="true" v-model="qiyeInfo.companyName"
  33. inputAlign="text-alight:left" />
  34. </u-form-item>
  35. <view class="margin-bottom" style="width: 100%;height: 1rpx;background: #F2F2F2;"></view>
  36. <view class="margin-bottom" style="width: 100%;height: 1rpx;background: #F2F2F2;"></view>
  37. <u-form-item label="营业地址" :border-bottom='false'>
  38. <u-input placeholder="请输入营业地址" :disabled="true" v-model="qiyeInfo.companyAddress"
  39. inputAlign="text-alight:left" />
  40. </u-form-item>
  41. <view class="margin-bottom" style="width: 100%;height: 1rpx;background: #F2F2F2;"></view>
  42. <u-form-item label="经营范围" :border-bottom='false'>
  43. <u-input placeholder="请输入经营范围" :disabled="true" v-model="qiyeInfo.companyScope"
  44. inputAlign="text-alight:left" />
  45. </u-form-item>
  46. <view class="margin-bottom" style="width: 100%;height: 1rpx;background: #F2F2F2;"></view>
  47. <u-form-item label="注册资金(万)" :border-bottom='false'>
  48. <u-input placeholder="请输入注册资金(万)" :disabled="true" v-model="qiyeInfo.companyRegisteredFund"
  49. inputAlign="text-alight:left" />
  50. </u-form-item>
  51. <view class="margin-bottom" style="width: 100%;height: 1rpx;background: #F2F2F2;"></view>
  52. <u-form-item label="注册时间" :border-bottom='false'>
  53. <u-input placeholder="请输入注册时间" :disabled="true" v-model="qiyeInfo.createTime"
  54. inputAlign="text-alight:left" />
  55. </u-form-item>
  56. <view class="margin-bottom" style="width: 100%;height: 1rpx;background: #F2F2F2;"></view>
  57. <u-form-item label="资质简介" :border-bottom='false'>
  58. <u-input placeholder="请输入资质简介" :disabled="true" v-model="qiyeInfo.companyDetails"
  59. inputAlign="text-alight:left" />
  60. </u-form-item>
  61. </u-form>
  62. </view>
  63. <u-button @click="submit()" class="margin-top" :custom-style="customStyle" shape="square" :hair-line="false">
  64. 转让
  65. </u-button>
  66. </view>
  67. </view>
  68. </template>
  69. <script>
  70. export default {
  71. data() {
  72. return {
  73. forms: {
  74. phone: '',
  75. phone2: '',
  76. code: '',
  77. },
  78. // disabled: false,
  79. lableStyle: {
  80. color: '#000000',
  81. fontSize: '30upx',
  82. fontWeight: 'bold'
  83. },
  84. customStyle: {
  85. backgroundColor: '#00B88F',
  86. color: '#FFFFFF',
  87. border: 0
  88. },
  89. tips: '',
  90. // refCode: null,
  91. seconds: 60,
  92. qiyeInfo: {},
  93. }
  94. },
  95. onLoad(e) {
  96. this.getQiyeInfo();
  97. this.forms.phone = uni.getStorageSync('phone')
  98. },
  99. onShow() {
  100. },
  101. methods: {
  102. //查询用户企业
  103. getQiyeInfo() {
  104. this.$Request.getT('/app/company/selectCompanyByUserId', {
  105. userId: uni.getStorageSync('userId')
  106. }).then(res => {
  107. if (res.code === 0) {
  108. this.qiyeInfo = res.data
  109. } else {
  110. uni.showModal({
  111. showCancel: false,
  112. title: '查询失败',
  113. content: res.msg
  114. });
  115. }
  116. });
  117. },
  118. //提交转让
  119. submit() {
  120. if (this.forms.phone == '') {
  121. uni.showToast({
  122. title: '请输入本人手机号',
  123. icon: 'none'
  124. })
  125. return
  126. }
  127. if (this.forms.code == '') {
  128. uni.showToast({
  129. title: '请输入验证码',
  130. icon: 'none'
  131. })
  132. return
  133. }
  134. if (this.forms.phone2 == '') {
  135. uni.showToast({
  136. title: '请输入转让人手机号',
  137. icon: 'none'
  138. })
  139. return
  140. }
  141. if (this.forms.phone == this.forms.phone2) {
  142. uni.showToast({
  143. title: '请勿转让企业给自己',
  144. icon: 'none'
  145. })
  146. return
  147. }
  148. let data = {
  149. phone: this.forms.phone,
  150. msg: this.forms.code,
  151. givePhone: this.forms.phone2
  152. }
  153. this.$Request.post('/app/company/giveCompany', data).then(res => {
  154. if (res.code === 0) {
  155. // uni.showToast({
  156. // title: '转让成功'
  157. // })
  158. this.forms = {
  159. phone: '',
  160. code: '',
  161. phone2: ''
  162. }
  163. this.goOut()
  164. // this.getQiyeInfo();
  165. } else {
  166. uni.showModal({
  167. showCancel: false,
  168. title: '提示',
  169. content: res.msg,
  170. confirmColor:'#00B88F',
  171. });
  172. }
  173. });
  174. },
  175. goOut() {
  176. let that = this
  177. uni.removeStorageSync('userName')
  178. uni.removeStorageSync('avatar')
  179. uni.removeStorageSync('userId')
  180. uni.removeStorageSync('token')
  181. uni.removeStorageSync('phone')
  182. // uni.removeStorageSync('userType')
  183. uni.removeStorageSync('zhiFuBaoName')
  184. uni.removeStorageSync('zhiFuBao')
  185. uni.removeStorageSync('invitationCode')
  186. uni.removeStorageSync('unionId')
  187. uni.removeStorageSync('openId')
  188. uni.removeStorageSync('isVIP')
  189. // uni.removeStorageSync('userType')
  190. uni.setStorageSync('userType',1)
  191. uni.showToast({
  192. title: '转让成功,请重新登录!',
  193. icon: 'none'
  194. })
  195. setTimeout(()=>{
  196. // uni.reLaunch({
  197. // url:'/pages/public/selectIdentity/selectIdentity'
  198. // })
  199. // uni.switchTab({
  200. // url:'/pages/my/index?out=yes'
  201. // })
  202. uni.reLaunch({
  203. url:'/pages/my/index'
  204. })
  205. },1000)
  206. },
  207. codeChange(text) {
  208. this.tips = text;
  209. },
  210. getCode() {
  211. if (this.$refs.uCode.canGetCode) {
  212. // 模拟向后端请求验证码
  213. uni.showLoading({
  214. title: '正在获取验证码'
  215. })
  216. let str = /^[1][3,5,7,8,9][0-9]{9}$/
  217. let mobile = this.forms.phone
  218. if (str.test(mobile) == false) {
  219. uni.showToast({
  220. title: '请输入正确的手机号',
  221. icon: 'none'
  222. })
  223. return
  224. }
  225. this.$Request.getT('/app/Login/sendMsg/' + mobile + '/forget').then(res => {
  226. if (res.code === 0) {
  227. uni.hideLoading();
  228. // 这里此提示会被this.start()方法中的提示覆盖
  229. this.$u.toast('验证码已发送');
  230. // 通知验证码组件内部开始倒计时
  231. this.$refs.uCode.start();
  232. } else {
  233. uni.hideLoading();
  234. uni.showModal({
  235. showCancel: false,
  236. title: '短信发送失败',
  237. content: res.msg ? res.msg : '请一分钟后再获取验证码'
  238. });
  239. }
  240. });
  241. } else {
  242. this.$u.toast('倒计时结束后再发送');
  243. }
  244. },
  245. end() {
  246. this.$u.toast('倒计时结束');
  247. },
  248. start() {
  249. this.$u.toast('倒计时开始');
  250. },
  251. }
  252. }
  253. </script>
  254. <style lang="less" scoped>
  255. page {
  256. background-color: #F7F7F7;
  257. }
  258. .bg {
  259. background-color: #FFFFFF;
  260. border-radius: 24upx;
  261. }
  262. .u-input__input {
  263. color: balck !important;
  264. }
  265. .title_btn {
  266. height: 78upx;
  267. line-height: 78upx;
  268. /* background: #f7f7f7; */
  269. }
  270. .buttons {
  271. border: 2upx solid #1A1A1A;
  272. border-radius: 45upx;
  273. // padding: 10upx 25upx;
  274. width: 200rpx;
  275. height: 60rpx;
  276. display: flex;
  277. justify-content: center;
  278. align-items: center;
  279. }
  280. </style>