推广小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

219 lines
4.0 KiB

5 months ago
  1. <template>
  2. <view class="page">
  3. <navbar title="提现"
  4. bgColor="#A3D250"
  5. color="#fff"
  6. leftClick
  7. @leftClick="$utils.navigateBack" />
  8. <view class="bg"/>
  9. <view class="price">
  10. <view class="title">
  11. 请输入提现金额
  12. </view>
  13. <view class="input-box">
  14. <view class="input">
  15. <input type="text" v-model="form.money"/>
  16. </view>
  17. <view class=""
  18. @click="selectAll">
  19. 全部提现
  20. </view>
  21. </view>
  22. <view class="num">
  23. 可提现金额{{ riceInfo.canWithdraw || 0 }}
  24. </view>
  25. </view>
  26. <view class="cell">
  27. <view class="cell-top">提现说明</view>
  28. <view style="padding: 0 20rpx;">
  29. <uv-parse :content="configList.withdrawal_instructions"></uv-parse>
  30. </view>
  31. </view>
  32. <view class="uni-color-btn"
  33. @click="submit">
  34. 提现
  35. </view>
  36. <view class="cell">
  37. <view class="cell-top">提现记录</view>
  38. <view class="cell-box"
  39. :key="index"
  40. v-for="(item,index) in list">
  41. <uv-cell-group>
  42. <uv-cell
  43. :title="item.title"
  44. :label="item.createTime"
  45. :center="true">
  46. <template #value>
  47. <view class="cell-text">
  48. <view class="price-text"
  49. v-if="item.type">{{ type[item.type] }}{{ item.money }}</view>
  50. <view class="price-text add"
  51. v-else>{{ type[item.type] }}{{ item.money }}</view>
  52. <view class="tips">{{ state[item.state] }}</view>
  53. </view>
  54. </template>
  55. </uv-cell>
  56. </uv-cell-group>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. import mixinsList from '@/mixins/list.js'
  63. import { mapState } from 'vuex'
  64. export default {
  65. mixins : [mixinsList],
  66. data() {
  67. return {
  68. mixinsListApi : 'getWaterPageList',
  69. list : [],
  70. type : ['+', '-'],
  71. state : ['未到账', '已到账'],
  72. form : {
  73. money : 0,
  74. },
  75. }
  76. },
  77. computed: {
  78. ...mapState(['userInfo', 'riceInfo']),
  79. },
  80. onShow() {
  81. this.$store.commit('getUserInfo')
  82. this.$store.commit('getRiceInfo')
  83. },
  84. methods: {
  85. selectAll(){
  86. this.form.money = this.riceInfo.canWithdraw
  87. },
  88. submit(){
  89. if(this.$utils.verificationAll(this.form, {
  90. money : '请输入金额'
  91. })){
  92. return
  93. }
  94. if(this.form.money <= 0){
  95. uni.showToast({
  96. title: '输入金额必须大于0',
  97. icon: 'none'
  98. })
  99. return
  100. }
  101. this.$api('withdraw', this.form, res => {
  102. if(res.code == 200){
  103. uni.showToast({
  104. title: '提现成功',
  105. icon : 'none'
  106. })
  107. this.form.money = 0
  108. this.$store.commit('getUserInfo')
  109. this.$store.commit('getRiceInfo')
  110. this.getData()
  111. }
  112. })
  113. },
  114. },
  115. }
  116. </script>
  117. <style scoped lang="scss">
  118. .page{
  119. .bg{
  120. background-color: $uni-color;
  121. height: 380rpx;
  122. position: absolute;
  123. left: 0;
  124. width: 100%;
  125. z-index: -1;
  126. border-bottom-left-radius: 30rpx;
  127. border-bottom-right-radius: 30rpx;
  128. }
  129. .price{
  130. color: #FFFFFF;
  131. padding: 40rpx;
  132. .title{
  133. color: #eee;
  134. font-size: 28rpx;
  135. }
  136. .input-box{
  137. background-color: #FFFFFF;
  138. color: $uni-color;
  139. display: flex;
  140. justify-content: center;
  141. border-radius: 30rpx;
  142. align-items: center;
  143. padding: 10rpx;
  144. margin: 20rpx 0;
  145. .input{
  146. color: #000;
  147. font-size: 40rpx;
  148. font-weight: 900;
  149. display: flex;
  150. flex: 1;
  151. input{
  152. flex: 1;
  153. padding: 14rpx 20rpx;
  154. }
  155. }
  156. }
  157. .num{
  158. font-size: 30rpx;
  159. font-weight: 900;
  160. margin-top: 10rpx;
  161. }
  162. }
  163. .cell {
  164. margin: 20rpx;
  165. background-color: #FFFFFF;
  166. border-radius: 16rpx;
  167. .cell-top {
  168. padding: 40rpx 34rpx;
  169. color: #474747;
  170. font-size: 34rpx;
  171. font-weight: 600;
  172. position: relative;
  173. &::after{
  174. content: '';
  175. display: block;
  176. position: absolute;
  177. left: 55rpx;
  178. bottom: 38rpx;
  179. height: 10rpx;
  180. width: 120rpx;
  181. background: linear-gradient(to right, #fff, $uni-color);
  182. }
  183. }
  184. .cell-text{
  185. text-align: right;
  186. .price-text{
  187. font-size: 32rpx;
  188. font-weight: 900;
  189. }
  190. .add{
  191. color: #f40;
  192. }
  193. .tips{
  194. font-size: 22rpx;
  195. color: #aaa;
  196. margin-top: 10rpx;
  197. }
  198. }
  199. }
  200. }
  201. </style>