sqdl.vue 8.8 KB

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