This commit is contained in:
weipengfei 2024-04-03 17:37:49 +08:00
commit da374881c5
3 changed files with 57 additions and 45 deletions

View File

@ -6,7 +6,7 @@
<image class="image" :src='routine_logo' mode="aspectFit"></image> <image class="image" :src='routine_logo' mode="aspectFit"></image>
</view> --> </view> -->
<!--#ifdef H5--> <!--#ifdef H5-->
<text v-if="isWeixin" class='title'>{{isPay?'提醒':'授权提醒'}}</text> <text v-if="isWeixin" class='title'>{{isPay?'付提醒':'授权提醒'}}</text>
<text v-else class='title'>{{title}}</text> <text v-else class='title'>{{title}}</text>
<!--#endif--> <!--#endif-->
<!--#ifdef APP-PLUS--> <!--#ifdef APP-PLUS-->
@ -31,7 +31,7 @@
<!-- #ifdef MP --> <!-- #ifdef MP -->
<button class="item grant" hover-class="none" @tap="getUserProfile"><text <button class="item grant" hover-class="none" @tap="getUserProfile"><text
class="text">去授权</text></button> class="text">去授权</text></button>
<!-- #endif --> <!-- #endif -->
<!-- #ifdef APP-PLUS --> <!-- #ifdef APP-PLUS -->
<button class="item grant" @tap="toWecahtAuth"> <button class="item grant" @tap="toWecahtAuth">
<text class="text">去登录</text> <text class="text">去登录</text>
@ -39,7 +39,7 @@
<!-- #endif --> <!-- #endif -->
<!-- #ifdef H5 --> <!-- #ifdef H5 -->
<button class="item grant" @tap="toWecahtAuth"> <button class="item grant" @tap="toWecahtAuth">
<text v-if="isWeixin" class="text">{{isPay?'去支付':'去授权'}}</text> <text v-if="isWeixin" class="text">{{isPay?'确认':'去授权'}}</text>
<text v-else class="text">去登录</text> <text v-else class="text">去登录</text>
</button> </button>
<!-- #endif --> <!-- #endif -->
@ -91,10 +91,10 @@
type: Boolean, type: Boolean,
default: false default: false
}, },
isPay:{ isPay: {
type: Boolean, type: Boolean,
default: false default: false
}, },
}, },
components: { components: {
// #ifdef MP // #ifdef MP
@ -107,13 +107,13 @@
info: '请登录,将为您提供更好的服务!', info: '请登录,将为您提供更好的服务!',
//#ifdef H5 //#ifdef H5
isWeixin: this.$wechat.isWeixin(), isWeixin: this.$wechat.isWeixin(),
// isWeixin: false, // // isWeixin: false, //
//#endif //#endif
//#ifdef MP //#ifdef MP
title: '授权提醒', title: '授权提醒',
info: '请授权头像等信息,以便为您提供更好的服务!', info: '请授权头像等信息,以便为您提供更好的服务!',
//#endif //#endif
payInfo: '', payInfo: '',
canUseGetUserProfile: false, canUseGetUserProfile: false,
code: null, code: null,
top: 0, top: 0,
@ -152,9 +152,9 @@
this.editModal = false this.editModal = false
}, },
// #endif // #endif
setPayInfo(e){ setPayInfo(e) {
this.payInfo = e; this.payInfo = e;
}, },
setAuthStatus() { setAuthStatus() {
//#ifdef MP //#ifdef MP
Routine.authorize().then(res => { Routine.authorize().then(res => {
@ -194,12 +194,12 @@
}, },
toWecahtAuth() { toWecahtAuth() {
toLogin(true); toLogin(true);
this.$emit('authColse', false); this.$emit('authColse', false);
}, },
getUserProfile() { getUserProfile() {
// console.log(11); // console.log(11);
toLogin(true); toLogin(true);
this.$emit('authColse', false); this.$emit('authColse', false);
uni.navigateTo({ uni.navigateTo({
url: '/pages/users/login/login_copy' url: '/pages/users/login/login_copy'
}) })
@ -327,7 +327,7 @@
} }
.Popup .bottom .item { .Popup .bottom .item {
flex: 1; flex: 1;
width: 250rpx; width: 250rpx;
height: 80rpx; height: 80rpx;
background-color: #eeeeee; background-color: #eeeeee;

View File

@ -93,7 +93,8 @@
</recommend> </recommend>
<view class="loadingicon acea-row row-center-wrapper" <view class="loadingicon acea-row row-center-wrapper"
v-if="hostProduct[hostIndex].length > 0 || hotLoading[hostIndex]"> v-if="hostProduct[hostIndex].length > 0 || hotLoading[hostIndex]">
<text class="loading iconfont icon-jiazai" :hidden="hotLoading[hostIndex] == false"></text> <text class="loading iconfont icon-jiazai"
:hidden="hotLoading[hostIndex] == false"></text>
{{ hotTitle }} {{ hotTitle }}
</view> </view>
</view> </view>
@ -372,7 +373,9 @@
import { import {
HTTP_REQUEST_URL HTTP_REQUEST_URL
} from '@/config/app'; } from '@/config/app';
import {showTab} from "@/utils/showTab.js"; import {
showTab
} from "@/utils/showTab.js";
export default { export default {
computed: configMap({ computed: configMap({
hide_mer_status: 0, hide_mer_status: 0,
@ -461,8 +464,13 @@
limit: 6 limit: 6
}, },
is_switch: true, is_switch: true,
hostProduct: [[],[],[],[]], hostProduct: [
hostIndex: 0, [],
[],
[],
[]
],
hostIndex: 0,
hotPage: 1, hotPage: 1,
hotLimit: 20, hotLimit: 20,
hotScroll: true, hotScroll: true,
@ -559,7 +567,7 @@
}); });
}) })
that.pageLoad(options); that.pageLoad(options);
this.$store.dispatch('INIT_CONFIG'); this.$store.dispatch('INIT_CONFIG');
}, },
created(options) { created(options) {
let routes = getCurrentPages(); // let routes = getCurrentPages(); //
@ -583,9 +591,9 @@
that.isScrolled = res[0].top <= -60 that.isScrolled = res[0].top <= -60
}) })
}) })
if (this.isLogin) { if (this.isLogin) {
this.getUserInfo(); this.getUserInfo();
} }
}, },
onHide() { onHide() {
uni.setStorageSync('isIntegral', false) uni.setStorageSync('isIntegral', false)
@ -680,7 +688,7 @@
success: res => { success: res => {
this.errorNetwork = res.networkType === 'none'; this.errorNetwork = res.networkType === 'none';
if (!this.errorNetwork) { if (!this.errorNetwork) {
this.pageLoad(this._options); this.pageLoad(this._options);
} else { } else {
// uni.stopPullDownRefresh(); // uni.stopPullDownRefresh();
that.overflow = false; that.overflow = false;
@ -946,9 +954,9 @@
getUserInfo: function() { getUserInfo: function() {
let that = this; let that = this;
getUserInfo().then(res => { getUserInfo().then(res => {
showTab(res.data); showTab(res.data);
that.userInfo = res.data; that.userInfo = res.data;
this.$store.commit('SET_USERINFO', res.data); this.$store.commit('SET_USERINFO', res.data);
}); });
}, },
// 访 // 访
@ -1012,9 +1020,9 @@
changeRecommedTab(e) { changeRecommedTab(e) {
this.hotPage = 1; this.hotPage = 1;
this.hotScroll = true; this.hotScroll = true;
this.hostIndex = e-1; this.hostIndex = e - 1;
let hostList = this.hostProduct; let hostList = this.hostProduct;
hostList[e-1] = []; hostList[e - 1] = [];
this.$set(this, 'hostProduct', hostList); this.$set(this, 'hostProduct', hostList);
this.loadGoods(e); this.loadGoods(e);
}, },
@ -1033,7 +1041,7 @@
/** /**
* 获取我的推荐 * 获取我的推荐
*/ */
get_host_product: function(e=0) { get_host_product: function(e = 0) {
let that = this; let that = this;
let num = that.hotLimit; let num = that.hotLimit;
if (!that.hotScroll) return; if (!that.hotScroll) return;
@ -1043,22 +1051,24 @@
getProductHot(that.hotPage, that.hotLimit, 1, 1).then(res => { getProductHot(that.hotPage, that.hotLimit, 1, 1).then(res => {
let list = res.data.list; let list = res.data.list;
let productList = that.hostProduct; let productList = that.hostProduct;
if(!productList[e]) productList[e] = []; if (!productList[e]) productList[e] = [];
productList[e] = [...productList[e], ...res.data.list]; productList[e] = [...productList[e], ...res.data.list];
let hotScroll = list.length <= num && list.length != 0; let hotScroll = list.length <= res.data.limit && list.length != 0;
that.hotScroll = hotScroll; that.hotScroll = hotScroll;
that.hotLoading[e] = false; that.hotLoading[e] = false;
that.hotTitle = !hotScroll ? '已全部加载' : '加载更多'; that.hotTitle = !hotScroll ? '已全部加载' : '加载更多';
that.$set(that, 'hostProduct', productList); that.$set(that, 'hostProduct', productList);
if(this.hostIndex==e) this.$forceUpdate(); if (this.hostIndex == e) this.$forceUpdate();
that.$set(that, 'hotPage', that.hotPage + 1);
that.$set(that, 'hotPage', res.data.page + 1);
that.$set(that, 'hotLimit', res.data.limit);
}); });
}, },
/** /**
* 获取里海云仓, 云市场, 名优特产 * 获取里海云仓, 云市场, 名优特产
*/ */
get_host_home: function(query = {}, e=1) { get_host_home: function(query = {}, e = 1) {
let that = this; let that = this;
let num = that.hotLimit; let num = that.hotLimit;
if (!that.hotScroll) return; if (!that.hotScroll) return;
@ -1067,22 +1077,23 @@
that.hotTitle = '加载中'; that.hotTitle = '加载中';
query.page = that.hotPage; query.page = that.hotPage;
query.limit = that.hotLimit; query.limit = that.hotLimit;
query.sale_type = 1; query.sale_type = 1;
query.rand = 1; query.rand = 1;
getProductslist({ getProductslist({
...query ...query
}).then(res => { }).then(res => {
let list = res.data.list; let list = res.data.list;
let productList = that.hostProduct; let productList = that.hostProduct;
if(!productList[e]) productList[e] = []; if (!productList[e]) productList[e] = [];
productList[e] = [...productList[e], ...list]; productList[e] = [...productList[e], ...list];
let hotScroll = list.length <= num && list.length != 0; let hotScroll = list.length <= res.data.limit && list.length != 0;
that.hotScroll = hotScroll; that.hotScroll = hotScroll;
that.hotLoading[e] = false; that.hotLoading[e] = false;
that.hotTitle = !hotScroll ? '已全部加载' : '加载更多'; that.hotTitle = !hotScroll ? '已全部加载' : '加载更多';
that.$set(that, 'hostProduct', productList); that.$set(that, 'hostProduct', productList);
if(this.hostIndex==e) this.$forceUpdate(); if (this.hostIndex == e) this.$forceUpdate();
that.$set(that, 'hotPage', that.hotPage + 1); that.$set(that, 'hotPage', res.data.page + 1);
that.$set(that, 'hotLimit', res.data.limit);
}); });
}, },

View File

@ -56,7 +56,8 @@
</view> </view>
<!-- 登陆 --> <!-- 登陆 -->
<authorize :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun" /> <authorize :isAuto="isAuto" :is-pay="true" :isShowAuth="isShowAuth" @authColse="authColse"
@onLoadFun="onLoadFun" />
</view> </view>
<!-- 无商户信息提示 --> <!-- 无商户信息提示 -->