withdraw.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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>{{info.amount?info.amount:0}}元</span>
  29. </view>
  30. <view class="withdraw-main" v-if="false">
  31. <p>申请提现金额(元)</p>
  32. <view class="withdraw-input">
  33. <span>¥</span>
  34. <u-input v-model="value" :type="type" placeholder-style="font-size:28px;height:40px;line-height:40px;color:#ccc;" />
  35. </view>
  36. </view>
  37. <view class="withdraw-head">
  38. <b>是否开票</b><span >
  39. <u-radio-group v-model="invoiceRequired" >
  40. <u-radio v-for="(item, index) in list2"
  41. style="margin-right: 16px;"
  42. :key="index+'a'" :name="item.value"
  43. :disabled="item.disabled" active-color="#00b962">
  44. {{item.name}}
  45. </u-radio>
  46. </u-radio-group>
  47. </span>
  48. </view>
  49. <view class="withdraw-head">
  50. <b>发票类型</b><span >
  51. <u-radio-group v-model="invoiceType" >
  52. <u-radio v-for="(item, index) in list1" :key="index+'a'" :name="item.value"
  53. :disabled="item.disabled" active-color="#00b962">
  54. {{item.name}}
  55. </u-radio>
  56. </u-radio-group>
  57. </span>
  58. </view>
  59. <view class="withdraw-head" >
  60. <b>开票税率(%)</b>
  61. <span class="withdraw-input">
  62. <u-input
  63. height="20px"
  64. placeholder="请输入内容"
  65. input-align="right"
  66. type="digit"
  67. v-model="taxRate"
  68. ></u-input>
  69. </span>
  70. </view>
  71. </view>
  72. <view class="applyBtn">
  73. <u-button :class="{
  74. 'applyBtn-btn':!info.amount
  75. }" @click="submit()" type="primary">申请提现,等待财务转账</u-button>
  76. </view>
  77. <view class="withdraw-tips">
  78. <h4>提现说明:</h4>
  79. <p>由于银行清算,提现申请将于次日内到账。如遇高峰期,可能延时到账,请耐心等待。</p>
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. import * as API from '@/apis/finance.js'
  85. import {
  86. parseUnixTime,
  87. substrMb
  88. } from '@/utils'
  89. export default {
  90. data() {
  91. return {
  92. info:{},
  93. code:"",
  94. value: '',
  95. type: 'number',
  96. nowTime:"",
  97. taxRate:"",
  98. invo:"",
  99. invoiceRequired:"1",
  100. invoiceType:"1",
  101. stationList:[],
  102. stationObj:{},
  103. list1: [{
  104. name: '普票',
  105. value:"1"
  106. }, {
  107. name: '专票',
  108. value:"2"
  109. }],
  110. list2: [{
  111. name: '是',
  112. value:"1"
  113. }, {
  114. name: '否 ',
  115. value:"0"
  116. }],
  117. home:{
  118. accountBalance:0
  119. },
  120. }
  121. },
  122. onReady() {
  123. //this.getHomePage()
  124. },
  125. onShow(){
  126. this.nowTime=parseUnixTime(new Date())
  127. this.getHomePage()
  128. },
  129. methods: {
  130. bindPickerChange(e){
  131. console.log(e)
  132. if(this.stationList[e.detail.value]){
  133. this.stationObj=this.stationList[e.detail.value];
  134. this.queryWithdrawInfo(this.stationObj.id)
  135. }
  136. },
  137. selectStation(){},
  138. submit(){
  139. //this.value=this.info.amount
  140. if(!this.stationObj.id){
  141. uni.showToast({
  142. title: "请选择站点"
  143. })
  144. return
  145. }
  146. if(!this.info.amount){
  147. uni.showToast({
  148. title: "可提现金额为0"
  149. })
  150. return
  151. }
  152. uni.showLoading({
  153. title: "加载中",
  154. mask: true,
  155. })
  156. this.info.invoiceRequired=this.invoiceRequired
  157. this.info.invoiceType=this.invoiceType
  158. this.info.taxRate=this.taxRate
  159. this.info.stationId=this.stationObj.id;
  160. API.applyWithdraw(this.info).then((res) => {
  161. uni.redirectTo({
  162. url:"/pagesFinance/user/applyResult?value="+this.info.amount
  163. })
  164. }).catch(error => {
  165. uni.showModal({
  166. title:"提示",
  167. content:"error",
  168. showCancel:false
  169. })
  170. })
  171. },
  172. queryWithdrawInfo(id){
  173. uni.showLoading({
  174. title: "加载中",
  175. mask: true,
  176. })
  177. API.queryWithdrawInfo({
  178. stationId:id
  179. }).then((res) => {
  180. this.info=res.data;
  181. uni.hideLoading()
  182. }).catch(error => {
  183. uni.showToast({
  184. title: error
  185. })
  186. })
  187. },
  188. getStationList(){
  189. uni.showLoading({
  190. title: "加载中",
  191. mask: true,
  192. })
  193. API.stationList().then((res) => {
  194. this.stationList=res.data.stationList;
  195. if(this.stationList.length){
  196. this.stationObj=this.stationList[0];
  197. this.queryWithdrawInfo(this.stationList[0].id)
  198. }
  199. uni.hideLoading()
  200. }).catch(error => {
  201. uni.showToast({
  202. title: error
  203. })
  204. })
  205. },
  206. getHomePage(){
  207. uni.showLoading({
  208. title: "加载中",
  209. mask: true,
  210. })
  211. API.homePage().then((res) => {
  212. this.home = res.data
  213. var bankCard="";
  214. if(this.home.bankCard){
  215. bankCard=substrMb(this.home.bankCard,0,4)+"****"+substrMb(this.home.bankCard,8,4)
  216. }
  217. this.code=this.home.bank+":"+bankCard;
  218. if(this.home.bank==null&&this.home.bankCard==null){
  219. this.code="未绑定"
  220. }
  221. uni.hideLoading()
  222. this.getStationList()
  223. }).catch(error => {
  224. uni.showToast({
  225. title: error
  226. })
  227. })
  228. }
  229. }
  230. }
  231. </script>
  232. <style>
  233. page{
  234. background-color: #F7F7F7;
  235. }
  236. </style>
  237. <style lang="scss" scoped>
  238. .withdraw-tips{
  239. margin:24px 16px;
  240. p{
  241. color:#999;
  242. margin-top: 4px;
  243. }
  244. }
  245. .withdraw{
  246. margin: 16px;
  247. background-color: #fff;
  248. padding: 16px;
  249. .withdraw-head{
  250. // margin: 16px 0;
  251. padding: 16px 0;
  252. border-bottom: 1px solid #f7f7f7;
  253. align-items: center;
  254. b{
  255. color:#999;
  256. }
  257. span{
  258. margin-left: 12px;
  259. float: right;
  260. }
  261. }
  262. .withdraw-main{
  263. border-top: 1px solid #f7f7f7;
  264. border-bottom: 1px solid #f7f7f7;
  265. margin: 16px 0;
  266. padding: 16px 0;
  267. .withdraw-input{
  268. margin-top: 32px;
  269. display: flex;
  270. align-items: center;
  271. font-size: 28px;
  272. /deep/.uni-input-input{
  273. font-size: 28px;
  274. }
  275. }
  276. }
  277. .withdraw-foot{
  278. display: flex;
  279. align-items: center;
  280. p{
  281. color:#999
  282. }
  283. span{
  284. color:#2979FF;
  285. margin-left: 16px;
  286. }
  287. }
  288. }
  289. .applyBtn{
  290. margin: 16px;
  291. }
  292. .applyBtn-btn{
  293. background-color: #185AC6;
  294. opacity: 0.5;
  295. border-color:#185AC6 ;
  296. border-radius: 8px;
  297. }
  298. </style>