This commit is contained in:
chenhao 2026-05-28 16:47:19 +08:00
parent cc8d4be07f
commit 606c3dd7a2
11 changed files with 23 additions and 67 deletions

View File

@ -32,7 +32,7 @@ export default {
},
methods: {
init() {
this.$post('/v1/client/HWxinfoClient/share', { url: location.href }).then(data => {
this.$post('/v1/client/HWxinfoClient/share', { url: encodeURIComponent(location.href) }).then(data => {
this.wechatShareInfo = data
}).finally(() => {
this.updateShare()
@ -54,7 +54,7 @@ export default {
},
updateShare(title, desc, imgUrl) {
if (wx && this.$isWechat()) {
this.$post('/v1/client/HWxinfoClient/share', { url: location.href }).then(data => {
this.$post('/v1/client/HWxinfoClient/share', { url: encodeURIComponent(location.href) }).then(data => {
let shareinfo = {
title: title || this.wechatShareInfo.ShareTitle || '泰古润',
desc: desc || this.wechatShareInfo.ShareContent || '汇聚平凡梦想,共创美好未来',

View File

@ -25,7 +25,6 @@ export default {
pageSize: { type: Number, default: 10 },
finishedText: { type: String, default: '没有更多了' },
parseData: { type: Function, default: (res) => res.data.items },
cacheKey: { type: String, default: '' },
},
data() {
return {
@ -35,8 +34,6 @@ export default {
page: 1,
requestId: 0,
observer: null,
_cacheKey: null,
_dataCache: null,
}
},
emits: ['update:list', 'load', 'refresh'],
@ -53,19 +50,6 @@ export default {
deep: true
}
},
created() {
if (this.cacheKey) {
const cached = sessionStorage.getItem(this.cacheKey)
if (cached) {
try {
const { list, page, finished, params } = JSON.parse(cached)
if (JSON.stringify(this.params) === JSON.stringify(params)) {
this._dataCache = { list, page, finished }
}
} catch (e) { }
}
}
},
mounted() {
this.$nextTick(() => {
this.observer = new IntersectionObserver((entries) => {
@ -77,27 +61,10 @@ export default {
this.observer.observe(this.$refs.sentinel)
}
})
window.addEventListener('scroll', this.onWindowScroll)
},
methods: {
onWindowScroll() {
if (this.finished || this.loading) return
const el = this.$refs.sentinel
if (!el) return
const rect = el.getBoundingClientRect()
if (rect.top < window.innerHeight) {
this.loadMore()
}
},
loadMore() {
if (this.loading) return
if (this._dataCache && this._dataCache.params && JSON.stringify(this.params) === JSON.stringify(this._dataCache.params)) {
this.list = this._dataCache.list
this.page = this._dataCache.page
this.finished = this._dataCache.finished
this.loading = false
return
}
const currentRequestId = this.requestId
this.loading = true
const request = this.method === 'get' ? this.$get : this.$post
@ -105,7 +72,6 @@ export default {
.then(res => {
if (currentRequestId !== this.requestId) return
const data = this.parseData(res)
// console.log(data);
const safeData = data || []
if (this.page === 1) {
@ -169,6 +135,7 @@ export default {
.finished-text,
.empty-text {
width: 100%;
text-align: center;
padding: 15px;
color: #969799;

View File

@ -16,6 +16,7 @@ export default {
props: [
'back', 'hideHome', 'title'
],
emits: ['updateShare'],
watch: {
title(val, old) {
if (val)

View File

@ -24,7 +24,7 @@ const routes = [
path: '/Mall',
name: 'Mall',
component: () => import('./views/Tabbars/Mall.vue'),
meta: { title: '商城', cache: true }
meta: { title: '商城' }
},
{
path: '/PointMall',

View File

@ -769,6 +769,10 @@ img {
.tradelist {
.f5;
>div {
.b_l_w;
}
&::before {
background: #f6f6f6;
}

View File

@ -174,11 +174,11 @@
<van-popup v-model:show="showArea" safe-area-inset-bottom
style=" width: 86.67vw; background-color: #fff7f7; border-radius: 2.67vw;overflow: visible;" class="area_popup"
@click.self="showArea = false">
<div class="area_box" style="position: relative;">
<div class="area_box" style="position: relative;height: 80vw;">
<img style="width:31.73vw;position: absolute;top: -16vw;z-index: 1;left: 50%;transform: translateX(-50%);"
src="/img/no.png" alt="">
<div
style="font-size: 3.73vw;color: #333333;padding:18vw 3.33vw 3.33vw;display: flex;flex-direction: column;align-items: center;justify-content:center;border-bottom: 1px solid #f5f5f5;">
style="height: 55vw;top:12vw;z-index: 2;position: absolute;overflow-y: scroll;font-size: 3.73vw;color: #333333;padding: 0 4vw 3.33vw;border-bottom: 1px solid #f5f5f5;">
<span style="">
不支持发货区域
<span style="font-size: 3.73vw;;color: #ea3e23;">
@ -188,7 +188,7 @@
</div>
<button @click="showArea = false"
style="height: 16vw;width:100%;border:none;background-color: transparent; font-size: 3.73vw;font-weight: bold;color:#333;">
style="position: absolute;bottom: 0;left: 0;height: 16vw;width:100%;border:none;background-color: transparent; font-size: 3.73vw;font-weight: bold;color:#333;">
好的知道了
</button>
</div>
@ -237,10 +237,9 @@ export default {
formattedForbidArea() {
if (!this.data.forbidbuyarea) return '暂无'
try {
//
const str = this.data.forbidbuyarea.replace(/\\"/g, '"')
const arr = JSON.parse(str)
return arr.map(s => s.split('-')[1] || s).join('、')
return arr.join('、')
} catch {
return this.data.forbidbuyarea.replace(/\\"/g, '"')
}
@ -341,7 +340,7 @@ export default {
this.$showFailToast("该规格库存不足,无法购买");
return;
}
this.$navigate(`/TradeConfirm?id=${this.data.id}&skuname=${encodeURIComponent(this.tempSku.skuname)}&buynums=${this.tempSku.Qty}`);
this.$navigate(`/TradeConfirm/?id=${this.data.id}&skuname=${encodeURIComponent(this.tempSku.skuname)}&buynums=${this.tempSku.Qty}`);
},
beforeShare() {
this.showShare = true;

View File

@ -15,6 +15,7 @@
<script>
export default {
name: 'Index',
emits: ['updateShare'],
data() {
return {
DefaultActive: 'Home',

View File

@ -139,7 +139,7 @@
<template #default="{ item }">
<van-cell clickable @click="selecting = item; active = item.id">
<template #icon>
<van-radio checked-color="#19954d" :name="item.id" />
<van-radio checked-color="#ca2904" :name="item.id" />
</template>
<template #title>
<div class="list">

View File

@ -211,15 +211,10 @@ export default {
}
},
deactivated() {
sessionStorage.setItem('mall_scroll', window.scrollY)
},
mounted() {
this.init()
},
activated() {
this.$refs.BaseList?.refresh()
this.init();
},
methods: {
init() {
Promise.all([
@ -236,10 +231,6 @@ export default {
this.$get('/v1/client/EProcatesClient/1').then(res => {
const filtered = res.data.filter(i => i.homeshowed)
this.typeData = filtered
if (filtered.length > 0) {
this.activeType = filtered[0].id
this.searchParams.pid = filtered[0].id
}
}),
]).catch(err => {
this.$showFailToast(err.message || '加载失败')
@ -253,15 +244,6 @@ export default {
onSwipeChange(index) {
this.bgcolor = this.data.Carousel[index]?.bgcolor || ''
},
onSearch() {
this.$refs.BaseList?.refresh()
},
onClear() {
this.searchParams.name = ''
this.$refs.BaseList?.refresh()
},
},
computed: {

View File

@ -32,7 +32,8 @@
</div>
<div>
<p>规格{{ product.skuname }}</p>
<p style="width: 45vw;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">规格{{
product.skuname }}</p>
<van-stepper class="r" v-model="product.buynums" :min="1" :max="999" input-width="7vw"
button-size="6vw" integer></van-stepper>
</div>
@ -120,6 +121,7 @@
<script>
export default {
name: 'TradeConfirm',
emits: ['updateShare'],
mounted() {
this.loadProduct();
this.loadUserInfo();
@ -192,7 +194,7 @@ export default {
loadProduct() {
const id = this.$route.query.id;
const skuname = decodeURIComponent(this.$route.query.skuname || '');
this.$get(`/v1/client/EProsClient/${id}`).then(res => {
this.$get(`/v1/client/EProsClient/fororder?id=${id}&skuname=${encodeURIComponent(skuname)}`).then(res => {
const data = res.data;
// SKU
let sku = null;

View File

@ -1,6 +1,6 @@
<template>
<BasePage :back="back">
<div class="tradelist">
<div class="tradelist b_l_w">
<div class="tabs">
<van-tabs class="area" v-model:active="TradeArea" color="#f00" title-active-color="#222"
title-inactive-color="#999" line-width="0" line-height=".667vw" @change="changeMall">