withdraw.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="container">
  3. <form @submit="bindSave" :report-submit="true">
  4. <tui-list-cell :hover="false" :lineLeft="false">
  5. <view class="tui-cell-input">
  6. <input name="amounts" @input="inputamounts" :placeholder="'提现金额,最少'+min_money+'元'" placeholder-class="tui-phcolor"
  7. type="text" :auto-focus="true" :focus="true" maxlength="40" />
  8. </view>
  9. <view class="tui-cell-text">
  10. 手续费:{{poundage}}
  11. </view>
  12. <view class="tui-cell-text">
  13. 实收:{{actual_amounts}}
  14. </view>
  15. </tui-list-cell>
  16. <tui-list-cell :arrow="true" unlined :radius="true" @click="chooseMemberbankcard">
  17. <view class="tui-bg-img"></view>
  18. <view class="tui-address">
  19. <view v-if="memberbankcardData.accounts">
  20. <view class="tui-userinfo">
  21. <text class="tui-name">{{memberbankcardData.name}}</text>{{memberbankcardData.accounts}}
  22. </view>
  23. <view class="tui-addr">
  24. <text>{{memberbankcardData.bankname}}</text>
  25. <text v-if="memberbankcardData.branchname">{{memberbankcardData.branchname}}</text>
  26. </view>
  27. </view>
  28. <view class="tui-none-addr" v-else>
  29. <text>请选择收款帐号</text>
  30. </view>
  31. </view>
  32. </tui-list-cell>
  33. <view class="tui-btn-box">
  34. <tui-button formType="submit" :shadow="false" height="88rpx" shape="circle" type="danger">申请提现
  35. </tui-button>
  36. </view>
  37. </form>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. data() {
  43. return {
  44. min_money: '',
  45. poundage:'',
  46. actual_amounts:'',
  47. mo: 'agent',
  48. memberbankcardData: []
  49. };
  50. },
  51. onLoad: function(options) {
  52. let _this = this;
  53. if (options.mo) {
  54. _this.mo = options.mo;
  55. }
  56. _this.$request.post('config', {
  57. mo: _this.mo
  58. }).then(res => {
  59. if (res.errno == 0) {
  60. _this.min_money = res.data.min_money
  61. }
  62. });
  63. },
  64. onShow: function() {
  65. let _this = this
  66. _this.initmemberbankcard();
  67. },
  68. methods: {
  69. chooseMemberbankcard() {
  70. uni.navigateTo({
  71. url: "/pagesA/my/memberbankcard/memberbankcard"
  72. })
  73. },
  74. inputamounts (e) {
  75. let _this = this;
  76. _this.$request.post('withdraw.calculate', {
  77. mo: _this.mo,
  78. amounts: e.detail.value
  79. }).then(res => {
  80. if (res.errno == 0) {
  81. _this.actual_amounts = res.data.actual_amounts;
  82. _this.poundage = res.data.poundage;
  83. }
  84. })
  85. },
  86. initmemberbankcard: function() {
  87. var _this = this;
  88. _this.$request.get('memberbankcard.default', {
  89. samkey: (new Date()).valueOf()
  90. }).then(res => {
  91. if (res.errno == 0) {
  92. _this.memberbankcardData = res.data;
  93. } else {
  94. _this.memberbankcardData = null;
  95. }
  96. })
  97. },
  98. bindSave: function(e) {
  99. var _this = this;
  100. var bid;
  101. var amounts = e.detail.value.amounts;
  102. if (_this.memberbankcardData) {
  103. bid = _this.memberbankcardData.id;
  104. }
  105. if (!bid) {
  106. uni.showModal({
  107. title: '提示',
  108. content: '请选择收款帐号',
  109. showCancel: false
  110. })
  111. return
  112. }
  113. if (amounts == "" || amounts * 1 < _this.min_money) {
  114. uni.showModal({
  115. title: '提示',
  116. content: '提现金额不能少于' + _this.min_money + '元',
  117. showCancel: false
  118. })
  119. return
  120. }
  121. _this.$request.post('withdraw.apply', {
  122. mo: _this.mo,
  123. amounts: amounts,
  124. bid: bid
  125. }).then(res => {
  126. if (res.errno == 0) {
  127. //console.log(res);
  128. uni.showModal({
  129. title: '提示',
  130. content: res.message,
  131. showCancel: false,
  132. success: function(res) {
  133. if (res.confirm) {
  134. uni.navigateBack({});
  135. }
  136. }
  137. })
  138. } else {
  139. uni.showModal({
  140. title: "提示",
  141. content: res.message,
  142. showCancel: false
  143. })
  144. }
  145. })
  146. }
  147. },
  148. /**
  149. * 页面相关事件处理函数--监听用户下拉动作
  150. */
  151. onPullDownRefresh: function() {
  152. setTimeout(() => {
  153. uni.stopPullDownRefresh()
  154. }, 200);
  155. },
  156. };
  157. </script>
  158. <style lang="scss">
  159. .container {
  160. padding-top: 20rpx;
  161. .tui-cell-input {
  162. width: 100%;
  163. display: flex;
  164. align-items: center;
  165. box-sizing: border-box;
  166. input {
  167. flex: 1;
  168. padding-left: $uni-spacing-row-base;
  169. }
  170. }
  171. .tui-cell-text {
  172. width: 100%;
  173. padding-top: 20rpx;
  174. padding-bottom: 20rpx;
  175. padding-left: 20rpx;
  176. }
  177. .tui-btn-box {
  178. padding: 40rpx 30rpx 10rpx 30rpx;
  179. box-sizing: border-box;
  180. }
  181. }
  182. </style>