|
@@ -3,15 +3,10 @@
|
|
|
<view class="list flex_r flex_ac flex_jb mar_t16">
|
|
<view class="list flex_r flex_ac flex_jb mar_t16">
|
|
|
<view class="list_name">赠送类型:</view>
|
|
<view class="list_name">赠送类型:</view>
|
|
|
<view class="list_text">
|
|
<view class="list_text">
|
|
|
- <div class="option-i" @click="value = 1">
|
|
|
|
|
- <img src="@/static/img/xuanzhong_icon.png" v-if="value === 1" class="ico" alt="" />
|
|
|
|
|
|
|
+ <div class="option-i" @click="value = s" v-for="(i,s) in list" :key="s">
|
|
|
|
|
+ <img src="@/static/img/xuanzhong_icon.png" v-if="value == s" class="ico" alt="" />
|
|
|
<img src="@/static/img/weixuanzhong_icon.png" v-else class="ico" alt="" />
|
|
<img src="@/static/img/weixuanzhong_icon.png" v-else class="ico" alt="" />
|
|
|
- <span class="txt">茶宝</span>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="option-i" @click="value = 0">
|
|
|
|
|
- <img src="@/static/img/xuanzhong_icon.png" v-if="value === 0" class="ico" alt="" />
|
|
|
|
|
- <img src="@/static/img/weixuanzhong_icon.png" v-else class="ico" alt="" />
|
|
|
|
|
- <span class="txt">云宝</span>
|
|
|
|
|
|
|
+ <span class="txt">{{ i.name }}</span>
|
|
|
</div>
|
|
</div>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -19,10 +14,14 @@
|
|
|
<view class="list_name">当前云宝:</view>
|
|
<view class="list_name">当前云宝:</view>
|
|
|
<view class="list_text"><text>{{ userinfo.user_money }}</text></view>
|
|
<view class="list_text"><text>{{ userinfo.user_money }}</text></view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="list flex_r flex_ac flex_jb mar_t16" v-else>
|
|
|
|
|
|
|
+ <view class="list flex_r flex_ac flex_jb mar_t16" v-else-if="value == 1">
|
|
|
<view class="list_name">当前茶宝:</view>
|
|
<view class="list_name">当前茶宝:</view>
|
|
|
<view class="list_text"><text>{{ userinfo.cha_bao }}</text></view>
|
|
<view class="list_text"><text>{{ userinfo.cha_bao }}</text></view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
+ <view class="list flex_r flex_ac flex_jb mar_t16" v-else>
|
|
|
|
|
+ <view class="list_name">当前TeaC:</view>
|
|
|
|
|
+ <view class="list_text"><text>{{ userinfo.teac }}</text></view>
|
|
|
|
|
+ </view>
|
|
|
<view class="list flex_r flex_ac flex_jb mar_t16">
|
|
<view class="list flex_r flex_ac flex_jb mar_t16">
|
|
|
<view class="list_name">对方账号:</view>
|
|
<view class="list_name">对方账号:</view>
|
|
|
<view class="list_text">
|
|
<view class="list_text">
|
|
@@ -75,80 +74,55 @@ export default {
|
|
|
if (this.give_num == 0) {
|
|
if (this.give_num == 0) {
|
|
|
appEv.errTips("赠送数量不得为0");
|
|
appEv.errTips("赠送数量不得为0");
|
|
|
return;
|
|
return;
|
|
|
|
|
+ } else if (
|
|
|
|
|
+ this.give_num > Number(this.userinfo.teac) &&
|
|
|
|
|
+ this.value == 2
|
|
|
|
|
+ ) {
|
|
|
|
|
+ appEv.errTips("赠送数量不得超过teac余额");
|
|
|
|
|
+ return;
|
|
|
} else if (
|
|
} else if (
|
|
|
this.give_num > Number(this.userinfo.cha_bao) &&
|
|
this.give_num > Number(this.userinfo.cha_bao) &&
|
|
|
this.value == 1
|
|
this.value == 1
|
|
|
) {
|
|
) {
|
|
|
- appEv.errTips("赠送数量不得超过茶宝云宝");
|
|
|
|
|
|
|
+ appEv.errTips("赠送数量不得超过茶宝余额");
|
|
|
return;
|
|
return;
|
|
|
} else if (
|
|
} else if (
|
|
|
this.give_num > Number(this.userinfo.user_money) &&
|
|
this.give_num > Number(this.userinfo.user_money) &&
|
|
|
this.value == 0
|
|
this.value == 0
|
|
|
) {
|
|
) {
|
|
|
- appEv.errTips("赠送数量不得超过云宝");
|
|
|
|
|
|
|
+ appEv.errTips("赠送数量不得超过云宝余额");
|
|
|
return;
|
|
return;
|
|
|
} else if (this.id == "") {
|
|
} else if (this.id == "") {
|
|
|
appEv.errTips("请输入赠送账号");
|
|
appEv.errTips("请输入赠送账号");
|
|
|
return;
|
|
return;
|
|
|
} else {
|
|
} else {
|
|
|
- let content = "";
|
|
|
|
|
- if (this.value == 0) {
|
|
|
|
|
- content = `你将赠送给${this.id}云宝${
|
|
|
|
|
- this.give_num
|
|
|
|
|
- },扣除手续费后对方将收到${
|
|
|
|
|
- this.$h.Mul(this.give_num, (1 - this.list[this.value].fee))
|
|
|
|
|
- }云宝`;
|
|
|
|
|
- } else {
|
|
|
|
|
- content = `你将赠送给${this.id}茶宝${
|
|
|
|
|
- this.give_num
|
|
|
|
|
- },扣除手续费后对方将收到${
|
|
|
|
|
- this.$h.Mul(this.give_num, (1 - this.list[this.value].fee))
|
|
|
|
|
- }茶宝`;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ let it_name = this.list[this.value].name;
|
|
|
|
|
+ let content = `你将赠送${it_name}给${this.id},扣除手续费后对方将收到${ this.$h.Mul(this.give_num, (1 - this.list[this.value].fee)) }${it_name}`;
|
|
|
let that = this
|
|
let that = this
|
|
|
uni.showModal({
|
|
uni.showModal({
|
|
|
title: "提示",
|
|
title: "提示",
|
|
|
content: content,
|
|
content: content,
|
|
|
showCancel: true,
|
|
showCancel: true,
|
|
|
success: function(res) {
|
|
success: function(res) {
|
|
|
- if (res.confirm) {
|
|
|
|
|
- if (that.value == 0) {
|
|
|
|
|
- that.giveMoney();
|
|
|
|
|
- } else {
|
|
|
|
|
- that.giveIntegral();
|
|
|
|
|
- }
|
|
|
|
|
- } else {}
|
|
|
|
|
|
|
+ if (res.confirm) that.giveMoney();
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- // 赠送茶宝
|
|
|
|
|
- giveIntegral() {
|
|
|
|
|
- let data = {
|
|
|
|
|
- mobile: this.id,
|
|
|
|
|
- number: this.give_num,
|
|
|
|
|
- };
|
|
|
|
|
- post("v1/my/give", data).then((res) => {
|
|
|
|
|
- if (res.code === 0) {
|
|
|
|
|
- this.give_num = 0;
|
|
|
|
|
- this.id = "";
|
|
|
|
|
- this.getuserInfo();
|
|
|
|
|
- appEv.errTips(res.msg);
|
|
|
|
|
- } else {
|
|
|
|
|
- appEv.errTips(res.msg);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // 赠送云宝
|
|
|
giveMoney() {
|
|
giveMoney() {
|
|
|
|
|
+ let url = "v1/my/moneyGive"
|
|
|
|
|
+ if (this.value == 1) { url = "v1/my/give" }
|
|
|
|
|
+ else if (this.value == 2) { url = "v1/my/giveTeac" }
|
|
|
|
|
+ else url = "v1/my/moneyGive"
|
|
|
let data = {
|
|
let data = {
|
|
|
mobile: this.id,
|
|
mobile: this.id,
|
|
|
number: this.give_num,
|
|
number: this.give_num,
|
|
|
};
|
|
};
|
|
|
- post("v1/my/moneyGive", data).then((res) => {
|
|
|
|
|
|
|
+ post(url, data).then((res) => {
|
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
|
- this.give_num = 0;
|
|
|
|
|
- this.id = "";
|
|
|
|
|
|
|
+ this.id = "";
|
|
|
|
|
+ this.give_num = "";
|
|
|
appEv.errTips(res.msg);
|
|
appEv.errTips(res.msg);
|
|
|
this.getuserInfo();
|
|
this.getuserInfo();
|
|
|
} else {
|
|
} else {
|
|
@@ -163,9 +137,6 @@ export default {
|
|
|
|
|
|
|
|
OnpickerShow() {
|
|
OnpickerShow() {
|
|
|
this.pickerShow = !this.pickerShow;
|
|
this.pickerShow = !this.pickerShow;
|
|
|
- },
|
|
|
|
|
- confirm(da) {
|
|
|
|
|
- this.value = da[0]
|
|
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
};
|
|
};
|
|
@@ -187,7 +158,6 @@ page {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.list_text {
|
|
.list_text {
|
|
|
- flex: 1;
|
|
|
|
|
font-family: "SourceHanSansCN-Bold";
|
|
font-family: "SourceHanSansCN-Bold";
|
|
|
text-align: right;
|
|
text-align: right;
|
|
|
|
|
|
|
@@ -215,7 +185,6 @@ page {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.list_name {
|
|
.list_name {
|
|
|
- flex: 1;
|
|
|
|
|
color: #333333;
|
|
color: #333333;
|
|
|
font-size: 28rpx;
|
|
font-size: 28rpx;
|
|
|
font-family: "SourceHanSansCN-Medium";
|
|
font-family: "SourceHanSansCN-Medium";
|