WAuth.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <view :style="colorStyle">
  3. <form @submit="formSubmit" report-submit='true'>
  4. <view class='evaluate-con'>
  5. <view class='score'>
  6. <view class='textarea'>
  7. <view class='item acea-row row-between-wrapper'>
  8. <view>姓名:</view>
  9. <view class='input'><input type='text' name='name' v-model='info.name' :disabled="disabled" ></input>
  10. </view>
  11. </view>
  12. <view class='item acea-row row-between-wrapper'>
  13. <view>身份证:</view>
  14. <view class='input'><input type='text' name='id_card' v-model='info.id_card' :disabled="disabled"></input>
  15. </view>
  16. </view>
  17. <view class='item acea-row row-between-wrapper'>
  18. <view>银行卡号:</view>
  19. <view class='input'><input type='text' name='bank_code' v-model='info.bank_code' :disabled="disabled"></input>
  20. </view>
  21. </view>
  22. <view class='item acea-row row-between-wrapper'>
  23. <view>手机号:</view>
  24. <view class='input'><input type='text' name='mobile' v-model='info.mobile' :disabled="disabled"></input>
  25. </view>
  26. </view>
  27. <view class='list acea-row row-middle'>
  28. <view class='pictrue acea-row row-center-wrapper row-column' @click='disabled?"":uploadpic("front_image")'
  29. >
  30. <text class='iconfont icon-icon25201' v-if="!info.front_image"></text>
  31. <image :src='info.front_image' v-else></image>
  32. <view v-if="!info.front_image">身份证正面</view>
  33. </view>
  34. </view>
  35. <view class='list acea-row row-middle'>
  36. <view class='pictrue acea-row row-center-wrapper row-column' @click='disabled?"":uploadpic("back_image")'
  37. >
  38. <text class='iconfont icon-icon25201' v-if="!info.back_image"></text>
  39. <image :src='info.back_image' v-else></image>
  40. <view v-if="!info.back_image">身份证反面</view>
  41. </view>
  42. </view>
  43. </view>
  44. <button v-if="!disabled" class='evaluateBnt bg-color' formType="submit">立即提交</button>
  45. </view>
  46. </view>
  47. </form>
  48. <canvas canvas-id="canvas" v-if="canvasStatus"
  49. :style="{width: canvasWidth + 'px', height: canvasHeight + 'px',position: 'absolute',left:'-100000px',top:'-100000px'}"></canvas>
  50. </view>
  51. </template>
  52. <script>
  53. import {
  54. toLogin
  55. } from '@/libs/login.js';
  56. import {
  57. getUserInfo,
  58. } from '@/api/user.js';
  59. import {
  60. employee,
  61. sign_url,
  62. bank_info
  63. } from '@/api/new.js';
  64. import {
  65. mapGetters
  66. } from "vuex";
  67. import colors from "@/mixins/color";
  68. export default {
  69. components: {},
  70. mixins: [colors],
  71. data() {
  72. return {
  73. canvasWidth: "",
  74. canvasHeight: "",
  75. canvasStatus: false,
  76. // 判断是否可以输入
  77. disabled:false,
  78. info:{
  79. name:'',
  80. id_card:'',
  81. bank_code:'',
  82. mobile:'',
  83. front_image:'',
  84. back_image:'',
  85. }
  86. };
  87. },
  88. computed: mapGetters(['isLogin']),
  89. watch: {
  90. isLogin: {
  91. handler: function(newV, oldV) {
  92. if (newV) {
  93. this.getUserInfo();
  94. }
  95. },
  96. deep: true
  97. }
  98. },
  99. onLoad(options) {
  100. if (this.isLogin) {
  101. this.getUserInfo();
  102. } else {
  103. toLogin()
  104. }
  105. },
  106. methods: {
  107. // 加载用户数据
  108. getUserInfo(){
  109. const that= this;
  110. bank_info().then((res)=>{
  111. if(res.data.bank_code){
  112. that.disabled = true;
  113. const info = that.info;
  114. const bank_info = res.data;
  115. info.bank_code = bank_info.bank_code;
  116. info.name = bank_info.name;
  117. info.id_card = bank_info.cer_code;
  118. info.mobile = bank_info.mobile;
  119. info.front_image = bank_info.cer_front_img;
  120. info.back_image = bank_info.cer_reverse_img;
  121. if(!bank_info.sign_img){
  122. uni.showModal({
  123. title: '提示',
  124. content: '您已认证但还未签约请先签约完成',
  125. cancelText: '取消',
  126. confirmText: '立即签约',
  127. success: res => {
  128. if(res.confirm){
  129. that.sign_url();
  130. }
  131. },
  132. fail: () => {},
  133. complete: () => {}
  134. });
  135. }else{
  136. uni.showModal({
  137. title: '提示',
  138. content: '您已成功签约!',
  139. showCancel:false
  140. });
  141. }
  142. }
  143. console.log(res);
  144. })
  145. },
  146. // 获取签约
  147. sign_url(){
  148. uni.showLoading({
  149. title: '签约中',
  150. mask: true
  151. });
  152. sign_url().then((res)=>{
  153. // that.$util.Tips({
  154. // title: res.msg,
  155. // icon: 'success'
  156. // });
  157. // #ifdef APP
  158. plus.runtime.openURL(res.data.signUrl);
  159. // #endif
  160. // #ifdef H5
  161. window.location.href = res.data.signUrl;
  162. // #endif
  163. console.log(res);
  164. })
  165. },
  166. /**
  167. * 删除图片
  168. *
  169. */
  170. DelPic: function(type) {
  171. let that = this;
  172. that.info[type] = '';
  173. },
  174. /**
  175. * 上传文件
  176. *
  177. */
  178. uploadpic: function(type) {
  179. let that = this;
  180. this.canvasStatus = true
  181. that.$util.uploadImageChange({count:8,url:'upload/image'}, function(res) {
  182. that.info[type] = res.data.url;
  183. }, (res) => {
  184. this.canvasStatus = false
  185. }, (res) => {
  186. this.canvasWidth = res.w
  187. this.canvasHeight = res.h
  188. });
  189. },
  190. /**
  191. * 立即评价
  192. */
  193. formSubmit: function(e) {
  194. const that = this;
  195. if(!that.info.name){
  196. uni.showToast({
  197. title: '请填写名字',
  198. icon:'error'
  199. });
  200. return
  201. }
  202. if(!that.info.id_card){
  203. uni.showToast({
  204. title: '请填写身份证号码',
  205. icon:'error'
  206. });
  207. return
  208. }
  209. if(!that.info.bank_code){
  210. uni.showToast({
  211. title: '请填写银行卡号',
  212. icon:'error'
  213. });
  214. return
  215. }
  216. if(!that.info.mobile){
  217. uni.showToast({
  218. title: '请填写手机号',
  219. icon:'error'
  220. });
  221. return
  222. }
  223. if(!that.info.front_image){
  224. uni.showToast({
  225. title: '请上传身份证正面',
  226. icon:'error'
  227. });
  228. return
  229. }
  230. if(!that.info.back_image){
  231. uni.showToast({
  232. title: '请上传身份证反面',
  233. icon:'error'
  234. });
  235. return
  236. }
  237. uni.showLoading({
  238. title: "正在提交申请……"
  239. });
  240. employee(that.info).then(res => {
  241. uni.hideLoading();
  242. that.$util.Tips({
  243. title: res.msg,
  244. icon: 'success'
  245. });
  246. that.getUserInfo();
  247. }).catch(err => {
  248. uni.hideLoading();
  249. return that.$util.Tips({
  250. title: err
  251. });
  252. });
  253. }
  254. }
  255. }
  256. </script>
  257. <style lang="scss" scoped>
  258. .evaluate-con{
  259. .score {
  260. background-color: #fff;
  261. border-top: 1rpx solid #f5f5f5;
  262. font-size: 28rpx;
  263. color: #282828;
  264. padding: 30rpx;
  265. .textarea {
  266. border-radius: 10rpx;
  267. .item {
  268. padding: 30rpx 30rpx 30rpx 0;
  269. border-bottom: 1rpx solid #f2f2f2;
  270. font-size: 32rpx;
  271. color: #282828;
  272. .label{
  273. margin-right: 30rpx;
  274. }
  275. .input {
  276. width: 460rpx;
  277. text-align: right;
  278. color: #868686;
  279. input{
  280. text-align: right;
  281. }
  282. }
  283. }
  284. .list {
  285. margin-top: 25rpx;
  286. .pictrue {
  287. width: 690rpx;
  288. height: 436rpx;
  289. position: relative;
  290. font-size: 40rpx;
  291. color: #bbb;
  292. image {
  293. width: 100%;
  294. height: 100%;
  295. border-radius: 3rpx;
  296. }
  297. .icon-icon25201 {
  298. color: #bfbfbf;
  299. font-size: 150rpx;
  300. }
  301. }
  302. .pictrue:nth-last-child(1) {
  303. border: 1rpx solid #ddd;
  304. box-sizing: border-box;
  305. border-radius: 10rpx;
  306. }
  307. }
  308. }
  309. .evaluateBnt {
  310. font-size: 30rpx;
  311. color: #fff;
  312. width: 690rpx;
  313. height: 86rpx;
  314. border-radius: 43rpx;
  315. text-align: center;
  316. line-height: 86rpx;
  317. margin-top: 45rpx;
  318. }
  319. }
  320. }
  321. </style>