1
This commit is contained in:
parent
cc8d4be07f
commit
606c3dd7a2
@ -32,7 +32,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
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
|
this.wechatShareInfo = data
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.updateShare()
|
this.updateShare()
|
||||||
@ -54,7 +54,7 @@ export default {
|
|||||||
},
|
},
|
||||||
updateShare(title, desc, imgUrl) {
|
updateShare(title, desc, imgUrl) {
|
||||||
if (wx && this.$isWechat()) {
|
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 = {
|
let shareinfo = {
|
||||||
title: title || this.wechatShareInfo.ShareTitle || '泰古润',
|
title: title || this.wechatShareInfo.ShareTitle || '泰古润',
|
||||||
desc: desc || this.wechatShareInfo.ShareContent || '汇聚平凡梦想,共创美好未来',
|
desc: desc || this.wechatShareInfo.ShareContent || '汇聚平凡梦想,共创美好未来',
|
||||||
|
|||||||
@ -25,7 +25,6 @@ export default {
|
|||||||
pageSize: { type: Number, default: 10 },
|
pageSize: { type: Number, default: 10 },
|
||||||
finishedText: { type: String, default: '没有更多了' },
|
finishedText: { type: String, default: '没有更多了' },
|
||||||
parseData: { type: Function, default: (res) => res.data.items },
|
parseData: { type: Function, default: (res) => res.data.items },
|
||||||
cacheKey: { type: String, default: '' },
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -35,8 +34,6 @@ export default {
|
|||||||
page: 1,
|
page: 1,
|
||||||
requestId: 0,
|
requestId: 0,
|
||||||
observer: null,
|
observer: null,
|
||||||
_cacheKey: null,
|
|
||||||
_dataCache: null,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
emits: ['update:list', 'load', 'refresh'],
|
emits: ['update:list', 'load', 'refresh'],
|
||||||
@ -53,19 +50,6 @@ export default {
|
|||||||
deep: true
|
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() {
|
mounted() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.observer = new IntersectionObserver((entries) => {
|
this.observer = new IntersectionObserver((entries) => {
|
||||||
@ -77,27 +61,10 @@ export default {
|
|||||||
this.observer.observe(this.$refs.sentinel)
|
this.observer.observe(this.$refs.sentinel)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
window.addEventListener('scroll', this.onWindowScroll)
|
|
||||||
},
|
},
|
||||||
methods: {
|
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() {
|
loadMore() {
|
||||||
if (this.loading) return
|
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
|
const currentRequestId = this.requestId
|
||||||
this.loading = true
|
this.loading = true
|
||||||
const request = this.method === 'get' ? this.$get : this.$post
|
const request = this.method === 'get' ? this.$get : this.$post
|
||||||
@ -105,7 +72,6 @@ export default {
|
|||||||
.then(res => {
|
.then(res => {
|
||||||
if (currentRequestId !== this.requestId) return
|
if (currentRequestId !== this.requestId) return
|
||||||
const data = this.parseData(res)
|
const data = this.parseData(res)
|
||||||
// console.log(data);
|
|
||||||
const safeData = data || []
|
const safeData = data || []
|
||||||
|
|
||||||
if (this.page === 1) {
|
if (this.page === 1) {
|
||||||
@ -169,6 +135,7 @@ export default {
|
|||||||
|
|
||||||
.finished-text,
|
.finished-text,
|
||||||
.empty-text {
|
.empty-text {
|
||||||
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
color: #969799;
|
color: #969799;
|
||||||
|
|||||||
@ -16,6 +16,7 @@ export default {
|
|||||||
props: [
|
props: [
|
||||||
'back', 'hideHome', 'title'
|
'back', 'hideHome', 'title'
|
||||||
],
|
],
|
||||||
|
emits: ['updateShare'],
|
||||||
watch: {
|
watch: {
|
||||||
title(val, old) {
|
title(val, old) {
|
||||||
if (val)
|
if (val)
|
||||||
|
|||||||
@ -24,7 +24,7 @@ const routes = [
|
|||||||
path: '/Mall',
|
path: '/Mall',
|
||||||
name: 'Mall',
|
name: 'Mall',
|
||||||
component: () => import('./views/Tabbars/Mall.vue'),
|
component: () => import('./views/Tabbars/Mall.vue'),
|
||||||
meta: { title: '商城', cache: true }
|
meta: { title: '商城' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/PointMall',
|
path: '/PointMall',
|
||||||
|
|||||||
@ -769,6 +769,10 @@ img {
|
|||||||
.tradelist {
|
.tradelist {
|
||||||
.f5;
|
.f5;
|
||||||
|
|
||||||
|
>div {
|
||||||
|
.b_l_w;
|
||||||
|
}
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
background: #f6f6f6;
|
background: #f6f6f6;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -174,11 +174,11 @@
|
|||||||
<van-popup v-model:show="showArea" safe-area-inset-bottom
|
<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"
|
style=" width: 86.67vw; background-color: #fff7f7; border-radius: 2.67vw;overflow: visible;" class="area_popup"
|
||||||
@click.self="showArea = false">
|
@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%);"
|
<img style="width:31.73vw;position: absolute;top: -16vw;z-index: 1;left: 50%;transform: translateX(-50%);"
|
||||||
src="/img/no.png" alt="">
|
src="/img/no.png" alt="">
|
||||||
<div
|
<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="">
|
||||||
不支持发货区域:
|
不支持发货区域:
|
||||||
<span style="font-size: 3.73vw;;color: #ea3e23;">
|
<span style="font-size: 3.73vw;;color: #ea3e23;">
|
||||||
@ -188,7 +188,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<button @click="showArea = false"
|
<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>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -237,10 +237,9 @@ export default {
|
|||||||
formattedForbidArea() {
|
formattedForbidArea() {
|
||||||
if (!this.data.forbidbuyarea) return '暂无'
|
if (!this.data.forbidbuyarea) return '暂无'
|
||||||
try {
|
try {
|
||||||
// 去掉转义的反斜杠
|
|
||||||
const str = this.data.forbidbuyarea.replace(/\\"/g, '"')
|
const str = this.data.forbidbuyarea.replace(/\\"/g, '"')
|
||||||
const arr = JSON.parse(str)
|
const arr = JSON.parse(str)
|
||||||
return arr.map(s => s.split('-')[1] || s).join('、')
|
return arr.join('、')
|
||||||
} catch {
|
} catch {
|
||||||
return this.data.forbidbuyarea.replace(/\\"/g, '"')
|
return this.data.forbidbuyarea.replace(/\\"/g, '"')
|
||||||
}
|
}
|
||||||
@ -341,7 +340,7 @@ export default {
|
|||||||
this.$showFailToast("该规格库存不足,无法购买");
|
this.$showFailToast("该规格库存不足,无法购买");
|
||||||
return;
|
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() {
|
beforeShare() {
|
||||||
this.showShare = true;
|
this.showShare = true;
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'Index',
|
name: 'Index',
|
||||||
|
emits: ['updateShare'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
DefaultActive: 'Home',
|
DefaultActive: 'Home',
|
||||||
|
|||||||
@ -139,7 +139,7 @@
|
|||||||
<template #default="{ item }">
|
<template #default="{ item }">
|
||||||
<van-cell clickable @click="selecting = item; active = item.id">
|
<van-cell clickable @click="selecting = item; active = item.id">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<van-radio checked-color="#19954d" :name="item.id" />
|
<van-radio checked-color="#ca2904" :name="item.id" />
|
||||||
</template>
|
</template>
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="list">
|
<div class="list">
|
||||||
|
|||||||
@ -211,15 +211,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
deactivated() {
|
|
||||||
sessionStorage.setItem('mall_scroll', window.scrollY)
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.init()
|
this.init();
|
||||||
},
|
|
||||||
activated() {
|
|
||||||
this.$refs.BaseList?.refresh()
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
Promise.all([
|
Promise.all([
|
||||||
@ -236,10 +231,6 @@ export default {
|
|||||||
this.$get('/v1/client/EProcatesClient/1').then(res => {
|
this.$get('/v1/client/EProcatesClient/1').then(res => {
|
||||||
const filtered = res.data.filter(i => i.homeshowed)
|
const filtered = res.data.filter(i => i.homeshowed)
|
||||||
this.typeData = filtered
|
this.typeData = filtered
|
||||||
if (filtered.length > 0) {
|
|
||||||
this.activeType = filtered[0].id
|
|
||||||
this.searchParams.pid = filtered[0].id
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
]).catch(err => {
|
]).catch(err => {
|
||||||
this.$showFailToast(err.message || '加载失败')
|
this.$showFailToast(err.message || '加载失败')
|
||||||
@ -253,15 +244,6 @@ export default {
|
|||||||
onSwipeChange(index) {
|
onSwipeChange(index) {
|
||||||
this.bgcolor = this.data.Carousel[index]?.bgcolor || ''
|
this.bgcolor = this.data.Carousel[index]?.bgcolor || ''
|
||||||
},
|
},
|
||||||
|
|
||||||
onSearch() {
|
|
||||||
this.$refs.BaseList?.refresh()
|
|
||||||
},
|
|
||||||
|
|
||||||
onClear() {
|
|
||||||
this.searchParams.name = ''
|
|
||||||
this.$refs.BaseList?.refresh()
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
|||||||
@ -32,7 +32,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<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"
|
<van-stepper class="r" v-model="product.buynums" :min="1" :max="999" input-width="7vw"
|
||||||
button-size="6vw" integer></van-stepper>
|
button-size="6vw" integer></van-stepper>
|
||||||
</div>
|
</div>
|
||||||
@ -120,6 +121,7 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'TradeConfirm',
|
name: 'TradeConfirm',
|
||||||
|
emits: ['updateShare'],
|
||||||
mounted() {
|
mounted() {
|
||||||
this.loadProduct();
|
this.loadProduct();
|
||||||
this.loadUserInfo();
|
this.loadUserInfo();
|
||||||
@ -192,7 +194,7 @@ export default {
|
|||||||
loadProduct() {
|
loadProduct() {
|
||||||
const id = this.$route.query.id;
|
const id = this.$route.query.id;
|
||||||
const skuname = decodeURIComponent(this.$route.query.skuname || '');
|
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;
|
const data = res.data;
|
||||||
// 从规格组合中找到匹配的SKU
|
// 从规格组合中找到匹配的SKU
|
||||||
let sku = null;
|
let sku = null;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<BasePage :back="back">
|
<BasePage :back="back">
|
||||||
<div class="tradelist">
|
<div class="tradelist b_l_w">
|
||||||
<div class="tabs">
|
<div class="tabs">
|
||||||
<van-tabs class="area" v-model:active="TradeArea" color="#f00" title-active-color="#222"
|
<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">
|
title-inactive-color="#999" line-width="0" line-height=".667vw" @change="changeMall">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user