From 30c9d46496aec542bc08e0eff0f147bd8d6eae6f Mon Sep 17 00:00:00 2001 From: tianyi <13521030702@163.com> Date: Thu, 26 Mar 2026 10:47:13 +0800 Subject: [PATCH] 11 --- package1/myCenter/addType.vue | 299 +++++++++++++++++++++++++++++-- package1/myCenter/myMerchant.vue | 2 +- 2 files changed, 290 insertions(+), 11 deletions(-) diff --git a/package1/myCenter/addType.vue b/package1/myCenter/addType.vue index add0c93..4f92ee0 100644 --- a/package1/myCenter/addType.vue +++ b/package1/myCenter/addType.vue @@ -10,6 +10,64 @@ + + + + + 添加分类 + + + + + + 新增分类 + + + + + + + 确认 + + + + + + + + + 编辑分类 + + + 请在下方输入框中输入分类名 + + + 分类名称: + + + + 排序: + + + 删除 + + 确认 + + + + @@ -17,19 +75,150 @@ export default { data() { return { - + show: false, + indexList: [], + inputVal: '', + menuButtonInfo: {}, + multipleList:[], + sortText:'', + sortTextEdit:'', + typeText:'', + editItem: {}, + delItems: {}, } }, filters: { - + }, onShow() { this.menuButtonInfo = uni.getMenuButtonBoundingClientRect() + }, onLoad(option) { - + this.getGategoryList() }, methods: { + //初始化获取分类列表 + getGategoryList() { + this.tui.request("/app/productCategory/list", "get",{ + shopId:uni.getStorageSync('shopId') + }, false, false).then((res) => { + if (res.code == 200) { + this.indexList = res.result; + } else { + this.tui.toast(res.message) + } + }).catch(() => {}); + }, + delItem(item, type) { + this.show = true + }, + delItemModal() { + this.show = false; + this.tui.request("/app/productCategory/delById", "POST",{ + id: this.editItem.id, + }, false, true).then((res) => { + if (res.code == 200) { + this.getGategoryList() + uni.showToast({ + title: "删除成功", + icon: 'none' + }) + this.$refs.carPopup.close() + this.$refs.delDialog.close() + + } else { + uni.showToast({ + title: "删除失败", + icon: 'none' + }) + } + }).catch(() => {}); + }, + //分类编辑(新增,修改) + dialogInputConfirm() { + let that = this; + switch (that.typeModel) { + case 'add': + for (let i = 0; i < that.indexList.length; i++) { + if (that.indexList[i].categoryName == that.typeText) { + uni.showToast({ + title: "请勿重复添加!", + icon: 'error' + }) + return + } + } + if(that.typeText == ''){ + that.tui.toast("请输入分类名") + return + } + this.tui.request("/app/productCategory/save", "POST",{ + categoryName: that.typeText, + sort: that.sortText, + productAttributeOfAddVos:that.multipleList, + shopId:uni.getStorageSync('shopId') + }, false, true).then((res) => { + if (res.code == 200) { + that.tui.toast("添加成功") + that.$refs.addTypeDialog.close() + that.sortText = '' + + that.getGategoryList() + } else { + that.tui.toast("添加失败") + } + }).catch(() => {}); + + that.typeText = '' + that.inputVal = '' + that.multipleList = [] + break; + case 'edit': + this.tui.request("/app/productCategory/edit", "POST",{ + categoryName: this.inputVal, + sort: that.sortTextEdit, + id: that.editItem.id, + shopId:uni.getStorageSync('shopId') + }, false, true).then((res) => { + if (res.code == 200) { + that.getGategoryList() + that.sortText = '' + uni.showToast({ + title: "修改成功", + icon: 'none' + }) + } else { + uni.showToast({ + title: "修改失败", + icon: 'none' + }) + } + }).catch(() => {}); + break; + default: + } + that.$refs.delDialog.close() + this.inputVal = "" + this.$forceUpdate() + }, + //判断需要打开哪个弹窗(删除弹窗、取消弹窗) + inputDialogToggle(type, item, parent) { + this.typeModel = type; + if (type == 'edit') { + this.inputVal = item.categoryName; + this.editItem = item; + this.sortTextEdit = (this.editItem.sort == null || this.editItem.sort == 'null') ? '' : this.editItem + .sort + this.$refs.delDialog.open('bottom') + } else if (type == 'add') { + this.inputVal = ''; + this.isOpenId = item; + this.dialogTit = '输入分类名' + this.$refs.addTypeDialog.open('bottom') + } + + }, back() { uni.navigateBack() }, @@ -45,33 +234,33 @@ background: #F5F8F5; color: #00231C; } - + .page1 { width: 100%; height: 100%; font-size: 24rpx; position: relative; } - + .title { background: url('https://jewel-shop.oss-cn-beijing.aliyuncs.com/8bc15960c2dc40268e295d6dd23aecce.png') no-repeat; width: 100%; - height: 54%; + height: 20%; } - + .title-sreach { width: 100%; display: flex; height: 200rpx; position: relative; } - + .back-btn { position: absolute; - bottom: 0; + top: 0; left: 0; } - + .title-name { padding-top: 55px; font-size: 36rpx; @@ -79,4 +268,94 @@ flex: 1; text-align: center; } + + .card-list { + width: 95%; + border-radius: 10upx; + background: #fff; + height: auto; + margin: -60px auto; + } + + .name { + width: 75%; + float: left; + display: flex; + } + + .bj-btn { + width: 88rpx; + height: 50rpx; + font-size: 24rpx; + padding: 0; + line-height: 50rpx; + border-radius: 50rpx; + margin-top: 26rpx; + } + + .type-popup { + width: 500rpx; + height: auto; + background: #fff; + border-radius: 10px; + position: relative; + margin-bottom: 40rpx; + } + + .add-btn { + width: 95%; + height: 50px; + margin: 10px auto 0; + background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1)); + font-size: 16px; + font-weight: 700; + text-align: center; + line-height: 50px; + border-radius: 50px; + } + + .add-popup-content { + align-items: center; + justify-content: center; + padding: 30rpx; + width: 100%; + height: 400rpx; + background-color: #fff; + } + + .add-popup-title { + font-size: 36rpx; + font-weight: bold; + text-align: center; + position: relative; + } + + .add-popup-container { + margin-top: 20rpx; + } + + .add-popup-bottom { + display: flex; + height: 80rpx; + color: #fff; + line-height: 80rpx; + margin-top: 50rpx; + } + + .add-popup-btn { + flex: 1; + text-align: center; + background: rgba(0, 35, 28, 1); + border-radius: 40px; + color: rgba(166, 255, 234, 1); + } + .add-input{ + width: 100%; + border: 1px solid #eee; + height: 80rpx; + padding-left: 20rpx; + margin:20rpx 0; + font-size: 25rpx; + line-height: 80rpx; + } \ No newline at end of file diff --git a/package1/myCenter/myMerchant.vue b/package1/myCenter/myMerchant.vue index 96ba6cf..d1bf680 100644 --- a/package1/myCenter/myMerchant.vue +++ b/package1/myCenter/myMerchant.vue @@ -323,7 +323,7 @@ this.formData.shopImages = this.formData.zhengzhao + '@@' + this.formData.fanzhao + '@@' + this.formData.yingyezhizhao + '@@' + JSON.stringify(this.formData.qita) that.tui.request(url, "post", this.formData, false, true).then((res1) => { if (res1.code == 200) { - uni.setStorageSync('schoolShopId',res1.result.shopId) + uni.setStorageSync('schoolShop',res1.result) uni.showModal({ title: '提示', content: '提交成功,请等待管理员审核',