From 5814c71ed8f5e5f9d31de2ea65e9b68acba8b82d Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Thu, 7 Nov 2024 22:08:12 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=A8=E5=BA=97=E9=A6=96=E9=A1=B5=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=BC=BA=E5=88=B6=E9=80=89=E6=8B=A9=E9=97=A8=E5=BA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 3 + components/realstore-list/realstore-list.vue | 49 ++++- locale/en.json | 5 +- locale/zh.json | 5 +- pages/plugins/realstore/detail/detail.css | 14 +- pages/plugins/realstore/detail/detail.vue | 66 +++++- pages/plugins/realstore/index/index.css | 13 ++ pages/plugins/realstore/index/index.vue | 206 +++++++++++++++---- pages/plugins/realstore/search/search.vue | 40 ++-- 9 files changed, 320 insertions(+), 81 deletions(-) diff --git a/App.vue b/App.vue index 129156fe..8a946134 100644 --- a/App.vue +++ b/App.vue @@ -209,6 +209,9 @@ // 搜索历史记录 cache_search_history_key: 'cache_search_history_key', + // 门店选择详情缓存 + cache_realstore_detail_choice_key: 'cache_realstore_detail_choice_key', + // 默认用户头像 default_user_head_src: '/static/images/common/user.png', diff --git a/components/realstore-list/realstore-list.vue b/components/realstore-list/realstore-list.vue index ca1f89f5..c80638aa 100644 --- a/components/realstore-list/realstore-list.vue +++ b/components/realstore-list/realstore-list.vue @@ -2,12 +2,12 @@ - + - + {{ item.alias }} {{ item.name }} @@ -24,7 +24,7 @@ - + @@ -64,6 +64,14 @@ export default { type: Boolean, default: true, }, + propIsChoice: { + type: Boolean, + default: false, + }, + propIsChoiceBackType: { + type: String, + default: 'back', + }, propData: { type: Object, default: () => { @@ -177,20 +185,43 @@ export default { // 地图查看 address_map_event(e) { - var info = this.data_list[e.currentTarget.dataset.index]; + var info = this.data_list[e.currentTarget.dataset.index] || {}; if (info.lat == 0 || info.lng == 0) { app.globalData.showToast(this.$t('user-order-detail.user-order-detail.i876o3')); return false; } - - // 打开地图 var address = (info.province_name || "") + (info.city_name || "") + (info.county_name || "") + (info.address || ""); app.globalData.open_location(info.lng, info.lat, info.name, address); }, - // url事件 - url_event(e) { - app.globalData.url_event(e); + // 门店事件 + realstore_item_event(e) { + // 是否选择模式 + if(this.propIsChoice) { + // 存储缓存 + var data = this.data_list[e.currentTarget.dataset.index]; + uni.setStorageSync(app.globalData.data.cache_realstore_detail_choice_key, { + data: data, + status: 1 + }); + + // 回调事件 + this.$emit('onChoiceEvent', data); + + // 选择回调类型 + switch(this.propIsChoiceBackType) { + // 返回上一个页面 + case 'back' : + app.globalData.page_back_prev_event(); + break; + // 进入门店详情页面 + case 'realstore-detail' : + app.globalData.url_open('/pages/plugins/realstore/detail/detail?id='+data.id, true); + break; + } + } else { + app.globalData.url_event(e); + } } } }; diff --git a/locale/en.json b/locale/en.json index d80714bc..b6801a18 100644 --- a/locale/en.json +++ b/locale/en.json @@ -1674,7 +1674,10 @@ "47h2a0": "Request failed, please try again!", "miv944": "start", "20epzm": "Product data incorrect", - "8tzr7l": "Incorrect store info" + "8tzr7l": "Incorrect store info", + "87tty2": "Choice store", + "76rfgh": "Choose another store", + "r67uyg": "Enter store" } }, "share-popup": { diff --git a/locale/zh.json b/locale/zh.json index 4a580848..9d1b5e6e 100644 --- a/locale/zh.json +++ b/locale/zh.json @@ -1657,7 +1657,10 @@ "47h2a0": "请求失败,请重试!", "miv944": "起步", "20epzm": "商品数据有误", - "8tzr7l": "门店信息有误" + "8tzr7l": "门店信息有误", + "87tty2": "选择门店", + "76rfgh": "选择其他门店", + "r67uyg": "进入门店" } }, "share-popup": { diff --git a/pages/plugins/realstore/detail/detail.css b/pages/plugins/realstore/detail/detail.css index 970be27b..a7452b50 100644 --- a/pages/plugins/realstore/detail/detail.css +++ b/pages/plugins/realstore/detail/detail.css @@ -13,12 +13,6 @@ page { .header-content .address-content { max-width: calc(100% - 100rpx); } -.header-content .navigation { - width: 68rpx; - height: 28rpx; - line-height: 28rpx; - border: 2rpx solid #52C41A; -} .header-content .icon-list { right: 20rpx; bottom: 20rpx; @@ -44,11 +38,11 @@ page { .header-content .logo { width: 100rpx; } -.header-content .base-right { - padding-left: 14rpx; -} .header-content .base-right .title-length-limit { - width: calc(100% - 110rpx); + max-width: calc(100% - 100rpx); +} +.header-content .base-right .title-length-limit .title-content.switch { + max-width: calc(100% - 44rpx); } .header-content .base-right .use-type-icon { border-top-left-radius: 8rpx; diff --git a/pages/plugins/realstore/detail/detail.vue b/pages/plugins/realstore/detail/detail.vue index 51ec8c03..9febeae9 100644 --- a/pages/plugins/realstore/detail/detail.vue +++ b/pages/plugins/realstore/detail/detail.vue @@ -42,24 +42,29 @@ - - + + {{ info.buy_use_type_list[buy_use_type_index]['name'] }} - - {{ info.alias }} - {{ info.name }} + + + {{ info.alias }} + {{ info.name }} + + + + - + {{$t('detail.detail.dor2v9')}}{{ info.status_info.time }} {{$t('extraction-address.extraction-address.42v8tv')}}{{ info.distance }} - + @@ -68,7 +73,7 @@ {{ info.province_name }}{{ info.city_name }}{{ info.county_name }}{{ info.address }} - {{$t('detail.detail.688i26')}} + {{$t('detail.detail.688i26')}} @@ -387,6 +392,10 @@ status: 0, count: 0, }, + // 门店客服信息展示 + is_service_info: 0, + // 是否支持门店切换 + is_realstore_switch: 0, // 自定义分享信息 share_info: {}, // 是否单页预览 @@ -428,6 +437,9 @@ // 调用公共事件方法 app.globalData.page_event_onshow_handle(); + // 门店选择初始化 + this.realstore_choice_init(); + // 初始化配置 this.init_config(); @@ -465,6 +477,32 @@ } }, + // 门店选择初始化 + realstore_choice_init() { + var key = app.globalData.data.cache_realstore_detail_choice_key; + var res = uni.getStorageSync(key) || null; + if(res != null && (res.data || null) != null && res.status == 1) { + uni.setStorageSync(key, { + data: res.data, + status: 0 + }); + this.setData({ + params: {...this.params, ...{id: res.data.id}}, + info: res.data, + is_first: 1, + data_list: [], + data_total: 0, + data_page: 1, + data_page_total: 0, + data_is_loading: 0, + data_list_loding_status: 1, + data_bottom_line_status: false + }); + this.source_goods_remove(); + this.reset_scroll(); + } + }, + // 获取数据-初始化 get_detail_init(params = {}) { // 网络检查 @@ -492,6 +530,7 @@ this.setData({ is_service_info: parseInt(data_base.is_service_info || 0), + is_realstore_switch: parseInt(data_base.is_realstore_switch || 0), is_base_mode: parseInt(data.is_base_mode || 0), is_base_mode_show_type: parseInt(data.is_base_mode_show_type || 0), is_cart_nav: true, @@ -870,13 +909,11 @@ // 地图查看 address_map_event(e) { - var info = this.info; + var info = this.info || {}; if (info.lat == 0 || info.lng == 0) { app.globalData.showToast(this.$t('user-order-detail.user-order-detail.i876o3')); return false; } - - // 打开地图 var address = (info.province_name || '') + (info.city_name || '') + (info.county_name || '') + (info.address || ''); app.globalData.open_location(info.lng, info.lat, info.name, address); }, @@ -1011,6 +1048,13 @@ } }, + // 门店切换事件 + realstore_switch_event (e) { + if(this.is_realstore_switch == 1) { + app.globalData.url_open('/pages/plugins/realstore/search/search?is_choice_mode=1&show_type_mode=1'); + } + }, + // 开启客服弹层 popup_service_open_event(e) { this.setData({ diff --git a/pages/plugins/realstore/index/index.css b/pages/plugins/realstore/index/index.css index 13948aae..9363becc 100644 --- a/pages/plugins/realstore/index/index.css +++ b/pages/plugins/realstore/index/index.css @@ -38,6 +38,19 @@ page { right: 20rpx; } +/** + * 已选门店 + */ +.user-choice-realstore .logo { + width: 100rpx; +} +.user-choice-realstore .base-right .title { + max-width: calc(100% - 180rpx); +} +.user-choice-realstore .address-content { + max-width: calc(100% - 100rpx); +} + /** * 媒体查询 diff --git a/pages/plugins/realstore/index/index.vue b/pages/plugins/realstore/index/index.vue index 6e1eb837..0a78bdf3 100644 --- a/pages/plugins/realstore/index/index.vue +++ b/pages/plugins/realstore/index/index.vue @@ -1,43 +1,102 @@