withdraw.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. <template>
  2. <view>
  3. <u-navbar title="提现"></u-navbar>
  4. <view class="withdraw">
  5. <view class="withdraw-head">
  6. <b>提现至</b><span>{{code}}</span>
  7. </view>
  8. <view class="withdraw-head">
  9. <b>选择提现站点</b>
  10. <span >
  11. <picker @change="bindPickerChange" range-key="name" :range="stationList">
  12. <view class="uni-input">{{stationObj.name?stationObj.name:'无站点'}}<text class="iconfont more">
  13. &#xe600;
  14. </text></view>
  15. </picker>
  16. </span>
  17. </view>
  18. <view class="withdraw-head">
  19. <b>上次提现时间</b><span>{{info.startTime}}</span>
  20. </view>
  21. <view class="withdraw-head">
  22. <b>本次提现时间</b><span>{{info.endTime}}</span>
  23. </view>
  24. <view class="withdraw-head">
  25. <b>此期间累计产生订单数</b><span>{{info.total}}笔</span>
  26. </view>
  27. <view class="withdraw-head">
  28. <b>此期间总分润金额</b><span class="whthdraw-price">{{info.amount?info.amount:0}}元</span>
  29. </view>
  30. <view class="withdraw-head">
  31. <b>此期间累计产生包月卡分润数</b><span>{{info.cardTotal}}笔</span>
  32. </view>
  33. <view class="withdraw-head">
  34. <b>此期间累计月卡分润金额</b><span class="whthdraw-price">{{info.cardAmount}}元</span>
  35. </view>
  36. <view class="withdraw-head">
  37. <b>分润提现明细表</b><span class="download" @click="ckdownload"><u-icon name="download"></u-icon> 下载</span>
  38. </view>
  39. <view class="withdraw-main" v-if="false">
  40. <p>申请提现金额(元)</p>
  41. <view class="withdraw-input">
  42. <span>¥</span>
  43. <u-input v-model="value" :type="type" placeholder-style="font-size:28px;height:40px;line-height:40px;color:#ccc;" />
  44. </view>
  45. </view>
  46. <view class="withdraw-head">
  47. <b>是否开票</b><span >
  48. <u-radio-group v-model="invoiceRequired" >
  49. <u-radio v-for="(item, index) in list2"
  50. style="margin-right: 16px;"
  51. :key="index+'a'" :name="item.value"
  52. :disabled="item.disabled" active-color="#00b962">
  53. {{item.name}}
  54. </u-radio>
  55. </u-radio-group>
  56. </span>
  57. </view>
  58. <view class="withdraw-head">
  59. <b>发票类型</b><span >
  60. <u-radio-group v-model="invoiceType" >
  61. <u-radio v-for="(item, index) in list1" :key="index+'a'" :name="item.value"
  62. :disabled="item.disabled" active-color="#00b962">
  63. {{item.name}}
  64. </u-radio>
  65. </u-radio-group>
  66. </span>
  67. </view>
  68. <view class="withdraw-head" >
  69. <b>开票税率(%)</b>
  70. <span class="withdraw-input">
  71. <u-input
  72. height="20px"
  73. placeholder="请输入内容"
  74. input-align="right"
  75. type="digit"
  76. v-model="taxRate"
  77. ></u-input>
  78. </span>
  79. </view>
  80. </view>
  81. <view class="applyBtn">
  82. <u-button :class="{
  83. 'applyBtn-btn':!info.amount
  84. }" @click="submit()" type="primary">申请提现,等待财务转账</u-button>
  85. </view>
  86. <view class="withdraw-tips">
  87. <h4>提现说明:</h4>
  88. <p>由于银行清算,提现申请将于次日内到账。如遇高峰期,可能延时到账,请耐心等待。</p>
  89. </view>
  90. </view>
  91. </template>
  92. <script>
  93. import * as API from '@/apis/finance.js'
  94. import {
  95. parseUnixTime,
  96. substrMb
  97. } from '@/utils'
  98. export default {
  99. data() {
  100. return {
  101. info:{},
  102. code:"",
  103. value: '',
  104. type: 'number',
  105. nowTime:"",
  106. taxRate:"",
  107. invo:"",
  108. invoiceRequired:"1",
  109. invoiceType:"1",
  110. stationList:[],
  111. stationObj:{},
  112. list1: [{
  113. name: '普票',
  114. value:"1"
  115. }, {
  116. name: '专票',
  117. value:"2"
  118. }],
  119. list2: [{
  120. name: '是',
  121. value:"1"
  122. }, {
  123. name: '否 ',
  124. value:"0"
  125. }],
  126. home:{
  127. accountBalance:0
  128. },
  129. }
  130. },
  131. onReady() {
  132. //this.getHomePage()
  133. },
  134. onShow(){
  135. this.nowTime=parseUnixTime(new Date())
  136. this.getHomePage()
  137. },
  138. methods: {
  139. ckdownload(){
  140. //this.value=this.info.amount
  141. if(!this.stationObj.id){
  142. uni.showToast({
  143. title: "请选择站点"
  144. })
  145. return
  146. }
  147. API.profitDetailsExcel({
  148. stationId:this.stationObj.id
  149. }).then((resDown) => {
  150. // uni.downloadFile({
  151. // url: resDown.data, //仅为示例,并非真实的资源
  152. // success: (res) => {
  153. // if (res.statusCode === 200) {
  154. // console.log('下载成功');
  155. // }
  156. // }
  157. // });
  158. if(resDown.data){
  159. window.location.href=resDown.data
  160. }else{
  161. uni.showToast({
  162. title:"无文件下载"
  163. })
  164. }
  165. }).catch(error => {
  166. uni.showToast({
  167. title:error
  168. })
  169. })
  170. },
  171. bindPickerChange(e){
  172. console.log(e)
  173. if(this.stationList[e.detail.value]){
  174. this.stationObj=this.stationList[e.detail.value];
  175. this.queryWithdrawInfo(this.stationObj.id)
  176. }
  177. },
  178. selectStation(){},
  179. submit(){
  180. //this.value=this.info.amount
  181. if(!this.stationObj.id){
  182. uni.showToast({
  183. title: "请选择站点"
  184. })
  185. return
  186. }
  187. var amount=0
  188. if(!this.info.amount&&!this.info.cardAmount){
  189. uni.showToast({
  190. title: "可提现金额为0"
  191. })
  192. return
  193. }
  194. amount=(this.info.amount*100+this.info.cardAmount*100)/100;
  195. uni.showLoading({
  196. title: "加载中",
  197. mask: true,
  198. })
  199. this.info.invoiceRequired=this.invoiceRequired
  200. this.info.invoiceType=this.invoiceType
  201. this.info.taxRate=this.taxRate
  202. this.info.stationId=this.stationObj.id;
  203. API.applyWithdraw(this.info).then((res) => {
  204. uni.redirectTo({
  205. url:"/pagesFinance/user/applyResult?value="+amount
  206. })
  207. }).catch(error => {
  208. uni.showModal({
  209. title:"提示",
  210. content:error,
  211. showCancel:false
  212. })
  213. })
  214. },
  215. queryWithdrawInfo(id){
  216. uni.showLoading({
  217. title: "加载中",
  218. mask: true,
  219. })
  220. API.queryWithdrawInfo({
  221. stationId:id
  222. }).then((res) => {
  223. this.info=res.data;
  224. uni.hideLoading()
  225. }).catch(error => {
  226. uni.showToast({
  227. title: error
  228. })
  229. })
  230. },
  231. getStationList(){
  232. uni.showLoading({
  233. title: "加载中",
  234. mask: true,
  235. })
  236. API.stationList().then((res) => {
  237. this.stationList=res.data.stationList;
  238. if(this.stationList.length){
  239. this.stationObj=this.stationList[0];
  240. this.queryWithdrawInfo(this.stationList[0].id)
  241. }
  242. uni.hideLoading()
  243. }).catch(error => {
  244. uni.showToast({
  245. title: error
  246. })
  247. })
  248. },
  249. getHomePage(){
  250. uni.showLoading({
  251. title: "加载中",
  252. mask: true,
  253. })
  254. API.homePage().then((res) => {
  255. this.home = res.data
  256. var bankCard="";
  257. if(this.home.bankCard){
  258. bankCard=substrMb(this.home.bankCard,0,4)+"****"+substrMb(this.home.bankCard,8,4)
  259. }
  260. this.code=this.home.bank+":"+bankCard;
  261. if(this.home.bank==null&&this.home.bankCard==null){
  262. this.code="未绑定"
  263. }
  264. uni.hideLoading()
  265. this.getStationList()
  266. }).catch(error => {
  267. uni.showToast({
  268. title: error
  269. })
  270. })
  271. }
  272. }
  273. }
  274. </script>
  275. <style>
  276. page{
  277. background-color: #F7F7F7;
  278. }
  279. </style>
  280. <style lang="scss" scoped>
  281. .download{
  282. color: #185AC6 ;
  283. }
  284. .withdraw-tips{
  285. margin:24px 16px;
  286. p{
  287. color:#999;
  288. margin-top: 4px;
  289. }
  290. }
  291. .withdraw{
  292. margin: 16px;
  293. background-color: #fff;
  294. padding: 16px 16px 0 16px;
  295. .withdraw-head{
  296. // margin: 16px 0;
  297. padding: 16px 0;
  298. border-bottom: 1px solid #f7f7f7;
  299. line-height: 20px;
  300. align-items: center;
  301. .whthdraw-price{
  302. font-size: 18px;
  303. color: #101010;
  304. font-weight: 600;
  305. }
  306. b{
  307. color:#999;
  308. }
  309. span{
  310. margin-left: 12px;
  311. float: right;
  312. }
  313. }
  314. .withdraw-main{
  315. border-top: 1px solid #f7f7f7;
  316. border-bottom: 1px solid #f7f7f7;
  317. margin: 16px 0;
  318. padding: 16px 0;
  319. .withdraw-input{
  320. margin-top: 32px;
  321. display: flex;
  322. align-items: center;
  323. font-size: 28px;
  324. /deep/.uni-input-input{
  325. font-size: 28px;
  326. }
  327. }
  328. }
  329. .withdraw-foot{
  330. display: flex;
  331. align-items: center;
  332. p{
  333. color:#999
  334. }
  335. span{
  336. color:#2979FF;
  337. margin-left: 16px;
  338. }
  339. }
  340. }
  341. .applyBtn{
  342. margin: 16px;
  343. }
  344. .applyBtn-btn{
  345. background-color: #185AC6;
  346. opacity: 0.5;
  347. border-color:#185AC6 ;
  348. border-radius: 8px;
  349. }
  350. </style>