Browse Source

Merge branch 'feature/v2.4.46' of https://jygit.jydev.jianyu360.cn/jianyu/qmx_page_admin into feature/v2.4.46

tangshizhe 2 months ago
parent
commit
4be54fc793

+ 38 - 5
src/views/create-order/components/product-info-submodule/RelatedOrderTable.vue

@@ -2,7 +2,7 @@
   <!-- 关联订单表格 -->
   <div class="relate-order-table">
     <el-table
-      :data="tableData"
+      :data="tableData2"
       border
       :row-key="getRowKey"
       :span-method="objectSpanMethod"
@@ -112,6 +112,35 @@ export default {
       }
     }
   },
+  computed: {
+    tableData2() {
+      let n = 0 // 记录长度,后续n个spanNum置为0
+      return this.tableData.map(row => {
+        let spanNum = 0
+        if (Array.isArray(row.linkedOrder)) {
+          const orderLength = row.linkedOrder.length
+          if (orderLength > 1) {
+            if (n <= 0) {
+              n = orderLength - 1
+              spanNum = orderLength
+            } else {
+              n--
+              spanNum = 0
+            }
+          } else {
+            // do something...
+            n = 0
+            spanNum = 0
+          }
+        }
+
+        return {
+          ...row,
+          spanNum,
+        }
+      })
+    }
+  },
   methods: {
     onInput(e) {
       this.$emit('input', e)
@@ -141,8 +170,8 @@ export default {
       const unSpanKey = ['order_code', 'service_type_text', 'create_time']
       const notSpanColumn = unSpanKey.includes(column.property)
       if (needSpan && !notSpanColumn) {
-        const spanNum = row.linkedOrder.length
-        if (rowIndex % spanNum === 0) {
+        const spanNum = row.spanNum
+        if (row.spanNum > 0) {
           return {
             rowspan: spanNum,
             colspan: 1
@@ -167,8 +196,12 @@ export default {
 
 <style lang="scss" scoped>
 ::v-deep {
-  .el-table__body tr.current-row > td {
-    background-color: #eef1f6;
+  .el-table__body {
+    max-height: 600px;
+    overflow: auto;
+    tr.current-row > td {
+      background-color: #eef1f6;
+    }
   }
   .el-table__row {
     cursor: pointer;

+ 71 - 76
src/views/create-order/components/product-info-submodule/RelatedOrders.vue

@@ -59,97 +59,87 @@ export default {
       default() {
         return [
           // {
-          //   buySubject: 1,
-          //   comboId: 0, // 套餐id
-          //   empowerCount: 2, // 人数
-          //   linkedId: '00xxx', // 关联id
-          //   name: 'cjdyxx',
-          //   provinceCount: 0, // 订阅省份
-          //   serviceStartTime: '2025-3-8', // 服务开始时间
-          //   serviceEndTime: '2025-4-8', // 结束时间
-          //   serviceList: [],
-          //   linkedOrder: [
+          //   "buySubject": 2,
+          //   "empowerCount": "-",
+          //   "linkedId": 188812,
+          //   "linkedOrder": [
           //     {
-          //       order_code: 'xxxxxx1',
-          //       create_time: '2025-3-8',
-          //       service_type: '1',
-          //       order_detail_id: 'xxxxxx1',
-          //     },
+          //       "create_time": "2025-06-04 15:05:32",
+          //       "order_code": "150532132533",
+          //       "order_detail_id": 188812,
+          //       "service_type": 1
+          //     }
           //   ],
-          //   vipExist: false, //当前服务是否在有限期内
+          //   "name": "权益码标准版",
+          //   "productCode": "qym001",
+          //   "serviceEndTime": null,
+          //   "serviceStartTime": "",
+          //   "vipExist": false
           // },
           // {
-          //   buySubject: 1,
-          //   comboId: 0, // 套餐id
-          //   empowerCount: 2, // 人数
-          //   linkedId: 'xxx12222', // 关联id
-          //   name: 'cjdyxx',
-          //   provinceCount: 0, // 订阅省份
-          //   serviceStartTime: '2025-3-8', // 服务开始时间
-          //   serviceEndTime: '2025-4-8', // 结束时间
-          //   serviceList: [],
-          //   linkedOrder: [
+          //   "buySubject": 2,
+          //   "comboId": 0,
+          //   "empowerCount": "3",
+          //   "gifUserCount": 1,
+          //   "linkedId": 188585,
+          //   "linkedOrder": [
           //     {
-          //       order_code: 'xxxxxx1',
-          //       create_time: '2025-3-8',
-          //       service_type: '1',
-          //       order_detail_id: 'xxxxxx1',
+          //       "create_time": "2025-05-28 16:25:39",
+          //       "order_code": "162539702929",
+          //       "order_detail_id": 188585,
+          //       "service_type": 2
           //     },
-          //   ],
-          //   vipExist: false, //当前服务是否在有限期内
-          // },
-          // {
-          //   buySubject: 1,
-          //   comboId: 0, // 套餐id
-          //   empowerCount: 2, // 人数
-          //   linkedId: 'zzz111', // 关联id
-          //   name: 'cjdy',
-          //   provinceCount: 0, // 订阅省份
-          //   serviceStartTime: '2025-3-8', // 服务开始时间
-          //   serviceEndTime: '2025-4-8', // 结束时间
-          //   serviceList: [],
-          //   linkedOrder: [
           //     {
-          //       order_code: 'xxxxxx1',
-          //       create_time: '2025-3-8',
-          //       service_type: '1',
-          //       order_detail_id: 'xxxxxx1',
+          //       "create_time": "2025-05-27 14:06:17",
+          //       "order_code": "140617698717",
+          //       "order_detail_id": 188475,
+          //       "service_type": 2
           //     },
           //     {
-          //       order_code: 'xxxxxx2',
-          //       create_time: '2025-3-8',
-          //       service_type: '1',
-          //       order_detail_id: 'xxxxxx2',
-          //     },
+          //       "create_time": "2025-05-27 13:36:15",
+          //       "order_code": "133615327959",
+          //       "order_detail_id": 188472,
+          //       "service_type": 1
+          //     }
           //   ],
-          //   vipExist: false, //当前服务是否在有限期内
+          //   "name": "VIP订阅",
+          //   "payUserCount": 1,
+          //   "productCode": "cjdy016",
+          //   "provinceCount": -1,
+          //   "serviceEndTime": "2031-03-29 15:59:59",
+          //   "serviceList": null,
+          //   "serviceStartTime": "2025-05-27 00:00:00",
+          //   "vipExist": true
           // },
           // {
-          //   buySubject: 2,
-          //   comboId: 1, // 套餐id
-          //   empowerCount: 3, // 人数
-          //   linkedId: 'ccc1211', // 关联id
-          //   name: 'dyh',
-          //   provinceCount: 0, // 订阅省份
-          //   serviceStartTime: '2025-3-8', // 服务开始时间
-          //   serviceEndTime: '2025-4-8', // 结束时间
-          //   serviceList: [],
-          //   linkedOrder: [
+          //   "buySubject": 2,
+          //   "comboId": 0,
+          //   "empowerCount": "14",
+          //   "gifUserCount": 3,
+          //   "linkedId": 188538,
+          //   "linkedOrder": [
           //     {
-          //       order_code: 'zz1',
-          //       create_time: '2025-3-8',
-          //       service_type: '1',
-          //       order_detail_id: 'zz1',
+          //       "create_time": "2025-05-28 10:40:28",
+          //       "order_code": "104028056372",
+          //       "order_detail_id": 188538,
+          //       "service_type": 1
           //     },
           //     {
-          //       order_code: 'zz2',
-          //       create_time: '2025-3-8',
-          //       service_type: '1',
-          //       order_detail_id: 'zz3',
+          //       "create_time": "2025-05-28 10:40:28",
+          //       "order_code": "104028056372",
+          //       "order_detail_id": 188539,
+          //       "service_type": 1
           //     },
           //   ],
-          //   vipExist: false, //当前服务是否在有限期内
-          // },
+          //   "name": "VIP订阅",
+          //   "payUserCount": 10,
+          //   "productCode": "cjdy001",
+          //   "provinceCount": 1,
+          //   "serviceEndTime": "2027-05-28 23:59:59",
+          //   "serviceList": null,
+          //   "serviceStartTime": "2025-05-28 00:00:00",
+          //   "vipExist": true
+          // }
         ]
       }
     },
@@ -181,7 +171,8 @@ export default {
             arr.push({
               ...item,
               linkedId: item.linkedId,
-              _linkedId: `${item.linkedId}-${t.order_code}`,
+              // _linkedId: `${item.linkedId}-${t.order_code}`,
+              _linkedId: this.createVid(item, t),
               linkedOrderSplit: t,
             })
           })
@@ -223,6 +214,9 @@ export default {
     },
   },
   methods: {
+    createVid(row, linkedItem) {
+      return `${row.linkedId || ''}-${linkedItem.order_code || ''}-${linkedItem.order_detail_id || ''}`
+    },
     onInput(e) {
       this.$emit('input', e)
     },
@@ -234,7 +228,8 @@ export default {
         if (linkedIdArr.includes(id)) {
           if (Array.isArray(row.linkedOrder) && row.linkedOrder.length > 0) {
             row.linkedOrder.forEach(t => {
-              const vId = `${row.linkedId}-${t.order_code}`
+              // const vId = `${row.linkedId}-${t.order_code}`
+              const vId = this.createVid(row, t)
               arr.push(vId)
             })
           } else {

+ 3 - 1
src/views/create-order/components/product-info-submodule/ValidityCount.vue

@@ -100,7 +100,9 @@ export default {
     },
     getState() {
       if (this.amountText) {
-        return {}
+        return {
+          amountText: this.amountText,
+        }
       } else {
         const params = {
           payCount: this.pay.count,

+ 1 - 0
src/views/create-order/components/product-info-submodule/ValidityDateTime.vue

@@ -107,6 +107,7 @@ export default {
     getState() {
       if (this.amountText) {
         return {
+          amountText: this.amountText,
           paybackOpenServer: this.paybackOpenServer,
         }
       } else {

+ 1 - 0
src/views/create-order/components/product-info-submodule/ValidityPeriod.vue

@@ -259,6 +259,7 @@ export default {
     getState() {
       if (this.amountText) {
         return {
+          amountText: this.amountText,
           paybackOpenServer: this.paybackOpenServer,
         }
       } else {

+ 16 - 2
src/views/create-order/components/schema-form/products/common.js

@@ -280,7 +280,11 @@ export function createValidityPeriodSchema({ amountText = '' } = {}) {
     required: true,
     showMessage: false,
     changedSchema: true,
-    defaultValue: {},
+    defaultValue: {
+      paybackOpenServer: false,
+      payCount: '',
+      freeCount: '',
+    },
     props: {
       amountText,
     }
@@ -313,13 +317,23 @@ export function createValidityPeriodDateTimeSchema({ label, info, amountText = '
   // if (!show) {
   //   return undefined
   // }
+  const defaultValue = {
+    paybackOpenServer: false,
+    start: '',
+    end: '',
+  }
+
+  if (amountText) {
+    defaultValue.amountText = amountText
+  }
+
   return createSchemaItem({
     label: label || '服务起止时间',
     key: 'validityPeriod',
     className: 'validity-period',
     component: ValidityDateTime,
     required: true,
-    defaultValue: {},
+    defaultValue,
     props: {
       amountText,
     }

+ 8 - 6
src/views/create-order/components/schema-form/required/data-count-pack.js

@@ -43,12 +43,14 @@ export function checkDataCountRequired(pageForm, product) {
   }
 
   if (form.validityPeriod && Object.keys(form.validityPeriod).length > 1) {
-    const pass = form.validityPeriod.start && form.validityPeriod.end
-    if (!pass) {
-      return Object.assign(res, {
-        p: false,
-        msg: '服务起止时间为必填'
-      })
+    if (!form.validityPeriod.amountText) {
+      const pass = form.validityPeriod.start && form.validityPeriod.end
+      if (!pass) {
+        return Object.assign(res, {
+          p: false,
+          msg: '服务起止时间为必填'
+        })
+      }
     }
   }
 

+ 4 - 3
src/views/create-order/components/schema-form/schema-form.vue

@@ -251,6 +251,7 @@ export default {
       })
       this.schema = schemaList
       this.rules = rules
+      this.defaultValue = cloneDeep(defaultValue)
       this.refreshSchemaWhenFieldsChanged = changedFields
       this.onInput(defaultValue)
       this.onInitSchema()
@@ -741,7 +742,7 @@ export default {
             return productTypeMap[item.productType] === productTypeMap[this.productType] || item._code === this.productType
           })
           if (currentProductTypeList.length > 0) {
-            const vipExistList = currentProductTypeList.filter(item => item.vipExist)
+            const vipExistList = currentProductTypeList.map(item => item.vipExist)
             vipExist = vipExistList.includes(true)
           }
           opt2 = vipExist ? currentProductTypeList : opt
@@ -1326,10 +1327,10 @@ export default {
         const obj = {}
         // 销售策略变更,清空有效周期(通用规则)
         if (this.value.validityPeriod) {
-          obj.validityPeriod = {}
+          obj.validityPeriod = cloneDeep(this.defaultValue.validityPeriod)
         }
         if (this.value[schemaKeyMap.validityCount]) {
-          obj[schemaKeyMap.validityCount] = {}
+          obj[schemaKeyMap.validityCount] = cloneDeep(this.defaultValue[schemaKeyMap.validityCount])
         }
         const buyType = [1, 4].includes(this.value[schemaKeyMap.payment]) 
         if (changedArr.includes(schemaKeyMap.payment) && buyType) {

+ 16 - 3
src/views/order/components/OrderReviewDialog.vue

@@ -9,7 +9,7 @@
     :visible="value"
     @update:visible="visibleUpdate"
     >
-    <OrderReviewCard ref="reviewCard" :orderCode="orderCode" />
+    <OrderReviewCard ref="reviewCard" :orderCode="orderCode" :key="orderReviewKey" />
     <div class="footer-container" slot="footer" v-if="showReviewModule">
       <div class="review-form-container">
         <el-form ref="form" label-width="110px">
@@ -84,6 +84,10 @@ export default {
       type: String,
       default: '',
     },
+    cacheContent: {
+      type: Boolean,
+      default: false
+    }
   },
   data() {
     return {
@@ -100,10 +104,18 @@ export default {
       orderReview: {
         pass: 1,
         reason: '',
-      }
+      },
+      refreshTimestamp: 0,
     }
   },
   computed: {
+    orderReviewKey() {
+      if (this.cacheContent) {
+        return this.orderCode
+      } else {
+        return this.orderCode + this.refreshTimestamp
+      }
+    },
     confirmDisabled() {
       return (this.orderReview.pass === -1 && !this.orderReview.reason) || this.submitLoading
     },
@@ -115,8 +127,9 @@ export default {
     value(n) {
       if (n) {
         this.resetReview()
+        this.refreshTimestamp = Date.now()
       }
-    }
+    },
   },
   methods: {
     visibleUpdate(e) {