|
|
@@ -29,6 +29,10 @@
|
|
|
</view>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
+ <tui-list-cell class="line-cell category-wrap" :hover="false">
|
|
|
+ <view class="tui-title">使用场景</view><view class="tui-input"><block v-for="item in useCaseData" :key="item.id"><button class="admin-button-com" :class="[form.useCaseIdList.includes(item.id) ? '' : 'default']" @click="toggleUseCase(item)">{{ item.useCaseName }}</button></block></view>
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
<tui-list-cell class="line-cell category-wrap" :hover="false">
|
|
|
<view class="tui-title required">分类</view>
|
|
|
<view class="tui-input">
|
|
|
@@ -43,8 +47,89 @@
|
|
|
<view class="tui-title required">名称</view>
|
|
|
<input v-model="form.name" placeholder-class="phcolor" class="tui-input" name="name" placeholder="请输入商品名称" maxlength="50" type="text" />
|
|
|
</tui-list-cell>
|
|
|
+ <view class="spec-switch-card">
|
|
|
+ <view class="spec-switch-left">
|
|
|
+ <view class="spec-switch-icon">▦</view>
|
|
|
+ <view>
|
|
|
+ <view class="spec-switch-title">启用多规格</view>
|
|
|
+ <view class="spec-switch-desc">开启后可设置商品多规格属性</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="spec-switch-right">
|
|
|
+ <switch :checked="form.specEnabled == 1" @change="toggleSpecs" color="#09C567" />
|
|
|
+ <text>{{ form.specEnabled == 1 ? '已开启' : '未开启' }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
|
|
|
- <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view v-if="form.specEnabled == 1" class="spec-wrap">
|
|
|
+ <view v-for="(spec,index) in form.specList" :key="index" class="spec-card">
|
|
|
+ <view class="spec-card-head">
|
|
|
+ <view class="spec-card-title">规格组名称{{ index + 1 }}</view>
|
|
|
+ <button v-if="form.specList.length > 1" class="spec-remove" @click.stop.prevent="removeSpec(index)">删除</button>
|
|
|
+ </view>
|
|
|
+ <tui-list-cell class="line-cell spec-line" :hover="false">
|
|
|
+ <view class="tui-title required">规格组名称{{ index + 1 }}</view>
|
|
|
+ <input :value="spec.specName" @input="setSpecField(index, 'specName', $event.detail.value)" placeholder-class="phcolor" class="tui-input" placeholder="请输入规格名称" maxlength="50" type="text" />
|
|
|
+ </tui-list-cell>
|
|
|
+ <view class="spec-image-wrap">
|
|
|
+ <view class="module-tit">
|
|
|
+ <span>图片</span>
|
|
|
+ <span class="app-color-3">(不传则使用主商品图片,最多5张)</span>
|
|
|
+ </view>
|
|
|
+ <view class="module-det">
|
|
|
+ <htz-image-upload :max="5" :compress="true" :value="spec.currentImgData || []" :headers="headers"
|
|
|
+ @input="setSpecField(index, 'currentImgData', $event)"
|
|
|
+ @uploadSuccess="specImgUploadSuccess($event, index)" @imgDelete="specImgDeleteFn($event, index)" :action="getLoginInfo.imgUploadApi">
|
|
|
+ </htz-image-upload>
|
|
|
+ </view>
|
|
|
+ <view v-if="spec.shopImg && spec.shopImg.length > 0" class="spec-cover-row">
|
|
|
+ <view class="spec-cover-title">封面</view>
|
|
|
+ <view class="spec-cover-btns">
|
|
|
+ <button class="admin-button-com" :class="[(spec.shortCover == item) ? '' : 'default']"
|
|
|
+ v-for="(item, imgIndex) in spec.shopImg" :key="imgIndex"
|
|
|
+ @click.stop.prevent="selSpecCoverFn(index, imgIndex)">第{{ imgIndex + 1 }}张</button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <tui-list-cell class="line-cell spec-line" :hover="false">
|
|
|
+ <view class="tui-title">价格类型</view>
|
|
|
+ <view class="btn-group">
|
|
|
+ <button class="admin-button-com middle" :class="[spec.priceType == 1 ? '' : 'default']" @click.stop.prevent="setSpecPriceType(index, '1')">有价格</button>
|
|
|
+ <button class="admin-button-com middle" :class="[spec.priceType == 0 ? '' : 'default']" @click.stop.prevent="setSpecPriceType(index, '0')">无价格</button>
|
|
|
+ </view>
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell v-if="spec.priceType == 1" class="line-cell spec-line" :hover="false">
|
|
|
+ <view class="tui-title required">价格</view>
|
|
|
+ <input :value="spec.price" @input="setSpecField(index, 'price', $event.detail.value)" placeholder-class="phcolor" class="tui-input" placeholder="请输入价格" maxlength="10" type="digit" />
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell class="line-cell spec-line" :hover="false">
|
|
|
+ <view class="tui-title">库存</view>
|
|
|
+ <view class="btn-group">
|
|
|
+ <button class="admin-button-com middle" :class="[spec.stockSet == 0 ? '' : 'default']" @click.stop.prevent="setSpecStockSet(index, '0')">管够</button>
|
|
|
+ <button class="admin-button-com middle" :class="[spec.stockSet == 1 ? '' : 'default']" @click.stop.prevent="setSpecStockSet(index, '1')">自定义</button>
|
|
|
+ </view>
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell v-if="spec.stockSet == 1" class="line-cell spec-line" :hover="false">
|
|
|
+ <view class="tui-title">库存</view>
|
|
|
+ <input :value="spec.stock" @input="setSpecField(index, 'stock', $event.detail.value)" placeholder-class="phcolor" class="tui-input" placeholder="请输入库存数量" maxlength="10" type="number" />
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell class="line-cell spec-line" :hover="false">
|
|
|
+ <view class="tui-title">用花支数</view>
|
|
|
+ <input :value="spec.flowerNum" @input="setSpecField(index, 'flowerNum', $event.detail.value)" placeholder-class="phcolor" class="tui-input" placeholder="用于判断花束大小" maxlength="5" type="number" />
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell class="line-cell spec-line" :hover="false">
|
|
|
+ <view class="tui-title">重量</view>
|
|
|
+ <input :value="spec.weight" @input="setSpecField(index, 'weight', $event.detail.value)" placeholder-class="phcolor" class="tui-input" placeholder="公斤,可输入小数" maxlength="10" type="digit" />
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell class="line-cell spec-line" :hover="false">
|
|
|
+ <view class="tui-title">已售数量</view>
|
|
|
+ <input :value="spec.sold" @input="setSpecField(index, 'sold', $event.detail.value)" placeholder-class="phcolor" class="tui-input" placeholder="客户端展示:已售数量+实售数量" maxlength="10" type="number" />
|
|
|
+ </tui-list-cell>
|
|
|
+ </view>
|
|
|
+ <button class="spec-add-btn" @click.stop.prevent="addSpec">新增规格组</button>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <tui-list-cell v-if="form.specEnabled != 1" class="line-cell" :hover="false">
|
|
|
<view class="tui-title">价格类型</view>
|
|
|
<view class="btn-group">
|
|
|
<button class="admin-button-com middle" :class="[form.priceType === '1' ? '' : 'default']" @click="setPriceType('1')">有价格</button>
|
|
|
@@ -52,12 +137,12 @@
|
|
|
</view>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
- <tui-list-cell v-if="form.priceType === '1'" class="line-cell" :hover="false">
|
|
|
+ <tui-list-cell v-if="form.specEnabled != 1 && form.priceType === '1'" class="line-cell" :hover="false">
|
|
|
<view class="tui-title required">价格</view>
|
|
|
<input v-model="form.price" placeholder-class="phcolor" class="tui-input" name="price" placeholder="请输入价格" maxlength="10" type="digit" />
|
|
|
</tui-list-cell>
|
|
|
|
|
|
- <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <tui-list-cell v-if="form.specEnabled != 1" class="line-cell" :hover="false">
|
|
|
<view class="tui-title">库存</view>
|
|
|
<view class="btn-group">
|
|
|
<button class="admin-button-com middle" :class="[form.stockSet === '0' ? '' : 'default']" @click="setstockSet('0')">管够</button>
|
|
|
@@ -65,22 +150,22 @@
|
|
|
</view>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
- <tui-list-cell v-if="form.stockSet === '1'" class="line-cell" :hover="false">
|
|
|
+ <tui-list-cell v-if="form.specEnabled != 1 && form.stockSet === '1'" class="line-cell" :hover="false">
|
|
|
<view class="tui-title">库存</view>
|
|
|
<input v-model="form.stock" placeholder-class="phcolor" @focus="onStockFocus" @blur="onStockBlur" class="tui-input" name="stock" placeholder="请输入库存数量" maxlength="10" type="number" />
|
|
|
</tui-list-cell>
|
|
|
|
|
|
- <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <tui-list-cell v-if="form.specEnabled != 1" class="line-cell" :hover="false">
|
|
|
<view class="tui-title">用花支数</view>
|
|
|
<input v-model="form.flowerNum" placeholder-class="phcolor" @focus="onFlowerNumFocus" @blur="onFlowerNumBlur" class="tui-input" name="flowerNum" placeholder="用于判断花束大小" maxlength="5" type="number" />
|
|
|
</tui-list-cell>
|
|
|
|
|
|
- <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <tui-list-cell v-if="form.specEnabled != 1" class="line-cell" :hover="false">
|
|
|
<view class="tui-title">重量</view>
|
|
|
<input v-model="form.weight" placeholder-class="phcolor" @focus="onWeightFocus" @blur="onWeightBlur" class="tui-input" name="weight" placeholder="公斤,可输入小数" maxlength="10" type="digit" />
|
|
|
</tui-list-cell>
|
|
|
|
|
|
- <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <tui-list-cell v-if="form.specEnabled != 1" class="line-cell" :hover="false">
|
|
|
<view class="tui-title">已售数量</view>
|
|
|
<input v-model="form.sold" placeholder-class="phcolor" class="tui-input" name="sold" placeholder="客户端展示:已售数量+实售数量" maxlength="10" type="number" />
|
|
|
</tui-list-cell>
|
|
|
@@ -132,7 +217,7 @@ import TuiListCell from "@/components/plugin/list-cell";
|
|
|
import AppUploader from "@/components/app-uploader";
|
|
|
const form = require("@/utils/formValidation.js");
|
|
|
import { getClass } from "@/api/category";
|
|
|
-import { addGoodsData } from "@/api/goods"
|
|
|
+import { addGoodsData, useCaseList } from "@/api/goods"
|
|
|
import { delImage } from "@/api/pic-text";
|
|
|
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
|
|
|
import inputRestore from "@/mixins/inputRestore";
|
|
|
@@ -164,8 +249,9 @@ export default {
|
|
|
cover: '1',
|
|
|
shortCover: "", // 添加shortCover字段,与detail.vue保持一致
|
|
|
setItemNum: 0,
|
|
|
+ useCaseIdList: [], specEnabled: 0, specList: [],
|
|
|
},
|
|
|
- categoryData:[],
|
|
|
+ categoryData:[], useCaseData: [],
|
|
|
currentImgData:[],
|
|
|
firstCategorySelected: false
|
|
|
};
|
|
|
@@ -266,6 +352,176 @@ export default {
|
|
|
this.categoryData = res.data
|
|
|
}
|
|
|
})
|
|
|
+ useCaseList().then(res => { if (res.code == 1) this.useCaseData = res.data || [] })
|
|
|
+ },
|
|
|
+ toggleUseCase(item) { const i=this.form.useCaseIdList.indexOf(item.id); i<0?this.form.useCaseIdList.push(item.id):this.form.useCaseIdList.splice(i,1) },
|
|
|
+ createSpecData(data = {}) {
|
|
|
+ const shopImg = Array.isArray(data.shortImgList) ? data.shortImgList : (Array.isArray(data.shopImg) ? data.shopImg : []);
|
|
|
+ const currentImgData = Array.isArray(data.currentImgData) ? data.currentImgData : (Array.isArray(data.smallImgList) ? data.smallImgList : []);
|
|
|
+ const shortCover = data.shortCover || (shopImg.includes(data.cover) ? data.cover : '') || shopImg[0] || '';
|
|
|
+ return {
|
|
|
+ id: data.id || 0,
|
|
|
+ specName: data.specName || '',
|
|
|
+ price: data.price !== undefined && data.price !== null ? data.price : '',
|
|
|
+ priceType: String(data.priceType !== undefined && data.priceType !== null ? data.priceType : '1'),
|
|
|
+ stock: data.stock !== undefined && data.stock !== null ? data.stock : 999,
|
|
|
+ stockSet: String(data.stockSet !== undefined && data.stockSet !== null ? data.stockSet : '0'),
|
|
|
+ flowerNum: data.flowerNum !== undefined && data.flowerNum !== null ? data.flowerNum : 0,
|
|
|
+ weight: data.weight !== undefined && data.weight !== null && data.weight !== '' ? data.weight : 1,
|
|
|
+ sold: data.sold !== undefined && data.sold !== null ? data.sold : 0,
|
|
|
+ shopImg,
|
|
|
+ currentImgData,
|
|
|
+ cover: shortCover,
|
|
|
+ shortCover
|
|
|
+ }
|
|
|
+ },
|
|
|
+ addSpec() { this.form.specList.push(this.createSpecData()) },
|
|
|
+ removeSpec(index) { this.form.specList.splice(index,1) },
|
|
|
+ setSpecField(index, field, value) {
|
|
|
+ const spec = this.form.specList[index] || this.createSpecData();
|
|
|
+ const nextSpec = { ...spec, [field]: value };
|
|
|
+ this.$set(this.form.specList, index, nextSpec);
|
|
|
+ },
|
|
|
+ specImgUploadSuccess(res, index) {
|
|
|
+ const spec = this.form.specList[index] || this.createSpecData();
|
|
|
+ const uploadRes = JSON.parse(res.data);
|
|
|
+ if (uploadRes.code == 1) {
|
|
|
+ const currentImgData = [...(spec.currentImgData || []), uploadRes.data.smallUrl];
|
|
|
+ const shopImg = [...(spec.shopImg || []), uploadRes.data.shortUrl];
|
|
|
+ const shortCover = spec.shortCover || uploadRes.data.shortUrl;
|
|
|
+ this.$set(this.form.specList, index, {
|
|
|
+ ...spec,
|
|
|
+ currentImgData,
|
|
|
+ shopImg,
|
|
|
+ cover: shortCover,
|
|
|
+ shortCover
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ specImgDeleteFn(res, index) {
|
|
|
+ const spec = this.form.specList[index] || this.createSpecData();
|
|
|
+ const imgIndex = res.index;
|
|
|
+ const currentImgData = Array.isArray(res.tempFilePaths) ? res.tempFilePaths : [...(spec.currentImgData || [])];
|
|
|
+ const shopImg = [...(spec.shopImg || [])];
|
|
|
+ const shortDelPath = (shopImg[imgIndex] || this.normalizeImgPath(res.del)).replace(/^\//, '');
|
|
|
+ shopImg.splice(imgIndex, 1);
|
|
|
+ const shortCover = shopImg.includes(spec.shortCover) ? spec.shortCover : (shopImg[0] || '');
|
|
|
+ this.$set(this.form.specList, index, {
|
|
|
+ ...spec,
|
|
|
+ currentImgData,
|
|
|
+ shopImg,
|
|
|
+ cover: shortCover,
|
|
|
+ shortCover
|
|
|
+ });
|
|
|
+ if (shortDelPath) {
|
|
|
+ delImage({ filePath: shortDelPath }).catch(() => {});
|
|
|
+ }
|
|
|
+ },
|
|
|
+ selSpecCoverFn(index, imgIndex) {
|
|
|
+ const spec = this.form.specList[index] || this.createSpecData();
|
|
|
+ const shortCover = (spec.shopImg || [])[imgIndex] || '';
|
|
|
+ this.$set(this.form.specList, index, {
|
|
|
+ ...spec,
|
|
|
+ cover: shortCover,
|
|
|
+ shortCover
|
|
|
+ });
|
|
|
+ },
|
|
|
+ toggleSpecs(e) {
|
|
|
+ this.form.specEnabled=e.detail.value?1:0;
|
|
|
+ if(this.form.specEnabled && !this.form.specList.length) {
|
|
|
+ this.form.specList.push(this.createSpecData(this.form))
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setSpecPriceType(index, type) {
|
|
|
+ const spec = this.form.specList[index] || this.createSpecData();
|
|
|
+ spec.priceType = type;
|
|
|
+ if (type === '0') {
|
|
|
+ spec.price = 0;
|
|
|
+ } else if (String(spec.price) === '0') {
|
|
|
+ spec.price = '';
|
|
|
+ }
|
|
|
+ this.$set(this.form.specList, index, { ...spec });
|
|
|
+ },
|
|
|
+ setSpecStockSet(index, status) {
|
|
|
+ const spec = this.form.specList[index] || this.createSpecData();
|
|
|
+ spec.stockSet = status;
|
|
|
+ spec.stock = status === '0' ? 9999 : '';
|
|
|
+ this.$set(this.form.specList, index, { ...spec });
|
|
|
+ },
|
|
|
+ validateSpecList() {
|
|
|
+ if (this.form.specEnabled != 1) return true;
|
|
|
+ if (!this.form.specList.length) {
|
|
|
+ this.$msg('请至少添加一个规格组');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for (let i = 0; i < this.form.specList.length; i++) {
|
|
|
+ const spec = this.form.specList[i];
|
|
|
+ const name = `规格组${i + 1}`;
|
|
|
+ if (!spec.specName || !String(spec.specName).trim()) {
|
|
|
+ this.$msg(`请输入${name}名称`);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (String(spec.priceType) === '1') {
|
|
|
+ const price = parseFloat(spec.price);
|
|
|
+ if (spec.price === '' || isNaN(price) || price <= 0) {
|
|
|
+ this.$msg(`${name}价格必须是大于0的数字`);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (String(spec.stockSet) === '1') {
|
|
|
+ const stock = parseFloat(spec.stock);
|
|
|
+ if (spec.stock === '' || isNaN(stock) || stock < 0) {
|
|
|
+ this.$msg(`${name}库存数量必须是大于等于0的数字`);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const flowerNum = parseFloat(spec.flowerNum || 0);
|
|
|
+ if (isNaN(flowerNum) || flowerNum < 0) {
|
|
|
+ this.$msg(`${name}花支数必须是大于等于0的数字`);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const weight = parseFloat(spec.weight);
|
|
|
+ if (spec.weight === '' || isNaN(weight) || weight < 0) {
|
|
|
+ this.$msg(`${name}重量必须是大于等于0的数字`);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const sold = parseFloat(spec.sold || 0);
|
|
|
+ if (isNaN(sold) || sold < 0) {
|
|
|
+ this.$msg(`${name}已售数量必须是大于等于0的数字`);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
+ normalizeSpecSubmitData(formData) {
|
|
|
+ if (formData.specEnabled != 1) {
|
|
|
+ formData.specList = [];
|
|
|
+ return formData;
|
|
|
+ }
|
|
|
+ formData.specList = formData.specList.map(item => {
|
|
|
+ const spec = this.createSpecData(item);
|
|
|
+ spec.priceType = parseInt(spec.priceType);
|
|
|
+ spec.price = spec.priceType === 1 ? parseFloat(spec.price || 0) : 0;
|
|
|
+ spec.stockSet = parseInt(spec.stockSet);
|
|
|
+ spec.stock = spec.stockSet === 1 ? parseInt(spec.stock || 0) : 9999;
|
|
|
+ spec.flowerNum = parseInt(spec.flowerNum || 0);
|
|
|
+ spec.weight = parseFloat(spec.weight || 0);
|
|
|
+ spec.sold = parseInt(spec.sold || 0);
|
|
|
+ spec.shopImg = Array.isArray(spec.shopImg) ? spec.shopImg : [];
|
|
|
+ spec.cover = spec.shopImg.length > 0 ? (spec.shortCover || spec.cover || spec.shopImg[0]) : '';
|
|
|
+ delete spec.currentImgData;
|
|
|
+ delete spec.shortCover;
|
|
|
+ return spec;
|
|
|
+ });
|
|
|
+ const firstSpec = formData.specList[0];
|
|
|
+ formData.priceType = String(firstSpec.priceType);
|
|
|
+ formData.price = firstSpec.price;
|
|
|
+ formData.stockSet = String(firstSpec.stockSet);
|
|
|
+ formData.stock = firstSpec.stock;
|
|
|
+ formData.flowerNum = firstSpec.flowerNum;
|
|
|
+ formData.weight = firstSpec.weight;
|
|
|
+ formData.sold = firstSpec.sold;
|
|
|
+ return formData;
|
|
|
},
|
|
|
// 封面选择
|
|
|
selCoverFn(index) {
|
|
|
@@ -359,6 +615,7 @@ export default {
|
|
|
} else {
|
|
|
formData.cover = '';
|
|
|
}
|
|
|
+ formData = this.normalizeSpecSubmitData(formData);
|
|
|
if(formData.stockSet === '0'){
|
|
|
formData.stock = 9999;
|
|
|
}
|
|
|
@@ -382,8 +639,12 @@ export default {
|
|
|
}
|
|
|
];
|
|
|
|
|
|
+ if (!this.validateSpecList()) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
// 只有在有价格类型时才验证价格
|
|
|
- if (this.form.priceType === '1') {
|
|
|
+ if (this.form.specEnabled != 1 && this.form.priceType === '1') {
|
|
|
rules.push({
|
|
|
name: "price",
|
|
|
rule: ["required"],
|
|
|
@@ -398,7 +659,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
// 验证库存数量
|
|
|
- if (this.form.stockSet === '1' && this.form.stock !== "") {
|
|
|
+ if (this.form.specEnabled != 1 && this.form.stockSet === '1' && this.form.stock !== "") {
|
|
|
const stockNum = parseFloat(this.form.stock);
|
|
|
if (isNaN(stockNum) || stockNum < 0) {
|
|
|
this.$msg('库存数量必须是大于等于0的数字!');
|
|
|
@@ -407,7 +668,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
// 验证已售数量
|
|
|
- if (this.form.sold !== "") {
|
|
|
+ if (this.form.specEnabled != 1 && this.form.sold !== "") {
|
|
|
const soldNum = parseFloat(this.form.sold);
|
|
|
if (isNaN(soldNum) || soldNum < 0) {
|
|
|
this.$msg('已售数量必须是大于等于0的数字!');
|
|
|
@@ -416,7 +677,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
// 验证花支数
|
|
|
- if (this.form.flowerNum !== "" && this.form.flowerNum !== 0) {
|
|
|
+ if (this.form.specEnabled != 1 && this.form.flowerNum !== "" && this.form.flowerNum !== 0) {
|
|
|
const flowerNum = parseFloat(this.form.flowerNum);
|
|
|
if (isNaN(flowerNum) || flowerNum < 0) {
|
|
|
this.$msg('花支数必须是大于0的数字!');
|
|
|
@@ -425,7 +686,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
// 验证重量(千克)
|
|
|
- if (this.form.weight !== "") {
|
|
|
+ if (this.form.specEnabled != 1 && this.form.weight !== "") {
|
|
|
const weightNum = parseFloat(this.form.weight);
|
|
|
if (isNaN(weightNum) || weightNum < 0) {
|
|
|
this.$msg('重量必须是大于等于0的数字!');
|
|
|
@@ -528,6 +789,128 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+.spec-switch-card {
|
|
|
+ margin: 0 20upx 20upx;
|
|
|
+ padding: 28upx 30upx;
|
|
|
+ border: 1px solid #e5f5ec;
|
|
|
+ border-radius: 12upx;
|
|
|
+ background: linear-gradient(90deg, #f3fff8 0%, #ffffff 100%);
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+.spec-switch-left {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ min-width: 0;
|
|
|
+}
|
|
|
+.spec-switch-icon {
|
|
|
+ width: 72upx;
|
|
|
+ height: 72upx;
|
|
|
+ margin-right: 22upx;
|
|
|
+ border-radius: 50%;
|
|
|
+ background: #09C567;
|
|
|
+ color: #ffffff;
|
|
|
+ font-size: 46upx;
|
|
|
+ line-height: 72upx;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+.spec-switch-title {
|
|
|
+ font-size: 34upx;
|
|
|
+ color: #222222;
|
|
|
+ font-weight: 700;
|
|
|
+ line-height: 44upx;
|
|
|
+}
|
|
|
+.spec-switch-desc {
|
|
|
+ margin-top: 6upx;
|
|
|
+ font-size: 24upx;
|
|
|
+ color: #999999;
|
|
|
+}
|
|
|
+.spec-switch-right {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ flex-shrink: 0;
|
|
|
+ color: #999999;
|
|
|
+ font-size: 24upx;
|
|
|
+ text {
|
|
|
+ margin-left: 12upx;
|
|
|
+ }
|
|
|
+}
|
|
|
+.spec-wrap {
|
|
|
+ padding: 0 0 20upx;
|
|
|
+}
|
|
|
+.spec-card {
|
|
|
+ margin-bottom: 24upx;
|
|
|
+ background: #ffffff;
|
|
|
+ border-top: 1px solid #eeeeee;
|
|
|
+ border-bottom: 1px solid #eeeeee;
|
|
|
+}
|
|
|
+.spec-card-head {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 20upx 30upx 0;
|
|
|
+}
|
|
|
+.spec-card-title {
|
|
|
+ font-size: 30upx;
|
|
|
+ color: #222222;
|
|
|
+ font-weight: 700;
|
|
|
+}
|
|
|
+.spec-remove {
|
|
|
+ margin: 0;
|
|
|
+ padding: 0 20upx;
|
|
|
+ height: 54upx;
|
|
|
+ line-height: 54upx;
|
|
|
+ border: 1px solid #eeeeee;
|
|
|
+ border-radius: 8upx;
|
|
|
+ background: #ffffff;
|
|
|
+ color: #999999;
|
|
|
+ font-size: 24upx;
|
|
|
+}
|
|
|
+.spec-line {
|
|
|
+ margin-top: 0;
|
|
|
+}
|
|
|
+.spec-image-wrap {
|
|
|
+ padding: 10upx 0 20upx;
|
|
|
+ border-bottom: 1px solid #eeeeee;
|
|
|
+ .module-tit {
|
|
|
+ padding: 20upx 30upx;
|
|
|
+ }
|
|
|
+ .module-det {
|
|
|
+ padding: 0 30upx;
|
|
|
+ }
|
|
|
+}
|
|
|
+.spec-cover-row {
|
|
|
+ display: flex;
|
|
|
+ align-items: flex-start;
|
|
|
+ padding: 20upx 30upx 0;
|
|
|
+}
|
|
|
+.spec-cover-title {
|
|
|
+ width: 200upx;
|
|
|
+ flex-shrink: 0;
|
|
|
+ font-size: 28upx;
|
|
|
+ color: #333333;
|
|
|
+ line-height: 68upx;
|
|
|
+}
|
|
|
+.spec-cover-btns {
|
|
|
+ flex: 1;
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ .admin-button-com {
|
|
|
+ margin-right: 30upx;
|
|
|
+ margin-bottom: 16upx;
|
|
|
+ }
|
|
|
+}
|
|
|
+.spec-add-btn {
|
|
|
+ margin: 20upx 24upx 0;
|
|
|
+ height: 88upx;
|
|
|
+ line-height: 88upx;
|
|
|
+ border-radius: 8upx;
|
|
|
+ background: #09C567;
|
|
|
+ color: #ffffff;
|
|
|
+ font-size: 30upx;
|
|
|
+}
|
|
|
|
|
|
/* 确保所有选中的按钮都使用相同的颜色 */
|
|
|
.admin-button-com:not(.default) {
|
|
|
@@ -664,4 +1047,4 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|