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