LaveyD 2 miesięcy temu
rodzic
commit
95c5843b46

+ 81 - 3
src/views/goodsCenter/priceList.vue

@@ -153,6 +153,81 @@
               >
               </el-table-column>
             </el-table>
+
+            <!-- 美团场次票信息 -->
+            <template v-if="props.row.mtProductLevelList && props.row.mtProductLevelList.length > 0">
+              <div
+                class="title"
+                style="margin-top: 15px;">美团场次票</div>
+              <el-table
+                :data="props.row.mtProductLevelList"
+                :max-height="200">
+                <el-table-column
+                  prop="batchConfigName"
+                  label="场次名称"
+                ></el-table-column>
+                <el-table-column
+                  prop="marketPrice"
+                  label="市场价"
+                ></el-table-column>
+                <el-table-column
+                  prop="mtPrice"
+                  label="美团价"
+                ></el-table-column>
+                <el-table-column
+                  prop="settlementPrice"
+                  label="结算价"
+                ></el-table-column>
+                <el-table-column
+                  prop="priceDate"
+                  label="日期范围"
+                ></el-table-column>
+              </el-table>
+            </template>
+
+            <!-- 携程场次票信息 -->
+            <template v-if="props.row.xcProductLevelList && props.row.xcProductLevelList.length > 0">
+              <div
+                class="title"
+                style="margin-top: 15px;">携程场次票</div>
+              <el-table
+                :data="props.row.xcProductLevelList"
+                :max-height="200">
+                <el-table-column
+                  prop="batchConfigName"
+                  label="场次名称"
+                ></el-table-column>
+                <el-table-column
+                  prop="status"
+                  label="状态">
+                  <template slot-scope="scope">
+                    {{ scope.row.status === 'active' ? '有效' : '无效' }}
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  prop="effectiveDays"
+                  label="可售天数"
+                ></el-table-column>
+                <el-table-column
+                  label="提前预订">
+                  <template slot-scope="scope">
+                    {{ scope.row.requiredAdvanceBooking === 1 ? '是' : '否' }}
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  prop="advanceDays"
+                  label="提前天数"
+                ></el-table-column>
+                <el-table-column
+                  prop="advanceTime"
+                  label="预订时间"
+                ></el-table-column>
+                <el-table-column
+                  prop="advanceMinutes"
+                  label="生效等待(分钟)"
+                ></el-table-column>
+              </el-table>
+            </template>
           </template>
         </el-table-column>
         <el-table-column
@@ -485,9 +560,12 @@ export default {
     },
     // 打开编辑对话框
     showDialog (type, item) {
-      this.dialogType = type
-      this.currentItem = item || {}
-      this.dialogVisible = true
+      // 每次打开弹框时重新查询票种列表
+      this.getTicketTypeList().then(() => {
+        this.dialogType = type
+        this.currentItem = item || {}
+        this.dialogVisible = true
+      })
     },
     // 删除产品
     deleteItem (item) {

+ 433 - 3
src/views/goodsCenter/priceList/EditDialog.vue

@@ -15,7 +15,8 @@
         <el-select
           v-model="form.ticketTypeId"
           :disabled="dialogType === 'edit'"
-          filterable>
+          filterable
+          @change="handleTicketTypeChange">
           <el-option
             v-for="item in ticketTypeList"
             :key="item.id"
@@ -32,7 +33,8 @@
           v-model="form.otaSourceIds"
           multiple
           filterable
-          :disabled="dialogType === 'edit'">
+          :disabled="dialogType === 'edit'"
+          @change="handleOtaSourceChange">
           <el-option
             v-for="item in otaList"
             :key="item.id"
@@ -271,6 +273,274 @@
         </div>
       </div>
 
+      <!-- 美团场次票配置 -->
+      <template v-if="showMtBatchConfig">
+        <div class="block-title">
+          美团场次票配置
+          <el-tooltip
+            effect="dark"
+            content="当票种为场次票且分销商包含美团时,需要配置各场次的价格信息"
+            placement="top">
+            <i class="el-icon-info"></i>
+          </el-tooltip>
+        </div>
+        <div>
+          <div class="btn-wrap-left">
+            <el-button
+              plain
+              class="add-btn"
+              type="primary"
+              @click="handleAddMtBatch">
+              添加美团场次
+            </el-button>
+          </div>
+          <div class="table-box">
+            <el-table
+              border
+              stripe
+              :data="form.mtProductLevelRequests">
+              <el-table-column
+                label="场次"
+                min-width="150">
+                <template slot-scope="scope">
+                  <el-select
+                    v-model="scope.row.batchConfigId"
+                    placeholder="请选择场次">
+                    <el-option
+                      v-for="item in currentBatchConfigList"
+                      :key="item.batchConfigId"
+                      :label="item.name"
+                      :value="item.batchConfigId">
+                    </el-option>
+                  </el-select>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="市场价"
+                min-width="120">
+                <template slot-scope="scope">
+                  <el-input-number
+                    controls-position="right"
+                    :min="0"
+                    :precision="2"
+                    v-model="scope.row.marketPrice">
+                  </el-input-number>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="美团价"
+                min-width="120">
+                <template slot-scope="scope">
+                  <el-input-number
+                    controls-position="right"
+                    :min="0"
+                    :precision="2"
+                    v-model="scope.row.mtPrice">
+                  </el-input-number>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="结算价"
+                min-width="120">
+                <template slot-scope="scope">
+                  <el-input-number
+                    controls-position="right"
+                    :min="0"
+                    :precision="2"
+                    v-model="scope.row.settlementPrice">
+                  </el-input-number>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="开始日期"
+                min-width="150">
+                <template slot-scope="scope">
+                  <el-date-picker
+                    v-model="scope.row.startDate"
+                    type="date"
+                    value-format="yyyy-MM-dd"
+                    placeholder="开始日期">
+                  </el-date-picker>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="结束日期"
+                min-width="150">
+                <template slot-scope="scope">
+                  <el-date-picker
+                    v-model="scope.row.endDate"
+                    type="date"
+                    value-format="yyyy-MM-dd"
+                    placeholder="结束日期">
+                  </el-date-picker>
+                </template>
+              </el-table-column>
+              <el-table-column
+                width="90"
+                label="操作">
+                <template slot-scope="scope">
+                  <span
+                    class="el-button el-button--primary el-button--small"
+                    @click="delMtBatch(scope.$index)">
+                    <i class="el-icon-delete"></i>
+                    删除
+                  </span>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </div>
+      </template>
+
+      <!-- 携程场次票配置 -->
+      <template v-if="showXcBatchConfig">
+        <div class="block-title">
+          携程场次票配置
+          <el-tooltip
+            effect="dark"
+            content="当票种为场次票且分销商包含携程时,需要配置各场次的资源信息"
+            placement="top">
+            <i class="el-icon-info"></i>
+          </el-tooltip>
+        </div>
+        <div>
+          <div class="btn-wrap-left">
+            <el-button
+              plain
+              class="add-btn"
+              type="primary"
+              @click="handleAddXcBatch">
+              添加携程场次
+            </el-button>
+          </div>
+          <div class="table-box">
+            <el-table
+              border
+              stripe
+              :data="form.xcProductLevelRequests">
+              <el-table-column
+                label="场次"
+                min-width="150">
+                <template slot-scope="scope">
+                  <el-select
+                    v-model="scope.row.batchConfigId"
+                    placeholder="请选择场次">
+                    <el-option
+                      v-for="item in currentBatchConfigList"
+                      :key="item.batchConfigId"
+                      :label="item.name"
+                      :value="item.batchConfigId">
+                    </el-option>
+                  </el-select>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="资源状态"
+                min-width="120">
+                <template slot-scope="scope">
+                  <el-select
+                    v-model="scope.row.status"
+                    placeholder="请选择">
+                    <el-option
+                      label="有效"
+                      value="active">
+                    </el-option>
+                    <el-option
+                      label="无效"
+                      value="inactive">
+                    </el-option>
+                  </el-select>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="可售天数"
+                min-width="120">
+                <template slot-scope="scope">
+                  <el-input-number
+                    controls-position="right"
+                    :min="0"
+                    :precision="0"
+                    v-model="scope.row.effectiveDays">
+                  </el-input-number>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="提前预订"
+                min-width="120">
+                <template slot-scope="scope">
+                  <el-select
+                    v-model="scope.row.requiredAdvanceBooking"
+                    placeholder="请选择">
+                    <el-option
+                      label="无需提前"
+                      :value="0">
+                    </el-option>
+                    <el-option
+                      label="需要提前"
+                      :value="1">
+                    </el-option>
+                  </el-select>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="提前天数"
+                min-width="100">
+                <template slot-scope="scope">
+                  <el-input-number
+                    v-if="scope.row.requiredAdvanceBooking === 1"
+                    controls-position="right"
+                    :min="0"
+                    :precision="0"
+                    v-model="scope.row.advanceDays">
+                  </el-input-number>
+                  <span v-else>-</span>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="预订时间"
+                min-width="120">
+                <template slot-scope="scope">
+                  <el-time-picker
+                    v-if="scope.row.requiredAdvanceBooking === 1"
+                    v-model="scope.row.advanceTime"
+                    value-format="HH:mm"
+                    format="HH:mm"
+                    placeholder="选择时间">
+                  </el-time-picker>
+                  <span v-else>-</span>
+                </template>
+              </el-table-column>
+              <el-table-column
+                label="生效等待(分钟)"
+                min-width="130">
+                <template slot-scope="scope">
+                  <el-input-number
+                    v-if="scope.row.requiredAdvanceBooking === 1"
+                    controls-position="right"
+                    :min="0"
+                    :precision="0"
+                    v-model="scope.row.advanceMinutes">
+                  </el-input-number>
+                  <span v-else>-</span>
+                </template>
+              </el-table-column>
+              <el-table-column
+                width="90"
+                label="操作">
+                <template slot-scope="scope">
+                  <span
+                    class="el-button el-button--primary el-button--small"
+                    @click="delXcBatch(scope.$index)">
+                    <i class="el-icon-delete"></i>
+                    删除
+                  </span>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </div>
+      </template>
+
     </div>
     <div class="dialog-btn-wrap">
       <el-button @click="reset">重置</el-button>
@@ -324,6 +594,29 @@ export default {
     },
     hasXc () {
       return this.form.otaSourceIds.some(id => !!this.otaList.find(item => item.otaSourceId === id && item.otaSourceCode === 'XC'))
+    },
+    hasMt () {
+      return this.form.otaSourceIds.some(id => !!this.otaList.find(item => item.otaSourceId === id && item.otaSourceCode === 'MT'))
+    },
+    // 当前选中的票种
+    currentTicketType () {
+      return this.ticketTypeList.find(item => item.ticketTypeId === this.form.ticketTypeId) || {}
+    },
+    // 判断是否是场次票
+    isBatchTicket () {
+      return this.currentTicketType.category === 'batch'
+    },
+    // 当前票种的场次列表
+    currentBatchConfigList () {
+      return this.currentTicketType.batchConfigList || []
+    },
+    // 是否显示美团场次配置
+    showMtBatchConfig () {
+      return this.isBatchTicket && this.currentBatchConfigList.length > 0 && this.hasMt
+    },
+    // 是否显示携程场次配置
+    showXcBatchConfig () {
+      return this.isBatchTicket && this.currentBatchConfigList.length > 0 && this.hasXc
     }
   },
   data () {
@@ -358,7 +651,9 @@ export default {
         useDateEnd: moment().add(30, 'years').endOf('year').format('YYYY-MM-DD'),
         totalStock: -1, // -1代表不限库存
         xcRealNameType: '',
-        otaTicketTypeScenicSplitRequests: []
+        otaTicketTypeScenicSplitRequests: [],
+        mtProductLevelRequests: [],
+        xcProductLevelRequests: []
       },
       showDeletedOption: false,
       deletedOption: {
@@ -381,6 +676,42 @@ export default {
           this.form = Object.assign({}, this.form, this.currentItem)
           console.log('this.form', this.form)
           this.form.otaSourceIds = this.form.otaSourceId ? [this.form.otaSourceId] : []
+          // 处理美团场次票数据回填
+          if (this.currentItem.mtProductLevelList && this.currentItem.mtProductLevelList.length > 0) {
+            this.form.mtProductLevelRequests = this.currentItem.mtProductLevelList.map(item => ({
+              batchConfigId: item.batchConfigId,
+              marketPrice: item.marketPrice,
+              mtPrice: item.mtPrice,
+              settlementPrice: item.settlementPrice,
+              startDate: item.priceDate ? item.priceDate.split(' - ')[0] : '',
+              endDate: item.priceDate ? item.priceDate.split(' - ')[1] : ''
+            }))
+          } else {
+            this.form.mtProductLevelRequests = []
+          }
+          // 处理携程场次票数据回填
+          if (this.currentItem.xcProductLevelList && this.currentItem.xcProductLevelList.length > 0) {
+            this.form.xcProductLevelRequests = this.currentItem.xcProductLevelList.map(item => ({
+              batchConfigId: item.batchConfigId,
+              status: item.status || 'active',
+              effectiveDays: item.effectiveDays || 0,
+              requiredAdvanceBooking: item.requiredAdvanceBooking || 0,
+              advanceDays: item.advanceDays || 0,
+              advanceTime: item.advanceTime || '',
+              advanceMinutes: item.advanceMinutes || 0
+            }))
+          } else {
+            this.form.xcProductLevelRequests = []
+          }
+          // 处理分账子景点数据回填
+          if (this.currentItem.otaTicketTypeScenicSplitList && this.currentItem.otaTicketTypeScenicSplitList.length > 0) {
+            this.form.otaTicketTypeScenicSplitRequests = this.currentItem.otaTicketTypeScenicSplitList.map(item => ({
+              scenicId: item.scenicId,
+              price: item.price
+            }))
+          } else {
+            this.form.otaTicketTypeScenicSplitRequests = []
+          }
           // 有绑定场次的情况
           const batch = this.batchConfigList.find(v => v.id === this.form.batchConfigId)
           if (!batch && this.form.batchConfigId !== 0 && this.dialogType === 'edit') { // 有绑定场次 且该场次在不在现有可选范围中  ==》原来绑定的场次被删了 要保证正常显示 手动加这一项
@@ -393,6 +724,9 @@ export default {
         } else {
           this.form.batchConfigId = 0
           this.form.batchConfigIds = []
+          this.form.mtProductLevelRequests = []
+          this.form.xcProductLevelRequests = []
+          this.form.otaTicketTypeScenicSplitRequests = []
         }
       }
     }
@@ -418,6 +752,54 @@ export default {
     delScenicSplit (index) {
       this.form.otaTicketTypeScenicSplitRequests.splice(index, 1)
     },
+    // 添加美团场次配置
+    handleAddMtBatch () {
+      this.form.mtProductLevelRequests.push({
+        batchConfigId: '',
+        marketPrice: this.form.marketPrice || 0,
+        mtPrice: this.form.salePrice || 0,
+        settlementPrice: this.form.settlementPrice || 0,
+        startDate: moment().format('YYYY-MM-DD'),
+        endDate: moment().add(1, 'years').format('YYYY-MM-DD')
+      })
+    },
+    // 删除美团场次配置
+    delMtBatch (index) {
+      this.form.mtProductLevelRequests.splice(index, 1)
+    },
+    // 添加携程场次配置
+    handleAddXcBatch () {
+      this.form.xcProductLevelRequests.push({
+        batchConfigId: '',
+        status: 'active',
+        effectiveDays: 365,
+        requiredAdvanceBooking: 0,
+        advanceDays: 0,
+        advanceTime: '',
+        advanceMinutes: 0
+      })
+    },
+    // 删除携程场次配置
+    delXcBatch (index) {
+      this.form.xcProductLevelRequests.splice(index, 1)
+    },
+    // 票种变更时清空场次配置
+    handleTicketTypeChange () {
+      this.form.mtProductLevelRequests = []
+      this.form.xcProductLevelRequests = []
+    },
+    // 分销商变更时处理
+    handleOtaSourceChange () {
+      // 如果不再包含美团,清空美团配置
+      if (!this.hasMt) {
+        this.form.mtProductLevelRequests = []
+      }
+      // 如果不再包含携程,清空携程配置
+      if (!this.hasXc) {
+        this.form.xcProductLevelRequests = []
+        this.form.xcRealNameType = ''
+      }
+    },
     submit () {
       this.$refs.form.validate((valid) => {
         if (valid) {
@@ -438,6 +820,30 @@ export default {
     addTicket () {
       const params = Object.assign({}, this.form)
       delete params.id
+      // 如果不是场次票或不包含美团,清空美团配置
+      if (!this.showMtBatchConfig) {
+        params.mtProductLevelRequests = []
+      }
+      // 如果不是场次票或不包含携程,清空携程配置
+      if (!this.showXcBatchConfig) {
+        params.xcProductLevelRequests = []
+      }
+      // 验证美团场次票配置
+      if (this.showMtBatchConfig && params.mtProductLevelRequests.length > 0) {
+        const hasEmptyBatch = params.mtProductLevelRequests.some(item => !item.batchConfigId)
+        if (hasEmptyBatch) {
+          this.$message.error('请选择美团场次票的场次')
+          return
+        }
+      }
+      // 验证携程场次票配置
+      if (this.showXcBatchConfig && params.xcProductLevelRequests.length > 0) {
+        const hasEmptyBatch = params.xcProductLevelRequests.some(item => !item.batchConfigId)
+        if (hasEmptyBatch) {
+          this.$message.error('请选择携程场次票的场次')
+          return
+        }
+      }
 
       addOTATicketSale(params).then(res => {
         this.$message.success('添加成功')
@@ -448,6 +854,30 @@ export default {
     },
     updateTicket () {
       const params = Object.assign({}, this.form)
+      // 如果不是场次票或不包含美团,清空美团配置
+      if (!this.showMtBatchConfig) {
+        params.mtProductLevelRequests = []
+      }
+      // 如果不是场次票或不包含携程,清空携程配置
+      if (!this.showXcBatchConfig) {
+        params.xcProductLevelRequests = []
+      }
+      // 验证美团场次票配置
+      if (this.showMtBatchConfig && params.mtProductLevelRequests.length > 0) {
+        const hasEmptyBatch = params.mtProductLevelRequests.some(item => !item.batchConfigId)
+        if (hasEmptyBatch) {
+          this.$message.error('请选择美团场次票的场次')
+          return
+        }
+      }
+      // 验证携程场次票配置
+      if (this.showXcBatchConfig && params.xcProductLevelRequests.length > 0) {
+        const hasEmptyBatch = params.xcProductLevelRequests.some(item => !item.batchConfigId)
+        if (hasEmptyBatch) {
+          this.$message.error('请选择携程场次票的场次')
+          return
+        }
+      }
 
       updateOTATicketSale(params).then(res => {
         this.$message.success('保存成功')