index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. <template>
  2. <v-page>
  3. <v-header class="nav-head" :title="$t('contribution.title')">
  4. <template #right>
  5. <v-link to="./record">
  6. <van-icon class="fn-20 m-t-xs" name="todo-list-o" />
  7. </v-link>
  8. </template>
  9. </v-header>
  10. <view class="d-flex justify-center fn-bold fn-15 fn-center">{{$t('contribution.a1')}}</view>
  11. <view class="desc p-t-lg p-x-md fn-13 fn-center">
  12. <view>{{$t('contribution.a2')}}</view>
  13. <view class="p-t-lg">{{$t('contribution.a3')}}</view>
  14. </view>
  15. <!-- <view class="d-flex align-center justify-center">
  16. <navigator url="./detail" class="h-25 d-flex align-center m-x-md justify-center label m-t-xs fn-15" style="max-width:max-content;">{{$t('contribution.b4')}}</navigator>
  17. </view> -->
  18. <view class="box-shadow m-x-md" style="margin-top:50rpx">
  19. <!-- <van-tabs type="card" color="#DD3F62" :border="false" :active="tab" @change="changeTab">
  20. <van-tab :title="$t('assets.g1')"></van-tab>
  21. <van-tab :title="$t('assets.g3')"></van-tab>
  22. <van-tab :title="$t('assets.g2')"></van-tab>
  23. </van-tabs> -->
  24. <van-tabs :ellipsis="false" :border="false" :active="tab" @change="changeTab">
  25. <van-tab class="height-max" :title="$t('assets.g1')"></van-tab>
  26. <van-tab class="height-max" :title="$t('assets.g3')"></van-tab>
  27. <van-tab class="height-max" :title="$t('assets.g2')"></van-tab>
  28. </van-tabs>
  29. </view>
  30. <block v-if="tab==0">
  31. <view class="p-x-lg">
  32. <!-- <view class="coin p-x-md p-y-xs d-flex justify-between bg-panel-3 m-y-md rounded-md box-shadow"
  33. @click="coinListShow=true">
  34. <view class="fn-lg color-light">{{coin}}</view>
  35. <view>
  36. <van-icon name="arrow" />
  37. </view>
  38. </view> -->
  39. <view class="m-y-md rounded-md overflow-hidden">
  40. <view class="bg-panel-3 rounded-md box-shadow">
  41. <view class="d-flex align-center justify-center border-b p-x-md p-y-xs color-light"
  42. >
  43. <view class="group d-flex fn-12 color-light justify-center align-center">
  44. <view class="rounded-md color-plain p-x-sm p-y-xs m-r-sm" size="mini"
  45. @click="changeRechargeType(2)"
  46. :class="rechargeType==2?'bg-gradient-green':'bg-gray-7'">
  47. ERC20</view>
  48. <view class="rounded-md color-plain p-x-sm p-y-xs m-r-sm"
  49. :class="rechargeType==1?'bg-gradient-green':'bg-gray-7'" size="mini"
  50. @click="changeRechargeType(1)">OMNI</view>
  51. <view class="rounded-md color-plain p-x-sm p-y-xs m-r-sm" size="mini"
  52. @click="changeRechargeType(3)"
  53. :class="rechargeType==3?'bg-gradient-green':'bg-gray-7'">
  54. TRC20</view>
  55. </view>
  56. </view>
  57. <view class="p-t-md p-b-md ">
  58. <view class="fn-center">
  59. <v-qr v-if="form.address" class="qr-box" :text="form.address||' '"></v-qr>
  60. </view>
  61. <view class="tips fn-center color-light m-y-xs">{{$t('contribution.a4')}}</view>
  62. </view>
  63. </view>
  64. <view class="info m-t-md p-xs bg-panel-3 rounded-md box-shadow">
  65. <view class="address">
  66. <view class="d-flex align-center justify-between">
  67. <view class="border-r address-txt flex-fill color-light fn-12 fn-center">
  68. {{form.address}}
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="m-b-lg m-t-lg">
  74. <v-button type="yellow" @click="$copy(form.address,$t('common.a1'))" block
  75. class="w-max rounded-md" key="loginbtn">
  76. <text class="color-light" style="color:#2c2c2c">{{$t('contribution.a5')}}</text>
  77. <i class="iconfont" style="color:#2c2c2c;font-size: 34rpx;">&#xe706;</i>
  78. </v-button>
  79. </view>
  80. </view>
  81. </view>
  82. </block>
  83. <block v-if="tab==1">
  84. <view class="p-x-lg">
  85. <view class="coin p-x-md p-y-xs d-flex justify-between bg-panel-3 m-y-md rounded-md box-shadow"
  86. @click="fiatListShow=true">
  87. <view class="fn-lg color-light">{{fiat}}</view>
  88. <view>
  89. <van-icon name="arrow" />
  90. </view>
  91. </view>
  92. <view>
  93. <view class="uni-padding-wrap">
  94. <view class="uni-title">{{$t('add.a1')}}</view>
  95. <radio-group class="p-t-md" @change="radioChange">
  96. <label class="radio m-r-lg">
  97. <radio :checked="type==1" value="1" color="#f7427b" style="transform: scale(.7);"/>Credit card-A
  98. </label>
  99. <label class="radio">
  100. <radio :checked="type==2" value="2" color="#f7427b" style="transform: scale(.7);"/>Credit card-B
  101. </label>
  102. </radio-group>
  103. </view>
  104. </view>
  105. <view class="form bg-panel-3 rounded-md p-x-md m-y-md box-shadow">
  106. <view class="d-flex align-end p-y-xs justify-between">
  107. <v-input type="number" v-model="form.amount" class="w-8/12 color-light"
  108. :placeholder="$t('assets.c2')"></v-input>
  109. <view class="d-flex align-end">
  110. <span class="unit flex-shrink">{{ fiat }}</span>
  111. </view>
  112. </view>
  113. <block v-if="type==2">
  114. <view class="d-flex align-end p-y-xs justify-center">
  115. <view class="d-flex align-end">
  116. <span class="unit flex-shrink">{{$t('reg.a2')}}:</span>
  117. </view>
  118. <v-input type="text" v-model="form.cellphone" class="w-8/12 flex-fill color-light"
  119. :placeholder="$t('assets.h1')">
  120. <template v-slot:left>+</template>
  121. </v-input>
  122. </view>
  123. <view class="d-flex align-end p-y-xs justify-center">
  124. <view class="d-flex align-end">
  125. <span class="unit flex-shrink">{{$t('reg.a4')}}:</span>
  126. </view>
  127. <v-input type="text" v-model="form.email" class="w-8/12 flex-fill color-light"
  128. :placeholder="$t('reg.a5')"></v-input>
  129. </view>
  130. </block>
  131. </view>
  132. <view style="margin-top:120rpx;">
  133. <v-button class="w-max rounded-md" block type="green" @click="toRecharge" ref="btn">
  134. {{$t('contribution.title')}}
  135. </v-button>
  136. </view>
  137. </view>
  138. </block>
  139. <view style="color:#999;margin-top:120rpx;text-align: center;">
  140. <view>{{$t('contribution.a6')}}:{{details.sum}} USDT</view>
  141. <view>{{$t('contribution.a7')}}:{{$date(details.end_time)}}</view>
  142. </view>
  143. <view @click="dialogShow=true" class="h-25 d-flex ali gn-center justify-center label m-t-xs fn-15" style="max-width:max-content;margin: 0 auto;" v-if="details.count > 0">{{$t('contribution.a9')}}</view>
  144. <view class="h-25 d-flex align-center justify-center label m-t-xs fn-15" style="max-width:max-content;margin: 0 auto;background-color: #999;" v-if="details.count == 0">{{$t('contribution.a8')}}</view>
  145. <view style="padding-bottom:100rpx;"></view>
  146. <view class="my-dialog" v-if="dialogShow">
  147. <van-dialog :show="dialogShow" @close="dialogShow=false" :confirmButtonText="$t('contribution.b3')" :message="`${$t('contribution.b1')}: ${details.order} ${$t('contribution.b2')}`" />
  148. </view>
  149. <fiat-list ref="fiatList" v-model="fiat" @close="fiatListShow=false" v-show="fiatListShow" />
  150. </v-page>
  151. </template>
  152. <script>
  153. // import coinList from "./coin-list";
  154. import Wallet from "@/api/wallet";
  155. import fiatList from "./fiat-list";
  156. import Donation from "@/api/donation.js";
  157. import {
  158. mapGetters
  159. } from 'vuex'
  160. export default {
  161. components: {
  162. // coinList,
  163. fiatList
  164. },
  165. data() {
  166. return {
  167. tab: 0,
  168. coinListShow: false,
  169. fiatListShow: false,
  170. coin: "",
  171. fiat: "",
  172. money:'',
  173. rechargeType:2,
  174. type:1,
  175. form: {
  176. coin_id: "",
  177. amount: "",
  178. address: "",
  179. coin: "",
  180. },
  181. dialogShow:false,
  182. details:[]
  183. }
  184. },
  185. computed: {
  186. activeCoin() {
  187. if (!this.coin) return {};
  188. return this.$refs.coinList.coinList.find(
  189. (item) => item.coin_name == this.coin
  190. );
  191. },
  192. activeFiat() {
  193. return this.$refs.fiatList.fiatList.find(
  194. (item) => item.fiat == this.fiat
  195. );
  196. },
  197. },
  198. watch: {
  199. coin(n) {
  200. if (n) {
  201. this.form.address = "";
  202. if (this.coin != "USDT") {
  203. this.rechargeType = 1;
  204. }
  205. this.walletImage();
  206. }
  207. },
  208. },
  209. onLoad() {
  210. this.walletImage();
  211. this.getDetails()
  212. },
  213. methods:{
  214. radioChange(e){
  215. this.type = e.detail.value
  216. },
  217. changeRechargeType(idx) {
  218. this.rechargeType = idx;
  219. this.form.address = "";
  220. this.walletImage();
  221. },
  222. changeTab(e){
  223. if(e.detail.index==0){
  224. this.tab = e.detail.index
  225. }else if(e.detail.index==2){
  226. // uni.navigateTo({
  227. // url:'/pages/assets/web-view'
  228. // })
  229. // window.location.href = 'https://go.crisp.chat/chat/embed/?website_id=c6ffb47c-4db3-4d31-b84c-23c5b95f3255'
  230. let url = 'https://im.gsras.com/index/index/home?visiter_id=&visiter_name=&avatar=&business_id=2&groupid=0&special=2'
  231. // #ifdef H5
  232. window.location.href = url
  233. // #endif
  234. // #ifdef APP-PLUS
  235. plus.runtime.openURL(url)
  236. // #endif
  237. }else if(e.detail.index==1){
  238. this.tab = e.detail.index
  239. }
  240. },
  241. changeRechargeType(idx) {
  242. this.rechargeType = idx;
  243. this.form.address = "";
  244. this.walletImage();
  245. },
  246. getDetails(){
  247. Donation.getDetails().then(res=>{
  248. this.details = res.data
  249. })
  250. },
  251. // 获取充币地址
  252. walletImage() {
  253. let data = {
  254. coin_id: this.activeCoin.coin_id,
  255. type: this.rechargeType,
  256. };
  257. uni.showLoading({
  258. title: ''
  259. })
  260. Donation.getAddress(data).then((res) => {
  261. if (res.message == 'FAILED') {
  262. this.$dialog
  263. .confirm({
  264. title: this.$t("common.error"),
  265. message: this.$t("common.error1"),
  266. cancelButtonText: this.$t('common.cancelButtonText'),
  267. confirmButtonText: this.$t('common.confirmButtonText'),
  268. })
  269. .then(() => {
  270. });
  271. } else {
  272. this.form.address = res.data.address;
  273. }
  274. uni.hideLoading()
  275. }).catch(() => {
  276. uni.hideLoading()
  277. });
  278. },
  279. // 信用卡捐款
  280. toRecharge() {
  281. return this.$toast(this.$t('base.h1'))
  282. uni.showLoading({
  283. title: ''
  284. })
  285. let cellphone = this.form.cellphone
  286. if(!this.form.amount){
  287. return this.$toast(this.$t('assets.c2'))
  288. }
  289. if(this.type==2){
  290. if(!cellphone){
  291. return this.$toast(this.$t('assets.h1'))
  292. }
  293. if(!this.form.email){
  294. return this.$toast(this.$t('reg.a5'))
  295. }
  296. }
  297. Wallet.xinRecharge({
  298. amount: this.form.amount,
  299. fait: this.activeFiat.id,
  300. type:this.type,
  301. cellphone:cellphone||'',
  302. email:this.form.email||'',
  303. money_type:2,
  304. }).then((res) => {
  305. let payUrl = res.data.payUrl
  306. location.href = payUrl
  307. })
  308. .catch((err) => {
  309. console.log(err)
  310. uni.hideLoading()
  311. });
  312. }
  313. }
  314. }
  315. </script>
  316. <style lang="scss" scoped>
  317. .qr-box {
  318. height: 150px;
  319. width: 150px;
  320. margin: 0 auto;
  321. border: 4px solid $white;
  322. }
  323. .trChange:nth-child(2n-1) {
  324. box-shadow: $shadow;
  325. border-radius: $border-radius-xs;
  326. td {
  327. background: $panel-3;
  328. padding-top: $padding-sm;
  329. padding-bottom: $padding-sm;
  330. }
  331. }
  332. .label {
  333. border-radius: 5rpx;
  334. background: #DD3F62;
  335. padding: 0 20rpx;
  336. width: max-content;
  337. color: #fff;
  338. }
  339. </style>