珠宝小程序前端代码
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.

201 lines
3.6 KiB

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