sqdl.vue 11 KB

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