index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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-ic_close"></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. numeral(value) {
  65. this.$nextTick(() => {
  66. this.numeral = Number(value) || ''
  67. })
  68. }
  69. },
  70. data(){
  71. return{
  72. navList:[],
  73. current:0,
  74. numeral:''
  75. }
  76. },
  77. mounted: function() {},
  78. methods:{
  79. navTap(index){
  80. this.current = index
  81. },
  82. define(){
  83. if(this.numeral<=0){
  84. let title = '';
  85. if(this.type){
  86. title = '请填写你要增加或减少的余额'
  87. }else{
  88. title = '请填写你要增加或减少的积分'
  89. }
  90. this.$util.Tips({
  91. title: title
  92. });
  93. return
  94. }
  95. postUserUpdateOther(this.uid,{
  96. status:this.current + 1,
  97. number:this.numeral,
  98. type:this.type
  99. }).then(res=>{
  100. this.$util.Tips({
  101. title: res.msg
  102. });
  103. this.numeral = 0;
  104. this.$emit('successChange');
  105. }).catch(err=>{
  106. this.$util.Tips({
  107. title: err
  108. });
  109. })
  110. },
  111. closeDrawer() {
  112. this.numeral = 0;
  113. this.$emit('closeDrawer');
  114. }
  115. }
  116. }
  117. </script>
  118. <style lang="scss" scoped>
  119. .edit-balance{
  120. background-color: #fff;
  121. padding-bottom: 60rpx;
  122. .title{
  123. text-align: center;
  124. height: 108rpx;
  125. line-height: 108rpx;
  126. font-size: 32rpx;
  127. font-family: PingFang SC, PingFang SC;
  128. font-weight: 600;
  129. color: #333333;
  130. position: relative;
  131. padding: 0 30rpx;
  132. .close{
  133. width: 36rpx;
  134. height: 36rpx;
  135. line-height: 36rpx;
  136. background: #EEEEEE;
  137. border-radius: 50%;
  138. position: absolute;
  139. right: 30rpx;
  140. top:38rpx;
  141. .iconfont {
  142. font-weight: 300;
  143. font-size: 20rpx;
  144. }
  145. }
  146. }
  147. .list{
  148. padding: 0 30rpx;
  149. .item{
  150. font-size: 28rpx;
  151. font-family: PingFang SC, PingFang SC;
  152. font-weight: 400;
  153. color: #333333;
  154. height: 72rpx;
  155. margin-bottom: 32rpx;
  156. box-sizing: border-box;
  157. .icon-ic_edit{
  158. color: #999999;
  159. }
  160. .itemn{
  161. margin-left: 50rpx;
  162. color: #999999;
  163. .iconfont {
  164. margin-top: 4rpx;
  165. color: #CCCCCC;
  166. margin-right: 14rpx;
  167. }
  168. &.on {
  169. color: #333333;
  170. .iconfont {
  171. color: #2A7EFB;
  172. }
  173. }
  174. }
  175. input {
  176. text-align: right;
  177. font-size: 36rpx;
  178. font-family: Regular;
  179. color: #FF7E00;
  180. }
  181. /deep/.uni-input-input{
  182. padding-right: 10rpx;
  183. }
  184. .placeholder{
  185. font-size: 28rpx;
  186. padding-right: 10rpx;
  187. padding: 6rpx 10rpx 0 0;
  188. }
  189. }
  190. }
  191. .footer{
  192. padding: 0 20rpx;
  193. margin-top: 166rpx;
  194. .bnt{
  195. width: 346rpx;
  196. height: 72rpx;
  197. border: 2rpx solid #2A7EFB;
  198. border-radius: 100rpx;
  199. font-size: 26rpx;
  200. font-family: PingFang SC, PingFang SC;
  201. font-weight: 500;
  202. color: #2A7EFB;
  203. &.on{
  204. background: #2A7EFB;
  205. color: #fff;
  206. }
  207. }
  208. }
  209. }
  210. </style>