3a53147d4607570e0fecd2d45b51b25d.json 35 KB

1
  1. {"remainingRequest":"D:\\front\\item\\zyAdmin\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\front\\item\\zyAdmin\\src\\pages\\marketing\\storeSeckill\\createMore.vue?vue&type=style&index=0&id=64e510d5&lang=scss&scoped=true","dependencies":[{"path":"D:\\front\\item\\zyAdmin\\src\\pages\\marketing\\storeSeckill\\createMore.vue","mtime":1761614939041},{"path":"D:\\front\\item\\zyAdmin\\node_modules\\css-loader\\index.js","mtime":1761614929364},{"path":"D:\\front\\item\\zyAdmin\\node_modules\\vue-loader\\lib\\loaders\\stylePostLoader.js","mtime":1761614937403},{"path":"D:\\front\\item\\zyAdmin\\node_modules\\postcss-loader\\src\\index.js","mtime":1761614935133},{"path":"D:\\front\\item\\zyAdmin\\node_modules\\sass-loader\\dist\\cjs.js","mtime":1761614936391},{"path":"D:\\front\\item\\zyAdmin\\node_modules\\cache-loader\\dist\\cjs.js","mtime":1761614927801},{"path":"D:\\front\\item\\zyAdmin\\node_modules\\vue-loader\\lib\\index.js","mtime":1761614937402}],"contextDependencies":[],"result":[{"type":"Buffer","data":"base64:DQouY29udGVudF93aWR0aCB7DQogIHdpZHRoOiA0NjBweDsNCn0NCi5tYXhXIDo6di1kZWVwIC5pdnUtc2VsZWN0LWRyb3Bkb3duIHsNCiAgbWF4LXdpZHRoOiA2MDBweDsNCn0NCi5ncmV5IHsNCiAgY29sb3I6ICM5OTk7DQogIGZvbnQtc2l6ZTogMTJweDsNCn0NCi50YWJCb3hfaW1nIHsNCiAgd2lkdGg6IDUwcHg7DQogIGhlaWdodDogNTBweDsNCiAgbWFyZ2luOiAwIGF1dG87DQp9DQoudGFiQm94X2ltZyBpbWcgew0KICB3aWR0aDogMTAwJTsNCiAgaGVpZ2h0OiAxMDAlOw0KfQ0KLnByaWNlQm94IHsNCiAgd2lkdGg6IDEwMCU7DQp9DQouZm9ybSB7DQogIC5waWNCb3ggew0KICAgIGRpc3BsYXk6IGlubGluZS1ibG9jazsNCiAgICBjdXJzb3I6IHBvaW50ZXI7DQogIH0NCiAgLnBpY3RydWUgew0KICAgIHdpZHRoOiA2MHB4Ow0KICAgIGhlaWdodDogNjBweDsNCiAgICBib3JkZXI6IDFweCBkb3R0ZWQgcmdiYSgwLCAwLCAwLCAwLjEpOw0KICAgIG1hcmdpbi1yaWdodDogMTVweDsNCiAgICBkaXNwbGF5OiBpbmxpbmUtYmxvY2s7DQogICAgcG9zaXRpb246IHJlbGF0aXZlOw0KICAgIGN1cnNvcjogcG9pbnRlcjsNCg0KICAgIGltZyB7DQogICAgICB3aWR0aDogMTAwJTsNCiAgICAgIGhlaWdodDogMTAwJTsNCiAgICB9DQogICAgLmJ0bmRlbCB7DQogICAgICBwb3NpdGlvbjogYWJzb2x1dGU7DQogICAgICB6LWluZGV4OiA5Ow0KICAgICAgd2lkdGg6IDIwcHggIWltcG9ydGFudDsNCiAgICAgIGhlaWdodDogMjBweCAhaW1wb3J0YW50Ow0KICAgICAgbGVmdDogNDZweDsNCiAgICAgIHRvcDogLTRweDsNCiAgICB9DQogIH0NCiAgLnVwTG9hZCB7DQogICAgd2lkdGg6IDU4cHg7DQogICAgaGVpZ2h0OiA1OHB4Ow0KICAgIGxpbmUtaGVpZ2h0OiA1OHB4Ow0KICAgIGJvcmRlcjogMXB4IGRvdHRlZCByZ2JhKDAsIDAsIDAsIDAuMSk7DQogICAgYm9yZGVyLXJhZGl1czogNHB4Ow0KICAgIGJhY2tncm91bmQ6IHJnYmEoMCwgMCwgMCwgMC4wMik7DQogICAgY3Vyc29yOiBwb2ludGVyOw0KICB9DQogIC5jb2wgew0KICAgIGNvbG9yOiAjMmQ4Y2YwOw0KICAgIGN1cnNvcjogcG9pbnRlcjsNCiAgfQ0KfQ0KLmFkZGZvbnQgew0KICBmb250LXNpemU6IDEycHg7DQogIGNvbG9yOiB2YXIoLS1wcmV2LWNvbG9yLXByaW1hcnkpOw0KICBtYXJnaW4tbGVmdDogMTRweDsNCiAgY3Vyc29yOiBwb2ludGVyOw0KICBtYXJnaW4tbGVmdDogMTBweDsNCiAgY3Vyc29yOiBwb2ludGVyOw0KfQ0K"},{"version":3,"sources":["createMore.vue"],"names":[],"mappings":";AAo1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"createMore.vue","sourceRoot":"src/pages/marketing/storeSeckill","sourcesContent":["<template>\r\n <div v-loading=\"spinShow\">\r\n <pages-header\r\n ref=\"pageHeader\"\r\n :title=\"$route.params.id ? '编辑秒杀商品' : '添加秒杀商品'\"\r\n :backUrl=\"$routeProStr + '/marketing/store_seckill/list'\"\r\n ></pages-header>\r\n <el-card :bordered=\"false\" shadow=\"never\" class=\"mt16\">\r\n <el-row class=\"mt30 acea-row row-middle row-center\">\r\n <el-col :span=\"20\">\r\n <steps :stepList=\"stepList\" :isActive=\"current\" @stepActive=\"stepActive\"></steps>\r\n </el-col>\r\n <el-col :span=\"23\">\r\n <el-form\r\n class=\"form mt30\"\r\n ref=\"formValidate\"\r\n :model=\"formValidate\"\r\n :label-width=\"labelWidth\"\r\n :label-position=\"labelPosition\"\r\n @submit.native.prevent\r\n >\r\n <el-col v-show=\"current === 0\">\r\n <el-col :span=\"24\">\r\n <el-col v-bind=\"grid\">\r\n <el-form-item label=\"活动标题:\" label-for=\"title\">\r\n <el-input\r\n clearable\r\n placeholder=\"请输入活动标题\"\r\n v-model=\"formValidate.title\"\r\n class=\"content_width\"\r\n maxlength=\"80\"\r\n show-word-limit\r\n />\r\n </el-form-item>\r\n </el-col>\r\n </el-col>\r\n\r\n <el-col :span=\"24\">\r\n <el-form-item label=\"活动时间:\">\r\n <div>\r\n <el-date-picker\r\n clearable\r\n :editable=\"false\"\r\n type=\"daterange\"\r\n format=\"yyyy-MM-dd\"\r\n value-format=\"yyyy-MM-dd\"\r\n range-separator=\"-\"\r\n start-placeholder=\"开始日期\"\r\n end-placeholder=\"结束日期\"\r\n @change=\"onchangeTime\"\r\n class=\"content_width\"\r\n v-model=\"formValidate.section_time\"\r\n ></el-date-picker>\r\n <div class=\"grey\">设置活动开启结束时间,用户可以在有效时间内参与秒杀</div>\r\n </div>\r\n </el-form-item>\r\n </el-col>\r\n\r\n <el-col :span=\"24\">\r\n <el-form-item label=\"开始时间:\">\r\n <div>\r\n <el-select v-model=\"formValidate.time_ids\" multiple class=\"content_width\">\r\n <el-option\r\n v-for=\"item in timeList\"\r\n :value=\"item.id\"\r\n :key=\"item.id\"\r\n :label=\"item.time_name\"\r\n ></el-option>\r\n </el-select>\r\n <div class=\"grey\">\r\n 选择产品开始时间段,该时间段内用户可参与购买;其它时间段会显示活动未开始或已结束。如活动超过一天,则活动期内,每天都会定时开启\r\n </div>\r\n </div>\r\n </el-form-item>\r\n </el-col>\r\n <el-col :span=\"24\">\r\n <el-form-item label=\"总购买数量限制:\">\r\n <div>\r\n <el-input-number\r\n :controls=\"false\"\r\n :min=\"1\"\r\n placeholder=\"请输入数量限制\"\r\n element-id=\"num\"\r\n :precision=\"0\"\r\n :max=\"10000\"\r\n v-model=\"formValidate.num\"\r\n class=\"content_width\"\r\n />\r\n <div class=\"grey\">\r\n 活动有效期内每个用户可购买该商品总数限制。例如设置为4,表示本次活动有效期内,每个用户最多可购买总数4个\r\n </div>\r\n </div>\r\n </el-form-item>\r\n </el-col>\r\n <el-col :span=\"24\">\r\n <el-form-item label=\"单次购买数量限制:\">\r\n <div>\r\n <el-input-number\r\n :controls=\"false\"\r\n :min=\"1\"\r\n placeholder=\"请输入单次购买数量限制\"\r\n element-id=\"once_num\"\r\n :precision=\"0\"\r\n :max=\"10000\"\r\n v-model=\"formValidate.once_num\"\r\n class=\"content_width\"\r\n />\r\n <div class=\"grey\">\r\n 用户参与秒杀时,一次购买最大数量限制。例如设置为2,表示参与秒杀时,用户一次购买数量最大可选择2个\r\n </div>\r\n </div>\r\n </el-form-item>\r\n </el-col>\r\n\r\n <el-col :span=\"24\">\r\n <el-form-item label=\"秒杀是否参与分销:\" props=\"is_commission\" label-for=\"is_commission\">\r\n <div>\r\n <el-switch\r\n class=\"defineSwitch\"\r\n :active-value=\"1\"\r\n :inactive-value=\"0\"\r\n v-model=\"formValidate.is_commission\"\r\n size=\"large\"\r\n active-text=\"开启\"\r\n inactive-text=\"关闭\"\r\n >\r\n </el-switch>\r\n <div class=\"grey\">商品是否参与商城分销返佣</div>\r\n </div>\r\n </el-form-item>\r\n </el-col>\r\n <el-col :span=\"24\">\r\n <el-form-item label=\"活动状态:\" props=\"status\" label-for=\"status\">\r\n <el-switch\r\n class=\"defineSwitch\"\r\n :active-value=\"1\"\r\n :inactive-value=\"0\"\r\n v-model=\"formValidate.status\"\r\n size=\"large\"\r\n active-text=\"开启\"\r\n inactive-text=\"关闭\"\r\n >\r\n </el-switch>\r\n </el-form-item>\r\n </el-col>\r\n </el-col>\r\n <el-row v-show=\"current === 1\">\r\n <el-col :span=\"24\">\r\n <div class=\"acea-row row-between-wrapper\">\r\n <div>\r\n <el-button type=\"primary\" @click=\"addGoods\">添加商品</el-button>\r\n <el-button @click=\"batchSet\" class=\"ml20\" :disabled=\"!isAllChecked && !checkPidList.length\"\r\n >批量设置</el-button\r\n >\r\n <el-button @click=\"delAll\" class=\"ml20\" :disabled=\"!isAllChecked && !checkPidList.length\"\r\n >批量删除</el-button\r\n >\r\n </div>\r\n <div class=\"goodsWord\">\r\n <el-form-item label=\"商品搜索:\">\r\n <el-input\r\n class=\"w_input240\"\r\n v-model=\"keyword\"\r\n placeholder=\"请输入商品关键词\"\r\n @input=\"searchWord\"\r\n ></el-input>\r\n </el-form-item>\r\n </div>\r\n </div>\r\n </el-col>\r\n <el-col :span=\"24\">\r\n <div class=\"vxeTable\">\r\n <vxe-table\r\n border=\"inner\"\r\n ref=\"xTree\"\r\n :column-config=\"{ resizable: true }\"\r\n row-id=\"id\"\r\n :tree-config=\"{ children: 'attrs', reserve: true }\"\r\n @checkbox-all=\"checkboxAll\"\r\n @checkbox-change=\"checkboxItem\"\r\n :data=\"searchTableData.length || keyword ? searchTableData : tableData\"\r\n >\r\n <vxe-column type=\"checkbox\" title=\"多选\" width=\"100\" tree-node></vxe-column>\r\n <vxe-column field=\"info\" title=\"商品信息\" min-width=\"300\">\r\n <template v-slot=\"{ row }\">\r\n <div class=\"flex imgPic row-middle\">\r\n <viewer>\r\n <div class=\"pictrue\"><img v-lazy=\"row.parent == 1 ? row.image : row.pic\" /></div>\r\n </viewer>\r\n <div class=\"info\">\r\n <el-tooltip max-width=\"200\" placement=\"bottom\" transfer>\r\n <span class=\"line2\">{{ row.store_name }}{{ row.suk }}</span>\r\n <p slot=\"content\">{{ row.store_name }}{{ row.suk }}</p>\r\n </el-tooltip>\r\n </div>\r\n </div>\r\n </template>\r\n </vxe-column>\r\n <vxe-column field=\"cost\" title=\"成本价\" min-width=\"80\"></vxe-column>\r\n <vxe-column field=\"product_price\" title=\"售价\" min-width=\"80\"></vxe-column>\r\n <vxe-column field=\"price\" title=\"秒杀价\" min-width=\"150\">\r\n <template v-slot=\"{ row }\">\r\n <div v-if=\"row.parent == 1\">——</div>\r\n <vxe-input\r\n v-else\r\n v-model=\"row.price\"\r\n min=\"0\"\r\n placeholder=\"请输入秒杀价\"\r\n type=\"float\"\r\n digits=\"2\"\r\n step=\"1\"\r\n ></vxe-input>\r\n </template>\r\n </vxe-column>\r\n <vxe-column field=\"quota\" title=\"限量\" min-width=\"150\">\r\n <template v-slot=\"{ row }\">\r\n <div v-if=\"row.parent == 1\">——</div>\r\n <vxe-input\r\n v-else\r\n v-model=\"row.quota\"\r\n min=\"0\"\r\n placeholder=\"请输入限量\"\r\n type=\"integer\"\r\n ></vxe-input>\r\n </template>\r\n </vxe-column>\r\n <vxe-column field=\"stock\" title=\"库存\" min-width=\"90\"></vxe-column>\r\n <vxe-column field=\"status\" title=\"是否开启\" min-width=\"100\">\r\n <template v-slot=\"{ row }\">\r\n <el-switch v-model=\"row.status\" :active-value=\"1\" :inactive-value=\"0\" size=\"large\">\r\n <span slot=\"open\">上架</span>\r\n <span slot=\"close\">下架</span>\r\n </el-switch>\r\n </template>\r\n </vxe-column>\r\n <vxe-column field=\"date\" title=\"操作\" min-width=\"100\" fixed=\"right\" align=\"center\">\r\n <template v-slot=\"{ row }\">\r\n <a @click=\"del(row, $event)\" v-if=\"row.parent == 1\">删除</a>\r\n </template>\r\n </vxe-column>\r\n </vxe-table>\r\n </div>\r\n </el-col>\r\n </el-row>\r\n <el-col class=\"mt20\" :span=\"24\">\r\n <el-form-item>\r\n <el-button class=\"submission\" v-db-click @click=\"step\" :disabled=\"current === 0\">上一步 </el-button>\r\n <el-button\r\n :disabled=\"submitOpen && current === 1\"\r\n type=\"primary\"\r\n class=\"submission\"\r\n v-db-click\r\n @click=\"next('formValidate')\"\r\n >{{ current === 1 ? '提交' : '下一步' }}</el-button\r\n >\r\n </el-form-item>\r\n </el-col>\r\n </el-form>\r\n </el-col>\r\n </el-row>\r\n </el-card>\r\n <!-- 选择商品-->\r\n <el-dialog :visible.sync=\"modals\" title=\"商品列表\" class=\"paymentFooter\" width=\"1000px\">\r\n <goods-list ref=\"goodslist\" :ischeckbox=\"true\" isdiy :goodsType=\"1\" @getProductId=\"getProductId\"></goods-list>\r\n </el-dialog>\r\n <!-- 上传图片-->\r\n <el-dialog :visible.sync=\"modalPic\" width=\"950px\" title=\"上传商品图\" :close-on-click-modal=\"false\">\r\n <uploadPictures\r\n :isChoice=\"isChoice\"\r\n @getPic=\"getPic\"\r\n @getPicD=\"getPicD\"\r\n :gridBtn=\"gridBtn\"\r\n :gridPic=\"gridPic\"\r\n v-if=\"modalPic\"\r\n ></uploadPictures>\r\n </el-dialog>\r\n <!-- 运费模板-->\r\n <freight-template ref=\"template\" @addSuccess=\"productGetTemplate\"></freight-template>\r\n <el-dialog :visible.sync=\"modalsSet\" title=\"批量设置\" @close=\"batchVisibleChange\">\r\n <el-form\r\n ref=\"formBatch\"\r\n :model=\"formBatch\"\r\n :label-width=\"labelWidth\"\r\n :label-position=\"labelPosition\"\r\n @submit.native.prevent\r\n >\r\n <el-form-item label=\"秒杀价:\" prop=\"price\">\r\n <el-input\r\n class=\"w_input315\"\r\n v-model=\"formBatch.price\"\r\n min=\"0\"\r\n placeholder=\"请输入秒杀价\"\r\n type=\"float\"\r\n digits=\"2\"\r\n step=\"1\"\r\n ></el-input>\r\n </el-form-item>\r\n <el-form-item label=\"限量:\" prop=\"quota\">\r\n <el-input\r\n class=\"w_input315\"\r\n v-model=\"formBatch.quota\"\r\n min=\"0\"\r\n placeholder=\"请输入限量\"\r\n type=\"integer\"\r\n ></el-input>\r\n </el-form-item>\r\n </el-form>\r\n <div slot=\"footer\">\r\n <el-button @click=\"modalsSet = false\">取消</el-button>\r\n <el-button type=\"primary\" @click=\"okBatch\">保存</el-button>\r\n </div>\r\n </el-dialog>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport { mapState } from 'vuex';\r\nimport goodsList from '@/components/goodsList/index';\r\nimport WangEditor from '@/components/wangEditor/index.vue';\r\nimport uploadPictures from '@/components/uploadPictures';\r\nimport { seckillActivityInfoApi, seckillActivityAddApi, seckillTimeListApi } from '@/api/marketing';\r\nimport { productGetTemplateApi } from '@/api/product';\r\nimport freightTemplate from '@/components/freightTemplate/index';\r\nimport steps from '@/components/steps/index';\r\n\r\nexport default {\r\n name: 'storeSeckillCreate',\r\n components: {\r\n goodsList,\r\n uploadPictures,\r\n WangEditor,\r\n freightTemplate,\r\n steps,\r\n },\r\n data() {\r\n return {\r\n stepList: ['填写基础信息', '选择秒杀商品'],\r\n submitOpen: false,\r\n spinShow: false,\r\n isChoice: '',\r\n current: 0,\r\n modalPic: false,\r\n grid: {\r\n xl: 12,\r\n lg: 20,\r\n md: 24,\r\n sm: 24,\r\n xs: 24,\r\n },\r\n grid2: {\r\n xl: 8,\r\n lg: 12,\r\n md: 12,\r\n sm: 24,\r\n xs: 24,\r\n },\r\n gridPic: {\r\n xl: 6,\r\n lg: 8,\r\n md: 12,\r\n sm: 12,\r\n xs: 12,\r\n },\r\n gridBtn: {\r\n xl: 4,\r\n lg: 8,\r\n md: 8,\r\n sm: 8,\r\n xs: 8,\r\n },\r\n myConfig: {\r\n autoHeightEnabled: false, // 编辑器不自动被内容撑高\r\n initialFrameHeight: 500, // 初始容器高度\r\n initialFrameWidth: '100%', // 初始容器宽度\r\n UEDITOR_HOME_URL: '/UEditor/',\r\n serverUrl: '',\r\n },\r\n modals: false,\r\n modal_loading: false,\r\n images: [],\r\n formValidate: {\r\n title: '',\r\n section_time: [],\r\n time_ids: [],\r\n num: 0,\r\n once_num: 0,\r\n status: 1,\r\n product_infos: [],\r\n },\r\n formBatch: {\r\n price: '',\r\n quota: '',\r\n },\r\n templateList: [],\r\n timeList: [],\r\n columns: [],\r\n specsData: [],\r\n picTit: '',\r\n tableIndex: 0,\r\n ruleValidate: {\r\n image: [{ required: true, message: '请选择主图', trigger: 'change' }],\r\n images: [\r\n {\r\n required: true,\r\n type: 'array',\r\n message: '请选择主图',\r\n trigger: 'change',\r\n },\r\n {\r\n type: 'array',\r\n min: 1,\r\n message: 'Choose two hobbies at best',\r\n trigger: 'change',\r\n },\r\n ],\r\n title: [{ required: true, message: '请输入商品标题', trigger: 'blur' }],\r\n info: [{ required: true, message: '请输入秒杀活动简介', trigger: 'blur' }],\r\n section_time: [\r\n {\r\n required: true,\r\n type: 'array',\r\n message: '请选择活动时间',\r\n trigger: 'change',\r\n },\r\n ],\r\n unit_name: [{ required: true, message: '请输入单位', trigger: 'blur' }],\r\n price: [\r\n {\r\n required: true,\r\n type: 'number',\r\n message: '请输入秒杀价',\r\n trigger: 'blur',\r\n },\r\n ],\r\n ot_price: [\r\n {\r\n required: true,\r\n type: 'number',\r\n message: '请输入原价',\r\n trigger: 'blur',\r\n },\r\n ],\r\n cost: [\r\n {\r\n required: true,\r\n type: 'number',\r\n message: '请输入成本价',\r\n trigger: 'blur',\r\n },\r\n ],\r\n stock: [\r\n {\r\n required: true,\r\n type: 'number',\r\n message: '请输入库存',\r\n trigger: 'blur',\r\n },\r\n ],\r\n num: [\r\n {\r\n required: true,\r\n type: 'number',\r\n message: '请输入购买数量限制',\r\n trigger: 'blur',\r\n },\r\n ],\r\n once_num: [\r\n {\r\n required: true,\r\n type: 'number',\r\n message: '请输入单次购买数量限制',\r\n trigger: 'blur',\r\n },\r\n ],\r\n temp_id: [\r\n {\r\n required: true,\r\n message: '请选择运费模板',\r\n trigger: 'change',\r\n type: 'number',\r\n },\r\n ],\r\n time_ids: [\r\n {\r\n required: true,\r\n message: '请选择开始时间',\r\n trigger: 'change',\r\n type: 'Array',\r\n },\r\n ],\r\n },\r\n copy: 0,\r\n modalsSet: false,\r\n isAllChecked: false,\r\n checkPidList: [], //父级有关id集合 (需求禁止删除子级,用于删除整个商品)\r\n searchTableData: [],\r\n tableData: [],\r\n keyword: '',\r\n };\r\n },\r\n computed: {\r\n ...mapState('media', ['isMobile']),\r\n labelWidth() {\r\n return this.isMobile ? undefined : '135px';\r\n },\r\n labelPosition() {\r\n return this.isMobile ? 'top' : 'right';\r\n },\r\n },\r\n mounted() {\r\n if (this.$route.params.id) {\r\n this.current = 0;\r\n this.getInfo();\r\n }\r\n this.productGetTemplate();\r\n this.seckillTimeList();\r\n },\r\n methods: {\r\n stepActive(index){\r\n this.current = index;\r\n },\r\n addGoods() {\r\n this.modals = true;\r\n },\r\n //批量设置\r\n batchSet() {\r\n this.modalsSet = true;\r\n },\r\n //删除\r\n del(row) {\r\n // this.tableData = this.tableData.filter((item) => item.id !== row.id);\r\n if (this.searchTableData.length) {\r\n this.searchTableData.forEach((i, index) => {\r\n if (row.id == i.id) {\r\n this.searchTableData.splice(index, 1);\r\n }\r\n });\r\n this.tableData.forEach((i, index) => {\r\n if (row.id == i.id) {\r\n return this.tableData.splice(index, 1);\r\n }\r\n });\r\n } else {\r\n this.tableData.forEach((i, index) => {\r\n if (row.id == i.id) {\r\n return this.tableData.splice(index, 1);\r\n }\r\n });\r\n }\r\n if (this.isAllChecked && !this.tableData.length) {\r\n this.isAllChecked = false;\r\n this.checkPidList = [];\r\n } else {\r\n let index = this.checkPidList.indexOf(row.id);\r\n this.checkPidList.splice(index, 1);\r\n }\r\n },\r\n //批量删除\r\n delAll() {\r\n if (this.isAllChecked && (this.tableData.length == this.searchTableData.length || !this.searchTableData.length)) {\r\n this.tableData = [];\r\n } else {\r\n this.tableData = this.tableData.filter((item) => !this.checkPidList.some((ele) => ele === item.id));\r\n }\r\n this.checkPidList = [];\r\n this.isAllChecked = false;\r\n },\r\n cancel() {\r\n this.modals = false;\r\n },\r\n batchVisibleChange() {\r\n this.formBatch.price = '';\r\n this.formBatch.quota = '';\r\n },\r\n searchWord() {\r\n let list = [];\r\n console.log(this.tableData, this.keyword);\r\n this.tableData.forEach((item) => {\r\n let obj = item.store_name.indexOf(this.keyword);\r\n if (obj != -1) {\r\n list.push(item);\r\n }\r\n });\r\n console.log(list);\r\n if (this.keyword) {\r\n this.searchTableData = list;\r\n } else {\r\n this.searchTableData = [];\r\n }\r\n },\r\n checkboxAll() {\r\n this.isAllChecked = this.$refs.xTree.isAllCheckboxChecked();\r\n if (!this.isAllChecked) {\r\n this.checkPidList = [];\r\n }\r\n },\r\n checkboxItem(e) {\r\n let id = parseInt(e.rowid);\r\n if (e.row.product_id) {\r\n let pIndex = this.checkPidList.indexOf(e.row.product_id);\r\n if (pIndex !== -1 && !e.checked) {\r\n this.checkPidList = this.checkPidList.filter((item) => item !== e.row.product_id);\r\n }\r\n if (pIndex === -1 && e.checked) {\r\n this.checkPidList.push(e.row.product_id);\r\n }\r\n } else {\r\n let pIndex = this.checkPidList.indexOf(id);\r\n if (pIndex !== -1 && !e.checked) {\r\n this.checkPidList = this.checkPidList.filter((item) => item !== id);\r\n }\r\n if (pIndex === -1 && e.checked) {\r\n this.checkPidList.push(id);\r\n }\r\n }\r\n this.isAllChecked = this.$refs.xTree.isAllCheckboxChecked();\r\n },\r\n // 添加运费模板\r\n freight() {\r\n this.$refs.template.id = 0;\r\n this.$refs.template.isTemplate = true;\r\n },\r\n\r\n // 多选\r\n changeCheckbox(selection) {\r\n this.formValidate.attrs = selection;\r\n },\r\n seckillTimeList() {\r\n let that = this;\r\n seckillTimeListApi()\r\n .then((res) => {\r\n that.timeList = res.data.list.data;\r\n })\r\n .catch((res) => {\r\n that.$message.error(res.msg);\r\n });\r\n },\r\n // 获取运费模板;\r\n productGetTemplate() {\r\n productGetTemplateApi().then((res) => {\r\n this.templateList = res.data;\r\n });\r\n },\r\n // 表单验证\r\n validate(prop, status, error) {\r\n if (status === false) {\r\n this.$message.error(error);\r\n }\r\n },\r\n // 商品id\r\n getProductId(data) {\r\n console.log(data, 'data');\r\n this.modals = false;\r\n let listChecked = JSON.parse(JSON.stringify(data));\r\n listChecked.forEach((item) => {\r\n item.parent = 1;\r\n item.status = 1;\r\n item.isAllChecked = true;\r\n item.attrs.forEach((value) => {\r\n value.cate_name = item.cate_name;\r\n value.store_label = item.store_label;\r\n value.status = 1;\r\n });\r\n });\r\n let list = this.tableData.concat(listChecked);\r\n let uni = this.unique(list);\r\n this.tableData = uni;\r\n },\r\n //对象数组去重;\r\n unique(arr) {\r\n const res = new Map();\r\n return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1));\r\n },\r\n cancel() {\r\n this.modals = false;\r\n },\r\n okBatch() {\r\n if (this.formBatch.price == '' && this.formBatch.quota == '') {\r\n return this.$Message.error('请输入秒杀价或限量');\r\n }\r\n if (this.isAllChecked && (this.tableData.length == this.searchTableData.length || !this.searchTableData.length)) {\r\n this.tableData.forEach((item) => {\r\n item.attrs.forEach((j) => {\r\n if (this.formBatch.price != '') {\r\n j.price = this.formBatch.price;\r\n }\r\n if (this.formBatch.quota != '') {\r\n j.quota = this.formBatch.quota;\r\n }\r\n });\r\n });\r\n } else {\r\n for (let i = 0; i < this.tableData.length; i++) {\r\n for (let j = 0; j < this.checkPidList.length; j++) {\r\n if (this.tableData[i].id == this.checkPidList[j]) {\r\n this.tableData[i].attrs.forEach((x) => {\r\n if (this.formBatch.price != '') {\r\n x.price = this.formBatch.price;\r\n }\r\n // 批量设置限量不为空,则修改规格上架的限量\r\n if (this.formBatch.quota != '' && x.status) {\r\n x.quota = this.formBatch.quota;\r\n }\r\n });\r\n }\r\n }\r\n }\r\n }\r\n this.modalsSet = false;\r\n },\r\n // 具体日期\r\n onchangeTime(e) {\r\n this.formValidate.section_time = e;\r\n },\r\n // 详情\r\n getInfo() {\r\n this.spinShow = true;\r\n seckillActivityInfoApi(this.$route.params.id)\r\n .then(async (res) => {\r\n this.formValidate = res.data;\r\n this.tableData = res.data.product_infos;\r\n this.tableData.forEach((item) => {\r\n item.parent = 1;\r\n item.isAllChecked = true;\r\n item.attrs.forEach((value) => {\r\n value.cate_name = item.cate_name;\r\n value.store_label = item.store_label;\r\n });\r\n });\r\n this.spinShow = false;\r\n })\r\n .catch((res) => {\r\n this.spinShow = false;\r\n this.$message.error(res.msg);\r\n });\r\n },\r\n getRowKeys(row) {\r\n return row.id;\r\n },\r\n changePrice(e, index) {\r\n this.$set(this.specsData[index], 'price', e);\r\n },\r\n // 下一步\r\n next(name) {\r\n let that = this;\r\n if (this.current === 1) {\r\n this.formValidate.id = Number(this.$route.params.id) || 0;\r\n this.submitOpen = true;\r\n let product_infos = [];\r\n this.tableData.forEach((item) => {\r\n product_infos.push({\r\n id: item.id,\r\n status: item.status,\r\n attrs: item.attrs,\r\n });\r\n this.formValidate.product_infos = product_infos;\r\n });\r\n seckillActivityAddApi(this.formValidate)\r\n .then(async (res) => {\r\n this.submitOpen = false;\r\n this.$message.success(res.msg);\r\n setTimeout(() => {\r\n this.$router.push({\r\n path: this.$routeProStr + '/marketing/store_seckill/index',\r\n });\r\n }, 500);\r\n })\r\n .catch((res) => {\r\n this.submitOpen = false;\r\n this.$message.error(res.msg);\r\n });\r\n } else {\r\n this.current += 1;\r\n }\r\n },\r\n // 上一步\r\n step() {\r\n this.current--;\r\n },\r\n // 点击商品图\r\n modalPicTap(tit, picTit, index) {\r\n this.modalPic = true;\r\n this.isChoice = tit === 'dan' ? '单选' : '多选';\r\n this.picTit = picTit;\r\n this.tableIndex = index;\r\n },\r\n // 获取单张图片信息\r\n getPic(pc) {\r\n switch (this.picTit) {\r\n case 'danFrom':\r\n this.formValidate.image = pc.att_dir;\r\n break;\r\n // case 'danTable':\r\n // this.specsData[this.tableIndex].pic = pc.att_dir;\r\n // break;\r\n default:\r\n if (!!this.formValidate.attrs && this.formValidate.attrs.length) {\r\n this.$set(this.specsData[this.tableIndex], '_checked', true);\r\n }\r\n this.specsData[this.tableIndex].pic = pc.att_dir;\r\n }\r\n this.modalPic = false;\r\n },\r\n // 获取多张图信息\r\n getPicD(pc) {\r\n this.images = pc;\r\n this.images.map((item) => {\r\n this.formValidate.images.push(item.att_dir);\r\n this.formValidate.images = this.formValidate.images.splice(0, 10);\r\n });\r\n this.modalPic = false;\r\n },\r\n handleRemove(i) {\r\n this.images.splice(i, 1);\r\n this.formValidate.images.splice(i, 1);\r\n },\r\n // 选择商品\r\n changeGoods() {\r\n this.modals = true;\r\n this.$nextTick((e) => {\r\n this.$refs.goodslist.formValidate.is_show = -1;\r\n this.$refs.goodslist.formValidate.type = 3;\r\n this.$refs.goodslist.getList();\r\n this.$refs.goodslist.goodsCategory();\r\n });\r\n }, // 移动\r\n handleDragStart(e, item) {\r\n this.dragging = item;\r\n },\r\n handleDragEnd(e, item) {\r\n this.dragging = null;\r\n },\r\n // 首先把div变成可以放置的元素,即重写dragenter/dragover\r\n handleDragOver(e) {\r\n e.dataTransfer.dropEffect = 'move'; // e.dataTransfer.dropEffect=\"move\";//在dragenter中针对放置目标来设置!\r\n },\r\n handleDragEnter(e, item) {\r\n e.dataTransfer.effectAllowed = 'move'; // 为需要移动的元素设置dragstart事件\r\n if (item === this.dragging) {\r\n return;\r\n }\r\n const newItems = [...this.formValidate.images];\r\n const src = newItems.indexOf(this.dragging);\r\n const dst = newItems.indexOf(item);\r\n newItems.splice(dst, 0, ...newItems.splice(src, 1));\r\n this.formValidate.images = newItems;\r\n },\r\n },\r\n};\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.content_width {\r\n width: 460px;\r\n}\r\n.maxW ::v-deep .ivu-select-dropdown {\r\n max-width: 600px;\r\n}\r\n.grey {\r\n color: #999;\r\n font-size: 12px;\r\n}\r\n.tabBox_img {\r\n width: 50px;\r\n height: 50px;\r\n margin: 0 auto;\r\n}\r\n.tabBox_img img {\r\n width: 100%;\r\n height: 100%;\r\n}\r\n.priceBox {\r\n width: 100%;\r\n}\r\n.form {\r\n .picBox {\r\n display: inline-block;\r\n cursor: pointer;\r\n }\r\n .pictrue {\r\n width: 60px;\r\n height: 60px;\r\n border: 1px dotted rgba(0, 0, 0, 0.1);\r\n margin-right: 15px;\r\n display: inline-block;\r\n position: relative;\r\n cursor: pointer;\r\n\r\n img {\r\n width: 100%;\r\n height: 100%;\r\n }\r\n .btndel {\r\n position: absolute;\r\n z-index: 9;\r\n width: 20px !important;\r\n height: 20px !important;\r\n left: 46px;\r\n top: -4px;\r\n }\r\n }\r\n .upLoad {\r\n width: 58px;\r\n height: 58px;\r\n line-height: 58px;\r\n border: 1px dotted rgba(0, 0, 0, 0.1);\r\n border-radius: 4px;\r\n background: rgba(0, 0, 0, 0.02);\r\n cursor: pointer;\r\n }\r\n .col {\r\n color: #2d8cf0;\r\n cursor: pointer;\r\n }\r\n}\r\n.addfont {\r\n font-size: 12px;\r\n color: var(--prev-color-primary);\r\n margin-left: 14px;\r\n cursor: pointer;\r\n margin-left: 10px;\r\n cursor: pointer;\r\n}\r\n</style>\r\n"]}]}