Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop-ui

This commit is contained in:
Chopper711
2025-02-20 14:57:21 +08:00
8 changed files with 135 additions and 211 deletions

View File

@@ -203,6 +203,7 @@
<AutoComplete ref="input" v-model="val.value"
:disabled="containsSameSkuItem"
:filter-method="filterMethod"
:maxlength="30" placeholder="请输入规格值" style="width: 180px"
@on-focus="changeSkuVals(val, item.name)"
@@ -257,6 +258,7 @@
<FormItem v-if="item.spec_values.length < 10 && item.spec_values.length >= 1 && item.spec_values[0].value !== ''" class="sku-item-content-val flex" label="" style="line-height: 32px;">
<AutoComplete ref="input" v-model="newSkuValues[$index]"
:disabled="containsSameSkuItem"
:filter-method="filterMethod"
:maxlength="30" placeholder="自定义规格值" style="width: 180px"
@on-blur="addSpec($index, item)"
@@ -630,6 +632,10 @@ export default {
skuTableColumn: [],
/** 表格数据 */
skuTableData: [],
// 持久化的sku数据
skuTableDataCopy: [],
// 持久化的sku数据
skuInfoCopy: [],
/** 默认的规格参数 */
skuData: [],
/** 默认的规格值 */
@@ -671,6 +677,9 @@ export default {
shopCategory: [],
/** 商品单位列表 */
goodsUnitList: [],
containsSameSkuItem: false,
containsSameSkuValue: false,
containsSameSkuNewValue: false,
// 展示商品视频
showGoodsVideo: false,
ignoreColumn: [
@@ -729,17 +738,6 @@ export default {
desc: "视频大小不能超过10MB",
});
},
onAddSku(index) {
if (!this.newSkuValues[index]) {
this.$Message.error('请输入规格值')
return
}
this.skuInfo[index].spec_values.push({
name: this.newSkuValues[index].name,
value: this.newSkuValues[index],
images: this.openImage ? [] : this.baseInfoForm.goodsGalleryFiles
})
},
// 图片选择后回调
callbackSelected(val) {
this.picModelFlag = false;
@@ -1246,6 +1244,14 @@ export default {
},
/** 添加规格项 */
addSkuItem() {
if (this.containsSameSkuItem) {
this.$Message.error("存在重复规格项");
return;
}
if (this.containsSameSkuValue) {
this.$Message.error("存在重复规格值");
return;
}
if (this.skuInfo.length >= 5) {
this.$Message.error("规格项不能大于5个");
return;
@@ -1269,8 +1275,10 @@ export default {
editSkuItem(val, index, item) {
if (this.skuTableData.find((i) => i[val])) {
this.$Message.error("已存在相同规格项");
this.containsSameSkuItem = true;
return;
}
this.containsSameSkuItem = false;
if (this.zz(0, val) > 20) {
this.$Message.error("规格值最多十个字符长度");
// val = val.toString().slice(0, 4);
@@ -1283,6 +1291,11 @@ export default {
delete e[this.currentSkuItem];
return e;
});
this.skuInfo[index].name = val;
this.skuInfo[index].spec_values.forEach((e) => {
e.name = val;
});
this.currentSkuItem = val;
this.renderTableData(this.skuTableData);
},
@@ -1322,8 +1335,13 @@ export default {
skuValueChange(val, index, item, $index) {
if (this.skuTableData.find((i) => i[val.name] === val.value)) {
this.$Message.error("已存在相同规格值");
this.skuInfo = cloneObj(this.skuInfoCopy);
this.skuTableData = cloneObj(this.skuTableDataCopy);
return;
}
this.containsSameSkuValue = false;
if (val.value === '') {
return;
}
@@ -1343,6 +1361,8 @@ export default {
return e;
});
this.currentSkuVal = val.value;
this.skuTableDataCopy = cloneObj(this.skuTableData);
this.skuInfoCopy = cloneObj(this.skuInfo);
this.renderTableData(this.skuTableData);
},
// 获取焦点时,取得规格名对应的规格值
@@ -1366,6 +1386,12 @@ export default {
(e) => e[spec.name] !== this.lastEditSkuValue
);
}
// 判断是否存在重复规格值
if (!this.skuTableData.find((i) => i[val.name] === val.value)) {
this.skuTableDataCopy = cloneObj(this.skuTableData);
this.skuInfoCopy = cloneObj(this.skuInfo);
}
},
/** 移除当前规格项 进行数据变化*/
handleCloseSkuItem($index, item) {
@@ -1456,6 +1482,21 @@ export default {
this.$Message.error("请输入规格值");
return;
}
if (this.containsSameSkuItem) {
this.$Message.error("存在重复规格项");
return;
}
if (item.spec_values.find((i) => i.value === this.newSkuValues[$index])) {
this.newSkuValues[$index] = "";
this.skuInfo = cloneObj(this.skuInfoCopy);
this.skuTableData = cloneObj(this.skuTableDataCopy);
this.$Message.error("存在重复规格值");
this.containsSameSkuNewValue = true;
return;
}
if (this.validateEmpty(item.spec_values)) {
if (item.spec_values.length >= 10) {
this.$Message.error("规格值不能大于10个");
@@ -1514,6 +1555,9 @@ export default {
}
this.baseInfoForm.regeneratorSkuFlag = true;
this.newSkuValues[$index] = "";
this.skuTableDataCopy = cloneObj(this.skuTableData);
this.skuInfoCopy = cloneObj(this.skuInfo);
}
},
handleClearSku() {
@@ -1780,6 +1824,14 @@ export default {
},
/** 添加商品 **/
save() {
if (this.containsSameSkuItem) {
this.$Message.error("存在重复规格项");
return;
}
if (this.containsSameSkuValue) {
this.$Message.error("存在重复规格值");
return;
}
this.submitLoading = true;
this.$refs["baseInfoForm"].validate((valid) => {
if (valid) {

View File

@@ -442,7 +442,7 @@
<Form :model="faceSheetForm" ref="faceSheetForm" v-if="facesheetFlag" :rules="faceSheetFormValidate">
<FormItem label="物流公司" prop="logisticsId" style="position: relative" :label-width="90">
<Select v-model="faceSheetForm.logisticsId" placeholder="请选择" style="width: 250px">
<Option v-for="(item, i) in checkedLogistics" :key="i" :value="item.id">{{ item.name }}
<Option v-for="(item, i) in checkedLogistics" :key="i" :value="item.logisticsId">{{ item.name }}
</Option>
</Select>
</FormItem>
@@ -451,7 +451,7 @@
:rules="orderDeliverFormValidate" style="position: relative">
<FormItem label="物流公司" prop="logisticsId">
<Select v-model="orderDeliveryForm.logisticsId" placeholder="请选择" style="width: 250px">
<Option v-for="(item, i) in checkedLogistics" :key="i" :value="item.id">{{ item.name }}
<Option v-for="(item, i) in checkedLogistics" :key="i" :value="item.logisticsId">{{ item.name }}
</Option>
</Select>
</FormItem>
@@ -571,8 +571,9 @@
</div>
</template>
<template slot="numSlot" slot-scope="{ row, index }">
<InputNumber :min="0" :max="row.___num - row.deliverNumber" v-model="data[index].canNum">
</InputNumber>
<InputNumber v-model="row.canNum" :disabled="!selectGroupShipGoods.find(item=>item.id === row.id)"
:max="row.___num - row.deliverNumber - row.returnNum" :min="0"
@on-change="changeNum($event,index)"></InputNumber>
</template>
</Table>
<div slot="footer">
@@ -872,6 +873,16 @@ export default {
}
});
},
changeNum(number, index) {
const current = this.data[index]
if (this.selectGroupShipGoods.length) {
this.selectGroupShipGoods.forEach(item => {
if (item.skuId === current.skuId) {
item.canNum = number
}
})
}
},
// 分包裹发货
confirmShipGroupGoods () {
this.$refs.groupOrderDeliveryForm.validate(async (valid) => {
@@ -1145,7 +1156,7 @@ export default {
})
},
toPrints () {
if (this.form.logisticsId != null && this.form.logisticsId != '') {
if (this.faceSheetForm.logisticsId != null && this.faceSheetForm.logisticsId != '') {
this.orderDeliverModal = false;
}
},
@@ -1155,9 +1166,11 @@ export default {
this.$refs['faceSheetForm'].validate((valid) => {
if (valid) {
API_Order.getOrderFaceSheet(this.sn, this.faceSheetForm).then(res => {
if (res.success) {
if (res.success && res.result.printTemplate) {
this.someJSONdata = res.result.printTemplate;
this.toPrints();
}else{
this.$Message.success("电子面单发货失败!");
}
})
}

View File

@@ -64,115 +64,19 @@
<!-- 分享卡片 -->
<FormItem label="分享卡片封面" prop="feedsImg">
<div class="upload-list" v-if="liveForm.feedsImg">
<template>
<img :src="liveForm.feedsImg" />
<div class="upload-list-cover">
<Icon
type="ios-eye-outline"
@click.native="handleView(liveForm.feedsImg)"
></Icon>
<Icon
type="ios-trash-outline"
@click.native="handleRemove('feedsImg')"
></Icon>
</div>
</template>
</div>
<Upload
v-if="liveForm.feedsImg.length == 0"
ref="upload"
:show-upload-list="false"
:on-success="handleFeedsImgSuccess"
:format="['jpg', 'jpeg', 'png']"
:on-format-error="handleFormatError"
:max-size="1024"
:on-exceeded-size="handleMaxSize"
type="drag"
:action="action"
:headers="accessToken"
style="display: inline-block; width: 58px"
>
<div style="width: 58px; height: 58px; line-height: 58px">
<Icon type="ios-camera" size="20"></Icon>
</div>
</Upload>
<upload-pic-thumb v-model="liveForm.feedsImg" :multiple="false"></upload-pic-thumb>
<div class="tips">直播间分享图图片规则建议像素800*640大小不超过1M</div>
</FormItem>
<!-- 直播间背景墙 -->
<FormItem label="直播间背景墙" prop="coverImg">
<div class="upload-list" v-if="liveForm.coverImg">
<template>
<img :src="liveForm.coverImg" />
<div class="upload-list-cover">
<Icon
type="ios-eye-outline"
@click.native="handleView(liveForm.coverImg)"
></Icon>
<Icon
type="ios-trash-outline"
@click.native="handleRemove('coverImg')"
></Icon>
</div>
</template>
</div>
<Upload
v-if="liveForm.coverImg.length == 0"
ref="upload"
:show-upload-list="false"
:on-success="handleCoverImgSuccess"
:format="['jpg', 'jpeg', 'png']"
:on-format-error="handleFormatError"
:max-size="1024"
:on-exceeded-size="handleMaxSize"
type="drag"
:action="action"
:headers="accessToken"
style="display: inline-block; width: 58px"
>
<div style="width: 58px; height: 58px; line-height: 58px">
<Icon type="ios-camera" size="20"></Icon>
</div>
</Upload>
<upload-pic-thumb v-model="liveForm.coverImg" :multiple="false"></upload-pic-thumb>
<div class="tips">直播间背景图图片规则建议像素1080*1920大小不超过1M</div>
</FormItem>
<!-- 直播间背景墙 -->
<FormItem label="直播间分享图" prop="shareImg">
<div class="upload-list" v-if="liveForm.shareImg">
<template>
<img :src="liveForm.shareImg" />
<div class="upload-list-cover">
<Icon
type="ios-eye-outline"
@click.native="handleView(liveForm.shareImg)"
></Icon>
<Icon
type="ios-trash-outline"
@click.native="handleRemove('shareImg')"
></Icon>
</div>
</template>
</div>
<Upload
v-if="liveForm.shareImg.length == 0"
ref="upload"
:show-upload-list="false"
:on-success="handleShareImgSuccess"
:format="['jpg', 'jpeg', 'png']"
:on-format-error="handleFormatError"
:max-size="1024"
:on-exceeded-size="handleMaxSize"
type="drag"
:action="action"
:headers="accessToken"
style="display: inline-block; width: 58px"
>
<div style="width: 58px; height: 58px; line-height: 58px">
<Icon type="ios-camera" size="20"></Icon>
</div>
</Upload>
<upload-pic-thumb v-model="liveForm.shareImg" :multiple="false"></upload-pic-thumb>
<div class="tips">直播间分享图图片规则建议像素800*640大小不超过1M</div>
</FormItem>
@@ -261,6 +165,7 @@
<script>
import { uploadFile } from "@/libs/axios";
import uploadPicThumb from "@/views/my-components/lili/upload-pic-thumb";
import {
addLive,
addLiveGoods,
@@ -272,6 +177,7 @@ import liveGoods from "./liveGoods";
export default {
components: {
liveGoods,
uploadPicThumb,
},
data() {
return {