👍 增加地图 增加拼多多

This commit is contained in:
2023-11-24 18:58:56 +08:00
parent 7f4aecb936
commit 3a33d65d6b
26 changed files with 2330 additions and 256 deletions
+159
View File
@@ -0,0 +1,159 @@
<template>
<view class="goods_page">
<view class="goods_item" @click="detail">
<image mode="aspectFit" class="goods_img" :src="data.goods_thumbnail_url"></image>
<view class="good_group_text">
<text class="goods_title">{{data.goods_name}}</text>
<view class="goods_description">
<view class="juanjia">
<text class="juanjia_title">领劵免拼</text>
<text class="juanjia_price">{{priceFormat(data.min_group_price-data.coupon_discount)}}</text>
</view>
<view class="yuanjia">原价{{priceFormat(data.min_normal_price)}}</view>
<view class="tuanjia">团购{{priceFormat(data.min_group_price)}}</view>
<view class="youhui" v-if="data.has_coupon">{{data.coupon_discount/100}}元卷</view>
<view class="yishou">已售{{data.sales_tip}}</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
};
},
computed: {
},
props: {
data: {
type: Object,
default: () => {
return {}
}
},
search_id: {
type: String,
default: () => {
return ""
}
},
pid: {
type: [String],
default: () => {
return ""
}
}
},
methods: {
detail() {
let url = '/uni_modules/aliea-goods/pages/goods/goodDetail?id=' + this.data.goods_sign +
'&search_id=' + this.search_id
if (this.pid) {
url += '&p_id=' + this.pid
}
uni.navigateTo({
url: url
})
},
priceFormat(price) {
let sj = price / 100
if (sj > 100) {
sj = Math.floor(sj)
}
return sj
}
}
}
</script>
<style lang="scss">
.goods_page {
width: 355rpx;
.goods_item {
width: 355rpx;
border-radius: 15rpx;
background-color: #fff;
padding: 10rpx 0;
.goods_img {
display: block;
width: 335rpx;
height: 335rpx;
border-radius: 15rpx;
margin: 0 auto;
}
.good_group_text {
padding: 0 10rpx;
.goods_title {
display: block;
font-size: 30rpx;
overflow: hidden;
margin: 20rpx 0;
height: 120rpx;
}
.goods_description {
line-height: 38rpx;
font-size: 26rpx;
.yuanjia {
text-decoration: line-through;
color: #999;
width: 50%;
display: inline-block;
}
.tuanjia {
text-decoration: line-through;
width: 50%;
display: inline-block;
text-align: right;
}
.juanjia {
color: red;
font-weight: bold;
position: relative;
.juanjia_title {
font-size: 26rpx;
text-align: justify;
}
.juanjia_price {
font-size: 45rpx;
position: absolute;
right: 10rpx;
top: -10rpx;
}
}
.yishou {
color: #999;
width: 50%;
display: inline-block;
text-align: right;
}
.youhui {
width: 50%;
display: inline-block;
color: #ff5500;
height: 40rpx;
}
}
}
}
}
</style>
+207
View File
@@ -0,0 +1,207 @@
<template>
<view class="search_page">
<view class="search_bar">
<view v-if="backTag" class="back_icon" @click="back">
<uni-icons color="#ffffff" size="26" type="back"></uni-icons>
</view>
<view class="search_bar_view">
<uni-search-bar @focus="getData" cancelButton="none" v-model="content" @confirm="confirm" />
<!-- <button class="h5_btm" type="default" @click="confirm(content)"></button> -->
</view>
</view>
<view class="searchzw"></view>
<view class="search_result" v-if="lishi">
<view class="search-title">搜索历史
<text v-if="!close" class="edit" @click="edit">编辑</text>
<text v-else class="edit" @click="edit">取消编辑</text>
</view>
<view class="search_text" v-for="(item,index) in searchData" :key="index">
<view v-if="close">{{item}}
<uni-icons @click="clearHis(index)" size="20" class="search_close" type="close">
</uni-icons>
</view>
<view v-else @click="confirms(item)">
{{item}}
</view>
</view>
<view class="guanbi" @click="closeLishi()">关闭</view>
</view>
</view>
</template>
<script>
export default {
name: 'search_bar',
data() {
return {
content: '',
searchData: {},
close: false,
closeText: "编辑",
lishi: false,
};
},
computed: {
backTag() {
return getCurrentPages().length > 1 && uni.getSystemInfoSync().uniPlatform=="app"
}
},
created() {
this.content = this.getSearchData()[0]
},
methods: {
confirm(content) {
this.confirms(content.value)
},
confirms(content) {
this.content = content
if (!this.content) return;
this.clearHis(this.searchData.indexOf(this.content))
this.searchData = this.setSearchData(this.content)
this.closeLishi()
this.$emit("toPage", {
keyword: this.content
})
},
getData() {
this.lishi = true
this.searchData = this.getSearchData()
},
closeLishi() {
this.lishi = false
this.close = false
},
back() {
uni.navigateBack()
},
edit() {
this.close = !this.close
if (this.close) {
this.closeText = "取消编辑"
} else {
this.closeText = "编辑"
}
},
clearHis(index) {
if (index < 0) return
this.searchData.splice(index, 1)
this.setSearchData(this.searchData)
},
setSearchData(content) {
let searchHistory = uni.getStorageSync('searchHistory')
if (typeof searchHistory != "object") {
searchHistory = []
}
if (typeof content == "string") {
if (searchHistory.indexOf(content) == -1) {
searchHistory.unshift(content)
}
} else if (typeof content == "object") {
searchHistory = content
}
uni.setStorageSync('searchHistory', searchHistory)
return searchHistory
},
getSearchData() {
let searchHistory = uni.getStorageSync('searchHistory')
if (typeof searchHistory != "object") {
searchHistory = []
}
return searchHistory
}
}
}
</script>
<style lang="scss">
.search_page {
width: 100%;
position: relative;
.search_bar {
position: fixed;
width: 100%;
padding-top: var(--status-bar-height);
background-color: #ff5500;
height: 115rpx;
line-height: 80rpx;
display: flex;
flex-direction: row;
align-items: center;
z-index: 100;
.back_icon {
width: 70rpx;
text-align: right;
z-index: 100;
}
.search_bar_view {
flex: 1;
position: relative;
}
}
.searchzw {
padding-top: var(--status-bar-height);
width: 100%;
height: 115rpx;
}
//#ifdef APP
//#endif
.search_result {
width: 710rpx;
padding: 20rpx;
line-height: 40rpx;
background-color: #f8f8f8;
border: #efefef 1px solid;
position: absolute;
top: 110rpx+var(--status-bar-height);
z-index: 200;
.search-title {
font-weight: bold;
color: #666;
line-height: 80rpx;
.edit {
position: absolute;
right: 20rpx;
display: inline-block;
text-align: right;
font-weight: normal;
color: #55aaff;
}
}
.search_text {
background-color: #f0f0f0;
padding: 10rpx 20rpx;
display: inline-block;
margin: 10rpx 15rpx;
border-radius: 10rpx;
position: relative;
.search_close {
position: absolute;
right: -15rpx;
top: -10rpx
}
}
.guanbi {
width: 100rpx;
margin: 20rpx auto 0rpx auto;
color: #e3e3e3;
text-align: center;
}
}
}
</style>
+79
View File
@@ -0,0 +1,79 @@
<template>
<view class="content">
<scroll-view class="scroll" :scroll-into-view="'scroll_view_id_'+(tabIndex-1)" scroll-x="true"
show-scrollbar="false">
<div class="scroll_view" :id="'scroll_view_id_'+index" @click="tabClick(index)"
v-for="(item,index) in tabList" :key="index">
<text class="tabText" :style="{
color:tabIndex===index?activeColor:noActiveColor,
fontWeight:tabIndex===index?'bold':'normal',}">{{item.name}}</text>
<view class="active_line"
:style="tabIndex===index?'background-color:'+activeColor:'background-color:#ffffff;'"></view>
</div>
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {};
},
props: {
activeColor: {
type: String,
default: '#1596FE'
},
noActiveColor: {
type: String,
default: '#333333'
},
tabList: {
type: Array,
default: ()=>{
return []
}
},
tabIndex: {
type: Number,
default: 0
}
},
methods: {
tabClick(index) {
if (this.tabIndex === index) return;
this.$emit("change", {
detail: {
current: index
}
})
},
}
}
</script>
<style lang="scss" >
.content {
width: 100%;
.scroll {
background-color: #efefef;
white-space: nowrap;
position: relative;
line-height: 70rpx;
.scroll_view {
display: inline-block;
padding: 10rpx 15rpx;
.tabText{
line-height: 50rpx;
font-size: 35rpx;
}
.active_line{
width: 100%;
height: 8rpx;
}
}
}
}
</style>