团购配置:团购产品

huipay-h5
游梦婷 1 year ago
parent a289f94297
commit 4db880f828
  1. 11
      Utils/groupBuying.js
  2. 2
      components/next-bubble-menu/next-bubble-menu.vue
  3. 2
      pages.json
  4. 275
      subpackages/groupBuyingConfiguration/groupProduct/groupProduct.vue
  5. 143
      subpackages/groupBuyingConfiguration/groupProduct/groupProductAdd.vue
  6. 29
      subpackages/groupBuyingConfiguration/storeImg/storeImg.vue
  7. 6
      subpackages/groupBuyingConfiguration/storeProduct/storeProduct.vue
  8. 4
      subpackages/groupBuyingConfiguration/storeProduct/storeProductAdd.vue

@ -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);
}

@ -12,7 +12,7 @@
:style="{
left:0,
top: showTop && (arrowTop+12)+'rpx'
}">
}" @click.stop>
</view>
<view class="list-container"
:style="'height:'+(dHeight?dHeight+'rpx':'auto')+';max-height:'+dMaxHeight+'rpx;border-radius:'+radius+'rpx;width:'+width+'rpx;left:'+ relativeAllow +'rpx;'">

@ -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, //

@ -1,104 +1,250 @@
<template>
<view class="all-container pd-main backcor6 font15">
<view class=" width100 mart10">
<button class="btns " @click.stop="clickToAdd()">新增</button>
<button class="btns icon tianjia" @click.stop="clickToAdd()">新增</button>
</view>
<view class="mart20 backcorfff">
<view class="dis-flex height40 bor-botm1">
<view class="flex-1 fotct fontwig6 " ></view>
<view class="flex-1 fotct fontwig6 "></view>
<view class="flex-1 fotct fontwig6">名称</view>
<view class="flex-1 fotct fontwig6">价格</view>
<!-- <view class="flex-1 fotct fontwig6">规格</view> -->
<view class="flex-1 fotct fontwig6">有效期</view>
<view class="flex-1 fotct fontwig6">状态</view>
<view class="flex-1 fotct fontwig6">操作</view>
</view>
<view class="dis-flex bor-botm1 paddtop5 paddbotm5 " v-for="(item,index) in storeGroupList" :key="index">
<view class="dis-flex bor-botm1 paddtop5 paddbotm5 " v-for="(item,index) in storeGroupList" :key="index"
@click="clickToOpenDetail(item)">
<view class="flex-1 fotct">
<image :src="imgUrl+item.img" @click.stop="previewImage(imgUrl+item.img)" mode="aspectFit" class="width100 height60 verc"></image>
<image :src="imgUrl+item.img[0]" @click.stop="previewImage(imgUrl+item.img[0])" mode="aspectFit"
class="width100 height60 verc"></image>
</view>
<view class="flex-1 fotct text1">{{item.name}}</view>
<view class="flex-1 fotct text1">{{item.price}}</view>
<view class="flex-1 fotct text1">{{item.validity}}</view>
<view class="flex-1 fotct fcor41c" @click.stop="clickToEdit(item)">编辑</view>
<view class="flex-1 fotct text1">{{item.status | filterStatus}}</view>
<next-bubble-menu class="flex-1 fotct font14" :d-width="150" :dataList="item.status | filterDataList"
bingEleId="imgType" @change="getItem($event,item)">
<view class=" font14 fcor41c " id="imgType">操作<text class="icon xia font14 fcor41c"></text></view>
</next-bubble-menu>
</view>
</view>
<wybPopup ref="popup" @hide="hide()" zIndex="999" type="bottom" height="500" width="500" :scrollY="true"
radius="6" :showCloseIcon="true">
<view class="pop-contain pd-main">
<view class="pop-title fontwig6"><text>详情</text></view>
<view class="dis-flex flex-wrap" v-if="productDetail">
<view class="width100 dis-flex bor-botm1">
<view class=" fotct fontwig6 backcor6 titleWidth minheight40">名称</view>
<view class="flex-1 fotct ">{{productDetail.name}}</view>
</view>
<view class="width100 dis-flex bor-botm1">
<view class=" fotct fontwig6 backcor6 titleWidth minheight40">价格</view>
<view class="flex-1 fotct ">{{productDetail.price}}</view>
</view>
<view class="width100 dis-flex bor-botm1">
<view class=" fotct fontwig6 backcor6 titleWidth minheight40">限制</view>
<view class="flex-1 fotct ">{{productDetail.astrict}}</view>
</view>
<view class="width100 dis-flex bor-botm1">
<view class=" fotct fontwig6 backcor6 titleWidth minheight40">状态</view>
<view class="flex-1 fotct ">{{productDetail.status | filterStatus}}</view>
</view>
<view class="width100 dis-flex bor-botm1">
<view class=" fotct fontwig6 backcor6 titleWidth minheight40">使用时间</view>
<view class="flex-1 fotct ">{{productDetail.serviceTime}}</view>
</view>
<view class="width100 dis-flex bor-botm1">
<view class=" fotct fontwig6 backcor6 titleWidth minheight40">有效期</view>
<view class="flex-1 fotct ">{{productDetail.validity}}</view>
</view>
<view class="width100 dis-flex bor-botm1">
<view class=" fotct fontwig6 backcor6 titleWidth minheight80">图片</view>
<view class="flex-1 fotct alijus flex-wrap">
<image v-for="(item,index) in productDetail.img" :src="imgUrl+item"
@click.stop="previewImage(imgUrl+item)" mode="aspectFit" class="width30 height60 verc">
</image>
</view>
</view>
<view class="width100 dis-flex bor-botm1">
<view class=" fotct fontwig6 backcor6 titleWidth minheight40">创建时间</view>
<view class="flex-1 fotct ">{{productDetail.createTime | timeFormat}}</view>
</view>
</view>
</view>
</wybPopup>
</view>
</template>
<script>
import {
getStoreGroupList
getStoreGroupList,
upDownGroup
} from '@/Utils/groupBuying.js';
import wybPopup from '@/components/wyb-popup/wyb-popup.vue';
import nextBubleMenu from "@/components/next-bubble-menu/next-bubble-menu.vue";
const app = getApp();
export default {
data(){
return{
data() {
return {
dataList: [{
id: 1,
text: '编辑',
}, {
id: 2,
text: '上/下架',
}],
imgUrl: app.globalData.imgUrl, //访
storeId:'',//id
storeGroupList:[],//
storeId: '', //id
storeGroupList: [], //
productDetail: null, //
}
},
onLoad(options){
if(options.storeId){
onLoad(options) {
if (options.storeId) {
this.storeId = options.storeId;
this.getStoreGroupList()
}
},
methods:{
clickToAdd(){
onShow() {
this.getStoreGroupList()
},
components: {
wybPopup,
nextBubleMenu
},
filters: {
filterStatus(type) {
switch (type) {
case 1:
return "展示中";
case 2:
return "编辑中";
case 0:
return "删除";
default:
return "未知";
}
},
filterDataList(type) {
let arr;
if (type == 1) {
arr = [{
id: 2,
text: '下架',
}];
}
if (type == 2) {
arr = [{
id: 1,
text: '编辑',
}, {
id: 2,
text: '上架',
}];
}
return arr
}
},
methods: {
clickToAdd() {
let that = this;
uni.navigateTo({
url:"./groupProductAdd?status=1&storeId="+that.storeId
url: "./groupProductAdd?status=1&storeId=" + that.storeId
})
},
clickToEdit(item){
/* 编辑操作 */
clickToEdit(item) {
let that = this;
uni.navigateTo({
url:"./groupProductAdd?status=2&id="+item.id+"&storeId="+that.storeId
url: "./groupProductAdd?status=2&id=" + item.id + "&storeId=" + that.storeId
})
},
getItem(data, item) {
if (data.id == 1) { //
this.clickToEdit(item)
} else if (data.id == 2) { //
this.upDownGroup(item.id)
}
console.log(data, item)
},
//
upDownGroup(id) {
let params = {
id: id
}
upDownGroup(params).then(res => {
if (res.return_code == '000000') {
uni.showToast({
title: res.return_data,
icon: 'none',
duration: 2000
})
this.getStoreGroupList()
} else {
uni.showToast({
title: res.return_msg,
icon: 'none',
duration: 2000
})
}
})
},
// id
getStoreGroupList(){
let params={
storeId:this.storeId
getStoreGroupList() {
let params = {
storeId: this.storeId
}
uni.showLoading({
title:"加载中",
mask:true
title: "加载中",
mask: true
})
getStoreGroupList(params).then(res=>{
getStoreGroupList(params).then(res => {
uni.hideLoading();
if (res.return_code == '000000') {
if(res.return_data.length>0){
this.storeGroupList = res.return_data
}
}else{
uni.showToast({
title: res.return_msg,
icon: 'none',
duration: 2000
})
if (res.return_code == '000000') {
this.storeGroupList = res.return_data;
this.storeGroupList.map(item => {
item.img = item.img.split(",");
})
} else {
uni.showToast({
title: res.return_msg,
icon: 'none',
duration: 2000
})
}
})
},
//
previewImage(img){
previewImage(img) {
uni.previewImage({
current: 0,
indicator: "number",
loop: "true",
urls:[img]
})
},
urls: [img]
})
},
hide() {
this.productDetail = null;
},
clickToOpenDetail(item) {
this.productDetail = item;
this.$refs.popup.show();
}
}
}
</script>
<style lang="scss" scoped>
.btns {
.btns {
width: 21%;
height: 35px;
line-height: 35px;
@ -109,4 +255,43 @@
padding: 0px;
margin: 0 0 0 auto;
}
/* 弹窗 */
.pop-contain {
text-align: center;
padding-top: 50px;
background-color: #ffffff;
.pop-title {
text-align: center;
height: 50px;
line-height: 50px;
font-size: 18px;
position: fixed;
z-index: 10;
top: 0;
left: 0;
right: 0;
background: #ffffff;
}
}
.flex-wrap {
flex-wrap: wrap;
}
.titleWidth {
width: 80px;
text-align: center;
}
.minheight40 {
padding: 15px 0;
}
.minheight80 {
min-height: 80px;
line-height: 80px;
}
</style>

@ -44,7 +44,7 @@
:disable-default-padding="false" v-model.trim="productData.astrict" placeholder="请输入限制"
placeholder-class="font15" :maxlength="999"></textarea>
</view>
<view class="dis-flex marb10 bor-botm1">
<view class="dis-flex marb10 ">
<view class="group-title marRight10 fontwig6 padleft15 paddtright10 flex-s0 self-top">团购图片:
</view>
<view class="imageUploadContainer flex-1">
@ -70,7 +70,11 @@
<uni-collapse-item v-for="(item,index) in productDetailList" :key="index" :title="item.name">
<view class="content dis-flex flex-sp" v-for="(item2,index2) in item.list" :key="index2">
<view class="text">{{item2.productName}}</view>
<view class="text">{{item2.count}}</view>
<view class="dis-flex">
<view class="text">{{item2.count}}</view>
<view class="icon shanchu margle20 font16 fcorred" @click.stop="deleteGroupDetail(item2.id)"></view>
</view>
</view>
</uni-collapse-item>
</uni-collapse>
@ -89,9 +93,10 @@
<!-- 底部按钮 -->
<view class="footer-btn">
<button class="backcor89 fcorfff" @click="clickToSave" v-if="merchart!=2">保存</button>
<button v-if="(status==2&&merchart<3)||merchart==2" class="backcor89 fcorfff" @click="merchart++">下一步</button>
<view class="footer-btn backcorfff">
<view v-if="(status==2&&merchart>1)" class="height50 flex-1 fcor089 fotct" @click="merchart--">上一步</view>
<button class="backcor89 flex-1 fcorfff" @click="clickToSave" v-if="merchart!=2">保存</button>
<view v-if="(status==2&&merchart<3)||merchart==2" class="height50 flex-1 fcor089 fotct" @click="merchart++">下一步</view>
</view>
@ -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;

@ -2,7 +2,7 @@
<!-- backcorfff backcor6-->
<view class="all-container pd-main backcor6 font15">
<view class="dis-flex width100 mart10">
<button class="btns " @click.stop="clickToAdd()">新增</button>
<button class="btns icon tianjia " @click.stop="clickToAdd()">新增</button>
<button class="btns bgRed " @click.stop = "clickToDelete()">删除</button>
</view>
<view class="mart20 backcorfff">
@ -10,7 +10,7 @@
<view class="checkFlex fotct fontwig6"></view>
<view class="flex-1 fotct fontwig6">图片</view>
<next-bubble-menu class="flex-1" :d-width="200" :dataList="dataList" bingEleId="imgType" @change="getItem($event)">
<view class=" fotct fontwig6 down " id="imgType">{{imgType.imgTypeText}}</view>
<view class=" fotct fontwig6 " id="imgType">{{imgType.imgTypeText}}<text class="icon xia font14 "></text></view>
</next-bubble-menu>
<view class="flex-1 fotct fontwig6">图片状态</view>
@ -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;

@ -2,7 +2,7 @@
<!-- backcorfff backcor6-->
<view class="all-container pd-main backcor6 font15">
<view class=" width100 mart10">
<button class="btns " @click.stop="clickToAdd()">新增</button>
<button class="btns icon tianjia " @click.stop="clickToAdd()">新增</button>
</view>
<view class="mart20 backcorfff">
<view class="dis-flex height40 bor-botm1">
@ -14,7 +14,7 @@
<view class="flex-1 fotct fontwig6">操作</view>
</view>
<view class="dis-flex bor-botm1 paddtop5 paddbotm5 " v-for="(item,index) in productList" @click="cilckToShowDetail(item)" :key="index">
<view class="dis-flex bor-botm1 paddtop5 paddbotm5 fon15" v-for="(item,index) in productList" @click="cilckToShowDetail(item)" :key="index">
<view class="flex-1 fotct">
<image :src="imgUrl+item.img" @click.stop="previewImage(imgUrl+item.img)" mode="aspectFit" class="width100 height60 verc"></image>
</view>
@ -22,7 +22,7 @@
<view class="flex-1 fotct">{{item.price}}</view>
<!-- <view class="flex-1 fotct text1">{{item.spec}}</view> -->
<view class="flex-1 fotct">{{item.saleCount}}</view>
<view class="flex-1 fotct fcor41c" @click.stop="clickToEdit(item)">编辑</view>
<view class="flex-1 fotct fcor41c " @click.stop="clickToEdit(item)"><text class="icon bianji font15 fcor41c"></text>编辑</view>
</view>
</view>

@ -1,5 +1,5 @@
<template>
<view class="all-container pd-main font18 backcor6" style="padding-bottom: 60px;">
<view class="all-container pd-main font16 backcor6" style="padding-bottom: 60px;">
<view class="form-gorup backcorfff">
<view class="dis-flex marb10 bor-botm1">
<view class=" marRight10 fontwig6 padleft15 paddtright10">名称:
@ -99,7 +99,7 @@
if(!this.validate()) return;
this.productData.img = this.imgValue.join("");
this.productData.img = this.imgValue.join(",");
if(this.status==1){//1. 2.
this.insertStoreProduct()

Loading…
Cancel
Save