shareF.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <view class="content">
  3. <view class="row-box">
  4. <view class="title">转赠内容</view>
  5. <view class="row"><input class="input" type="text" v-model="withdrawal" :placeholder="withdrawal" placeholder-class="placeholder" disabled="" /></view>
  6. </view>
  7. <view class="row-box">
  8. <view class="title">收款人账户</view>
  9. <view class="row"><input class="input" type="text" v-model="card" placeholder="请输入收款人账户" placeholder-class="placeholder" /></view>
  10. </view>
  11. <button class="add-btn up" :class="{ action: loding }" @click="!loding ? confirm() : ''">转入</button>
  12. </view>
  13. </template>
  14. <script>
  15. import { getMoneyStyle } from '@/utils/rocessor.js';
  16. import { getUserInfo, transfer } from '@/api/user.js';
  17. import { mapMutations, mapState } from 'vuex';
  18. export default {
  19. filters: {
  20. getMoneyStyle
  21. },
  22. data() {
  23. return {
  24. id: '', //券码id
  25. withdrawal: '', //提现金额
  26. card: '', //转账卡号
  27. name: '',
  28. // #ifdef H5
  29. weichatBsrowser: false,
  30. // #endif
  31. loding: false
  32. };
  33. },
  34. onLoad(options) {
  35. if (options.id) {
  36. this.id = options.id;
  37. }
  38. if (options.nickname) {
  39. this.withdrawal = options.nickname;
  40. }
  41. // #ifdef H5
  42. this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
  43. // #endif
  44. this.dataUp();
  45. },
  46. computed: {
  47. ...mapState(['userInfo'])
  48. },
  49. methods: {
  50. ...mapMutations(['setUserInfo', 'login']),
  51. // 更新数据
  52. dataUp() {
  53. let obj = this;
  54. getUserInfo({})
  55. .then(e => {
  56. obj.login();
  57. // 保存返回用户数据
  58. obj.setUserInfo(e.data);
  59. })
  60. .catch(e => {
  61. console.log(e);
  62. });
  63. },
  64. // 切换选中对象
  65. tabRadio(e) {
  66. this.type = e.detail.value;
  67. },
  68. // 提交
  69. confirm() {
  70. let obj = this;
  71. obj.loding = true;
  72. if (obj.card == obj.userInfo.uid) {
  73. obj.loding = false;
  74. uni.showModal({
  75. title: '提示',
  76. content: '不要输入自己的用户编号'
  77. });
  78. } else {
  79. let data = {
  80. uid: obj.card //编号
  81. };
  82. transfer(data, obj.id)
  83. .then(e => {
  84. // 允许按钮点击
  85. obj.loding = false;
  86. // 初始化提现金额
  87. uni.showToast({
  88. title: '转赠成功',
  89. duration: 2000,
  90. position: 'top'
  91. });
  92. obj.dataUp();
  93. })
  94. .catch(e => {
  95. obj.$api.msg(e.msg);
  96. obj.loding = false;
  97. console.log();
  98. });
  99. }
  100. }
  101. }
  102. };
  103. </script>
  104. <style lang="scss">
  105. page {
  106. height: 100%;
  107. }
  108. .row-box {
  109. margin-top: 30rpx;
  110. padding: 20rpx 30rpx;
  111. background: #fff;
  112. .title {
  113. font-size: $font-base + 2rpx;
  114. color: $font-color-dark;
  115. }
  116. .row {
  117. display: flex;
  118. align-items: center;
  119. position: relative;
  120. height: 80rpx;
  121. .tit {
  122. flex-shrink: 0;
  123. width: 40rpx;
  124. font-size: 30rpx;
  125. color: $font-color-dark;
  126. }
  127. .input {
  128. flex: 1;
  129. font-size: 30rpx;
  130. color: $font-color-dark;
  131. }
  132. .iconlocation {
  133. font-size: 36rpx;
  134. color: $font-color-light;
  135. }
  136. .buttom {
  137. color: $base-color;
  138. font-size: $font-base;
  139. }
  140. }
  141. }
  142. .add-btn {
  143. background: $base-color;
  144. display: flex;
  145. align-items: center;
  146. justify-content: center;
  147. width: 690rpx;
  148. height: 80rpx;
  149. margin: 0 auto;
  150. margin-top: 30rpx;
  151. font-size: $font-lg;
  152. border-radius: 10rpx;
  153. color: #fff;
  154. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  155. }
  156. .name {
  157. background: #fff;
  158. padding: 30rpx;
  159. }
  160. .list {
  161. padding-left: 30rpx;
  162. margin-top: 30rpx;
  163. background-color: #ffffff;
  164. .box {
  165. display: flex;
  166. align-items: center;
  167. width: 100%;
  168. height: 120rpx;
  169. border-bottom: 1px solid $border-color-light;
  170. .icon {
  171. font-size: 48rpx;
  172. padding-right: 20rpx;
  173. .icon-img {
  174. height: 50rpx;
  175. width: 50rpx;
  176. }
  177. }
  178. .iconweixin1 {
  179. color: #18bf16;
  180. }
  181. .iconzhifubao {
  182. color: #08aaec;
  183. }
  184. .title-box {
  185. flex-grow: 1;
  186. text-align: left;
  187. .title {
  188. font-size: $font-base + 2rpx;
  189. color: $font-color-base;
  190. }
  191. .node {
  192. font-size: $font-sm;
  193. color: $font-color-light;
  194. }
  195. }
  196. }
  197. }
  198. /deep/ .uni-radio-input {
  199. width: 45rpx;
  200. height: 45rpx;
  201. }
  202. </style>