priceList.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. <template>
  2. <div class="form-wrap">
  3. <div class="searchBox">
  4. <el-form
  5. ref="form"
  6. :model="form"
  7. :inline="true"
  8. label-width="150px">
  9. <el-form-item
  10. label="产品ID"
  11. prop="otaProductId">
  12. <el-input
  13. v-model="form.otaProductId"
  14. clearable></el-input>
  15. </el-form-item>
  16. <el-form-item
  17. label="分销商名称"
  18. prop="otaSourceId">
  19. <el-select
  20. v-model="form.otaSourceId"
  21. filterable>
  22. <el-option
  23. value=""
  24. label="全部"></el-option>
  25. <el-option
  26. v-for="item in otaList"
  27. :key="item.id"
  28. :value="item.otaSourceId"
  29. :label="item.otaSourceName"></el-option>
  30. </el-select>
  31. </el-form-item>
  32. <el-form-item
  33. label="票种"
  34. prop="ticketTypeId">
  35. <el-select
  36. v-model="form.ticketTypeId"
  37. filterable>
  38. <el-option
  39. value=""
  40. label="全部"></el-option>
  41. <el-option
  42. v-for="item in ticketTypeList"
  43. :key="item.id"
  44. :value="item.ticketTypeId"
  45. :label="item.name"></el-option>
  46. </el-select>
  47. </el-form-item>
  48. <el-form-item
  49. label="是否可售"
  50. prop="isSale">
  51. <el-select
  52. v-model="form.isSale">
  53. <el-option
  54. value=""
  55. label="全部"></el-option>
  56. <el-option
  57. :value="1"
  58. label="可售"></el-option>
  59. <el-option
  60. :value="0"
  61. label="不可售"></el-option>
  62. </el-select>
  63. </el-form-item>
  64. <el-form-item
  65. label="价格"
  66. prop="salePrice">
  67. <el-input
  68. v-model="form.salePrice"
  69. clearable></el-input>
  70. </el-form-item>
  71. </el-form>
  72. <div class="btn-wrap">
  73. <el-button @click="reset">重置</el-button>
  74. <el-button
  75. type="primary"
  76. @click="getList">搜索</el-button>
  77. <el-button
  78. type="primary"
  79. plain
  80. v-if="canEdit"
  81. @click="showDialog('add')">创建产品</el-button>
  82. <el-button
  83. type="danger"
  84. @click="batchDelete">批量删除</el-button>
  85. </div>
  86. </div>
  87. <div class="tableBox">
  88. <!-- <div class="block-title">查询信息</div> -->
  89. <el-table
  90. stripe
  91. :data="tableData"
  92. row-class-name="is-center"
  93. @selection-change="handleSelectionChange"
  94. v-loading="loading">
  95. <el-table-column
  96. type="selection"
  97. width="55">
  98. </el-table-column>
  99. <!-- <el-table-column type="expand">
  100. <template slot-scope="scope">
  101. <el-form
  102. label-position="right"
  103. inline
  104. class="table-expand"
  105. label-width="120px"
  106. >
  107. <el-form-item label="游玩天数">
  108. <span>{{ scope.row.useValidDays }} 天</span>
  109. </el-form-item>
  110. <el-form-item label="最小起订数">
  111. <span>{{ scope.row.minOrderNum }}</span>
  112. </el-form-item>
  113. <el-form-item label="最大限订数">
  114. <span>{{ scope.row.maxOrderNum }}</span>
  115. </el-form-item>
  116. </el-form>
  117. </template>
  118. </el-table-column> -->
  119. <el-table-column type="expand">
  120. <template slot-scope="props">
  121. <div class="title">场次</div>
  122. <el-table
  123. :data="props.row.batchConfigList"
  124. :max-height="200">
  125. <el-table-column
  126. prop="id"
  127. label="skuId"
  128. ></el-table-column>
  129. <el-table-column
  130. prop="name"
  131. label="场次名称"
  132. >
  133. </el-table-column>
  134. <el-table-column
  135. prop="startTime"
  136. label="开始时间"
  137. width="170px"
  138. >
  139. </el-table-column>
  140. <el-table-column
  141. prop="endTime"
  142. label="结束时间"
  143. width="170px"
  144. >
  145. </el-table-column>
  146. <el-table-column
  147. prop="leftNums"
  148. label="库存"
  149. width="120px"
  150. >
  151. </el-table-column>
  152. </el-table>
  153. <!-- 美团场次票信息 -->
  154. <template v-if="props.row.mtProductLevelList && props.row.mtProductLevelList.length > 0">
  155. <div
  156. class="title"
  157. style="margin-top: 15px;">美团场次票</div>
  158. <el-table
  159. :data="props.row.mtProductLevelList"
  160. :max-height="200">
  161. <el-table-column
  162. prop="batchConfigName"
  163. label="场次名称"
  164. ></el-table-column>
  165. <el-table-column
  166. prop="marketPrice"
  167. label="市场价"
  168. ></el-table-column>
  169. <el-table-column
  170. prop="mtPrice"
  171. label="美团价"
  172. ></el-table-column>
  173. <el-table-column
  174. prop="settlementPrice"
  175. label="结算价"
  176. ></el-table-column>
  177. <el-table-column
  178. prop="priceDate"
  179. label="日期范围"
  180. ></el-table-column>
  181. </el-table>
  182. </template>
  183. <!-- 携程场次票信息 -->
  184. <template v-if="props.row.xcProductLevelList && props.row.xcProductLevelList.length > 0">
  185. <div
  186. class="title"
  187. style="margin-top: 15px;">携程场次票</div>
  188. <el-table
  189. :data="props.row.xcProductLevelList"
  190. :max-height="200">
  191. <el-table-column
  192. prop="batchConfigName"
  193. label="场次名称"
  194. ></el-table-column>
  195. <el-table-column
  196. prop="status"
  197. label="状态">
  198. <template slot-scope="scope">
  199. {{ scope.row.status === 'active' ? '有效' : '无效' }}
  200. </template>
  201. </el-table-column>
  202. <el-table-column
  203. prop="effectiveDays"
  204. label="可售天数"
  205. ></el-table-column>
  206. <el-table-column
  207. label="提前预订">
  208. <template slot-scope="scope">
  209. {{ scope.row.requiredAdvanceBooking === 1 ? '是' : '否' }}
  210. </template>
  211. </el-table-column>
  212. <el-table-column
  213. prop="advanceDays"
  214. label="提前天数"
  215. ></el-table-column>
  216. <el-table-column
  217. prop="advanceTime"
  218. label="预订时间"
  219. ></el-table-column>
  220. <el-table-column
  221. prop="advanceMinutes"
  222. label="生效等待(分钟)"
  223. ></el-table-column>
  224. </el-table>
  225. </template>
  226. </template>
  227. </el-table-column>
  228. <el-table-column
  229. label="产品ID"
  230. prop="id">
  231. <template
  232. slot="header">
  233. 产品ID
  234. <Tip msg="表格中的产品ID,请填写在OTA平台中的商品配置中,和该商品绑定"></Tip>
  235. </template>
  236. </el-table-column>
  237. <el-table-column
  238. label="票种"
  239. prop="ticketTypeName">
  240. </el-table-column>
  241. <el-table-column
  242. prop="otaSourceName"
  243. label="分销商">
  244. <template slot-scope="scope">
  245. {{ scope.row.otaSourceName }}
  246. <span v-if="scope.row.ksProductId">(快手商品ID:{{ scope.row.ksProductId }})</span>
  247. </template>
  248. </el-table-column>
  249. <el-table-column
  250. width="80"
  251. prop="salePrice"
  252. label="价格">
  253. </el-table-column>
  254. <el-table-column
  255. width="80"
  256. prop="marketPrice"
  257. label="市场价">
  258. </el-table-column>
  259. <el-table-column
  260. width="80"
  261. prop="settlementPrice"
  262. label="结算价">
  263. </el-table-column>
  264. <!-- <el-table-column
  265. prop="name"
  266. label="产品名称">
  267. </el-table-column> -->
  268. <!-- <el-table-column
  269. prop="batchConfigName"
  270. label="场次">
  271. <template slot-scope="scope">
  272. {{ scope.row.batchConfigName ? scope.row.batchConfigName : '' }}
  273. </template>
  274. </el-table-column> -->
  275. <el-table-column
  276. width="170"
  277. label="可售日期"
  278. >
  279. <template slot-scope="scope">
  280. {{ scope.row.saleDateStart | formatDate }} 至 {{ scope.row.saleDateEnd | formatDate }}
  281. </template>
  282. </el-table-column>
  283. <el-table-column
  284. width="170"
  285. label="游玩日期"
  286. >
  287. <template slot-scope="scope">
  288. {{ scope.row.useDateStart | formatDate }} 至 {{ scope.row.useDateEnd | formatDate }}
  289. </template>
  290. </el-table-column>
  291. <el-table-column
  292. prop="totalStock"
  293. label="总库存">
  294. <template slot-scope="scope">
  295. {{ scope.row.totalStock > 0 ? scope.row.totalStock : '不限库存' }}
  296. </template>
  297. </el-table-column>
  298. <el-table-column
  299. prop="xcRealNameType"
  300. label="携程出行人模板">
  301. <template slot-scope="scope">
  302. {{ scope.row.xcRealNameType | formatXCProductName }}
  303. </template>
  304. </el-table-column>
  305. <el-table-column
  306. width="110"
  307. label="状态">
  308. <template slot-scope="scope">
  309. <span>{{ scope.row.isSale ? '已激活' : '已禁用' }}</span>
  310. <span v-if="canEdit">
  311. <el-button
  312. type="text"
  313. @click="offSale(scope.row)"
  314. class="offSale-btn"
  315. v-if="scope.row.isSale"><i class="iconfont icon-offSale"></i>禁用</el-button>
  316. <el-button
  317. type="text"
  318. @click="onSale(scope.row)"
  319. class="onSale-btn"
  320. v-else><i class="iconfont icon-onSale"></i>激活</el-button>
  321. </span>
  322. </template>
  323. </el-table-column>
  324. <el-table-column
  325. v-if="canEdit"
  326. width="120"
  327. label="操作">
  328. <template slot-scope="scope">
  329. <!-- <el-button
  330. v-if="scope.row.otaSourceName==='携程网'"
  331. type="text"
  332. @click="$refs.xcPriceCalendar.show(scope.row.id)"
  333. >
  334. <i class="el-icon-date"></i>
  335. 价格方案
  336. </el-button>
  337. <el-button
  338. v-if="scope.row.otaSourceName==='携程网'"
  339. type="text"
  340. @click="$refs.xcStock.show(scope.row.id)"
  341. >
  342. <i class="el-icon-date"></i>
  343. 库存方案
  344. </el-button>
  345. <el-button
  346. v-else
  347. type="text"
  348. @click="$refs.priceCalendar.show(scope.row.id)"
  349. >
  350. <i class="el-icon-date"></i>
  351. 价格方案
  352. </el-button> -->
  353. <el-button
  354. type="text"
  355. @click="showDialog('edit', scope.row)">
  356. <i class="el-icon-edit"></i>
  357. 编辑
  358. </el-button>
  359. <el-button
  360. type="text"
  361. @click="deleteItem(scope.row)">
  362. <i class="el-icon-delete"></i>
  363. 删除
  364. </el-button>
  365. <!-- <el-button
  366. v-if="scope.row.otaSourceCode==='KS'"
  367. type="text"
  368. @click="$refs.KSNewDialogRef.show(scope.row)"
  369. >
  370. 同步商品
  371. </el-button>
  372. <el-button
  373. v-if="scope.row.otaSourceCode==='KS' && scope.row.ksProductId"
  374. type="text"
  375. @click="$refs.KSUpdateDialogRef.show(scope.row)"
  376. >
  377. 同步商品价格库存
  378. </el-button> -->
  379. </template>
  380. </el-table-column>
  381. </el-table>
  382. <el-pagination
  383. background
  384. :current-page.sync="form.pageNum"
  385. @current-change="getList"
  386. layout="total, prev, pager, next"
  387. :total="total">
  388. </el-pagination>
  389. </div>
  390. <ElDialog
  391. :title="dialogType === 'add' ? '创建产品' : '编辑产品'"
  392. width="1000px"
  393. v-model="dialogVisible">
  394. <EditDialog
  395. :perform-list="performList"
  396. :dialog-type="dialogType"
  397. :ticket-type-list="ticketTypeList"
  398. :ota-list="otaList"
  399. :batch-config-list="batchConfigList"
  400. :current-item="currentItem"
  401. @updateList="getList"></EditDialog>
  402. </ElDialog>
  403. <KSNewDialog ref="KSNewDialogRef"></KSNewDialog>
  404. <KSUpdateDialog ref="KSUpdateDialogRef"></KSUpdateDialog>
  405. <PriceCalendar ref="priceCalendar"></PriceCalendar>
  406. <xcPriceCalendar ref="xcPriceCalendar"></xcPriceCalendar>
  407. <XCStock ref="xcStock"></XCStock>
  408. </div>
  409. </template>
  410. <script>
  411. import { getTicketTypeList } from '@/api/ticketType'
  412. import {
  413. // getPerformList,
  414. getOTATicketSaleList,
  415. deleteOTATicketSale,
  416. updateOTATicketSale
  417. // getBatchConfigList,
  418. } from '@/api/otaTicketSale'
  419. import { getOtaProjectList } from '@/api/ota'
  420. import ElDialog from '@/components/Dialog'
  421. import EditDialog from './priceList/EditDialog'
  422. import KSNewDialog from './priceList/KSNewDialog'
  423. import KSUpdateDialog from './priceList/KSUpdateDialog'
  424. import PriceCalendar from './priceList/PriceCalendar'
  425. import xcPriceCalendar from './priceList/xcPriceCalendar'
  426. import XCStock from './priceList/xcStock'
  427. export default {
  428. components: {
  429. ElDialog,
  430. EditDialog,
  431. KSNewDialog,
  432. KSUpdateDialog,
  433. PriceCalendar,
  434. xcPriceCalendar,
  435. XCStock
  436. },
  437. data () {
  438. return {
  439. projectName: localStorage.getItem('otaProject'),
  440. performList: [],
  441. dialogType: 'add',
  442. dialogVisible: false,
  443. form: {
  444. pageNum: 1,
  445. pageSize: 10,
  446. isSale: '',
  447. otaSourceId: '',
  448. ticketTypeId: '',
  449. salePrice: '',
  450. otaProductId: ''
  451. },
  452. loading: false,
  453. multipleSelection: [], // 批量删除多选数组
  454. total: 0,
  455. tableData: [],
  456. currentItem: {},
  457. ticketTypeList: [], // 票种列表
  458. batchConfigList: [],
  459. otaList: []
  460. }
  461. },
  462. created () {
  463. this.getTicketTypeList()
  464. this.getList()
  465. // this.fetchBatchConfigList()
  466. // getPerformList(this.projectName).then((res) => {
  467. // this.performList = res.extraInfo
  468. // })
  469. getOtaProjectList({
  470. pageNum: 1,
  471. pageSize: -1
  472. }).then(res => {
  473. this.otaList = res.data.records
  474. })
  475. },
  476. filters: {
  477. formatXCProductName (time) {
  478. if (!time) return ''
  479. const map = {
  480. '1': '一张一人需要证件',
  481. '2': '一张一人不需要证件',
  482. '3': '一单一人需要证件',
  483. '4': '一单一人不需要证件'
  484. }
  485. return map[time] || ''
  486. }
  487. },
  488. computed: {
  489. canEdit () {
  490. return true
  491. // return this.$store.state.user.permissionList.includes('product:pricecode_edit')
  492. },
  493. queryClear () {
  494. return this.$store.state.user.permissionList.includes('stats:clearwx_query')
  495. }
  496. },
  497. methods: {
  498. handleSelectionChange (val) {
  499. this.multipleSelection = val
  500. },
  501. // 批量删除产品
  502. batchDelete () {
  503. if (!this.multipleSelection || !this.multipleSelection.length) {
  504. this.$message.error('请先选择批量删除的产品记录')
  505. return
  506. }
  507. const ids = this.multipleSelection.map(item => item.id)
  508. this.$confirm(`将删除这${ids.length}条记录, 是否继续?`, '提示', {
  509. confirmButtonText: '确定',
  510. cancelButtonText: '取消',
  511. type: 'warning'
  512. }).then(() => {
  513. deleteOTATicketSale({ idList: ids }).then(res => {
  514. this.$message.success('批量删除成功')
  515. this.multipleSelection = [] // 清空选中待删记录
  516. this.getList()
  517. }).catch(() => {
  518. this.$message({
  519. type: 'success',
  520. message: '批量删除出错!'
  521. })
  522. this.multipleSelection = [] // 清空选中待删记录
  523. this.getList()
  524. })
  525. }).catch(() => {
  526. this.$message({
  527. type: 'info',
  528. message: '已取消删除'
  529. })
  530. })
  531. },
  532. // 获取票种列表
  533. getTicketTypeList () {
  534. return getTicketTypeList({
  535. pageNum: 1,
  536. pageSize: -1
  537. }).then(res => {
  538. this.ticketTypeList = res.data.records
  539. })
  540. },
  541. // 获取列表
  542. getList () {
  543. this.loading = true
  544. getOTATicketSaleList(this.form).then(res => {
  545. this.total = res.data.total
  546. this.tableData = res.data.records
  547. this.loading = false
  548. })
  549. },
  550. // 打开编辑对话框
  551. showDialog (type, item) {
  552. // 每次打开弹框时重新查询票种列表
  553. this.getTicketTypeList().then(() => {
  554. this.dialogType = type
  555. this.currentItem = item || {}
  556. this.dialogVisible = true
  557. })
  558. },
  559. // 删除产品
  560. deleteItem (item) {
  561. this.$confirm('确定删除?', '提示', {
  562. confirmButtonText: '确定',
  563. cancelButtonText: '取消',
  564. type: 'warning'
  565. }).then(() => {
  566. deleteOTATicketSale({ idList: [item.id] }).then(res => {
  567. this.$message.success('删除成功')
  568. this.getList()
  569. })
  570. })
  571. },
  572. reset () {
  573. this.$refs.form.resetFields()
  574. },
  575. offSale (data) {
  576. let form = Object.assign({}, data)
  577. form.isSale = 0
  578. updateOTATicketSale(form).then(res => {
  579. this.$message.success('操作成功')
  580. this.getList()
  581. })
  582. },
  583. onSale (data) {
  584. let form = Object.assign({}, data)
  585. form.isSale = 1
  586. updateOTATicketSale(form).then(res => {
  587. this.$message.success('操作成功')
  588. this.getList()
  589. })
  590. },
  591. // fetchBatchConfigList () {
  592. // getBatchConfigList({ pageNum: 1, pageSize: -1 }).then(res => {
  593. // this.batchConfigList = res.list
  594. // })
  595. // },
  596. getBatchName (id) {
  597. if (!id || id === -1) { // null或者0 不显示(-1为以前为绑定)
  598. return ''
  599. } else {
  600. const batch = this.batchConfigList.find(v => v.id === id)
  601. return batch ? batch.name : ''
  602. }
  603. }
  604. }
  605. }
  606. </script>