|
|
@@ -50,7 +50,7 @@
|
|
|
</text>
|
|
|
</u-list-item>
|
|
|
<!-- 空数据状态 -->
|
|
|
- <u-empty
|
|
|
+ <u-empty
|
|
|
v-if="filteredRecords.length === 0 && !loading"
|
|
|
text="暂无积分记录"
|
|
|
mode="list"
|
|
|
@@ -60,7 +60,7 @@
|
|
|
<u-loading-icon text="加载中..."></u-loading-icon>
|
|
|
</view>
|
|
|
<!-- 加载更多 -->
|
|
|
- <u-loadmore
|
|
|
+ <u-loadmore
|
|
|
v-if="filteredRecords.length > 0"
|
|
|
:status="loading ? 'loading' : (hasMore ? 'more' : 'nomore')"
|
|
|
loading-text="加载中..."
|
|
|
@@ -75,7 +75,9 @@
|
|
|
|
|
|
<script>
|
|
|
import {mapState} from "vuex";
|
|
|
-import { getPointDetails } from '@/api/points'
|
|
|
+import { getPointDetails } from '@/api/points';
|
|
|
+import {queryBind, useBind, uuidLogin} from "@/api/index";
|
|
|
+
|
|
|
export default {
|
|
|
name: "billPage",
|
|
|
data() {
|
|
|
@@ -94,7 +96,11 @@ export default {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
hasMore: true,
|
|
|
- loading: false
|
|
|
+ loading: false,
|
|
|
+ currentUser:'',
|
|
|
+ currentPlatform:'',
|
|
|
+ nowPlatform:'gyy-aB4cD6eF8gH0iJ2kL4',
|
|
|
+ uuId:'',
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -118,9 +124,26 @@ export default {
|
|
|
return this.pointRecords
|
|
|
}
|
|
|
},
|
|
|
+ onLoad(options) {
|
|
|
+ // #ifdef H5
|
|
|
+ window.addEventListener('popstate', this.__h5BackRefresh);
|
|
|
+ // #endif
|
|
|
+ if(options.currentPlatform && options.currentUser){
|
|
|
+ this.currentPlatform = options.currentPlatform;
|
|
|
+ this.currentUser = options.currentUser;
|
|
|
+ this.verificationAccount();
|
|
|
+ }else{
|
|
|
+ this.fetchPointDetails()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onUnload() {
|
|
|
+ // #ifdef H5
|
|
|
+ window.removeEventListener('popstate', this.__h5BackRefresh);
|
|
|
+ // #endif
|
|
|
+ },
|
|
|
mounted() {
|
|
|
// 初始获取数据
|
|
|
- this.fetchPointDetails()
|
|
|
+ //this.fetchPointDetails()
|
|
|
},
|
|
|
methods: {
|
|
|
// 切换标签
|
|
|
@@ -166,6 +189,61 @@ export default {
|
|
|
} finally {
|
|
|
this.loading = false
|
|
|
}
|
|
|
+ },
|
|
|
+ // H5 返回强制刷新
|
|
|
+ __h5BackRefresh() {
|
|
|
+ if(this.currentPlatform && this.currentUser && uni.getStorageSync('access-token')){
|
|
|
+ this.bindAccount();//若没有登录。登录后获取绑定信息
|
|
|
+ }
|
|
|
+ },
|
|
|
+ verificationAccount(){
|
|
|
+ // jzg-7kP9xL2mN5vQ8zR1jW ,晋掌柜
|
|
|
+ // gyy-aB4cD6eF8gH0iJ2kL4 ,广誉源
|
|
|
+ // bdsh-X9yZ1wV3uT5sR7qP9o ,本地生活
|
|
|
+ // https://test.baoxianzhanggui.com/lxl-api/usercenter
|
|
|
+ // 用户ID userId
|
|
|
+ // 平台ID clientId
|
|
|
+ // 租户ID (晋掌柜用) tenantId
|
|
|
+ // source 自己的平台,,,
|
|
|
+ // target 要绑的平台
|
|
|
+ queryBind({
|
|
|
+ userId : this.currentUser,
|
|
|
+ clientId :this.currentPlatform
|
|
|
+ }).then(res => {
|
|
|
+ if(res.data.code == 200){
|
|
|
+ this.uuId = res.data.data.filter(item=> item.clientId === 'gyy-aB4cD6eF8gH0iJ2kL4')[0].uuid;
|
|
|
+ if(!uni.getStorageSync('access-token')){
|
|
|
+ this.uuLogin();
|
|
|
+ }else{
|
|
|
+ this.fetchPointDetails()
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if (!this.$utils.checkLogin({ type: 'navigate' })) return;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ bindAccount(){
|
|
|
+ useBind({
|
|
|
+ sourceUserId: this.currentUser, //a项目的id
|
|
|
+ sourceClientId: this.currentPlatform, //a项目的来源平台
|
|
|
+ targetUserId: uni.getStorageSync('userId'), //b项目的id
|
|
|
+ targetClientId: this.nowPlatform, //b项目的来源平台
|
|
|
+ userPhone:uni.getStorageSync('wx_phone')
|
|
|
+ }).then(res => {
|
|
|
+ this.fetchPointDetails()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ uuLogin(){
|
|
|
+ // 广誉源uuid登录
|
|
|
+ uuidLogin({
|
|
|
+ uuid: this.uuId,
|
|
|
+ }).then(res => {
|
|
|
+ uni.setStorageSync('wx_copenid', res.data.data.copenid || '')
|
|
|
+ uni.setStorageSync('access-token', res.data.data.token)
|
|
|
+ uni.setStorageSync('wx_phone', res.data.data.cphone)
|
|
|
+ uni.setStorageSync('userId', res.data.data.id)
|
|
|
+ this.fetchPointDetails()
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -259,10 +337,10 @@ export default {
|
|
|
.u-empty{
|
|
|
margin-top: 20vh!important;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/* 加载中容器 */
|
|
|
.loading-container {
|
|
|
margin-top: 20vh!important;
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|