<template>
|
|
<view class="page_bg" :style="'background-image: url('+img_url+'presented_integral_bg.png)'">
|
|
<view class="card">
|
|
<u-search height="90" :show-action="true" placeholder="请输入邀请码" @search="searchsend" @custom="searchsend" v-model="search_text" actionText="搜索" @clear="clear_search_text"></u-search>
|
|
<view class="send_user" v-if="Object.keys(search_user).length > 0">
|
|
<view class="item">
|
|
<u-badge :offset="['64','588']" :isDot="true" showZero='0' type="success"></u-badge>
|
|
<image :src="search_user.headUrl" mode=""></image>
|
|
<view class="user_name">
|
|
<text class="name">{{search_user.nickName}}</text>
|
|
<text class="id">ID:{{search_user.id}}</text>
|
|
</view>
|
|
<view class="icon_btn">
|
|
<button class="invite_btn" v-if="!checked" @click="toInvite(item)">确认选择</button>
|
|
<view class="" v-else>
|
|
<u-checkbox v-model="checked" shape="circle"></u-checkbox>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
<view class="send_num">
|
|
<text class="send_num_text">赠送兑购金:</text>
|
|
<u-input type="number" :placeholder="null" clearable v-model="num"></u-input>
|
|
</view>
|
|
<button class="send_btn no_btn sccusess" @click="send">确认赠送</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import config from "@/utils/js/config.js"
|
|
export default {
|
|
data() {
|
|
return {
|
|
img_url: config.img_url,
|
|
checked: false,
|
|
search_user:{},
|
|
search_text: "",
|
|
num: null
|
|
}
|
|
},
|
|
methods: {
|
|
searchsend() {
|
|
const params = {
|
|
invitationCode: this.search_text
|
|
}
|
|
this.$api('invitationCode',params).then(res => {
|
|
let { code, result, message} = res
|
|
if(code == 200) {
|
|
console.log(result)
|
|
this.search_user = result
|
|
this.search_text=""
|
|
}else{
|
|
this.$Toast(message)
|
|
}
|
|
}).catch(err => {
|
|
console.log(err)
|
|
this.search_text=""
|
|
this.$Toast(err.message)
|
|
})
|
|
},
|
|
clear_search_text() {
|
|
this.search_text=""
|
|
},
|
|
toInvite () {
|
|
this.checked = true
|
|
},
|
|
send() {
|
|
// 确认送兑购
|
|
const params = {
|
|
count: this.num,
|
|
uid:this.search_user.id
|
|
}
|
|
if(!this. checked) {
|
|
this.$Toast("请选择赠送人!");
|
|
return
|
|
}
|
|
if(this.num == null && this.num == 0) {
|
|
this.$Toast("请输入赠送兑购!");
|
|
return
|
|
}
|
|
uni.showLoading()
|
|
this.$api('awardPoints',params).then(res => {
|
|
let { code, result, message} = res
|
|
if(code == 200) {
|
|
console.log(result)
|
|
// this.$Toast(result)
|
|
uni.showModal({
|
|
title: result,
|
|
icon: 'none',
|
|
success(res) {
|
|
if(res.confirm) {
|
|
// 确定
|
|
uni.switchTab({
|
|
url: '/pages/my/my'
|
|
})
|
|
}else{
|
|
// 取消,
|
|
this.search_user = {};
|
|
this.num = null
|
|
}
|
|
}
|
|
})
|
|
uni.hideLoading()
|
|
}else{
|
|
uni.hideLoading()
|
|
this.$Toast(message)
|
|
}
|
|
}).catch(err => {
|
|
uni.hideLoading()
|
|
console.log(err)
|
|
this.$Toast(err.message)
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
/deep/ .u-badge{
|
|
padding: 0 !important;
|
|
}
|
|
.page_bg {
|
|
position: relative;
|
|
height: 100vh;
|
|
background-size: 100% 100%;
|
|
.card {
|
|
width: 674rpx;
|
|
border-radius: 17rpx;
|
|
background-color: #fff;
|
|
position: absolute;
|
|
top: 25%;
|
|
left: 38rpx;
|
|
z-index: 10;
|
|
padding-left: 23rpx;
|
|
padding-top: 40rpx;
|
|
padding-right: 40rpx;
|
|
padding-bottom: 50rpx;
|
|
box-sizing: border-box;
|
|
/deep/ .u-search{
|
|
margin-top: 40rpx;
|
|
.u-action-active{
|
|
font-size: 32rpx;
|
|
}
|
|
}
|
|
/deep/ input{
|
|
font-size: 32rpx;
|
|
}
|
|
.send_user{
|
|
position: relative;
|
|
margin-top: 44rpx;
|
|
.item{
|
|
width: 602rpx;
|
|
height: 138rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
&:nth-child(1){
|
|
border-top: 1px solid #ECECEC;
|
|
}
|
|
border-bottom: 1px solid #ECECEC;
|
|
image{
|
|
width: 88rpx;
|
|
height: 88rpx;
|
|
border-radius: 8rpx;
|
|
margin-left: 40rpx;
|
|
background-color: #3B3B3B;
|
|
}
|
|
.user_name{
|
|
display: flex;
|
|
flex: 1;
|
|
flex-direction: column;
|
|
margin-left: 16rpx;
|
|
.name{
|
|
font-size: 28rpx;
|
|
color: #3B3B3B;
|
|
padding-top: 10rpx;
|
|
}
|
|
.id{
|
|
font-size: 24rpx;
|
|
color: #929292;
|
|
padding-top: 13rpx;
|
|
}
|
|
}
|
|
.icon_btn{
|
|
.invite_btn{
|
|
width: 161rpx;
|
|
height: 67rpx;
|
|
border-radius: 17rpx;
|
|
background-color: #01AEEA;
|
|
font-size: 26rpx;
|
|
color: #fff;
|
|
text-align: center;
|
|
line-height: 67rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.send_num{
|
|
width: 545rpx;
|
|
height: 101rpx;
|
|
margin: 0 auto;
|
|
box-shadow: 0 3px 6px 0 rgba(0,0,0,0.16);
|
|
border-radius: 34rpx;
|
|
display: flex;
|
|
flex-wrap: nowrap;
|
|
margin-top: 60rpx;
|
|
align-items: center;
|
|
padding-left: 23rpx;
|
|
font-size: 32rpx;
|
|
.send_num_text{
|
|
width: 230rpx;
|
|
}
|
|
input{
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
}
|
|
|
|
.send_btn{
|
|
font-size: 36rpx;
|
|
width: 403rpx;
|
|
height: 81rpx;
|
|
line-height: 81rpx;
|
|
margin: 0 auto;
|
|
margin-top: 150rpx;
|
|
border-radius: 18rpx;
|
|
color: #fff;
|
|
}
|
|
.no_btn{
|
|
background-color: #B4B4B4;
|
|
}
|
|
.sccusess{
|
|
background-color: #01AEEA;
|
|
}
|
|
|
|
}
|
|
}
|
|
</style>
|