withdraw.vue 9.3 KB

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