新增搜索开始页面

master
gongfuxiang 2024-10-15 00:31:55 +08:00
parent 5414b98e4a
commit ec5c5db5ee
13 changed files with 342 additions and 77 deletions

11
App.vue
View File

@ -8,11 +8,11 @@
//
//
request_url: 'http://shopxo.com/',
// request_url:'https://new.shopxo.vip/',
// request_url:'https://new.shopxo.vip/',
// publicpublichttps://d1.shopxo.vip/public/
static_url: 'http://shopxo.com/',
// static_url:'https://new.shopxo.vip/',
// static_url:'https://new.shopxo.vip/',
// default
system_type: 'default',
@ -205,6 +205,9 @@
// apptabbar
cache_tabbar_badge_key: 'cache_tabbar_badge_key',
//
cache_search_history_key: 'cache_search_history_key',
//
default_user_head_src: '/static/images/common/user.png',
@ -2877,14 +2880,14 @@
},
//
set_navigation_bar_color(is_white = false) {
set_navigation_bar_color(is_white = null) {
var color = '#000000';
var bg_color = '#ffffff';
var arr = [
'pages/index/index',
];
var page = this.current_page(false);
if(is_white === true || (is_white === false && arr.indexOf(page) != -1)) {
if(is_white === true || (is_white === null && arr.indexOf(page) != -1)) {
color = '#ffffff';
bg_color = '#000000';
}

View File

@ -218,6 +218,9 @@ button:before {
.dis-inline-block {
display: inline-block !important;
}
.dis-inline-grid {
display: inline-grid;
}
.va-t {
vertical-align: top;
}

View File

@ -138,58 +138,58 @@
</view>
<!-- 操作导航 -->
<block v-if="data_list.length > 0">
<view class="bottom-fixed z-i" :class="(discount_detail_status ? ' discount-detail-popup-z-index' : '')" :style="bottom_fixed_style">
<view :class="propCartNavBottomValue > 0 ? '' : 'bottom-line-exclude'">
<!-- 展示 -->
<view v-if="common_site_type == 1" class="cart-exhibition-mode">
<button class="item exhibition-btn bg-main br-main cr-white round wh-auto text-size-sm" type="default" @tap="exhibition_submit_event" hover-class="none">
<view class="dis-inline-block va-m margin-right-xl">
<uni-icons type="phone" size="14" color="#fff" />
</view>
<text class="va-m">{{ common_is_exhibition_mode_btn_text }}</text>
</button>
</view>
<!-- 销售,自提,虚拟销售 -->
<view v-else class="bottom-fixed-content item round bg-white flex-row jc-sb align-c">
<view class="cart-nav-base single-text padding-left flex-row jc-sb align-c">
<view class="cart-selected flex-row align-c">
<view @tap="selected_event" data-type="all">
<iconfont :name="'icon-zhifu-' + (is_selected_all ? 'yixuan' : 'weixuan')" size="34rpx" :color="is_selected_all ? theme_color : '#999'"></iconfont>
</view>
<text v-if="already_selected_status" @tap="cart_all_remove_event" class="margin-left-main cart-nav-remove-submit dis-inline-block va-m bg-white cr-red br-red round cp">{{ $t('common.del') }}</text>
<text v-else class="va-m cr-base padding-left-main" @tap="selected_event" data-type="all">{{ $t('cart.cart.pxjwv8') }}</text>
</view>
<view class="price">
<view class="flex-row jc-s flex-nowrap align-c">
<view>{{ $t('buy.buy.wx78ju') }}</view>
<view class="sales-price single-text fw-b">
<text class="text-size-sm">{{ buy_currency_symbol }}</text>
<text class="text-size-lg">{{ total_price }}</text>
</view>
</view>
<block v-if="is_cart_show_discount == 1 && total_num > 0">
<view v-if="data_list.length > 0" class="flex-row jc-s flex-nowrap align-c text-size-xss">
<block v-if="preferential_price > 0">
<view class="cr-base">{{ $t('cart.cart.3kr74b') }}{{ buy_currency_symbol }}{{ preferential_price }}</view>
</block>
<block v-else>
<block v-if="increase_price > 0">
<view class="cr-base">{{ $t('cart.cart.n76213') }}{{ buy_currency_symbol }}{{ increase_price }}</view>
</block>
</block>
<view v-if="preferential_price > 0 || increase_price > 0" class="discount-details" @tap="discount_detail_open_event">{{ $t('cart.cart.4tbj4s') }}</view>
</view>
</block>
</view>
</view>
<view class="cart-nav-submit">
<button class="nav-btn bg-main br-main cr-white round text-size-md" type="default" @tap="buy_submit_event" :disabled="!already_valid_selected_status" hover-class="none">
{{ $t('goods-category.goods-category.44f1ww') }}<block v-if="total_num > 0">({{ total_num }})</block>
</button>
</view>
</view>
</view>
<block v-if="data_list.length > 0">
<view class="bottom-fixed z-i" :class="(discount_detail_status ? ' discount-detail-popup-z-index' : '')" :style="bottom_fixed_style">
<view :class="propCartNavBottomValue > 0 ? '' : 'bottom-line-exclude'">
<!-- 展示 -->
<view v-if="common_site_type == 1" class="cart-exhibition-mode">
<button class="item exhibition-btn bg-main br-main cr-white round wh-auto text-size-sm" type="default" @tap="exhibition_submit_event" hover-class="none">
<view class="dis-inline-block va-m margin-right-xl">
<uni-icons type="phone" size="14" color="#fff" />
</view>
<text class="va-m">{{ common_is_exhibition_mode_btn_text }}</text>
</button>
</view>
<!-- 销售,自提,虚拟销售 -->
<view v-else class="bottom-fixed-content item round bg-white flex-row jc-sb align-c">
<view class="cart-nav-base single-text padding-left flex-row jc-sb align-c">
<view class="cart-selected flex-row align-c">
<view @tap="selected_event" data-type="all">
<iconfont :name="'icon-zhifu-' + (is_selected_all ? 'yixuan' : 'weixuan')" size="34rpx" :color="is_selected_all ? theme_color : '#999'"></iconfont>
</view>
<text v-if="already_selected_status" @tap="cart_all_remove_event" class="margin-left-main cart-nav-remove-submit dis-inline-block va-m bg-white cr-red br-red round cp">{{ $t('common.del') }}</text>
<text v-else class="va-m cr-base padding-left-main" @tap="selected_event" data-type="all">{{ $t('cart.cart.pxjwv8') }}</text>
</view>
<view class="price">
<view class="flex-row jc-s flex-nowrap align-c">
<view>{{ $t('buy.buy.wx78ju') }}</view>
<view class="sales-price single-text fw-b">
<text class="text-size-sm">{{ buy_currency_symbol }}</text>
<text class="text-size-lg">{{ total_price }}</text>
</view>
</view>
<block v-if="is_cart_show_discount == 1 && total_num > 0">
<view v-if="data_list.length > 0" class="flex-row jc-s flex-nowrap align-c text-size-xss">
<block v-if="preferential_price > 0">
<view class="cr-base">{{ $t('cart.cart.3kr74b') }}{{ buy_currency_symbol }}{{ preferential_price }}</view>
</block>
<block v-else>
<block v-if="increase_price > 0">
<view class="cr-base">{{ $t('cart.cart.n76213') }}{{ buy_currency_symbol }}{{ increase_price }}</view>
</block>
</block>
<view v-if="preferential_price > 0 || increase_price > 0" class="discount-details" @tap="discount_detail_open_event">{{ $t('cart.cart.4tbj4s') }}</view>
</view>
</block>
</view>
</view>
<view class="cart-nav-submit">
<button class="nav-btn bg-main br-main cr-white round text-size-md" type="default" @tap="buy_submit_event" :disabled="!already_valid_selected_status" hover-class="none">
{{ $t('goods-category.goods-category.44f1ww') }}<block v-if="total_num > 0">({{ total_num }})</block>
</button>
</view>
</view>
</view>
</view>
</block>
<!-- 优惠明细弹窗 -->
@ -882,13 +882,13 @@
data_list_loding_status: temp_list.length == 0 ? 0 : this.data_list_loding_status,
random_value: Math.random(),
});
app.globalData.showToast(type == 'delete' ? this.$t('user-list.user-list.kpn3fp') : this.$t('cart.cart.346c25'), 'success');
app.globalData.showToast(type == 'delete' ? this.$t('common.del_success') : this.$t('cart.cart.346c25'), 'success');
//
this.cart_selected_calculate();
} else {
if (app.globalData.is_login_check(res.data)) {
app.globalData.showToast(type == 'delete' ? this.$t('user-list.user-list.649j60') : this.$t('cart.cart.21051p'));
app.globalData.showToast(type == 'delete' ? this.$t('common.del_fail') : this.$t('cart.cart.21051p'));
} else {
app.globalData.showToast(this.$t('common.sub_error_retry_tips'));
}
@ -1408,9 +1408,9 @@
/**
* 操作导航
*/
.bottom-fixed-content {
height: 120rpx;
*/
.bottom-fixed-content {
height: 120rpx;
}
.cart-nav-base {
width: calc(75% - 20rpx);

View File

@ -168,7 +168,7 @@
},
//
search_submit_confirm_event(e) {
search_submit_confirm_event() {
//
if (this.propIsRequired && this.input_value === '') {
app.globalData.showToast(this.$t('search.search.ic9b89'));
@ -182,6 +182,11 @@
//
app.globalData.url_open(this.propUrl + '?' + this.propFormName + '=' + this.input_value);
}
},
//
search_submit_confirm(input_value = '') {
app.globalData.url_open(this.propUrl + '?' + this.propFormName + '=' + input_value);
},
// icon

View File

@ -15,6 +15,8 @@
"add": "Add",
"del": "Delete",
"del_record": "Delete record",
"del_success": "Delete successful",
"del_fail": "Delete failed",
"edit": "Edit",
"link": "Link",
"gift": "Gift",
@ -77,6 +79,7 @@
"login": "Login",
"paytips": "Secure payment",
"goods-search": "Product search",
"goods-search-start": "Product search",
"goods-detail": "Product details",
"goods-comment": "Product evaluation",
"user-address": "My address",
@ -765,9 +768,7 @@
},
"user-list": {
"user-list": {
"yhvl2q": "Are you sure you want to delete this post?",
"kpn3fp": "Delete successful",
"649j60": "Delete failed"
"yhvl2q": "Are you sure you want to delete this post?"
}
},
"shop": {

View File

@ -15,6 +15,8 @@
"add": "新增",
"del": "删除",
"del_record": "删除记录",
"del_success": "删除成功",
"del_fail": "删除失败",
"edit": "编辑",
"link": "链接",
"gift": "礼物",
@ -77,6 +79,7 @@
"login": "登录",
"paytips": "安全支付",
"goods-search": "商品搜索",
"goods-search-start": "商品搜索",
"goods-detail": "商品详情",
"goods-comment": "商品评价",
"user-address": "我的地址",
@ -759,9 +762,7 @@
},
"user-list": {
"user-list": {
"yhvl2q": "确定要删除这条帖子吗?",
"kpn3fp": "删除成功",
"649j60": "删除失败"
"yhvl2q": "确定要删除这条帖子吗?"
}
},
"shop": {

View File

@ -154,6 +154,18 @@
}
]
},
{
"root": "pages/goods-search-start",
"pages": [
{
"path": "goods-search-start",
"style": {
"enablePullDownRefresh": true,
"navigationBarTitleText": ""
}
}
]
},
{
"root": "pages/goods-comment",
"pages": [

View File

@ -0,0 +1,10 @@
.ranking-list .ranking-item {
width: 65%;
}
.ranking-list .goods-list .goods-image {
width: 100rpx;
height: 100rpx;
}
.ranking-list .goods-list .goods-title {
width: calc(100% - 120rpx);
}

View File

@ -0,0 +1,230 @@
<template>
<view :class="theme_view">
<view v-if="data_list_loding_status == 3" class="padding-main">
<!-- 搜索 -->
<view class="margin-bottom-xxxl">
<component-search ref="search" :propIsBtn="true" :propIsOnEvent="true" propSize="sm" @onsearch="search_history_handle" :propPlaceholder="search_keywords_value" :propDefaultValue="search_keywords_value" propBrColor="#eee" propPlaceholderClass="cr-grey-c" propIconColor="#999" propBgColor="#fff"></component-search>
</view>
<!-- 历史搜索关键字 -->
<view v-if="history_keywords.length > 0" class="history-keywords margin-bottom-xxxl">
<view class="margin-bottom flex-row jc-sb align-c">
<text class="text-size-sm fw-b">历史搜索</text>
<view class="dis-inline-block" @tap="history_delete_event">
<iconfont name="icon-delete" size="30rpx" color="#999"></iconfont>
</view>
</view>
<view class="oh">
<block v-for="(item, index) in history_keywords" :key="index">
<view class="dis-inline-block bg-grey-e cr-base round padding-vertical-xs padding-horizontal-lg margin-right margin-bottom" :data-value="item" @tap="keywords_event">{{item}}</view>
</block>
</view>
</view>
<!-- 推荐搜索关键字 -->
<view v-if="recommend_keywords.length > 0" class="recommend-keywords margin-bottom-xxxl">
<view class="text-size-sm fw-b margin-bottom">热门搜索</view>
<view class="oh">
<block v-for="(item, index) in recommend_keywords" :key="index">
<view class="dis-inline-block bg-grey-e cr-base round padding-vertical-xs padding-horizontal-lg margin-right margin-bottom" :data-value="item" @tap="keywords_event">{{item}}</view>
</block>
</view>
</view>
<!-- 排行榜 -->
<view v-if="ranking_list.length > 0" class="ranking-list scroll-view-horizontal border-radius-main oh">
<scroll-view scroll-x="true">
<block v-for="(item, index) in ranking_list" :key="index">
<view class="ranking-item dis-inline-grid bg-main-light padding-sm border-radius-main" :class="index > 0 ? 'margin-left-main' : ''">
<view class="padding-vertical-sm padding-left-sm">
<view v-if="(item.icon || null) != null" class="dis-inline-block margin-right-sm">
<iconfont :name="item.icon" size="26rpx" propClass="cr-main"></iconfont>
</view>
<text class="text-size-sm fw-b cr-main">{{item.name}}</text>
</view>
<view class="goods-list bg-white border-radius-main padding-main margin-top-xs">
<block v-for="(item2, index2) in item.data" :key="index2">
<view class="goods-item oh margin-bottom-main" :data-value="item2.goods_url" @tap="url_event">
<image class="goods-image radius fl" :src="item2.images" mode="aspectFill"></image>
<view class="goods-title text-size-sm multi-text fr">{{item2.title}}</view>
</view>
</block>
</view>
</view>
</block>
</scroll-view>
</view>
</view>
<block v-else>
<!-- 提示信息 -->
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
</block>
<!-- 公共 -->
<component-common ref="common" @footer-height="footer_height_value_event" :propIsFooterSeat="false"></component-common>
</view>
</template>
<script>
const app = getApp();
import componentCommon from '@/components/common/common';
import componentNoData from '@/components/no-data/no-data';
import componentSearch from '@/components/search/search';
export default {
data() {
return {
theme_view: app.globalData.get_theme_value_view(),
data_list_loding_status: 1,
data_list_loding_msg: '',
history_keywords: [],
recommend_keywords: [],
ranking_list: [],
search_keywords_value: '',
};
},
components: {
componentCommon,
componentNoData,
componentSearch,
},
onLoad(params) {
//
app.globalData.page_event_onload_handle(params);
//
params = app.globalData.launch_params_handle(params);
this.setData({
params: params,
search_keywords_value: params.keywords || '',
});
},
onShow() {
//
app.globalData.page_event_onshow_handle();
//
this.init_config();
// onshow
if ((this.$refs.common || null) != null) {
this.$refs.common.on_show();
}
//
this.setData({
history_keywords: uni.getStorageSync(app.globalData.data.cache_search_history_key) || [],
});
//
this.get_data();
},
//
onPullDownRefresh() {
this.get_data();
},
methods: {
//
init_config(status) {
if ((status || false) == true) {
this.setData({
currency_symbol: app.globalData.get_config('currency_symbol'),
});
} else {
app.globalData.is_config(this, 'init_config');
}
},
//
get_data(params = {}) {
//
if((params || null) == null || (params.loading || 0) == 0) {
app.globalData.network_type_handle(this, 'get_data');
return false;
}
//
uni.request({
url: app.globalData.get_request_url("start", "search"),
method: 'POST',
data: {},
dataType: 'json',
success: (res) => {
uni.stopPullDownRefresh();
if (res.data.code == 0) {
var data = res.data.data;
this.setData({
recommend_keywords: data.search_keywords || [],
ranking_list: data.ranking_list || [],
data_list_loding_status: 3,
data_list_loding_msg: '',
});
} else {
this.setData({
data_list_loding_status: 2,
data_list_loding_msg: res.data.msg,
});
}
},
fail: () => {
uni.stopPullDownRefresh();
this.setData({
data_list_loding_status: 2,
data_list_loding_msg: this.$t('common.internet_error_tips'),
});
},
});
},
//
history_delete_event(e) {
uni.removeStorageSync(app.globalData.data.cache_search_history_key);
this.setData({
history_keywords: []
});
app.globalData.showToast(this.$t('common.del_success'), 'success');
},
//
search_history_handle(value = '') {
//
var key = app.globalData.data.cache_search_history_key;
var data = uni.getStorageSync(key) || [];
var index = data.indexOf(value);
if(index != -1) {
data.splice(index, 1);
}
data.unshift(value);
uni.setStorageSync(key, data);
//
this.setData({
search_keywords_value: value
});
//
this.search_submit_confirm_event();
},
//
keywords_event(e) {
this.search_history_handle(e.currentTarget.dataset.value);
},
//
search_submit_confirm_event() {
if ((this.$refs.search || null) != null) {
this.$refs.search.search_submit_confirm(this.search_keywords_value);
}
},
// url
url_event(e) {
app.globalData.url_event(e);
}
},
};
</script>
<style>
@import './goods-search-start.css';
</style>

View File

@ -64,11 +64,11 @@
<view v-if="common_app_is_enable_search == 1" class="search-content-input padding-horizontal-main">
<!-- 是否开启搜索框前面icon扫一扫 -->
<block v-if="is_home_search_scan == 1">
<component-search :propIsBtn="true" propSize="sm" :propPlaceholder="$t('customview.customview.726k7y')" propPlaceholderClass="cr-grey-c" propIconColor="#999" propBgColor="#fff" <!-- #ifndef H5 -->
<component-search :propIsBtn="true" propSize="sm" :propPlaceholder="$t('customview.customview.726k7y')" propPlaceholderClass="cr-grey-c" propIconColor="#999" propBgColor="#fff"
<!-- #ifndef H5 -->
@onicon="search_icon_event" propIcon="icon-scan" :propIsIconOnEvent="true"
<!-- #endif -->
></component-search
>
></component-search>
</block>
<block v-else>
<component-search :propIsBtn="true" propSize="sm" :propPlaceholder="$t('customview.customview.726k7y')" propPlaceholderClass="cr-grey-c" propIconColor="#999" propBgColor="#fff"></component-search>

View File

@ -253,10 +253,10 @@
this.setData({
data: temp_list,
});
app.globalData.showToast(this.$t('user-list.user-list.kpn3fp'), 'success');
app.globalData.showToast(this.$t('common.del_success'), 'success');
} else {
if (app.globalData.is_login_check(res.data)) {
app.globalData.showToast(this.$t('user-list.user-list.649j60'));
app.globalData.showToast(this.$t('common.del_fail'));
} else {
app.globalData.showToast(this.$t('common.sub_error_retry_tips'));
}

View File

@ -470,11 +470,11 @@
this.setData({
data_page: 1,
});
app.globalData.showToast(this.$t('user-list.user-list.kpn3fp'), 'success');
app.globalData.showToast(this.$t('common.del_success'), 'success');
this.get_data_list(1);
} else {
if (app.globalData.is_login_check(res.data)) {
app.globalData.showToast(this.$t('user-list.user-list.649j60'));
app.globalData.showToast(this.$t('common.del_fail'));
} else {
app.globalData.showToast(this.$t('common.sub_error_retry_tips'));
}

View File

@ -471,11 +471,11 @@
this.setData({
data_page: 1,
});
app.globalData.showToast(this.$t('user-list.user-list.kpn3fp'), 'success');
app.globalData.showToast(this.$t('common.del_success'), 'success');
this.get_data_list(1);
} else {
if (app.globalData.is_login_check(res.data)) {
app.globalData.showToast(this.$t('user-list.user-list.649j60'));
app.globalData.showToast(this.$t('common.del_fail'));
} else {
app.globalData.showToast(this.$t('common.sub_error_retry_tips'));
}