sqdl.vue 12 KB

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