|
@@ -0,0 +1,265 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div class="mod-prod-prodTemplate">
|
|
|
|
|
+ <!-- 搜索相关区域 -->
|
|
|
|
|
+ <div class="search-bar">
|
|
|
|
|
+ <el-form :inline="true" class="search-form" ref="searchForm" :model="searchForm" label-width="auto" size="small">
|
|
|
|
|
+ <!-- 表单项 -->
|
|
|
|
|
+ <div class="input-row">
|
|
|
|
|
+ <el-form-item :label="$t('prodTemplate.templateStyle')+':'">
|
|
|
|
|
+ <el-select v-model="searchForm.templateStyleId" clearable filterable>
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="node in styleList"
|
|
|
|
|
+ :key="node.styleId"
|
|
|
|
|
+ :label="node.styleName"
|
|
|
|
|
+ :value="node.styleId"
|
|
|
|
|
+ ></el-option>
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item :label="$t('prodTemplate.templateSeries')+':'">
|
|
|
|
|
+ <el-select v-model="searchForm.templateSeriesId" clearable filterable>
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="node in seriesList"
|
|
|
|
|
+ :key="node.seriesId"
|
|
|
|
|
+ :label="node.seriesName"
|
|
|
|
|
+ :value="node.seriesId"
|
|
|
|
|
+ ></el-option>
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item>
|
|
|
|
|
+ <div class="default-btn primary-btn" @click="searchChange(true)">{{ $t('crud.searchBtn') }}</div>
|
|
|
|
|
+ <div class="default-btn" @click="resetForm()">{{ $t('shop.resetMap') }}</div>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <!-- 列表相关区域 -->
|
|
|
|
|
+ <div class="main-container">
|
|
|
|
|
+ <div class="operation-bar">
|
|
|
|
|
+ <div class="default-btn primary-btn" @click="addOrUpdateHandle()"
|
|
|
|
|
+ >{{$t("crud.addTitle")}}</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="table-con spec-table">
|
|
|
|
|
+ <el-table
|
|
|
|
|
+ ref="specListTable"
|
|
|
|
|
+ :data="dataList"
|
|
|
|
|
+ header-cell-class-name="table-header"
|
|
|
|
|
+ row-class-name="table-row"
|
|
|
|
|
+ style="width: 100%">
|
|
|
|
|
+ <!-- 模板图片地址 -->
|
|
|
|
|
+ <!--<el-table-column :label="$t('prodTemplate.templatePic')" prop="templatePic" align="center">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <span>{{ scope.row.templatePic}}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>-->
|
|
|
|
|
+ <el-table-column
|
|
|
|
|
+ align="center"
|
|
|
|
|
+ prop="templatePic"
|
|
|
|
|
+ :label="$t('prodTemplate.templatePic')"
|
|
|
|
|
+ width="300">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <img
|
|
|
|
|
+ :src="resourcesUrl + scope.row.templatePic"
|
|
|
|
|
+ width="100"
|
|
|
|
|
+ height="100"
|
|
|
|
|
+ v-if="scope.row.templatePic"
|
|
|
|
|
+ />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <!-- 模板风格 -->
|
|
|
|
|
+ <el-table-column :label="$t('prodTemplate.templateStyle')" prop="templateStyle" align="center">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <span>{{ scope.row.templateStyle}}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <!-- 模板下风格的系列,比如二次元风格的海贼王系列 -->
|
|
|
|
|
+ <el-table-column :label="$t('prodTemplate.templateSeries')" prop="templateSeries" align="center">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <span>{{ scope.row.templateSeries}}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <!-- 商家ID -->
|
|
|
|
|
+<!-- <el-table-column :label="$t('prodTemplate.shopId')" prop="shopId" align="center">-->
|
|
|
|
|
+<!-- <template slot-scope="scope">-->
|
|
|
|
|
+<!-- <span>{{ scope.row.shopId}}</span>-->
|
|
|
|
|
+<!-- </template>-->
|
|
|
|
|
+<!-- </el-table-column>-->
|
|
|
|
|
+ <!-- 1启用 0禁用 -->
|
|
|
|
|
+ <!-- 模板面,Front:正面,Back:背面 -->
|
|
|
|
|
+ <el-table-column :label="$t('prodTemplate.templateSide')" prop="templateSide" align="center">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <span v-if="scope.row.templateSide == 'Front'">正面</span>
|
|
|
|
|
+ <span v-if="scope.row.templateSide == 'Back'">背面</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column :label="$t('prodTemplate.status')" prop="status" align="center">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-tag type="success" v-if="scope.row.status == 1">启用</el-tag>
|
|
|
|
|
+ <el-tag type="danger" v-if="scope.row.status == 0">禁用</el-tag>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column align="center" fixed="right" :label="$t('publics.operating')" width="auto">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <div class="text-btn-con">
|
|
|
|
|
+ <div class="default-btn text-btn" @click="addOrUpdateHandle(scope.row.templateId)"
|
|
|
|
|
+ >{{$t("crud.updateBtn")}}</div>
|
|
|
|
|
+ <div class="default-btn text-btn" @click.stop="deleteHandle(scope.row.templateId)"
|
|
|
|
|
+ >{{$t("text.delBtn")}}</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-pagination
|
|
|
|
|
+ v-if="dataList.length"
|
|
|
|
|
+ @size-change="handleSizeChange"
|
|
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
|
|
+ :current-page="page.currentPage"
|
|
|
|
|
+ :page-sizes="[10, 20, 50, 100]"
|
|
|
|
|
+ :page-size="page.pageSize"
|
|
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
|
|
+ :total="page.total">
|
|
|
|
|
+ </el-pagination>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="refreshChange"></add-or-update>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script>
|
|
|
|
|
+import AddOrUpdate from './prodTemplate-add-or-update'
|
|
|
|
|
+export default {
|
|
|
|
|
+ data () {
|
|
|
|
|
+ return {
|
|
|
|
|
+ dataList: [],
|
|
|
|
|
+ page: {
|
|
|
|
|
+ total: 0, // 总页数
|
|
|
|
|
+ currentPage: 1, // 当前页数
|
|
|
|
|
+ pageSize: 10 // 每页显示多少条
|
|
|
|
|
+ },
|
|
|
|
|
+ searchForm: {}, // 搜索
|
|
|
|
|
+ dataListLoading: false,
|
|
|
|
|
+ addOrUpdateVisible: false,
|
|
|
|
|
+ seriesList: [],
|
|
|
|
|
+ styleList: [],
|
|
|
|
|
+ resourcesUrl: process.env.VUE_APP_RESOURCES_URL
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ components: {
|
|
|
|
|
+ AddOrUpdate
|
|
|
|
|
+ },
|
|
|
|
|
+ created () {
|
|
|
|
|
+ this.getDataList()
|
|
|
|
|
+ this.getStyleList()
|
|
|
|
|
+ this.getSeriesList()
|
|
|
|
|
+ },
|
|
|
|
|
+ mounted () {
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ getStyleList () {
|
|
|
|
|
+ this.$http({
|
|
|
|
|
+ url: this.$http.adornUrl('/prod/prodTemplateStyle/page'),
|
|
|
|
|
+ method: 'get',
|
|
|
|
|
+ params: this.$http.adornParams(
|
|
|
|
|
+ Object.assign({
|
|
|
|
|
+ size: 100,
|
|
|
|
|
+ shopId: this.$store.state.user.shopId
|
|
|
|
|
+ },
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ }).then(({data}) => {
|
|
|
|
|
+ this.styleList = data.records
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ getSeriesList () {
|
|
|
|
|
+ this.$http({
|
|
|
|
|
+ url: this.$http.adornUrl('/prod/prodTemplateSeries/page'),
|
|
|
|
|
+ method: 'get',
|
|
|
|
|
+ params: this.$http.adornParams(
|
|
|
|
|
+ Object.assign({
|
|
|
|
|
+ size: 100,
|
|
|
|
|
+ shopId: this.$store.state.user.shopId
|
|
|
|
|
+ },
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ }).then(({data}) => {
|
|
|
|
|
+ this.seriesList = data.records
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ getDataList (page) {
|
|
|
|
|
+ this.dataListLoading = true
|
|
|
|
|
+ this.$http({
|
|
|
|
|
+ url: this.$http.adornUrl('/prod/prodTemplate/page'),
|
|
|
|
|
+ method: 'get',
|
|
|
|
|
+ params: this.$http.adornParams(
|
|
|
|
|
+ Object.assign({
|
|
|
|
|
+ current: page == null ? this.page.currentPage : page.currentPage,
|
|
|
|
|
+ size: page == null ? this.page.pageSize : page.pageSize,
|
|
|
|
|
+ shopId: this.$store.state.user.shopId
|
|
|
|
|
+ },
|
|
|
|
|
+ this.searchForm
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ }).then(({data}) => {
|
|
|
|
|
+ this.dataList = data.records
|
|
|
|
|
+ this.page.total = data.total
|
|
|
|
|
+ this.dataListLoading = false
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ // 新增 / 修改
|
|
|
|
|
+ addOrUpdateHandle (id) {
|
|
|
|
|
+ this.addOrUpdateVisible = true
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.$refs.addOrUpdate.init(id)
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ deleteHandle (id) {
|
|
|
|
|
+ this.$confirm(this.$i18n.t('admin.isDeleOper') + '?', this.$i18n.t('text.tips'), {
|
|
|
|
|
+ confirmButtonText: this.$i18n.t('crud.filter.submitBtn'),
|
|
|
|
|
+ cancelButtonText: this.$i18n.t('crud.filter.cancelBtn'),
|
|
|
|
|
+ type: 'warning'
|
|
|
|
|
+ }).then(() => {
|
|
|
|
|
+ this.$http({
|
|
|
|
|
+ url: this.$http.adornUrl('/prod/prodTemplate/' + id),
|
|
|
|
|
+ method: 'delete',
|
|
|
|
|
+ data: this.$http.adornData({})
|
|
|
|
|
+ }).then(({ data }) => {
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ message: this.$i18n.t('publics.operation'),
|
|
|
|
|
+ type: 'success',
|
|
|
|
|
+ duration: 1500,
|
|
|
|
|
+ onClose: () => {
|
|
|
|
|
+ this.refreshChange()
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ }).catch(() => { })
|
|
|
|
|
+ },
|
|
|
|
|
+ resetForm () {
|
|
|
|
|
+ this.searchForm = {
|
|
|
|
|
+ templateStyleId: null,
|
|
|
|
|
+ templateSeriesId: null
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ // 刷新回调
|
|
|
|
|
+ refreshChange () {
|
|
|
|
|
+ this.page.currentPage = 1
|
|
|
|
|
+ this.getDataList(this.page)
|
|
|
|
|
+ },
|
|
|
|
|
+ searchChange (params) {
|
|
|
|
|
+ this.searchForm = params
|
|
|
|
|
+ this.getDataList(this.page)
|
|
|
|
|
+ },
|
|
|
|
|
+ handleSizeChange (val) {
|
|
|
|
|
+ this.page.pageSize = val
|
|
|
|
|
+ this.getDataList()
|
|
|
|
|
+ },
|
|
|
|
|
+ handleCurrentChange (val) {
|
|
|
|
|
+ this.page.currentPage = val
|
|
|
|
|
+ this.getDataList()
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+</script>
|
|
|
|
|
+<style lang="scss">
|
|
|
|
|
+.mod-prod-prodTemplate {
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|