diff --git a/pages/my/new-serv.vue b/pages/my/new-serv.vue
index 5e8928d..802e5e6 100644
--- a/pages/my/new-serv.vue
+++ b/pages/my/new-serv.vue
@@ -12,7 +12,7 @@
- 服务描述
+ 服务描述*
@@ -132,7 +132,7 @@
- 区域描述
+ 区域描述*
-
@@ -203,9 +203,9 @@
-
-
+
+
视频上传
@@ -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
}