<template>
|
<TableLayout :permissions="['business:bikes:query']">
|
<!-- 搜索表单 -->
|
<el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
|
<el-form-item label="商品名称" prop="productName">
|
<el-input v-model="searchForm.productName" placeholder="请输入商品名称" @keypress.enter.native="search"></el-input>
|
</el-form-item>
|
<el-form-item label="套餐名称" prop="discountName">
|
<el-input v-model="searchForm.discountName" placeholder="请输入套餐名称" @keypress.enter.native="search"></el-input>
|
</el-form-item>
|
<section>
|
<el-button type="primary" @click="search">搜索</el-button>
|
<el-button @click="reset">重置</el-button>
|
</section>
|
</el-form>
|
<!-- 表格和分页 -->
|
<template v-slot:table-wrap>
|
<ul class="toolbar">
|
<li><el-button type="primary" :loading="isWorking.sync" :disabled="isWorking.sync" @click="handleSync">同步商品</el-button></li>
|
</ul>
|
<el-table
|
v-loading="isWorking.search"
|
:data="tableData.list"
|
stripe
|
>
|
<el-table-column prop="productId" label="抖音商品ID" min-width="100px"></el-table-column>
|
<el-table-column prop="productName" label="抖音商品名称" min-width="100px"></el-table-column>
|
<el-table-column prop="price" label="抖音商品价格" min-width="100px">
|
<template slot-scope="{row}">
|
{{ ((row.price || 0) / 100).toFixed(2) }}
|
</template>
|
</el-table-column>
|
<el-table-column prop="discountName" label="套餐名称" min-width="100px"></el-table-column>
|
<el-table-column prop="exchangedCount" label="已兑换数量" min-width="100px"></el-table-column>
|
<el-table-column prop="category" label="卡券类型" min-width="100px"></el-table-column>
|
<el-table-column prop="onlineStatus" label="销售状态" min-width="100px">
|
<template slot-scope="{row}">
|
{{ row.onlineStatus === 1 ? '售卖中' : row.onlineStatus === 2 ? '已下架' : '封禁' }}
|
</template>
|
</el-table-column>
|
<el-table-column prop="syncDate" label="同步时间" min-width="100px"></el-table-column>
|
<el-table-column
|
label="操作"
|
min-width="120"
|
fixed="right"
|
>
|
<template slot-scope="{row}">
|
<el-button type="text" @click="$refs.productConfigurationWindow.open('配置', row)">配置</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<pagination
|
@size-change="handleSizeChange"
|
@current-change="handlePageChange"
|
:pagination="tableData.pagination"
|
>
|
</pagination>
|
</template>
|
<!-- 配置弹窗 -->
|
<ProductConfigurationWindow ref="productConfigurationWindow" @success="handlePageChange"/>
|
</TableLayout>
|
</template>
|
|
<script>
|
import BaseTable from '@/components/base/BaseTable'
|
import TableLayout from '@/layouts/TableLayout'
|
import Pagination from '@/components/common/Pagination'
|
import ProductConfigurationWindow from '@/components/business/productConfiguration.vue'
|
import { sync } from '@/api/business/douyinProduct'
|
export default {
|
name: 'Goods',
|
extends: BaseTable,
|
components: { TableLayout, Pagination, ProductConfigurationWindow },
|
data () {
|
return {
|
// 搜索
|
searchForm: {
|
productName: '',
|
discountName: ''
|
},
|
isWorking: {
|
...this.isWorking,
|
sync: false
|
}
|
}
|
},
|
created () {
|
this.config({
|
module: '抖音商品',
|
api: '/business/douyinProduct',
|
'field.id': 'id',
|
'field.main': 'id'
|
})
|
this.search()
|
},
|
methods: {
|
handleSync () {
|
this.isWorking.sync = true
|
sync()
|
.then(() => {
|
this.$tip.apiSuccess('同步成功')
|
this.search()
|
})
|
.catch(e => {
|
this.$tip.apiFailed(e)
|
})
|
.finally(() => {
|
this.isWorking.sync = false
|
})
|
}
|
}
|
}
|
</script>
|