From 357a4c941549c9d65d74629c38b989683f5db0b4 Mon Sep 17 00:00:00 2001
From: seatonwan9
Date: 星期一, 18 八月 2025 13:50:25 +0800
Subject: [PATCH] 提交源码

---
 src/views/layout/components/sideBar/index.vue |   12 -
 src/views/pointsManage/ruleDetail/index.vue   |  389 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/router/modules/productPriceManage.ts      |    2 
 src/views/productManage/price/index.vue       |    2 
 4 files changed, 393 insertions(+), 12 deletions(-)

diff --git a/src/router/modules/productPriceManage.ts b/src/router/modules/productPriceManage.ts
index 78f9a3b..7a32c8a 100644
--- a/src/router/modules/productPriceManage.ts
+++ b/src/router/modules/productPriceManage.ts
@@ -1,5 +1,5 @@
 export default {
-  path: 'productPrice/',
+  path: 'product/',
   name: 'productPrice',
   children: [
     {
diff --git a/src/views/layout/components/sideBar/index.vue b/src/views/layout/components/sideBar/index.vue
index 33e2398..deb2260 100644
--- a/src/views/layout/components/sideBar/index.vue
+++ b/src/views/layout/components/sideBar/index.vue
@@ -73,18 +73,10 @@
     {
         "id": "4fa90aab-2e3c-4bc4-abbf-fbe536629fb0",
         "icon": "",
-        "name": "绉垎璁剧疆鍒楄〃",
+        "name": "绉垎璁剧疆",
         "url": "/points/ruleList",
         "parentId": "266e3ff1-ca98-4946-8975-8526ef83cd2a",
         "sort": "1"
-    },
-    {
-        "id": "4fa90aab-2e3c-4bc4-abbf-fbe536629fb1",
-        "icon": "",
-        "name": "绉垎璁剧疆",
-        "url": "/points/settings",
-        "parentId": "266e3ff1-ca98-4946-8975-8526ef83cd2a",
-        "sort": "2"
     },
     {
         "id": "14a70ce4-7ce0-40d4-8480-2e590f146002",
@@ -184,7 +176,7 @@
         "id": "4fa90aab-2e3c-4bc4-abbf-fbe516729fa2",
         "icon": "",
         "name": "浜у搧鍒楄〃",
-        "url": "/productPrice/list",
+        "url": "/product/list",
         "parentId": "266e3ff1-ca98-4946-8975-7526ef83cd5c",
         "sort": "1"
     }]
diff --git a/src/views/pointsManage/ruleDetail/index.vue b/src/views/pointsManage/ruleDetail/index.vue
new file mode 100644
index 0000000..1f5feca
--- /dev/null
+++ b/src/views/pointsManage/ruleDetail/index.vue
@@ -0,0 +1,389 @@
+<template>
+  <div class="points-settings">
+    <div class="settings-content">
+      <!-- 宸︿晶锛氱Н鍒嗚幏鍙栬鍒� -->
+      <div class="left-column">
+        <el-card class="rule-section" shadow="never">
+          <template #header>
+            <div class="card-header">
+              <span class="section-title">绉垎鑾峰彇瑙勫垯</span>
+            </div>
+          </template>
+
+          <!-- 璧勬簮璐$尞 -->
+          <div class="rule-category" v-for="rule in rules.getPointsRuleList">
+            <h4>{{ rule.category}}</h4>
+            <div class="rule-subcategory">
+              <div class="rule-items">
+              <div class="rule-item" v-for="pointRuleDetial in rule.pointsRules">
+                <span class="rule-desc">{{ pointRuleDetial.ruleName }} : {{ pointRuleDetial.ruleDescription}} </span>
+                <el-input
+                  v-model="pointRuleDetial.pointsValue"
+                  size="small"
+                  style="width: 80px;"
+                  placeholder="璇疯緭鍏�"
+                  readonly
+                />
+                <span class="unit">绉垎</span>
+                <span class="unit" v-if="pointRuleDetial.isLimit === 1">,姣忔棩绉垎涓婇檺</span>
+                <el-input
+                  v-model="pointRuleDetial.dailyLimit"
+                  size="small"
+                  style="width: 80px;"
+                  placeholder="璇疯緭鍏�"
+                  readonly
+                   v-if="pointRuleDetial.isLimit === 1"
+                />
+              </div>
+              </div>
+            </div>
+          </div>
+
+        </el-card>
+      </div>
+
+      <!-- 鍙充晶锛氱Н鍒嗘秷鑰楄鍒欏拰绉垎杞崲瑙勫垯 -->
+      <div class="right-column">
+        <!-- 绉垎娑堣�楄鍒� -->
+        <el-card class="rule-section" shadow="never">
+          <template #header>
+            <div class="card-header">
+              <span class="section-title">绉垎娑堣�楄鍒�</span>
+            </div>
+          </template>
+
+          <!-- 璧勬簮浼犳挱 -->
+          <div class="rule-category" v-for="consumeRule in rules.consumePointsRuleList">
+            <h4>{{ consumeRule.category }}</h4>
+            <div class="rule-subcategory">
+            <div class="rule-items">
+              <div class="rule-item" v-for="pointRuleDetials in consumeRule.pointsRules">
+                <span class="rule-desc">{{ pointRuleDetials.ruleName }} : {{ pointRuleDetials.ruleDescription}}</span>
+                <el-input
+                  v-model="pointRuleDetials.pointsValue"
+                  size="small"
+                  style="width: 60px;"
+                  placeholder="璇疯緭鍏�"
+                  readonly
+                />
+                <span class="unit">绉垎</span>
+                <span class="unit" v-if="pointRuleDetials.isLimit === 1">,姣忔棩绉垎涓婇檺</span>
+                  <el-input
+                          v-model="pointRuleDetials.dailyLimit"
+                          size="small"
+                          style="width: 80px;"
+                          placeholder="璇疯緭鍏�"
+                          readonly
+                          v-if="pointRuleDetials.isLimit === 1"
+                  />
+              </div>
+            </div>
+            </div>
+          </div>
+
+        </el-card>
+      </div>
+    </div>
+
+    <!-- 搴曢儴鎸夐挳 -->
+    <div class="bottom-actions">
+      <el-button @click="goBack" size="large">杩斿洖</el-button>
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+import { ref, onMounted, watch } from 'vue'
+import { useRoute } from 'vue-router'
+import { ElMessage } from 'element-plus'
+import pointsApi from '../../../api/pointsApi'
+
+// 瀹氫箟props
+interface Props {
+  ruleId?: string
+}
+
+const props = withDefaults(defineProps<Props>(), {
+  ruleId: ''
+})
+
+// 瀹氫箟emits
+const emit = defineEmits<{
+  goBack: []
+}>()
+
+// 鑾峰彇璺敱瀹炰緥
+const route = useRoute()
+// 鑾峰彇璺敱鍙傛暟涓殑瑙勫垯id锛屼紭鍏堜娇鐢╬rops涓殑ruleId
+const ruleId = props.ruleId || (route.query.ruleId as string)
+
+interface PointRule {
+  category: string,
+  pointsRules: PointRuleDetial[]
+}
+interface PointRuleDetial {
+  category: string,
+  id: number,
+  ruleDescription: string,
+  ruleName: string,
+  createdAt: string,
+  ruleType: number,
+  pointsWinner: number,
+  isLimit: number,
+  pointsValue: number,
+  dailyLimit: number
+}
+
+// 绉垎瑙勫垯閰嶇疆
+interface PointsRules {
+  getPointsRuleList: PointRule[],
+  consumePointsRuleList: PointRule[]
+}
+
+const rules = ref<PointsRules>({
+  consumePointsRuleList: [],
+  getPointsRuleList: []
+})
+
+// 鑾峰彇绉垎瑙勫垯閰嶇疆
+const getPointsRules = async () => {
+  try {
+    if (ruleId) {
+      // 濡傛灉鏈塺uleId鍙傛暟锛屽垯鑾峰彇鐗瑰畾瑙勫垯
+      const formData = new URLSearchParams();
+      formData.append('ruleId', ruleId);
+
+      const res = await pointsApi.getPointsRuleById(formData)
+      if (res.code === 200 && res.data) {
+        // 灏嗗悗绔暟鎹槧灏勫埌鍓嶇瑙勫垯瀵硅薄
+        Object.assign(rules.value, res.data)
+        console.log(rules.value)
+      }
+    } else {
+      // 濡傛灉娌℃湁ruleId鍙傛暟锛屽垯鑾峰彇鎵�鏈夎鍒�
+      const res = await pointsApi.getPointsRules({})
+      if (res.code === 200 && res.data) {
+        // 灏嗗悗绔暟鎹槧灏勫埌鍓嶇瑙勫垯瀵硅薄
+        Object.assign(rules.value, res.data)
+      }
+    }
+  } catch (error) {
+    console.error('鑾峰彇绉垎瑙勫垯澶辫触:', error)
+  }
+}
+
+// 杩斿洖涓婁竴椤�
+const goBack = () => {
+  // 濡傛灉鏄粠缁勪欢璋冪敤锛屽彂鍑篻oBack浜嬩欢
+  if (props.ruleId) {
+    emit('goBack')
+  } else {
+    // 鍚﹀垯浣跨敤鍘熸湁鐨勮繑鍥為�昏緫
+    history.back()
+  }
+}
+
+// 鐩戝惉ruleId鍙樺寲
+watch(() => props.ruleId, (newRuleId) => {
+  if (newRuleId) {
+    getPointsRules()
+  }
+}, { immediate: true })
+
+onMounted(() => {
+  // 鍙湁鍦ㄦ病鏈塸rops.ruleId鏃舵墠鎵ц鍘熸湁鐨勯�昏緫
+  if (!props.ruleId) {
+    getPointsRules()
+  }
+})
+</script>
+
+<style scoped lang="scss">
+.points-settings {
+  padding: 20px;
+  background-color: #f5f5f5;
+  min-height: 100vh;
+  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
+
+  .page-header {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    margin-bottom: 20px;
+    padding: 16px 20px;
+    background: white;
+    border-radius: 8px;
+    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
+
+    .breadcrumb {
+      display: flex;
+      align-items: center;
+      gap: 8px;
+
+      .back-arrow {
+        cursor: pointer;
+        color: #409eff;
+        font-size: 18px;
+
+        &:hover {
+          color: #66b1ff;
+        }
+      }
+
+      .title {
+        font-size: 16px;
+        font-weight: 500;
+        color: #303133;
+      }
+    }
+
+    .actions {
+      display: flex;
+      gap: 12px;
+    }
+  }
+
+  .settings-content {
+    display: flex;
+    gap: 20px;
+    max-width: 1665px;
+    margin: 0 auto;
+    margin-bottom: 40px;
+
+    @media (max-width: 768px) {
+      flex-direction: column;
+      gap: 16px;
+    }
+  }
+
+  .bottom-actions {
+    display: flex;
+    justify-content: center;
+    gap: 20px;
+    padding: 20px 0;
+
+    .el-button {
+      min-width: 120px;
+      height: 40px;
+      font-size: 14px;
+    }
+  }
+
+  .left-column {
+    flex: 1;
+    max-width: 50%;
+
+    @media (max-width: 768px) {
+      max-width: 100%;
+    }
+  }
+
+  .right-column {
+    flex: 1;
+    max-width: 50%;
+    display: flex;
+    flex-direction: column;
+    gap: 20px;
+
+    @media (max-width: 768px) {
+      max-width: 100%;
+      gap: 16px;
+    }
+  }
+
+  .rule-section {
+    border-radius: 8px;
+    border: 1px solid #e4e7ed;
+
+    .card-header {
+      .section-title {
+        font-size: 16px;
+        font-weight: 600;
+        color: #656D9A;
+      }
+    }
+  }
+
+  .rule-category {
+    margin-bottom: 24px;
+
+    h4 {
+      font-size: 14px;
+      font-weight: 600;
+      color: #303133;
+      margin: 0 0 16px 0;
+      padding-bottom: 8px;
+      border-bottom: 1px solid #ebeef5;
+      background-color: #f8f9fa;
+      padding: 8px 12px;
+      border-radius: 4px;
+      border-left: 3px solid #409eff;
+    }
+
+    .rule-subcategory {
+      margin-left: 16px;
+      margin-bottom: 16px;
+
+      h5 {
+        font-size: 13px;
+        font-weight: 500;
+        color: #606266;
+        margin: 0 0 12px 0;
+        padding-left: 8px;
+      }
+    }
+
+    .rule-items {
+      display: flex;
+      flex-direction: column;
+      margin-left: 16px;
+      gap: 8px;
+    }
+
+    .rule-item {
+      display: flex;
+      align-items: center;
+      gap: 6px;
+      padding: 6px 8px;
+      border-radius: 4px;
+      transition: background-color 0.2s;
+
+      &:hover {
+        background-color: #f5f7fa;
+      }
+
+      .rule-desc {
+        font-size: 13px;
+        color: #606266;
+        line-height: 1.4;
+      }
+
+      .unit {
+        font-size: 13px;
+        color: #606266;
+        white-space: nowrap;
+      }
+
+      :deep(.el-input) {
+        .el-input__wrapper {
+          box-shadow: 0 0 0 1px #dcdfe6 inset;
+          background-color: #f5f7fa;
+
+          &:hover {
+            box-shadow: 0 0 0 1px #c0c4cc inset;
+          }
+
+          &.is-focus {
+            box-shadow: 0 0 0 1px #409eff inset;
+          }
+        }
+
+        .el-input__inner {
+          color: #606266;
+          cursor: not-allowed;
+        }
+      }
+    }
+  }
+}
+</style> 
\ No newline at end of file
diff --git a/src/views/productManage/price/index.vue b/src/views/productManage/price/index.vue
index 1aad86e..0cecbf8 100644
--- a/src/views/productManage/price/index.vue
+++ b/src/views/productManage/price/index.vue
@@ -17,7 +17,7 @@
         </div>
       </template>
 
-      <el-descriptions v-if="productDetail" :column="3" border>
+      <el-descriptions v-if="productDetail" :column="2" border>
         <el-descriptions-item label="浜у搧鍚嶇О">{{ productDetail.name }}</el-descriptions-item>
         <el-descriptions-item label="鎻愭姤鍗曚綅">{{ productDetail.submitUnit }}</el-descriptions-item>
         <el-descriptions-item label="鎻愭姤浜�">{{ productDetail.submitter }}</el-descriptions-item>

--
Gitblit v1.8.0