From 4db880f828e7baa5cfcfaeb9adc22b4367db1db4 Mon Sep 17 00:00:00 2001 From: youmengting <2080639302@qq.com> Date: Mon, 30 Oct 2023 14:24:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=A2=E8=B4=AD=E9=85=8D=E7=BD=AE:=E5=9B=A2?= =?UTF-8?q?=E8=B4=AD=E4=BA=A7=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Utils/groupBuying.js | 11 +- .../next-bubble-menu/next-bubble-menu.vue | 2 +- pages.json | 2 + .../groupProduct/groupProduct.vue | 275 +++++++++++++++--- .../groupProduct/groupProductAdd.vue | 143 +++++---- .../storeImg/storeImg.vue | 29 +- .../storeProduct/storeProduct.vue | 6 +- .../storeProduct/storeProductAdd.vue | 4 +- 8 files changed, 339 insertions(+), 133 deletions(-) diff --git a/Utils/groupBuying.js b/Utils/groupBuying.js index a0c8038..154481b 100644 --- a/Utils/groupBuying.js +++ b/Utils/groupBuying.js @@ -59,9 +59,9 @@ export const editGroupContent = params => { } //新增团购规则内容 -export const insertGroupServeRule = params => { - return POST('POST', `${base}/storeGroup/insertGroupServeRule`, params).then(res => res.data); -} +// export const insertGroupServeRule = params => { +// return POST('POST', `${base}/storeGroup/insertGroupServeRule`, params).then(res => res.data); +// } //编辑团购规则内容 export const editGroupServeRule = params => { @@ -90,4 +90,9 @@ export const getStoreGroupDetailList = params => { //根据团购id查询门店规则内容 export const findGroupServeRuleByGroup = params => { return POST('GET', `${base}/storeGroup/findGroupServeRuleByGroup`, params).then(res => res.data); +} + +//查询团购内容 +export const findStoreGroupContent = params => { + return POST('GET', `${base}/storeGroup/findStoreGroupContent`, params).then(res => res.data); } \ No newline at end of file diff --git a/components/next-bubble-menu/next-bubble-menu.vue b/components/next-bubble-menu/next-bubble-menu.vue index a2e5d41..69cc396 100644 --- a/components/next-bubble-menu/next-bubble-menu.vue +++ b/components/next-bubble-menu/next-bubble-menu.vue @@ -12,7 +12,7 @@ :style="{ left:0, top: showTop && (arrowTop+12)+'rpx' - }"> + }" @click.stop> diff --git a/pages.json b/pages.json index 8eea7e4..00cb466 100644 --- a/pages.json +++ b/pages.json @@ -580,6 +580,7 @@ { "path":"groupBuyingConfiguration/storeProduct/storeProductAdd", "style": { + "navigationBarTitleText": "", "enablePullDownRefresh": false, "app-plus": { "titleNView": false, //禁用原生导航栏 @@ -599,6 +600,7 @@ },{ "path":"groupBuyingConfiguration/groupProduct/groupProductAdd", "style": { + "navigationBarTitleText": "", "enablePullDownRefresh": false, "app-plus": { "titleNView": false, //禁用原生导航栏 diff --git a/subpackages/groupBuyingConfiguration/groupProduct/groupProduct.vue b/subpackages/groupBuyingConfiguration/groupProduct/groupProduct.vue index 25d903b..c752ba8 100644 --- a/subpackages/groupBuyingConfiguration/groupProduct/groupProduct.vue +++ b/subpackages/groupBuyingConfiguration/groupProduct/groupProduct.vue @@ -1,104 +1,250 @@ \ No newline at end of file diff --git a/subpackages/groupBuyingConfiguration/groupProduct/groupProductAdd.vue b/subpackages/groupBuyingConfiguration/groupProduct/groupProductAdd.vue index 4872f10..cd06e08 100644 --- a/subpackages/groupBuyingConfiguration/groupProduct/groupProductAdd.vue +++ b/subpackages/groupBuyingConfiguration/groupProduct/groupProductAdd.vue @@ -44,7 +44,7 @@ :disable-default-padding="false" v-model.trim="productData.astrict" placeholder="请输入限制" placeholder-class="font15" :maxlength="999"> - + 团购图片: @@ -70,7 +70,11 @@ {{item2.productName}} - {{item2.count}}份 + + {{item2.count}}份 + + + @@ -89,9 +93,10 @@ - - - + + 上一步 + + 下一步 @@ -158,9 +163,10 @@ getStoreProductByList, editGroupContentDetail, getStoreGroupDetailList, - insertGroupServeRule, editGroupServeRule, findGroupServeRuleByGroup, + deleteGroupDetail, + findStoreGroupContent } from '@/Utils/groupBuying.js'; const app = getApp(); export default { @@ -204,11 +210,7 @@ return true }, isShowAdd() { - /* if(this.imgValue.length>=1){ - return false - }else{ - return true - } */ + return true }, @@ -218,6 +220,14 @@ this.storeId = option.storeId; this.productData.storeId = option.storeId; this.status = option.status; + if (option.id) { + this.productData.id = option.id; + /* */ + this.groupId =option.id; + this.productDetail.groupId =option.id; + this.ruleData.groupId =option.id; + /* */ + } if (this.status == 1) { uni.setNavigationBarTitle({ title: "添加团购产品" @@ -226,14 +236,11 @@ uni.setNavigationBarTitle({ title: "编辑团购产品" }) + this.findStoreGroupContent();//查询基本信息 this.getStoreGroupDetailList();//查询产品详情 this.findGroupServeRuleByGroup();//查询产品规则 } - if (option.id) { - this.productData.id = option.id; - this.ruleData.id = option.id; - // this.getStoreProductById() - } + console.log(option, "=======") }, components: { @@ -278,7 +285,7 @@ if (this.merchart == 1) { /* 第一步:团购基本内容*/ if (!this.validate()) return; //校验是否有空 - this.productData.img = this.imgValue.join(""); + this.productData.img = this.imgValue.join(","); if (this.status == 1) { //1.新增 2.编辑 this.insertGroupContent(); return @@ -298,18 +305,36 @@ }) return } + this.editGroupServeRule(); - if (this.status == 1) { //1.新增 2.编辑 - this.insertGroupServeRule(); - return - } - if (this.status == 2) { - this.editGroupServeRule(); - return - } } }, - + /* 查询配置基本内容 */ + findStoreGroupContent(){ + let params={ + groupId:this.groupId + } + findStoreGroupContent(params).then(res=>{ + if (res.return_code == '000000') { + + this.productData.name = res.return_data.name; + this.productData.price = res.return_data.price; + this.productData.astrict = res.return_data.astrict; + this.productData.img = res.return_data.img; + this.productData.serviceTime = res.return_data.serviceTime; + this.productData.validity = res.return_data.validity; + this.imgValue = this.productData.img.split(","); + + + }else{ + uni.showToast({ + title: res.return_msg, + icon: 'none', + duration: 2000 + }) + } + }) + }, /* 新增配置团购基本内容 */ insertGroupContent() { insertGroupContent(this.productData).then(res => { @@ -409,7 +434,6 @@ //查看临时图片路径 getImgSignedUrl(item1) { this.imgValue.push(item1); - console.log(this.imgValue, "this.imgValue") }, // 弹窗关闭 hide() { @@ -426,9 +450,7 @@ getStoreGroupDetailList(params).then(res=>{ uni.hideLoading(); if (res.return_code == '000000') { - if(res.return_data.length>0){ - this.productDetailList = res.return_data - } + this.productDetailList = res.return_data }else{ uni.showToast({ title: res.return_msg, @@ -477,7 +499,6 @@ /* 产品列表复选款 */ checkClick(e) { this.productSelectIdList = e.detail.value; - console.log(this.productSelectIdList, "this.productSelectIdList") }, /* 保存产品详情 */ saveProductDetail() { @@ -508,6 +529,43 @@ this.editGroupContentDetail(this.productDetail) }, + //删除团购产品详情单个产品 + deleteGroupDetail(id){ + let _this = this; + uni.showModal({ + title: '提示', + content: '确定删除吗?', + success: function(res) { + if (res.confirm) { + let params ={ + id:id + } + uni.showLoading({ + title: "加载中..." + }) + deleteGroupDetail(params).then(res => { + uni.hideLoading(); + if (res.return_code == '000000') { + _this.getStoreGroupDetailList(); + uni.showToast({ + title: res.return_data, + icon: 'none', + duration: 2000 + }) + } else { + uni.showToast({ + title: res.return_msg, + icon: 'none', + duration: 2000 + }) + } + }) + } else if (res.cancel) { + // console.log('用户点击取消'); + } + } + }); + }, validateProductDetail() { if (!this.productDetail.name) { uni.showToast({ @@ -545,27 +603,6 @@ }) }, /* 团购规则 */ - /* 新增团购规则 */ - insertGroupServeRule(){ - insertGroupServeRule(this.ruleData).then(res=>{ - let title ; - if (res.return_code == '000000') { - title = res.return_data; - setTimeout(()=>{ - uni.navigateBack(); - },1000) - }else{ - title = res.return_msg; - } - uni.showToast({ - title: title, - icon: 'none', - duration: 2000 - }) - - }) - - }, // 编辑团购规则 editGroupServeRule(){ editGroupServeRule(this.ruleData).then(res=>{ @@ -597,6 +634,7 @@ findGroupServeRuleByGroup(params).then(res=>{ uni.hideLoading(); if (res.return_code == '000000') { + this.ruleData.content = res.return_data.content; console.log(res.return_data,"res.return_data") }else{ uni.showToast({ @@ -811,6 +849,7 @@ bottom: 0; left: 0; right: 0; + z-index: 99; display: flex; justify-content: center; align-items: center; diff --git a/subpackages/groupBuyingConfiguration/storeImg/storeImg.vue b/subpackages/groupBuyingConfiguration/storeImg/storeImg.vue index c2f89fc..286a1d6 100644 --- a/subpackages/groupBuyingConfiguration/storeImg/storeImg.vue +++ b/subpackages/groupBuyingConfiguration/storeImg/storeImg.vue @@ -2,7 +2,7 @@ - + @@ -10,7 +10,7 @@ 图片 - {{imgType.imgTypeText}} + {{imgType.imgTypeText}} 图片状态 @@ -251,32 +251,7 @@ .fcRed{ color: red; } - // 箭头 - .down{ - &::after{ - content: ""; - display: inline-block; - border: solid black; - border-width: 0 1px 1px 0; - padding: 4px; - margin-left: 10px; - vertical-align: 3px; - transform: rotate(45deg); - } - } - .up{ - &::after{ - content: ""; - display: inline-block; - border: solid black; - border-width: 0 2px 2px 0; - padding: 4px; - margin-left: 10px; - // vertical-align: 3px; - transform: rotate(225deg); - } - } //checkbox .checkContainer{ width: 40px; diff --git a/subpackages/groupBuyingConfiguration/storeProduct/storeProduct.vue b/subpackages/groupBuyingConfiguration/storeProduct/storeProduct.vue index 92cf92c..725d7a2 100644 --- a/subpackages/groupBuyingConfiguration/storeProduct/storeProduct.vue +++ b/subpackages/groupBuyingConfiguration/storeProduct/storeProduct.vue @@ -2,7 +2,7 @@ - + @@ -14,7 +14,7 @@ 操作 - + @@ -22,7 +22,7 @@ {{item.price}} {{item.saleCount}} - 编辑 + 编辑 diff --git a/subpackages/groupBuyingConfiguration/storeProduct/storeProductAdd.vue b/subpackages/groupBuyingConfiguration/storeProduct/storeProductAdd.vue index bf9b860..d010ded 100644 --- a/subpackages/groupBuyingConfiguration/storeProduct/storeProductAdd.vue +++ b/subpackages/groupBuyingConfiguration/storeProduct/storeProductAdd.vue @@ -1,5 +1,5 @@