猫妈狗爸伴宠师小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

250 lines
4.9 KiB

4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
2 weeks ago
4 months ago
2 weeks ago
4 months ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
4 months ago
2 weeks ago
4 months ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
  1. <template>
  2. <!-- <div>提现</div> -->
  3. <view class="box">
  4. <view class="top" :style="{ borderRadius: '16rpx' }">
  5. <view >
  6. 提现金额
  7. </view>
  8. <view class="level">
  9. <view class="money level">
  10. <text>¥</text>
  11. <up-input class="amount" placeholderClass="placeInput" placeholder="请输入提现金额" clearable fontSize="34rpx"
  12. border="bottom" type="number" color="#FF2742" v-model="num"></up-input>
  13. </view>
  14. <!-- <DForm :list="state. " @submit="handleSubmit" /> -->
  15. </view>
  16. </view>
  17. </view>
  18. <view class="center">
  19. <view class="text">
  20. 提现说明
  21. </view>
  22. <view>
  23. <up-parse :content="configList.withdrawal_statement.paramValueArea" containerStyle="{
  24. color: '#707070',
  25. fontSize: '30rpx',
  26. lineHeight: '45rpx',
  27. }"></up-parse>
  28. </view>
  29. <up-button class="buttom" type="warning" text="提现" shape="circle" @click="cashClick"></up-button>
  30. </view>
  31. <uni-popup ref="inputDialogRef" type="dialog">
  32. <uni-popup-dialog ref="inputClose" mode="input" title="提现" v-model="fullName" placeholder="请输入姓名"
  33. @confirm="dialogInputConfirm" @close="close" :before-close="true"></uni-popup-dialog>
  34. </uni-popup>
  35. <!-- 客服组件 -->
  36. <CustomerService />
  37. </template>
  38. <script setup>
  39. import {
  40. ref,
  41. computed,
  42. } from "vue"
  43. import { useStore } from 'vuex'
  44. import {
  45. cashOut,
  46. withdrawalSuccessful,
  47. } from "@/api/amount/index.js"
  48. import {
  49. onLoad
  50. } from '@dcloudio/uni-app'
  51. const store = useStore()
  52. const configList = computed(() => {
  53. return store.getters.configList
  54. })
  55. const num = ref('');;
  56. const fullName = ref('')
  57. const inputDialogRef = ref(null)
  58. const inputClose = ref(null)
  59. const type = ref(null)
  60. onLoad((options) => {
  61. console.log('options', options);
  62. type.value = options.type || 0;
  63. });
  64. const cashClick = () => {
  65. // 验证金额
  66. if (!num.value || num.value.trim() === '') {
  67. uni.showToast({
  68. icon: 'error',
  69. title: '金额不能为空',
  70. duration: 2000
  71. })
  72. return
  73. }
  74. const amount = parseFloat(num.value)
  75. if (isNaN(amount) || amount <= 0) {
  76. uni.showToast({
  77. icon: 'error',
  78. title: '请输入有效的金额',
  79. duration: 2000
  80. })
  81. return
  82. }
  83. if (amount < 0.01) {
  84. uni.showToast({
  85. icon: 'error',
  86. title: '提现金额不能小于0.01元',
  87. duration: 2000
  88. })
  89. return
  90. }
  91. // 转账成功后调用成功接口 65
  92. // withdrawalSuccessful({ id: 65 })
  93. fullName.value = ''
  94. inputDialogRef.value.open()
  95. }
  96. // 提现功能已改为审核流程,不再需要立即转账
  97. const dialogInputConfirm = (val) => {
  98. if (val) {
  99. //提现接口
  100. cashOut({
  101. userId: store.state.user.userInfo.userId,
  102. amount: num.value,
  103. nameValue: val,
  104. moneyType: type.value,
  105. }).then(res => {
  106. if (res.code == 200) {
  107. store.dispatch("getUserInfo")
  108. fullName.value = ''
  109. num.value = ''
  110. // 提现申请提交成功,跳转到流水页面查看审核状态
  111. uni.showToast({
  112. title: '提现申请已提交,等待审核',
  113. icon: 'none',
  114. duration: 1500,
  115. success() {
  116. setTimeout(() => {
  117. uni.navigateTo({
  118. url: '/otherPages/myOrdersManage/transaction/index?type=1'
  119. })
  120. }, 1500)
  121. }
  122. })
  123. } else {
  124. uni.showToast({
  125. icon: 'error',
  126. title: res.msg || '提现申请失败',
  127. duration: 2000
  128. })
  129. }
  130. }).catch(error => {
  131. console.error('提现申请失败:', error)
  132. uni.showToast({
  133. icon: 'error',
  134. title: '提现申请失败,请重试',
  135. duration: 2000
  136. })
  137. })
  138. fullName.value = val
  139. inputClose.value.close()
  140. fullName.value = ''
  141. } else {
  142. uni.showToast({
  143. icon: 'error',
  144. title: '请输入姓名',
  145. duration: 2000
  146. })
  147. }
  148. }
  149. const close = () => {
  150. inputDialogRef.value.close()
  151. fullName.value = ''
  152. }
  153. </script>
  154. <style scoped lang="scss">
  155. .box {
  156. width: 750rpx;
  157. height: 180rpx;
  158. background-image: linear-gradient(to bottom, #FFBF60, #FFFFFF);
  159. padding: 60rpx 24rpx 0 24rpx;
  160. box-sizing: border-box;
  161. }
  162. .top {
  163. width: 702rpx;
  164. height: 227rpx;
  165. background-color: #FFFFFF;
  166. padding: 24rpx 34rpx 0 34rpx;
  167. box-sizing: border-box;
  168. }
  169. .money {
  170. width: 550rpx;
  171. height: 71rpx;
  172. /* background-color: #FFBF60; */
  173. color: red !important;
  174. font-size: 54rpx !important;
  175. margin: 3% 0 0 5%;
  176. font-weight: 700;
  177. .amount {
  178. margin-left: 5%;
  179. height: 71rpx;
  180. }
  181. .placeInput {
  182. font-weight: 100;
  183. }
  184. }
  185. .center {
  186. width: 100%;
  187. height: 100vh;
  188. background-color: #FFFFFF;
  189. font-size: 30rpx;
  190. color: #707070;
  191. padding: 0 50rpx;
  192. ;
  193. box-sizing: border-box;
  194. margin-top: 80rpx;
  195. }
  196. .text {
  197. color: #000000;
  198. font-weight: 700;
  199. margin-bottom: 30rpx;
  200. }
  201. .buttom {
  202. width: 544rpx;
  203. height: 89rpx;
  204. background-color: #FFBF60;
  205. color: #FFFFFF;
  206. font-size: 28rpx;
  207. border-radius: 41rpx;
  208. margin-top: 300rpx;
  209. }
  210. .level {
  211. display: flex;
  212. }
  213. </style>