多商户新增diy页面

master
gongfuxiang 2025-08-09 13:36:44 +08:00
parent e86c233441
commit 79ea628f69
3 changed files with 225 additions and 2 deletions

View File

@ -1270,6 +1270,26 @@
"navigationBarTitleText": ""
}
},
{
"path": "diy/diy",
"style": {
// #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ || MP-KUAISHOU || H5 || APP
"navigationStyle": "custom",
// #endif
// #ifdef MP-ALIPAY
"transparentTitle": "always",
"titlePenetrate": "YES",
// #endif
"enablePullDownRefresh": true,
"navigationBarTitleText": "",
"usingComponents": {
"component-diy": "/pages/diy/components/diy/diy"
},
"componentPlaceholder": {
"component-diy": "view"
}
}
},
{
"path": "design/design",
"style": {

View File

@ -244,10 +244,10 @@
</view>
</view>
<view class="bg-white padding-sm border-radius-main spacing-mb">
<!-- <view class="bg-white padding-sm border-radius-main spacing-mb">
<view>form - input -data</view>
<component-form-input-base ref="form_input_base" :propConfig="order_goods_form_data_config" @onItemEvent="order_goods_form_back_item_event" @onSubmitEvent="order_goods_form_back_data_event"></component-form-input-base>
</view>
</view> -->
</view>

View File

@ -0,0 +1,203 @@
<template>
<view :class="theme_view">
<block v-if="(data || null) != null && (data.config || null) != null">
<!-- diy模块 -->
<component-diy :propValue="data.config" :propDataId="data.id" :propKey="random_value" @onLocationBack="user_back_choice_location">
<!-- 底部内容 -->
<template slot="diy-bottom-content">
<!-- 结尾 -->
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
</template>
<!-- 底部公共 -->
<template slot="diy-bottom-common">
<component-common ref="common"></component-common>
</template>
</component-diy>
</block>
<block v-else>
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
</block>
</view>
</template>
<script>
const app = getApp();
import componentCommon from '@/components/common/common';
import componentDiy from '@/pages/diy/components/diy/diy';
import componentNoData from '@/components/no-data/no-data';
import componentBottomLine from '@/components/bottom-line/bottom-line';
export default {
components: {
componentCommon,
componentDiy,
componentNoData,
componentBottomLine,
},
data() {
return {
theme_view: app.globalData.get_theme_value_view(),
data_bottom_line_status: false,
data_list_loding_status: 1,
data_list_loding_msg: '',
load_status: 0,
params: null,
data: null,
//
share_info: {},
//
random_value: 0,
};
},
onLoad(params) {
//
app.globalData.page_event_onload_handle(params);
//
this.setData({
params: app.globalData.launch_params_handle(params),
});
},
onShow() {
//
app.globalData.page_event_onshow_handle();
//
this.get_data();
// onshow
this.init_common();
//
this.set_navigation_bar_color();
},
//
onPullDownRefresh() {
this.get_data();
},
methods: {
//
init_common() {
// onshow
if ((this.$refs.common || null) != null) {
this.$refs.common.on_show();
}
},
//
get_data(params = {}) {
//
var cache_key = app.globalData.data.cache_diy_page_data_key+'_shop_diy_' + (this.params.id || 0);
if (this.load_status == 0) {
//
var upd_data = uni.getStorageSync(cache_key) || null;
if (upd_data != null) {
// 使
this.setData(upd_data);
//
params['is_cache'] = 0;
//
this.set_navigation_bar_color();
// onshow
this.init_common();
}
} else {
//
params['is_cache'] = 0;
}
uni.request({
url: app.globalData.get_request_url('index', 'diy', 'shop'),
method: 'POST',
data: { ...this.params, ...params },
dataType: 'json',
success: (res) => {
uni.stopPullDownRefresh();
if (res.data.code == 0) {
var data = res.data.data;
var upd_data = {
data: data.data || null,
data_list_loding_msg: '',
data_list_loding_status: 0,
data_bottom_line_status: true,
random_value: Math.random(),
};
this.setData(upd_data);
//
uni.setStorageSync(cache_key, upd_data);
//
if (parseInt(data.is_result_data_cache || 0) == 1) {
this.get_data({ is_cache: 0 });
}
if ((this.data || null) != null) {
//
this.setData({
share_info: {
title: this.data.name,
desc: this.data.describe,
path: '/pages/plugins/shop/diy/diy',
query: 'id=' + this.data.id,
img: this.data.logo,
},
});
//
uni.setNavigationBarTitle({
title: this.data.name,
});
//
this.set_navigation_bar_color();
// onshow
this.init_common();
}
//
app.globalData.page_share_handle(this.share_info);
} else {
this.setData({
data_bottom_line_status: false,
data_list_loding_status: 2,
data_list_loding_msg: res.data.msg,
});
}
//
this.setData({
load_status: 1,
});
},
fail: () => {
uni.stopPullDownRefresh();
this.setData({
data_bottom_line_status: false,
data_list_loding_status: 2,
load_status: 1,
data_list_loding_msg: this.$t('common.internet_error_tips'),
});
},
});
},
//
set_navigation_bar_color() {
app.globalData.set_navigation_bar_color(parseInt(app.globalData.get_key_data(this.data, 'config.header.com_data.style.function_buttons_type', 0)) == 1);
},
//
user_back_choice_location(e) {
//
this.get_data();
},
},
};
</script>
<style scoped lang="scss">
</style>