Browse Source

feat: 订单详情接口联调

Signed-off-by: tangshizhe <48740614+tangshizhe@users.noreply.github.com>
tangshizhe 3 months ago
parent
commit
9455f2f820

+ 11 - 8
src/views/create-order/components/order-detail-submodule/AuditRecords.vue

@@ -122,20 +122,23 @@ export default {
         },
         {
           label: '审核备注',
-          key: 'desc'
+          key: 'back_reason'
         }
       ],
       tableData: [
-        {
-          operator: '王小虎',
-          create_time: '2016-05-02',
-          type: '一审',
-          status: '已通过',
-          desc: '审核备注'
-        }
+        // {
+        //   operator: '王小虎',
+        //   create_time: '2016-05-02',
+        //   type: '一审',
+        //   status: '已通过',
+        //   back_reason: '审核备注'
+        // }
       ]
     }
   },
+  mounted() {
+    this.tableData = this.orderDetail?.audit || []
+  }
 }
 </script>
 <style lang="scss" scoped>

+ 3 - 3
src/views/create-order/components/order-detail-submodule/OrderDescInfo.vue

@@ -8,14 +8,14 @@
         购买主体: {{ orderInfo.buy_subject == '1' ? '个人' : '企业' }}
       </div>
       <div class="order-desc-card-info-item">
-        联系人: 张三
+        联系人: {{ orderInfo.user_nickname || '-' }}
       </div>
       <div class="order-desc-card-info-item">
-        联系人手机号: 18843323424
+        联系人手机号: {{ orderInfo.user_phone || '-' }}
       </div>
     </div>
     <div class="order-desc-card-company">
-      公司名称: 北京剑鱼
+      公司名称: {{ orderInfo.company_name || '-' }}
     </div>
   </div>
 </template>

+ 72 - 18
src/views/create-order/components/order-detail-submodule/OrderDetailCard.vue

@@ -14,24 +14,50 @@
         </div>
       </div>
       <div class="order-detail-product-list">
-        <ProductCard v-for="(product, index) in productData" :key="product.id" :title="setProductTitle(product, index)" :subtitle="product.auto !== 1 ? '该产品暂不支持系统自动开通权限,请联系运维开通': ''">
+        <ProductCard
+          v-for="(product, index) in productData"
+          :key="product.id"
+          :title="setProductTitle(product, index)"
+          :subtitle="product.auto !== 1 ? '该产品暂不支持系统自动开通权限,请联系运维开通': ''"
+          >
           <div class="order-detail-product-content">
             <div class="grouped-items">
-              <div class="order-detail-card-item" :class="`item-span-${item.span}`" v-for="(item, index) in productInfoItems" :key="index">
-                <div v-if="item.key === 'linkedOrder'" class="linkedOrder">
-                  {{ item.label }}:
-                  <TableCard :columns="linkOrderColumns"></TableCard>
+              <div
+                v-for="(item, index) in productInfoItems"
+                :key="index"
+                :class="`item-span-${item.span}`"              >
+                <div
+                  class="order-detail-card-item"
+                  v-if="shouldRenderItem(item, product)"
+                  >
+                  <div v-if="item.key === 'linkedOrder'" class="linkedOrder">
+                    {{ item.label }}:
+                    <TableCard :table-data="product[item.key]" :columns="linkOrderColumns"></TableCard>
+                  </div>
+                  <div v-if="item.key === 'final_price' || item.key === 'original_price'">
+                    {{ item.label }}:¥{{ getFilteredValue(product[item.key], item.filter) || '-' }}
+                  </div>
+                  <div v-else-if="item.key === 'validity_period'">
+                    <span v-html="getValidityPeriodHtml(product, item)"></span>
+                  </div>
+                  <div v-else-if="item.key === 'supServicelds'">
+                    {{ item.label }}:{{ getFilteredValue(product[item.key], item.filter) || '-' }}
+                  </div>
+                  <div v-else>{{ item.label }}:{{ getFilteredValue(product[item.key], item.filter) || '-' }}</div>
                 </div>
-                <div v-else-if="item.key === 'validity_period'">
-                  <span v-html="getValidityPeriodHtml(product, item)"></span>
-                </div>
-                <div v-else>{{ item.label }}:{{ getFilteredValue(product[item.key], item.filter) || '-' }}</div>
               </div>
             </div>
           </div>
         </ProductCard>
       </div>
     </InfoCard>
+    <InfoCard title="其他信息">
+      <div class="order-detail-card-content">
+        <div class="order-detail-card-item" v-for="(item, index) in otherInfoItems" :key="index">
+          {{ item.label }}:{{ getFilteredValue(orderData[item.key], item.filter) || '-' }}
+        </div>
+      </div>
+    </InfoCard>
   </div>
 </template>
 
@@ -64,10 +90,16 @@ export default {
         { label: '订单审核状态', key: 'audit_status', filter: 'orderCoursed' },
         { label: '订单状态', key: 'order_status', filter: 'orderStatus' }
       ],
+      otherInfoItems: [
+        { label: '约定支付方式', key: 'pay_way' },
+        { label: '下单渠道', key: 'order_channel_new' },
+        { label: '付款户名', key: 'payment_user'},
+        { label: '订单备注', key: 'remark' },
+      ],
       productInfoTotalItems: [
-        { label: '合同金额合计', key: 'product_name' },
-        { label: '标准售价合计', key: 'product_type'},
-        { label: '折扣率', key: 'product_price' },
+        { label: '合同金额合计', key: 'final_price_total' },
+        { label: '标准售价合计', key: 'original_price_total'},
+        { label: '折扣率', key: 'rate_total' },
         { label: '渠道佣金', key: 'product_type'},
         { label: '净合同金额合计', key: 'product_type'},
         { label: '0元订单类型', key: 'product_type'}
@@ -75,15 +107,15 @@ export default {
       productInfoItems: [
         { label: '活动产品', key: 'activity_code', span: 1 },
         { label: '付费类型', key: 'service_type', filter: 'orderServiceType', span: 3},
-        { label: '升级内容', key: 'supServicelds', span: 3 },
+        { label: '升级内容', key: 'supServicelds', span: 3, condition: (product) => product.product_type === '大会员' },
         { label: '产品规格', key: 'productName', span: 3},
         { label: '服务列表', key: 'bigServiceNames', span: 1},
         { label: '有效周期', key: 'validity_period', span: 1},
         { label: '合同金额', key: 'final_price', span: 3},
         { label: '标准售价', key: 'original_price', span: 3},
         { label: '折扣率', key: 'rate', span: 3},
-        { label: '子账号数量', key: 'product_type', span: 1},
-        { label: '主账号数量', key: 'product_type', span: 1},
+        { label: '子账号数量', key: 'subAccountCount', span: 1, condition: (product) => product.product_type === 'VIP订阅' },
+        { label: '主账号数量', key: 'mainAccountCount', span: 1, condition: (product) => product.product_type === 'VIP订阅' },
         { label: '关联订单', key: 'linkedOrder', span: 1},
         { label: '开通权益手机号', key: 'phone', span: 3},
         { label: '服务开始时间', key: 'service_starttime', span: 3},
@@ -150,9 +182,15 @@ export default {
               parsedFilter.give_cycle,
               parsedFilter.give_type
             );
+            // 设置子账号数量
+            if (product.product_type === 'VIP订阅') {
+              const countTotal = Number(product.buyAccountCount) + Number(product.giftAccountCount) || 0
+              product.subAccountCount = `付费${product.buyAccountCount || 0}个,赠送${product.giftAccountCount || 0}个,合计:${countTotal}个`
+              product.mainAccountCount = '1个';
+            }
             // 设置合同金额和标准售价
-            product.final_price = '¥' + (product.final_price / 100).toFixed(2)
-            product.original_price = '¥' + (product.original_price / 100).toFixed(2)
+            product.final_price = (product.final_price / 100).toFixed(2)
+            product.original_price = (product.original_price / 100).toFixed(2)
             return Object.assign(product, { filter: parsedFilter,  rate});
           } catch (error) {
             console.error('JSON 解析失败:', error);
@@ -160,8 +198,25 @@ export default {
           }
         })
       }
+      // 设置合同金额合计和标准售价合计
+      const totalFinalPrice = (this.productData.reduce((acc, cur) => acc + Number(cur.final_price), 0)).toFixed(2)
+      const totalOriginalPrice = (this.productData.reduce((acc, cur) => acc + Number(cur.original_price), 0)).toFixed(2)
+      this.orderData.final_price_total = '¥' + totalFinalPrice
+      this.orderData.original_price_total = '¥' + totalOriginalPrice
+      this.orderData.rate_total = (div(totalFinalPrice, totalOriginalPrice) * 100).toFixed(2) + '%'
       this.productData = this.orderDetail?.productData || []
     },
+    shouldRenderItem(item, product) {
+      if (item.condition && typeof item.condition === 'function') {
+        const conditionResult = item.condition(product)
+        console.log(conditionResult, 'conditionResult')
+        if(!conditionResult) {
+          // item.span = 0
+        }
+        return conditionResult
+      }
+      return true;
+    },
     calculateValidityPeriod(buyCycle, buyType, giveCycle, giveType) {
       let totalMonths = 0;
       let buyText = '';
@@ -239,7 +294,6 @@ export default {
         }
     },
     orderServiceType(val) {
-      console.log(val, 'orderServiceType val')
       const matchedOption = paymentTypeOptions.find(option => option.value === val);
       return matchedOption ? matchedOption.label : val; // 如果未找到匹配项,返回原始值
     },

+ 71 - 57
src/views/create-order/components/order-detail-submodule/PerformanceBelongs.vue

@@ -8,27 +8,17 @@
           :data="newPerformmaceBelongsList"
           style="width: 1108px">
           <el-table-column
-            prop="salesMan"
-            label="销售人员">
+            v-for="(item, index) in newPerformmaceBelongsColumns"
+            :key="index"
+            :prop="item.prop"
+            :label="item.label">
           </el-table-column>
-          <el-table-column
-            prop="performanceBelongDept"
-            label="业绩归属部门"
-          />
-          <el-table-column
-            prop="salesPerformance"
-            label="销售业绩"
-          />
-          <el-table-column
-            prop="salesChannel"
-            label="销售渠道"
-          />
         </el-table>
       </div>
     </InfoCard>
     <InfoCard>
       <template #title>
-        业绩变更记录<span style="font-size: 14px;line-height: 22px;">(共<span class="num-active"> 0 </span>条)</span>
+        业绩变更记录<span style="font-size: 14px;line-height: 22px;">(共<span class="num-active"> {{ performanceChangeList.length || 0 }} </span>条)</span>
         </template>
       <div class="performmace-belongs-content">
         <el-table
@@ -37,36 +27,10 @@
         :data="performanceChangeList"
         style="width: 1108px">
           <el-table-column
-            prop="operator"
-            label="操作人"
-          />
-          <el-table-column
-            prop="actionTime"
-            label="操作时间">
-          </el-table-column>
-          <el-table-column
-            prop="salesMan"
-            label="销售人员"
-          />
-          <el-table-column
-            prop="salesPerformanceChange"
-            label="销售业绩变动"
-          />
-          <el-table-column
-            prop="performanceBelongDept"
-            label="业绩归属部门"
-          />
-          <el-table-column
-            prop="performanceStatisticsTime"
-            label="业绩统计时间"
-          />
-          <el-table-column
-            prop="salesChannel"
-            label="销售渠道"
-          />
-          <el-table-column
-            prop="performanceChangeReason"
-            label="变更原因"
+            v-for="(item, index) in performanceChangeColumns"
+            :key="index"
+            :prop="item.prop"
+            :label="item.label"
           />
         </el-table>
       </div>
@@ -88,27 +52,77 @@ export default {
   },
   data() {
     return {
-      newPerformmaceBelongsList: [
+      newPerformmaceBelongsColumns: [
+        {
+          label: '销售人员',
+          prop: 'name'
+        },
+        {
+          label: '业绩归属部门',
+          prop: 'saler_dept'
+        },
         {
-          salesMan: '姓名',
-          performanceBelongDept: '销售一部/电销部',
-          salesPerformance: '¥5,000.00',
-          salesChannel: '电话',
+          label: '销售业绩',
+          prop: 'money'
+        },
+        {
+          label: '销售渠道',
+          prop: 'distribution_channel'
+        }
+      ],
+      newPerformmaceBelongsList: [],
+      performanceChangeColumns: [
+        {
+          label: '操作人',
+          prop: 'operator'
+        },
+        {
+          label: '操作时间',
+          prop: 'createtime'
+        },
+        {
+          label: '销售人员',
+          prop: 'name'
+        },
+        {
+          label: '销售业绩变动',
+          prop: 'change_value'
+        },
+        {
+          label: '业绩归属部门',
+          prop: 'saler_dept'
+        },
+        {
+          label: '业绩统计时间',
+          prop: 'statistics_time'
+        },
+        {
+          label: '销售渠道',
+          prop: 'distribution_channel'
+        },
+        {
+          label: '变更原因',
+          prop: 'change_reason' 
         }
       ],
       performanceChangeList: [
         {
           operator: '姓名',
-          actionTime: '2021-05-28 15:30:00',
-          salesMan: '姓名',
-          salesPerformanceChange: '¥5,000.00',
-          performanceBelongDept: '销售一部/电销部',
-          performanceStatisticsTime: '2021-05-28 15:30:00',
-          salesChannel: '电话',
-          performanceChangeReason: '备注'
+          createtime: '2021-05-28 15:30:00',
+          name: '姓名',
+          change_value: '¥5,000.00',
+          saler_dept: '销售一部/电销部',
+          statistics_time: '2021-05-28 15:30:00',
+          distribution_channel: '电话',
+          change_reason: '备注'
         }
       ]
     }
+  },
+  mounted() {
+    console.log(this.orderDetail)
+    this.newPerformmaceBelongsList = this.orderDetail?.saleDataRes?.saleFinal?.list || []
+    this.performanceChangeList = this.orderDetail?.saleDataRes?.saleRecord || []
   }
 }
 </script>