|
|
@@ -7,7 +7,7 @@
|
|
|
|
|
|
<view class="form-box">
|
|
|
<view class="form-item">
|
|
|
- <text class="label">收款人UID</text>
|
|
|
+ <text class="label">收款人UID/手机号</text>
|
|
|
<input
|
|
|
class="input"
|
|
|
type="number"
|
|
|
@@ -17,7 +17,7 @@
|
|
|
/>
|
|
|
</view>
|
|
|
|
|
|
- <view class="user-card" v-if="targetUser">
|
|
|
+ <!-- <view class="user-card" v-if="targetUser">
|
|
|
<image
|
|
|
class="avatar"
|
|
|
:src="targetUser.avatar || 'https://api.myjie.cn/static/img/logo.png'"
|
|
|
@@ -27,13 +27,13 @@
|
|
|
<text class="nickname">{{ targetUser.nickname || '微信用户' }}</text>
|
|
|
<text class="uid">UID:{{ targetUser.uid }}</text>
|
|
|
</view>
|
|
|
- </view>
|
|
|
- <view class="user-tip" v-else-if="keyword && searched && !searching">
|
|
|
+ </view> -->
|
|
|
+ <!-- <view class="user-tip" v-else-if="keyword && searched && !searching">
|
|
|
<text>未找到该用户,请检查UID</text>
|
|
|
- </view>
|
|
|
- <view class="user-tip" v-else-if="searching">
|
|
|
+ </view> -->
|
|
|
+ <!-- <view class="user-tip" v-else-if="searching">
|
|
|
<text>搜索中...</text>
|
|
|
- </view>
|
|
|
+ </view> -->
|
|
|
|
|
|
<view class="form-item">
|
|
|
<text class="label">转账积分</text>
|
|
|
@@ -149,7 +149,7 @@
|
|
|
submit() {
|
|
|
const that = this;
|
|
|
if (that.submitting) return;
|
|
|
-
|
|
|
+
|
|
|
if (!that.keyword) {
|
|
|
return that.$api.msg('请输入收款人UID');
|
|
|
}
|
|
|
@@ -159,7 +159,9 @@
|
|
|
if (String(that.keyword) === String(that.userInfo.uid)) {
|
|
|
return that.$api.msg('不能给自己转账');
|
|
|
}
|
|
|
-
|
|
|
+ if (String(that.keyword) === String(that.userInfo.mobile)) {
|
|
|
+ return that.$api.msg('不能给自己转账');
|
|
|
+ }
|
|
|
const score = parseInt(that.score, 10);
|
|
|
if (!score || score <= 0 || String(score) !== String(that.score).trim()) {
|
|
|
return that.$api.msg('请输入有效的整数积分');
|
|
|
@@ -167,42 +169,51 @@
|
|
|
if (score > Number(that.userInfo.score || 0)) {
|
|
|
return that.$api.msg('积分余额不足');
|
|
|
}
|
|
|
-
|
|
|
- uni.showModal({
|
|
|
- title: '确认转账',
|
|
|
- content: `向「UID:${that.keyword}」转账 ${score} 积分?`,
|
|
|
- success(res) {
|
|
|
- if (!res.confirm) return;
|
|
|
- that.submitting = true;
|
|
|
- const payload = {
|
|
|
- to_uid: that.keyword,
|
|
|
- score
|
|
|
- };
|
|
|
- if (that.mono && that.mono.trim()) {
|
|
|
- payload.mono = that.mono.trim();
|
|
|
- }
|
|
|
- scoreTransfer(payload)
|
|
|
- .then(() => {
|
|
|
- that.$api.msg('转账成功');
|
|
|
- that.score = '';
|
|
|
- that.mono = '';
|
|
|
- that.refreshUserInfo();
|
|
|
- setTimeout(() => {
|
|
|
- uni.navigateBack({
|
|
|
- fail() {
|
|
|
- uni.redirectTo({
|
|
|
- url: '/pages/user/jf/bill'
|
|
|
+ searchTransferUser({keyword:that.keyword}).then(ress => {
|
|
|
+ if(ress.data.list && ress.data.list.length > 0) {
|
|
|
+ let user = ress.data.list[0]
|
|
|
+ uni.showModal({
|
|
|
+ title: '确认转账',
|
|
|
+ content: `向「${user.nickname || '微信用户'}(UID:${user.uid})」转账 ${score} 积分?`,
|
|
|
+ success(res) {
|
|
|
+ if (!res.confirm) return;
|
|
|
+ that.submitting = true;
|
|
|
+ const payload = {
|
|
|
+ to_uid: user.uid,
|
|
|
+ score
|
|
|
+ };
|
|
|
+ if (that.mono && that.mono.trim()) {
|
|
|
+ payload.mono = that.mono.trim();
|
|
|
+ }
|
|
|
+ scoreTransfer(payload)
|
|
|
+ .then(() => {
|
|
|
+ that.$api.msg('转账成功');
|
|
|
+ that.score = '';
|
|
|
+ that.mono = '';
|
|
|
+ that.refreshUserInfo();
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.navigateBack({
|
|
|
+ fail() {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/user/jf/bill'
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
- }
|
|
|
+ }, 1200);
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ .finally(() => {
|
|
|
+ that.submitting = false;
|
|
|
});
|
|
|
- }, 1200);
|
|
|
- })
|
|
|
- .catch(() => {})
|
|
|
- .finally(() => {
|
|
|
- that.submitting = false;
|
|
|
- });
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- });
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
};
|