|
@@ -0,0 +1,951 @@
|
|
|
+<style lang="scss" scoped>
|
|
|
+/deep/.vue-treeselect__control {
|
|
|
+ line-height: 36px !important;
|
|
|
+}
|
|
|
+/deep/ .ant-collapse-item,
|
|
|
+/deep/.ant-collapse-content {
|
|
|
+ overflow: inherit !important;
|
|
|
+}
|
|
|
+.search-bar {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+.search-box p {
|
|
|
+ display: inline-block;
|
|
|
+ border: 1px solid #f2f2f2;
|
|
|
+ border-radius: 5px;
|
|
|
+ margin-right: 10px;
|
|
|
+ padding: 5px 10px;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
+</style>
|
|
|
+<style scoped>
|
|
|
+.showNumBox {
|
|
|
+ margin: 10px 0;
|
|
|
+}
|
|
|
+.showNumBox .ant-card-body {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+}
|
|
|
+.showNumBox p,
|
|
|
+.showNumBox span {
|
|
|
+ text-align: center;
|
|
|
+ line-height: 40px;
|
|
|
+ font-size: 30px;
|
|
|
+ font-weight: 600;
|
|
|
+ color: red;
|
|
|
+ margin: 0;
|
|
|
+}
|
|
|
+.search-box .ant-card-body {
|
|
|
+ padding: 5px 15px;
|
|
|
+}
|
|
|
+.showNumBox .ant-card-body .styleElse {
|
|
|
+ line-height: 60px;
|
|
|
+ height: 40px;
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: 400;
|
|
|
+ margin-left: 10px;
|
|
|
+}
|
|
|
+.ant-modal-wrap .yincang .ant-modal-content .ant-modal-footer {
|
|
|
+ display: none !important;
|
|
|
+}
|
|
|
+.yincang .ant-col-6 p {
|
|
|
+ text-align: left;
|
|
|
+ color: red;
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: 500;
|
|
|
+}
|
|
|
+.ant-table-thead div {
|
|
|
+ font-weight: 700;
|
|
|
+}
|
|
|
+.tool-tip {
|
|
|
+ position: absolute;
|
|
|
+ top: 65px;
|
|
|
+ right: 10px;
|
|
|
+}
|
|
|
+</style>
|
|
|
+<style lang="less" scoped>
|
|
|
+.ant-card-head .ant-tabs-bar {
|
|
|
+ padding: 0;
|
|
|
+}
|
|
|
+.search-box .ant-card-body {
|
|
|
+ padding: 5px 15px;
|
|
|
+}
|
|
|
+.search-box {
|
|
|
+ padding: 15px 10px;
|
|
|
+}
|
|
|
+.search-box p {
|
|
|
+ display: inline-block;
|
|
|
+ border: 1px solid #f2f2f2;
|
|
|
+ border-radius: 5px;
|
|
|
+ margin-right: 10px;
|
|
|
+ padding: 5px 10px;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
+.statistics .ant-col-6 .ant-card-body .styleElse {
|
|
|
+ line-height: 60px;
|
|
|
+ height: 40px;
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: 400;
|
|
|
+ margin-left: 10px;
|
|
|
+}
|
|
|
+.ant-modal-wrap .yincang .ant-modal-content .ant-modal-footer {
|
|
|
+ display: none !important;
|
|
|
+}
|
|
|
+.yincang .ant-col-6 p {
|
|
|
+ text-align: left;
|
|
|
+ color: red;
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: 500;
|
|
|
+}
|
|
|
+.ant-table-thead div {
|
|
|
+ font-weight: 700;
|
|
|
+}
|
|
|
+.tool-tip {
|
|
|
+ position: absolute;
|
|
|
+ top: 65px;
|
|
|
+ right: 10px;
|
|
|
+}
|
|
|
+.statistics {
|
|
|
+ .ant-card-bordered {
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ .ant-card-head .ant-tabs {
|
|
|
+ clear: both;
|
|
|
+ margin-bottom: -13px;
|
|
|
+ color: rgba(0, 0, 0, 0.65);
|
|
|
+ font-weight: normal;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ .duibi {
|
|
|
+ position: absolute;
|
|
|
+ right: 24px;
|
|
|
+ top: 15px;
|
|
|
+ }
|
|
|
+ p {
|
|
|
+ margin-bottom: 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+@import 'channelManage';
|
|
|
+</style>
|
|
|
+<template>
|
|
|
+ <div class="channelManage config-project">
|
|
|
+ <a-card>
|
|
|
+ <div class="table-page-search-wrapper">
|
|
|
+ <a-form layout="inline" :form="form" hide-required-mark :selfUpdate="true" @submit="handleQueryList">
|
|
|
+ <a-row :gutter="24">
|
|
|
+ <!-- <a-col :md="8" :sm="8" :xxl="6">
|
|
|
+ <selectTable :projectId.sync="productId" ref="selectTable"></selectTable>
|
|
|
+ </a-col> -->
|
|
|
+
|
|
|
+ <a-col :md="8" :sm="8" :xxl="6">
|
|
|
+ <selectTableProject
|
|
|
+ :projectId.sync="projectId"
|
|
|
+ :productId="productId"
|
|
|
+ ref="selectTableProject"
|
|
|
+ ></selectTableProject>
|
|
|
+ </a-col>
|
|
|
+ <!-- -->
|
|
|
+ <a-col :md="8" :sm="8" :xxl="6">
|
|
|
+ <a-form-item label="素材关键字">
|
|
|
+ <a-input placeholder="请输入素材关键字" v-decorator="['keyword']"></a-input>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="8" :sm="8" :xxl="6">
|
|
|
+ <a-form-item label="单品名称">
|
|
|
+ <a-input placeholder="请输入单品名称" v-decorator="['itemName']"></a-input>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="8" :sm="8" :xxl="6">
|
|
|
+ <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
|
|
|
+ <a-button type="primary" icon="search" @click="handleQueryList">查询</a-button>
|
|
|
+ <a-button type="primary" @click="handleResetForm" icon="reload" class="middle-button"
|
|
|
+ >重置</a-button
|
|
|
+ >
|
|
|
+ <a-button type="primary" @click="visibleAddItem = true">添加单品</a-button>
|
|
|
+ <a-button type="primary" @click="visibleDownLoad = true" class="middle-button"
|
|
|
+ >批量导入单品</a-button
|
|
|
+ >
|
|
|
+ </span>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form>
|
|
|
+ </div>
|
|
|
+ </a-card>
|
|
|
+
|
|
|
+ <a-row style="margin-bottom:15px;margin-top:12px">
|
|
|
+ <a-col :span="24">
|
|
|
+ <div class="tableBody" style="min-height:200px;padding-bottom: 50px">
|
|
|
+ <a-table
|
|
|
+ :columns="columns"
|
|
|
+ :dataSource="dataSource"
|
|
|
+ :pagination="false"
|
|
|
+ :loading="dataLoading"
|
|
|
+ bordered
|
|
|
+ @change="tableChange"
|
|
|
+ size="middle"
|
|
|
+ style="word-break: break-all;font-size:16px;font-weight:600"
|
|
|
+ id="outTable"
|
|
|
+ ref="accountTable"
|
|
|
+ >
|
|
|
+ <span slot="state" slot-scope="text, record">
|
|
|
+ <a-switch :checked="text" @change="handleSwitchChang($event, record)" />
|
|
|
+ </span>
|
|
|
+ <span slot="action" slot-scope="text, record">
|
|
|
+ <a-popover
|
|
|
+ v-model="record.visible"
|
|
|
+ trigger="click"
|
|
|
+ placement="topLeft"
|
|
|
+ @visibleChange="visibleChange"
|
|
|
+ >
|
|
|
+ <span slot="title">关键词</span>
|
|
|
+ <template slot="content" style="width:300px;">
|
|
|
+ <div style="margin:5px">
|
|
|
+ <span
|
|
|
+ ><a-input
|
|
|
+ v-model="keyWord"
|
|
|
+ size="small"
|
|
|
+ style="margin-right:20px;width:120px"
|
|
|
+ /></span>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div>
|
|
|
+ <a-button
|
|
|
+ type="default"
|
|
|
+ @click="bidChangeCancel(record)"
|
|
|
+ size="small"
|
|
|
+ style="margin-right:10px"
|
|
|
+ >取消</a-button
|
|
|
+ >
|
|
|
+ <a-button type="primary" @click="bidChangeOk(record)" size="small" class="ok"
|
|
|
+ >修改</a-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <a
|
|
|
+ @click="
|
|
|
+ () => {
|
|
|
+ record.visible = true
|
|
|
+ }
|
|
|
+ "
|
|
|
+ >编辑素材关键词</a
|
|
|
+ >
|
|
|
+ </a-popover>
|
|
|
+ </span>
|
|
|
+ </a-table>
|
|
|
+ <a-pagination
|
|
|
+ size="small"
|
|
|
+ :showTotal="ipagination.showTotal"
|
|
|
+ style="float: right;margin-top:10px"
|
|
|
+ v-if="dataSource.length > 0"
|
|
|
+ showQuickJumper
|
|
|
+ :pageSize.sync="ipagination.pageSize"
|
|
|
+ :total="ipagination.total"
|
|
|
+ v-model="ipagination.current"
|
|
|
+ @change="getDataSource"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+
|
|
|
+ <a-modal
|
|
|
+ title="下载模板"
|
|
|
+ :width="800"
|
|
|
+ ref="modal"
|
|
|
+ :visible="visibleDownLoad"
|
|
|
+ @ok="handleOkImport"
|
|
|
+ @cancel="
|
|
|
+ downLoading = false
|
|
|
+ visibleDownLoad = false
|
|
|
+ projectIdDownLoad = ''
|
|
|
+ cancel()
|
|
|
+ "
|
|
|
+ okText="提交"
|
|
|
+ :confirmLoading="downLoading"
|
|
|
+ >
|
|
|
+ <selectTableProject
|
|
|
+ :projectId.sync="projectIdDownLoad"
|
|
|
+ ref="selectTableProjectDownLoad"
|
|
|
+ ></selectTableProject>
|
|
|
+ <a-button type="primary" @click="handleOkDownLoad" style="margin-left:85px;margin-bottom:15px"
|
|
|
+ >导出单品模板</a-button
|
|
|
+ >
|
|
|
+ <a-form :form="formDownLoad">
|
|
|
+ <a-form-item
|
|
|
+ label="上传文件"
|
|
|
+ v-if="visibleDownLoad"
|
|
|
+ :labelCol="{ xs: { span: 24 }, sm: { span: 5 } }"
|
|
|
+ :wrapperCol="{ xs: { span: 24 }, sm: { span: 16 } }"
|
|
|
+ class="require-class fileUpload"
|
|
|
+ id="fileUpload"
|
|
|
+ >
|
|
|
+ <a-upload
|
|
|
+ name="file"
|
|
|
+ :multiple="false"
|
|
|
+ :headers="tokenHeader"
|
|
|
+ :file-list="fileList"
|
|
|
+ :showUploadList="false"
|
|
|
+ :beforeUpload="beforeUpload"
|
|
|
+ @change="handleChange"
|
|
|
+ style="margin-right: 20px"
|
|
|
+ >
|
|
|
+ <a-button>
|
|
|
+ <a-icon type="upload" />
|
|
|
+ {{ loadDisabled ? '上传中,请稍后' : '文件上传' }}
|
|
|
+ </a-button>
|
|
|
+ </a-upload>
|
|
|
+ </a-form-item>
|
|
|
+ </a-form>
|
|
|
+ </a-modal>
|
|
|
+
|
|
|
+ <a-modal
|
|
|
+ title="添加单品"
|
|
|
+ :width="800"
|
|
|
+ ref="modal"
|
|
|
+ :visible="visibleAddItem"
|
|
|
+ @cancel="visibleAddItem = false"
|
|
|
+ @ok="handleOk"
|
|
|
+ :confirmLoading="confirmLoading"
|
|
|
+ >
|
|
|
+ <a-button type="primary" @click="addOneItem" style="margin-bottom:10px">添加单品信息</a-button>
|
|
|
+ <a-form-model ref="ruleForm" :model="addItemForm" v-bind="formItemLayout">
|
|
|
+ <a-collapse accordion v-model="activeKey" ref="collapse" v-if="visibleAddItem">
|
|
|
+ <template v-for="(item, index) in addItemForm.items">
|
|
|
+ <a-collapse-panel
|
|
|
+ :forceRender="true"
|
|
|
+ :header="item.itemName"
|
|
|
+ style="background: #f9f9fa;border-radius: 4px;margin-bottom:15px;overflow: hidden;border: 1px solid #d9d9d9;"
|
|
|
+ >
|
|
|
+ <span slot="extra">
|
|
|
+ <a-popconfirm :title="`确定删除吗?`" @confirm="deleteRule($event, item, index)">
|
|
|
+ <a-icon type="delete" @click="deleteIcon($event)" />
|
|
|
+ </a-popconfirm>
|
|
|
+ </span>
|
|
|
+ <a-form-model-item
|
|
|
+ label="项目"
|
|
|
+ ref="projectId"
|
|
|
+ :prop="'items.' + index + '.projectId'"
|
|
|
+ :rules="[{ required: true, message: '请选择项目', trigger: 'change' }]"
|
|
|
+ >
|
|
|
+ <!-- <a-input v-model="item.projectId" placeholder="请输入规则名称" /> -->
|
|
|
+ <Treeselect v-model="item.projectId" style="width:100%" />
|
|
|
+ </a-form-model-item>
|
|
|
+ <a-form-model-item
|
|
|
+ label="素材关键字"
|
|
|
+ ref="keyword"
|
|
|
+ :prop="'items.' + index + '.keyword'"
|
|
|
+ :rules="[
|
|
|
+ { required: true, message: '请填写素材关键字', trigger: 'blur' },
|
|
|
+ { min: 1, max: 15, message: '长度不得小于1,最大长度为15', trigger: 'blur' }
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ <a-input v-model="item.keyword" placeholder="请输入素材关键字" />
|
|
|
+ </a-form-model-item>
|
|
|
+ <a-form-model-item
|
|
|
+ label="单品名称"
|
|
|
+ ref="itemName"
|
|
|
+ :prop="'items.' + index + '.itemName'"
|
|
|
+ :rules="[
|
|
|
+ { required: true, message: '请填写单品名称', trigger: 'blur' },
|
|
|
+ { min: 1, max: 10, message: '长度不得小于1,最大长度为10', trigger: 'blur' }
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ <a-input v-model="item.itemName" placeholder="请输入单品名称" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-collapse-panel>
|
|
|
+ </template>
|
|
|
+ </a-collapse>
|
|
|
+ </a-form-model>
|
|
|
+ </a-modal>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import ARow from 'ant-design-vue/es/grid/Row'
|
|
|
+import ACol from 'ant-design-vue/es/grid/Col'
|
|
|
+import moment from 'moment'
|
|
|
+import { getAction, postAction, downFile, downFilePost } from '@/api/manage'
|
|
|
+import selectTable from '@/views/modules/material/comment/selectTable.vue'
|
|
|
+import selectTableProject from '@/views/modules/Statistics/components/selectPagination.vue'
|
|
|
+import Treeselect from './components/treeSelectProject.vue'
|
|
|
+import qs from 'qs'
|
|
|
+import { mapGetters } from 'vuex'
|
|
|
+import uploadFile from './components/uploadFile.vue'
|
|
|
+import Vue from 'vue'
|
|
|
+import { ACCESS_TOKEN } from '@/store/mutation-types'
|
|
|
+import $ from 'jquery'
|
|
|
+const fileSuffix = ['xlsx', 'xls', 'zip']
|
|
|
+let TTcolumns = [
|
|
|
+ {
|
|
|
+ title: '开关',
|
|
|
+ dataIndex: 'state',
|
|
|
+ scopedSlots: { customRender: 'state' },
|
|
|
+ align: 'center',
|
|
|
+ key: 'state'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '项目名称',
|
|
|
+ dataIndex: 'project_name',
|
|
|
+ scopedSlots: { customRender: 'project_name' },
|
|
|
+ align: 'center',
|
|
|
+ key: 'project_name'
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ title: '单品名称',
|
|
|
+ dataIndex: 'item_name',
|
|
|
+ scopedSlots: { customRender: 'item_name' },
|
|
|
+ align: 'center',
|
|
|
+ key: 'item_name'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '素材关键字',
|
|
|
+ dataIndex: 'keyword',
|
|
|
+ scopedSlots: { customRender: 'keyword' },
|
|
|
+ align: 'center',
|
|
|
+ key: 'keyword'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ dataIndex: 'action',
|
|
|
+ scopedSlots: { customRender: 'action' },
|
|
|
+ align: 'center',
|
|
|
+ key: 'action'
|
|
|
+ }
|
|
|
+]
|
|
|
+
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ ACol,
|
|
|
+ ARow,
|
|
|
+ selectTable,
|
|
|
+ selectTableProject,
|
|
|
+ uploadFile,
|
|
|
+ Treeselect
|
|
|
+ },
|
|
|
+
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ visibleAddItem: false,
|
|
|
+ confirmLoading: false,
|
|
|
+ activeKey: '0',
|
|
|
+ addItemForm: {
|
|
|
+ items: [{ projectId: '', keyWord: '', itemName: '默认名称-单品1' }]
|
|
|
+ },
|
|
|
+ formItemLayout: {
|
|
|
+ labelCol: { span: 4 },
|
|
|
+ wrapperCol: { span: 20 }
|
|
|
+ },
|
|
|
+ tokenHeader: { 'X-Access-Token': Vue.ls.get(ACCESS_TOKEN) },
|
|
|
+ fileList: [],
|
|
|
+ dataFile: null,
|
|
|
+ loadDisabled: false,
|
|
|
+ productId: '',
|
|
|
+ projectId: '',
|
|
|
+ accountId: '',
|
|
|
+ visibleChannel: false,
|
|
|
+ visibleDownLoad: false,
|
|
|
+ downLoading: false,
|
|
|
+ fileUrl: '',
|
|
|
+ projectIdDownLoad: '',
|
|
|
+ channelType: 'a',
|
|
|
+ createType: 1,
|
|
|
+ indexAll: 0,
|
|
|
+ spinning: false,
|
|
|
+ form: this.$form.createForm(this),
|
|
|
+ formDownLoad: this.$form.createForm(this),
|
|
|
+ exportloading: false,
|
|
|
+ dateRange: [moment().subtract(1, 'weeks'), moment()],
|
|
|
+ noImg: require('@/assets/noImg.png'),
|
|
|
+ validationRules: {
|
|
|
+ bid: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '出价信息必须填写'
|
|
|
+ // validator: this.validateBid,
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ ipagination: {
|
|
|
+ current: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ // pageSizeOptions: ['10', '20', '30'],
|
|
|
+ showTotal: (total, range) => {
|
|
|
+ return range[0] + '-' + range[1] + ' 共' + total + '条'
|
|
|
+ },
|
|
|
+ showQuickJumper: true,
|
|
|
+ showSizeChanger: true,
|
|
|
+ pageSizeOptions: ['10', '30', '50'],
|
|
|
+ total: 0,
|
|
|
+ onChange: (current, pageSize) => {
|
|
|
+ // 切换分页时的回调,
|
|
|
+ // 当在页面定义change事件时,切记要把此处的事件清除,因为这两个事件重叠了,可能到时候会导致一些莫名的bug
|
|
|
+ this.ipagination.current = current
|
|
|
+ this.ipagination.pageSize = pageSize
|
|
|
+ }
|
|
|
+ },
|
|
|
+ value: 'valid',
|
|
|
+ KSaccountList: [],
|
|
|
+ TTaccountList: [],
|
|
|
+
|
|
|
+ KSdesignList: [],
|
|
|
+ TTdesignList: [],
|
|
|
+
|
|
|
+ operateDisabled: false,
|
|
|
+ duration: 1000,
|
|
|
+ //treeselect的参数
|
|
|
+ treeValue: [],
|
|
|
+ treeData: [],
|
|
|
+
|
|
|
+ type: 3,
|
|
|
+
|
|
|
+ operate: '',
|
|
|
+ designList: [],
|
|
|
+
|
|
|
+ tabKey: 1,
|
|
|
+
|
|
|
+ loading: false,
|
|
|
+ columns: [...TTcolumns],
|
|
|
+ dataSource: [],
|
|
|
+
|
|
|
+ tableTab: 1,
|
|
|
+
|
|
|
+ newPlan: 0,
|
|
|
+ effectPlan: 0,
|
|
|
+
|
|
|
+ openOptions: false,
|
|
|
+
|
|
|
+ target: 'createTime',
|
|
|
+ order: 'descend',
|
|
|
+ dataLoading: false,
|
|
|
+ url: '/channelItem/queryChannelItemList',
|
|
|
+ modifyPriceVisible: false,
|
|
|
+ modifyPriceLoading: false,
|
|
|
+ modifyPriceDetail: null,
|
|
|
+ accountVisible: false,
|
|
|
+ againLoading: false,
|
|
|
+ accountProjectDetail: null,
|
|
|
+ accountProjectList: [],
|
|
|
+ keyWord: undefined
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ moment,
|
|
|
+ deleteIcon(event) {
|
|
|
+ event.stopPropagation()
|
|
|
+ },
|
|
|
+ deleteRule(event, item, index) {
|
|
|
+ event.stopPropagation()
|
|
|
+ this.addItemForm.items.splice(index, 1)
|
|
|
+ },
|
|
|
+ visibleChange() {
|
|
|
+ this.keyWord = undefined
|
|
|
+ },
|
|
|
+ bidChangeCancel(record) {
|
|
|
+ record.visible = false
|
|
|
+ this.keyWord = undefined
|
|
|
+ },
|
|
|
+ bidChangeOk(record) {
|
|
|
+ if (this.keyWord.length > 15) {
|
|
|
+ this.$message.error('素材关键字最多15个字')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ record.visible = false
|
|
|
+ const paramsData = {
|
|
|
+ id: record.id,
|
|
|
+ keyword: this.keyWord
|
|
|
+ }
|
|
|
+ getAction('/channelItem/updateChannelItems', paramsData)
|
|
|
+ .then(result => {
|
|
|
+ if (result.code === 200) {
|
|
|
+ record.visible = false
|
|
|
+ this.keyWord = undefined
|
|
|
+ const paramsData = this.form.getFieldsValue()
|
|
|
+ this.handleGetTableList(paramsData)
|
|
|
+ } else {
|
|
|
+ this.$message.error(result.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.log(error, 'eeee')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleSwitchChang(checked, data) {
|
|
|
+ const paramsData = {
|
|
|
+ id: data.id,
|
|
|
+ state: checked ? 1 : 0
|
|
|
+ }
|
|
|
+ getAction('/channelItem/updateChannelItems', paramsData)
|
|
|
+ .then(result => {
|
|
|
+ if (result.code === 200) {
|
|
|
+ const paramsData = this.form.getFieldsValue()
|
|
|
+ this.handleGetTableList(paramsData)
|
|
|
+ } else {
|
|
|
+ this.$message.error(result.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.log(error, 'eeee')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ overUpload(file) {},
|
|
|
+ handleChange() {
|
|
|
+ this.loadDisabled = false
|
|
|
+ this.$message.success('文件导入成功')
|
|
|
+ },
|
|
|
+ beforeUpload(file) {
|
|
|
+ // this.cosUpload(file)
|
|
|
+ // if (process.env.NODE_ENV == 'development') {
|
|
|
+ // this.uploadAction = `/jeecg-boot/kuaishouAppPackage/importAppExcel?projectId=${this.projectId}&platform=${
|
|
|
+ // this.appType == 'ios' ? +this.platform + 2 : +this.platform
|
|
|
+ // }&imageUrl=${this.fileUrl}`
|
|
|
+ // } else if (process.env.NODE_ENV == 'debug') {
|
|
|
+ // } else if (process.env.NODE_ENV == 'production') {
|
|
|
+ // this.uploadAction = `${this.axios.defaults.baseURL}/kuaishouAppPackage/importAppExcel?projectId=${
|
|
|
+ // this.projectId
|
|
|
+ // }&platform=${this.appType == 'ios' ? +this.platform + 2 : +this.platform}&imageUrl=${this.fileUrl}`
|
|
|
+ // }
|
|
|
+ // this.dataFile = file
|
|
|
+ this.dataFile = $('.fileUpload')
|
|
|
+ .eq(0)
|
|
|
+ .find('input')[0].files[0]
|
|
|
+ this.loadDisabled = true
|
|
|
+ const size = (Number(file.size) / (1024 * 1024)).toFixed(2)
|
|
|
+ const fileName = file.name
|
|
|
+ const fileStrArr = fileName.split('.')
|
|
|
+ const suffix = fileStrArr[fileStrArr.length - 1]
|
|
|
+
|
|
|
+ let result = fileSuffix.some(item => {
|
|
|
+ return item === suffix
|
|
|
+ })
|
|
|
+
|
|
|
+ if (!result) {
|
|
|
+ this.$message.error('不支持该文件类型')
|
|
|
+ this.loadDisabled = false
|
|
|
+ return Promise.reject()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ...mapGetters(['userInfo']),
|
|
|
+ toDetailList(item) {},
|
|
|
+
|
|
|
+ cpaBidValid(rule, value, callback) {
|
|
|
+ let z = /-/g
|
|
|
+ let a = /\//g
|
|
|
+ let d = /\./g
|
|
|
+ if (value === '' || value === undefined) {
|
|
|
+ callback('出价必须填写')
|
|
|
+ } else if (value.startsWith('.') || value.endsWith('.')) {
|
|
|
+ callback('请填写正确出价')
|
|
|
+ } else if (value.startsWith('-') || value.endsWith('-')) {
|
|
|
+ callback('请填写正确出价')
|
|
|
+ } else if (value.match(a) && value.match(z)) {
|
|
|
+ callback('不允许出现除"-"和"/"之外的所有字符,并且二者不可同时出现')
|
|
|
+ } else if (value.match(/[^0-9+-\/]/g)) {
|
|
|
+ callback('请填写正确出价')
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ addOneItem() {
|
|
|
+ this.addItemForm.items.push({
|
|
|
+ projectId: '',
|
|
|
+ keyWord: '',
|
|
|
+ itemName: '默认名称-单品' + (this.addItemForm.items.length + 1)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleOk() {
|
|
|
+ this.$refs.ruleForm.validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.confirmLoading = true
|
|
|
+ postAction('/channelItem/addChannelItem', this.addItemForm.items).then(res => {
|
|
|
+ this.confirmLoading = false
|
|
|
+ if (res.success) {
|
|
|
+ this.visibleAddItem = false
|
|
|
+ this.addItemForm.items = [{ projectId: '', keyWord: '', itemName: '默认名称-单品1' }]
|
|
|
+ this.handleResetForm()
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleOkImport() {
|
|
|
+ this.downLoading = true
|
|
|
+ let params = {}
|
|
|
+ if (this.dataFile) {
|
|
|
+ let formData = new FormData()
|
|
|
+ formData.append('file', this.dataFile)
|
|
|
+
|
|
|
+ postAction('/channelItem/importItemExcel', formData).then(res => {
|
|
|
+ this.downLoading = false
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message.success(res.message)
|
|
|
+ this.visibleDownLoad = false
|
|
|
+ this.projectIdDownLoad = ''
|
|
|
+ this.handleResetForm()
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.downLoading = false
|
|
|
+ this.$message.error('请上传文件')
|
|
|
+ }
|
|
|
+
|
|
|
+ return
|
|
|
+ },
|
|
|
+ handleOkDownLoad() {
|
|
|
+ if (!!this.projectIdDownLoad) {
|
|
|
+ let params = {}
|
|
|
+ params.projectId = this.projectIdDownLoad
|
|
|
+ params.userId = this.userInfo().id
|
|
|
+ downFile('/channelItem/exportItemTemplate', params).then(res => {
|
|
|
+ let blob = new Blob([res], {
|
|
|
+ type: 'application/vnd.openxmlformats-officedocument.spre1adsheetml.sheet'
|
|
|
+ })
|
|
|
+ let downloadElement = document.createElement('a')
|
|
|
+ let href = window.URL.createObjectURL(blob) //创建下载的链接
|
|
|
+ downloadElement.href = href
|
|
|
+ downloadElement.download = '单品模板.xlsx' //下载后文件名
|
|
|
+ document.body.appendChild(downloadElement)
|
|
|
+ downloadElement.click() //点击下载
|
|
|
+ document.body.removeChild(downloadElement) //下载完成移除元素
|
|
|
+ window.URL.revokeObjectURL(href) //释放掉blob对象
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message.error('请选择项目')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleCancel() {
|
|
|
+ this.visibleChannel = false
|
|
|
+ },
|
|
|
+ addNewChannel() {
|
|
|
+ this.visibleChannel = true
|
|
|
+ },
|
|
|
+ getDataSource(current, pageSize) {
|
|
|
+ // 切换分页时的回调,
|
|
|
+ // 当在页面定义change事件时,切记要把此处的事件清除,因为这两个事件重叠了,可能到时候会导致一些莫名的bug
|
|
|
+ this.ipagination.current = current
|
|
|
+ this.ipagination.pageSize = pageSize
|
|
|
+ const paramsData = this.form.getFieldsValue()
|
|
|
+ this.handleGetTableList(paramsData)
|
|
|
+ },
|
|
|
+ handleQueryList(event) {
|
|
|
+ this.ipagination.current = 1
|
|
|
+ event.preventDefault()
|
|
|
+ const paramsData = this.form.getFieldsValue()
|
|
|
+ this.handleGetTableList(paramsData)
|
|
|
+ },
|
|
|
+ handleResetForm() {
|
|
|
+ this.ipagination.current = 1
|
|
|
+ this.form.resetFields()
|
|
|
+ this.$refs.selectTableProject.keyValue = ''
|
|
|
+ this.$refs.selectTableProject.getData()
|
|
|
+ const paramsData = this.form.getFieldsValue()
|
|
|
+ this.handleGetTableList(paramsData)
|
|
|
+ },
|
|
|
+ handleGetTableList(data) {
|
|
|
+ let paramsData = {
|
|
|
+ projectId: this.projectId,
|
|
|
+ keyword: data.keyword,
|
|
|
+ itemName: data.itemName,
|
|
|
+ pageNo: this.ipagination.current,
|
|
|
+ pageSize: this.ipagination.pageSize,
|
|
|
+ userId: this.userInfo().id
|
|
|
+ }
|
|
|
+ this.dataSource = []
|
|
|
+ this.dataLoading = true
|
|
|
+ this.getAction(this.url, paramsData)
|
|
|
+ .then(result => {
|
|
|
+ this.dataLoading = false
|
|
|
+ if (result.code === 200) {
|
|
|
+ this.dataSource =
|
|
|
+ result.result.list.map(item => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ visible: false
|
|
|
+ }
|
|
|
+ }) || []
|
|
|
+ this.ipagination.total = result.result.total || 0
|
|
|
+ // result.result.total
|
|
|
+ } else {
|
|
|
+ this.$message.error(result.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ this.dataLoading = false
|
|
|
+ console.log(error, 'eeee')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getAccountNoProject() {
|
|
|
+ this.projectId = undefined
|
|
|
+ const paramsData = this.form.getFieldsValue()
|
|
|
+ this.handleGetTableList(paramsData)
|
|
|
+ },
|
|
|
+ disabledDate(current) {
|
|
|
+ // Can not select days before today and today
|
|
|
+ return current && current > moment().endOf('day')
|
|
|
+ },
|
|
|
+ dateChange(date, dateString) {
|
|
|
+ // console.log(date,dateString)
|
|
|
+ },
|
|
|
+
|
|
|
+ filterOption(input, option) {
|
|
|
+ // console.log(input, option)
|
|
|
+ return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
+ },
|
|
|
+ operateChange(value) {
|
|
|
+ console.log(value)
|
|
|
+ if (value) {
|
|
|
+ this.accountDisabled = true
|
|
|
+ this.accountId = ''
|
|
|
+ } else {
|
|
|
+ this.accountDisabled = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ tableChange(pagination, filters, sorter, { currentDataSource }) {
|
|
|
+ this.ipagination.current = pagination.current
|
|
|
+ this.ipagination.pageSize = pagination.pageSize
|
|
|
+ if (sorter.order) {
|
|
|
+ this.order = sorter.order ? sorter.order : 'descend'
|
|
|
+ this.target = sorter.columnKey
|
|
|
+ const paramsData = this.form.getFieldsValue()
|
|
|
+ this.handleGetTableList({
|
|
|
+ ...paramsData,
|
|
|
+ target: sorter.columnKey,
|
|
|
+ order: sorter.order ? sorter.order : 'descend'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取所有运营
|
|
|
+ getAllOperator(key) {
|
|
|
+ let url = '/sys/user/getAllUserListV1'
|
|
|
+ this.designList = []
|
|
|
+
|
|
|
+ getAction(url, {}).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.designList = res.result
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ productId: function(n, o) {
|
|
|
+ if (n != '') {
|
|
|
+ this.$refs.selectTableProject.keyValue = ''
|
|
|
+ this.$refs.selectTableProject.getData(n)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ visibleAddItem: function(n, o) {
|
|
|
+ if (!n) {
|
|
|
+ this.addItemForm = {
|
|
|
+ items: [{ projectId: '', keyWord: '', itemName: '默认名称-单品1' }]
|
|
|
+ }
|
|
|
+ this.addItemForm.items[0].projectId = ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ newDate() {
|
|
|
+ var myDate = new Date()
|
|
|
+ myDate.getYear() //获取当前年份(2位)
|
|
|
+ var n = myDate.getFullYear() //获取完整的年份(4位,1970-????)
|
|
|
+ var m = myDate.getMonth() //获取当前月份(0-11,0代表1月)
|
|
|
+ var d = myDate.getDate() //获取当前日(1-31)
|
|
|
+ var day = myDate.getHours()
|
|
|
+ return day
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ const paramsData = this.form.getFieldsValue()
|
|
|
+ this.handleGetTableList(paramsData)
|
|
|
+ this.getAllOperator()
|
|
|
+ },
|
|
|
+ activated: function() {},
|
|
|
+
|
|
|
+ filters: {
|
|
|
+ toPercentage(val) {
|
|
|
+ if (typeof val != 'string') {
|
|
|
+ return (val * 100).toFixed(2) + '%'
|
|
|
+ } else {
|
|
|
+ return val
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //保留两位小数并且变成货币格式
|
|
|
+ decimalsHandle(val) {
|
|
|
+ if (val && typeof val != 'string') {
|
|
|
+ if (val >= 0) {
|
|
|
+ val = parseFloat(val).toFixed(2)
|
|
|
+ let numberStr = val.toString()
|
|
|
+ let str = numberStr.split('.')
|
|
|
+
|
|
|
+ let str0 = str[0].split('').reverse()
|
|
|
+ for (let i = 0; i < str0.length; i++) {
|
|
|
+ if ((i + 1) % 4 === 0) {
|
|
|
+ str0.splice(i, 0, ',')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ str0.reverse()
|
|
|
+ let handleResult = ''
|
|
|
+ for (let j = 0; j < str0.length; j++) {
|
|
|
+ handleResult += str0[j]
|
|
|
+ }
|
|
|
+
|
|
|
+ return handleResult + '.' + str[1]
|
|
|
+ } else {
|
|
|
+ val = parseFloat(val).toFixed(2)
|
|
|
+ let numberStr = val.toString()
|
|
|
+ let str = numberStr.split('.')
|
|
|
+
|
|
|
+ let str0 = str[0]
|
|
|
+ .substr(1)
|
|
|
+ .split('')
|
|
|
+ .reverse()
|
|
|
+ for (let i = 0; i < str0.length; i++) {
|
|
|
+ if ((i + 1) % 4 === 0) {
|
|
|
+ str0.splice(i, 0, ',')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ str0.reverse()
|
|
|
+ let handleResult = ''
|
|
|
+ for (let j = 0; j < str0.length; j++) {
|
|
|
+ handleResult += str0[j]
|
|
|
+ }
|
|
|
+
|
|
|
+ return '-' + handleResult + '.' + str[1]
|
|
|
+ }
|
|
|
+ } else if (typeof val == 'string') {
|
|
|
+ return val
|
|
|
+ } else {
|
|
|
+ return 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //变成货币格式
|
|
|
+ formatCurrency(val) {
|
|
|
+ if (val) {
|
|
|
+ let numberStr = val.toString()
|
|
|
+ let str = numberStr.split('').reverse()
|
|
|
+ for (let i = 0; i < str.length; i++) {
|
|
|
+ if ((i + 1) % 4 === 0) {
|
|
|
+ str.splice(i, 0, ',')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ str.reverse()
|
|
|
+ let handleResult = ''
|
|
|
+ for (let j = 0; j < str.length; j++) {
|
|
|
+ handleResult += str[j]
|
|
|
+ }
|
|
|
+ return handleResult
|
|
|
+ } else {
|
|
|
+ return '-'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|