钱包 获取成功id

This commit is contained in:
asd 2020-10-15 20:12:21 +08:00
parent 4824480b5b
commit 9a6eeff200
4 changed files with 232 additions and 110 deletions

View File

@ -82,6 +82,7 @@ interface Wallect {
export async function getwallect(){ export async function getwallect(){
const res = await get<Array<Wallect>>('wallect') const res = await get<Array<Wallect>>('wallect')
console.log(res) console.log(res)
return res.data
} }
/** /**
@ -285,8 +286,9 @@ interface SaleInfo{
* @param data * @param data
*/ */
export async function saleinfo(data?:any){ export async function saleinfo(data?:any){
const res= await get<SaleInfo>('account',data) const res= await get<Array<SaleInfo>>('account',data)
console.log(res) console.log(res)
return res.data
} }
/** /**
@ -298,6 +300,52 @@ export async function cashout(data?:any){
message.success("新增成功") message.success("新增成功")
} }
} }
/**
*
*/
interface AccountInfo{
wallectid:number,
typeid:number,
type:number,
account:number,
mname:string,
bankcode:string,
bankname:string
}
export async function getaccountinfo(data?: any){
const res=await get<AccountInfo>('wallect/'+data)
console.log(res,2333)
return {
accountid:res.data.wallectid,
type:res.data.type,
account:res.data.account,
mname:res.data.mname,
bankcode:res.data.bankcode,
bankname:res.data.bankname
}
}
/**
*
*/
export async function editaccount(data?:any){
const res=await put<Liveaddrule>('wallect/'+data);
if(res.code==0){
message.success("修改成功")
}
}
/**
*
*/
export async function deleteaccount(data:any) {
const res = await del<Liveaddrule>('wallect/'+data);
if(res.code==0){
message.success("删除成功")
}
console.log(res)
}
/** /**
* *
* @param phone * @param phone

View File

@ -17,14 +17,14 @@
<div v-if="ifchina"> <div v-if="ifchina">
<a-radio-group <a-radio-group
name="radioGroup" name="radioGroup"
v-model="paytype"
class="accountlist" class="accountlist"
@change="onChange" @change="onChange"
:default-value="4" v-model:value="accountinfo.type"
> >
<a-radio :value="4"> <a-radio :value="4">
<img src="@/static/images/bank.png" alt="" class="icon icon1" /> <img src="@/static/images/bank.png" alt="" class="icon icon1" />
<span>银行卡</span> <span>银行卡zzz</span>
</a-radio> </a-radio>
<a-radio :value="2"> <a-radio :value="2">
<img src="@/static/images/walletzfb.png" alt="" class="icon" /> <img src="@/static/images/walletzfb.png" alt="" class="icon" />
@ -59,7 +59,7 @@
</a-radio-group> </a-radio-group>
</div> </div>
</div> </div>
<div class="cashoutmoney" v-if="paytype == 4 && ifchina"> <div class="cashoutmoney" v-if="accountinfo.type == 4 && ifchina">
<a-form > <a-form >
<div> <div>
<div class="infoitem"> <div class="infoitem">
@ -85,7 +85,7 @@
</div> </div>
</a-form> </a-form>
</div> </div>
<div class="cashoutmoney" v-if="paytype == 2 && ifchina"> <div class="cashoutmoney" v-if="accountinfo.type == 2 && ifchina">
<div> <div>
<div class="infoitem"> <div class="infoitem">
<span class="label label1">帐号</span> <span class="label label1">帐号</span>
@ -97,7 +97,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="cashoutmoney" v-if="paytype == 1 && ifchina"> <div class="cashoutmoney" v-if="accountinfo.type == 1 && ifchina">
<div class="label label1">扫码绑定</div> <div class="label label1">扫码绑定</div>
<div class="ewmbox"> <div class="ewmbox">
<img src="@/static/images/erweima.png" alt="" class="ewmpic" /> <img src="@/static/images/erweima.png" alt="" class="ewmpic" />
@ -152,9 +152,10 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, ref, toRaw } from "vue"; import { defineComponent, onMounted, ref, toRaw } from "vue";
import NavBottom from "@/components/NavBottom.vue"; import NavBottom from "@/components/NavBottom.vue";
import { accountadd } from '@/api'; import { accountadd, editaccount, getaccountinfo } from '@/api';
import { useRoute } from 'vue-router';
export default defineComponent({ export default defineComponent({
name: "Cashout", name: "Cashout",
components: { components: {
@ -188,9 +189,25 @@ export default defineComponent({
}; };
function sub(){ function sub(){
console.log(toRaw(accountinfo.value),11) console.log(toRaw(accountinfo.value),11)
accountadd(toRaw(accountinfo.value)) // cosnole.log(useRoute().query.id)
if(toRaw(accountinfo.value).accountid){
console.log(300)
editaccount(toRaw(accountinfo.value).accountid)
}else{
console.log(111)
accountadd(toRaw(accountinfo.value))
}
} }
const ifchina = ref(true); const ifchina = ref(true);
onMounted(async () => {
if(useRoute().query.id){
accountinfo.value=await getaccountinfo(useRoute().query.id)
// console.log(await getaccountinfo(useRoute().query.id),233)
}
// useRoute().query.id
})
return { return {
money, money,
onChange, onChange,

View File

@ -18,23 +18,43 @@
<div class="chooseitem"> <div class="chooseitem">
<div class="label">选择账户</div> <div class="label">选择账户</div>
<!-- <a-radio></a-radio> --> <!-- <a-radio></a-radio> -->
{{payinfo.type}} <!-- {{payinfo.type}} -->
<a-radio-group v-model:value="payinfo.type" @change="onChange"> <a-radio-group v-model:value="payinfo.type" @change="onChange">
<div class="accountlist"> <div class="accountlist">
<a-radio :value="4"> <a-radio v-for="(i,j) in accountlist" :key="j" :value="j">
<div class="accountitem"> <div class="accountitem">
<div class="hostinfo"> <div class="hostinfo" v-if="i.type==4">
<div> <div>
<img src="@/static/images/bank.png" alt="" class="icon" /> <img src="@/static/images/bank.png" alt="" class="icon" />
<span class="accounttype">银行卡</span> <span class="accounttype">银行卡</span>
</div> </div>
</div>
<div class="hostinfo" v-if="i.type==2">
<div>
<img
src="@/static/images/walletzfb.png"
alt=""
class="icon icon1"
/>
<span class="accounttype">支付宝</span>
</div>
</div>
<div class="hostinfo" v-if="i.type==1">
<div>
<img
src="@/static/images/walletweixin.png"
alt=""
class="icon icon1"
/>
<span class="accounttype">微信</span>
</div>
</div> </div>
<div class="zhanghao">账号6217 **** **** **** 175</div> <div class="zhanghao">账号6217 **** **** **** 175</div>
</div> </div>
</a-radio> </a-radio>
<a-radio :value="2"> <!-- <a-radio :value="2">
<div class="accountitem"> <div class="accountitem">
<div class="hostinfo"> <div class="hostinfo">
<div> <div>
@ -63,7 +83,7 @@
</div> </div>
<div class="zhanghao">账号6217 **** **** **** 175</div> <div class="zhanghao">账号6217 **** **** **** 175</div>
</div> </div>
</a-radio> </a-radio> -->
</div> </div>
</a-radio-group> </a-radio-group>
@ -86,9 +106,9 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, ref, toRaw } from "vue"; import { defineComponent, onMounted, ref, toRaw } from "vue";
import NavBottom from "@/components/NavBottom.vue"; import NavBottom from "@/components/NavBottom.vue";
import { cashout } from '@/api'; import { cashout, getwallect } from '@/api';
export default defineComponent({ export default defineComponent({
name: "Cashout", name: "Cashout",
components: { components: {
@ -97,29 +117,37 @@ export default defineComponent({
setup() { setup() {
const money = ref(0); const money = ref(0);
const payinfo=ref<any>({ const payinfo=ref<any>({
type:4, type:0,
money:0, money:0,
account :"", account :"",
mname:"", mname:"",
bankcode:"", bankcode:"",
bankname:"", bankname:"",
international:0 international:0,
typeid:0
}) })
const moneychange: (e: number) => void = (e: number) => { const moneychange: (e: number) => void = (e: number) => {
console.log(e); console.log(e);
}; };
const yue=ref<number>(105) const yue=ref<number>(105)
const accountlist =ref<Array<any>>([])
onMounted(async () => {
accountlist.value=await getwallect();
});
function onChange(e: any) { function onChange(e: any) {
console.log(e.target.value); console.log(e.target.value);
payinfo.value.type=e.target.value payinfo.value.type=e.target.value
payinfo.value.typeid=toRaw(accountlist.value)[e.target.value].wallectid
// payinfo.value.type=toRaw(accountlist.value)[e.target.value].wallectid
} }
function all(){ function all(){
payinfo.value.money=yue.value payinfo.value.money=yue.value
} }
function sub(){ function sub(){
console.log(toRaw(payinfo.value)) console.log(toRaw(payinfo.value))
cashout(toRaw(payinfo.value)) // cashout(toRaw(payinfo.value))
} }
return { return {
@ -129,7 +157,8 @@ export default defineComponent({
onChange, onChange,
all, all,
yue, yue,
sub sub,
accountlist
}; };
}, },
}); });
@ -214,8 +243,12 @@ export default defineComponent({
.chooseitem { .chooseitem {
display: flex; display: flex;
margin-bottom: 34px; margin-bottom: 34px;
.label{
width:150px;
}
.accountlist { .accountlist {
display: flex; display: flex;
flex-wrap: wrap;
.accountitem { .accountitem {
// width: 200px; // width: 200px;
padding-bottom: 16px; padding-bottom: 16px;
@ -225,6 +258,7 @@ export default defineComponent({
border-radius: 17px; border-radius: 17px;
margin-left: 17px; margin-left: 17px;
margin-right: 46px; margin-right: 46px;
margin-bottom: 17px;
.hostinfo { .hostinfo {
display: flex; display: flex;
padding-top: 17px; padding-top: 17px;

View File

@ -16,7 +16,7 @@
</div> </div>
<div class="line"></div> <div class="line"></div>
<div class="accounts"> <div class="accounts">
<div class="left"> <div class="left" @click="listchange(1)">
<img src="@/static/images/account.png" alt="" class="pic" /> <img src="@/static/images/account.png" alt="" class="pic" />
<div class="texts"> <div class="texts">
<div>绑定用户</div> <div>绑定用户</div>
@ -24,7 +24,7 @@
</div> </div>
</div> </div>
<div class="linecolumn"></div> <div class="linecolumn"></div>
<div class="left"> <div class="left" @click="listchange(2)">
<img src="@/static/images/money.png" alt="" class="pic" /> <img src="@/static/images/money.png" alt="" class="pic" />
<div class="texts"> <div class="texts">
<div>账户余额</div> <div>账户余额</div>
@ -43,23 +43,40 @@
<div>添加新的账户</div> <div>添加新的账户</div>
</div> </div>
</div> </div>
<div class="accountlist" v-if="ifchina && !ifmingxi">
<div class="accountitem"> <div class="accountlist" v-if="ifchina && listindex==1">
<div class="accountitem" v-for="(i,j) in accountlist" :key="j">
<div class="hostinfo"> <div class="hostinfo">
<div> <div v-if="i.type==4">
<img src="@/static/images/bank.png" alt="" class="icon" /> <img src="@/static/images/bank.png" alt="" class="icon" />
<span class="accounttype">银行卡</span> <span class="accounttype">银行卡</span>
</div> </div>
<div v-if="i.type==2">
<img
src="@/static/images/walletzfb.png"
alt=""
class="icon icon1"
/>
<span class="accounttype">支付宝</span>
</div>
<div v-if="i.type==1">
<img
src="@/static/images/walletweixin.png"
alt=""
class="icon icon1"
/>
<span class="accounttype">微信</span>
</div>
<div class="btns"> <div class="btns">
<div class="btn">修改</div> <div class="btn" @click="navto(1,i.wallectid)">修改</div>
<div class="btn1">删除</div> <div class="btn1" @click="del(i.wallectid)">删除</div>
</div> </div>
</div> </div>
<div class="zhanghao">账号6217 **** **** **** 175</div> <div class="zhanghao" v-if="i.type==4">账号 <span>{{i.bankcode}}</span></div>
<div class="zhanghao" v-else>账号 <span>{{i.account}}</span></div>
</div> </div>
<div class="accountitem"> <!-- <div class="accountitem">
<div class="hostinfo"> <div class="hostinfo">
<div> <div>
<img <img
@ -76,9 +93,9 @@
</div> </div>
</div> </div>
<div class="zhanghao">账号6217 **** **** **** 175</div> <div class="zhanghao">账号6217 **** **** **** 175</div>
</div> </div> -->
<div class="accountitem"> <!-- <div class="accountitem">
<div class="hostinfo"> <div class="hostinfo">
<div> <div>
<img <img
@ -95,10 +112,10 @@
</div> </div>
</div> </div>
<div class="zhanghao">账号6217 **** **** **** 175</div> <div class="zhanghao">账号6217 **** **** **** 175</div>
</div> </div> -->
</div> </div>
<div class="accountlist" v-if="!ifchina && !ifmingxi"> <div class="accountlist" v-if="!ifchina && listindex==1">
<div class="accountitem"> <!-- <div class="accountitem">
<div class="hostinfo"> <div class="hostinfo">
<div> <div>
<img src="@/static/images/foreignbank.png" alt="" class="icon" /> <img src="@/static/images/foreignbank.png" alt="" class="icon" />
@ -111,35 +128,41 @@
</div> </div>
</div> </div>
<div class="zhanghao">账号6217 **** **** **** 175</div> <div class="zhanghao">账号6217 **** **** **** 175</div>
</div> </div> -->
<div class="accountitem"> <div class="accountitem" v-for="(i,j) in accountlist" :key="j">
<div class="hostinfo"> <div class="hostinfo">
<div> <div v-if="i.type==4">
<img src="@/static/images/foreignbank.png" alt="" class="icon" />
<span class="accounttype">银行卡</span>
</div>
<div v-else>
<img src="@/static/images/paypi.png" alt="" class="icon icon1" /> <img src="@/static/images/paypi.png" alt="" class="icon icon1" />
<span class="accounttype">paypal</span> <span class="accounttype">paypal</span>
</div> </div>
<div class="btns"> <div class="btns">
<div class="btn">修改</div> <div class="btn" @click="navto(1,i.wallectid)">修改</div>
<div class="btn1">删除</div> <div class="btn1" @click="del(i.wallectid)">删除</div>
</div> </div>
</div> </div>
<div class="zhanghao">账号6217 **** **** **** 175</div> <div class="zhanghao" v-if="i.type==4">账号 <span>{{i.bankcode}}</span></div>
<div class="zhanghao" v-else>账号 <span>{{i.account}}</span></div>
</div> </div>
</div> </div>
<div class="mingxilist"> <div class="mingxilist" v-if="ifchina && listindex==2">
<div class="mingxitop"> <div class="mingxitop">
<div class="tabs"> <div class="tabs">
<span class="tabtitle">明细查询</span> <span class="tabtitle">明细查询</span>
<div :class="tabindex == 4 ? 'on' : ''" @click="tabchange(4)"> <div :class="tabindex == 0 ? 'on' : ''" @click="tabchange(0)">
全部 全部
</div> </div>
<div :class="tabindex == 0 ? 'on' : ''" @click="tabchange(0)"> <div :class="tabindex == 1 ? 'on' : ''" @click="tabchange(1)">
收入 收入
</div> </div>
<div :class="tabindex == 1 ? 'on' : ''" @click="tabchange(1)"> <div :class="tabindex == 2 ? 'on' : ''" @click="tabchange(2)">
支出 支出
</div> </div>
</div> </div>
@ -157,55 +180,14 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr v-for="(i,j) in salelist" :key="j">
<td>2020-08-13 13:54</td> <td>{{i.created_at}}</td>
<td>直播收入</td> <td>{{i.typename}}</td>
<td class="moneyadd">+320</td> <td class="moneyadd moneyreverse" v-if="i.type==2">-{{i.money}}</td>
<td>查看详情</td> <td class="moneyadd " v-else>+{{i.money}}</td>
</tr>
<tr>
<td>2020-08-13 13:54</td>
<td>直播收入</td>
<td class="moneyreverse">+320</td>
<td>查看详情</td> <td>查看详情</td>
</tr> </tr>
<tr>
<td>2020-08-13 13:54</td>
<td>直播收入</td>
<td class="moneyadd">+320</td>
<td>查看详情</td>
</tr>
<tr>
<td>2020-08-13 13:54</td>
<td>直播收入</td>
<td class="moneyadd">+320</td>
<td>查看详情</td>
</tr>
<tr>
<td>2020-08-13 13:54</td>
<td>直播收入</td>
<td class="moneyadd">+320</td>
<td>查看详情</td>
</tr>
<tr>
<td>2020-08-13 13:54</td>
<td>直播收入</td>
<td class="moneyadd">+320</td>
<td>查看详情</td>
</tr>
<tr>
<td>2020-08-13 13:54</td>
<td>直播收入</td>
<td class="moneyadd">+320</td>
<td>查看详情</td>
</tr>
<tr>
<td>2020-08-13 13:54</td>
<td>直播收入</td>
<td class="moneyadd">+320</td>
<td>查看详情</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
@ -215,42 +197,70 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, onMounted, ref } from "vue"; import { defineComponent, onMounted, ref, toRaw } from "vue";
import NavBottom from "@/components/NavBottom.vue"; import NavBottom from "@/components/NavBottom.vue";
import router from "@/router"; import router from "@/router";
import { getwallect, saleinfo } from "@/api"; import { deleteaccount, getwallect, saleinfo } from "@/api";
export default defineComponent({ export default defineComponent({
name: "Wallet", name: "Wallet",
components: { components: {
NavBottom, NavBottom,
}, },
setup() { setup() {
const ifchina = false; const ifchina = true;
const ifmingxi = true; const ifmingxi = false;
getwallect(); const salelist=ref<Array<any>>([])
const accountlist =ref<Array<any>>([])
const listindex=ref<number>(1)
const state=ref<number>(0)
const dates=ref<Array<string>>(["",""])
onMounted(async () => { onMounted(async () => {
const res = await saleinfo(); salelist.value = await saleinfo();
accountlist.value=await getwallect();
}); });
const tabindex = ref(4); const tabindex = ref(0);
function tabchange(e: number): void { async function tabchange(e: number): Promise<void> {
tabindex.value = e; tabindex.value = e;
state.value=e
salelist.value=await saleinfo({status:e,bdate:dates.value[0],edate:dates.value[1]});
// console.log(videolist) // console.log(videolist)
} }
function navto(index: number) { function listchange(e: number){
listindex.value=e
}
async function onChange(e: any,dateString:string){
console.log(dateString)
dates.value[0]=dateString[0]
dates.value[1]=dateString[1]
salelist.value=await saleinfo({bdate:dateString[0],edate:dateString[1],status:state.value});
}
async function del(e: number){
deleteaccount(e)
}
function navto(index: number,id?:number) {
let url = ""; let url = "";
switch (index) { switch (index) {
case 1: case 1:
url = "/mine/addaccount";
url = "/mine/addaccount"
console.log(url)
break; break;
case 2: case 2:
url = "/mine/cashout"; url = "/mine/cashout";
break; break;
} }
router.push({ if(id){
path: url, router.push({
}); path: url,
query:{id:id}
});
}else{
router.push({
path: url
});
}
} }
return { return {
ifchina, ifchina,
@ -258,6 +268,13 @@ export default defineComponent({
navto, navto,
tabindex, tabindex,
tabchange, tabchange,
salelist,
accountlist,
listchange,
listindex,
onChange,
dates,
del
}; };
}, },
}); });
@ -424,12 +441,15 @@ export default defineComponent({
.accountlist { .accountlist {
margin-top: 17px; margin-top: 17px;
display: flex; display: flex;
width:1170px;
flex-wrap: wrap;
.accountitem { .accountitem {
width: 372px; width: 372px;
height: 226px; height: 226px;
background: white; background: white;
border-radius: 17px; border-radius: 17px;
margin-left: 17px; margin-left: 17px;
margin-bottom: 17px;
.hostinfo { .hostinfo {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
@ -478,13 +498,16 @@ export default defineComponent({
font-size: 11px; font-size: 11px;
margin-top: 119px; margin-top: 119px;
margin-left: 34px; margin-left: 34px;
>span{
margin-left:15px
}
} }
} }
} }
.mingxilist { .mingxilist {
width: 1150px; width: 1150px;
height: 533px; max-height: 533px;
background: white; background: white;
border-radius: 18px; border-radius: 18px;
margin-top: 18px; margin-top: 18px;
@ -512,7 +535,7 @@ export default defineComponent({
} }
.table { .table {
width: 1150px; width: 1150px;
height: 365px; max-height: 365px;
text-align: center; text-align: center;
color: #343434; color: #343434;
font-size: 12px; font-size: 12px;