diff --git a/package2/IdleTrad/detail.vue b/package2/IdleTrad/detail.vue index cc366f1..89edcc1 100644 --- a/package2/IdleTrad/detail.vue +++ b/package2/IdleTrad/detail.vue @@ -481,10 +481,15 @@ uni.showModal({ title: '举报原因', editable: true, - placeholderText: '请描述问题', + placeholderText: '请描述问题(必填)', success: (res) => { - if (!res.confirm || !res.content) return - submitFishComplaint({ ...base, reason: res.content }).then(() => { + if (!res.confirm) return + const reason = String(res.content || '').trim() + if (!reason) { + uni.showToast({ title: '请输入举报内容', icon: 'none' }) + return + } + submitFishComplaint({ ...base, reason }).then(() => { uni.showToast({ title: '已提交举报', icon: 'none' }) }) } diff --git a/package2/myCenter/addGoods.vue b/package2/myCenter/addGoods.vue index 2e8bc80..b76c634 100644 --- a/package2/myCenter/addGoods.vue +++ b/package2/myCenter/addGoods.vue @@ -182,6 +182,7 @@ currentCanbuy:1, canbuyMap:{}, categoryData:[], + productCategoryList:[], categoryIndex: 0, modalclassType:'', categorySonData:[], @@ -249,9 +250,11 @@ this.tui.toast("您未授权,图片上传功能可能会出现错误") } }) - this.typeItem = JSON.parse(JSON.stringify(this.typeItem)) || '' - if (this.typeItem) { + if (this.hasSelectedTypeItem(this.typeItem)) { + this.typeItem = JSON.parse(JSON.stringify(this.typeItem)) this.formData.categoryId = this.typeItem.id + this.formData.categoryName = this.typeItem.categoryName + this.syncSelectedCategory() } this.formData.shopId = uni.getStorageSync('shopId') }, @@ -284,6 +287,7 @@ this.formData.productIntro = res.result.productIntro this.formData.categoryId = res.result.categoryId this.edit(this.formData) + this.syncSelectedCategory() } else { this.tui.toast(res.message) } @@ -385,24 +389,47 @@ shopId:uni.getStorageSync('shopId') }, false, true).then((res) => { if (res.code == 200) { - if (res.result.length > 0) { - if(this.formData.categoryId != '' && this.formData.categoryId != undefined){ - for(let i=0;i {}) }, + hasCategoryValue(value) { + return value !== '' && value !== undefined && value !== null + }, + hasSelectedTypeItem(item) { + return item && this.hasCategoryValue(item.id) + }, + syncSelectedCategory() { + if (this.hasCategoryValue(this.formData.categoryId)) { + const selected = this.productCategoryList.find(item => String(item.id) == String(this.formData.categoryId)) + if (selected) { + this.typeItem = selected + this.formData.categoryId = selected.id + this.formData.categoryName = selected.categoryName + return + } + if (this.formData.categoryName) { + this.typeItem = { + id: this.formData.categoryId, + categoryName: this.formData.categoryName + } + } + return + } + if (this.hasSelectedTypeItem(this.typeItem)) { + this.formData.categoryId = this.typeItem.id + this.formData.categoryName = this.typeItem.categoryName + return + } + if (this.productCategoryList.length > 0) { + this.typeItem = this.productCategoryList[0] + this.formData.categoryId = this.typeItem.id + this.formData.categoryName = this.typeItem.categoryName + } + }, // 触发提交表单 submit() { let that = this; diff --git a/package2/myCenter/myPost.vue b/package2/myCenter/myPost.vue index 2733d14..82f09bb 100644 --- a/package2/myCenter/myPost.vue +++ b/package2/myCenter/myPost.vue @@ -159,7 +159,7 @@ }, { text: offShelf ? '上架' : '下架', style: { - backgroundColor: offShelf ? '#24b979' : '#ff9f2d', + backgroundColor: offShelf ? '#2f8cff' : '#ff9f2d', color: '#fff', fontSize: '26rpx' } @@ -187,6 +187,7 @@ }, editItem(item) { if (!item || !item.id) return + uni.hideKeyboard() const type = this.activeTab == 'wants' ? 'want' : 'sell' uni.navigateTo({ url: `/package1/tabbar/fishRelease?mode=edit&type=${type}&id=${item.id}`