|
|
@@ -3,11 +3,11 @@
|
|
|
import {
|
|
|
getTotalMoney
|
|
|
} from "@/api/money";
|
|
|
- import {
|
|
|
- addDeal,
|
|
|
- getAddress,
|
|
|
- getDealList
|
|
|
- } from "@/api/deal";
|
|
|
+ import {
|
|
|
+ addDeal, authorizeDeal,
|
|
|
+ getAddress,
|
|
|
+ getDealList
|
|
|
+ } from "@/api/deal";
|
|
|
import tools from "@/common/js/tools";
|
|
|
import web3 from "web3";
|
|
|
import {
|
|
|
@@ -161,7 +161,38 @@
|
|
|
}
|
|
|
|
|
|
})
|
|
|
- }
|
|
|
+ },
|
|
|
+ async authorizeDeal(item){
|
|
|
+ console.log(item)
|
|
|
+ let data = ''
|
|
|
+ let transactionData = ''
|
|
|
+ console.log(item.to_money-item.server_money)
|
|
|
+ let money=((item.to_money-item.server_money).toFixed(6)*1)+'';
|
|
|
+ let formHex = web3.utils.numberToHex(ethers.utils.parseEther(money).toString());
|
|
|
+ data = '0x095ea7b3'
|
|
|
+ data = data + tools.replenishZero(this.dealAddress) + tools.replenishZero(formHex)
|
|
|
+ console.log(data)
|
|
|
+ transactionData = await tokenpocketBnb.getContractTransaction(data, 0);
|
|
|
+ console.log(transactionData)
|
|
|
+ // data='0x5e9a0c48000000000000000000000000b7f1c21c51a0f85704a13b981aa9075d9b102962';
|
|
|
+ tokenpocketBnb.sendTransaction(transactionData).then(hash => {
|
|
|
+ console.log(hash)
|
|
|
+ if (hash) {
|
|
|
+ authorizeDeal({
|
|
|
+ 'id': item.id,
|
|
|
+ 'hash': hash
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code === 1) {
|
|
|
+ tools.success(res.msg)
|
|
|
+ item.sq_hash =hash
|
|
|
+ } else {
|
|
|
+ tools.error(res.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
},
|
|
|
}
|
|
|
</script>
|
|
|
@@ -262,10 +293,10 @@
|
|
|
<view class="fs-24">{{item.created_date}}</view>
|
|
|
</view>
|
|
|
<view class="flex-direction-column flex-justify-end align-items-flex-end">
|
|
|
- <view class="fs-24" :class="item.id<=3?'fc-ED930F':item.id === 4?'fc-FF3B30':'fc-27AE60'">
|
|
|
+ <view class="fs-24" :class="item.status<=3?'fc-ED930F':(item.status === 4?'fc-FF3B30':'fc-27AE60')">
|
|
|
{{item.status_str}}</view>
|
|
|
- <view class="fs-28 ">到账: <text class="fc-ED301D">{{item.to_money}} DAO</text></view>
|
|
|
- <view class="but-b bgc-3489FF fs-24 text-align-center fc-f b-rad-20">
|
|
|
+ <view class="fs-28 ">到账: <text class="fc-ED301D">{{(item.to_money-item.server_money).toFixed(6)*1}} DAO</text></view>
|
|
|
+ <view class="but-b bgc-3489FF fs-24 text-align-center fc-f b-rad-20" @click="authorizeDeal(item)" v-show="item.status===3 && !item.sq_hash">
|
|
|
授权
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -347,4 +378,4 @@
|
|
|
box-sizing: border-box;
|
|
|
border-top: 2rpx solid #e5e5e5;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|