| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617 |
- <template>
- <div class="form-wrap">
- <div class="searchBox">
- <el-form
- ref="form"
- :model="form"
- :inline="true"
- label-width="150px">
- <el-form-item
- label="产品ID"
- prop="otaProductId">
- <el-input
- v-model="form.otaProductId"
- clearable></el-input>
- </el-form-item>
- <el-form-item
- label="分销商名称"
- prop="otaSourceId">
- <el-select
- v-model="form.otaSourceId"
- filterable>
- <el-option
- value=""
- label="全部"></el-option>
- <el-option
- v-for="item in otaList"
- :key="item.id"
- :value="item.otaSourceId"
- :label="item.otaSourceName"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item
- label="票种"
- prop="ticketTypeId">
- <el-select
- v-model="form.ticketTypeId"
- filterable>
- <el-option
- value=""
- label="全部"></el-option>
- <el-option
- v-for="item in ticketTypeList"
- :key="item.id"
- :value="item.ticketTypeId"
- :label="item.name"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item
- label="是否可售"
- prop="isSale">
- <el-select
- v-model="form.isSale">
- <el-option
- value=""
- label="全部"></el-option>
- <el-option
- :value="1"
- label="可售"></el-option>
- <el-option
- :value="0"
- label="不可售"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item
- label="价格"
- prop="salePrice">
- <el-input
- v-model="form.salePrice"
- clearable></el-input>
- </el-form-item>
- </el-form>
- <div class="btn-wrap">
- <el-button @click="reset">重置</el-button>
- <el-button
- type="primary"
- @click="getList">搜索</el-button>
- <el-button
- type="primary"
- plain
- v-if="canEdit"
- @click="showDialog('add')">创建产品</el-button>
- <el-button
- type="danger"
- @click="batchDelete">批量删除</el-button>
- </div>
- </div>
- <div class="tableBox">
- <!-- <div class="block-title">查询信息</div> -->
- <el-table
- stripe
- :data="tableData"
- row-class-name="is-center"
- @selection-change="handleSelectionChange"
- v-loading="loading">
- <el-table-column
- type="selection"
- width="55">
- </el-table-column>
- <!-- <el-table-column type="expand">
- <template slot-scope="scope">
- <el-form
- label-position="right"
- inline
- class="table-expand"
- label-width="120px"
- >
- <el-form-item label="游玩天数">
- <span>{{ scope.row.useValidDays }} 天</span>
- </el-form-item>
- <el-form-item label="最小起订数">
- <span>{{ scope.row.minOrderNum }}</span>
- </el-form-item>
- <el-form-item label="最大限订数">
- <span>{{ scope.row.maxOrderNum }}</span>
- </el-form-item>
- </el-form>
- </template>
- </el-table-column> -->
- <el-table-column type="expand">
- <template slot-scope="props">
- <div class="title">场次</div>
- <el-table
- :data="props.row.batchConfigList"
- :max-height="200">
- <el-table-column
- prop="id"
- label="skuId"
- ></el-table-column>
- <el-table-column
- prop="name"
- label="场次名称"
- >
- </el-table-column>
- <el-table-column
- prop="startTime"
- label="开始时间"
- width="170px"
- >
- </el-table-column>
- <el-table-column
- prop="endTime"
- label="结束时间"
- width="170px"
- >
- </el-table-column>
- <el-table-column
- prop="leftNums"
- label="库存"
- width="120px"
- >
- </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
- label="产品ID"
- prop="id">
- <template
- slot="header">
- 产品ID
- <Tip msg="表格中的产品ID,请填写在OTA平台中的商品配置中,和该商品绑定"></Tip>
- </template>
- </el-table-column>
- <el-table-column
- label="票种"
- prop="ticketTypeName">
- </el-table-column>
- <el-table-column
- prop="otaSourceName"
- label="分销商">
- <template slot-scope="scope">
- {{ scope.row.otaSourceName }}
- <span v-if="scope.row.ksProductId">(快手商品ID:{{ scope.row.ksProductId }})</span>
- </template>
- </el-table-column>
- <el-table-column
- width="80"
- prop="salePrice"
- label="价格">
- </el-table-column>
- <el-table-column
- width="80"
- prop="marketPrice"
- label="市场价">
- </el-table-column>
- <el-table-column
- width="80"
- prop="settlementPrice"
- label="结算价">
- </el-table-column>
- <!-- <el-table-column
- prop="name"
- label="产品名称">
- </el-table-column> -->
- <!-- <el-table-column
- prop="batchConfigName"
- label="场次">
- <template slot-scope="scope">
- {{ scope.row.batchConfigName ? scope.row.batchConfigName : '' }}
- </template>
- </el-table-column> -->
- <el-table-column
- width="170"
- label="可售日期"
- >
- <template slot-scope="scope">
- {{ scope.row.saleDateStart | formatDate }} 至 {{ scope.row.saleDateEnd | formatDate }}
- </template>
- </el-table-column>
- <el-table-column
- width="170"
- label="游玩日期"
- >
- <template slot-scope="scope">
- {{ scope.row.useDateStart | formatDate }} 至 {{ scope.row.useDateEnd | formatDate }}
- </template>
- </el-table-column>
- <el-table-column
- prop="totalStock"
- label="总库存">
- <template slot-scope="scope">
- {{ scope.row.totalStock > 0 ? scope.row.totalStock : '不限库存' }}
- </template>
- </el-table-column>
- <el-table-column
- prop="xcRealNameType"
- label="携程出行人模板">
- <template slot-scope="scope">
- {{ scope.row.xcRealNameType | formatXCProductName }}
- </template>
- </el-table-column>
- <el-table-column
- width="110"
- label="状态">
- <template slot-scope="scope">
- <span>{{ scope.row.isSale ? '已激活' : '已禁用' }}</span>
- <span v-if="canEdit">
- <el-button
- type="text"
- @click="offSale(scope.row)"
- class="offSale-btn"
- v-if="scope.row.isSale"><i class="iconfont icon-offSale"></i>禁用</el-button>
- <el-button
- type="text"
- @click="onSale(scope.row)"
- class="onSale-btn"
- v-else><i class="iconfont icon-onSale"></i>激活</el-button>
- </span>
- </template>
- </el-table-column>
- <el-table-column
- v-if="canEdit"
- width="120"
- label="操作">
- <template slot-scope="scope">
- <!-- <el-button
- v-if="scope.row.otaSourceName==='携程网'"
- type="text"
- @click="$refs.xcPriceCalendar.show(scope.row.id)"
- >
- <i class="el-icon-date"></i>
- 价格方案
- </el-button>
- <el-button
- v-if="scope.row.otaSourceName==='携程网'"
- type="text"
- @click="$refs.xcStock.show(scope.row.id)"
- >
- <i class="el-icon-date"></i>
- 库存方案
- </el-button>
- <el-button
- v-else
- type="text"
- @click="$refs.priceCalendar.show(scope.row.id)"
- >
- <i class="el-icon-date"></i>
- 价格方案
- </el-button> -->
- <el-button
- type="text"
- @click="showDialog('edit', scope.row)">
- <i class="el-icon-edit"></i>
- 编辑
- </el-button>
- <el-button
- type="text"
- @click="deleteItem(scope.row)">
- <i class="el-icon-delete"></i>
- 删除
- </el-button>
- <!-- <el-button
- v-if="scope.row.otaSourceCode==='KS'"
- type="text"
- @click="$refs.KSNewDialogRef.show(scope.row)"
- >
- 同步商品
- </el-button>
- <el-button
- v-if="scope.row.otaSourceCode==='KS' && scope.row.ksProductId"
- type="text"
- @click="$refs.KSUpdateDialogRef.show(scope.row)"
- >
- 同步商品价格库存
- </el-button> -->
- </template>
- </el-table-column>
- </el-table>
- <el-pagination
- background
- :current-page.sync="form.pageNum"
- @current-change="getList"
- layout="total, prev, pager, next"
- :total="total">
- </el-pagination>
- </div>
- <ElDialog
- :title="dialogType === 'add' ? '创建产品' : '编辑产品'"
- width="1000px"
- v-model="dialogVisible">
- <EditDialog
- :perform-list="performList"
- :dialog-type="dialogType"
- :ticket-type-list="ticketTypeList"
- :ota-list="otaList"
- :batch-config-list="batchConfigList"
- :current-item="currentItem"
- @updateList="getList"></EditDialog>
- </ElDialog>
- <KSNewDialog ref="KSNewDialogRef"></KSNewDialog>
- <KSUpdateDialog ref="KSUpdateDialogRef"></KSUpdateDialog>
- <PriceCalendar ref="priceCalendar"></PriceCalendar>
- <xcPriceCalendar ref="xcPriceCalendar"></xcPriceCalendar>
- <XCStock ref="xcStock"></XCStock>
- </div>
- </template>
- <script>
- import { getTicketTypeList } from '@/api/ticketType'
- import {
- // getPerformList,
- getOTATicketSaleList,
- deleteOTATicketSale,
- updateOTATicketSale
- // getBatchConfigList,
- } from '@/api/otaTicketSale'
- import { getOtaProjectList } from '@/api/ota'
- import ElDialog from '@/components/Dialog'
- import EditDialog from './priceList/EditDialog'
- import KSNewDialog from './priceList/KSNewDialog'
- import KSUpdateDialog from './priceList/KSUpdateDialog'
- import PriceCalendar from './priceList/PriceCalendar'
- import xcPriceCalendar from './priceList/xcPriceCalendar'
- import XCStock from './priceList/xcStock'
- export default {
- components: {
- ElDialog,
- EditDialog,
- KSNewDialog,
- KSUpdateDialog,
- PriceCalendar,
- xcPriceCalendar,
- XCStock
- },
- data () {
- return {
- projectName: localStorage.getItem('otaProject'),
- performList: [],
- dialogType: 'add',
- dialogVisible: false,
- form: {
- pageNum: 1,
- pageSize: 10,
- isSale: '',
- otaSourceId: '',
- ticketTypeId: '',
- salePrice: '',
- otaProductId: ''
- },
- loading: false,
- multipleSelection: [], // 批量删除多选数组
- total: 0,
- tableData: [],
- currentItem: {},
- ticketTypeList: [], // 票种列表
- batchConfigList: [],
- otaList: []
- }
- },
- created () {
- this.getTicketTypeList()
- this.getList()
- // this.fetchBatchConfigList()
- // getPerformList(this.projectName).then((res) => {
- // this.performList = res.extraInfo
- // })
- getOtaProjectList({
- pageNum: 1,
- pageSize: -1
- }).then(res => {
- this.otaList = res.data.records
- })
- },
- filters: {
- formatXCProductName (time) {
- if (!time) return ''
- const map = {
- '1': '一张一人需要证件',
- '2': '一张一人不需要证件',
- '3': '一单一人需要证件',
- '4': '一单一人不需要证件'
- }
- return map[time] || ''
- }
- },
- computed: {
- canEdit () {
- return true
- // return this.$store.state.user.permissionList.includes('product:pricecode_edit')
- },
- queryClear () {
- return this.$store.state.user.permissionList.includes('stats:clearwx_query')
- }
- },
- methods: {
- handleSelectionChange (val) {
- this.multipleSelection = val
- },
- // 批量删除产品
- batchDelete () {
- if (!this.multipleSelection || !this.multipleSelection.length) {
- this.$message.error('请先选择批量删除的产品记录')
- return
- }
- const ids = this.multipleSelection.map(item => item.id)
- this.$confirm(`将删除这${ids.length}条记录, 是否继续?`, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- deleteOTATicketSale({ idList: ids }).then(res => {
- this.$message.success('批量删除成功')
- this.multipleSelection = [] // 清空选中待删记录
- this.getList()
- }).catch(() => {
- this.$message({
- type: 'success',
- message: '批量删除出错!'
- })
- this.multipleSelection = [] // 清空选中待删记录
- this.getList()
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- })
- })
- },
- // 获取票种列表
- getTicketTypeList () {
- return getTicketTypeList({
- pageNum: 1,
- pageSize: -1
- }).then(res => {
- this.ticketTypeList = res.data.records
- })
- },
- // 获取列表
- getList () {
- this.loading = true
- getOTATicketSaleList(this.form).then(res => {
- this.total = res.data.total
- this.tableData = res.data.records
- this.loading = false
- })
- },
- // 打开编辑对话框
- showDialog (type, item) {
- // 每次打开弹框时重新查询票种列表
- this.getTicketTypeList().then(() => {
- this.dialogType = type
- this.currentItem = item || {}
- this.dialogVisible = true
- })
- },
- // 删除产品
- deleteItem (item) {
- this.$confirm('确定删除?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- deleteOTATicketSale({ idList: [item.id] }).then(res => {
- this.$message.success('删除成功')
- this.getList()
- })
- })
- },
- reset () {
- this.$refs.form.resetFields()
- },
- offSale (data) {
- let form = Object.assign({}, data)
- form.isSale = 0
- updateOTATicketSale(form).then(res => {
- this.$message.success('操作成功')
- this.getList()
- })
- },
- onSale (data) {
- let form = Object.assign({}, data)
- form.isSale = 1
- updateOTATicketSale(form).then(res => {
- this.$message.success('操作成功')
- this.getList()
- })
- },
- // fetchBatchConfigList () {
- // getBatchConfigList({ pageNum: 1, pageSize: -1 }).then(res => {
- // this.batchConfigList = res.list
- // })
- // },
- getBatchName (id) {
- if (!id || id === -1) { // null或者0 不显示(-1为以前为绑定)
- return ''
- } else {
- const batch = this.batchConfigList.find(v => v.id === id)
- return batch ? batch.name : ''
- }
- }
- }
- }
- </script>
|