From 616458206a9f9f146554188ec55b9a35cc1f9a81 Mon Sep 17 00:00:00 2001 From: peng <peng.com> Date: 星期三, 10 九月 2025 19:12:58 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev --- seller/src/views/goods/goods-seller/goodsOperationSec.vue | 181 ++++++++++++++++++++++++++++++++++---------- 1 files changed, 138 insertions(+), 43 deletions(-) diff --git a/seller/src/views/goods/goods-seller/goodsOperationSec.vue b/seller/src/views/goods/goods-seller/goodsOperationSec.vue index ce33407..0b8e8b0 100644 --- a/seller/src/views/goods/goods-seller/goodsOperationSec.vue +++ b/seller/src/views/goods/goods-seller/goodsOperationSec.vue @@ -23,16 +23,25 @@ <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"> @@ -48,13 +57,22 @@ <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.salesModel == 'WHOLESALE'" class="form-item-view-el" label="閿�鍞鍒�" prop="wholesaleRule"> @@ -101,7 +119,7 @@ </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" @@ -151,11 +169,11 @@ <!-- </div>--> <div style="color: grey" v-if="!baseInfoForm.goodsVideo">涓诲浘浠呮敮鎸乸ng锛宩pg锛宩peg鏍煎紡锛屽楂樿嚦灏�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']" @@ -252,12 +270,13 @@ </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" @@ -309,9 +328,9 @@ 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="璇疯緭鍏ラ噸閲�" @@ -383,6 +402,7 @@ </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" @@ -396,6 +416,7 @@ <FormItem class="form-item-view-el" label="绉诲姩绔弿杩�" prop="skuList" style="width: 100%"> <editor + :show-upload="true" ref="introEditor" v-model="baseInfoForm.mobileIntro" height="800px" @@ -496,7 +517,7 @@ <!--</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"> @@ -539,6 +560,7 @@ import COS from 'cos-js-sdk-v5'; import {getFileKey} from "@/utils/file.js"; import {getFilePreview, getSts} from "@/api/file"; +import {formatDate} from "@/utils/filters"; export default { @@ -675,6 +697,11 @@ categoryName: [], goodsVideo: "", showGoodsVideo: "", + // 棰勫敭鏃堕棿 + preSaleTime:[], + preSaleBeginDate:'', + preSaleEndDate:'', + commission:5 }, /** 琛ㄦ牸澶� */ skuTableColumn: [], @@ -748,9 +775,40 @@ if (val) { this.initVideo(); } + }, + showListImages(newValue){ + this.baseInfoForm.goodsGalleryFiles = newValue.map(item => { + return item.split('/').slice(-2).join('/') + }) } }, methods: { + // 鏍煎紡鍖栨樉绀哄�� + 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) @@ -776,10 +834,10 @@ }, // ship澶у皬涓嶆纭� handleVideoMaxSize(file) { - this.$Notice.warning({ - title: "瓒呰繃鏂囦欢澶у皬闄愬埗", - desc: "瑙嗛澶у皬涓嶈兘瓒呰繃10MB", - }); + // this.$Notice.warning({ + // title: "瓒呰繃鏂囦欢澶у皬闄愬埗", + // desc: "瑙嗛澶у皬涓嶈兘瓒呰繃10MB", + // }); }, onAddSku(index) { if (!this.newSkuValues[index]) { @@ -1059,6 +1117,16 @@ } }, // 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 && @@ -1178,6 +1246,7 @@ 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]; @@ -1234,7 +1303,8 @@ this.renderGoodsDetailSku(response.result.skuList); /** 鏌ヨ鍝佺墝鍒楄〃 */ - this.getGoodsBrandList(); + //todo 绉婚櫎鍝佺墝姒傚康 + // this.getGoodsBrandList(); /** 鏌ヨ搴楅摵鍟嗗搧鍒嗙被 */ this.GET_ShopGoodsLabel(); @@ -1254,7 +1324,7 @@ this.firstData.goodsType && (this.baseInfoForm.goodsType = this.firstData.goodsType); /** 鏌ヨ鍟嗗搧鍙傛暟 */ - this.GET_GoodsParams(); + // this.GET_GoodsParams(); }, // 娓叉煋sku鏁版嵁 renderGoodsDetailSku(skuList) { @@ -1400,8 +1470,8 @@ 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();// 璋冪敤璇ユ柟娉曚細瑙﹀彂缁勪欢鐨勯噸鏂版覆鏌� @@ -1456,8 +1526,8 @@ 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();// 璋冪敤璇ユ柟娉曚細瑙﹀彂缁勪欢鐨勯噸鏂版覆鏌� @@ -1644,6 +1714,7 @@ this.baseInfoForm.regeneratorSkuFlag = true; this.newSkuValues[$index] = ""; } + this.renderTableData(this.skuTableData); }, handleClearSku() { this.skuInfo = []; @@ -1671,6 +1742,7 @@ * 娓叉煋table鎵�闇�瑕佺殑column 鍜� data */ renderTableData(skus) { + console.log('-------------->閿�鍞被鍨�', skus) this.skuTableColumn = []; let pushData = []; // 娓叉煋澶撮儴 @@ -1695,7 +1767,15 @@ } ); } - + // 棰勫敭妯″紡 + // if (this.baseInfoForm.salesModel !== "PRESALE") { + // pushData.push( + // { + // title: "棰勫敭鏃堕棿", + // slot: "price", + // } + // ); + // } if (this.baseInfoForm.salesModel === "WHOLESALE" && this.wholesaleData) { this.wholesaleData.forEach((item, index) => { pushData.push({ @@ -1751,6 +1831,7 @@ * array spec鏁版嵁 */ specIterator(result, spec, skus) { + let table = result; if (spec.length > 0) { //娓呴櫎褰撳墠寰幆鐨勫垎缁� @@ -1792,6 +1873,11 @@ } else { this.skuIndex++; } + + table.forEach((item,index) =>{ + console.log("鍏冪礌:" + item +"index:" + (index +1)) + item.sn = index + 1; + }) return table; }, /** 鏍规嵁鍒嗙被id鑾峰彇绯荤粺璁剧疆瑙勬牸淇℃伅*/ @@ -1849,6 +1935,7 @@ return; } } + // else if (item === "alertQuantity") { // if ( // !/^[0-9]\d*$/.test(row[item]) || @@ -1923,13 +2010,18 @@ } 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 - // ) { + console.log('----------------->鎻愪氦', submit); + 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; @@ -2096,16 +2188,16 @@ 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++); + console.log(file, this.count++); if (this.listImages.length >= 5) { this.$Message.error("鍥剧墖涓婁紶涓嶈兘瓒呰繃5涓�"); return; @@ -2224,12 +2316,15 @@ 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(); // 鑾峰彇褰撳墠搴楅摵鍒嗙被 -- Gitblit v1.8.0