You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
xuan-pay-cweb/subpackages/groupBuyingConfiguration/groupProduct/groupProduct.vue

302 lines
7.7 KiB

<template>
<view class="all-container pd-main backcor6 font15">
<view class=" width100 mart10">
<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>
<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[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>
1 year ago
<view :class="'flex-1 fotct text1'+(item.status == 2 ? ' fcorred ':'')">{{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>
1 year ago
<view class="flex-1 fotct ">{{productDetail.price}}</view>
</view>
<view class="width100 dis-flex bor-botm1">
<view class=" fotct fontwig6 backcor6 titleWidth minheight40">原价</view>
1 year ago
<view class="flex-1 fotct ">{{productDetail.originalPrice}}</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>
1 year ago
<view :class="'flex-1 fotct'+(productDetail.status == 2 ? ' fcorred ':'') ">{{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>
1 year ago
<view class="flex-1 fotct ">{{productDetail.validity.replace(',',"至")}}</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,
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 {
dataList: [{
id: 1,
text: '编辑',
}, {
id: 2,
text: '上/下架',
}],
imgUrl: app.globalData.imgUrl, //图片访问地址
storeId: '', //门店id
storeGroupList: [], //门店团购列表
productDetail: null, //团购详情
}
},
onLoad(options) {
if (options.storeId) {
this.storeId = options.storeId;
}
},
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
})
},
/* 编辑操作 */
clickToEdit(item) {
let that = this;
uni.navigateTo({
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
}
uni.showLoading({
title: "加载中",
mask: true
})
getStoreGroupList(params).then(res => {
uni.hideLoading();
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) {
uni.previewImage({
current: 0,
indicator: "number",
loop: "true",
urls: [img]
})
},
hide() {
this.productDetail = null;
},
clickToOpenDetail(item) {
this.productDetail = item;
this.$refs.popup.show();
}
}
}
</script>
<style lang="scss" scoped>
.btns {
width: 21%;
height: 35px;
line-height: 35px;
background-color: #0083f5;
color: #FFFFFF;
font-weight: bold;
font-size: 12px;
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;
1 year ago
align-self: stretch;
}
.minheight40 {
padding: 15px 0;
}
.minheight80 {
min-height: 80px;
line-height: 80px;
}
</style>