123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412 |
- <template>
- <view class="content">
- <view class="bannerimg">
- <image src="../../static/banner.png" class="imgBanner"></image>
- </view>
- <view class="wrap leakagebox">
- <view class="mallList flex" v-if="listAll.length>0">
- <view class="listli rows" v-for="(item,index) in listAll" :key="index">
- <view class="title flex flsb ">
- <view class="titfl flex">
- <image src="../../static/tip.png" class="listimg"></image>
- {{item.name}}
- </view>
- </view>
- <view class="rowsfl">
- <view class="times flex" >
- <image src="../../static/icon/icon3.png" class="iconimg"></image>
- 價值:
- <span>{{item.yingfu}}USDT</span>
- </view>
- <view class="times flex">
- <image src="../../static/icon/icon2.png" class="iconimg"></image>
- 收益:
- <span>{{item.shouyi}}</span>
- </view>
- </view>
- <view class="rowsfr" @click="orderopen(item.id)">立即撿漏</view>
- </view>
-
- </view>
- <view class="noMore" v-else>暫無數據</view>
- </view>
- </view>
- </template>
- <script>
- import {
- createWeb3Modal,
- defaultWagmiConfig,
- useWeb3ModalState,
- useWeb3Modal
- } from '@web3modal/wagmi/vue'
- import {
- mainnet,
- arbitrum,
- optimism,
- bsc,
- polygon
- } from '@wagmi/core/chains'
- import {
- getAccount, //地址
- writeContract,
- disconnect, //断开
- watchAccount,
- createConfig, //创建客户端
- configureChains, //配置链
- getNetwork, //获取链
- getWalletClient,
- fetchToken,
- connect, //链接
- watchContractEvent,
- watchNetwork,
- sendTransaction,
- signMessage,
- prepareSendTransaction
- } from '@wagmi/core'
- import {
- publicProvider
- } from '@wagmi/core/providers/public'
- import {
- InjectedConnector
- } from '@wagmi/core/connectors/injected'
- import {
- parseEther
- } from 'viem'
- const projectId = 'c46fe115e62fd8cc283e8db10b3a7fa7'
- // 2. Create wagmiConfig
- const metadata = {
- name: 'Web3Modal',
- description: 'Web3Modal Example',
- url: 'https://web3modal.com',
- icons: ['https://avatars.githubusercontent.com/u/37784886']
- }
- const chains = [bsc]
- const wagmiConfig = defaultWagmiConfig({
- chains,
- projectId,
- metadata
- })
-
- // 3. Create modal
- const modal = createWeb3Modal({
- wagmiConfig,
- projectId,
- chains,
- optionalChains: [{
- chainId: 128,
- chainName: "HECO",
- nativeCurrency: {
- name: "HECO",
- symbol: "HT",
- decimals: 18,
- },
- rpcUrls: ["https://http-mainnet.hecochain.com/ "]
- },
- {
- chainId: 137,
- chainName: "MATIC",
- nativeCurrency: {
- name: "MATIC",
- symbol: "MATIC",
- decimals: 18,
- },
- rpcUrls: ["https://matic.mytokenpocket.vip/ "],
-
- }
- ],
- defaultChain: bsc,
- tokens: {
- 1: {
- address: '0xdac17f958d2ee523a2206206994597c13d831ec7',
- image: 'token_image_url' //optional ETH
- },
- 56: {
- address: '0x55d398326f99059ff775485246999027b3197955',
- image: 'token_image_url' //optional BSC
- },
- 137: {
- address: '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
- image: 'token_image_url' //optional MATIC
- },
- 128: {
- address: '0xa71edc38d189767582c38a3145b5873052c3e47a',
- image: 'token_image_url' //optional HT
- }
- },
-
- //主题覆盖
- themeVariables: {
- '--w3m-accent': '#02cc66',
- },
- //主题亮,暗
- themeMode: 'light'
-
- })
-
-
- export default {
- data() {
- return {
- statusBarHeight:'',
- navIndex:0,
- type:'1',
- listAll:[],
- status: 'more',//'上拉加載更多','加載中','沒有更多'
- contentText: {
- contentdown: '上拉加載更多',
- contentrefresh:'加載中',
- contentnomore:'沒有更多'
- },
- page: '1',
- totalCount: '',//总条数
- }
- },
- computed: {
- i18n() {
- return this.$t('lang')
- }
- },
- onLoad() {
- uni.startPullDownRefresh(); //这里表示当进入页面的时候就开始执行下拉刷新动画
- this.getList()
- //获取状态栏+导航栏的高度
- let _that = this;
- uni.getSystemInfo({
- success(e) {
- if (e.platform == "ios") {
- _that.statusBarHeight = e.statusBarHeight + 45;
- } else {
- _that.statusBarHeight = e.statusBarHeight + 50;
- }
- }
- })
- },
- //监听该页面用户下拉刷新事件
- onPullDownRefresh() {
- this.getList()
- setTimeout(function () {
- uni.stopPullDownRefresh();
- }, 1000);
- },
-
- methods: {
- getList(){
- let data={
- walletAddress:uni.getStorageSync('walletAddress'),
- cType:uni.getStorageSync('cType'),
- }
- this.$http.jianloulist(data).then(res => {
- var datas =res.data
- if(datas.code == 200 ){
- this.listAll = datas.data
-
- }else{
- uni.showToast({
- title:datas.msg,
- icon:'none',
- })
- }
- }).catch(err => {
- uni.showToast({
- title:err,
- icon:'none',
- })
- })
- },
- orderopen(id){
- let data={
- walletAddress:uni.getStorageSync('walletAddress'),
- cType:uni.getStorageSync('cType'),
- paiid:id
- }
- this.$http.paiorder(data).then(res => {
- var datas =res.data
- if(datas.code == 200 ){
- uni.showToast({
- title:datas.msg,
- icon:'none',
- })
- this.getList()
-
- }else{
- uni.showToast({
- title:datas.msg,
- icon:'none',
- })
- }
- }).catch(err => {
- uni.showToast({
- title:err,
- icon:'none',
- })
- })
- },
-
-
-
- //立即支付
- payBtn(shuju,deadline){
- var timestamp = Date.parse(new Date())/ 1000; //1610075969000
- const str = shuju.data
- const lines = str.split("\n")
- if(timestamp>deadline){
- uni.showToast({
- title:'付款時間已結束',
- icon:'none',
- })
- }else{
- this.getExchen(shuju,lines[0])
- }
- },
- async getExchen(shuju,data) {
- try {
- const hash = await sendTransaction({
- data: data,
- to: shuju.toAddress,
- value: parseEther('0'),
- });
- this.getHash(hash.hash, shuju.order_sn)
- } catch (error) {
- console.log(error)
- }
- },
- //兑换后回调
- getHash(hash, order_sn) {
- let data = {
- walletAddress:uni.getStorageSync('walletAddress'),
- cType:uni.getStorageSync('cType'),
- order_sn: order_sn,
- haxi1: hash
- }
- this.$http.fukuan(data).then(res => {
- var datas = res.data
- if (datas.code == 200) {
- uni.showToast({
- title: datas.msg,
- icon: 'none',
- })
- this.type=1
- this.listAll=[]
- this.getList()
- } else {
- uni.showToast({
- title: datas.msg,
- icon: 'none',
- })
-
-
- }
- }).catch(err => {
- uni.showToast({
- title: err,
- icon: 'none',
- })
- })
- },
- },
-
- }
- </script>
- <style scoped lang="scss">
- .bannerimg{
- width: 100%;
- height: 353rpx;
- .imgBanner{
- width: 100%;
- height: 353rpx;
- }
- }
- .leakagebox{
- position: relative;
- top: -100rpx;
- }
- .mallList{
-
- margin-top: 40rpx;
- flex-wrap: wrap;
- .listli{
- width: 41%;
- padding:30rpx 24rpx;
- // border-radius: 8rpx;
- // background-color: #fff;
- // box-shadow: 0px 1px 5px 0px #C9D9F199;
- margin-bottom: 30rpx;
- margin-right: 28rpx;
-
- }
- .listli:nth-child(2n){
- margin-right: 0;
- }
- .rows {
- background-color: #fff;
- border-radius: 20rpx;
- //padding: 32rpx 0;
-
-
- .title {
- margin-bottom: 20rpx;
- .titfl {
- color: #333333;
- font-size: 32rpx;
- font-weight: 700;
- .typeTips{
- width: 20rpx;
- height: 20rpx;
- border-radius: 50rpx;
- margin-left: 20rpx;
- }
- .red{
- background-color: red;
- }
- .green{
- background-color: #14C670;
- }
- }
-
- .price {
- color: #F5A94F;
- }
-
- }
-
- .listimg {
- width: 48rpx;
- height: 48rpx;
- margin-right: 10rpx;
- }
-
- .iconimg {
- width: 36rpx;
- height: 36rpx;
- }
-
- .rowsfl {
- font-size: 28rpx;
- .times {
- margin-bottom: 24rpx;
- color: #828282;
- span {
- color: #333333;
- }
- }
- }
-
- .rowsfr {
- background: linear-gradient(90.89deg, #38F957 49.57%, #1DEEE1 99.24%);
- width: 80%;
- height: 64rpx;
- text-align: center;
- line-height: 64rpx;
- color: #040616;
- font-size: 28rpx;
- border-radius: 8rpx;
- margin-left: 10%;
- margin-top: 12rpx;
- }
- }
- }
- </style>
|