index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <view class="platform-recharge">
  3. <JHeader title="平台充值" width="50" height="50" style="padding: 24upx 0 10upx;background-color: #f5f5f5;">
  4. <template #ftFn>
  5. <text
  6. style="margin-right: 40upx;font-size: 30upx;font-weight: bold;color: #000000;"
  7. @click="handleMemberAccountWithdraw"
  8. >
  9. 提现
  10. </text>
  11. </template>
  12. </JHeader>
  13. <view
  14. style="position: relative;padding: 8upx 0 0;text-align: center;color: #ffffff;background: linear-gradient(90deg, #EF530E 0%, #EF530E 100%);overflow: hidden;"
  15. >
  16. <view>
  17. <view
  18. style="position: absolute;top: -30%;left: -40%;width: 600upx;height: 620upx;background-color: #f16527;border-radius: 50%;"
  19. >
  20. </view>
  21. <view
  22. style="position: absolute;top: -30%;left: -40%;width: 508upx;height: 538upx;background: linear-gradient(101deg, #FFFFFF 26%, rgba(255, 255, 255, 0.0001) 154%);border-radius: 50%;opacity: 0.1;"
  23. >
  24. </view>
  25. </view>
  26. <view style="position: relative;">
  27. <view style="font-size: 28upx;">
  28. <view>当前总余额(元)</view>
  29. <view style="margin-top: 24upx;font-size: 64upx;">{{ pricePlatformInfo.totalPrice || 0 }}</view>
  30. <view style="margin-top: 22upx;color: #f6a07a;">可提现金额:{{ pricePlatformInfo.price || 0 }}元</view>
  31. </view>
  32. <view
  33. style="display: flex;justify-content: space-evenly;margin-top: 76upx;padding: 20upx 0;background: linear-gradient(0deg, rgba(255, 255, 255, 0.0001) 0%, rgba(255, 255, 255, 0.15) 99%);"
  34. >
  35. <view>
  36. <view style="color: #f7a783;">充值余额</view>
  37. <view style="margin-top: 10upx;">{{ pricePlatformInfo.rechargePrice || 0 }}</view>
  38. </view>
  39. <view style="width: 2upx;background-color: #f37d49;"></view>
  40. <view>
  41. <view style="color: #f7a783;">代金券余额</view>
  42. <view style="margin-top: 10upx;">{{ pricePlatformInfo.voucherPrice || 0 }}</view>
  43. </view>
  44. <view style="width: 2upx;background-color: #f37d49;"></view>
  45. <view>
  46. <view style="color: #f7a783;">商家分佣</view>
  47. <view style="margin-top: 10upx;">{{ pricePlatformInfo.distributorPrice || 0 }}</view>
  48. </view>
  49. <view style="width: 2upx;background-color: #f37d49;"></view>
  50. <view>
  51. <view style="color: #f7a783;">推广收益</view>
  52. <view style="margin-top: 10upx;">{{ pricePlatformInfo.commissionPrice || 0 }}</view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. <view style="margin-top: 28upx;">
  58. <view style="padding: 0 36upx;">
  59. <view style="display: flex;justify-content: space-between;align-items: center;">
  60. <text style="color: #222229;">余额充值</text>
  61. <tui-button
  62. type="warning" width="220rpx" height="60rpx" margin="0"
  63. style="display: inline-block;border-radius: 30rpx;"
  64. @click="go('/another-tf/another-user/platform-recharge/recharge-record')"
  65. >
  66. 充值流水 →
  67. </tui-button>
  68. </view>
  69. <view
  70. style="display: flex;justify-content: space-between;align-items: center;flex-wrap: wrap;padding: 12upx 0 0;text-align: center;"
  71. >
  72. <view
  73. v-for="(item, index) in rechargeAmountsList" :key="index"
  74. style="position: relative;width: 31%;margin: 16upx 0 0;padding: 48upx 0;background-color: #f4f4f4;border-radius: 20upx;"
  75. :style="{ border: currentRechargeIndex === index ? '2upx solid #ef520e' : '2upx solid #f4f4f4' }"
  76. @click="handleClickCurrentRecharge(item, index)"
  77. >
  78. <view v-if="item.type === 'custom'">
  79. <view style="font-size: 42upx;font-weight: bold;color: #222229;">{{ item.amounts || '输入' }}</view>
  80. <view style="margin-top: 20upx;font-size: 28upx;color: #888889;">{{ item.voucherNum || '自定义金额' }}</view>
  81. </view>
  82. <view v-else>
  83. <view style="font-size: 42upx;font-weight: bold;color: #222229;">{{ item.amounts }}</view>
  84. <view style="margin-top: 20upx;font-size: 28upx;color: #888889;">代金券{{ item.voucherNum || '' }}</view>
  85. </view>
  86. <view
  87. v-if="currentRechargeIndex === index"
  88. style="position: absolute;right: 0;bottom: 0;padding: 2upx;border-radius: 60% 0 0;background-color: #ef520e;"
  89. >
  90. <tui-icon name="check" color="#FFFFFF" size="34" unit="upx"></tui-icon>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. <view style="padding: 120upx 0 38upx;text-align: center;">
  96. <tui-button
  97. type="warning" width="680rpx" height="84upx" margin="0 20upx 0"
  98. style="display: inline-block;background: linear-gradient(287deg, #EF530E 31%, #F77A42 104%)!important;border-radius: 16upx;box-shadow: 0px 2px 2px 0px #FA6842,0px 5px 20px 0px rgba(250, 104, 66, 0.8);"
  99. @click="rechargeForm.amounts && (isShowModalRecharge = true)"
  100. >
  101. ¥{{ rechargeForm.amounts || '--' }} 立即充值
  102. </tui-button>
  103. </view>
  104. </view>
  105. <!-- 输入充值金额dialog -->
  106. <tui-dialog
  107. style="position: relative;z-index: 888;" :buttons="[{ text: '取消' }, { text: '确定', color: '#586c94' }]"
  108. :show="isShowRechargeCustomDialog" title="自定义充值金额" @click="handleClickRechargeCustomDialog"
  109. >
  110. <template #content>
  111. <tui-input v-model="rechargeAmountsList[5].amounts" label="充值金额" type="number" placeholder="请输入充值金额">
  112. <template #right>
  113. <text>元</text>
  114. </template>
  115. </tui-input>
  116. </template>
  117. </tui-dialog>
  118. <tui-modal :show="isShowModalRecharge" custom fadein :button="[]" :z-index="995" :mask-z-index="994" @cancel="isShowModalRecharge = false">
  119. <view style="padding: 28upx 0;text-align: center;">
  120. <view>
  121. <image style="width: 435upx;height: 337upx;" src="../../../static/images/common/modal-show.png"></image>
  122. </view>
  123. <view style="margin-top: 24upx;font-size: 40upx;color: #333333;">
  124. <text>确定要充值 {{ rechargeAmountsList[currentRechargeIndex].amounts }} 代金券吗?</text>
  125. </view>
  126. <view style="margin-top: 22upx;font-size: 36upx;color: #687383;">
  127. <text>附赠 {{ rechargeAmountsList[currentRechargeIndex].voucherNum }} 代金券</text>
  128. </view>
  129. <view>
  130. <tui-button
  131. type="warning" width="238rpx" height="108rpx" margin="32upx 0 0"
  132. :size="40" shape="circle"
  133. style="display: inline-block;background: #ef530e!important;box-shadow: 0px 12px 20px 0px #f1ac8e;" @click="handleRecharge"
  134. >
  135. 确定
  136. </tui-button>
  137. </view>
  138. </view>
  139. </tui-modal>
  140. <CashierList :price-pay="rechargeForm.amounts || 0" @change="(e) => payInfo = e" />
  141. </view>
  142. </template>
  143. <script>
  144. import { getPricePlatformAllApi, addOrderSubmitUserRechargeApi } from '../../../api/anotherTFInterface'
  145. import { handleDoPay } from '../../../utils/payUtil'
  146. export default {
  147. name: 'PlatformRecharge',
  148. onLoad() {
  149. this.handleClickCurrentRecharge(this.rechargeAmountsList[0], 0)
  150. },
  151. onShow() {
  152. this.getPricePlatformAll()
  153. },
  154. data() {
  155. return {
  156. pricePlatformInfo: {
  157. totalPrice: '', // 账户总余额
  158. price: '', // 账户可提现金额
  159. rechargePrice: '', // 账户充值余额
  160. voucherPrice: '', // 代金券余额
  161. distributorPrice: '', // 账户分销金额
  162. commissionPrice: '' // 推广收益,关系链分佣
  163. },
  164. rechargeAmountsList: [
  165. { amounts: 1000, voucherNum: 1000 },
  166. { amounts: 1500, voucherNum: 1500 },
  167. { amounts: 2000, voucherNum: 2000 },
  168. { amounts: 3000, voucherNum: 3000 },
  169. { amounts: 5000, voucherNum: 5000 },
  170. { amounts: '', voucherNum: 0, type: 'custom' }
  171. ],
  172. currentRechargeIndex: '',
  173. isShowRechargeCustomDialog: false,
  174. // 充值
  175. rechargeForm: {
  176. amounts: ''
  177. },
  178. payInfo: {},
  179. isShowModalRecharge: false
  180. }
  181. },
  182. methods: {
  183. // 刷新用户信息
  184. getPricePlatformAll() {
  185. getPricePlatformAllApi({})
  186. .then((res) => {
  187. this.pricePlatformInfo = res.data
  188. })
  189. },
  190. handleClickCurrentRecharge(item, index) {
  191. if (item.type === 'custom') {
  192. this.isShowRechargeCustomDialog = true
  193. } else {
  194. this.currentRechargeIndex = index
  195. this.rechargeForm.amounts = item.amounts
  196. }
  197. },
  198. handleClickRechargeCustomDialog(e) {
  199. if (e.index === 0) {
  200. this.rechargeAmountsList[5].amounts = ''
  201. } else if (e.index === 1) {
  202. if (!this.rechargeAmountsList[5].amounts) return this.$showToast('充值金额不能为空')
  203. if (this.rechargeAmountsList[5].amounts < 1000) return this.$showToast('充值金额不能少于1000')
  204. if (this.rechargeAmountsList[5].amounts > 100000) return this.$showToast('单次充值金额不能大于10万')
  205. this.rechargeForm.amounts = this.rechargeAmountsList[5].amounts
  206. this.rechargeAmountsList[5].voucherNum = `代金券${this.rechargeAmountsList[5].amounts}`
  207. this.currentRechargeIndex = 5
  208. }
  209. this.isShowRechargeCustomDialog = false
  210. },
  211. handleRecharge() {
  212. if (!this.rechargeForm.amounts) return this.$showToast('缺少金额')
  213. uni.showLoading()
  214. addOrderSubmitUserRechargeApi({ ...this.rechargeForm })
  215. .then(async (res) => {
  216. await handleDoPay({ ...res.data, ...this.payInfo }, 8)
  217. })
  218. .catch(() => {
  219. uni.hideLoading()
  220. })
  221. },
  222. handleMemberAccountWithdraw() {
  223. // if (this.pricePlatformInfo.price <= 0) {
  224. // this.$showToast('您暂时没有余额,不能提现')
  225. // } else {
  226. this.go('/another-tf/another-serve/withdraw/index')
  227. // }
  228. }
  229. }
  230. }
  231. </script>
  232. <style lang="less" scoped>
  233. .platform-recharge {
  234. box-sizing: border-box;
  235. }
  236. </style>