This commit is contained in:
chenhao 2026-05-25 16:13:10 +08:00
parent 7381a330b2
commit 1585a8c74b
3 changed files with 44 additions and 138 deletions

View File

@ -1,123 +0,0 @@
<template>
<div class="agriculture">
<div class="top">
<van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
<van-swipe-item>
<img style="width: 100%;" src="/img/agri_bg.png" alt="">
</van-swipe-item>
</van-swipe>
<div class="search">
<img src="/img/search-w.png" alt="">
<input type="text" placeholder="搜索您想要的产品">
</div>
</div>
<div class="tabs">
<van-tabs style="max-width: 90%;" line-height="0" v-model:active="active" :ellipsis="false"
title-active-color="#13774d" title-inactive-color="#4e4e4e">
<van-tab title="新品" name=""></van-tab>
<van-tab v-for="i in tabs" :name="i.id" :title="i.name"></van-tab>
</van-tabs>
<img @click="showLeft = true" class="r" style="width: 5.4vw;" src="/img/filter.png" alt="">
</div>
<BaseList url="/v1/client/EProsClient" class="goods_list" :params="{ mallstate: 2, pid: active }">
<template #default="{ item }">
<div class="goods_item" :key="item.id" @click="toDetail(item.id)">
<img :src="$file(item.img)" alt="">
<div>
<span class="title">{{ item.name }}</span>
<p>¥{{ item.originalprice }}</p>
<div class="money">
<div>
<span>¥
<b>{{ item.saleprice }}</b>.00
</span>
</div>
<img class="r" style="width: 5.6vw;" src="/img/cart.png" alt="">
</div>
</div>
</div>
</template>
</BaseList>
<!-- <div class="goods_list">
<div class="goods_item" v-for="item in goods" :key="item.id" @click="toDetail(item.id)">
<img :src="item.Icon" alt="">
<div>
<span class="title">{{ item.SubTitle }}</span>
<p>¥{{ item.OPrice }}</p>
<div class="money">
<div>
<span>¥
<b>{{ item.Price }}</b>.00
</span>
</div>
<img class="r" style="width: 5.6vw;" src="/img/cart.png" alt="">
</div>
</div>
</div>
</div> -->
</div>
<van-popup v-model:show="showLeft" position="left" :style="{ width: '30%', height: '100%' }">
<div v-for="i in tabs">
<div @click="changeTab(i.id)" style="height: 10vw;width: 100%;border-bottom: solid 1px #f5f5f5;"
class="box box-center-center">
{{ i.name }}
</div>
</div>
</van-popup>
</template>
<script>
export default {
name: 'Agriculture',
activated() {
this.getTab()
},
data() {
return {
active: '',
showLeft: false,
tabs: []
}
},
mounted() {
this.getTab()
},
methods: {
getTab() {
this.$get('/v1/client/EProcatesClient/2').then(res => {
this.tabs = res.data
})
},
changeTab(id) {
this.active = id;
this.showLeft = false;
},
toDetail(e) {
this.$navigate(`/GoodsDetail?id=${e}`)
}
},
computed: {
filteredGoods() {
// if (this.active === 0) {
// return this.goods
// }
// const categoryId = this.active
// return this.goods.filter(item => item.CategoryId === categoryId)
}
}
}
</script>
<style>
.finished-text {
width: 100%;
}
</style>

View File

@ -220,7 +220,11 @@ export default {
name: 'Mall',
// emits: ['changeTabbar'],
activated() {
this.init();
if (this._skipActivatedRefresh) {
this._skipActivatedRefresh = false
return
}
this.$refs.BaseList?.refresh()
},
mounted() {
this.init();
@ -228,6 +232,7 @@ export default {
data() {
return {
activeType: '',
_skipActivatedRefresh: true,
searchParams: {
mallstate: 3,
pid: '',
@ -261,7 +266,11 @@ export default {
this.typeData = res.data
this.searchParams.pid = res.data?.[0]?.id || ''
}),
]).catch(err => {
]).then(() => {
// activated refresh
this._skipActivatedRefresh = false
}).catch(err => {
this.$showFailToast(err.message || '加载失败')
});
},
groupItems(items, num) {

View File

@ -42,7 +42,8 @@
<div class="detail_box">
<div>
<span>订单编号:</span>
<span class="r">{{ item.ordernum }}<img src="/img/copy_b.png" @click="$copyText(item.ordernum); $showSuccessToast('复制成功')" alt=""></span>
<span class="r">{{ item.ordernum }}<img src="/img/copy_b.png"
@click="$copyText(item.ordernum); $showSuccessToast('复制成功')" alt=""></span>
</div>
<div>
<span>下单时间:</span>
@ -102,7 +103,7 @@ export default {
data() {
return {
activeTab: '',
TradeArea: Number(this.$route.query.TradeArea) || 0,
TradeArea: 0,
_initialized: false,
_searchParams: {
ordernum: '',
@ -111,10 +112,6 @@ export default {
tradeStates: [
],
mallList: [
{ value: 0, label: '全部订单' },
{ value: 3, label: '商城订单' },
{ value: 1, label: '礼包订单' },
{ value: 2, label: '买单订单' },
],
}
},
@ -125,13 +122,27 @@ export default {
]).then(([stateRes, areaRes]) => {
this.tradeStates = stateRes.data;
this.mallList = [{ value: 0, label: '全部订单' }, ...(areaRes.data || [])];
this._initialized = true;
this.$refs.baseList?.refresh();
// watch
if (this.$refs.baseList) {
this.$refs.baseList._skipWatch = true
}
const areaFromRoute = this.$route.query.TradeArea;
if (areaFromRoute !== undefined && areaFromRoute !== '') {
this.TradeArea = Number(areaFromRoute) || 0;
} else {
this.TradeArea = 0;
}
const stateFromRoute = this.$route.query.state;
if (stateFromRoute !== undefined && stateFromRoute !== '') {
this.activeTab = String(stateFromRoute);
this._searchParams.state = stateFromRoute;
}
this.$nextTick(() => {
if (this.$refs.baseList) {
this.$refs.baseList._skipWatch = false
this.$refs.baseList.refresh()
}
})
}).catch((err) => {
this.$showFailToast(err.message || '加载失败');
});
@ -155,10 +166,10 @@ export default {
}
},
watch: {
TradeArea(val) {
this._searchParams.state = '';
this.activeTab = '';
},
// TradeArea(val) {
// this._searchParams.state = '';
// this.activeTab = '';
// },
'$route.query.state': {
handler(newVal) {
if (newVal !== undefined && newVal !== '') {
@ -168,7 +179,16 @@ export default {
this.activeTab = '';
}
}
}
},
'$route.query.TradeArea': {
handler(newVal) {
if (newVal !== undefined && newVal !== '') {
this.TradeArea = Number(newVal) || 0;
} else {
this.TradeArea = 0;
}
}
},
},
methods: {
back() {