f3d7a4375adbbf63ed832c9172ad4238.json 41 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\\storeBargain\\create.vue?vue&type=style&index=0&id=432dcd1d&lang=scss&scoped=true","dependencies":[{"path":"D:\\front\\item\\zyAdmin\\src\\pages\\marketing\\storeBargain\\create.vue","mtime":1761614939035},{"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:DQouY29udGVudF93aWR0aCB7DQogIHdpZHRoOiA0NjBweDsNCn0NCi5ncmV5IHsNCiAgY29sb3I6ICM5OTk7DQogIGZvbnQtc2l6ZTogMTJweDsNCn0NCi5tYXhXIDo6di1kZWVwIC5pdnUtc2VsZWN0LWRyb3Bkb3duIHsNCiAgbWF4LXdpZHRoOiA2MDBweDsNCn0NCi5pdnUtdGFibGUtd3JhcHBlciB7DQogIGJvcmRlci1sZWZ0OiAxcHggc29saWQgI2RjZGVlMjsNCiAgYm9yZGVyLXRvcDogMXB4IHNvbGlkICNkY2RlZTI7DQp9DQoudGFiQm94X2ltZyB7DQogIHdpZHRoOiA1MHB4Ow0KICBoZWlnaHQ6IDUwcHg7DQp9DQoudGFiQm94X2ltZyBpbWcgew0KICB3aWR0aDogMTAwJTsNCiAgaGVpZ2h0OiAxMDAlOw0KfQ0KLnByaWNlQm94IHsNCiAgd2lkdGg6IDEwMCU7DQp9DQouZm9ybSB7DQogIC5waWNCb3ggew0KICAgIGRpc3BsYXk6IGlubGluZS1ibG9jazsNCiAgICBjdXJzb3I6IHBvaW50ZXI7DQogIH0NCiAgLnBpY3RydWUgew0KICAgIHdpZHRoOiA2MHB4Ow0KICAgIGhlaWdodDogNjBweDsNCiAgICBib3JkZXI6IDFweCBkb3R0ZWQgcmdiYSgwLCAwLCAwLCAwLjEpOw0KICAgIG1hcmdpbi1yaWdodDogMTVweDsNCiAgICBkaXNwbGF5OiBpbmxpbmUtYmxvY2s7DQogICAgcG9zaXRpb246IHJlbGF0aXZlOw0KICAgIGN1cnNvcjogcG9pbnRlcjsNCg0KICAgIGltZyB7DQogICAgICB3aWR0aDogMTAwJTsNCiAgICAgIGhlaWdodDogMTAwJTsNCiAgICB9DQogICAgLmJ0bmRlbCB7DQogICAgICBwb3NpdGlvbjogYWJzb2x1dGU7DQogICAgICB6LWluZGV4OiA5Ow0KICAgICAgd2lkdGg6IDIwcHggIWltcG9ydGFudDsNCiAgICAgIGhlaWdodDogMjBweCAhaW1wb3J0YW50Ow0KICAgICAgbGVmdDogNDZweDsNCiAgICAgIHRvcDogLTRweDsNCiAgICB9DQogIH0NCiAgLnVwTG9hZCB7DQogICAgd2lkdGg6IDU4cHg7DQogICAgaGVpZ2h0OiA1OHB4Ow0KICAgIGxpbmUtaGVpZ2h0OiA1OHB4Ow0KICAgIGJvcmRlcjogMXB4IGRvdHRlZCByZ2JhKDAsIDAsIDAsIDAuMSk7DQogICAgYm9yZGVyLXJhZGl1czogNHB4Ow0KICAgIGJhY2tncm91bmQ6IHJnYmEoMCwgMCwgMCwgMC4wMik7DQogICAgY3Vyc29yOiBwb2ludGVyOw0KICB9DQogIC5jb2wgew0KICAgIGNvbG9yOiAjMmQ4Y2YwOw0KICAgIGN1cnNvcjogcG9pbnRlcjsNCiAgfQ0KfQ0KLmFkZGZvbnQgew0KICBmb250LXNpemU6IDEycHg7DQogIGNvbG9yOiB2YXIoLS1wcmV2LWNvbG9yLXByaW1hcnkpOw0KICBtYXJnaW4tbGVmdDogMTRweDsNCiAgY3Vyc29yOiBwb2ludGVyOw0KICBtYXJnaW4tbGVmdDogMTBweDsNCiAgY3Vyc29yOiBwb2ludGVyOw0KfQ0K"},{"version":3,"sources":["create.vue"],"names":[],"mappings":";AAu7BA;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;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":"create.vue","sourceRoot":"src/pages/marketing/storeBargain","sourcesContent":["<template>\r\n <div>\r\n <pages-header\r\n ref=\"pageHeader\"\r\n :title=\"$route.params.id ? '编辑砍价商品' : '添加砍价商品'\"\r\n :backUrl=\"$routeProStr + '/marketing/store_bargain/index'\"\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\"></steps>\r\n </el-col>\r\n <el-col :span=\"23\" v-loading=\"spinShow\">\r\n <el-form\r\n class=\"form mt30\"\r\n ref=\"formValidate\"\r\n :rules=\"ruleValidate\"\r\n :model=\"formValidate\"\r\n @on-validate=\"validate\"\r\n :label-width=\"labelWidth\"\r\n :label-position=\"labelPosition\"\r\n @submit.native.prevent\r\n >\r\n <el-form-item label=\"选择商品:\" prop=\"image_input\" v-show=\"current === 0\">\r\n <div class=\"picBox\" v-db-click @click=\"changeGoods\">\r\n <div class=\"pictrue\" v-if=\"formValidate.image\">\r\n <img v-lazy=\"formValidate.image\" />\r\n </div>\r\n <div class=\"upLoad acea-row row-center-wrapper\" v-else>\r\n <i class=\"el-icon-goods\" style=\"font-size: 24px\"></i>\r\n </div>\r\n </div>\r\n </el-form-item>\r\n <el-row v-show=\"current === 1\">\r\n <el-col :span=\"24\">\r\n <el-form-item label=\"商品主图:\" prop=\"image\">\r\n <div class=\"picBox\" v-db-click @click=\"modalPicTap('dan', 'danFrom')\">\r\n <div class=\"pictrue\" v-if=\"formValidate.image\">\r\n <img v-lazy=\"formValidate.image\" />\r\n </div>\r\n <div class=\"upLoad acea-row row-center-wrapper\" v-else>\r\n <i class=\"el-icon-picture-outline\" style=\"font-size: 24px\"></i>\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=\"商品轮播图:\" prop=\"images\">\r\n <div class=\"acea-row\">\r\n <div\r\n class=\"pictrue\"\r\n v-for=\"(item, index) in formValidate.images\"\r\n :key=\"index\"\r\n draggable=\"true\"\r\n @dragstart=\"handleDragStart($event, item)\"\r\n @dragover.prevent=\"handleDragOver($event, item)\"\r\n @dragenter=\"handleDragEnter($event, item)\"\r\n @dragend=\"handleDragEnd($event, item)\"\r\n >\r\n <img v-lazy=\"item\" />\r\n <i class=\"el-icon-circle-close btndel\" v-db-click @click=\"handleRemove(index)\"></i>\r\n </div>\r\n <div\r\n v-if=\"formValidate.images.length < 10\"\r\n class=\"upLoad acea-row row-center-wrapper\"\r\n v-db-click\r\n @click=\"modalPicTap('duo')\"\r\n >\r\n <i class=\"el-icon-picture-outline\" style=\"font-size: 24px\"></i>\r\n </div>\r\n </div>\r\n </el-form-item>\r\n </el-col>\r\n <el-col :span=\"24\">\r\n <el-col v-bind=\"grid\">\r\n <el-form-item label=\"砍价活动名称:\" prop=\"title\" label-for=\"title\">\r\n <el-input\r\n placeholder=\"请输入砍价活动名称\"\r\n v-model=\"formValidate.title\"\r\n class=\"content_width\"\r\n maxlength=\"30\"\r\n show-word-limit\r\n />\r\n </el-form-item>\r\n </el-col>\r\n </el-col>\r\n <el-col :span=\"24\">\r\n <el-col v-bind=\"grid\">\r\n <el-form-item label=\"砍价活动简介:\" prop=\"info\" label-for=\"info\">\r\n <el-input\r\n placeholder=\"请输入砍价活动简介\"\r\n type=\"textarea\"\r\n :rows=\"4\"\r\n v-model=\"formValidate.info\"\r\n class=\"content_width\"\r\n maxlength=\"100\"\r\n show-word-limit\r\n />\r\n </el-form-item>\r\n </el-col>\r\n </el-col>\r\n <el-col :span=\"24\">\r\n <el-form-item label=\"活动时间:\" prop=\"section_time\">\r\n <div>\r\n <el-date-picker\r\n clearable\r\n :editable=\"false\"\r\n type=\"datetimerange\"\r\n format=\"yyyy-MM-dd HH:mm\"\r\n value-format=\"yyyy-MM-dd HH:mm\"\r\n range-separator=\"-\"\r\n start-placeholder=\"开始日期\"\r\n end-placeholder=\"结束日期\"\r\n @change=\"onchangeTime\"\r\n style=\"width: 460px\"\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 <el-col :span=\"24\" v-if=\"formValidate.virtual_type == 0\">\r\n <el-form-item label=\"物流方式:\" prop=\"logistics\">\r\n <el-checkbox-group v-model=\"formValidate.logistics\">\r\n <el-checkbox label=\"1\">快递</el-checkbox>\r\n <el-checkbox label=\"2\">到店</el-checkbox>\r\n </el-checkbox-group>\r\n </el-form-item>\r\n </el-col>\r\n <el-col :span=\"24\" v-if=\"formValidate.virtual_type == 0\">\r\n <el-form-item label=\"运费设置:\" :prop=\"formValidate.freight != 1 ? 'freight' : ''\">\r\n <el-radio-group v-model=\"formValidate.freight\">\r\n <el-radio :label=\"2\">固定邮费</el-radio>\r\n <el-radio :label=\"3\">运费模板</el-radio>\r\n </el-radio-group>\r\n </el-form-item>\r\n </el-col>\r\n <el-col\r\n :span=\"24\"\r\n v-if=\"formValidate.freight != 3 && formValidate.freight != 1 && formValidate.virtual_type == 0\"\r\n >\r\n <el-form-item label=\"\">\r\n <div class=\"acea-row\">\r\n <el-input-number\r\n :controls=\"false\"\r\n :min=\"0\"\r\n :max=\"9999999999\"\r\n v-model=\"formValidate.postage\"\r\n placeholder=\"请输入金额\"\r\n class=\"content_width\"\r\n />\r\n </div>\r\n </el-form-item>\r\n </el-col>\r\n <el-col :span=\"24\" v-if=\"formValidate.freight == 3 && formValidate.virtual_type == 0\">\r\n <el-form-item label=\"\" prop=\"temp_id\">\r\n <div class=\"acea-row\">\r\n <el-select\r\n v-model=\"formValidate.temp_id\"\r\n clearable\r\n placeholder=\"请选择运费模板\"\r\n class=\"content_width\"\r\n >\r\n <el-option\r\n v-for=\"(item, index) in templateList\"\r\n :value=\"item.id\"\r\n :key=\"index\"\r\n :label=\"item.name\"\r\n ></el-option>\r\n </el-select>\r\n <span class=\"addfont\" v-db-click @click=\"freight\">新增运费模板</span>\r\n </div>\r\n </el-form-item>\r\n </el-col>\r\n <el-col :span=\"24\">\r\n <el-form-item label=\"砍价人数:\" prop=\"people_num\" label-for=\"people_num\">\r\n <div>\r\n <el-input-number\r\n :controls=\"false\"\r\n placeholder=\"请输入砍价人数\"\r\n element-id=\"people_num\"\r\n :min=\"2\"\r\n :max=\"10000\"\r\n :precision=\"0\"\r\n v-model=\"formValidate.people_num\"\r\n class=\"content_width input-number-unit-class\"\r\n class-unit=\"人\"\r\n />\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=\"帮砍次数:\" prop=\"bargain_num\" label-for=\"bargain_num\">\r\n <div>\r\n <el-input-number\r\n :controls=\"false\"\r\n placeholder=\"请输入帮砍次数\"\r\n :min=\"1\"\r\n :max=\"10000\"\r\n :precision=\"0\"\r\n v-model=\"formValidate.bargain_num\"\r\n class=\"content_width input-number-unit-class\"\r\n class-unit=\"次\"\r\n />\r\n <div class=\"grey\">\r\n 单个商品用户可以帮砍的次数,例:次数设置为1,甲和乙同时将商品A的砍价链接发给丙,丙只能帮甲或乙其中一个人砍价\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=\"单位:\" prop=\"unit_name\" label-for=\"unit_name\">\r\n <el-input\r\n placeholder=\"请输入单位\"\r\n element-id=\"unit_name\"\r\n v-model=\"formValidate.unit_name\"\r\n class=\"content_width\"\r\n />\r\n </el-form-item>\r\n </el-col>\r\n <el-col :span=\"24\">\r\n <el-form-item label=\"购买数量限制:\" prop=\"num\">\r\n <div>\r\n <el-input-number\r\n :controls=\"false\"\r\n placeholder=\"购买数量限制\"\r\n :min=\"1\"\r\n :max=\"10000\"\r\n :precision=\"0\"\r\n v-model=\"formValidate.num\"\r\n class=\"content_width input-number-unit-class\"\r\n :class-unit=\"formValidate.unit_name || '件'\"\r\n />\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=\"排序:\">\r\n <el-input-number\r\n :controls=\"false\"\r\n placeholder=\"请输入排序\"\r\n element-id=\"sort\"\r\n :min=\"0\"\r\n :max=\"10000\"\r\n :precision=\"0\"\r\n v-model=\"formValidate.sort\"\r\n class=\"content_width\"\r\n />\r\n </el-form-item>\r\n </el-col>\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 :span=\"24\">\r\n <el-form-item label=\"规格选择:\">\r\n <el-table :data=\"specsData\" border>\r\n <el-table-column width=\"50\">\r\n <template slot-scope=\"scope\">\r\n <el-radio type=\"index\" v-model=\"templateRadio\" :label=\"scope.$index\" @input=\"getTemplateRow\"\r\n >&nbsp;</el-radio\r\n >\r\n </template>\r\n </el-table-column>\r\n <el-table-column\r\n :label=\"item.title\"\r\n :min-width=\"item.minWidth\"\r\n v-for=\"(item, index) in columns\"\r\n :key=\"index\"\r\n >\r\n <template slot-scope=\"scope\">\r\n <template v-if=\"item.key\">\r\n <div>\r\n <span>{{ scope.row[item.key] }}</span>\r\n </div>\r\n </template>\r\n <template v-else-if=\"item.slot === 'pic'\">\r\n <div\r\n class=\"acea-row row-middle row-center-wrapper\"\r\n v-db-click\r\n @click=\"modalPicTap('dan', 'danTable', scope.$index)\"\r\n >\r\n <div class=\"pictrue pictrueTab\" v-if=\"scope.row.pic\">\r\n <img v-lazy=\"scope.row.pic\" />\r\n </div>\r\n <div class=\"upLoad pictrueTab acea-row row-center-wrapper\" v-else>\r\n <i class=\"el-icon-picture-outline\" style=\"font-size: 24px\"></i>\r\n </div>\r\n </div>\r\n </template>\r\n <template v-else-if=\"item.slot === 'price'\">\r\n <el-input-number\r\n :controls=\"false\"\r\n v-model=\"scope.row.price\"\r\n :min=\"0\"\r\n :precision=\"2\"\r\n class=\"priceBox\"\r\n :active-change=\"false\"\r\n ></el-input-number>\r\n </template>\r\n <template v-else-if=\"item.slot === 'min_price'\">\r\n <el-input-number\r\n :controls=\"false\"\r\n v-model=\"scope.row.min_price\"\r\n :min=\"0\"\r\n :precision=\"2\"\r\n class=\"priceBox\"\r\n :active-change=\"false\"\r\n ></el-input-number>\r\n </template>\r\n <template v-else-if=\"item.slot === 'quota'\">\r\n <el-input-number\r\n :controls=\"false\"\r\n v-model=\"scope.row.quota\"\r\n :min=\"1\"\r\n active-change\r\n class=\"priceBox\"\r\n ></el-input-number>\r\n </template>\r\n </template>\r\n </el-table-column>\r\n </el-table>\r\n </el-form-item>\r\n </el-col>\r\n </el-row>\r\n <div v-if=\"current === 2\">\r\n <el-form-item label=\"内容:\">\r\n <WangEditor\r\n style=\"width: 90%\"\r\n :content=\"formValidate.description\"\r\n @editorContent=\"getEditorContent\"\r\n ></WangEditor>\r\n </el-form-item>\r\n </div>\r\n <div v-if=\"current === 3\">\r\n <el-form-item label=\"规则:\">\r\n <WangEditor\r\n style=\"width: 90%\"\r\n :content=\"formValidate.rule\"\r\n @editorContent=\"getEditorContent2\"\r\n ></WangEditor>\r\n </el-form-item>\r\n </div>\r\n <el-form-item>\r\n <el-button\r\n v-if=\"current !== 0\"\r\n class=\"submission\"\r\n v-db-click\r\n @click=\"step\"\r\n :disabled=\"($route.params.id && $route.params.id !== '0' && current === 1) || current === 0\"\r\n >上一步</el-button\r\n >\r\n <el-button\r\n type=\"primary\"\r\n :disabled=\"submitOpen && current === 3\"\r\n class=\"submission\"\r\n v-db-click\r\n @click=\"next('formValidate')\"\r\n >{{ current === 3 ? '提交' : '下一步' }}</el-button\r\n >\r\n </el-form-item>\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\" @getProductId=\"getProductId\"></goods-list>\r\n </el-dialog>\r\n\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 </div>\r\n</template>\r\n\r\n<script>\r\nimport { mapState } from 'vuex';\r\nimport goodsList from '@/components/goodsList/index';\r\nimport uploadPictures from '@/components/uploadPictures';\r\nimport { bargainInfoApi, bargainCreatApi, productAttrsApi } from '@/api/marketing';\r\nimport { productGetTemplateApi } from '@/api/product';\r\nimport freightTemplate from '@/components/freightTemplate/index';\r\nimport WangEditor from '@/components/wangEditor/index.vue';\r\nimport steps from '@/components/steps/index';\r\n\r\nexport default {\r\n name: 'storeBargainCreate',\r\n components: {\r\n goodsList,\r\n uploadPictures,\r\n freightTemplate,\r\n WangEditor,\r\n steps,\r\n },\r\n data() {\r\n return {\r\n templateRadio: 0,\r\n submitOpen: false,\r\n spinShow: false,\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 stepList: ['选择砍价商品', '填写基础信息', '修改商品详情', '修改商品规则'],\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: 8,\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 modals: false,\r\n modal_loading: false,\r\n images: [],\r\n templateList: [],\r\n columns: [],\r\n specsData: [],\r\n formValidate: {\r\n images: [],\r\n info: '',\r\n title: '',\r\n store_name: '',\r\n image: '',\r\n unit_name: '',\r\n price: 0,\r\n min_price: 0,\r\n bargain_max_price: 10,\r\n bargain_min_price: 0.01,\r\n cost: 0,\r\n bargain_num: 1,\r\n people_num: 2,\r\n stock: 1,\r\n sales: 0,\r\n sort: 0,\r\n num: 1,\r\n give_integral: 0,\r\n is_postage: 0,\r\n is_hot: 0,\r\n status: 0,\r\n section_time: [],\r\n description: '',\r\n rule: '',\r\n id: 0,\r\n product_id: 0,\r\n temp_id: '',\r\n attrs: [],\r\n items: [],\r\n logistics: [], //选择物流方式\r\n freight: 2, //运费设置\r\n postage: 1, //设置运费金额\r\n is_commission: 0,\r\n },\r\n description: '',\r\n rule: '',\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 store_name: [{ 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 min_price: [\r\n {\r\n required: true,\r\n type: 'number',\r\n message: '请输入最低购买价',\r\n trigger: 'blur',\r\n },\r\n ],\r\n // bargain_max_price: [\r\n // { required: true, type: 'number', message: '请输单次砍价最大金额', trigger: 'blur' }\r\n // ],\r\n // bargain_min_price: [\r\n // { required: true, type: 'number', message: '单次砍价最小金额', trigger: 'blur' }\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 bargain_num: [\r\n {\r\n required: true,\r\n type: 'number',\r\n message: '请输入帮砍次数',\r\n trigger: 'blur',\r\n },\r\n ],\r\n people_num: [\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 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 },\r\n currentid: 0,\r\n picTit: '',\r\n tableIndex: 0,\r\n copy: 0,\r\n };\r\n },\r\n computed: {\r\n ...mapState('media', ['isMobile']),\r\n labelWidth() {\r\n return this.isMobile ? undefined : '140px';\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 !== '0' && this.$route.params.id) {\r\n this.copy = this.$route.params.copy;\r\n this.current = 1;\r\n this.getInfo();\r\n }\r\n this.productGetTemplate();\r\n },\r\n methods: {\r\n // 详情内容\r\n getEditorContent(data) {\r\n this.description = data;\r\n },\r\n // 规则内容\r\n getEditorContent2(data) {\r\n this.rule = data;\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 productAttrs(row) {\r\n let that = this;\r\n productAttrsApi(row.id, 2)\r\n .then((res) => {\r\n let data = res.data.info;\r\n that.columns = data.header;\r\n // that.columns.unshift(radio);\r\n that.specsData = data.attrs;\r\n that.formValidate.items = data.items;\r\n that.$set(that.formValidate, 'attrs', [that.specsData[0]]);\r\n })\r\n .catch((res) => {\r\n that.$message.error(res.msg);\r\n });\r\n },\r\n getTemplateRow(index) {\r\n this.currentid = index;\r\n this.$set(this.formValidate, 'attrs', [this.specsData[index]]);\r\n },\r\n // 获取运费模板;\r\n productGetTemplate() {\r\n productGetTemplateApi().then((res) => {\r\n this.templateList = res.data;\r\n });\r\n },\r\n // 商品id\r\n getProductId(row) {\r\n this.modal_loading = false;\r\n this.modals = false;\r\n setTimeout(() => {\r\n this.formValidate = {\r\n // attrs: row.attrs,\r\n images: row.slider_image,\r\n info: row.store_info,\r\n title: row.store_name,\r\n store_name: row.store_name,\r\n image: row.image,\r\n unit_name: row.unit_name,\r\n price: 0, // 不取商品中的原价\r\n min_price: 0,\r\n bargain_max_price: 10,\r\n bargain_min_price: 0.01,\r\n cost: row.cost,\r\n bargain_num: 1,\r\n people_num: 2,\r\n stock: row.stock,\r\n sales: row.sales,\r\n sort: row.sort,\r\n num: 1,\r\n give_integral: row.give_integral,\r\n is_postage: row.is_postage,\r\n is_hot: row.is_hot,\r\n status: 0,\r\n section_time: [],\r\n description: '', // 不取商品中的\r\n rule: '',\r\n id: 0,\r\n product_id: row.id,\r\n temp_id: row.temp_id,\r\n logistics: row.temp_id ? row.temp_id : ['1'], //选择物流方式\r\n freight: row.freight, //运费设置\r\n postage: row.postage, //设置运费金额\r\n custom_form: row.custom_form, //自定义表单数据\r\n virtual_type: row.virtual_type, //虚拟商品类型\r\n is_commission: row.is_commission,\r\n };\r\n this.productAttrs(row);\r\n }, 500);\r\n },\r\n cancel() {\r\n this.modals = false;\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';\r\n },\r\n handleDragEnter(e, item) {\r\n e.dataTransfer.effectAllowed = 'move';\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 onchangeTime(e) {\r\n this.formValidate.section_time = e;\r\n },\r\n // 详情\r\n getInfo() {\r\n this.spinShow = true;\r\n bargainInfoApi(this.$route.params.id)\r\n .then(async (res) => {\r\n let that = this;\r\n let info = res.data.info;\r\n this.formValidate = info;\r\n this.formValidate.rule = info.rule === null ? '' : info.rule;\r\n this.$set(this.formValidate, 'items', info.attrs.items);\r\n this.description = this.formValidate.description;\r\n this.columns = info.attrs.header;\r\n this.specsData = info.attrs.value;\r\n let defaultAttrs = [];\r\n info.attrs.value.forEach(function (item, index) {\r\n if (item.opt) {\r\n defaultAttrs.push(item);\r\n that.$set(that, 'currentid', index);\r\n that.$set(that, 'templateRadio', index);\r\n that.$set(that.formValidate, 'attrs', defaultAttrs);\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 // 下一步\r\n next(name) {\r\n if (this.current === 3) {\r\n this.formValidate.description = this.description;\r\n this.formValidate.rule = this.rule;\r\n this.$refs[name].validate((valid) => {\r\n if (valid) {\r\n if (this.copy == 1) this.formValidate.copy = 1;\r\n this.formValidate.id = this.$route.params.id || 0;\r\n this.submitOpen = true;\r\n bargainCreatApi(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_bargain/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 return false;\r\n }\r\n });\r\n } else if (this.current === 1) {\r\n this.$refs[name].validate((valid) => {\r\n if (valid) {\r\n if (this.currentid === '') {\r\n return this.$message.error('请选择属性规格');\r\n } else {\r\n let val = this.specsData[this.currentid];\r\n // let formValidate = this.formValidate.attrs[0];\r\n // formValidate.price = val.price;\r\n // formValidate.min_price = val.min_price;\r\n // formValidate.quota = val.quota;\r\n if (this.formValidate.attrs[0].quota <= 0) {\r\n return this.$message.error('砍价限量必须大于0');\r\n }\r\n if (this.formValidate.attrs[0].quota > this.formValidate.attrs[0]['stock']) {\r\n return this.$message.error('砍价限量不能超过规格库存');\r\n }\r\n }\r\n this.current += 1;\r\n // setTimeout((e) => {\r\n // this.formValidate.description += ' ';\r\n // }, 0);\r\n } else {\r\n return this.$message.warning('请完善您的信息');\r\n }\r\n });\r\n } else {\r\n if (this.formValidate.image) {\r\n this.current += 1;\r\n if (this.current == 3) {\r\n setTimeout((e) => {\r\n this.formValidate.rule += ' ';\r\n }, 0);\r\n }\r\n } else {\r\n this.$message.warning('请选择商品');\r\n }\r\n }\r\n },\r\n // 上一步\r\n step() {\r\n this.current--;\r\n },\r\n // 内容\r\n getContent(val) {\r\n this.formValidate.description = val;\r\n },\r\n // 规则\r\n getRole(val) {\r\n this.formValidate.rule = val;\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 default:\r\n this.specsData[this.tableIndex].pic = pc.att_dir;\r\n this.formValidate.attrs[0].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 // 表单验证\r\n validate(prop, status, error) {\r\n if (status === false) {\r\n this.$message.error(error);\r\n }\r\n },\r\n // 添加自定义弹窗\r\n addCustomDialog(editorId) {\r\n window.UE.registerUI(\r\n 'test-dialog',\r\n function (editor, uiName) {\r\n // 创建 dialog\r\n let dialog = new window.UE.ui.Dialog({\r\n // 指定弹出层中页面的路径,这里只能支持页面,路径参考常见问题 2\r\n iframeUrl: this.$routeProStr + '/widget.images/index.html?fodder=dialog',\r\n // 需要指定当前的编辑器实例\r\n editor: editor,\r\n // 指定 dialog 的名字\r\n name: uiName,\r\n // dialog 的标题\r\n title: '上传图片',\r\n // 指定 dialog 的外围样式\r\n cssRules: 'width:960px;height:550px;padding:20px;',\r\n });\r\n this.dialog = dialog;\r\n var btn = new window.UE.ui.Button({\r\n name: 'dialog-button',\r\n title: '上传图片',\r\n cssRules: `background-image: url(../../../assets/images/icons.png);background-position: -726px -77px;`,\r\n onclick: function () {\r\n // 渲染dialog\r\n dialog.render();\r\n dialog.open();\r\n },\r\n });\r\n return btn;\r\n },\r\n 37,\r\n );\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.grey {\r\n color: #999;\r\n font-size: 12px;\r\n}\r\n.maxW ::v-deep .ivu-select-dropdown {\r\n max-width: 600px;\r\n}\r\n.ivu-table-wrapper {\r\n border-left: 1px solid #dcdee2;\r\n border-top: 1px solid #dcdee2;\r\n}\r\n.tabBox_img {\r\n width: 50px;\r\n height: 50px;\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"]}]}