index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <base-drawer mode="bottom" :visible="visible" background-color="transparent" mask maskClosable @close="closeDrawer">
  3. <view class="edit-balance rd-t-40rpx">
  4. <view class="title">修改{{type? '积分' : '余额'}}
  5. <view class="close acea-row row-center-wrapper" @tap="closeDrawer">
  6. <text class="iconfont icon-iconfontguanbi"></text>
  7. </view>
  8. </view>
  9. <view class="list">
  10. <view class="item acea-row row-between-wrapper">
  11. <view>修改{{type? '积分' : '余额'}}</view>
  12. <view class="acea-row row-middle">
  13. <view class="itemn acea-row row-middle" :class="current == index?'on':''" v-for="(item, index) in navList" :key="index" @click="navTap(index)">
  14. <text class="iconfont" :class="current == index?'icon-ic_Selected':'icon-ic_unselect'"></text>
  15. <text>{{item}}</text>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="item acea-row row-between-wrapper">
  20. <view>{{type? '积分' : '余额'}}</view>
  21. <view class="acea-row row-middle">
  22. <input type="number" v-model="numeral" :placeholder="type? '请填写积分' : '请填写余额'" placeholder-class="placeholder"/>
  23. <text class="iconfont icon-ic_edit"></text>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="footer acea-row row-between-wrapper">
  28. <view class="bnt acea-row row-center-wrapper" @click="closeDrawer">取消</view>
  29. <view class="bnt on acea-row row-center-wrapper" @click="define">确定</view>
  30. </view>
  31. </view>
  32. </base-drawer>
  33. </template>
  34. <script>
  35. import {
  36. postUserUpdateOther
  37. } from "@/api/admin";
  38. export default {
  39. props:{
  40. visible: {
  41. type: Boolean,
  42. default: false,
  43. },
  44. type: {
  45. type: Number,
  46. default: 0,
  47. },
  48. uid: {
  49. type: Number,
  50. default: 0
  51. }
  52. },
  53. watch: {
  54. type: {
  55. handler(newValue, oldValue) {
  56. if(newValue){
  57. this.navList = ['增加积分','减少积分']
  58. }else{
  59. this.navList = ['增加余额','减少余额']
  60. }
  61. },
  62. immediate: true
  63. }
  64. },
  65. data(){
  66. return{
  67. navList:[],
  68. current:0,
  69. numeral:0
  70. }
  71. },
  72. mounted: function() {},
  73. methods:{
  74. navTap(index){
  75. this.current = index
  76. },
  77. define(){
  78. if(this.numeral<=0){
  79. let title = '';
  80. if(this.type){
  81. title = '请填写你要增加或减少的余额'
  82. }else{
  83. title = '请填写你要增加或减少的积分'
  84. }
  85. this.$util.Tips({
  86. title: title
  87. });
  88. return
  89. }
  90. postUserUpdateOther(this.uid,{
  91. status:this.current + 1,
  92. number:this.numeral,
  93. type:this.type
  94. }).then(res=>{
  95. this.$util.Tips({
  96. title: res.msg
  97. });
  98. this.numeral = 0;
  99. this.$emit('successChange');
  100. }).catch(err=>{
  101. this.$util.Tips({
  102. title: err
  103. });
  104. })
  105. },
  106. closeDrawer() {
  107. this.numeral = 0;
  108. this.$emit('closeDrawer');
  109. }
  110. }
  111. }
  112. </script>
  113. <style lang="scss" scoped>
  114. .edit-balance{
  115. background-color: #fff;
  116. padding-bottom: 60rpx;
  117. .title{
  118. text-align: center;
  119. height: 108rpx;
  120. line-height: 108rpx;
  121. font-size: 32rpx;
  122. font-family: PingFang SC, PingFang SC;
  123. font-weight: 600;
  124. color: #333333;
  125. position: relative;
  126. padding: 0 30rpx;
  127. .close{
  128. width: 36rpx;
  129. height: 36rpx;
  130. line-height: 36rpx;
  131. background: #EEEEEE;
  132. border-radius: 50%;
  133. position: absolute;
  134. right: 30rpx;
  135. top:38rpx;
  136. .iconfont {
  137. font-weight: 300;
  138. font-size: 20rpx;
  139. }
  140. }
  141. }
  142. .list{
  143. padding: 0 30rpx;
  144. .item{
  145. font-size: 28rpx;
  146. font-family: PingFang SC, PingFang SC;
  147. font-weight: 400;
  148. color: #333333;
  149. height: 72rpx;
  150. margin-bottom: 32rpx;
  151. box-sizing: border-box;
  152. .icon-ic_edit{
  153. color: #999999;
  154. }
  155. .itemn{
  156. margin-left: 50rpx;
  157. color: #999999;
  158. .iconfont {
  159. margin-top: 4rpx;
  160. color: #CCCCCC;
  161. margin-right: 14rpx;
  162. }
  163. &.on {
  164. color: #333333;
  165. .iconfont {
  166. color: #2A7EFB;
  167. }
  168. }
  169. }
  170. input {
  171. text-align: right;
  172. font-size: 36rpx;
  173. font-family: Regular;
  174. color: #FF7E00;
  175. }
  176. ::v-deep.uni-input-input{
  177. padding-right: 10rpx;
  178. }
  179. .placeholder{
  180. font-size: 28rpx;
  181. padding-right: 10rpx;
  182. padding: 6rpx 10rpx 0 0;
  183. }
  184. }
  185. }
  186. .footer{
  187. padding: 0 20rpx;
  188. margin-top: 166rpx;
  189. .bnt{
  190. width: 346rpx;
  191. height: 72rpx;
  192. border: 2rpx solid #2A7EFB;
  193. border-radius: 100rpx;
  194. font-size: 26rpx;
  195. font-family: PingFang SC, PingFang SC;
  196. font-weight: 500;
  197. color: #2A7EFB;
  198. &.on{
  199. background: #2A7EFB;
  200. color: #fff;
  201. }
  202. }
  203. }
  204. }
  205. </style>