sqdl.vue 8.4 KB

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