withdrawal.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. <template>
  2. <view class="content">
  3. <!-- <uni-notice-bar single="true" text="实际到账98%"></uni-notice-bar> -->
  4. <view class="content-money">
  5. <view class="flex " style="width: 750rpx;justify-content: space-around;margin-left: 0;">
  6. <view class="buttom">
  7. <view class="icon">{{ money | getMoneyStyle }}</view>
  8. <text class="text">可提现{{ showType }}</text>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="row-box">
  13. <view class="title">提现金额</view>
  14. <view class="row">
  15. <text class="tit">¥</text>
  16. <input class="input" type="number" v-model="withdrawal" placeholder="请输入提现金额" placeholder-class="placeholder" />
  17. <view class="buttom" @click="withdrawal = money">全部提现</view>
  18. </view>
  19. <view class="tip" v-if="withdrawal != 0">提现手续费{{ (withdrawal * 0.05 + 5).toFixed(6) * 1 }},可用阳光抵扣,当前阳光数量{{ userInfo.purple_integral }}</view>
  20. </view>
  21. <!-- #ifndef MP-WEIXIN -->
  22. <view class="list">
  23. <radio-group @change="tabRadio">
  24. <!-- <label>
  25. <view class="box">
  26. <view class="icon iconfont iconweixin1"></view>
  27. <view class="title-box">
  28. <view class="title"><text>提现至微信</text></view>
  29. </view>
  30. <view class="right"><radio value="weixin" color="#5dbc7c" :checked="type == 'weixin'" /></view>
  31. </view>
  32. </label> -->
  33. <label>
  34. <view class="box">
  35. <view class="icon iconfont iconzhifubao"></view>
  36. <view class="title-box">
  37. <view class="title">
  38. <text v-if="aliData.fullname">提现至支付宝</text>
  39. <text v-else>请创建支付宝账号</text>
  40. </view>
  41. <view class="node">
  42. <text v-if="aliData.fullname">真实姓名({{ aliData.fullname }})</text>
  43. </view>
  44. </view>
  45. <view class="right"><radio value="alipay" color="#ff0060" :checked="type == 'alipay'" /></view>
  46. </view>
  47. </label>
  48. <label>
  49. <view class="box">
  50. <view class="icon iconfont"><image class="icon-img" src="/static/icon/i8.png" mode="aspectFit"></image></view>
  51. <view class="title-box">
  52. <view class="title">
  53. <text v-if="bankData.bankno">{{ bankData.bank + ' ' + bankData.bankno }}</text>
  54. <text v-else>请创建银行账号</text>
  55. </view>
  56. <view class="node">
  57. <text v-if="bankData.fullname">真实姓名({{ bankData.fullname }})</text>
  58. </view>
  59. </view>
  60. <view class="right"><radio value="bank" color="#ff0060" :checked="type == 'bank'" /></view>
  61. </view>
  62. </label>
  63. </radio-group>
  64. </view>
  65. <!-- #endif -->
  66. <view class="row b-b" v-if="type == 'alipay'">
  67. <text class="tit">支付宝账号</text>
  68. <input class="input" type="text" v-model="alipay_code" placeholder="请输入支付宝账号" placeholder-class="placeholder" />
  69. </view>
  70. <view class="row b-b" v-if="type == 'alipay'">
  71. <text class="tit">支付宝姓名</text>
  72. <input class="input" type="text" v-model="alipay_name" placeholder="请输入支付宝姓名" placeholder-class="placeholder" />
  73. </view>
  74. <view class="row b-b" v-if="type == 'bank'">
  75. <text class="tit">银行卡号</text>
  76. <input class="input" type="text" v-model="bank_code" placeholder="请输入银行卡号" placeholder-class="placeholder" />
  77. </view>
  78. <view class="row b-b" v-if="type == 'bank'">
  79. <text class="tit">姓名</text>
  80. <input class="input" type="text" v-model="bank_people" placeholder="请输入银行卡姓名" placeholder-class="placeholder" />
  81. </view>
  82. <view class="row b-b" v-if="type == 'bank'">
  83. <text class="tit">所属银行</text>
  84. <input class="input" type="text" v-model="bank_name" placeholder="请输入所属银行" placeholder-class="placeholder" />
  85. </view>
  86. <button class="add-btn up" @click="confirm" :class="{ loading: load }">提交申请</button>
  87. <!-- <button class="add-btn modified" v-if="!weichatBsrowser" @click="navTo('/pages/money/account')">账号管理</button> -->
  88. </view>
  89. </template>
  90. <script>
  91. export default {
  92. filters: {
  93. getMoneyStyle
  94. },
  95. computed: {
  96. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  97. },
  98. data() {
  99. return {
  100. load: true,
  101. showType: '',
  102. from: '',
  103. type: 'alipay', //提现方式
  104. money: '0.00', //可提现金额
  105. freeze: '0.0', //冻结金额
  106. withdrawal: '', //提现金额
  107. minPrice: '', //最少提现金额
  108. aliData: {},
  109. bankData: {},
  110. alipay_code: '',
  111. alipay_name: '',
  112. bank_code: '',
  113. bank_people: '',
  114. bank_name: '',
  115. // #ifdef H5
  116. weichatBsrowser: false
  117. // #endif
  118. };
  119. },
  120. onLoad(options) {
  121. // #ifdef H5
  122. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  123. // #endif
  124. if (options.type) {
  125. this.from = options.type;
  126. if (this.from == 'purple') {
  127. this.showType = '肥料';
  128. }
  129. if (this.from == 'shop') {
  130. this.showType = '商家积分';
  131. }
  132. }
  133. //加载提现信息
  134. this.loadData();
  135. // // 加载提款账号信息
  136. // this.loadAli();
  137. // this.loadBank();
  138. },
  139. methods: {
  140. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  141. // 加载余额信息
  142. async loadData() {
  143. let obj = this;
  144. aliInfo().then(e => {
  145. console.log(e, 'eeee');
  146. obj.alipay_code = e.data.zfb.payment;
  147. obj.alipay_name = e.data.zfb.name;
  148. obj.alipay_phone = e.data.zfb.phone;
  149. obj.bank_code = e.data.bank.payment;
  150. obj.bank_people = e.data.bank.name;
  151. obj.bank_name = e.data.bank.bank;
  152. });
  153. getUserInfo({})
  154. .then(({ data }) => {
  155. console.log(data);
  156. this.setUserInfo(data);
  157. if (obj.from == 'purple') {
  158. obj.money = data.white_integral;
  159. }
  160. if (obj.from == 'shop') {
  161. obj.money = data.business_integral;
  162. }
  163. obj.load = false;
  164. })
  165. .catch(e => {
  166. console.log(e);
  167. });
  168. },
  169. // 跳转
  170. navTo(url) {
  171. uni.navigateTo({
  172. url: url
  173. });
  174. },
  175. // 切换选中对象
  176. tabRadio(e) {
  177. this.type = e.detail.value;
  178. },
  179. // 提交
  180. confirm() {
  181. if (this.load) {
  182. return;
  183. }
  184. let data = {
  185. extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
  186. money: this.withdrawal, //金额
  187. type: this.from == 'purple' ? 1 : 2 //0佣金1余额 1紫积分 2商家积分
  188. };
  189. if (this.withdrawal % 100 != 0) {
  190. uni.showToast({
  191. title: '提现金额为100的倍数',
  192. duration: 2000,
  193. mask: false,
  194. icon: 'none'
  195. });
  196. return;
  197. }
  198. if (this.withdrawal < this.minPrice) {
  199. uni.showToast({
  200. title: '提现金额不可少于' + this.minPrice,
  201. duration: 2000,
  202. mask: false,
  203. icon: 'none'
  204. });
  205. return;
  206. }
  207. if (this.type == 'alipay') {
  208. console.log('alipay');
  209. data.name = this.alipay_name;
  210. data.alipay_code = this.alipay_code;
  211. }
  212. if (this.type == 'bank') {
  213. data.name = this.bank_people;
  214. data.bankname = this.bank_name;
  215. data.cardnum = this.bank_code;
  216. }
  217. let zfbData = {
  218. type: 2,
  219. payment: this.alipay_code,
  220. name: this.alipay_name
  221. };
  222. let bankData = {
  223. type: 3,
  224. payment: this.bank_code,
  225. name: this.bank_people,
  226. bank: this.bank_name
  227. };
  228. let scdata = '';
  229. if (this.type == 'bank') {
  230. scdata = bankData;
  231. }
  232. if (this.type == 'alipay') {
  233. scdata = zfbData;
  234. }
  235. this.load = true;
  236. getMoneyType(scdata)
  237. .then(e => {
  238. console.log(e, 'eeeeee');
  239. this.$api.prePage().dataUp();
  240. })
  241. .catch(e => {
  242. console.log(e);
  243. });
  244. extractCash(data)
  245. .then(e => {
  246. this.loadData();
  247. uni.showToast({
  248. title: '提交成功',
  249. duration: 2000,
  250. position: 'top'
  251. });
  252. })
  253. .catch(e => {
  254. this.load = false;
  255. console.log();
  256. });
  257. }
  258. }
  259. };
  260. </script>
  261. <style lang="scss">
  262. page {
  263. height: 100%;
  264. }
  265. .content-money {
  266. padding: 30rpx 0;
  267. background: #ffffff;
  268. }
  269. .flex {
  270. background-color: #ffffff;
  271. text-align: center;
  272. margin: 0 30rpx;
  273. .buttom {
  274. width: 50%;
  275. }
  276. .interval {
  277. width: 2px;
  278. height: 60rpx;
  279. background-color: #eeeeee;
  280. }
  281. .icon {
  282. background-size: 100%;
  283. font-size: 42rpx;
  284. font-weight: bold;
  285. background-repeat: no-repeat;
  286. background-position: center;
  287. }
  288. }
  289. .row-box {
  290. margin-top: 30rpx;
  291. padding: 20rpx 30rpx;
  292. background: #fff;
  293. .row {
  294. display: flex;
  295. align-items: center;
  296. position: relative;
  297. height: 80rpx;
  298. .tit {
  299. flex-shrink: 0;
  300. width: 40rpx;
  301. font-size: 30rpx;
  302. }
  303. .input {
  304. flex: 1;
  305. font-size: 30rpx;
  306. }
  307. .iconlocation {
  308. font-size: 36rpx;
  309. }
  310. .buttom {
  311. color: #ff0060;
  312. }
  313. }
  314. }
  315. .add-btn {
  316. display: flex;
  317. align-items: center;
  318. justify-content: center;
  319. width: 690rpx;
  320. height: 80rpx;
  321. margin: 0 auto;
  322. margin-top: 30rpx;
  323. border-radius: 10rpx;
  324. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  325. &.modified {
  326. color: #ffffff;
  327. }
  328. &.up {
  329. color: #fff;
  330. }
  331. }
  332. .list {
  333. padding-left: 30rpx;
  334. margin-top: 30rpx;
  335. background-color: #ffffff;
  336. .box {
  337. display: flex;
  338. align-items: center;
  339. width: 100%;
  340. height: 120rpx;
  341. .icon {
  342. font-size: 48rpx;
  343. padding-right: 20rpx;
  344. .icon-img {
  345. height: 50rpx;
  346. width: 50rpx;
  347. }
  348. }
  349. .iconweixin1 {
  350. color: #18bf16;
  351. }
  352. .iconzhifubao {
  353. color: #08aaec;
  354. }
  355. .title-box {
  356. flex-grow: 1;
  357. text-align: left;
  358. }
  359. }
  360. }
  361. /deep/ .uni-radio-input {
  362. width: 45rpx;
  363. height: 45rpx;
  364. }
  365. .row {
  366. display: flex;
  367. align-items: center;
  368. position: relative;
  369. padding: 0 30upx;
  370. height: 110upx;
  371. background: #fff;
  372. .tit {
  373. flex-shrink: 0;
  374. width: 250upx;
  375. font-size: 30upx;
  376. }
  377. .input {
  378. flex: 1;
  379. font-size: 30upx;
  380. }
  381. .iconlocation {
  382. font-size: 36upx;
  383. }
  384. }
  385. </style>