sqdl.vue 8.4 KB

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