Browse Source

feat(邀请码): 实现邀请码绑定功能及界面优化

- 在order.js中添加bindCode接口用于绑定邀请码
- 修改InvitationCode页面支持邀请码绑定状态显示
- 优化输入框和按钮的样式及交互逻辑
- 更新环境变量从trial改为develop
master
前端-胡立永 2 weeks ago
parent
commit
bb3bc6e8ad
4 changed files with 60 additions and 47 deletions
  1. +13
    -0
      api/order/order.js
  2. +15
    -1
      pages/personalCenter/index.vue
  3. +31
    -45
      pages_order/mine/InvitationCode.vue
  4. +1
    -1
      utils/getUrl.js

+ 13
- 0
api/order/order.js View File

@ -1,6 +1,18 @@
import upload from '@/utils/upload' import upload from '@/utils/upload'
import request from '@/utils/request' import request from '@/utils/request'
// 查询指定伴宠师的服务小结
export const bindCode = (params) => {
return request({
url: '/applet/mall/teacher/bindCode',
headers: {
isToken: true
},
method: "get",
params
})
}
// 查询伴宠师列表 // 查询伴宠师列表
export function getTeacherList(params) { export function getTeacherList(params) {
return request({ return request({
@ -70,6 +82,7 @@ export const getTeacherServiceLogList = (params) => {
}) })
} }
// 查询订单列表 // 查询订单列表
export const getOrderList = (params) => { export const getOrderList = (params) => {
return request({ return request({


+ 15
- 1
pages/personalCenter/index.vue View File

@ -148,11 +148,23 @@
常用功能 常用功能
</view> </view>
</view> </view>
<!-- v-if="item.path != 'InvitationCode' || !userInfo.inviteCode" -->
<view class="personal-functions-content"> <view class="personal-functions-content">
<view v-for="(item,index) in functions" :key="index" class="personal-function" @click="openOtherPage(item.path)">
<view v-for="(item,index) in functions"
:key="index" class="personal-function"
@click="openOtherPage(item.path)">
<img :src="item.icon" alt="item.label" style="width: 30px; height: 30px;" mode="widthFix" /> <img :src="item.icon" alt="item.label" style="width: 30px; height: 30px;" mode="widthFix" />
<view class="personal-function-name">{{item.label}}</view> <view class="personal-function-name">{{item.label}}</view>
</view> </view>
<!-- <view class="personal-function"
v-if="userInfo.inviteCode">
<img src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/lock.png" alt="item.label"
style="width: 30px; height: 30px;" mode="widthFix" />
<view class="personal-function-name">已绑定</view>
</view> -->
</view> </view>
</uni-card> </uni-card>
</view> </view>
@ -169,6 +181,7 @@
export default{ export default{
data(){ data(){
return{ return{
// userInfo : {},
userName:'', userName:'',
userLevel:'', userLevel:'',
userAvatar:'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/avatar_1.png', userAvatar:'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/avatar_1.png',
@ -320,6 +333,7 @@
this.isMember=true this.isMember=true
getPersonalInfo().then(res=>{ getPersonalInfo().then(res=>{
if(res&&(res.id || res.id === 0)){ if(res&&(res.id || res.id === 0)){
// this.userInfo = res
this.userLevel=res.level this.userLevel=res.level
this.userName=res.nickname this.userName=res.nickname
// 使使 // 使使


+ 31
- 45
pages_order/mine/InvitationCode.vue View File

@ -8,33 +8,29 @@
</view> </view>
<view class="section-subtitle">邀请人有且只有一位添加后不可更改</view> <view class="section-subtitle">邀请人有且只有一位添加后不可更改</view>
<view class="input-area"> <view class="input-area">
<input type="text" class="invite-input" placeholder="请输入邀请码,领取优惠券" v-model="inviteCode" />
<input type="text" class="invite-input"
:disabled="!!userInfo.inviteCode"
placeholder="请输入邀请码" v-model="inviteCode" />
</view> </view>
<view class="submit-btn" @click="submitInviteCode">立即领取</view>
<view class="submit-btn"
v-if="userInfo.inviteCode"
style="background-color: #aaa;color: #fff;"
>已绑定</view>
<view class="submit-btn"
v-else
@click="submitInviteCode">立即绑定</view>
</view> </view>
<!-- 我的邀请码区域 -->
<!-- <view class="my-invitation-section">
<view class="section-header">
<text class="iconfont icon-myinvite"></text>
<text class="section-title">我的邀请码</text>
</view>
<view class="section-subtitle">有关邀请码的更多功能请前往服务者端了解~</view>
<view class="my-code-area">
<text class="my-code">{{ myInviteCode }}</text>
<view class="copy-btn" @click="copyInviteCode">复制</view>
</view>
</view> -->
<!-- 推广员入口 -->
<!-- <view class="promotion-section">
<text class="promotion-text">了解并加入布了推广员赚取高达80%收益分成!!!</text>
<view class="promotion-btn" @click="goToPromotion">推广员后台</view>
</view> -->
</view> </view>
</template> </template>
<script> <script>
import { bindCode } from '@/api/order/order.js'
import {
getOpenIdKey
} from '@/utils/auth'
export default { export default {
name: 'InvitationCode', name: 'InvitationCode',
data() { data() {
@ -43,9 +39,12 @@ export default {
myInviteCode: 'b1014pib' // myInviteCode: 'b1014pib' //
} }
}, },
onLoad() {
this.inviteCode = this.userInfo.inviteCode || ''
},
methods: { methods: {
// //
submitInviteCode() {
async submitInviteCode() {
if (!this.inviteCode) { if (!this.inviteCode) {
uni.showToast({ uni.showToast({
title: '请输入邀请码', title: '请输入邀请码',
@ -53,34 +52,19 @@ export default {
}) })
return return
} }
//
await bindCode({
openId : getOpenIdKey(),
code : this.inviteCode,
})
uni.showToast({ uni.showToast({
title: '邀请码提交成功',
title: '邀请码绑定成功',
icon: 'success' icon: 'success'
}) })
this.$store.commit('getUserInfo')
setTimeout(uni.navigateBack, 500, -1)
}, },
//
copyInviteCode() {
uni.setClipboardData({
data: this.myInviteCode,
success: () => {
uni.showToast({
title: '复制成功',
icon: 'success'
})
}
})
},
// 广
goToPromotion() {
// 广
uni.navigateTo({
url: '/pages_order/mine/promotion'
})
}
} }
} }
</script> </script>
@ -134,6 +118,8 @@ export default {
height: 80rpx; height: 80rpx;
padding: 0 20rpx; padding: 0 20rpx;
font-size: 28rpx; font-size: 28rpx;
text-align: center;
font-weight: 900;
} }
.submit-btn { .submit-btn {


+ 1
- 1
utils/getUrl.js View File

@ -1,4 +1,4 @@
let current ="trial";
let current ="develop";
const accountInfo = wx.getAccountInfoSync(); const accountInfo = wx.getAccountInfoSync();
// current = accountInfo.miniProgram.envVersion; // current = accountInfo.miniProgram.envVersion;


Loading…
Cancel
Save