会员价和分销价

version/0412
fanfan 9 months ago
parent 66ff4c6d5a
commit 0b776dd9ff
  1. 17
      api/newFun.js
  2. 4
      pages/news/user/report.vue
  3. 182
      pages/news3/components/category.vue
  4. 33
      pages/news3/components/setRange.vue
  5. 442
      pages/news3/vipPrice.vue
  6. 4
      pages/user/index.vue

@ -211,4 +211,21 @@ export const editTransfer = (param) => {
// 数据统计
export const statistics = (param) => {
return request.post('data/statistics', param)
}
// 会员分类
export const category = (param) => {
return request.post('category/list', param)
}
// 会员分类新增
export const setStorePrice = (param) => {
return request.post('store/setStorePrice', param)
}
// 会员分类xiangqing
export const getStorePriceInfo = (param) => {
return request.post('store/getStorePriceInfo', param)
}
// 会员分类编辑
export const editStore = (param) => {
return request.post('store/editStore', param)
}

@ -15,7 +15,7 @@
订单数<text>{{ orderData.orderCount}}</text>
</view>
<view class="item">
支持人数<text>{{ orderData.orderPayUser}}</text>
订单人数<text>{{ orderData.orderPayUser}}</text>
</view>
<view class="item">
总成本金额<text>¥{{ orderData.orderCostMoney}}</text>
@ -88,7 +88,7 @@
订单数<text>{{ orderData.orderCount}}</text>
</view>
<view class="item">
支持人数<text>{{ orderData.orderPayUser}}</text>
订单人数<text>{{ orderData.orderPayUser}}</text>
</view>
<view class="item">
总成本金额<text>¥{{ orderData.orderCostMoney}}</text>

@ -0,0 +1,182 @@
<template>
<view>
<u-popup v-model="afterSale" catchtouchmove='true' width="80%" border-radius="10" @close="onClose"
:closeable="true" mode="center">
<view class="afterSales">
<view class="filterTitle">
请选择分类
</view>
<view class="shopItem">
<view class="shopText" :class="{'active':activeIndex.indexOf(item.category_id) > -1}"
@click="getShop(item,item.category_id)" v-for="(item, index) in tabList" :key="index">
<text>{{ item.name }}</text>
<image v-if="activeIndex.indexOf(item.category_id) > -1"
:src="$picUrl + '/static/news1/selected.png'" mode="widthFix">
</image>
</view>
</view>
<view class="btnGroup">
<view class="reset" @click="reset">
重置
</view>
<view class="submit" @click="submit" style="margin-left:24upx;">
确定
</view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
export default {
props: {
tabList: Array, //
activeIndex: Array,
categoryId: String || Number
},
data() {
return {
afterSale: false,
category_id: '',
category_name: '',
}
},
methods: {
reset() {
this.activeIndex = []
},
getShop(item, category_id) {
let arrIndex = this.activeIndex.indexOf(category_id)
if (arrIndex > -1) {
this.activeIndex.splice(arrIndex, 1)
} else {
this.activeIndex.push(category_id)
}
console.log(this.activeIndex)
},
submit() {
let idList = [];
let nameList = []
this.tabList.forEach(item => {
if (this.activeIndex.indexOf(item.category_id) > -1) {
idList.push(item.category_id);
nameList.push(item.name)
}
});
this.$emit('getChoseCategory', {
category_id: idList.join(','),
category_name: nameList.length > 1 ? nameList.join(',') + '等' : nameList.join(',')
})
}
}
}
</script>
<style lang="scss" scoped>
.afterSales {
padding: 32upx;
.btnGroup {
margin: 40upx 0;
display: flex;
justify-content: center;
align-items: center;
.reset {
width: 216upx;
height: 70upx;
background: #E9E9E9;
border-radius: 22px 22px 22px 22px;
opacity: 1;
font-size: 28upx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #585858;
line-height: 70upx;
text-align: center;
}
.submit {
width: 216upx;
height: 70upx;
background: linear-gradient(180deg, #FD5D06 0%, #F3211A 100%);
border-radius: 50px 50px 50px 50px;
opacity: 1;
font-size: 28upx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #FFFFFF;
line-height: 70upx;
text-align: center;
}
}
.filterTitle {
font-size: 32upx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #303030;
text-align: center;
padding-bottom: 30rpx;
border-bottom: 1px solid #EAEAEA;
}
.shopItem {
margin-top: 40rpx;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
max-height: 750rpx;
overflow-y: auto;
.shopText {
width: 150upx;
height: 72upx;
background: #FFFFFF;
border-radius: 3px 3px 3px 3px;
border: 1px solid #D6D6D6;
position: relative;
margin-bottom: 24upx;
display: flex;
justify-content: center;
align-items: center;
text {
font-size: 26upx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #B6B6B6;
}
image {
position: absolute;
z-index: 9;
right: -8upx;
bottom: -8upx;
height: 0;
width: 50upx;
height: auto;
}
}
.active {
text {
color: #FF4F40;
}
border: 1px solid #FF4F40;
}
}
}
</style>

@ -1,14 +1,14 @@
<template>
<view>
<u-popup v-model="afterSale" width="80%" border-radius="10" @close="close" :closeable="true" mode="center">
<u-popup v-model="afterSale" width="80%" border-radius="10" @close="onClose" :closeable="true" mode="center">
<view class="afterSales">
<view class="filterTitle">
请设置价格区间
</view>
<view class="priceContainer">
<u-input placeholder="最低" @input="startPrice" v-model="min"></u-input>
<u-input placeholder="最低价格" @input="startPrice" v-model="min"></u-input>
<text style="margin:0 30upx;">-</text>
<u-input placeholder="最高" v-model="max"></u-input>
<u-input placeholder="最高价格" @input="endPrice" v-model="max"></u-input>
</view>
<view class="btnGroup">
<view class="reset" @click="reset">
@ -46,18 +46,29 @@
this.min = null;
this.max = null
},
close() {
onClose() {
this.min = null;
this.max = null
},
startPrice(e) {
console.log(e)
this.min = e
},
onRate(e){
console.log(e)
},
submit() {
if (!this.min) {
return this.$toast('请输入最低价格')
}
if (!this.max) {
return this.$toast('请输入最高价格')
}
if (0 >= this.min) {
this.min = null
return this.$toast('最低价格必须大于0')
}
if (0 >= this.max) {
this.max = null
return this.$toast('最高价格必须大于0')
}
if (this.min > this.max) {
this.max = null
return this.$toast('最高价格不能低于最低价格')
}
this.$emit('getprice', {
min: this.min,
max: this.max

@ -6,26 +6,33 @@
<text>利润空间(</text>
</view>
<view class="classifyContainer">
<view class="classifyItem" v-for="(item,index_1) in list" :key="index">
<view class="classifyItem" v-for="(item,index_1) in list" :key="index_1">
<view class="classTitle">
<text>{{item.name}}</text>
<u-icon name="arrow-right" color="#292929" size="28"></u-icon>
<view class="category_box" @click="onCategory(item.category,index_1)">
<text class="maxWith">{{item.category_name?item.category_name:'请选择分类'}}</text>
<u-icon name="arrow-right" color="#292929" size="28"></u-icon>
</view>
<view class="category" style="padding: 0;">
<view class="rangeHandle" v-if="list.length>1" @click="delCatego(index_1,2)">
<view class="delBtn">-</view>
<text>删除分类</text>
</view>
</view>
</view>
<view class="priceRange">
<view class="rangeItem" v-for="(val,index_2) in item.children" :key="i">
<view class="rangeItem" v-for="(val,index_2) in item.price_list" :key="index_2">
<view class="rangeInput" @click="setUp(index_1,index_2)">
<text v-if="val.startPrice>=0 && val.endPrice>0 ">
<text>0</text> - <text>100</text>
<text v-if="val. min>=0 && val.max>0 ">
<text>{{val. min}}</text> - <text>{{val.max}}</text>
</text>
<text v-else style="color: #8F8F8F;">请设置</text>
</view>
<view class="rangeInput fix">
<input type="text" style="border: none;" @input="onRate($event,index_1,index_2)"
placeholder="请设置" v-model="val.rate" />
<text style="margin-right: 15rpx;">%</text>
<input type="text" :min="5" style="border: none;" @input="onRate($event,index_1,index_2)"
placeholder="请设置" v-model="val.add_price_rate" />
</view>
<view class="profit">
<text>{{val.startProfit}}</text> - <text>{{val.endProfit}}</text>
<text>{{val.startProfit}}</text> - <text>{{val.endProfit}}</text>
</view>
</view>
@ -41,96 +48,308 @@
</view>
</view>
</view>
<view class="category">
<view class="rangeHandle" @click="addCatego(list.length)">
<view class="addFlag">+</view>
<text>新增分类模板</text>
</view>
<view class="rangeHandle" @click="delCatego('',1)" style="border-left:1px solid #E2E2E2;">
<view class="delBtn">-</view>
<text>删除分类模板</text>
</view>
</view>
</view>
<view class="price-fd">
<view class="btn" @click="onSubmit">提交</view>
</view>
<setRange ref="setRange" @getprice="getprice"></setRange>
<category ref="category" :tabList='categoryList' @getChoseCategory="getChoseCategory"
:activeIndex='activeIndex'></category>
</view>
</template>
<script>
category
import * as newFunApi from '@/api/newFun'
import setRange from './components/setRange.vue'
import category from './components/category.vue'
export default {
components: {
setRange
setRange,
category
},
data() {
return {
activeIndex: [],
categoryIndex: '',
index_1: '',
index_2: '',
list: [{
name: '一级分类名称',
children: [{
startPrice: null,
endPrice: null,
rate: null,
startProfit: null,
endProfit: null
}]
},
{
name: '二级分类名称',
children: [{
startPrice: null,
endPrice: null,
rate: null,
startProfit: null,
endProfit: null
}]
},
{
name: '三级分类名称',
children: [{
startPrice: null,
endPrice: null,
rate: null,
startProfit: null,
endProfit: null
}]
},
]
list: [],
categoryList: '',
type: '',
isEdit: false
}
},
onLoad(op) {
this.type = op.type
this.getCategory()
},
methods: {
//
async getInfor() {
let {
status,
message,
data
} = await newFunApi.getStorePriceInfo({
type: this.type
});
if (status == 200) {
if (data.list.length > 0) {
this.isEdit = true
data.list.forEach((item_1, index_1) => {
let arr = item_1.category.split(",").map(item => Number(item))
let name = this.categoryList.filter(function(obj) {
return arr.some(function(item) {
return item === obj.category_id;
});
}).map(function(obj) {
return obj.name;
});
item_1.category_name = name.join(',')
item_1.price_list.forEach((item_2, index_2) => {
item_2.startProfit = (Number(item_2.min) * (Number(item_2
.add_price_rate) / 100)).toFixed(2);
item_2.endProfit = (Number(item_2.max) * (Number(item_2
.add_price_rate) / 100)).toFixed(2);
})
})
this.list = data.list
} else {
this.isEdit = false
}
}
},
//
async onSubmit() {
let that = this
let step = 0;
let list = this.list
console.log(list)
list.forEach((item, index) => {
if (!item.category_name) {
step++
let name = "请选择第" + (index + 1) + '行分类'
uni.showToast({
title: name,
duration: 3000,
icon: 'none'
});
return
}
if (item.price_list.length > 0) {
item.price_list.forEach((item_1, index_1) => {
if (!item_1.min) {
step++
let name = "请完善" + item.category_name + "第" + (index_1 + 1) +
'行分类的最低价格'
uni.showToast({
title: name,
duration: 3000,
icon: 'none'
});
return
}
if (!item_1.max) {
step++
let name = "请完善" + item.category_name + "第" + (index_1 + 1) +
'行分类的最高价格'
uni.showToast({
title: name,
duration: 3000,
icon: 'none'
});
return
}
if (!item_1.add_price_rate) {
step++
let name = "请完善" + item.category_name + "第" + (index_1 + 1) +
'行分类的会员加价率'
uni.showToast({
title: name,
duration: 3000,
icon: 'none'
});
return
}
});
} else {
step++
let name = "请新增第" + (index + 1) + '行的价格区间'
uni.showToast({
title: name,
duration: 3000,
icon: 'none'
});
return
}
});
if (step == 0) {
list.forEach((item, index) => {
delete item.category_name
list.forEach((item_1, index) => {
delete item_1.endProfit
delete item_1.startProfit
})
})
let url = ''
if (this.isEdit) {
url = newFunApi.editStore({
list: list,
type: this.type
})
} else {
url = newFunApi.setStorePrice({
list: list,
type: this.type
})
}
let {
status,
message,
data
} = await url;
if (status == 200) {
uni.showToast({
title: "保存成功"
})
this.getCategory()
}
}
},
//
async getCategory() {
let {
status,
message,
data
} = await newFunApi.category();
this.categoryList = data.list
this.list = []
this.list.push({
category_name: '',
category: '',
price_list: [],
})
this.getInfor()
},
//
onRate(e, index_1, index_2) {
let rate = Number(e.detail.value)
this.list[this.index_1].children[this.index_2].startProfit = Number((this.list[this.index_1].children[this
if (5 > rate) {
this.list[this.index_1].price_list[this.index_2].add_price_rate = ''
return this.$toast('最低利率不能低于5%')
}
this.list[this.index_1].price_list[this.index_2].startProfit = Number((this.list[this.index_1].price_list[
this
.index_2]
.startPrice * (rate / 100)).toFixed(2))
this.list[this.index_1].children[this.index_2].endProfit = Number((this.list[this.index_1].children[this
.min * (rate / 100)).toFixed(2))
this.list[this.index_1].price_list[this.index_2].endProfit = Number((this.list[this.index_1].price_list[
this
.index_2]
.endPrice * (rate / 100)).toFixed(2))
this.list[this.index_1].children[this.index_2].rate = rate
console.log(this.list)
.max * (rate / 100)).toFixed(2))
this.list[this.index_1].price_list[this.index_2].add_price_rate = rate
},
//
getprice(res) {
this.list[this.index_1].children[this.index_2].startPrice = Number(res.min)
this.list[this.index_1].children[this.index_2].endPrice = Number(res.max)
this.$forceUpdate(this.list)
this.list[this.index_1].price_list[this.index_2].min = Number(res.min)
this.list[this.index_1].price_list[this.index_2].max = Number(res.max)
this.$refs.setRange.afterSale = false;
},
//
addHandle(index_1) {
this.list[index_1].children.push({
startPrice: null,
endPrice: null,
rate: null,
startProfit: null,
endProfit: null
})
this.index_2 = this.list[index_1].children;
this.$refs.setRange.afterSale = true;
if (this.list[index_1].price_list.length > 19) {
return this.$toast('最多可新增20条')
} else {
this.list[index_1].price_list.push({
min: null,
max: null,
add_price_rate: null,
startProfit: null,
endProfit: null
})
this.index_1 = index_1
this.index_2 = this.list[index_1].price_list.length - 1;
this.$refs.setRange.afterSale = true;
}
},
//
setUp(index_1, index_2) {
this.index_1 = index_1;
this.index_2 = index_2;
this.$refs.setRange.afterSale = true;
},
//
delHandle(item) {
if (item.children.length > 1) {
item.children.pop()
if (item.price_list.length == 0) {
return this.$toast('暂无可删除的价格区间')
}
item.price_list.pop()
},
//
onCategory(categoryId, index) {
this.categoryIndex = index;
this.activeIndex = [];
// let newId = []
// this.list.forEach((item, index) => {
// if (item.category) {
// newId.push(item.category.split(",").map(item => Number(item)))
// }
// })
// console.log(newId)
// this.activeIndex = newId
if (typeof categoryId == 'number') {} else {
let arr = categoryId.split(",")
this.activeIndex = arr.map(item => Number(item));
}
console.log(this.activeIndex)
// if (newId.length > 0) {
this.$refs.category.afterSale = true;
// }
},
//
getChoseCategory(res) {
this.$refs.category.afterSale = false;
this.list[this.categoryIndex].category_name = res.category_name;
this.list[this.categoryIndex].category = res.category_id
},
//
addCatego(index) {
if (this.list > 19) {
return this.$toast('暂无可新增的分类模块')
}
this.list.push({
category_name: '',
category: '',
price_list: [],
})
},
//
delCatego(index, type) {
if (this.list.length == 1) {
return this.$toast('暂无可删除的分类模块')
}
if (type == 1) {
this.list.pop()
} else {
this.list.splice(index, 1)
}
},
}
}
</script>
@ -142,7 +361,7 @@
}
::v-deep .uni-input-wrapper {
width: 160rpx !important;
width: 180rpx !important;
text-align: center !important;
height: 70rpx !important;
}
@ -152,6 +371,18 @@
font-size: 28rpx;
}
.category_box {
display: flex;
.maxWith {
max-width: 400rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: block;
}
}
.vipInfo {
.msg {
background: #FFE7E7;
@ -173,13 +404,17 @@
}
.classifyContainer {
padding-bottom: 200rpx;
.classifyItem {
padding: 36upx 56upx;
background-color: #fff;
margin-bottom: 14upx;
.classTitle {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 28upx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
@ -205,7 +440,7 @@
border-radius: 4rpx;
border: 2rpx solid #DADADA;
text-align: center;
line-height: 74rpx;
line-height: 66rpx;
margin-right: 50rpx;
text {
@ -232,9 +467,11 @@
}
.profit {
min-width: 180rpx;
border: none !important;
background: transparent !important;
line-height: 70rpx;
text-align: center;
::v-deep .uni-input-placeholder {
display: none;
@ -290,4 +527,73 @@
}
}
}
.category {
display: flex;
align-items: center;
padding: 40rpx 0;
.rangeHandle {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
margin-right: 20rpx;
.addFlag {
width: 30upx;
height: 30upx;
background: #FF6551;
border-radius: 50%;
color: #fff;
line-height: 26upx;
text-align: center;
opacity: 1;
}
.delBtn {
width: 30upx;
height: 30upx;
line-height: 26upx;
text-align: center;
background: #BDBDBD;
border-radius: 50%;
color: #fff;
opacity: 1;
}
text {
font-size: 24upx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #3B3B3B;
margin-left: 10upx;
}
}
}
.price-fd {
width: 100%;
position: fixed;
left: 0;
bottom: 0;
padding: 0.9375rem;
z-index: 99;
background-color: #fafafa;
box-sizing: border-box;
.btn {
width: 630rpx;
line-height: 88rpx;
background: #F34A40;
border-radius: 88rpx;
text-align: center;
font-size: 28rpx;
font-weight: 500;
color: #FFFFFF;
margin: auto;
}
}
</style>

@ -419,14 +419,14 @@
物流查询
</view>
</view>
<view class="serveIcon" @click="goJump('/pages/news3/vipPrice?type=1')"
<view class="serveIcon" @click="goJump('/pages/news3/vipPrice?type=0')"
v-if="userInfo.user_type == 40">
<image :src="$picUrl+'/static/user/member.png'" class="icons"></image>
<view class="serveInfo">
会员价
</view>
</view>
<view class="serveIcon" @click="goJump('/pages/news3/vipPrice?type=2')"
<view class="serveIcon" @click="goJump('/pages/news3/vipPrice?type=1')"
v-if="userInfo.user_type == 40">
<image :src="$picUrl+'/static/user/retail.png'" class="icons"></image>
<view class="serveInfo">

Loading…
Cancel
Save