sqdl.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  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,stype = 3) {
  200. let that = this
  201. upload({
  202. file: '',
  203. stype:stype
  204. })
  205. .then(e => {
  206. console.log(e,'e')
  207. if(type == 1) {
  208. that.aliInfo.qr = e[0].url
  209. }else {
  210. that.wxInfo.qr = e[0].url
  211. }
  212. })
  213. .catch(e => {});
  214. },
  215. changeNavT(index) {
  216. if (index == this.current) {
  217. return
  218. }
  219. this.current = index
  220. },
  221. getbankInfo() {
  222. bankInfo().then(res => {
  223. console.log(res);
  224. if (res.data && res.data.id) {
  225. this.bankInfo = res.data
  226. }
  227. })
  228. getAli().then(res => {
  229. if (res.data && res.data.id) {
  230. this.aliInfo = res.data
  231. }
  232. })
  233. getWx().then(res => {
  234. if (res.data && res.data.id) {
  235. this.wxInfo = res.data
  236. }
  237. })
  238. },
  239. // 选中城市切换
  240. onCityClick({
  241. data
  242. }) {
  243. // let address = this.addressData.address;
  244. // address.province = data[0];
  245. // address.city = data[1];
  246. // address.district = data[2];
  247. this.address = data.join('-');
  248. },
  249. bank() {
  250. let that = this
  251. let setInfo,qdata;
  252. if (that.loading) {
  253. return
  254. }
  255. if (that.current == 0) {
  256. // 校验银行卡
  257. setInfo = bank
  258. if (that.bankInfo.fullname == '') {
  259. return that.$api.msg('请输入您的姓名')
  260. }
  261. // if (that.bankInfo.phone == '') {
  262. // return that.$api.msg('请输入手机号')
  263. // }
  264. if (that.bankInfo.bankno == '') {
  265. return that.$api.msg('请输入银行卡号')
  266. }
  267. if (that.bankInfo.bank == '') {
  268. return that.$api.msg('请输入银行')
  269. }
  270. if (that.bankInfo.subbranch == '') {
  271. return that.$api.msg('请输入所属支行')
  272. }
  273. qdata = that.bankInfo
  274. } else if (that.current == 1) {
  275. //校验支付宝
  276. setInfo = setAli
  277. if (that.aliInfo.fullname == '') {
  278. return that.$api.msg('请输入您的姓名')
  279. }
  280. if (that.aliInfo.wxno == '') {
  281. return that.$api.msg('请输入支付宝账号')
  282. }
  283. if (that.aliInfo.qr == '') {
  284. return that.$api.msg('请上传支付宝收款码')
  285. }
  286. qdata = that.aliInfo
  287. } else if (that.current == 2) {
  288. //校验微信
  289. setInfo = setWx
  290. if (that.wxInfo.fullname == '') {
  291. return that.$api.msg('请输入您的姓名')
  292. }
  293. if (that.wxInfo.wxno == '') {
  294. return that.$api.msg('请输入微信账号')
  295. }
  296. if (that.wxInfo.qr == '') {
  297. return that.$api.msg('请上传微信收款码')
  298. }
  299. qdata = that.wxInfo
  300. }
  301. that.loading = true
  302. setInfo(qdata).then(res => {
  303. console.log(res);
  304. uni.showToast({
  305. title: '提交成功',
  306. duration: 2000
  307. });
  308. }).catch(err => {
  309. console.log('err');
  310. that.loading = false
  311. })
  312. }
  313. }
  314. };
  315. </script>
  316. <style lang="scss" scoped>
  317. .tab {
  318. width: 690rpx;
  319. margin: auto;
  320. // height: 606rpx;
  321. background: #FFFFFF;
  322. border-radius: 10rpx;
  323. }
  324. .bd-wrap {
  325. width: 690rpx;
  326. // height: 100rpx;
  327. padding: 20rpx 0;
  328. background-color: #fff;
  329. border-bottom: 1px solid #f2f2f2;
  330. // line-height: 100rpx;
  331. font-size: 32rpx;
  332. position: relative;
  333. .code {
  334. position: absolute;
  335. width: 100rpx;
  336. height: 100rpx;
  337. right: 10rpx;
  338. color: #f64342;
  339. font-size: 23rpx;
  340. }
  341. .bg-name {
  342. width: 280rpx;
  343. height: 100%;
  344. padding-left: 20rpx;
  345. }
  346. .bg-val {
  347. width: 430rpx;
  348. height: 100%;
  349. .val-ipt {
  350. padding-top: 10rpx;
  351. display: inline-block;
  352. width: 100%;
  353. height: 100%;
  354. // background-color: #009100;
  355. padding-left: 10rpx;
  356. }
  357. image {
  358. width: 150rpx;
  359. height: 150rpx;
  360. }
  361. }
  362. }
  363. .btm-btn {
  364. margin: 60rpx auto 0;
  365. font-size: 34rpx;
  366. font-weight: 500;
  367. color: #FFFFFF;
  368. text-align: center;
  369. line-height: 82rpx;
  370. width: 560rpx;
  371. height: 80rpx;
  372. background: #FA2740;
  373. border-radius: 40rpx;
  374. }
  375. .nav-list {
  376. justify-content: space-around;
  377. background-color: #fff;
  378. font-weight: 500;
  379. color: #333333;
  380. .item {
  381. padding: 28rpx 20rpx 16rpx;
  382. }
  383. .action {
  384. color: #EC5A54;
  385. border-bottom: 2px solid red;
  386. }
  387. }
  388. </style>