|
@@ -4,13 +4,13 @@
|
|
<view class="order-top sticky-top">
|
|
<view class="order-top sticky-top">
|
|
<cm-search
|
|
<cm-search
|
|
v-model="listQuery.name"
|
|
v-model="listQuery.name"
|
|
- @search="handleSearch"
|
|
|
|
placeholder="请输入搜索关键字"
|
|
placeholder="请输入搜索关键字"
|
|
:keywordVisible="keywordVisible"
|
|
:keywordVisible="keywordVisible"
|
|
:keywordList="keywordList"
|
|
:keywordList="keywordList"
|
|
@focus="keywordVisible = true"
|
|
@focus="keywordVisible = true"
|
|
@clear="keywordVisible = true"
|
|
@clear="keywordVisible = true"
|
|
@remove="removeKeywordModal = true"
|
|
@remove="removeKeywordModal = true"
|
|
|
|
+ @search="handleSearch"
|
|
></cm-search>
|
|
></cm-search>
|
|
</view>
|
|
</view>
|
|
<!-- 订单列表为空 -->
|
|
<!-- 订单列表为空 -->
|
|
@@ -26,17 +26,24 @@
|
|
<view class="title">{{ product.name }}</view>
|
|
<view class="title">{{ product.name }}</view>
|
|
<view class="unit">规格:{{ product.unit }}</view>
|
|
<view class="unit">规格:{{ product.unit }}</view>
|
|
<view class="tags">
|
|
<view class="tags">
|
|
- <view class="tag pt" v-if="product.collageStatus === 1">拼团价</view>
|
|
|
|
- <view class="tag hd" v-if="product.activeStatus == 1 && product.collageStatus === 0">
|
|
|
|
- 活动价
|
|
|
|
- </view>
|
|
|
|
- <view class="tag hd" v-if="product.couponsLogo">优惠券</view>
|
|
|
|
|
|
+ <!-- 拼团价 活动价 限时特价 券后价 -->
|
|
|
|
+ <!-- 该商品参与了商城活动 -->
|
|
|
|
+ <template v-if="isActivityProduct(product)">
|
|
|
|
+ <view class="tag pt" v-if="product.collageStatus > 0">拼团价</view>
|
|
|
|
+ <view class="tag hd" v-else-if="product.activeStatus > 0">活动价</view>
|
|
|
|
+ <view class="tag other" v-else-if="product.discountStatus > 0">限时特价</view>
|
|
|
|
+ </template>
|
|
|
|
+ <!-- 该商品未参与商城活动 -->
|
|
|
|
+ <template v-else>
|
|
|
|
+ <view class="tag other" v-if="product.couponStatus > 1">{{ product.couponInfo }}</view>
|
|
|
|
+ <view class="tag other" v-else-if="product.couponStatus > 0">券后价</view>
|
|
|
|
+ </template>
|
|
</view>
|
|
</view>
|
|
<!-- 底部 -->
|
|
<!-- 底部 -->
|
|
<view class="footer">
|
|
<view class="footer">
|
|
<!-- 价格 -->
|
|
<!-- 价格 -->
|
|
<view class="price">
|
|
<view class="price">
|
|
- <text>¥{{ product.price | priceFormat }}</text>
|
|
|
|
|
|
+ <text>¥{{ showPrice(product) | priceFormat }}</text>
|
|
<text class="deleted" v-if="product.normalPrice">
|
|
<text class="deleted" v-if="product.normalPrice">
|
|
¥{{ product.normalPrice | priceFormat }}
|
|
¥{{ product.normalPrice | priceFormat }}
|
|
</text>
|
|
</text>
|
|
@@ -61,7 +68,7 @@
|
|
<!-- 操作弹窗 -->
|
|
<!-- 操作弹窗 -->
|
|
<tui-modal :show="removeKeywordModal" content="确认清空搜索历史记录?" @click="clearAllHistory"></tui-modal>
|
|
<tui-modal :show="removeKeywordModal" content="确认清空搜索历史记录?" @click="clearAllHistory"></tui-modal>
|
|
<!-- 安全区域 -->
|
|
<!-- 安全区域 -->
|
|
- <cm-safe-area-bottom v-if="!visiable"></cm-safe-area-bottom>
|
|
|
|
|
|
+ <cm-safe-area-bottom v-if="visiable"></cm-safe-area-bottom>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -118,6 +125,14 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ isActivityProduct(product) {
|
|
|
|
+ return product.collageStatus > 0 || product.activeStatus > 0 || product.discountStatus > 0
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ showPrice(product) {
|
|
|
|
+ return product.couponStatus === 1 && !this.isActivityProduct(product) ? product.couponPrice : product.price
|
|
|
|
+ },
|
|
|
|
+
|
|
toDetail(row) {
|
|
toDetail(row) {
|
|
this.$router.navigateTo(`goods/goods-detail?jumpState=1?productId=${row.productId}`)
|
|
this.$router.navigateTo(`goods/goods-detail?jumpState=1?productId=${row.productId}`)
|
|
},
|
|
},
|
|
@@ -138,11 +153,12 @@ export default {
|
|
fetchList: debounce(async function() {
|
|
fetchList: debounce(async function() {
|
|
this.listQuery.userId = this.userId
|
|
this.listQuery.userId = this.userId
|
|
try {
|
|
try {
|
|
- const res = await fetchProductList(this.listQuery)
|
|
|
|
- this.total = res.data.total
|
|
|
|
- this.hasNextPage = res.data.hasNextPage
|
|
|
|
- this.list = [...this.list, ...res.data.list]
|
|
|
|
|
|
+ const { data } = await fetchProductList(this.listQuery)
|
|
|
|
+ this.total = data.pageInfo.totalRecord
|
|
|
|
+ this.hasNextPage = data.pageInfo.hasNextPage
|
|
|
|
+ this.list = [...this.list, ...data.pageInfo.results]
|
|
this.listQuery.pageNum++
|
|
this.listQuery.pageNum++
|
|
|
|
+ this.isLoading = false
|
|
} catch (e) {
|
|
} catch (e) {
|
|
console.log(e)
|
|
console.log(e)
|
|
}
|
|
}
|
|
@@ -151,7 +167,7 @@ export default {
|
|
async fetchHistoryList() {
|
|
async fetchHistoryList() {
|
|
try {
|
|
try {
|
|
const res = await fetchProductSearchHistory({ userId: this.userId })
|
|
const res = await fetchProductSearchHistory({ userId: this.userId })
|
|
- this.keywordList = res.data
|
|
|
|
|
|
+ this.keywordList = res.data.map(item => item.searchWord)
|
|
this.isLoading = false
|
|
this.isLoading = false
|
|
} catch (e) {
|
|
} catch (e) {
|
|
console.log(e)
|
|
console.log(e)
|