7bed9e632b561b9fc12f5ecf3967590e.json 33 KB

1
  1. {"remainingRequest":"C:\\Users\\Administrator\\Desktop\\crmeb5.0\\template\\admin\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!C:\\Users\\Administrator\\Desktop\\crmeb5.0\\template\\admin\\src\\pages\\marketing\\storePresell\\create.vue?vue&type=style&index=0&id=63ed8eda&lang=scss&scoped=true","dependencies":[{"path":"C:\\Users\\Administrator\\Desktop\\crmeb5.0\\template\\admin\\src\\pages\\marketing\\storePresell\\create.vue","mtime":1761185180135},{"path":"C:\\Users\\Administrator\\Desktop\\crmeb5.0\\template\\admin\\node_modules\\css-loader\\index.js","mtime":499162500000},{"path":"C:\\Users\\Administrator\\Desktop\\crmeb5.0\\template\\admin\\node_modules\\vue-loader\\lib\\loaders\\stylePostLoader.js","mtime":499162500000},{"path":"C:\\Users\\Administrator\\Desktop\\crmeb5.0\\template\\admin\\node_modules\\postcss-loader\\src\\index.js","mtime":499162500000},{"path":"C:\\Users\\Administrator\\Desktop\\crmeb5.0\\template\\admin\\node_modules\\sass-loader\\dist\\cjs.js","mtime":499162500000},{"path":"C:\\Users\\Administrator\\Desktop\\crmeb5.0\\template\\admin\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"C:\\Users\\Administrator\\Desktop\\crmeb5.0\\template\\admin\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":[{"type":"Buffer","data":"base64:DQouZ3JleSB7DQogIGNvbG9yOiAjOTk5Ow0KfQ0KLm1heFcgOjp2LWRlZXAgLml2dS1zZWxlY3QtZHJvcGRvd24gew0KICBtYXgtd2lkdGg6IDYwMHB4Ow0KfQ0KLml2dS10YWJsZS13cmFwcGVyIHsNCiAgYm9yZGVyLWxlZnQ6IDFweCBzb2xpZCAjZGNkZWUyOw0KICBib3JkZXItdG9wOiAxcHggc29saWQgI2RjZGVlMjsNCn0NCi50YWJCb3hfaW1nIHsNCiAgd2lkdGg6IDUwcHg7DQogIGhlaWdodDogNTBweDsNCn0NCi50YWJCb3hfaW1nIGltZyB7DQogIHdpZHRoOiAxMDAlOw0KICBoZWlnaHQ6IDEwMCU7DQp9DQoucHJpY2VCb3ggew0KICB3aWR0aDogMTAwJTsNCn0NCi5mb3JtIHsNCiAgLnBpY0JveCB7DQogICAgZGlzcGxheTogaW5saW5lLWJsb2NrOw0KICAgIGN1cnNvcjogcG9pbnRlcjsNCiAgfQ0KICAucGljdHJ1ZSB7DQogICAgd2lkdGg6IDYwcHg7DQogICAgaGVpZ2h0OiA2MHB4Ow0KICAgIGJvcmRlcjogMXB4IGRvdHRlZCByZ2JhKDAsIDAsIDAsIDAuMSk7DQogICAgbWFyZ2luLXJpZ2h0OiAxNXB4Ow0KICAgIGRpc3BsYXk6IGlubGluZS1ibG9jazsNCiAgICBwb3NpdGlvbjogcmVsYXRpdmU7DQogICAgY3Vyc29yOiBwb2ludGVyOw0KDQogICAgaW1nIHsNCiAgICAgIHdpZHRoOiAxMDAlOw0KICAgICAgaGVpZ2h0OiAxMDAlOw0KICAgIH0NCiAgICAuYnRuZGVsIHsNCiAgICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTsNCiAgICAgIHotaW5kZXg6IDk7DQogICAgICB3aWR0aDogMjBweCAhaW1wb3J0YW50Ow0KICAgICAgaGVpZ2h0OiAyMHB4ICFpbXBvcnRhbnQ7DQogICAgICBsZWZ0OiA0NnB4Ow0KICAgICAgdG9wOiAtNHB4Ow0KICAgIH0NCiAgfQ0KICAudXBMb2FkIHsNCiAgICB3aWR0aDogNThweDsNCiAgICBoZWlnaHQ6IDU4cHg7DQogICAgbGluZS1oZWlnaHQ6IDU4cHg7DQogICAgYm9yZGVyOiAxcHggZG90dGVkIHJnYmEoMCwgMCwgMCwgMC4xKTsNCiAgICBib3JkZXItcmFkaXVzOiA0cHg7DQogICAgYmFja2dyb3VuZDogcmdiYSgwLCAwLCAwLCAwLjAyKTsNCiAgICBjdXJzb3I6IHBvaW50ZXI7DQogIH0NCiAgLmNvbCB7DQogICAgY29sb3I6ICMyZDhjZjA7DQogICAgY3Vyc29yOiBwb2ludGVyOw0KICB9DQp9DQo="},{"version":3,"sources":["create.vue"],"names":[],"mappings":";AAuxBA;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","file":"create.vue","sourceRoot":"src/pages/marketing/storePresell","sourcesContent":["<template>\r\n <div v-loading=\"spinShow\">\r\n <div class=\"i-layout-page-header\">\r\n <div class=\"i-layout-page-header\">\r\n <router-link :to=\"{ path: $routeProStr + '/marketing/presell/index' }\">\r\n <el-button icon=\"ios-arrow-back\" size=\"small\" class=\"mr20\">返回 </el-button>\r\n </router-link>\r\n <span\r\n class=\"ivu-page-header-title mr20\"\r\n v-text=\"$route.params.id != 0 ? '编辑预售商品' : '添加预售商品'\"\r\n ></span>\r\n </div>\r\n </div>\r\n <el-card :bordered=\"false\" shadow=\"never\" class=\"ivu-mt\">\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\">\r\n <el-form\r\n class=\"form mt30\"\r\n ref=\"formValidate\"\r\n :model=\"formValidate\"\r\n :rules=\"ruleValidate\"\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-if=\"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 <el-button\r\n shape=\"circle\"\r\n icon=\"md-close\"\r\n v-db-click\r\n @click.native=\"handleRemove(index)\"\r\n class=\"btndel\"\r\n ></el-button>\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 placeholder=\"请输入预售名称\" element-id=\"title\" v-model=\"formValidate.title\" />\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 element-id=\"info\"\r\n v-model=\"formValidate.info\"\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 class=\"acea-row row-middle\">\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 class=\"perW20\"\r\n v-model=\"formValidate.section_time\"\r\n ></el-date-picker>\r\n <div class=\"ml10 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=\"deliver_time\">\r\n <div class=\"acea-row row-middle\">\r\n <span class=\"mr10\">预售活动结束后</span>\r\n <el-input-number\r\n :controls=\"false\"\r\n placeholder=\"请输入发货时间\"\r\n :precision=\"0\"\r\n :min=\"1\"\r\n v-model=\"formValidate.deliver_time\"\r\n />\r\n <span class=\"ml10\"> 天之内 </span>\r\n <div class=\"ml10 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=\"temp_id\">\r\n <div class=\"acea-row row-middle\">\r\n <el-select v-model=\"formValidate.temp_id\" class=\"perW20\">\r\n <el-option\r\n v-for=\"item in templateList\"\r\n :value=\"item.id\"\r\n :key=\"item.id\"\r\n :label=\"item.name\"\r\n ></el-option>\r\n </el-select>\r\n <div class=\"ml10 col\" v-db-click @click=\"freight\">添加运费模板</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=\"num\">\r\n <div class=\"acea-row row-middle\">\r\n <el-input-number\r\n :controls=\"false\"\r\n :min=\"1\"\r\n placeholder=\"请输入总数量限制\"\r\n :precision=\"0\"\r\n element-id=\"num\"\r\n v-model=\"formValidate.num\"\r\n class=\"perW20\"\r\n />\r\n <div class=\"ml10 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=\"单位:\" 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=\"perW20\"\r\n />\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 :precision=\"0\"\r\n v-model=\"formValidate.sort\"\r\n class=\"perW10\"\r\n />\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\" @selection-change=\"changeCheckbox\">\r\n <el-table-column type=\"selection\" width=\"55\"> </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 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 </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 <el-row v-show=\"current === 2\">\r\n <el-col :span=\"24\">\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 </el-col>\r\n </el-row>\r\n <el-form-item>\r\n <el-button\r\n class=\"submission\"\r\n v-db-click\r\n @click=\"step\"\r\n :disabled=\"($route.params.id && current === 1) || current === 0\"\r\n >上一步\r\n </el-button>\r\n <el-button\r\n type=\"primary\"\r\n :disabled=\"submitOpen && current === 2\"\r\n class=\"submission\"\r\n v-db-click\r\n @click=\"next('formValidate')\"\r\n >{{ current === 2 ? '提交' : '下一步' }}</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 <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 WangEditor from '@/components/wangEditor/index.vue';\r\nimport uploadPictures from '@/components/uploadPictures';\r\nimport freightTemplate from '@/components/freightTemplate/index';\r\nimport { presellInfoApi, presellCreatApi, productAttrsApi } from '@/api/marketing';\r\nimport { productGetTemplateApi } from '@/api/product';\r\nimport steps from '@/components/steps/index';\r\n\r\nexport default {\r\n name: 'storePersellCreate',\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: 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 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 templateList: [],\r\n columns: [],\r\n specsData: [],\r\n picTit: '',\r\n tableIndex: 0,\r\n formValidate: {\r\n images: [],\r\n info: '',\r\n title: '',\r\n image: '',\r\n unit_name: '',\r\n stock: 1,\r\n sales: 0,\r\n deliver_time: 3,\r\n sort: 0,\r\n status: 1,\r\n section_time: [],\r\n description: '',\r\n id: 0,\r\n product_id: 0,\r\n // pay_time: [],\r\n // type: 1,\r\n num: 1,\r\n deposit: 1,\r\n temp_id: '',\r\n attrs: [],\r\n items: [],\r\n },\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 // pay_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 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 give_integral: [\r\n {\r\n required: true,\r\n type: 'number',\r\n message: '请输入赠送积分',\r\n trigger: 'blur',\r\n },\r\n ],\r\n effective_time: [\r\n {\r\n required: true,\r\n type: 'number',\r\n message: '请输入预售时效(单位 小时)',\r\n trigger: 'blur',\r\n },\r\n ],\r\n people: [\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 deposit: [\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 virtualPeople: [\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 copy: 0,\r\n };\r\n },\r\n computed: {\r\n ...mapState('media', ['isMobile']),\r\n labelWidth() {\r\n return this.isMobile ? undefined : '155px';\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) {\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 getEditorContent(data) {\r\n this.formValidate.description = 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, 6)\r\n .then((res) => {\r\n let data = res.data.info;\r\n that.specsData = data.attrs;\r\n that.specsData.forEach(function (item, index) {\r\n that.$set(that.specsData[index], 'id', index);\r\n });\r\n that.formValidate.items = data.items;\r\n that.columns = data.header;\r\n })\r\n .catch((res) => {\r\n that.$message.error(res.msg);\r\n });\r\n },\r\n\r\n // 多选\r\n changeCheckbox(selection) {\r\n this.formValidate.attrs = selection;\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(row) {\r\n this.modal_loading = false;\r\n this.modals = false;\r\n setTimeout(() => {\r\n this.formValidate = {\r\n images: row.slider_image,\r\n info: row.store_info,\r\n title: row.store_name,\r\n image: row.image,\r\n unit_name: row.unit_name,\r\n stock: row.stock,\r\n sales: row.sales,\r\n sort: row.sort,\r\n section_time: [],\r\n deliver_time: 3,\r\n // pay_time: [],\r\n // type: 1,\r\n num: 1,\r\n deposit: 1,\r\n description: '', // 不取商品中的\r\n id: 0,\r\n num: 1,\r\n status: 1,\r\n product_id: row.id,\r\n temp_id: row.temp_id,\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 onchangeTime(e) {\r\n this.formValidate.section_time = e;\r\n },\r\n // onchangePayTime(e) {\r\n // this.formValidate.pay_time = e;\r\n // },\r\n // 详情\r\n getInfo() {\r\n this.spinShow = true;\r\n presellInfoApi(this.$route.params.id)\r\n .then(async (res) => {\r\n let that = this;\r\n let info = res.data.info;\r\n let selection = {\r\n type: 'selection',\r\n width: 60,\r\n align: 'center',\r\n };\r\n this.formValidate = info;\r\n this.formValidate.virtualPeople = parseInt(\r\n this.formValidate.people - this.formValidate.people * (this.formValidate.virtual / 100),\r\n );\r\n this.$set(this.formValidate, 'items', info.attrs.items);\r\n this.columns = info.attrs.header;\r\n // this.columns.unshift(selection);\r\n this.specsData = info.attrs.value;\r\n that.specsData.forEach(function (item, index) {\r\n that.$set(that.specsData[index], 'id', index);\r\n });\r\n let data = info.attrs;\r\n let attr = [];\r\n for (let index in info.attrs.value) {\r\n if (info.attrs.value[index]._checked) {\r\n attr.push(info.attrs.value[index]);\r\n }\r\n }\r\n that.formValidate.attrs = attr;\r\n this.spinShow = false;\r\n })\r\n .catch((res) => {\r\n this.spinShow = false;\r\n this.$message.error(res);\r\n });\r\n },\r\n // 下一步\r\n next(name) {\r\n let that = this;\r\n if (this.current === 2) {\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 = Number(this.$route.params.id) || 0;\r\n this.submitOpen = true;\r\n this.formValidate.virtual = parseInt(\r\n ((this.formValidate.people - this.formValidate.virtualPeople) / this.formValidate.people) * 100,\r\n );\r\n presellCreatApi(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/presell/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 (that.formValidate.people < 2) {\r\n return that.$message.error('预售人数必须大于2');\r\n }\r\n if (that.formValidate.num < 0) {\r\n return that.$message.error('购买数量限制必须大于0');\r\n }\r\n if (!that.formValidate.attrs) {\r\n return that.$message.error('请选择属性规格');\r\n } else {\r\n for (let index in that.formValidate.attrs) {\r\n if (that.formValidate.attrs[index].quota <= 0) {\r\n return that.$message.error('预售限量必须大于0');\r\n }\r\n if (this.formValidate.attrs[index].quota > this.formValidate.attrs[index]['stock']) {\r\n return this.$message.error('预售限量不能超过规格库存');\r\n }\r\n }\r\n }\r\n this.current += 1;\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 } 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 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 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.getList();\r\n this.$refs.goodslist.goodsCategory();\r\n });\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};\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.grey {\r\n color: #999;\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</style>\r\n"]}]}