| | |
| | | <FormItem label="商品价格" prop="price"> |
| | | <Input v-model="baseInfoForm.price" clearable placeholder="商品价格" style="width: 260px" type="text"/> |
| | | </FormItem> |
| | | |
| | | <FormItem label="抽成比例" prop="commission"> |
| | | <!-- <Input v-model="baseInfoForm.commission" max="100" min="0" clearable placeholder="抽成比例" style="width: 260px" type="number"/>--> |
| | | <InputNumber v-model="baseInfoForm.commission" :formatter="value => `${value}%`" |
| | | :parser="value => value.replace('%', '')" :max="100" :min="0" clearable |
| | | :active-change="false" |
| | | placeholder="抽成比例" style="width: 260px" type="number"/> |
| | | </FormItem> |
| | | |
| | | <FormItem label="商品卖点" prop="sellingPoint"> |
| | | <Input v-model="baseInfoForm.sellingPoint" :rows="4" style="width: 260px" type="textarea"/> |
| | | </FormItem> |
| | | <FormItem label="商品品牌" prop="brandId"> |
| | | <Select v-model="baseInfoForm.brandId" filterable style="width: 200px"> |
| | | <Option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id"></Option> |
| | | </Select> |
| | | <Button class="refresh-icon" icon="md-refresh" shape="circle" type="text" |
| | | @click="refresh('brand')"></Button> |
| | | </FormItem> |
| | | <!-- <FormItem label="商品品牌" prop="brandId">--> |
| | | <!-- <Select v-model="baseInfoForm.brandId" filterable style="width: 200px">--> |
| | | <!-- <Option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id"></Option>--> |
| | | <!-- </Select>--> |
| | | <!-- <Button class="refresh-icon" icon="md-refresh" shape="circle" type="text"--> |
| | | <!-- @click="refresh('brand')"></Button>--> |
| | | <!-- </FormItem>--> |
| | | </div> |
| | | <h4>商品交易信息</h4> |
| | | <div class="form-item-view"> |
| | |
| | | <RadioGroup v-if="baseInfoForm.goodsType != 'VIRTUAL_GOODS'" v-model="baseInfoForm.salesModel" |
| | | button-style="solid" type="button" @on-change="renderTableData(skuTableData)"> |
| | | <Radio label="RETAIL" title="零售型">零售型</Radio> |
| | | <Radio label="WHOLESALE" title="批发型">批发型</Radio> |
| | | <!-- <Radio label="WHOLESALE" title="批发型">批发型</Radio>--> |
| | | <Radio label="PRESALE" title="预售">预售</Radio> |
| | | </RadioGroup> |
| | | <RadioGroup v-else v-model="baseInfoForm.salesModel" button-style="solid" type="button"> |
| | | <Radio label="RETAIL" title="零售型"> |
| | | <span>虚拟型</span> |
| | | </Radio> |
| | | </RadioGroup> |
| | | </FormItem> |
| | | <FormItem v-if="baseInfoForm.salesModel == 'PRESALE'"> |
| | | <div> |
| | | 预售时间: |
| | | <DatePicker type="daterange" v-model="baseInfoForm.preSaleTime" |
| | | format="yyyy-MM-dd" placement="bottom-end" placeholder="请选择预售时间" style="width: 200px" |
| | | @on-change="choosePreTime"></DatePicker> |
| | | </div> |
| | | </FormItem> |
| | | <FormItem v-if="baseInfoForm.goodsType == 'VIRTUAL_GOODS'" class="form-item-view-el" label="商品类型"> |
| | | <Select |
| | | v-model="baseInfoForm.virtualGoodsType" |
| | | clearable |
| | | style="width: 160px" |
| | | @on-clear="handleGoodsType" |
| | | @on-change="handleGoodsType" |
| | | > |
| | | <Option value="COUPON">优惠卷</option> |
| | | </select> |
| | | </FormItem> |
| | | <FormItem v-if="baseInfoForm.salesModel == 'WHOLESALE'" class="form-item-view-el" label="销售规则" |
| | | prop="wholesaleRule"> |
| | |
| | | </FormItem> |
| | | </div> |
| | | <h4>商品规格及图片</h4> |
| | | |
| | | <div class="form-item-view"> |
| | | <FormItem class="form-item-view-el required" label="主图" prop="goodsGalleryFiles" v-if=" baseInfoForm.goodsVideo ==null || baseInfoForm.goodsVideo ===''"> |
| | | <FormItem class="form-item-view-el required" label="主图" prop="goodsGalleryFiles" > |
| | | <div style="display: flex; flex-wrap: wrap;"> |
| | | <vuedraggable :animation="200" :list="showListImages"> |
| | | <div v-for="(item, __index) in showListImages" :key="__index" |
| | |
| | | <img v-if="goodsPictureVisible" :src="previewGoodsPicture" style="width: 100%"/> |
| | | </Modal> |
| | | </FormItem> |
| | | |
| | | |
| | | |
| | | <FormItem> |
| | | |
| | | <!-- <div class="demo-upload-list" v-for="(item,index) in showListImages">--> |
| | |
| | | <!-- </div>--> |
| | | <div style="color: grey" v-if="!baseInfoForm.goodsVideo">主图仅支持png,jpg,jpeg格式,宽高至少600*600px,大小2M内</div> |
| | | </FormItem> |
| | | <FormItem class="form-item-view-el" label="视频" prop="goodsVideo" v-if="!(baseInfoForm.goodsGalleryFiles !=null &&baseInfoForm.goodsGalleryFiles.length>0)"> |
| | | <FormItem class="form-item-view-el" label="视频" prop="goodsVideo" > |
| | | <div class="goods-video"> |
| | | <div v-if="baseInfoForm.goodsVideo"> |
| | | <div> |
| | | <video :src="baseInfoForm.showGoodsVideo" class="video" controls style="max-width: 300px;"/> |
| | | <video :src="baseInfoForm.showGoodsVideo" class="video" controls style="max-width: 300px;max-height: 400px"/> |
| | | </div> |
| | | </div> |
| | | <Upload ref="upload" action="-" :format="['avi', 'wmv', 'mpeg', 'mp4', 'mov']" |
| | |
| | | </template> |
| | | </div> |
| | | </vuedraggable> |
| | | <!-- todo 3--> |
| | | <Upload ref="uploadSku" action="-" |
| | | <!-- todo 3--> |
| | | <Upload ref="uploadSku" :action="uploadFileUrl" |
| | | v-if="val.images < 1" |
| | | :before-upload="handleBeforeUpload" |
| | | :format="['jpg', 'jpeg', 'png', 'webp']" |
| | | :max-size="2048" |
| | | :headers="{ ...accessToken }" |
| | | :on-error="() => { $Spin.hide(); }" |
| | | :on-exceeded-size="handleMaxSize" |
| | | :on-format-error="handleFormatError" |
| | |
| | | overflow-x: hidden; |
| | | } |
| | | "> |
| | | <template slot="sn" slot-scope="{ row }"> |
| | | <Input v-model="row.sn" clearable placeholder="请输入货号" |
| | | @on-change="updateSkuTable(row, 'sn')"/> |
| | | <template slot="sn" slot-scope="{ row, index }"> |
| | | <Input v-model="row.sn" placeholder="请输入货号" disabled |
| | | @on-change="updateSkuTable(row, 'sn')" /> |
| | | </template> |
| | | <div v-if="baseInfoForm.goodsType !== 'VIRTUAL_GOODS'" slot="weight" slot-scope="{ row }"> |
| | | <Input v-model="row.weight" clearable placeholder="请输入重量" |
| | |
| | | baseInfoForm.goodsUnit || "" |
| | | }}</span> |
| | | </Input> |
| | | </template> |
| | | <template slot="COUPON" slot-scope="{ row }"> |
| | | <div @click="showCouponListModal(row)"> |
| | | <Input v-model="row.couponName" clearable placeholder="选择优惠卷" |
| | | > |
| | | </Input> |
| | | </div> |
| | | |
| | | </template> |
| | | <template slot="cost" slot-scope="{ row }"> |
| | | <Input v-model="row.cost" clearable placeholder="请输入成本价" |
| | |
| | | </div> |
| | | <FormItem class="form-item-view-el" label="PC商品描述" prop="intro" style="width: 100%"> |
| | | <editor |
| | | :show-upload="true" |
| | | ref="editor" |
| | | v-model="baseInfoForm.intro" |
| | | height="800px" |
| | |
| | | |
| | | <FormItem class="form-item-view-el" label="移动端描述" prop="skuList" style="width: 100%"> |
| | | <editor |
| | | :show-upload="true" |
| | | ref="introEditor" |
| | | v-model="baseInfoForm.mobileIntro" |
| | | height="800px" |
| | |
| | | <Button type="primary" @click="saveToDraft">保存为模版</Button> |
| | | </ButtonGroup> |
| | | </div> |
| | | |
| | | <Modal v-model="showCouponModal" title="优惠卷列表" width="1200px"> |
| | | <div style="display: flex; align-items: center; margin-bottom: 20px;"> |
| | | <!-- 模拟表单label样式 --> |
| | | <label style="width: 100px; text-align: right; padding-right: 12px; font-size:14px;"> |
| | | 已选择优惠卷: |
| | | </label> |
| | | <Input |
| | | :disabled="true" |
| | | style="width: 30%;" |
| | | v-model="showCoupon" |
| | | placeholder="请点击选择表格内优惠劵" |
| | | ></Input> |
| | | </div> |
| | | <Table |
| | | :loading="couponLoading" |
| | | border |
| | | :columns="couponColumns" |
| | | :data="couponData" |
| | | ref="table" |
| | | @on-current-change="handleRowClick" |
| | | highlight-row |
| | | ></Table> |
| | | <Row type="flex" justify="center" class="mt_10"> |
| | | <Page |
| | | :current="couponSearchForm.pageNumber" |
| | | :total="couponTotal" |
| | | :page-size="couponSearchForm.pageSize" |
| | | @on-change="couponChangePage" |
| | | @on-page-size-change="couponChangePageSize" |
| | | :page-size-opts="[10, 20, 50]" |
| | | size="small" |
| | | show-total |
| | | show-elevator |
| | | show-sizer |
| | | ></Page> |
| | | </Row> |
| | | </Modal> |
| | | <Modal v-model="showGoodsVideo" title="查看视频"> |
| | | <div id="dplayer"> |
| | | |
| | |
| | | <!--</Modal>--> |
| | | <!-- todo web--> |
| | | <Modal v-model="picModelFlag" width="1200px"> |
| | | <!-- <ossManage ref="ossManage" :isComponent="true" :initialize="picModelFlag" @callback="callbackSelected" @selected="(list)=>{ selectedImage = list}"/>--> |
| | | <!-- <ossManage ref="ossManRage" :isComponent="true" :initialize="picModelFlag" @callback="callbackSelected" @selected="(list)=>{ selectedImage = list}"/>--> |
| | | <div class="demo-upload-list" v-for="(item,index) in showListImages"> |
| | | <template> |
| | | <img :src="item"> |
| | |
| | | import COS from 'cos-js-sdk-v5'; |
| | | import {getFileKey} from "@/utils/file.js"; |
| | | import {getFilePreview, getSts} from "@/api/file"; |
| | | |
| | | import {formatDate} from "@/utils/filters"; |
| | | import {getShopCouponList} from '@/api/promotion' |
| | | import {promotionsScopeTypeRender} from "../../../utils/promotions"; |
| | | |
| | | export default { |
| | | name: "goodsOperationSec", |
| | |
| | | }, 1000); |
| | | }; |
| | | return { |
| | | currentRow:null, |
| | | showCouponModal:false, |
| | | showCoupon:'', |
| | | |
| | | couponSearchForm: { |
| | | // 搜索框初始化对象 |
| | | pageNumber: 1, // 当前页数 |
| | | pageSize: 10, // 页面大小 |
| | | sort: "startTime", // 默认排序字段 |
| | | order: "desc", // 默认排序方式 |
| | | promotionStatus:"START", |
| | | }, |
| | | selectedRowId:'', |
| | | couponTotal:0, |
| | | couponData:[], |
| | | couponLoading:false, |
| | | couponColumns: [ |
| | | // 表头 |
| | | { |
| | | title: "优惠券名称", |
| | | key: "couponName", |
| | | width: 180, |
| | | tooltip: true, |
| | | }, |
| | | { |
| | | title: "面额/折扣", |
| | | key: "price", |
| | | width: 150, |
| | | render: (h, params) => { |
| | | if (params.row.price) { |
| | | return h("priceColorScheme", {props:{value:params.row.price,color:this.$mainColor}} ); |
| | | |
| | | } else { |
| | | return h("div", params.row.couponDiscount + "折"); |
| | | } |
| | | }, |
| | | }, |
| | | |
| | | { |
| | | title: "获取方式", |
| | | width: 120, |
| | | key: "getType", |
| | | render: (h, params) => { |
| | | if (params.row.getType === "FREE") { |
| | | return h("Tag", { props: { color: "red" } }, "免费获取"); |
| | | } else if (params.row.getType === "ACTIVITY") { |
| | | return h("Tag", { props: { color: "volcano" } }, "活动获取"); |
| | | } else if (params.row.getType === "INSIDE") { |
| | | return h("Tag", { props: { color: "lime" } }, "内购"); |
| | | } else if (params.row.getType === "IGAME") { |
| | | return h("Tag", { props: { color: "lime" } }, "游戏人生"); |
| | | } else { |
| | | return h("Tag", { props: { color: "purple" } }, "未知"); |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | title: "优惠券类型", |
| | | key: "couponType", |
| | | width: 150, |
| | | render: (h, params) => { |
| | | let text = ""; |
| | | if (params.row.couponType === "DISCOUNT") { |
| | | return h("Tag", { props: { color: "blue" } }, "打折"); |
| | | } else if (params.row.couponType === "PRICE") { |
| | | return h("Tag", { props: { color: "geekblue" } }, "减免现金"); |
| | | } else { |
| | | return h("Tag", { props: { color: "purple" } }, "未知"); |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | title: "品类描述", |
| | | key: "scopeType", |
| | | width: 120, |
| | | render: (h, params) => { |
| | | return promotionsScopeTypeRender(h, params); |
| | | }, |
| | | }, |
| | | { |
| | | title: "活动时间", |
| | | render: (h, params) => { |
| | | if ( |
| | | params?.row?.getType === "ACTIVITY" && |
| | | params?.row?.rangeDayType === "DYNAMICTIME" |
| | | ) { |
| | | return h("div", "长期有效"); |
| | | } else if (params?.row?.startTime && params?.row?.endTime) { |
| | | return h("div", { |
| | | domProps: { |
| | | innerHTML: |
| | | params.row.startTime + "<br/>" + params.row.endTime, |
| | | }, |
| | | }); |
| | | } |
| | | }, |
| | | } |
| | | ], |
| | | |
| | | showListImages: [], |
| | | regular, |
| | | openImage: false, |
| | |
| | | ], |
| | | /** 发布商品基本参数 */ |
| | | baseInfoForm: { |
| | | virtualGoodsType:"", |
| | | salesModel: "RETAIL", |
| | | /** 商品相册列表 */ |
| | | goodsGalleryFiles: [], |
| | |
| | | categoryName: [], |
| | | goodsVideo: "", |
| | | showGoodsVideo: "", |
| | | // 预售时间 |
| | | preSaleTime:[], |
| | | preSaleBeginDate:'', |
| | | preSaleEndDate:'', |
| | | commission:5, |
| | | |
| | | }, |
| | | /** 表格头 */ |
| | | skuTableColumn: [], |
| | |
| | | "price", |
| | | "weight", |
| | | "quantity", |
| | | "couponName", |
| | | "couponId", |
| | | // "alertQuantity", |
| | | "specId", |
| | | "specValueId", |
| | |
| | | selectedFormBtnName: "", // 点击图片绑定form |
| | | selectedImage: [], |
| | | lastEditSkuValue: '', |
| | | |
| | | }; |
| | | }, |
| | | watch: { |
| | |
| | | if (val) { |
| | | this.initVideo(); |
| | | } |
| | | }, |
| | | showListImages(newValue){ |
| | | this.baseInfoForm.goodsGalleryFiles = newValue.map(item => { |
| | | return item.split('/').slice(-2).join('/') |
| | | }) |
| | | } |
| | | }, |
| | | methods: { |
| | | showCouponListModal(row){ |
| | | this.showCouponModal = true; |
| | | this.showCoupon =''; |
| | | this.getCouponDataList() |
| | | this.currentRow = row; |
| | | }, |
| | | handleGoodsType(){ |
| | | //重新渲染 |
| | | this.renderTableData(this.skuTableData); |
| | | }, |
| | | getCouponDataList() { |
| | | // 获取数据 |
| | | this.couponLoading = true; |
| | | getShopCouponList(this.couponSearchForm).then((res) => { |
| | | this.couponLoading = false; |
| | | if (res.success) { |
| | | this.couponData = res.result.records; |
| | | this.couponTotal = res.result.total; |
| | | } |
| | | }); |
| | | this.couponLoading = false; |
| | | }, |
| | | // 处理行点击事件 |
| | | handleRowClick(currentRow ,oldCurrentRow){ |
| | | this.showCoupon = currentRow.couponName; |
| | | this.$set(this.currentRow, 'couponName', currentRow.couponName); |
| | | this.currentRow.couponId = currentRow.id |
| | | console.log(this.currentRow) |
| | | this.updateSkuTable(this.currentRow,"couponName") |
| | | this.updateSkuTable(this.currentRow,"couponId") |
| | | console.log(this.skuTableData) |
| | | }, |
| | | couponChangePage(v) { |
| | | // 改变页码 |
| | | this.couponSearchForm.pageNumber = v; |
| | | this.getCouponDataList(); |
| | | }, |
| | | couponChangePageSize(v) { |
| | | // 改变页数 |
| | | this.couponSearchForm.pageNumber = 1; |
| | | this.couponSearchForm.pageSize = v; |
| | | this.getCouponDataList(); |
| | | }, |
| | | |
| | | // 格式化显示值 |
| | | formatter(date) { |
| | | return this.formatDate(date, 'yyyy-MM-dd'); |
| | | }, |
| | | |
| | | // 日期格式化工具 |
| | | formatDate(date, format) { |
| | | const year = date.getFullYear(); |
| | | const month = (date.getMonth() + 1).toString().padStart(2, '0'); |
| | | const day = date.getDate().toString().padStart(2, '0'); |
| | | |
| | | return format |
| | | .replace('yyyy', year) |
| | | .replace('MM', month) |
| | | .replace('dd', day); |
| | | }, |
| | | choosePreTime(e){ |
| | | if (this.baseInfoForm.preSaleTime){ |
| | | const[begin,end] = this.baseInfoForm.preSaleTime; |
| | | this.baseInfoForm.preSaleBeginDate = this.formatDate(begin,'yyyy-MM-dd'); |
| | | this.baseInfoForm.preSaleEndDate = this.formatDate(end,'yyyy-MM-dd'); |
| | | console.log('------------------>选择时间',this.baseInfoForm.preSaleBeginDate,this.baseInfoForm.preSaleEndDate) |
| | | |
| | | } |
| | | console.log('时间选择------------------》',e) |
| | | }, |
| | | // 选择图片modal |
| | | handleCLickImg(val, index) { |
| | | console.log('测试输入的值----------------》', val) |
| | |
| | | }, |
| | | // ship大小不正确 |
| | | handleVideoMaxSize(file) { |
| | | this.$Notice.warning({ |
| | | title: "超过文件大小限制", |
| | | desc: "视频大小不能超过10MB", |
| | | }); |
| | | // this.$Notice.warning({ |
| | | // title: "超过文件大小限制", |
| | | // desc: "视频大小不能超过10MB", |
| | | // }); |
| | | }, |
| | | onAddSku(index) { |
| | | if (!this.newSkuValues[index]) { |
| | |
| | | } |
| | | }, |
| | | // sku图片上传前钩子 |
| | | // async handleBeforeUpload(file) { |
| | | // const check = |
| | | // this.selectedSku.images !== undefined && |
| | | // this.selectedSku.images.length > 5; |
| | | // if (check) { |
| | | // this.$Notice.warning({title: "图片数量不能大于五张"}); |
| | | // return false; |
| | | // } |
| | | // }, |
| | | // sku图片上传前钩子 |
| | | async handleBeforeUpload(file) { |
| | | const check = |
| | | this.selectedSku.images !== undefined && |
| | |
| | | response.result.recommend |
| | | ? (response.result.recommend = 1) |
| | | : (response.result.recommend = 0); |
| | | response.result.preSaleTime = [response.result.preSaleBeginDate, response.result.preSaleEndDate]; |
| | | this.baseInfoForm = {...this.baseInfoForm, ...response.result}; |
| | | this.baseInfoForm.release = 1; //即使是被放入仓库,修改的时候也会显示会立即发布 |
| | | this.categoryId = response.result.categoryPath.split(",")[2]; |
| | |
| | | this.renderGoodsDetailSku(response.result.skuList); |
| | | |
| | | /** 查询品牌列表 */ |
| | | this.getGoodsBrandList(); |
| | | //todo 移除品牌概念 |
| | | // this.getGoodsBrandList(); |
| | | |
| | | /** 查询店铺商品分类 */ |
| | | this.GET_ShopGoodsLabel(); |
| | |
| | | this.firstData.goodsType && |
| | | (this.baseInfoForm.goodsType = this.firstData.goodsType); |
| | | /** 查询商品参数 */ |
| | | this.GET_GoodsParams(); |
| | | // this.GET_GoodsParams(); |
| | | }, |
| | | // 渲染sku数据 |
| | | renderGoodsDetailSku(skuList) { |
| | |
| | | // cost: e.cost, |
| | | quantity: e.quantity, |
| | | // alertQuantity: e.alertQuantity, |
| | | couponName:e.couponName, |
| | | couponId:e.couponId, |
| | | weight: e.weight, |
| | | }; |
| | | if (e.goodsGalleryList && e.goodsGalleryList.length >= 1) { |
| | |
| | | this.$Message.error("已存在相同规格项!"); |
| | | return; |
| | | } |
| | | if (this.zz(0, val) > 20) { |
| | | this.$Message.error("规格值最多十个字符长度!"); |
| | | if (this.zz(0, val) > 30) { |
| | | this.$Message.error("规格值最多十五个字符长度!"); |
| | | // val = val.toString().slice(0, 4); |
| | | this.skuInfo[index].name = this.countCharacters(val, 10); |
| | | this.$forceUpdate();// 调用该方法会触发组件的重新渲染 |
| | |
| | | if (val.value === '') { |
| | | return; |
| | | } |
| | | if (this.zz(0, val.value) > 20) { |
| | | this.$Message.error("规格值最多十个字符长度!"); |
| | | if (this.zz(0, val.value) > 30) { |
| | | this.$Message.error("规格值最多十五个字符长度!"); |
| | | // val.value = val.value.toString().slice(0, 4); |
| | | this.skuInfo[$index].spec_values[index].value = this.countCharacters(val.value, 10); |
| | | this.$forceUpdate();// 调用该方法会触发组件的重新渲染 |
| | |
| | | // find.cost && (find.cost = ""); |
| | | find.quantity && (find.quantity = ""); |
| | | // find.alertQuantity && (find.alertQuantity = ""); |
| | | find.couponName && (find.couponName = ""); |
| | | find.couponId && (find.couponId = ""); |
| | | find.weight && (find.weight = ""); |
| | | |
| | | this.skuTableData.splice(this.skuTableData.length, 0, find); |
| | |
| | | find.sn && (find.sn = ""); |
| | | // find.cost && (find.cost = ""); |
| | | find.quantity && (find.quantity = ""); |
| | | find.couponName && (find.couponName = ""); |
| | | find.couponId && (find.couponId = ""); |
| | | // find.alertQuantity && (find.alertQuantity = ""); |
| | | find.weight && (find.weight = ""); |
| | | |
| | |
| | | this.baseInfoForm.regeneratorSkuFlag = true; |
| | | this.newSkuValues[$index] = ""; |
| | | } |
| | | this.renderTableData(this.skuTableData); |
| | | }, |
| | | handleClearSku() { |
| | | this.skuInfo = []; |
| | |
| | | * 渲染table所需要的column 和 data |
| | | */ |
| | | renderTableData(skus) { |
| | | console.log('-------------->销售类型', skus) |
| | | this.skuTableColumn = []; |
| | | let pushData = []; |
| | | // 渲染头部 |
| | |
| | | } |
| | | ); |
| | | } |
| | | |
| | | // 预售模式 |
| | | // if (this.baseInfoForm.salesModel !== "PRESALE") { |
| | | // pushData.push( |
| | | // { |
| | | // title: "预售时间", |
| | | // slot: "price", |
| | | // } |
| | | // ); |
| | | // } |
| | | if (this.baseInfoForm.salesModel === "WHOLESALE" && this.wholesaleData) { |
| | | this.wholesaleData.forEach((item, index) => { |
| | | pushData.push({ |
| | |
| | | title: "重量", |
| | | slot: "weight", |
| | | }); |
| | | } |
| | | if (this.baseInfoForm.goodsType ==="VIRTUAL_GOODS" && this.baseInfoForm.virtualGoodsType==="COUPON"){ |
| | | pushData.push( |
| | | { |
| | | title:"优惠卷", |
| | | slot:"COUPON" |
| | | } |
| | | ) |
| | | } |
| | | pushData.push( |
| | | { |
| | |
| | | * array spec数据 |
| | | */ |
| | | specIterator(result, spec, skus) { |
| | | |
| | | let table = result; |
| | | if (spec.length > 0) { |
| | | //清除当前循环的分组 |
| | |
| | | id: skus[index].id, |
| | | sn: skus[index].sn, |
| | | quantity: skus[index].quantity, |
| | | coupon: skus[index].coupon, |
| | | cost: skus[index].cost, |
| | | price: skus[index].price, |
| | | // [spec[0].name]: skus[index][spec[0].name] ? skus[index][spec[0].name] : specItem.value, |
| | |
| | | } else { |
| | | this.skuIndex++; |
| | | } |
| | | |
| | | table.forEach((item,index) =>{ |
| | | console.log("元素:" + item +"index:" + (index +1)) |
| | | item.sn = index + 1; |
| | | }) |
| | | return table; |
| | | }, |
| | | /** 根据分类id获取系统设置规格信息*/ |
| | |
| | | return; |
| | | } |
| | | } |
| | | |
| | | // else if (item === "alertQuantity") { |
| | | // if ( |
| | | // !/^[0-9]\d*$/.test(row[item]) || |
| | |
| | | } |
| | | this.baseInfoForm.goodsId = this.goodsId; |
| | | let submit = JSON.parse(JSON.stringify(this.baseInfoForm)); |
| | | console.log('----------------->提交',submit); |
| | | // if ( |
| | | // (submit.goodsGalleryFiles && |
| | | // submit.goodsGalleryFiles.length <= 0) && !submit.goodsVideo |
| | | // ) { |
| | | |
| | | if ( |
| | | submit.goodsGalleryFiles && |
| | | submit.goodsGalleryFiles.length <= 0 |
| | | ) { |
| | | this.submitLoading = false; |
| | | this.$Message.error("请上传商品图片"); |
| | | return; |
| | | } |
| | | // if (!submit.goodsVideo){ |
| | | // this.submitLoading = false; |
| | | // this.$Message.error("请上传商品图片或者视频"); |
| | | // this.$Message.error("请上传商品视频"); |
| | | // return; |
| | | // } |
| | | if (submit.templateId === "") submit.templateId = 0; |
| | |
| | | cost: 1, |
| | | price: sku.price, |
| | | quantity: sku.quantity, |
| | | couponName:sku.couponName, |
| | | couponId:sku.couponId, |
| | | // alertQuantity: sku.alertQuantity, |
| | | sn: sku.sn, |
| | | images: [], |
| | | }; |
| | | if(this.baseInfoForm.goodsType === "VIRTUAL_GOODS" && |
| | | this.baseInfoForm.virtualGoodsType !== '' && |
| | | this.baseInfoForm.virtualGoodsType !== undefined && |
| | | this.baseInfoForm.virtualGoodsType !== null){ |
| | | if (sku.couponId === null || sku.couponId === undefined){ |
| | | this.$Message.error("请选择优惠劵") |
| | | return; |
| | | } |
| | | if (sku.couponName === null || sku.couponName === undefined){ |
| | | this.$Message.error("请选择优惠劵") |
| | | return; |
| | | } |
| | | } |
| | | if (this.openImage) { |
| | | this.skuInfo[0].spec_values.forEach(item => { |
| | | if (!item.images || item.images.length === 0) { |
| | |
| | | } |
| | | submit.skuList.push(skuCopy); |
| | | }); |
| | | console.log('----------------->提交', submit); |
| | | if (containEmptyImage) { |
| | | this.$Message.error("开启规格图片,所有规格图片不能为空!"); |
| | | this.submitLoading = false; |
| | |
| | | } |
| | | }); |
| | | } else { |
| | | console.log(submit) |
| | | API_GOODS.createGoods(submit).then((res) => { |
| | | if (res.success) { |
| | | this.submitLoading = false; |
| | |
| | | this.$Message.error("刷新失败,请重试"); |
| | | } |
| | | }).catch(reason => { |
| | | console.log("获取模板失败",reason) |
| | | console.log("获取模板失败", reason) |
| | | }); |
| | | }, |
| | | removeVideo(){ |
| | | removeVideo() { |
| | | this.baseInfoForm.showGoodsVideo = null; |
| | | this.baseInfoForm.goodsVideo = null; |
| | | }, |
| | | // todo 文件上传 |
| | | async upLoadImg(file) { |
| | | console.log(file,this.count++); |
| | | if (this.listImages.length >= 5) { |
| | | this.$Message.error("图片上传不能超过5个"); |
| | | console.log(file, this.count++); |
| | | if (this.listImages.length >= 10) { |
| | | this.$Message.error("图片上传不能超过10个"); |
| | | return; |
| | | } |
| | | try { |
| | |
| | | this.baseInfoForm.goodsType = this.firstData.goodsType; |
| | | |
| | | |
| | | /** 获取该商城分类下 商品参数信息 */ |
| | | this.GET_GoodsParams(); |
| | | /** 查询品牌列表 */ |
| | | this.getGoodsBrandList(); |
| | | /** 查询分类绑定的规格信息 */ |
| | | this.Get_SkuInfoByCategory(this.categoryId); |
| | | if (this.categoryId != null && this.categoryId !== '') { |
| | | /** 获取该商城分类下 商品参数信息 */ |
| | | this.GET_GoodsParams(); |
| | | console.log('分类id------------------>', this.categoryId); |
| | | /** 查询分类绑定的规格信息 */ |
| | | this.Get_SkuInfoByCategory(this.categoryId); |
| | | /** 查询品牌列表 */ |
| | | this.getGoodsBrandList(); |
| | | } |
| | | // 获取商品单位 |
| | | this.GET_GoodsUnit(); |
| | | // 获取当前店铺分类 |