上架问题修复
This commit is contained in:
parent
99b0390f89
commit
501c905abb
|
|
@ -12,7 +12,7 @@
|
||||||
<input name="servName" v-model="formData.servName" placeholder="请编辑上架标题(供客户搜索)"></input>
|
<input name="servName" v-model="formData.servName" placeholder="请编辑上架标题(供客户搜索)"></input>
|
||||||
</view>
|
</view>
|
||||||
<view class="cu-form-group">
|
<view class="cu-form-group">
|
||||||
<view class="title">服务描述</view>
|
<view class="title">服务描述<text class="text-red">*</text></view>
|
||||||
<input name="servDesc" v-model="formData.servDesc" placeholder="让客户更清晰的上架内容描述"></input>
|
<input name="servDesc" v-model="formData.servDesc" placeholder="让客户更清晰的上架内容描述"></input>
|
||||||
</view>
|
</view>
|
||||||
<view class="solid-top">
|
<view class="solid-top">
|
||||||
|
|
@ -132,7 +132,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="cu-bar bg-white">
|
<view class="cu-bar bg-white">
|
||||||
<view class="action text-black">区域描述</view>
|
<view class="action text-black">区域描述<text class="text-red">*</text></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="padding-lr-sm padding-bottom-sm bg-white">
|
<view class="padding-lr-sm padding-bottom-sm bg-white">
|
||||||
<textarea name="areaDesc" style="width: 100%; height: 150rpx;" class="solid radius text-left padding-sm"
|
<textarea name="areaDesc" style="width: 100%; height: 150rpx;" class="solid radius text-left padding-sm"
|
||||||
|
|
@ -179,7 +179,7 @@
|
||||||
<text class='cuIcon-close'></text>
|
<text class='cuIcon-close'></text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="solids" @tap="chooseImgList($event, 'descImgList')"
|
<view class="solids" @tap="chooseImgNoCrop($event, 'descImgList')"
|
||||||
v-if="formData.descImgList.length<9">
|
v-if="formData.descImgList.length<9">
|
||||||
<text class='cuIcon-cameraadd'></text>
|
<text class='cuIcon-cameraadd'></text>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -203,9 +203,9 @@
|
||||||
<text class='cuIcon-cameraadd'></text>
|
<text class='cuIcon-cameraadd'></text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<ksp-cropper mode="fixed" :width="cropWidth" :height="cropHeight" :maxWidth="cropWidth" :maxHeight="cropHeight" :url="url2Crop"
|
<ksp-cropper mode="fixed" :width="cropWidth" :height="cropHeight" :maxWidth="cropWidth"
|
||||||
@cancel="oncancel" @ok="onok"></ksp-cropper>
|
:maxHeight="cropHeight" :url="url2Crop" @cancel="oncancel" @ok="onok"></ksp-cropper>
|
||||||
<view class="cu-bar bg-white solid-top">
|
<view class="cu-bar bg-white solid-top">
|
||||||
<view class="action text-black">
|
<view class="action text-black">
|
||||||
视频上传
|
视频上传
|
||||||
|
|
@ -271,11 +271,11 @@
|
||||||
descImgList: [],
|
descImgList: [],
|
||||||
coverImgList: [],
|
coverImgList: [],
|
||||||
videoList: []
|
videoList: []
|
||||||
},
|
},
|
||||||
sysInfo: null,
|
sysInfo: null,
|
||||||
url2Crop: '',
|
url2Crop: '',
|
||||||
cropWidth: 0,
|
cropWidth: 0,
|
||||||
cropHeight: 0,
|
cropHeight: 0,
|
||||||
curImgListField: '',
|
curImgListField: '',
|
||||||
categoryList: [],
|
categoryList: [],
|
||||||
categoryMultiIndex: [0, 0, 0],
|
categoryMultiIndex: [0, 0, 0],
|
||||||
|
|
@ -328,7 +328,7 @@
|
||||||
this.loadData(goodId);
|
this.loadData(goodId);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async loadData(goodId) {
|
async loadData(goodId) {
|
||||||
this.sysInfo = uni.getSystemInfoSync();
|
this.sysInfo = uni.getSystemInfoSync();
|
||||||
this.curUserInfo = this.$request.getCurUserInfo();
|
this.curUserInfo = this.$request.getCurUserInfo();
|
||||||
this.checkBankAndCertify();
|
this.checkBankAndCertify();
|
||||||
|
|
@ -372,16 +372,16 @@
|
||||||
type: 1,
|
type: 1,
|
||||||
goodsCategoryId: col2Id
|
goodsCategoryId: col2Id
|
||||||
});
|
});
|
||||||
subSubTypeList = subSubTypeList.data;
|
subSubTypeList = subSubTypeList.data;
|
||||||
let col3Id = idArr ? idArr[2] : subSubTypeList[0].goodsCategoryId;
|
let col3Id = idArr ? idArr[2] : subSubTypeList[0].goodsCategoryId;
|
||||||
let thirdTypeList = await this.$request.listByStep({
|
let thirdTypeList = await this.$request.listByStep({
|
||||||
type: 1,
|
type: 1,
|
||||||
goodsCategoryId: col3Id
|
goodsCategoryId: col3Id
|
||||||
});
|
});
|
||||||
thirdTypeList = thirdTypeList.data;
|
thirdTypeList = thirdTypeList.data;
|
||||||
// this.categoryList.push(typeList);
|
// this.categoryList.push(typeList);
|
||||||
this.categoryList.push(subTypeList);
|
this.categoryList.push(subTypeList);
|
||||||
this.categoryList.push(subSubTypeList);
|
this.categoryList.push(subSubTypeList);
|
||||||
this.categoryList.push(thirdTypeList);
|
this.categoryList.push(thirdTypeList);
|
||||||
},
|
},
|
||||||
async loadRegionList() {
|
async loadRegionList() {
|
||||||
|
|
@ -420,14 +420,14 @@
|
||||||
type: 1,
|
type: 1,
|
||||||
goodsCategoryId: this.categoryList[0][colObj.value].goodsCategoryId
|
goodsCategoryId: this.categoryList[0][colObj.value].goodsCategoryId
|
||||||
});
|
});
|
||||||
subTypeList = subTypeList.data;
|
subTypeList = subTypeList.data;
|
||||||
let subSubTypeList = [];
|
let subSubTypeList = [];
|
||||||
if (subTypeList && subTypeList.length) {
|
if (subTypeList && subTypeList.length) {
|
||||||
subSubTypeList = await this.$request.listByStep({
|
subSubTypeList = await this.$request.listByStep({
|
||||||
type: 1,
|
type: 1,
|
||||||
goodsCategoryId: subTypeList[0].goodsCategoryId
|
goodsCategoryId: subTypeList[0].goodsCategoryId
|
||||||
});
|
});
|
||||||
subSubTypeList = subSubTypeList.data;
|
subSubTypeList = subSubTypeList.data;
|
||||||
}
|
}
|
||||||
this.categoryList.pop();
|
this.categoryList.pop();
|
||||||
this.categoryList.pop();
|
this.categoryList.pop();
|
||||||
|
|
@ -499,30 +499,30 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
chooseImgList(e, imgListField, cropWidth, cropHeight) {
|
chooseImgList(e, imgListField, cropWidth, cropHeight) {
|
||||||
this.cropWidth = cropWidth && cropWidth > 0 ? cropWidth : this.sysInfo.windowWidth * 2;
|
this.cropWidth = cropWidth && cropWidth > 0 ? cropWidth : this.sysInfo.windowWidth * 2;
|
||||||
this.cropHeight = cropHeight && cropHeight > 0 ? cropHeight : this.sysInfo.windowWidth * 2 * 1.5;
|
this.cropHeight = cropHeight && cropHeight > 0 ? cropHeight : this.sysInfo.windowWidth * 2 * 1.3;
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1, //默认9
|
count: 1, //默认9
|
||||||
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||||
sourceType: ['album'], //从相册选择
|
sourceType: ['album'], //从相册选择
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
res.tempFilePaths.forEach((tmpUrl, index) => {
|
res.tempFilePaths.forEach((tmpUrl, index) => {
|
||||||
this.url2Crop = tmpUrl;
|
this.url2Crop = tmpUrl;
|
||||||
this.curImgListField = imgListField;
|
this.curImgListField = imgListField;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onok(ev) {
|
onok(ev) {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '上传中',
|
title: '上传中',
|
||||||
mask: true
|
mask: true
|
||||||
});
|
});
|
||||||
this.$request.uploadFile(ev.path).then((url) => {
|
this.$request.uploadFile(ev.path).then((url) => {
|
||||||
this.formData[this.curImgListField].push(url);
|
this.formData[this.curImgListField].push(url);
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
});
|
});
|
||||||
// url设置为空,隐藏控件
|
// url设置为空,隐藏控件
|
||||||
this.url2Crop = "";
|
this.url2Crop = "";
|
||||||
},
|
},
|
||||||
|
|
@ -530,6 +530,27 @@
|
||||||
// url设置为空,隐藏控件
|
// url设置为空,隐藏控件
|
||||||
this.url2Crop = "";
|
this.url2Crop = "";
|
||||||
},
|
},
|
||||||
|
chooseImgNoCrop(e, imgListField) {
|
||||||
|
uni.chooseImage({
|
||||||
|
count: 9, //默认9
|
||||||
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
||||||
|
sourceType: ['album'], //从相册选择
|
||||||
|
success: (res) => {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '上传中',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
res.tempFilePaths.forEach((tmpUrl, index) => {
|
||||||
|
this.$request.uploadFile(tmpUrl).then((url) => {
|
||||||
|
this.formData[imgListField].push(url);
|
||||||
|
if (index === res.tempFilePaths.length - 1) {
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
viewImage(e, imgList) {
|
viewImage(e, imgList) {
|
||||||
uni.previewImage({
|
uni.previewImage({
|
||||||
urls: imgList,
|
urls: imgList,
|
||||||
|
|
@ -577,25 +598,32 @@
|
||||||
let errMsg = "";
|
let errMsg = "";
|
||||||
if (!data.servName) {
|
if (!data.servName) {
|
||||||
errMsg = '服务名称不能为空';
|
errMsg = '服务名称不能为空';
|
||||||
|
} else if (!data.servDesc) {
|
||||||
|
errMsg = '服务描述不能为空';
|
||||||
|
} else if (!data.category || !data.category.length) {
|
||||||
|
errMsg = '请选择类目';
|
||||||
} else if (!data.goodsStandardList || !data.goodsStandardList.length) {
|
} else if (!data.goodsStandardList || !data.goodsStandardList.length) {
|
||||||
errMsg = '至少选择一个规格';
|
errMsg = '至少勾选一个规格';
|
||||||
} else if (!this.validSpecData(data.goodsStandardList)) {
|
} else if (!this.validSpecData(data.goodsStandardList)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (!data.goodsUnit) {
|
} else if (!data.goodsUnit) {
|
||||||
errMsg = '商品单位不能为空';
|
errMsg = '商品单位不能为空';
|
||||||
} else if (!data.goodsAreaList || !data.goodsAreaList.length) {
|
} else if (!data.goodsAreaList || !data.goodsAreaList.length) {
|
||||||
errMsg = '至少选择一个上架区域';
|
errMsg = '至少选择一个上架区域';
|
||||||
|
} else if (!data.areaDesc) {
|
||||||
|
errMsg = '区域描述不能为空';
|
||||||
} else if (!data.coverImgList || !data.coverImgList.length) {
|
} else if (!data.coverImgList || !data.coverImgList.length) {
|
||||||
errMsg = '封面图不能为空'
|
errMsg = '封面图不能为空';
|
||||||
} else if (!data.descImgList || !data.descImgList.length) {
|
} else if (!data.descImgList || !data.descImgList.length) {
|
||||||
errMsg = '详情图不能为空'
|
errMsg = '详情图不能为空';
|
||||||
} else if (!data.imgList || !data.imgList.length) {
|
} else if (!data.imgList || !data.imgList.length) {
|
||||||
errMsg = '轮播图不能为空'
|
errMsg = '轮播图不能为空';
|
||||||
}
|
}
|
||||||
if (errMsg) {
|
if (errMsg) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
title: errMsg
|
title: errMsg,
|
||||||
|
duration: 2500
|
||||||
})
|
})
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -605,19 +633,16 @@
|
||||||
let errMsg = "";
|
let errMsg = "";
|
||||||
for (let i = 0; i < goodsStandardList.length; i++) {
|
for (let i = 0; i < goodsStandardList.length; i++) {
|
||||||
let spec = goodsStandardList[i];
|
let spec = goodsStandardList[i];
|
||||||
if (!spec.goodsStandardName) {
|
if (!spec.goodsPrice) {
|
||||||
errMsg = '勾选规格的自编辑购买标题不能为空';
|
errMsg = '已勾选规格的价格不能为空';
|
||||||
} else if (!spec.goodsPrice) {
|
|
||||||
errMsg = '勾选规格的价格不能为空';
|
|
||||||
} else if (!spec.groupPrice) {
|
|
||||||
errMsg = '勾选规格的团购价不能为空';
|
|
||||||
} else if (!spec.goodsNum) {
|
} else if (!spec.goodsNum) {
|
||||||
errMsg = '勾选规格的库存不能为空';
|
errMsg = '已勾选规格的库存不能为空';
|
||||||
}
|
}
|
||||||
if (errMsg) {
|
if (errMsg) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
title: errMsg
|
title: errMsg,
|
||||||
|
duration: 2500
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -629,7 +654,10 @@
|
||||||
},
|
},
|
||||||
async submit() {
|
async submit() {
|
||||||
let goodsStandardList = this.formData.specsList.filter((item) => {
|
let goodsStandardList = this.formData.specsList.filter((item) => {
|
||||||
if (item.checked) {
|
if (item.checked) {
|
||||||
|
if (!item.goodsStandardName) {
|
||||||
|
item.goodsStandardName = item.goodsCategoryName;
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
...item
|
...item
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue