withdraw.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <template>
  2. <view class="pos-r padding-lr-sm" v-if="fetch && fetch.info" @click="Dever.close()">
  3. <use-tabbar :tabbar="false" />
  4. <view class="border-radius bg-main padding margin-top-sm">
  5. <u-popover position="right" width="200px">
  6. <view class="fwbd fs">{{fetch.info.name}}提现
  7. <view style="margin-left:5px;display: inline-block;">
  8. <u-icon name="question-circle"></u-icon>
  9. </view>
  10. </view>
  11. <template v-slot:content>
  12. <view style="color: white;">
  13. <u-parse :content="fetch.info.exp_tip"></u-parse>
  14. </view>
  15. </template>
  16. </u-popover>
  17. <text class="link cur_color" style="float:right" @click="open">修改账户</text>
  18. <!-- 金额选项 -->
  19. <view class="dflex money-area flex-wrap">
  20. <view class="item dflex-c dflex-flow-c" :class="{ active: config === index }"
  21. v-for="(item, index) in fetch.config" :key="index" @click="setConfig(index)">
  22. <view class="price">{{ item.name }}</view>
  23. <text class="fs-xs">{{ item.tip }}</text>
  24. </view>
  25. </view>
  26. <!-- 输入其他金额 -->
  27. <input class="w-full padding border-radius-sm bg-drak" type="number" placeholder="请输入提现数值" v-model="number" @input="setValue"
  28. maxlength="140"/>
  29. <text class="margin-left-xs tip padding-tb">余额:{{fetch.user.yue_text}}</text>
  30. <text class="margin-left-xs tip padding-tb">手续费:{{fetch.info.withdraw_fee}}%</text>
  31. <text class="margin-left-xs tip padding-tb">到账金额:{{value}}</text>
  32. <!-- 马上充值按钮 -->
  33. <view class="dflex-c w-full margin-tb" @click="act">
  34. <view class="dflex-c dflex-flow-c border-radius-lg padding-tb-sm fwb line-height-1 cur_bgcolor"
  35. style="width: 70vw;">
  36. <text>马上提现</text>
  37. <text class="fs-xxs margin-top-xs ft-dark-4">并同意积分服务协议</text>
  38. </view>
  39. </view>
  40. <!-- 协议提示 -->
  41. <view class="margin-top dflex-c" @click="Dever.location('tool/page?title=积分服务协议')">
  42. <text class="cur_color margin-left-xs fs-xs padding-tb">积分服务协议</text>
  43. </view>
  44. </view>
  45. <!-- 记录列表 -->
  46. <view class="record-list margin-top-sm" v-if="fetch">
  47. <view class="record-title fs fwbd ft-black margin-bottom-sm">提现记录</view>
  48. <view v-if="fetch['list_' + current] && fetch['list_' + current].length > 0">
  49. <view class="record-item" v-for="(item, index) in fetch['list_' + current]" :key="index">
  50. <view class="record-left">
  51. <view class="record-name">{{ item.action_name }}</view>
  52. <view class="record-desc" v-if="item.desc">{{ item.desc }}</view>
  53. <view class="record-time">{{ item.cdate }}</view>
  54. </view>
  55. <view class="record-amount" :class="{ income: item.amount > 0, expense: item.amount < 0 }">
  56. {{ item.amount > 0 ? '+' : '' }}{{ item.amount }}
  57. </view>
  58. </view>
  59. </view>
  60. <view v-else class="empty-record">
  61. <u-empty mode="data"></u-empty>
  62. </view>
  63. </view>
  64. <u-popup mode="center" @close="close" :show="show" round="14" :closeable="true">
  65. <view class="alert-area border-radius bg-main pos-r">
  66. <view class="dflex-b ft-dark margin-bottom-sm margin-lr-xs">
  67. <view>绑定{{fetch.config[config].name}}提现账户:</view>
  68. </view>
  69. <view class="dflex border-radius-sm field set-input">
  70. <u--input placeholder="请输入真实姓名" v-model="fetch.config[config].realname"
  71. class="fwb fs-sm" border="none" :focus="true" clearable
  72. style="max-height: 76px; min-height: 19px; height: auto; font: initial;"></u--input>
  73. </view>
  74. <view class="dflex border-radius-sm field set-input">
  75. <u--input :placeholder="`请输入`+fetch.config[config].name+`账号`" v-model="fetch.config[config].account"
  76. class="fwb fs-sm" border="none" clearable
  77. style="max-height: 76px; min-height: 19px; height: auto; font: initial;"></u--input>
  78. </view>
  79. <view class="dflex border-radius-sm field set-input" v-if="fetch.config[config].id == 3">
  80. <u--input :placeholder="`请输入`+fetch.config[config].name+`开户行`" v-model="fetch.config[config].bank"
  81. class="fwb fs-sm" border="none" clearable
  82. style="max-height: 76px; min-height: 19px; height: auto; font: initial;"></u--input>
  83. </view>
  84. <view class="dflex-b ft-base margin-bottom-sm margin-lr-xs">
  85. <view>*请输入真实信息</view>
  86. </view>
  87. <!-- 提交按钮 -->
  88. <view class="cur_bgcolor margin-top-xl tac w-full border-radius-lg padding-tb-sm" @click="bind">
  89. 提交
  90. </view>
  91. </view>
  92. </u-popup>
  93. <view class="safe-area-inset-bottom"></view>
  94. </view>
  95. </template>
  96. <script>
  97. export default {
  98. data() {
  99. return {
  100. config: 0, // 默认选中第一个
  101. fetch: {},
  102. id: 0,
  103. current: 0,
  104. number: '',
  105. value: 0,
  106. show:false,
  107. name:'',
  108. account:'',
  109. };
  110. },
  111. onLoad(options) {
  112. if (options && options.id) {
  113. this.id = options.id;
  114. } else {
  115. this.Dever.location('source/home');
  116. return;
  117. }
  118. },
  119. onShow() {
  120. this.loadData();
  121. this.loadList(1);
  122. },
  123. //下拉刷新
  124. onPullDownRefresh() {
  125. this.loadList(1);
  126. },
  127. //加载更多
  128. onReachBottom() {
  129. this.loadList(2);
  130. },
  131. methods: {
  132. open() {
  133. this.show = true;
  134. },
  135. close() {
  136. this.show = false;
  137. },
  138. setConfig(index) {
  139. this.config = index;
  140. this.loadValue()
  141. },
  142. loadData() {
  143. this.DeverApi.get(this, 'score.withdraw', {
  144. id: this.id
  145. }, res => {
  146. this.loadValue()
  147. });
  148. },
  149. loadList(page) {
  150. this.DeverApi.page([page, 'list_' + this.current], this, 'score.withdrawLog', {
  151. id: this.id
  152. });
  153. },
  154. setValue() {
  155. this.loadValue()
  156. },
  157. loadValue() {
  158. if (!this.number) {
  159. var number = this.fetch.user.yue
  160. } else {
  161. var number = this.number
  162. }
  163. number = parseFloat(number)
  164. var exp = parseFloat(this.fetch.info.exp);
  165. var fee = number * parseFloat(this.fetch.info.withdraw_fee)/100
  166. this.value = ((number - fee)*exp).toFixed(2).toString()
  167. this.value = this.value + this.fetch.money.unit;
  168. },
  169. bind() {
  170. if (this.config < 0) {
  171. return this.Dever.alert('请选择账户');
  172. }
  173. var config = this.fetch.config[this.config];
  174. this.DeverApi.post('score.withdrawBind', {id: this.id, config:config.id, realname:config.realname,account:config.account,bank:config.bank}, r => {
  175. this.loadData();
  176. this.loadList(1);
  177. this.close();
  178. this.Dever.success('绑定账户成功');
  179. });
  180. },
  181. act() {
  182. var number = this.number;
  183. if (number) {
  184. number = parseFloat(number);
  185. } else {
  186. number = 0;
  187. }
  188. if (this.config < 0) {
  189. return this.Dever.alert('请选择要提现的账户');
  190. }
  191. var config = this.fetch.config[this.config];
  192. if (config.status == 2) {
  193. // 展示绑定窗口
  194. //this.Dever.alert('您还未开通提现账户,请先开通');
  195. this.open()
  196. return
  197. }
  198. if (number <= 0) {
  199. return this.Dever.alert('请输入要提现的数值');
  200. }
  201. var yue = parseFloat(this.fetch.user.yue);
  202. if (yue <= number) {
  203. return this.Dever.alert('余额不足');
  204. }
  205. this.Dever.confirm('确认申请提现吗?申请后工作人员审核通过,提现的金额将转入您的账户', () => {
  206. this.DeverApi.post('score.withdrawAct', {id: this.id, config:config.id, number:number}, r => {
  207. this.number = '';
  208. this.loadData();
  209. this.loadList(1);
  210. this.Dever.success('提现申请成功');
  211. });
  212. })
  213. },
  214. },
  215. };
  216. </script>
  217. <style lang="scss">
  218. .money-area {
  219. margin-top: 28rpx;
  220. margin-bottom: 18rpx;
  221. display: flex;
  222. flex-wrap: wrap;
  223. gap: 18rpx;
  224. /* 加这个 */
  225. .item {
  226. width: calc((100% - 2 * 18rpx) / 3);
  227. /* 3个元素,间隔2个gap */
  228. height: 152rpx;
  229. background: #f5f5f5;
  230. border-radius: 12rpx;
  231. box-sizing: border-box;
  232. padding: 20rpx;
  233. text-align: center;
  234. .price {
  235. color: #333;
  236. margin-bottom: 8rpx;
  237. }
  238. text {
  239. color: #9a9a9a;
  240. }
  241. }
  242. .active {
  243. background: #6f96f1;
  244. color: #fff;
  245. .price,
  246. text {
  247. color: #fff !important;
  248. }
  249. }
  250. }
  251. .record-list {
  252. background: #ffffff;
  253. border-radius: 20rpx;
  254. padding: 30rpx;
  255. .record-title {
  256. font-size: 30rpx;
  257. font-weight: bold;
  258. color: #333;
  259. }
  260. .record-item {
  261. display: flex;
  262. justify-content: space-between;
  263. align-items: center;
  264. padding: 20rpx 0;
  265. border-bottom: 1px solid #f0f0f0;
  266. &:last-child {
  267. border-bottom: none;
  268. }
  269. .record-left {
  270. display: flex;
  271. flex-direction: column;
  272. .record-name {
  273. font-size: 28rpx;
  274. color: #333;
  275. }
  276. .record-desc {
  277. font-size: 28rpx;
  278. color: #999;
  279. }
  280. .record-time {
  281. font-size: 24rpx;
  282. color: #999;
  283. margin-top: 6rpx;
  284. }
  285. }
  286. .record-amount {
  287. font-size: 28rpx;
  288. font-weight: bold;
  289. &.income {
  290. color: #4caf50;
  291. }
  292. &.expense {
  293. color: #f44336;
  294. }
  295. }
  296. }
  297. }
  298. .empty-record {
  299. text-align: center;
  300. padding: 60rpx 0;
  301. .empty-icon {
  302. width: 160rpx;
  303. height: 160rpx;
  304. margin-bottom: 20rpx;
  305. opacity: 0.6;
  306. }
  307. .empty-text {
  308. font-size: 28rpx;
  309. color: #999;
  310. }
  311. }
  312. .cur_bgcolor {
  313. background: #6f96f1;
  314. color: #fff;
  315. }
  316. .cur_color {
  317. color: #6f96f1;
  318. }
  319. .tip {
  320. font-size: 24rpx;
  321. color: #6f96f1;
  322. margin-top: 6rpx;
  323. }
  324. .set-input {
  325. padding: 20rpx;
  326. margin-bottom: 10rpx;
  327. }
  328. .u-popover {
  329. width: 180rpx !important;
  330. }
  331. </style>