index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <view class="balance-content" :style="{'--status-bar-': statusBarHeight}">
  3. <view class="balance-content-info">
  4. <!-- 头部主要内容 开始 -->
  5. <view class="balance-content-header">
  6. <customNavbar
  7. title="余额提现"
  8. bgColor="#fff"
  9. :contentStyle="{color: '#000'}"
  10. ></customNavbar>
  11. </view>
  12. <!-- 头部主要内容 结束 -->
  13. <!-- userInfo内容 开始 -->
  14. <view class="balance-content-userinfo">
  15. <view class="balance-content-userinfo-box">
  16. <view class="balance-userinfo-info">
  17. <view class="balance-userinfo-title"><text>{{ withdrawInfo && withdrawInfo.name }}</text></view>
  18. <view class="balance-userinfo-count">
  19. <!-- 余额 -->
  20. <view
  21. class="balance-userinfo-money"
  22. >
  23. <text>
  24. <text class="inspage-userinfo-util">¥</text>
  25. <u-count-to :decimals="2" :startVal="0" :endVal="monry" color="#fff" />
  26. <text class="balance-userinfo-util">元</text>
  27. </text>
  28. <text>我的余额(元)</text>
  29. </view>
  30. <!-- 去提现 -->
  31. <view class="balance-userinfo-cash">
  32. <view @click="navigateToFun({url: '/pages/distributor/index'})">去提现</view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="balance-userinfo-tool">
  37. <view
  38. v-for="(item,index) in tool"
  39. :key="index"
  40. @click="navigateToFun(item)"
  41. >
  42. <image :class="['',index != 1 ?'balance-userinfo-tool-icon':'balance-userinfo-tool-icon1']" :src="item.icon"></image>
  43. <text>{{item.title}}</text>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <!-- userInfo内容 结束 -->
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import { navigateTo } from "@/utils/util.js"
  54. export default {
  55. data() {
  56. return {
  57. title: '余额提现',
  58. statusBarHeight: 0, // 状态栏安全距离
  59. monry: 0,
  60. tool: [ // 我的工具
  61. { title: "支付设置",icon: this.$commonConfig.staticUrl + 'balance/zhifu.png', url: '/pages/passwordSet/index?type=1' },
  62. { title: "收支明细",icon: this.$commonConfig.staticUrl + 'balance/mingxi.png', url: '/pages/consume/index' },
  63. ],
  64. withdrawInfo: {}
  65. }
  66. },
  67. onLoad() {
  68. },
  69. onShow() {
  70. this.statusBarHeight = getApp().globalData.statusBarHeight
  71. this.getWithdrawInfo()
  72. },
  73. methods: {
  74. /**
  75. * @author ygh
  76. * @data 2023-12-20
  77. */
  78. navigateToFun(item){
  79. if(this.withdrawInfo.ifPaySet == 0 && item.url == '/pages/cash/index'){
  80. uni.showModal({
  81. title: '提示',
  82. content: '请先设置密码!!!',
  83. success: res => {
  84. if(res.confirm){
  85. uni.navigateTo({
  86. url: '/pages/passwordSet/index?type=0'
  87. });
  88. }
  89. },
  90. complete() {
  91. }
  92. })
  93. }else {
  94. navigateTo(item.url)
  95. }
  96. },
  97. /**
  98. * 数字显示格式化
  99. *
  100. */
  101. numFormat(num=0) {
  102. if(num<100000) {
  103. return num
  104. }else if(num>100000){
  105. return (num/10000).toFixed(2)
  106. }
  107. },
  108. /**
  109. * 获取数据
  110. */
  111. async getWithdrawInfo() {
  112. try{
  113. let res = await this.$u.api.withdrawInfo({
  114. noSign: 1,
  115. userid: this.distribution_user_info.userId
  116. })
  117. if(res && res.code ===200) {
  118. this.withdrawInfo = res.data
  119. this.monry = res.data.withdrawTotal
  120. }
  121. }catch(e){
  122. //TODO handle the exception
  123. console.error("e===",e)
  124. }
  125. }
  126. }
  127. }
  128. </script>
  129. <style lang="scss" scoped>
  130. .balance-content {
  131. display: flex;
  132. flex-direction: column;
  133. align-items: center;
  134. justify-content: center;
  135. --header-h: 90rpx;
  136. .balance-content-info {
  137. width: 100%;
  138. box-sizing: border-box;
  139. }
  140. }
  141. /** 头部主要内容 开始 */
  142. .balance-content-header {
  143. width: 100%;
  144. height: var(--header-h);
  145. box-sizing: border-box;
  146. ::v-deep .u-search {
  147. padding: 0 30rpx !important;
  148. }
  149. ::v-deep .u-search__action {
  150. color: #fff !important;
  151. }
  152. }
  153. /** 头部主要内容 结束 **/
  154. /** userInfo内容 开始 */
  155. .balance-content-userinfo {
  156. width: 100%;
  157. padding: 24rpx 40rpx 0;
  158. box-sizing: border-box;
  159. .balance-content-userinfo-box {
  160. width: 100%;
  161. background: #F3F8FF;
  162. border-radius: 0rpx 0rpx 24rpx 24rpx;
  163. border-radius: 20rpx;
  164. box-sizing: border-box;
  165. .balance-userinfo-info {
  166. width: 100%;
  167. height: 320rpx;
  168. box-sizing: border-box;
  169. background: linear-gradient(to bottom, rgba(238, 12, 12, 1) 0%, rgba(243, 157, 159, 1) 100%);
  170. border-radius: 20rpx;
  171. box-shadow: 0rpx 0 20rpx 2rpx rgba(205, 205, 205, 0.50);
  172. display: flex;
  173. flex-direction: column;
  174. align-items: flex-start;
  175. justify-content: space-between;
  176. color: #fff;
  177. font-size: 28rpx;
  178. font-family: SourceHanSansCN, SourceHanSansCN;
  179. padding: 46rpx;
  180. .balance-userinfo-title {
  181. display: flex;
  182. width: 100%;
  183. box-sizing: border-box;
  184. }
  185. .balance-userinfo-count {
  186. width: 100%;
  187. display: flex;
  188. box-sizing: border-box;
  189. align-items: center;
  190. justify-content: space-between;
  191. .balance-userinfo-money {
  192. display: flex;
  193. justify-content: center;
  194. align-items: flex-start;
  195. flex-direction: column;
  196. > text:nth-child(1) {
  197. .balance-userinfo-util {
  198. font-size: 24rpx;
  199. margin-left: 5rpx;
  200. }
  201. ::v-deep .u-count-num {
  202. font-weight: bold !important;
  203. font-size: 48rpx !important;
  204. }
  205. }
  206. > text:nth-child(2) {
  207. margin-top: 20rpx;
  208. font-size: 24rpx;
  209. }
  210. }
  211. .balance-userinfo-cash {
  212. width: 144rpx;
  213. height: 50rpx;
  214. flex-shrink: 0;
  215. >view {
  216. width: 100%;
  217. height: 100%;
  218. display: flex;
  219. justify-content: center;
  220. align-items: center;
  221. background: #FFFFFF;
  222. border-radius: 24rpx;
  223. font-size: 24rpx;
  224. font-family: SourceHanSansCN, SourceHanSansCN;
  225. font-weight: 550;
  226. color: #EE1818;
  227. }
  228. }
  229. }
  230. }
  231. .balance-userinfo-tool {
  232. width: 100%;
  233. box-sizing: border-box;
  234. padding: 22rpx 0;
  235. display: flex;
  236. >view {
  237. flex: 1;
  238. display: flex;
  239. align-items: center;
  240. justify-content: center;
  241. color: rgba(78, 78, 78, 1);
  242. .balance-userinfo-tool-icon {
  243. width: 34rpx;
  244. height: 30rpx;
  245. }
  246. .balance-userinfo-tool-icon1 {
  247. width: 32rpx;
  248. height: 32rpx;
  249. }
  250. text {
  251. margin-left: 10rpx;
  252. font-size: 24rpx;
  253. }
  254. }
  255. }
  256. }
  257. }
  258. /** userInfo内容 结束 **/
  259. </style>