sqdl.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. <template>
  2. <view class="content">
  3. <!-- <view class="flex nav-list">
  4. <view class="item" v-for="(item,index) in navList" :class="{'action': current == index}"
  5. @click="changeNavT(index)">
  6. {{item.tit}}
  7. </view>
  8. </view> -->
  9. <view class="" style="height: 20rpx;">
  10. </view>
  11. <view class="tab" v-if="auth == 0">
  12. <template v-if="current == 0">
  13. <view class="bd-wrap flex">
  14. <view class="bg-name">
  15. 真实姓名:
  16. </view>
  17. <view class="bg-val">
  18. <input type="text" value="" placeholder="请输入真实姓名" class="val-ipt" v-model="bankInfo.fullname"
  19. ref="name" />
  20. </view>
  21. </view>
  22. <view class="bd-wrap flex">
  23. <view class="bg-name">
  24. 银行卡号:
  25. </view>
  26. <view class="bg-val">
  27. <input type="text" value="" placeholder="请输入银行卡号" class="val-ipt" v-model="bankInfo.bankno"
  28. ref="address" />
  29. </view>
  30. </view>
  31. <view class="bd-wrap flex">
  32. <view class="bg-name">
  33. 开户行:
  34. </view>
  35. <view class="bg-val">
  36. <input type="text" value="" placeholder="请输入开户行" class="val-ipt" v-model="bankInfo.bank"
  37. ref="storenamae" />
  38. </view>
  39. </view>
  40. <view class="bd-wrap flex">
  41. <view class="bg-name">
  42. 所属支行:
  43. </view>
  44. <view class="bg-val">
  45. <input type="text" value="" placeholder="请输入所属支行" class="val-ipt" v-model="bankInfo.subbranch"
  46. ref="storenamae" />
  47. </view>
  48. </view>
  49. </template>
  50. <template v-if="current == 1">
  51. <view class="bd-wrap flex">
  52. <view class="bg-name">
  53. 真实姓名:
  54. </view>
  55. <view class="bg-val">
  56. <input type="text" value="" placeholder="请输入真实姓名" class="val-ipt" v-model="aliInfo.fullname"
  57. ref="name" />
  58. </view>
  59. </view>
  60. <view class="bd-wrap flex">
  61. <view class="bg-name">
  62. 支付宝账号:
  63. </view>
  64. <view class="bg-val">
  65. <input type="text" value="" placeholder="请输入支付宝账号" class="val-ipt" v-model="aliInfo.alino"
  66. ref="name" />
  67. </view>
  68. </view>
  69. <view class="bd-wrap flex">
  70. <view class="bg-name">
  71. 收款码:
  72. </view>
  73. <view class="bg-val">
  74. <!-- #ifdef APP -->
  75. <image v-if="!aliInfo.qr" src="../../static/img/add.png" mode="" @click="openAuth(1)"></image>
  76. <image v-else :src="aliInfo.qr" mode="" @click="openAuth(1)"></image>
  77. <!-- #endif -->
  78. <!-- #ifndef APP -->
  79. <image v-if="!aliInfo.qr" src="../../static/img/add.png" mode="" @click="upimg(1)"></image>
  80. <image v-else :src="aliInfo.qr" mode="" @click="upimg(1)"></image>
  81. <!-- #endif -->
  82. </view>
  83. </view>
  84. <view class="bd-wrap flex">
  85. <view class="bg-name">
  86. 手机号:
  87. </view>
  88. <view class="bg-val">
  89. <input type="text" value="" placeholder="请输入手机号" class="val-ipt" v-model="aliInfo.phone"
  90. ref="phone" />
  91. </view>
  92. </view>
  93. </template>
  94. <template v-if="current == 2">
  95. <view class="bd-wrap flex">
  96. <view class="bg-name">
  97. 真实姓名:
  98. </view>
  99. <view class="bg-val">
  100. <input type="text" value="" placeholder="请输入真实姓名" class="val-ipt" v-model="wxInfo.fullname"
  101. ref="name" />
  102. </view>
  103. </view>
  104. <view class="bd-wrap flex">
  105. <view class="bg-name">
  106. 微信账号:
  107. </view>
  108. <view class="bg-val">
  109. <input type="text" value="" placeholder="请输入微信账号" class="val-ipt" v-model="wxInfo.wxno"
  110. ref="name" />
  111. </view>
  112. </view>
  113. <view class="bd-wrap flex">
  114. <view class="bg-name">
  115. 收款码:
  116. </view>
  117. <view class="bg-val">
  118. <!-- #ifdef APP -->
  119. <image v-if="!wxInfo.qr" src="../../static/img/add.png" mode="" @click="openAuth()(2)"></image>
  120. <image v-else :src="wxInfo.qr" mode="" @click="openAuth(2)"></image>
  121. <!-- #endif -->
  122. <!-- #ifndef APP -->
  123. <image v-if="!wxInfo.qr" src="../../static/img/add.png" mode="" @click="upimg(2)"></image>
  124. <image v-else :src="wxInfo.qr" mode="" @click="upimg(2)"></image>
  125. <!-- #endif -->
  126. </view>
  127. </view>
  128. <view class="bd-wrap flex">
  129. <view class="bg-name">
  130. 手机号:
  131. </view>
  132. <view class="bg-val">
  133. <input type="text" value="" placeholder="请输入手机号" class="val-ipt" v-model="wxInfo.phone"
  134. ref="phone" />
  135. </view>
  136. </view>
  137. </template>
  138. <!-- <view class="bd-wrap flex">
  139. <view class="bg-name">
  140. 验证码:
  141. </view>
  142. <view class="bg-val flex">
  143. <input type="text" value="" placeholder="请输入验证码" class="val-iptt" v-model="captcha"
  144. ref="captcha" />
  145. <view class="code" @click="verification()">{{ countDown == 0 || countDown<0 ? '验证码' : countDown }}</view>
  146. </view>
  147. </view> -->
  148. </view>
  149. <view class="btm-btn" @click="bank">
  150. {{current == 0? '保存银行卡信息': (current == 1? '保存支付宝信息': '保存微信信息')}}
  151. </view>
  152. <!-- #ifdef APP-PLUS -->
  153. <yk-authpup ref="WRITE_EXTERNAL_STORAGE" type="top" @changeAuth="changeAuth"
  154. permissionID="WRITE_EXTERNAL_STORAGE"></yk-authpup>
  155. <!-- #endif -->
  156. </view>
  157. </template>
  158. <script>
  159. import ykAuthpup from "@/components/yk-authpup/yk-authpup";
  160. import { register, verify } from '@/api/login.js';
  161. import {
  162. enroll,
  163. loadIndexs
  164. } from '@/api/index.js'
  165. import {
  166. getLevelList,
  167. bank,
  168. bankInfo,
  169. setWx,
  170. setAli,
  171. getAli,
  172. getWx
  173. } from '@/api/user.js'
  174. import {
  175. mapState,
  176. mapMutations
  177. } from 'vuex';
  178. import { upload } from '@/api/order.js';
  179. export default {
  180. components: {
  181. ykAuthpup
  182. },
  183. data() {
  184. return {
  185. auth: 1,
  186. captcha: '',
  187. countDown: 0 ,//倒计时
  188. current: 0,
  189. navList: [{
  190. tit: '银行卡',
  191. info: {},
  192. },
  193. // {
  194. // tit: '支付宝',
  195. // info: {}
  196. // },
  197. // {
  198. // tit: '微信',
  199. // info: {}
  200. // }
  201. ],
  202. type: 1,
  203. aliInfo: {
  204. fultname: '',
  205. alino: '',
  206. qr: '',
  207. id: 0
  208. },
  209. wxInfo: {
  210. fultname: '',
  211. wxno: '',
  212. qr: '',
  213. id: 0
  214. },
  215. bankInfo: {
  216. fullname: '',
  217. phone: '',
  218. bankno: '',
  219. bank: '',
  220. subbranch: '',
  221. },
  222. loading: false,
  223. };
  224. },
  225. onLoad(opt) {
  226. },
  227. watch: {
  228. current(n, o) {
  229. }
  230. },
  231. onShow() {
  232. this.getbankInfo()
  233. this.getIndex()
  234. },
  235. onReachBottom() {
  236. },
  237. computed: {
  238. ...mapState('user', ['userInfo'])
  239. },
  240. methods: {
  241. getIndex() {
  242. loadIndexs().then(res => {
  243. this.auth = res.data.auth
  244. })
  245. },
  246. //发送验证码
  247. verification() {
  248. let obj = this;
  249. let index = this.current;
  250. let phone;
  251. if(index == 0) {
  252. phone = this.bankInfo.phone
  253. }else if(index == 1) {
  254. phone = this.aliInfo.phone
  255. }else if(index == 2) {
  256. phone = this.wxInfo.phone
  257. }
  258. // if (!phone) {
  259. // this.$api.msg('请输入手机号');
  260. // return;
  261. // }
  262. // if (phone.length < 11) {
  263. // this.$api.msg('请输入正确的手机号');
  264. // return;
  265. // }
  266. // 判断是否在倒计时
  267. if (obj.countDown > 0) {
  268. return false;
  269. } else {
  270. obj.countDown = 60;
  271. obj.time = setInterval(() => {
  272. obj.countDown--;
  273. }, 1000);
  274. //调用验证码接口
  275. verify({
  276. phone: phone,
  277. type: 'verify'
  278. })
  279. .then(({ data }) => {})
  280. .catch(err => {
  281. console.log(err);
  282. });
  283. }
  284. },
  285. openAuth(type) {
  286. this.typename = type
  287. this.$refs['WRITE_EXTERNAL_STORAGE'].open()
  288. },
  289. changeAuth() {
  290. this.upimg(this.typename)
  291. },
  292. upimg(type) {
  293. let that = this
  294. upload({
  295. file: ''
  296. })
  297. .then(e => {
  298. console.log(e,'e')
  299. if(type == 1) {
  300. that.aliInfo.qr = e[0].url
  301. }else {
  302. that.wxInfo.qr = e[0].url
  303. }
  304. })
  305. .catch(e => {});
  306. },
  307. changeNavT(index) {
  308. if (index == this.current) {
  309. return
  310. }
  311. this.current = index
  312. },
  313. getbankInfo() {
  314. bankInfo().then(res => {
  315. console.log(res);
  316. if (res.data && res.data.id) {
  317. this.bankInfo = res.data
  318. }
  319. })
  320. getAli().then(res => {
  321. if (res.data && res.data.id) {
  322. this.aliInfo = res.data
  323. }
  324. })
  325. getWx().then(res => {
  326. if (res.data && res.data.id) {
  327. this.wxInfo = res.data
  328. }
  329. })
  330. },
  331. // 选中城市切换
  332. onCityClick({
  333. data
  334. }) {
  335. // let address = this.addressData.address;
  336. // address.province = data[0];
  337. // address.city = data[1];
  338. // address.district = data[2];
  339. this.address = data.join('-');
  340. },
  341. bank() {
  342. let that = this
  343. let setInfo,qdata;
  344. if (that.loading) {
  345. return
  346. }
  347. if (that.current == 0) {
  348. // 校验银行卡
  349. setInfo = bank
  350. if (that.bankInfo.fullname == '') {
  351. return that.$api.msg('请输入您的姓名')
  352. }
  353. // if (that.bankInfo.phone == '') {
  354. // return that.$api.msg('请输入手机号')
  355. // }
  356. if (that.bankInfo.bankno == '') {
  357. return that.$api.msg('请输入银行卡号')
  358. }
  359. if (that.bankInfo.bank == '') {
  360. return that.$api.msg('请输入银行')
  361. }
  362. if (that.bankInfo.subbranch == '') {
  363. return that.$api.msg('请输入所属支行')
  364. }
  365. qdata = that.bankInfo
  366. } else if (that.current == 1) {
  367. //校验支付宝
  368. setInfo = setAli
  369. if (that.aliInfo.fullname == '') {
  370. return that.$api.msg('请输入您的姓名')
  371. }
  372. if (that.aliInfo.wxno == '') {
  373. return that.$api.msg('请输入支付宝账号')
  374. }
  375. if (that.aliInfo.qr == '') {
  376. return that.$api.msg('请上传支付宝收款码')
  377. }
  378. qdata = that.aliInfo
  379. } else if (that.current == 2) {
  380. //校验微信
  381. setInfo = setWx
  382. if (that.wxInfo.fullname == '') {
  383. return that.$api.msg('请输入您的姓名')
  384. }
  385. if (that.wxInfo.wxno == '') {
  386. return that.$api.msg('请输入微信账号')
  387. }
  388. if (that.wxInfo.qr == '') {
  389. return that.$api.msg('请上传微信收款码')
  390. }
  391. qdata = that.wxInfo
  392. }
  393. // qdata.captcha = that.captcha
  394. that.loading = true
  395. setInfo(qdata).then(res => {
  396. console.log(res);
  397. uni.showToast({
  398. title: '提交成功',
  399. duration: 2000
  400. });
  401. setTimeout(()=> {
  402. uni.navigateBack()
  403. },1500)
  404. }).catch(err => {
  405. console.log('err');
  406. that.loading = false
  407. })
  408. }
  409. }
  410. };
  411. </script>
  412. <style lang="scss" scoped>
  413. .tab {
  414. width: 690rpx;
  415. margin: auto;
  416. // height: 606rpx;
  417. background: #FFFFFF;
  418. border-radius: 10rpx;
  419. }
  420. .bd-wrap {
  421. width: 690rpx;
  422. // height: 100rpx;
  423. padding: 20rpx 0;
  424. background-color: #fff;
  425. border-bottom: 1px solid #f2f2f2;
  426. // line-height: 100rpx;
  427. font-size: 32rpx;
  428. position: relative;
  429. .code {
  430. position: absolute;
  431. width: 100rpx;
  432. height: 100rpx;
  433. right: 10rpx;
  434. color: #f64342;
  435. font-size: 23rpx;
  436. }
  437. .bg-name {
  438. width: 280rpx;
  439. height: 100%;
  440. padding-left: 20rpx;
  441. }
  442. .bg-val {
  443. width: 430rpx;
  444. height: 100%;
  445. .code {
  446. height: 100%;
  447. display: flex;
  448. justify-content: center;
  449. align-items: center;
  450. }
  451. .val-ipt {
  452. padding-top: 10rpx;
  453. display: inline-block;
  454. width: 100%;
  455. height: 100%;
  456. // background-color: #009100;
  457. padding-left: 10rpx;
  458. }
  459. .val-iptt {
  460. width: 70%;
  461. }
  462. image {
  463. width: 150rpx;
  464. height: 150rpx;
  465. }
  466. }
  467. }
  468. .btm-btn {
  469. margin: 60rpx auto 0;
  470. font-size: 34rpx;
  471. font-weight: 500;
  472. color: #FFFFFF;
  473. text-align: center;
  474. line-height: 82rpx;
  475. width: 560rpx;
  476. height: 80rpx;
  477. background: $base-color;
  478. border-radius: 40rpx;
  479. }
  480. .nav-list {
  481. justify-content: space-around;
  482. background-color: #fff;
  483. font-weight: 500;
  484. color: #333333;
  485. .item {
  486. padding: 28rpx 20rpx 16rpx;
  487. }
  488. .action {
  489. color: $base-color;
  490. border-bottom: 2px solid $base-color;
  491. }
  492. }
  493. </style>