| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- <template>
- <el-dialog
- width="1200px"
- title="创建商品"
- :before-close="handleClose"
- :visible.sync="visible"
- >
- <el-form
- inline
- :model="form"
- ref="form"
- label-width="180px">
- <div class="dialog-info">
- <el-form-item
- verify
- prop="poiId"
- label="商家ID"
- >
- <el-input
- v-model="form.poiId"
- ></el-input>
- </el-form-item>
- <div style="width:100%">
- <el-button
- :disabled="!form.poiId"
- @click="handleAdd"
- style="margin:5px 0">添加日历计划</el-button>
- <el-table :data="form.ticket_specification.calendars">
- <el-table-column
- prop="origin_amount"
- label="原价(单位:分)">
- <template slot-scope="scope">
- <el-input-number
- v-model="scope.row.origin_amount"
- :min="0"
- :precision="0" />
- </template>
- </el-table-column>
- <el-table-column
- prop="actual_amount"
- label="实际售价(单位:分)">
- <template slot-scope="scope">
- <el-input-number
- v-model="scope.row.actual_amount"
- :min="0"
- :precision="0" />
- </template>
- </el-table-column>
- <el-table-column
- prop="stock_qty"
- label="库存">
- <template slot-scope="scope">
- <el-input-number
- v-model="scope.row.stock_qty"
- :min="0"
- :precision="0" />
- </template>
- </el-table-column>
- <el-table-column
- prop="value_list"
- label="日期范围"
- width="300"
- >
- <template slot-scope="scope">
- <el-date-picker
- style="width:270px"
- v-model="scope.row.value_list"
- value-format="yyyyMMdd"
- type="daterange"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- </template>
- </el-table-column>
- <el-table-column
- prop="action"
- label="操作"
- width="100">
- <template slot-scope="scope">
- <el-button @click="handleDelete(scope.$index)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- <div class="dialog-btn-wrap">
- <el-button
- @click="submit"
- type="primary">同步</el-button>
- </div>
- </el-form>
- </el-dialog>
- </template>
- <script>
- import { ksUpdatePriceOrStock } from '@/api/otaTicketSale'
- import moment from 'moment'
- export default {
- data () {
- return {
- visible: false,
- uploadUrl: '',
- form: {
- product_id: '',
- poiId: '',
- ticket_specification: {
- calendars: [],
- sku_id: ''
- }
- },
- calendars_value_list: []
- }
- },
- methods: {
- show (data) {
- this.visible = true
- this.form.product_id = data.ksProductId || 0
- this.form.ticket_specification.sku_id = data.ks_sku_id || 0
- let startDate = moment().format('YYYY-MM-DD HH:mm:ss')
- let endDate = moment().add(179, 'days').format('YYYY-MM-DD HH:mm:ss')
- startDate = startDate.split(' ')[0].replaceAll('-', '')
- endDate = endDate.split(' ')[0].replaceAll('-', '')
- this.calendars_value_list = [startDate, endDate]
- },
- handleClose () {
- this.visible = false
- },
- submit () {
- this.$refs.form.validate((valid) => {
- if (valid) {
- let params = JSON.parse(JSON.stringify(this.form))
- ksUpdatePriceOrStock(params, this.form.poiId).then(res => {
- if (res.extraInfo.data.error_code) {
- this.$message.error(res.extraInfo.data.description)
- } else {
- this.$message.success('同步成功')
- this.handleClose()
- this.$emit('update')
- }
- })
- } else {
- console.log('error submit!!')
- return false
- }
- })
- },
- handleAdd () {
- this.form.ticket_specification.calendars.push(
- {
- actual_amount: 0,
- calendar_type: 1,
- exclude_date_list: [],
- origin_amount: 0,
- status: 1,
- stock_qty: 0,
- value_list: this.calendars_value_list || []
- }
- )
- },
- handleDelete (index) {
- this.form.ticket_specification.calendars.splice(index, 1)
- }
- },
- created () {
- }
- }
- </script>
- <style scoped>
- .el-tag + .el-tag {
- margin-left: 10px;
- }
- .button-new-tag {
- margin-left: 10px;
- height: 32px;
- line-height: 30px;
- padding-top: 0;
- padding-bottom: 0;
- }
- .input-new-tag {
- width: 90px;
- margin-left: 10px;
- vertical-align: bottom;
- }
- ::v-deep .el-cascader-node {
- position: relative;
- display: flex;
- align-items: center;
- padding: 0 30px 0 20px;
- height: 34px;
- line-height: 34px;
- outline: none;
- }
- </style>
|