牛奶 1 månad sedan
förälder
incheckning
6d11f63446

+ 8 - 6
src/router/index.ts

@@ -52,7 +52,7 @@ export const constantRoutes: RouteRecordRaw[] = [
     component: () => import('@/views/diy/pcedit.vue'),
     hidden: true
   },
-    {
+  {
     path: '/diy/pcdiy',
     component: () => import('@/views/diy/pcdiy.vue'),
     hidden: true
@@ -82,6 +82,11 @@ export const constantRoutes: RouteRecordRaw[] = [
         component: () => import('@/views/index.vue'),
         name: 'Index',
         meta: { title: '首页', icon: 'dashboard', affix: true }
+      },
+      {
+        path: '/customerOperation/pcList',
+        component: () => import('@/views/platform/customerOperation/vipSite/pcList.vue'),
+        hidden: true
       }
       // {
       //   path: '/diy/edit',
@@ -212,14 +217,11 @@ export const constantRoutes: RouteRecordRaw[] = [
         meta: { title: '样式设置', activeMenu: '/customerOperation/vipSite', noCache: true }
       }
     ]
-  },
-
+  }
 ];
 
 // 动态路由,基于用户权限动态去加载
-export const dynamicRoutes: RouteRecordRaw[] = [
-
-];
+export const dynamicRoutes: RouteRecordRaw[] = [];
 
 /**
  * 创建路由

+ 4 - 1
src/store/modules/pcdiy.ts

@@ -59,7 +59,7 @@ const usePcdiyStore: any = defineStore('pcdiy', {
           },
           margin: {
             top: 0, // 上边距
-            bottom: 0 // 下边距
+            bottom: 10 // 下边距
           },
           isHidden: false // 是否隐藏该组件 true:是,false:否,增加问号说明:勾选后该组件将隐藏,适用于你不希望看到该组件字段又不希望删除的情况;
         }
@@ -782,6 +782,9 @@ const usePcdiyStore: any = defineStore('pcdiy', {
     // 修改index值
     onIndex(index: any) {
       this.currentIndex = index;
+    },
+    resetComponent(){
+      this.currentIndex = -99;
     }
   }
 });

+ 14 - 8
src/views/diy/pcEdit.vue

@@ -44,7 +44,7 @@
             <draggable v-model="diyStore.componentList" item-key="itemKey" class="drag-area" :move="onDragMove">
               <template #item="{ element, index }">
                 <div @click="diyStore.onComponent(element, index)" class="component-bos">
-                  <!-- <div class="component-box" :style="{ borderWidth: diyStore.currentIndex == index ? '2px' : '0px' }"></div> -->
+                  <div class="component-box" :style="{ borderWidth: diyStore.currentIndex == index ? '2px' : '0px' }"></div>
                   <component :is="element.components" :key="element.itemKey" :index="index"></component>
                 </div>
               </template>
@@ -57,13 +57,13 @@
             <el-tooltip effect="light" content="下移" placement="right">
               <icon name="iconfont iconjiantouxia" size="20px" class="block cursor-pointer leading-[40px]" @click="diyStore.moveDownComponent" />
             </el-tooltip>
-            <el-tooltip effect="light" content="复制" placement="right">
+            <!-- <el-tooltip effect="light" content="复制" placement="right">
               <icon name="iconfont iconcopy-line" size="20px" class="block cursor-pointer leading-[40px]" @click="diyStore.copyComponent" />
-            </el-tooltip>
+            </el-tooltip> -->
             <el-tooltip effect="light" content="删除" placement="right">
               <icon name="iconfont icondelete-line" size="20px" class="block cursor-pointer leading-[40px]" @click="diyStore.delComponent" />
             </el-tooltip>
-            <el-tooltip effect="light" content="置" placement="right">
+            <el-tooltip effect="light" content="页面设置" placement="right">
               <icon name="iconfont iconloader-line" size="20px" class="block cursor-pointer leading-[40px]" @click="diyStore.resetComponent" />
             </el-tooltip>
           </div>
@@ -197,19 +197,21 @@ const loading = ref<any>(false);
 const id = ref<any>(null);
 const activeNames = ref<any>([0]);
 const collapse = ref<any>([]);
+const siteId = ref<any>(null);
+const clientId = ref<any>(null);
 
 onMounted(() => {
   loadComponents();
   if (query.id) {
     id.value = query.id;
-    diyStore.backgroundColor = '#f2f2f2';
-    diyStore.hoverColor = '#E7000B';
   } else {
     id.value = null;
     diyStore.type = query.type;
     diyStore.name = query.title;
     diyStore.backgroundColor = '#f2f2f2';
     diyStore.hoverColor = '#E7000B';
+    if (query.siteId) siteId.value = query.siteId;
+    if (query.clientId) clientId.value = query.clientId;
   }
 });
 
@@ -222,6 +224,8 @@ const loadComponents = async () => {
       if (res.code == 200) {
         diyStore.name = res.data.name;
         diyStore.type = res.data.type;
+        diyStore.backgroundColor = res.data.backgroundColor ? res.data.backgroundColor : '#f2f2f2';
+        diyStore.hoverColor = res.data.hoverColor ? res.data.hoverColor : '#E7000B';
         diyStore.currentIndex = -99;
 
         const datas = JSON.parse(res.data.property);
@@ -284,11 +288,13 @@ const preview = () => {
 const save = (type?: number) => {
   const datas: any = {
     name: diyStore.name,
-    siteId: '',
-    clientId: '',
+    siteId: siteId.value,
+    clientId: query.clientId,
     type: diyStore.type,
     remark: '',
     previewPicUrls: '',
+    hoverColor: diyStore.hoverColor,
+    backgroundColor: diyStore.backgroundColor,
     property: JSON.stringify(diyStore.componentList),
     isHome: 1
   };

+ 1 - 1
src/views/diy/pccomponents/pages/head.vue

@@ -61,7 +61,7 @@
           }"
         >
           <div class="classify-list" v-for="(item, index) in classifyList" :key="index">
-            <div :style="{ 'color': componentData.leftColor1 }" class="label ellipsis hover-color">{{ item.label }}55</div>
+            <div :style="{ 'color': componentData.leftColor1 }" class="label ellipsis hover-color">{{ item.label }}</div>
             <div :style="{ 'color': componentData.leftColor2 }" class="info info1 ellipsis hover-color">{{ item.oneLable1 }}</div>
             <div :style="{ 'color': componentData.leftColor2 }" class="info ellipsis hover-color">{{ item.oneLable2 }}</div>
           </div>

+ 12 - 13
src/views/platform/customerOperation/vipSite/index.vue

@@ -25,12 +25,7 @@
                     style="width: 100%"
                     @focus="handleQueryCustomerFocus"
                   >
-                    <el-option
-                      v-for="item in queryCustomerList"
-                      :key="item.id"
-                      :label="`${item.customerNo} ${item.customerName}`"
-                      :value="item.id"
-                    />
+                    <el-option v-for="item in queryCustomerList" :key="item.id" :label="`${item.customerNo} ${item.customerName}`" :value="item.id" />
                   </el-select>
                 </el-form-item>
               </el-col>
@@ -122,11 +117,8 @@
               <el-link type="primary" :underline="false" @click="handleSiteConfig(scope.row)">站点配置</el-link>
               <el-link type="primary" :underline="false" @click="handleProductConfig(scope.row)">商品配置</el-link>
               <el-link type="primary" :underline="false" @click="handleStyleDesign(scope.row)">样式设计</el-link>
-              <el-link
-                :type="scope.row.status === '0' ? 'danger' : 'success'"
-                :underline="false"
-                @click="handleStatusChange(scope.row)"
-              >
+              <el-link type="primary" :underline="false" @click="handleDiy(scope.row)">diy设计</el-link>
+              <el-link :type="scope.row.status === '0' ? 'danger' : 'success'" :underline="false" @click="handleStatusChange(scope.row)">
                 {{ scope.row.status === '0' ? '停 用' : '启 用' }}
               </el-link>
             </div>
@@ -195,7 +187,7 @@ const queryParams = ref<SiteQuery & { startTimeRange?: string[]; endTimeRange?:
 
 /** 通过客户接口回显列表中的客户编号和名称 */
 const enrichListWithCustomerInfo = async () => {
-  const uniqueClientIds = [...new Set(siteList.value.map(item => item.clientId).filter(Boolean))];
+  const uniqueClientIds = [...new Set(siteList.value.map((item) => item.clientId).filter(Boolean))];
   if (uniqueClientIds.length === 0) return;
   const customerMap = new Map<string, any>();
   await Promise.all(
@@ -208,7 +200,7 @@ const enrichListWithCustomerInfo = async () => {
       } catch {}
     })
   );
-  siteList.value = siteList.value.map(item => {
+  siteList.value = siteList.value.map((item) => {
     const customer = customerMap.get(String(item.clientId));
     if (customer) {
       return { ...item, clientNo: customer.customerNo || item.clientNo, clientName: customer.customerName || item.clientName };
@@ -302,6 +294,13 @@ const handleStyleDesign = (row: SiteVO) => {
   });
 };
 
+const handleDiy = (row: any) => {
+  router.push({
+    path: '/customerOperation/pcList',
+    query: { id: row.id, clientId: row.clientId }
+  });
+};
+
 /** 状态切换 */
 const handleStatusChange = async (row: SiteVO) => {
   const newStatus = row.status === '0' ? '1' : '0';

+ 217 - 0
src/views/platform/customerOperation/vipSite/pcList.vue

@@ -0,0 +1,217 @@
+<template>
+  <div class="p-2">
+    <div class="head-card">
+      <el-card shadow="hover">
+        <el-form ref="queryFormRef" :model="queryParams" :inline="true">
+          <el-form-item label="页面名称">
+            <el-input v-model="queryParams.name" placeholder="请输入页面名称" clearable @keyup.enter="handleQuery" />
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
+            <el-button icon="Refresh" @click="resetQuery">重置</el-button>
+          </el-form-item>
+        </el-form>
+      </el-card>
+    </div>
+    <el-card shadow="hover">
+      <template #header>
+        <el-row :gutter="10" class="mb8">
+          <el-col :span="1.5">
+            <el-button v-hasPermi="['system:dict:add']" type="primary" plain icon="Plus" @click="handleAdd">添加页面</el-button>
+          </el-col>
+          <el-col :span="1.5">
+            <el-button v-hasPermi="['system:dict:remove']" type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()">
+              删除
+            </el-button>
+          </el-col>
+        </el-row>
+      </template>
+      <el-table v-loading="loading" border :data="dataList">
+        <el-table-column label="页面名称" align="center" prop="name" :show-overflow-tooltip="true" />
+        <el-table-column label="页面类型" align="center" :show-overflow-tooltip="true">
+          <template #default="scope">
+            {{
+              scope.row.type == 1
+                ? '平台商城'
+                : scope.row.type == 2
+                  ? '工业品商城'
+                  : scope.row.type == 3
+                    ? '福利商城'
+                    : scope.row.type == 4
+                      ? '客户站点商城'
+                      : ''
+            }}
+          </template>
+        </el-table-column>
+        <el-table-column label="状态" align="center" width="150">
+          <template #default="scope">
+            {{ scope.row.isHome == 1 ? '开启' : '关闭' }}
+          </template>
+        </el-table-column>
+        <el-table-column label="更新时间" align="center" :show-overflow-tooltip="true" width="200">
+          <template #default="scope">
+            {{ scope.row.updateTime }}
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
+          <template #default="scope">
+            <el-tooltip content="修改" placement="top">
+              <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"></el-button>
+            </el-tooltip>
+            <el-tooltip content="删除" placement="top">
+              <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"></el-button>
+            </el-tooltip>
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination v-show="total > 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" :total="total" @pagination="getList" />
+    </el-card>
+
+    <!--添加页面-->
+    <el-dialog v-model="dialogVisible" title="创建新页面" width="400px">
+      <el-form :model="formData" label-width="90px" ref="formRef" :rules="formRules">
+        <el-form-item label="页面名称" prop="title">
+          <el-input v-model.trim="formData.title" placeholder="请输入标题" clearable maxlength="12" show-word-limit class="w-full" />
+        </el-form-item>
+        <el-form-item label="页面类型" prop="type">
+          <el-select v-model="formData.type" placeholder="请选择页面类型" class="!w-full">
+            <el-option label="平台商城" :value="1" />
+            <el-option label="工业品商城" :value="2" />
+            <el-option label="福利商城" :value="3" />
+            <el-option label="客户站点商城" :value="4" />
+          </el-select>
+        </el-form-item>
+      </el-form>
+
+      <template #footer>
+        <span class="dialog-footer">
+          <el-button @click="dialogVisible = false">取消</el-button>
+          <el-button type="primary" @click="addEvent(formRef)">确认</el-button>
+        </span>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup lang="ts">
+import { pcDiyList, template, pcDelDiy } from '@/api/diy/index';
+import { FormInstance } from 'element-plus';
+const route = useRoute();
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const dataList = ref<any[]>([]);
+const loading = ref(true);
+const multiple = ref(true);
+const total = ref(0);
+
+const pageType: any = reactive({}); // 页面类型
+const dialogVisible = ref(false);
+const formRef = ref<FormInstance>();
+// 添加自定义页面
+const formData = reactive({
+  title: '',
+  type: ''
+});
+// 表单验证规则
+const formRules = computed(() => {
+  return {
+    title: [{ required: true, message: '请输入标题', trigger: 'blur' }],
+    type: [{ required: true, message: '请选择页面类型', trigger: 'blur' }]
+  };
+});
+
+const queryParams = ref<any>({
+  pageNum: 1,
+  pageSize: 10,
+  title: '',
+  addon_name: '',
+  type: ''
+});
+
+/** 查询字典类型列表 */
+const getList = () => {
+  loading.value = true;
+  pcDiyList(queryParams.value).then((res) => {
+    if (res.code == 200) {
+      dataList.value = res.rows;
+      total.value = res.total;
+      loading.value = false;
+    }
+  });
+};
+
+/** 表单重置 */
+const reset = () => {};
+/** 搜索按钮操作 */
+const handleQuery = () => {
+  queryParams.value.pageNum = 1;
+  getList();
+};
+/** 重置按钮操作 */
+const resetQuery = () => {
+  handleQuery();
+};
+/** 新增按钮操作 */
+const router = useRouter();
+const handleAdd = () => {
+  // dialogVisible.value = true;
+  const url = router.resolve({
+    path: '/diy/pcEdit',
+    query: {
+      clientId: queryParams.value.clientId,
+      siteId: queryParams.value.siteId,
+      type: 4,
+      title: '客户站点商城Diy'
+    }
+  });
+  window.open(url.href);
+};
+/** 修改按钮操作 */
+const handleUpdate = async (row?: any) => {
+  const query = { id: row.id };
+  const url = router.resolve({
+    path: '/diy/pcedit',
+    query
+  });
+  window.open(url.href);
+};
+/** 删除按钮操作 */
+const handleDelete = async (row?: any) => {
+  await proxy?.$modal.confirm('是否确认删除"' + row.name + '"的diy数据项?').finally(() => (loading.value = false));
+  await pcDelDiy(row.id);
+  proxy?.$modal.msgSuccess('删除成功');
+  getList();
+};
+
+const addEvent = async (formEl: FormInstance | undefined) => {
+  if (!formEl) return;
+
+  await formEl.validate(async (valid) => {
+    if (valid) {
+      const query = { type: formData.type, title: formData.title };
+      const url = router.resolve({
+        path: '/diy/pcedit',
+        query
+      });
+      window.open(url.href);
+      dialogVisible.value = false;
+      formData.title = '';
+      formData.type = '';
+    }
+  });
+};
+onMounted(() => {
+  queryParams.value.type = 4;
+  queryParams.value.clientId = route.query.clientId;
+  queryParams.value.siteId = route.query.id;
+  getList();
+});
+</script>
+
+<style lang="scss" scoped>
+.head-card {
+  margin-bottom: 20px;
+  :deep(.el-card__body) {
+    padding-bottom: 0px !important;
+  }
+}
+</style>