From 90be424554b99d335c43107082217f426ce5af48 Mon Sep 17 00:00:00 2001 From: maqian Date: Fri, 5 Jun 2026 14:41:13 +0800 Subject: [PATCH] merge webdecoration --- src/api/company.js | 2 +- src/components/function/mallList.vue | 4 + .../sp-picker/pickers/picker-link.vue | 113 ++-- src/components/sp-web-decoration/index.vue | 9 +- .../panels/ProductTabBlockPanel.vue | 23 - src/components/sp-web-decoration/utils/dsl.js | 7 + .../sp-web-decoration/utils/panelState.js | 12 +- src/i18n/locales/ar.json | 11 +- src/i18n/locales/en.json | 11 +- src/i18n/locales/zh-CN.json | 7 +- src/router/routes/modules/apps.js | 11 + src/router/src/route-applications.js | 5 + src/view/decorate/index.vue | 6 +- src/view/decorate/wgts/index.js | 1 - src/view/decorate/wgts/wgt_shop/config.js | 211 ++++--- src/view/decorate/wgts/wgt_shop/index.vue | 128 +++- src/view/mall/aftersales/list.vue | 19 +- src/view/marketing/employee/purchase.vue | 110 +++- src/view/wxapp/home/index.vue | 3 + .../application-center/shopex-appcenter.vue | 546 ++++++++++++++++++ src/views/decoration/web-template/index.vue | 1 - 21 files changed, 985 insertions(+), 255 deletions(-) create mode 100644 src/views/applications/application-center/shopex-appcenter.vue diff --git a/src/api/company.js b/src/api/company.js index b50d2f4..6268957 100755 --- a/src/api/company.js +++ b/src/api/company.js @@ -282,7 +282,7 @@ export function getAppcenterUrl(params) { export function loginUsercenter(params) { return fetch({ url: '/company/usercenter/login', - method: 'get', + method: 'post', params }) } diff --git a/src/components/function/mallList.vue b/src/components/function/mallList.vue index 40081e2..319d4cd 100755 --- a/src/components/function/mallList.vue +++ b/src/components/function/mallList.vue @@ -44,6 +44,7 @@ {{ $t('6880d32e.701fa5') }} + {{ $t('6880d32e.f9a598') }} @@ -134,9 +135,12 @@ {{ $t('6880d32e.79d3ab') }} + + {{ $t('6880d32e.0044f6') }} diff --git a/src/components/sp-picker/pickers/picker-link.vue b/src/components/sp-picker/pickers/picker-link.vue index e67869f..c460e85 100755 --- a/src/components/sp-picker/pickers/picker-link.vue +++ b/src/components/sp-picker/pickers/picker-link.vue @@ -41,11 +41,6 @@ @@ -154,10 +138,6 @@ export default { return this.selectedProducts.map( (id) => snapshotMap.get(id) || { item_id: id, item_name: id } ) - }, - sectionSize() { - const value = this.section?.settings?.size - return ['xsmall', 'small', 'medium', 'large', 'xlarge'].includes(value) ? value : 'medium' } }, methods: { @@ -173,9 +153,6 @@ export default { product_snapshots: snapshots }) }, - updateSize(value) { - this.$emit('change', { size: value, size_override: true }) - }, clearProducts() { this.$emit('change', { product_ids: [], product_snapshots: [] }) }, diff --git a/src/components/sp-web-decoration/utils/dsl.js b/src/components/sp-web-decoration/utils/dsl.js index 9962827..9ae5788 100644 --- a/src/components/sp-web-decoration/utils/dsl.js +++ b/src/components/sp-web-decoration/utils/dsl.js @@ -367,6 +367,13 @@ export function serializeDsl(dsl) { const nextDsl = cloneValue(dsl) Object.keys(nextDsl.sections || {}).forEach((sectionId) => { const section = nextDsl.sections[sectionId] + Object.keys(section.blocks || {}).forEach((blockId) => { + const block = section.blocks[blockId] + if (block?.type === 'product-tab' && block.settings) { + delete block.settings.size + delete block.settings.size_override + } + }) section.block_order = cloneValue(section.blockOrder || []) }) return nextDsl diff --git a/src/components/sp-web-decoration/utils/panelState.js b/src/components/sp-web-decoration/utils/panelState.js index b7977e9..01c2d6b 100644 --- a/src/components/sp-web-decoration/utils/panelState.js +++ b/src/components/sp-web-decoration/utils/panelState.js @@ -51,16 +51,8 @@ export function normalizeProductTabBlockSettings(settings = {}) { nextSettings.limit = Number.isFinite(Number(nextSettings.limit)) ? Math.min(24, Math.max(2, Number(nextSettings.limit))) : 8 - if ( - nextSettings.size !== undefined && - !['xsmall', 'small', 'medium', 'large', 'xlarge'].includes(nextSettings.size) - ) { - delete nextSettings.size - delete nextSettings.size_override - } - if (!nextSettings.size_override) { - delete nextSettings.size_override - } + delete nextSettings.size + delete nextSettings.size_override if (nextSettings.columns !== undefined) { nextSettings.columns = [2, 3, 4].includes(Number(nextSettings.columns)) ? Number(nextSettings.columns) diff --git a/src/i18n/locales/ar.json b/src/i18n/locales/ar.json index 8b5db31..5017378 100644 --- a/src/i18n/locales/ar.json +++ b/src/i18n/locales/ar.json @@ -17960,6 +17960,8 @@ "39e3acc2.45394d": "مشاركة النشاط", "39e3acc2.5925d6": "يظهر عند المشاركة عبر بطاقة البرنامج. مقاس 300*240، png/jpg، 2M كحد أقصى", "39e3acc2.9742f1": "يرجى اختيار صورة النشاط", + "39e3acc2.a8c1e2": "ملصق قائمة النشاط", + "39e3acc2.b9d3f4": "يرجى رفع ملصق قائمة النشاط", "39e3acc2.98fbb0": "ملصق النشاط", "39e3acc2.818403": "مقترح: عرض 640px، ارتفاع تلقائي", "39e3acc2.90a4b4": "يرجى اختيار ملصق النشاط", @@ -18000,8 +18002,8 @@ "39e3acc2.040c4d": "قائمة السلع / التفاصيل", "39e3acc2.c017be": "السلة", "39e3acc2.482b55": "الدفع", - "39e3acc2.028f5b": "وصف الخصم", - "39e3acc2.8e568f": "عرض وصف الخصم في صفحة الدفع عند التفعيل", + "39e3acc2.028f5b": "تذكير الشراء الداخلي", + "39e3acc2.8e568f": "عرض تذكير الشراء الداخلي في صفحة الدفع عند التفعيل", "39e3acc2.d0bea4": "تذكير الشراء للموظفين", "39e3acc2.6a03e7": "مواضع العرض: صفحة تفاصيل المنتج، صفحة سلة التسوق، صفحة الدفع", "39e3acc2.592c59": "وقت البداية", @@ -22590,8 +22592,9 @@ "223cc8af.d50361": "طلب استلام ذاتي", "223cc8af.e5f71f": "بحث", "223cc8af.e366cc": "تبديل اللغة", - "223cc8af.f2d3e5": "", - "223cc8af.3b02dd": "", + "223cc8af.f2d3e5": "مكتبة حالات Kujiale", + "223cc8af.3b02dd": "قائمة جميع المتاجر", + "223cc8af.437974": "قائمة المنتجات", "223cc8af.5c34aa": "دعم الفعالية", "223cc8af.94b1e6": "طلبات التعزيز", "223cc8af.1107a8": "انضمام التاجر", diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 0fa4273..6660878 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -17962,6 +17962,8 @@ "39e3acc2.45394d": "Share activity", "39e3acc2.5925d6": "Shown when sharing via mini-program card. Recommended 300*240, png/jpg, max 2M", "39e3acc2.9742f1": "Please select activity image", + "39e3acc2.a8c1e2": "Activity list poster", + "39e3acc2.b9d3f4": "Please upload activity list poster", "39e3acc2.98fbb0": "Activity poster", "39e3acc2.818403": "Recommended: width 640px, height auto", "39e3acc2.90a4b4": "Please select activity poster", @@ -18002,8 +18004,8 @@ "39e3acc2.040c4d": "Goods list / detail", "39e3acc2.c017be": "Cart", "39e3acc2.482b55": "Checkout", - "39e3acc2.028f5b": "Discount description", - "39e3acc2.8e568f": "Show discount description on checkout when enabled", + "39e3acc2.028f5b": "Internal purchase reminder", + "39e3acc2.8e568f": "Show internal purchase reminder on checkout when enabled", "39e3acc2.d0bea4": "Employee purchase reminder", "39e3acc2.6a03e7": "Display locations: product detail page, shopping cart, checkout page", "39e3acc2.592c59": "Start time", @@ -22591,8 +22593,9 @@ "223cc8af.d50361": "Self-pickup order", "223cc8af.e5f71f": "Search", "223cc8af.e366cc": "Switch language", - "223cc8af.f2d3e5": "", - "223cc8af.3b02dd": "", + "223cc8af.f2d3e5": "Kujiale case library", + "223cc8af.3b02dd": "All store list", + "223cc8af.437974": "Product list", "223cc8af.5c34aa": "Support the event", "223cc8af.94b1e6": "Boost orders", "223cc8af.1107a8": "Merchant entry", diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json index 092c1c0..364151c 100644 --- a/src/i18n/locales/zh-CN.json +++ b/src/i18n/locales/zh-CN.json @@ -18052,6 +18052,8 @@ "39e3acc2.45394d": "分享活动", "39e3acc2.5925d6": "员工通过小程序卡片分享活动时展示,建议尺寸300*240,支持 png、jpg 格式,文件大小为 2M 内", "39e3acc2.9742f1": "请选择活动图片", + "39e3acc2.a8c1e2": "活动列表海报", + "39e3acc2.b9d3f4": "请上传活动列表海报", "39e3acc2.98fbb0": "活动海报", "39e3acc2.818403": "建议尺寸:(宽度640px,高度自适应)", "39e3acc2.90a4b4": "请选择活动海报", @@ -18092,8 +18094,8 @@ "39e3acc2.040c4d": "商品列表/商详页面", "39e3acc2.c017be": "购物车", "39e3acc2.482b55": "结算页", - "39e3acc2.028f5b": "优惠说明", - "39e3acc2.8e568f": "开启优惠说明展示在结算页,关闭不展示", + "39e3acc2.028f5b": "内购提醒", + "39e3acc2.8e568f": "开启内购提醒展示在结算页,关闭不展示", "39e3acc2.d0bea4": "内购提醒", "39e3acc2.6a03e7": "显示位置:商品详情页、购物车页面、结算页", "39e3acc2.592c59": "开始时间", @@ -22593,6 +22595,7 @@ "223cc8af.e366cc": "切换语言", "223cc8af.f2d3e5": "酷家乐案例库", "223cc8af.3b02dd": "所有门店列表", + "223cc8af.437974": "商品列表", "223cc8af.5c34aa": "助力活动", "223cc8af.94b1e6": "助力订单", "223cc8af.1107a8": "商家入驻", diff --git a/src/router/routes/modules/apps.js b/src/router/routes/modules/apps.js index fb65980..5b34c39 100755 --- a/src/router/routes/modules/apps.js +++ b/src/router/routes/modules/apps.js @@ -438,6 +438,17 @@ const routes = [ permissions: ['applications.kujiale.kujiale-products'] }, component: () => import('@/views/applications/kujiale/list') + }, + { + name: 'appcenter', + path: 'shopex/appcenter', + meta: { + aliasName: 'shopex-appcenter', + icon: 'icon-products', + title: '商派应用中心', + permissions: ['applications.shopex-appcenter'] + }, + component: () => import('@/views/applications/application-center/shopex-appcenter') } ] } diff --git a/src/router/src/route-applications.js b/src/router/src/route-applications.js index a20b417..b94d982 100755 --- a/src/router/src/route-applications.js +++ b/src/router/src/route-applications.js @@ -405,6 +405,11 @@ export default { path: 'community/chiefupload', name: '5286ac37.5ad881', component: () => import('@/view/member/members/upload_chief') + }, + { + path: 'shopex/appcenter', + name: '商派用户中心', + component: () => import('@/views/applications/application-center/shopex-appcenter') } ] } diff --git a/src/view/decorate/index.vue b/src/view/decorate/index.vue index 4739406..8eb77e5 100644 --- a/src/view/decorate/index.vue +++ b/src/view/decorate/index.vue @@ -360,9 +360,11 @@ export default { findWidgetForPersistedName(persistedName) { const key = String(persistedName || '').toLowerCase() if (!key || !this.widgets.length) return null - let w = this.widgets.find((item) => (item.name || '').toLowerCase() === key) + // 附近商家已合并到店铺挂件,历史数据 name 仍为 nearbyShop + const lookupKey = key === 'nearbyshop' ? 'shop' : key + let w = this.widgets.find((item) => (item.name || '').toLowerCase() === lookupKey) if (w) return w - w = this.widgets.find((item) => String(item.config?.name || '').toLowerCase() === key) + w = this.widgets.find((item) => String(item.config?.name || '').toLowerCase() === lookupKey) if (w) return w if (String(this.localScene) === '1005' && key === 'goods') { return ( diff --git a/src/view/decorate/wgts/index.js b/src/view/decorate/wgts/index.js index d5217e3..ad361a9 100755 --- a/src/view/decorate/wgts/index.js +++ b/src/view/decorate/wgts/index.js @@ -9,7 +9,6 @@ import WgtFilm from './wgt_film' import WgtCoupon from './wgt_coupon' import WgtShop from './wgt_shop' import WgtMarquees from './wgt_marquees' -import WgtNearbyShop from './wgt_nearbyShop' import WgtGoodsCard from './wgt_goodsCard' import WgtWriting from './wgt_writing' import WgtHeading from './wgt_heading' diff --git a/src/view/decorate/wgts/wgt_shop/config.js b/src/view/decorate/wgts/wgt_shop/config.js index 58c49d6..90b46d0 100644 --- a/src/view/decorate/wgts/wgt_shop/config.js +++ b/src/view/decorate/wgts/wgt_shop/config.js @@ -3,6 +3,60 @@ import { i18n } from '@/i18n' import AttrStore from './attr-store' import { transformInBase, createTransformOutBase } from '../../comps/transform-utils' +const NEARBY_SETTING_KEYS = [ + 'title', + 'subtitle', + 'padded', + 'show_nearby_merchants', + 'merchantsNumber', + 'quantityNumber' +] + +const SHARED_BASE_KEYS = [ + 'dataType', + 'outerMargin', + 'innerPadding', + 'outerBackground', + 'innerBackground', + 'wgtCustName', + 'track', + ...NEARBY_SETTING_KEYS +] + +function isNearbyDataType(v, raw = {}) { + if (raw.name === 'nearbyShop') return true + const base = raw.base || {} + return (base.dataType || v.dataType) === 'nearby' +} + +function buildNearbySetting() { + return [ + { label: i18n.t('9b7fb994.4707ba'), key: 'padded', component: 'switch', value: false }, + { + label: i18n.t('9b7fb994.f417a5'), + key: 'show_nearby_merchants', + component: 'switch', + value: false + }, + { + label: i18n.t('9b7fb994.35f408'), + key: 'merchantsNumber', + component: 'number', + value: 4, + min: 1, + max: 100 + }, + { + label: i18n.t('9b7fb994.81756c'), + key: 'quantityNumber', + component: 'number', + value: 4, + min: 1, + max: 100 + } + ] +} + const config = { name: 'shop', setting: [ @@ -22,13 +76,17 @@ const config = { label: i18n.t('ca99873f.185f7b'), key: 'dataType', component: 'select', - options: [{ label: i18n.t('ca99873f.fcf7d8'), value: 'specify' }], + options: [ + { label: i18n.t('ca99873f.fcf7d8'), value: 'specify' }, + { label: i18n.t('5e1ae7f2.0c0d95'), value: 'nearby' } + ], value: 'specify', onchange: function (e, vm) { - vm.value.data = [] + if (e === 'nearby') { + vm.value.data = [] + } } }, - { label: i18n.t('ca99873f.e7af71'), key: 'data', @@ -38,117 +96,86 @@ const config = { v-model={this.value[key]} on-change={() => { if (this.value[key].id === '') { - this.value['items'] = [] - this.value['tags'] = [] + this.value.items = [] + this.value.tags = [] } }} /> ) }, value: [], - isShow: function () { + isShow() { return this.value.dataType === 'specify' } - } - // { - // label: '组件外边距', - // key: 'outerMargin', - // component: function (h, { key }) { - // return ( - // - // ) - // }, - // value: { - // paddedt: 10, - // paddedb: 10 - // } - // }, - // { - // label: '组件内边距', - // key: 'innerPadding', - // component: function (h, { key }) { - // return ( - // - // ) - // }, - // value: { - // paddedt: 10, - // paddedb: 10, - // paddedl: 10, - // paddedr: 10 - // } - // }, - // { - // label: '组件外背景', - // key: 'outerBackground', - // component: function (h, { key }) { - // return - // }, - // value: { color: '#f8f8f8', image: '' } - // }, - // { - // label: '组件内背景', - // key: 'innerBackground', - // component: function (h, { key }) { - // return - // }, - // value: { type: 'solid', color: '#ffffff', startColor: '#ffffff', endColor: '#ffffff' } - // } + }, + ...buildNearbySetting().map((item) => ({ + ...item, + isShow() { + return this.value.dataType === 'nearby' + } + })) ], transformIn: (v) => { - const { name, base, data, meber_tags = [], no_meber_tags = [], tagsType } = v - // 使用公共函数处理 base 中的样式数据转换 + const nearby = isNearbyDataType(v, v) + const base = v.base || {} const transformedBase = transformInBase(base, ['outerMargin', 'innerPadding']) - return { + const tags = { + type: v.tagsType || '2', + meber_tags: v.meber_tags || [], + no_meber_tags: v.no_meber_tags || [] + } + const common = { id: v?.id, - name, + name: 'shop', + dataType: nearby ? 'nearby' : base.dataType || 'specify', ...transformedBase, - data: data, - tags: { - type: tagsType || '2', - meber_tags: meber_tags || [], - no_meber_tags: no_meber_tags || [] + wgtCustName: base.wgtCustName ?? '', + track: v.track ?? base.track ?? '', + tags + } + if (nearby) { + return { + ...common, + data: [], + title: base.title ?? '', + subtitle: base.subtitle ?? '', + padded: base.padded ?? false, + show_nearby_merchants: base.show_nearby_merchants ?? false, + merchantsNumber: base.merchantsNumber ?? 4, + quantityNumber: base.quantityNumber ?? 4 } } + return { + ...common, + data: v.data || [], + padded: false, + show_nearby_merchants: false, + merchantsNumber: 4, + quantityNumber: 4, + title: '', + subtitle: '' + } }, transformOut: (v, wgtList, regionauth_id) => { - return pickBy(v, { + const nearby = v.dataType === 'nearby' + const baseKeys = nearby + ? SHARED_BASE_KEYS + : SHARED_BASE_KEYS.filter((k) => !NEARBY_SETTING_KEYS.includes(k)) + const out = { id: 'id', - name: 'name', - base: (v) => { - // 使用公共函数处理 outerMargin 和 innerPadding 转换,同时保留其他字段 - const baseData = createTransformOutBase( - [ - 'dataType', - 'outerMargin', - 'innerPadding', - 'outerBackground', - 'innerBackground', - 'wgtCustName', - 'track' - ], - ['outerMargin', 'innerPadding'] - )(v) - return baseData - }, - data: 'data', + name: () => 'shop', + base: createTransformOutBase(baseKeys, ['outerMargin', 'innerPadding']), meber_tags: 'tags.meber_tags', no_meber_tags: 'tags.no_meber_tags', tagsType: 'tags.type', noRegionauth: !regionauth_id - }) + } + if (nearby) { + out.data = () => [] + } else { + out.data = 'data' + } + return pickBy(v, out) } } diff --git a/src/view/decorate/wgts/wgt_shop/index.vue b/src/view/decorate/wgts/wgt_shop/index.vue index fbb7796..6654ffa 100644 --- a/src/view/decorate/wgts/wgt_shop/index.vue +++ b/src/view/decorate/wgts/wgt_shop/index.vue @@ -4,21 +4,21 @@
-
{{ item?.name || 'ADIDAS' }}
+
{{ shopName(shop) }}
@@ -28,19 +28,23 @@
-
+
-
{{ item?.item_name || i18n.t('1d819fcf.1fd1d5') }}
+
{{ product?.item_name || i18n.t('1d819fcf.1fd1d5') }}
¥ - {{ item?.price / 100 }} - {{ item?.market_price / 100 }} + {{ (product?.price || 0) / 100 }} + {{ (product?.market_price || 0) / 100 }}
@@ -63,7 +67,23 @@ import { i18n } from '@/i18n' import config from './config' import { getOuterStyle, getInnerStyle } from '../../comps/style-utils' + const defaultShopLogo = require('@/assets/imgs/decorate/default-shop-logo.png') + +const NEARBY_PLACEHOLDER_PRODUCT = { + item_name: '', + price: 19900, + market_price: 29900, + pics: [], + tags: ['4折', '活动标'] +} + +function clampCount(n, fallback = 4, max = 100) { + const num = Number(n) + if (!Number.isFinite(num) || num < 1) return fallback + return Math.min(Math.floor(num), max) +} + export default { name: 'Shop', wgtName: i18n.t('1d819fcf.295713'), @@ -75,9 +95,32 @@ export default { value: [Object, Array] }, data() { - return { i18n, currentIndex: 1, defaultShopLogo, distributorData: null } + return { + i18n, + defaultShopLogo, + distributorData: [] + } }, computed: { + isNearbyType() { + return this.value?.dataType === 'nearby' + }, + nearbyMerchantsCount() { + return clampCount(this.value?.merchantsNumber) + }, + nearbyProductsCount() { + return clampCount(this.value?.quantityNumber) + }, + displayShops() { + if (this.isNearbyType) { + return Array.from({ length: this.nearbyMerchantsCount }, (_, index) => ({ + _placeholder: true, + distributor_id: `nearby-placeholder-${index}`, + name: i18n.t('5e1ae7f2.0c0d95') + })) + } + return this.value?.data || [] + }, outerStyle() { return getOuterStyle(this.value) }, @@ -86,32 +129,61 @@ export default { } }, watch: { - value: { - handler(newVal) {}, - immediate: true, - deep: true - }, 'value.data': { handler(newVal) { - if (newVal.length > 0) { - this.getList() + if (!this.isNearbyType && newVal && newVal.length > 0) { + this.loadSpecifyGoods() + } else if (!this.isNearbyType) { + this.distributorData = [] } }, immediate: true, deep: true + }, + 'value.dataType'() { + if (!this.isNearbyType) { + this.loadSpecifyGoods() + } else { + this.distributorData = [] + } } }, - created() {}, methods: { - async getList() { - const query = { - data_type: 'distributor', - data_value: this.value?.data[0]?.distributor_id + shopRowKey(shop, index) { + return shop.distributor_id || shop.id || `shop-${index}` + }, + shopLogo(shop) { + return shop.logo || this.defaultShopLogo + }, + shopName(shop) { + return shop.name || shop.distributor_name || 'ADIDAS' + }, + productsForShop(shop) { + if (this.isNearbyType) { + return Array.from({ length: this.nearbyProductsCount }, () => ({ + ...NEARBY_PLACEHOLDER_PRODUCT, + item_name: i18n.t('1d819fcf.1fd1d5') + })) } - console.log(this.value?.data, 'getSeckdistributorilldata') - const res = await this.$api.template.getShelvesGoods(query) - console.log(res, 'getSeckdistributorilldata') - this.distributorData = res + return this.distributorData || [] + }, + productImage(product) { + return product?.pics && product.pics.length > 0 ? product.pics[0] : '' + }, + productTags(product) { + return product?.tags || ['4折', '活动标'] + }, + async loadSpecifyGoods() { + const first = this.value?.data?.[0] + if (!first?.distributor_id) { + this.distributorData = [] + return + } + const res = await this.$api.template.getShelvesGoods({ + data_type: 'distributor', + data_value: first.distributor_id + }) + this.distributorData = res || [] } } } diff --git a/src/view/mall/aftersales/list.vue b/src/view/mall/aftersales/list.vue index 6bb2f98..676d92e 100755 --- a/src/view/mall/aftersales/list.vue +++ b/src/view/mall/aftersales/list.vue @@ -187,6 +187,8 @@ @@ -282,7 +284,7 @@ export default { ], aftersalesRemindForm: { intro: '', - is_open: false + is_open: 'false' }, aftersalesRemindVisible: false, aftersalesRemindTitle: i18n.t('4d1aec94.117b5a'), @@ -816,11 +818,17 @@ export default { }) } }, + normalizeAftersalesRemindIsOpen(value) { + return value === 'true' || value === true || value === 1 || value === '1' ? 'true' : 'false' + }, async aftersalesRemindAction() { // 请求提醒数据 const data = await this.$api.aftersales.getAftersalesRemind() if (data) { - this.aftersalesRemindForm = data + this.aftersalesRemindForm = { + intro: data.intro || '', + is_open: this.normalizeAftersalesRemindIsOpen(data.is_open) + } } this.aftersalesRemindVisible = true }, @@ -830,12 +838,12 @@ export default { handleCancel() { this.aftersalesRemindVisible = false this.aftersalesRemindForm.intro = '' - this.aftersalesRemindForm.is_open = false + this.aftersalesRemindForm.is_open = 'false' }, async submitAftersalesRemind() { let params = { intro: this.aftersalesRemindForm.intro, - is_open: this.aftersalesRemindForm.is_open + is_open: this.normalizeAftersalesRemindIsOpen(this.aftersalesRemindForm.is_open) } await this.$api.aftersales.setAftersalesRemind(params) this.$message({ @@ -843,6 +851,9 @@ export default { message: this.$t('4d1aec94.3b1083') }) this.aftersalesRemindVisible = false + this.$nextTick(() => { + this.$refs.finder?.refresh() + }) }, handleSelectionChange(val) { console.log('handleSelectionChange', val) diff --git a/src/view/marketing/employee/purchase.vue b/src/view/marketing/employee/purchase.vue index dd64350..dd49c14 100755 --- a/src/view/marketing/employee/purchase.vue +++ b/src/view/marketing/employee/purchase.vue @@ -346,6 +346,7 @@ export default { title: '', linkHome: null, share_pic: '', + list_pic: '', pic: '' }, formBaseList: [], @@ -506,6 +507,19 @@ export default { } } }, + { + label: t('39e3acc2.a8c1e2'), + key: 'list_pic', + component: () => , + tip: t('39e3acc2.818403'), + validator: (rule, value, callback) => { + if (isEmpty(self.formBase.list_pic)) { + callback(new Error(t('39e3acc2.b9d3f4'))) + } else { + callback() + } + } + }, { label: t('39e3acc2.98fbb0'), key: 'pic', @@ -1091,6 +1105,7 @@ export default { title: res.title, linkHome, share_pic: res.share_pic, + list_pic: res.list_pic || res.pic || '', pic: res.pic } @@ -1158,11 +1173,31 @@ export default { enterprise_id: res.enterprise_id }) - // res.price_display_config = {"cart_page": {"sale_price": "true", "market_price": "false", "activity_price": "false"}, "items_page": {"sale_price": "true", "market_price": "true", "activity_price": "false"}, "checkout_page": {"sale_price": "true", "market_price": "false", "activity_price": "false"}, "order_detail_page": {"sale_price": "true", "market_price": "false", "activity_price": "true"}} - //价格展示处理 const priceData = this.priceShowData(res.price_display_config, 'detail') - console.log('priceData', priceData) + const phraseMap = {} + ;(res.passphrase_enterprises || []).forEach((pe) => { + const eid = pe.enterprise_id + phraseMap[eid] = { + participate_quota: pe.participate_quota, + passphrase_code: pe.passphrase_code || '', + passphrase_limitfee: + pe.passphrase_limitfee != null && pe.passphrase_limitfee !== '' + ? Number(pe.passphrase_limitfee) / 100 + : '' + } + }) + const passphraseRows = list.map((c) => { + const pm = phraseMap[c.id] + return { + enterprise_id: c.id, + name: c.name, + enterprise_sn: c.enterprise_sn || '', + participate_quota: pm ? pm.participate_quota : '', + passphrase_code: pm ? pm.passphrase_code : '', + passphrase_limitfee: pm ? pm.passphrase_limitfee : '' + } + }) const phraseMap = {} ;(res.passphrase_enterprises || []).forEach((pe) => { @@ -1383,33 +1418,48 @@ export default { this.passphraseBatchCodeGenerating = false } }, - priceShowData(form, isDetail) { - //接口需要 - // cart_page: {sale_price: "true", market_price: "false", activity_price: "false"}, - // items_page: {sale_price: "true", market_price: "false", activity_price: "false"}, - // checkout_page: {sale_price: "true", market_price: "false", activity_price: "false"}, - // order_detail_page: {sale_price: "true", market_price: "false", activity_price: "false"} - - let keys = ['items_page', 'cart_page', 'order_detail_page', 'checkout_page'] - let prices = ['sale_price', 'market_price', 'activity_price'] - if (isDetail) { - //编辑获取详情数据处理 - return keys.reduce((prev, cur) => { - let _arr = [] - prices.forEach((item) => { - _arr = Object.keys(form[cur]).filter((item2) => form[cur][item2] == 'true') - console.log(Object.keys(form[cur])) - }) - prev[cur] = _arr - return prev - }, {}) + normalizePriceDisplayConfig(raw) { + const defaultChecked = ['sale_price', 'activity_price'] + const pageKeys = ['items_page', 'cart_page', 'order_detail_page', 'checkout_page'] + const priceKeys = ['sale_price', 'market_price', 'activity_price'] + let config = raw + if (config == null || config === '') { + config = {} + } else if (typeof config === 'string') { + try { + config = JSON.parse(config) + } catch (e) { + config = {} + } } - return keys.reduce((prev, cur) => { - let _obj = {} - prices.forEach((item) => { - _obj[item] = form[cur].includes(item) + '' - }) - prev[cur] = _obj + if (typeof config !== 'object') { + config = {} + } + return pageKeys.reduce((prev, pageKey) => { + const pageConfig = config[pageKey] + if (pageConfig && typeof pageConfig === 'object' && !Array.isArray(pageConfig)) { + prev[pageKey] = priceKeys.filter((k) => pageConfig[k] === 'true' || pageConfig[k] === true) + } else if (Array.isArray(pageConfig)) { + prev[pageKey] = pageConfig + } else { + prev[pageKey] = defaultChecked.slice() + } + return prev + }, {}) + }, + priceShowData(form, isDetail) { + const pageKeys = ['items_page', 'cart_page', 'order_detail_page', 'checkout_page'] + const priceKeys = ['sale_price', 'market_price', 'activity_price'] + if (isDetail) { + return this.normalizePriceDisplayConfig(form) + } + const normalized = this.normalizePriceDisplayConfig(form) + return pageKeys.reduce((prev, cur) => { + const checked = normalized[cur] || [] + prev[cur] = priceKeys.reduce((obj, item) => { + obj[item] = String(checked.includes(item)) + return obj + }, {}) return prev }, {}) }, @@ -1421,6 +1471,7 @@ export default { title, linkHome: { pages_template_id }, share_pic, + list_pic, pic } = this.formBase const { @@ -1458,6 +1509,7 @@ export default { title, pages_template_id, share_pic: share_pic, + list_pic: list_pic, pic: pic, enterprise_id: companyList.map((item) => item.id), display_time: preheatMoment.unix(), diff --git a/src/view/wxapp/home/index.vue b/src/view/wxapp/home/index.vue index daa3302..237d391 100755 --- a/src/view/wxapp/home/index.vue +++ b/src/view/wxapp/home/index.vue @@ -138,12 +138,15 @@ {{ $t('a066f499.79d3ab') }} + + {{ $t('a066f499.0044f6') }} diff --git a/src/views/applications/application-center/shopex-appcenter.vue b/src/views/applications/application-center/shopex-appcenter.vue new file mode 100644 index 0000000..0779fbc --- /dev/null +++ b/src/views/applications/application-center/shopex-appcenter.vue @@ -0,0 +1,546 @@ + + +