Merge branch 'dev' of https://gitea.lihaink.cn/weipengfei/purchase-let
This commit is contained in:
commit
2a1e112e57
|
@ -21,19 +21,17 @@
|
|||
<view class="content">
|
||||
<up-navbar placeholder style="z-index: 10080;">
|
||||
<template #left>
|
||||
|
||||
<view class="store-info">
|
||||
<view style="display: flex;font-size: 30rpx;font-weight: bold;">
|
||||
<text v-if="userStore.userInfo.user_ship==1"
|
||||
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{(shareInfo.real_name||userStore.userInfo.nickname + '的供销个人门店' )}}</text>
|
||||
<text v-if="userStore.userInfo.user_ship==1 || shareInfo.store_id"
|
||||
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{(shareInfo.real_name||userStore.userInfo.nickname) + '的供销个人门店' }}</text>
|
||||
<text v-else
|
||||
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{shareInfo.real_name?(shareInfo.real_name + '的' + STORE_INFO.name):STORE_INFO.store_name}}</text>
|
||||
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{STORE_INFO.store_name}}</text>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</up-navbar>
|
||||
|
||||
<view class="share-btn" :style="{height:btns.height + 'px',top:btns.top + 'px',left:(btns.left - 40) + 'px'}">
|
||||
<up-button icon="share-square" openType="share" plain size="large" loadingSize="100" />
|
||||
</view>
|
||||
|
@ -191,7 +189,6 @@
|
|||
onLoad,
|
||||
onShow,
|
||||
onShareAppMessage,
|
||||
onShareTimeline
|
||||
} from "@dcloudio/uni-app"
|
||||
import {
|
||||
reactive,
|
||||
|
@ -209,7 +206,8 @@
|
|||
} from "@/api/cart.js";
|
||||
import {
|
||||
productLogApi,
|
||||
userInfoApi
|
||||
userInfoApi,
|
||||
getStoreInfo
|
||||
} from "@/api/user.js";
|
||||
import viewPopup from "@/components/viewPopup.vue"
|
||||
import goodPopup from "@/components/goodPopup.vue"
|
||||
|
@ -223,32 +221,37 @@
|
|||
|
||||
import useUserStore from "@/store/user";
|
||||
const userStore = useUserStore();
|
||||
|
||||
const STORE_INFO = ref({
|
||||
name: '',
|
||||
const STORE_INFO = reactive({
|
||||
id: 5,
|
||||
detailed_address: '',
|
||||
image: ''
|
||||
});
|
||||
store_name: "测试"
|
||||
})
|
||||
|
||||
const test = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pageQuota/quotation/index'
|
||||
const getStoreInfoFn = () => {
|
||||
if (uni.getStorageSync('STORE_INFO').length) {
|
||||
let data = JSON.parse(uni.getStorageSync('STORE_INFO'))
|
||||
for (let key in data) {
|
||||
STORE_INFO[key] = data[key]
|
||||
}
|
||||
} else {
|
||||
getStoreInfo().then(res => {
|
||||
uni.setStorageSync("STORE_INFO", JSON.stringify(res.data))
|
||||
})
|
||||
}
|
||||
}
|
||||
getStoreInfoFn()
|
||||
|
||||
|
||||
// 分享给好友
|
||||
onShareAppMessage(() => {
|
||||
let shareStr = '?id=' + STORE_INFO.value.id;
|
||||
let shareStr = '?id=' + STORE_INFO.id;
|
||||
if (userStore.userInfo.user_ship == 1) {
|
||||
shareStr = shareStr + '&spread_uid=' + userStore.userInfo.id + '&real_name=' + (userStore.userInfo
|
||||
.real_name || userStore.userInfo.nickname)
|
||||
}
|
||||
|
||||
let shareInfo = {
|
||||
title: STORE_INFO.value.name,
|
||||
title: userStore.userInfo.nickname,
|
||||
path: '/pages/index/index' + shareStr,
|
||||
imageUrl: STORE_INFO.value.image,
|
||||
imageUrl: STORE_INFO.image || '',
|
||||
success() {
|
||||
uni.$u.toast('分享成功');
|
||||
},
|
||||
|
@ -259,8 +262,6 @@
|
|||
return shareInfo;
|
||||
})
|
||||
|
||||
|
||||
|
||||
/*商品列表滚动隐藏头部导航 */
|
||||
const instance = getCurrentInstance(); // 获取组件实例
|
||||
const targetHeight = ref(0)
|
||||
|
@ -309,7 +310,7 @@
|
|||
cart_num: cart_num,
|
||||
is_new: 0, // 是否直接购买0否1是
|
||||
// goods_id: id,
|
||||
store_id: STORE_INFO.value.id || 5,
|
||||
store_id: STORE_INFO.id,
|
||||
product_id: product_id
|
||||
}).then(res => {
|
||||
getCartList();
|
||||
|
@ -337,7 +338,7 @@
|
|||
name: '',
|
||||
order: '',
|
||||
store_name: '',
|
||||
store_id: STORE_INFO.value.id || '5'
|
||||
store_id: STORE_INFO.id
|
||||
})
|
||||
|
||||
const loading = ref(true);
|
||||
|
@ -362,16 +363,15 @@
|
|||
if (loadmore) goodList.value.push(...res.data.lists);
|
||||
else goodList.value = res.data.lists;
|
||||
// 补充店铺信息
|
||||
if (!STORE_INFO.value.name || !STORE_INFO.value.detailed_address) {
|
||||
STORE_INFO.value.name = res.data.store.name;
|
||||
STORE_INFO.value.detailed_address = res.data.store.detailed_address;
|
||||
}
|
||||
// if (!STORE_INFO.store_name || !STORE_INFO.detailed_address) {
|
||||
// STORE_INFO.store_name = res.data.store.name;
|
||||
// STORE_INFO.value.detailed_address = res.data.store.detailed_address;
|
||||
// }
|
||||
})
|
||||
}
|
||||
|
||||
// 商品列表触底
|
||||
const loadMoreGood = () => {
|
||||
console.log('触底了');
|
||||
getGoodList(true);
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@
|
|||
page_no: page_no,
|
||||
page_size: 30,
|
||||
level: three,
|
||||
store_id: STORE_INFO.value.id || '5' // 店铺id,用于获取店铺分类列表,如果为空则获取全部分类列表,否则获取店铺分类列表。
|
||||
store_id: STORE_INFO.id // 店铺id,用于获取店铺分类列表,如果为空则获取全部分类列表,否则获取店铺分类列表。
|
||||
}).then(res => {
|
||||
if (pid == 0) { // 加载一级分类时设置全部分类
|
||||
if (!res.data?.lists?.length) return;
|
||||
|
@ -494,7 +494,7 @@
|
|||
productLogApi({
|
||||
product_id: item.product_id,
|
||||
cate_id: item.cate_id,
|
||||
store_id: STORE_INFO.value.id || '5'
|
||||
store_id: STORE_INFO.id
|
||||
});
|
||||
};
|
||||
const changeGood = (data) => { // 确定选择商品重量
|
||||
|
@ -550,6 +550,7 @@
|
|||
left: 0
|
||||
});
|
||||
|
||||
|
||||
// 分享信息
|
||||
const shareInfo = ref({
|
||||
uid: '',
|
||||
|
@ -558,46 +559,23 @@
|
|||
});
|
||||
|
||||
onLoad(async (opt) => {
|
||||
where.value.store_id = opt.id || STORE_INFO.id;
|
||||
// 店铺id
|
||||
if (opt.id) {
|
||||
where.value.store_id = 5;
|
||||
where.value.store_id = opt.id;
|
||||
const info = await shopDetailApi({
|
||||
store_id: 5
|
||||
store_id: opt.id
|
||||
});
|
||||
|
||||
STORE_INFO.value = info.data;
|
||||
uni.setStorageSync('STORE_INFO', JSON.stringify(info.data));
|
||||
|
||||
// 分享参数至当前用户参数
|
||||
if (opt.spread_uid) {
|
||||
shareInfo.value.uid = opt.spread_uid;
|
||||
shareInfo.value.real_name = opt.real_name;
|
||||
shareInfo.value.store_id = opt.id;
|
||||
console.log(shareInfo.value);
|
||||
uni.setStorageSync('SHARE_INFO', shareInfo.value);
|
||||
} else {
|
||||
// 分享信息
|
||||
const i = uni.getStorageSync('SHARE_INFO');
|
||||
if (i)
|
||||
shareInfo.value = i;
|
||||
}
|
||||
} else {
|
||||
// 店铺信息
|
||||
const info = uni.getStorageSync('STORE_INFO');
|
||||
if (info) {
|
||||
STORE_INFO.value = JSON.parse(info);
|
||||
where.value.store_id = 5;
|
||||
}
|
||||
|
||||
// 分享信息
|
||||
const i = uni.getStorageSync('SHARE_INFO');
|
||||
if (i)
|
||||
shareInfo.value = i;
|
||||
}
|
||||
|
||||
getgoodClassList(0);
|
||||
getGoodList();
|
||||
|
||||
// 胶囊布局信息
|
||||
btns.value = uni.getMenuButtonBoundingClientRect();
|
||||
})
|
||||
|
|
|
@ -177,8 +177,8 @@
|
|||
const logout = () => {
|
||||
userStore.setToken('');
|
||||
userStore.setUserInfo({});
|
||||
uni.removeStorageSync('SHARE_INFO');
|
||||
uni.setStorageSync("STORE_INFO", '')
|
||||
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue