分销会员价的逻辑调整

master
fanfan 8 months ago
parent a5025ea9c4
commit a1967a046a
  1. 21692
      package-lock.json
  2. 4
      src/config/router.config.js
  3. 217
      src/views/goods/distributionPrice/Index.vue
  4. 81
      src/views/goods/filter/Index.vue
  5. 217
      src/views/goods/memberPrice/Index.vue
  6. 10
      src/views/store/Setting.vue

21692
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -361,8 +361,8 @@ export const asyncRouterMap = [
path: '/goods/filter/index', path: '/goods/filter/index',
component: () => import(/* webpackChunkName: "goods" */ '@/views/goods/filter/Index'), component: () => import(/* webpackChunkName: "goods" */ '@/views/goods/filter/Index'),
meta: { meta: {
title: '数据过滤', title: '数据渠道',
pageTitle: '数据过滤', pageTitle: '数据渠道',
keepAlive: false, keepAlive: false,
permission: ['/goods/filter/index'], permission: ['/goods/filter/index'],
}, },

@ -3,61 +3,61 @@
<div class="card-title">{{ $route.meta.title }}</div> <div class="card-title">{{ $route.meta.title }}</div>
<a-spin :spinning="isLoading"> <a-spin :spinning="isLoading">
<a-form :form="form" @submit="handleSubmit"> <a-form :form="form" @submit="handleSubmit">
<div style="width:1000px">
<a-form-item v-bind="formItemLayoutWithOutLabel"> <a-form-item v-bind="formItemLayoutWithOutLabel">
<div class="msg"> <div class="msg">
<span>价格区间()</span> <span>价格区间()</span>
<span>分销加价率%</span> <span>分销加价率%</span>
<span>利润空间()</span> <span>利润空间()</span>
</div> </div>
<div class="ruleText"><span class="ruleTitle">分销说明</span>A.当加价率生效后分销价高于市场价分销价统一自动按以下标准执行
市场价-成本价x_____% +成本价=分销价 _____%为此时的加价率
B.当加价率生效后分销价高于会员价分销价进一步统一自动按以下标准执行会员价-成本价x_____% +成本价=分销价 _____%为此时的加价率</div>
</a-form-item> </a-form-item>
<a-modal v-model:visible="setPriceVisible" width="450px" title="利润值" @ok="handleBatchPrice(index_1, index_2, mixPrice, maxPrice)">
<div class="fen" style="margin-top: -10px">
<input placeholder="最大利润值" style="margin-right: 25px" v-model="mixPrice" class="input" type="text" />
<input placeholder="最小利润值" v-model="maxPrice" class="input" type="text" />
</div>
<div class="setRule">
<div class="ruleTitle">设置规则</div>
<div class="ruleText">
A.当加价率生效后会员价高于市场价会员价统一自动按以下标准执行 市场价-成本价x_____% +成本价=会员价
_____%为此时的加价率 利润低于_____元的商品不展示在商城里
</div>
</div>
</a-modal>
<a-form-item v-bind="formItemLayoutWithOutLabel"> <a-form-item v-bind="formItemLayoutWithOutLabel">
<a-button type="dashed" style="width: calc(43.5% + 8px); margin-right: 50px" @click="handleAddCondition"> <div style="width: 100%;">
<a-icon type="plus-circle" /> 新增分类模版 </a-button><a-button type="dashed" style="width: calc(44.5% + 8px)" @click="handleRemoveCondition"> <a-button type="dashed" style="width: 100%" @click="handleAddCondition">
<a-icon type="minus-circle-o" /> 删除分类模版 <a-icon type="plus-circle" /> 新增分类模版 </a-button>
</a-button> </div>
</a-form-item> </a-form-item>
<a-form-item v-for="(k, index) in form.getFieldValue('list')" :key="k.id" :label="index === 0 ? '分销模版' : ''" :labelCol="labelCol" v-bind="index === 0 ? { wrapperCol } : formItemLayoutWithOutLabel" required> <a-form-item v-for="(k, index) in form.getFieldValue('list')" :key="k.id" :label="index === 0 ? '分销模版' : ''" :labelCol="labelCol" v-bind="index === 0 ? { wrapperCol } : formItemLayoutWithOutLabel" required>
<a-tree-select style="width: 100%; margin-right: 8px; margin-top: 3px" placeholder="请选择商品分类" :dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }" :treeData="formData.categoryList" treeCheckable allowClear treeCheckStrictly <div style="width: 100%;display: flex;align-items: center;justify-content: space-between">
@select="onSelect(index, $event)" @focus="handleSelectChange(index)" v-decorator="[`category${k.id}`]"></a-tree-select> <div style="width: 700px;">
<a-tree-select style="width: 100%; margin-right: 8px; margin-top: 3px" placeholder="请选择商品分类" :dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }" :treeData="formData.categoryList" treeCheckable allowClear
treeCheckStrictly @select="onSelect(index, $event)" @focus="handleSelectChange(index)" v-decorator="[`category${k.id}`]"></a-tree-select>
<div style="width: 100%"> <div style="width: 100%">
<div class="fan" v-for="(m, index2) in k.price_list" :key="m.id"> <div class="fan" v-for="(m, index2) in k.price_list" :key="m.id">
<a-form-item style="margin-right: 15px; width: 33%; cursor: pointer"> <a-form-item style="margin-right: 15px; width: 47%; cursor: pointer">
<div class="inMax" @click="setPrice(index, index2,m.min,m.max)"> <div class="inMax">
<span v-if="m.min && m.max">{{ m.min }} ~ {{ m.max }}</span><span style="color: #d9d9d9" v-else>利润值</span> <input placeholder="最小利润值" @blur="onPrice($event, index, index2)" v-model="m.min" class="input" type="text" />
~<input placeholder="最大利润值" @blur="onPrice($event, index, index2)" v-model="m.max" class="input" type="text" />
<div class="yuan"></div> <div class="yuan"></div>
</div> </div>
</a-form-item> </a-form-item>
<a-form-item style="margin-right: 15px; width: 33%"> <a-form-item style="margin-right: 15px; width: 23%">
<a-input placeholder="利润率" @input="onRate($event, index, index2)" suffix="%" v-model="m.add_price_rate" style="width: 100%; margin-right: 8px; text-align: center" /> <a-input placeholder="利润率" @input="onRate($event, index, index2)" suffix="%" v-model="m.add_price_rate" style="width: 100%; margin-right: 8px; text-align: center" />
</a-form-item> </a-form-item>
<div style="width: 33%; text-align: center"> <div style="width: 30%; text-align: center">
<span>{{ m.startProfit }}</span> ~ <span>{{ m.endProfit }}</span> <span>{{ m.startProfit }}</span> ~ <span>{{ m.endProfit }}</span>
</div> </div>
<a-button type="dashed" style="width: 120px" @click="handleRemovePriceRate(index,index2)">
<a-icon type="minus-circle-o" /> 删除价格区间</a-button>
</div> </div>
<div style="width: 100%"> <div style="width: 100%">
<a-button type="dashed" style="width: calc(40% + 8px); margin-right: 50px" @click="handleAddPriceRate(index)"> <a-button type="dashed" style="width: 100%; margin-right: 50px" @click="handleAddPriceRate(index)">
<a-icon type="plus-circle" /> 新增价格区间 </a-button><a-button type="dashed" style="width: calc(40% + 8px)" @click="handleRemovePriceRate(index)"> <a-icon type="plus-circle" /> 新增价格区间 </a-button>
<a-icon type="minus-circle-o" /> 删除价格区间 </div>
</a-button>
</div> </div>
</div> </div>
<a-button type="dashed" style="width: 120px;margin-left: 20px;" @click="handleRemoveCondition(index)">
<a-icon type="minus-circle-o" /> 删除分类模版
</a-button>
</div>
</a-form-item> </a-form-item>
<a-form-item :wrapperCol="{ span: wrapperCol.span, offset: labelCol.span }"> <a-form-item :wrapperCol="{ span: wrapperCol.span, offset: labelCol.span }">
<a-button type="primary" html-type="submit">提交</a-button> <a-button type="primary" html-type="submit">提交</a-button>
</a-form-item> </a-form-item>
</div>
</a-form> </a-form>
</a-spin> </a-spin>
</a-card> </a-card>
@ -87,11 +87,6 @@ export default {
formItemLayoutWithOutLabel: { formItemLayoutWithOutLabel: {
wrapperCol: { span: 10, offset: 3 }, wrapperCol: { span: 10, offset: 3 },
}, },
setPriceVisible: false,
index_1: '',
index_2: '',
mixPrice: '',
maxPrice: '',
} }
}, },
// //
@ -107,6 +102,50 @@ export default {
this.getDetail() this.getDetail()
}, },
methods: { methods: {
onPrice(e, index_1, index_2, type) {
const { form } = this
const list = form.getFieldValue('list')
if (0 >= list[index_1].price_list[index_2].min) {
list[index_1].price_list[index_2].min = null
this.$message.warning('最小利润值必须大于0', 1.5)
list[index_1].price_list[index_2].startProfit = 0
list[index_1].price_list[index_2].endProfit = 0
return
}
if (0 >= list[index_1].price_list[index_2].max) {
list[index_1].price_list[index_2].max = null
this.$message.warning('最大利润值必须大于0', 1.5)
list[index_1].price_list[index_2].startProfit = 0
list[index_1].price_list[index_2].endProfit = 0
return
}
if (list[index_1].price_list[index_2].min > list[index_1].price_list[index_2].max) {
list[index_1].price_list[index_2].max = null
this.$message.warning('最大利润值不能低于最小利润值', 1.5)
list[index_1].price_list[index_2].startProfit = 0
list[index_1].price_list[index_2].endProfit = 0
return
}
if (!list[index_1].price_list[index_2].min || !list[index_1].price_list[index_2].max || !list[index_1].price_list[index_2].add_price_rate) {
list[index_1].price_list[index_2].startProfit = 0
list[index_1].price_list[index_2].endProfit = 0
return
}
if (list[index_1].price_list[index_2].min && list[index_1].price_list[index_2].max) {
let rate = Number(list[index_1].price_list[index_2].add_price_rate)
list[index_1].price_list[index_2].startProfit = Number(
(list[index_1].price_list[index_2].min * (rate / 100)).toFixed(2)
)
list[index_1].price_list[index_2].endProfit = Number(
(list[index_1].price_list[index_2].max * (rate / 100)).toFixed(2)
)
list[index_1].price_list[index_2].add_price_rate = rate
form.setFieldsValue({
list: list,
})
this.$forceUpdate()
}
},
// //
onRate(e, index_1, index_2) { onRate(e, index_1, index_2) {
const { form } = this const { form } = this
@ -136,49 +175,6 @@ export default {
}) })
this.$forceUpdate() this.$forceUpdate()
}, },
handleBatchPrice(index1, index2, min, max) {
const { form } = this
if (!this.mixPrice) {
this.$message.warning('请输入最低价格', 1.5)
} else if (!this.maxPrice) {
this.$message.warning('请输入最高价格', 1.5)
} else if (0 >= this.mixPrice) {
this.mixPrice = null
this.$message.warning('最低价格必须大于0', 1.5)
} else if (0 >= this.maxPrice) {
this.maxPrice = null
this.$message.warning('最高价格必须大于0', 1.5)
} else if (this.mixPrice > this.maxPrice) {
this.maxPrice = null
this.$message.warning('最高价格不能低于最低价格', 1.5)
} else {
const condition = form.getFieldValue('list')
condition.forEach(function (item, k) {
if (k == index1) {
item.price_list.forEach(function (item1, j) {
if (j == index2) {
item1.min = min
item1.max = max
}
})
}
})
form.setFieldsValue({
list: condition,
})
this.$forceUpdate()
this.setPriceVisible = false;
this.mixPrice = '';
this.maxPrice = ''
}
},
setPrice(index1, index2, min, max) {
this.index_1 = index1
this.index_2 = index2
this.mixPrice = min;
this.maxPrice = max
this.setPriceVisible = true
},
onSelect(index, event) { onSelect(index, event) {
const { form, $nextTick } = this const { form, $nextTick } = this
const key = form.getFieldValue('list') const key = form.getFieldValue('list')
@ -198,7 +194,6 @@ export default {
let that = this let that = this
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
nodes[i].disabled = false nodes[i].disabled = false
console.log(nodes[i].value, ids)
if (ids.includes(nodes[i].value) == true) { if (ids.includes(nodes[i].value) == true) {
nodes[i].disabled = true nodes[i].disabled = true
} }
@ -222,7 +217,6 @@ export default {
} }
$nextTick(() => { $nextTick(() => {
this.formData.categoryList = this.deleteNodeById(this.formData.categoryList, category) this.formData.categoryList = this.deleteNodeById(this.formData.categoryList, category)
console.log(this.deleteNodeById(this.formData.categoryList, category))
this.formData = this.formData this.formData = this.formData
this.$forceUpdate() this.$forceUpdate()
}) })
@ -231,11 +225,7 @@ export default {
handleRemoveCondition(index) { handleRemoveCondition(index) {
const { form } = this const { form } = this
const keys = form.getFieldValue('list') const keys = form.getFieldValue('list')
if (keys.length === 0) { keys.splice(index, 1) // 1
this.$message.warning('暂无可删除的分类模版', 1.5)
return
}
keys.pop()
form.setFieldsValue({ form.setFieldsValue({
list: keys, list: keys,
}) })
@ -252,22 +242,12 @@ export default {
}) })
}, },
// //
handleRemovePriceRate(index) { handleRemovePriceRate(index1, index2) {
const { form } = this const { form } = this
const priceList = form.getFieldValue('list')[index].price_list const priceList = form.getFieldValue('list')
if (priceList.length === 0) { priceList[index1].price_list.splice(index2, 1) // 1
this.$message.warning('暂无可删除的价格区间', 1.5)
return
}
priceList.pop()
const conditionList = form.getFieldValue('list')
conditionList.forEach(function (item, mm) {
if (mm == index) {
item.price_list = priceList
}
})
form.setFieldsValue({ form.setFieldsValue({
list: conditionList, list: priceList,
}) })
this.$forceUpdate() this.$forceUpdate()
}, },
@ -312,6 +292,12 @@ export default {
return { value: id } return { value: id }
}) })
}, },
convertToString(value) {
if (typeof value == 'number') {
return String(value);
}
return value;
},
// //
setFieldsValue() { setFieldsValue() {
const { record, form, $nextTick } = this const { record, form, $nextTick } = this
@ -322,10 +308,10 @@ export default {
return x return x
}) })
record.list.forEach((x, i) => { record.list.forEach((x, i) => {
record[`category${x.id}`] = this.formatCategoryIds(x.category.split(',')) record[`category${x.id}`] = this.formatCategoryIds((this.convertToString(x.category)).split(','))
categoryAry.push(`category${x.id}`) categoryAry.push(`category${x.id}`)
this.form.getFieldDecorator(`category${x.id}`, { initialValue: '', preserve: true }) this.form.getFieldDecorator(`category${x.id}`, { initialValue: '', preserve: true })
x.category = x.category.split(',') x.category = (this.convertToString(x.category)).split(',')
x.price_list.forEach((m, j) => { x.price_list.forEach((m, j) => {
m.startProfit = Number((m.min * (Number(m.add_price_rate) / 100)).toFixed(2)) m.startProfit = Number((m.min * (Number(m.add_price_rate) / 100)).toFixed(2))
m.endProfit = Number((m.max * (Number(m.add_price_rate) / 100)).toFixed(2)) m.endProfit = Number((m.max * (Number(m.add_price_rate) / 100)).toFixed(2))
@ -466,6 +452,9 @@ export default {
/deep/.ant-input-prefix { /deep/.ant-input-prefix {
font-weight: bold; font-weight: bold;
} }
/deep/.ant-col-10 {
width: 80%;
}
.fan { .fan {
display: flex; display: flex;
align-items: top; align-items: top;
@ -501,20 +490,20 @@ export default {
} }
.setRule { .setRule {
margin-top: 20px; margin-top: 20px;
.ruleTitle { }
.ruleTitle {
font-size: 14px; font-size: 14px;
font-family: PingFang SC, PingFang SC; font-family: PingFang SC, PingFang SC;
font-weight: 500; font-weight: 500;
color: #303030; color: #303030;
} }
.ruleText { .ruleText {
margin-top: 8px; margin-top: 8px;
font-size: 14px; font-size: 14px;
font-family: PingFang SC, PingFang SC; font-family: PingFang SC, PingFang SC;
font-weight: 400; font-weight: 400;
color: #8b8b8b; color: #8b8b8b;
line-height: 32px; line-height: 32px;
}
} }
.inMax { .inMax {
width: 100%; width: 100%;
@ -525,21 +514,35 @@ export default {
list-style: none; list-style: none;
display: inline-block; display: inline-block;
width: 100%; width: 100%;
height: 30px; height: 32px;
padding: 4px 11px; padding: 0 26px 0 0;
color: rgba(0, 0, 0, 0.65); color: rgba(0, 0, 0, 0.65);
font-size: 13px; font-size: 13px;
line-height: 1.8; line-height: 32px;
background-color: #fff; background-color: #fff;
background-image: none; background-image: none;
border: 1px solid #d9d9d9; border: 1px solid #d9d9d9;
border-radius: 2px; border-radius: 2px;
-webkit-transition: all 0.3s; -webkit-transition: all 0.3s;
transition: all 0.3s; transition: all 0.3s;
input {
border: none;
width: 45%;
margin: 0;
height: 100%;
text-align: center;
}
input:focus {
outline: none;
border: none;
}
input::-webkit-input-placeholder {
color: #bfbfbf;
}
.yuan { .yuan {
position: absolute; position: absolute;
right: 10px; right: 10px;
top: 2px; top: 0px;
} }
} }
</style> </style>

@ -3,78 +3,37 @@
<div class="card-title">{{ $route.meta.title }}</div> <div class="card-title">{{ $route.meta.title }}</div>
<a-spin :spinning="isLoading"> <a-spin :spinning="isLoading">
<a-form :form="form" @submit="handleSubmit"> <a-form :form="form" @submit="handleSubmit">
<a-form-item label="数据渠道" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="选择渠道" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select <a-select v-decorator="[`open_channel`]" allowClear mode="multiple" @change="getChannel" placeholder="请选择渠道">
v-decorator="[`open_channel`]"
allowClear
mode="multiple"
@change="getChannel"
placeholder="请选择渠道"
>
<a-select-option :value="item.id" v-for="item in checkList" :key="item.id"> <a-select-option :value="item.id" v-for="item in checkList" :key="item.id">
{{ item.name }} {{ item.name }}
</a-select-option> </a-select-option>
</a-select> </a-select>
<div style="color: rgba(0, 0, 0, 0.45); font-size: 12.5px; line-height: 20px"> <div style="color: rgba(0, 0, 0, 0.45); font-size: 12.5px; line-height: 20px">
数据渠道未选择时则代表所有渠道 渠道未选择时则代表所有渠道
</div> </div>
</a-form-item> </a-form-item>
<!-- {{form.getFieldValue('fliter_condition')}} --> <!-- {{form.getFieldValue('fliter_condition')}} -->
<a-form-item <a-form-item v-for="(k, index) in form.getFieldValue('fliter_condition')" :key="k.id" :label="index === 0 ? '筛选条件' : ''" :labelCol="labelCol" v-bind="index === 0 ? { wrapperCol } : formItemLayoutWithOutLabel" required>
v-for="(k, index) in form.getFieldValue('fliter_condition')"
:key="k.id"
:label="index === 0 ? '过滤数据' : ''"
:labelCol="labelCol"
v-bind="index === 0 ? { wrapperCol } : formItemLayoutWithOutLabel"
required
>
<div class="fan"> <div class="fan">
<a-tree-select <a-tree-select :key="k.id" style="width: 100%; margin-right: 8px; margin-top: 3px" placeholder="请选择商品分类" :dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }" :treeData="formData.categoryList" treeCheckable checkStrictly
:key="k.id" allowClear showCheckedStrategy="SHOW_ALL" @change="onChange(k.id, $event)" @select="onSelect(index, $event)" @focus="handleSelectChange(index)"
style="width: 100%; margin-right: 8px; margin-top: 3px" v-decorator="[`category${k.id}`, { rules: [{ required: true, message: '请至少选择1个商品分类' }] }]"></a-tree-select>
placeholder="请选择商品分类"
:dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }"
:treeData="formData.categoryList"
treeCheckable
allowClear
showCheckedStrategy="SHOW_ALL"
@select="onSelect(index, $event)"
@focus="handleSelectChange(index)"
v-decorator="[`category${k.id}`, { rules: [{ required: true, message: '请至少选择1个商品分类' }] }]"
></a-tree-select>
<a-form-item> <a-form-item>
<a-input <a-input placeholder="利润值" prefix=">" suffix="元" v-decorator="[`profit${k.id}`, { rules: [{ required: true, message: '请输入利润值' }] }]" style="width: 94%; margin-right: 8px" />
placeholder="利润值"
prefix=">"
suffix="元"
v-decorator="[`profit${k.id}`, { rules: [{ required: true, message: '请输入利润值' }] }]"
style="width: 94%; margin-right: 8px"
/>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-input <a-input placeholder="利润率" prefix=">" suffix="%" v-decorator="[`profit_rate${k.id}`, { rules: [{ required: true, message: '请输入利润率' }] }]" style="width: 94%; margin-right: 8px" />
placeholder="利润率"
prefix=">"
suffix="%"
v-decorator="[`profit_rate${k.id}`, { rules: [{ required: true, message: '请输入利润率' }] }]"
style="width: 94%; margin-right: 8px"
/>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-icon <a-icon style="margin-top: 30rpx" v-if="form.getFieldValue('fliter_condition').length > 0" class="dynamic-delete-button" type="minus-circle-o" :disabled="form.getFieldValue('fliter_condition').length === 1"
style="margin-top: 30rpx" @click="() => handleRemoveCondition(index)" />
v-if="form.getFieldValue('fliter_condition').length > 0"
class="dynamic-delete-button"
type="minus-circle-o"
:disabled="form.getFieldValue('fliter_condition').length === 1"
@click="() => handleRemoveCondition(index)"
/>
</a-form-item> </a-form-item>
</div> </div>
</a-form-item> </a-form-item>
<a-form-item v-bind="formItemLayoutWithOutLabel"> <a-form-item v-bind="formItemLayoutWithOutLabel">
<a-button type="dashed" style="width: calc(50% + 8px)" @click="handleAddCondition"> <a-button type="dashed" style="width: calc(50% + 8px)" @click="handleAddCondition">
<a-icon type="plus" /> 新增过滤数据 <a-icon type="plus" /> 新增筛选条件
</a-button> </a-button>
</a-form-item> </a-form-item>
<a-form-item :wrapperCol="{ span: wrapperCol.span, offset: labelCol.span }"> <a-form-item :wrapperCol="{ span: wrapperCol.span, offset: labelCol.span }">
@ -124,6 +83,9 @@ export default {
this.getDetail() this.getDetail()
}, },
methods: { methods: {
onChange(id, event) {
console.log(id, event)
},
onSelect(index, event) { onSelect(index, event) {
const { form, $nextTick } = this const { form, $nextTick } = this
const key = form.getFieldValue('fliter_condition') const key = form.getFieldValue('fliter_condition')
@ -265,6 +227,12 @@ export default {
return { value: id } return { value: id }
}) })
}, },
convertToString(value) {
if (typeof value == 'number') {
return String(value);
}
return value;
},
// //
getDetail() { getDetail() {
this.isLoading = true this.isLoading = true
@ -272,7 +240,7 @@ export default {
.then((result) => { .then((result) => {
// //
result.data.storeInfo.open_channel = result.data.storeInfo.open_channel result.data.storeInfo.open_channel = result.data.storeInfo.open_channel
? result.data.storeInfo.open_channel.split(',') ? this.convertToString(result.data.storeInfo.open_channel).split(',')
: undefined : undefined
this.record = result.data.storeInfo this.record = result.data.storeInfo
// //
@ -298,8 +266,8 @@ export default {
// api // api
onFormSubmit(values) { onFormSubmit(values) {
const params = {} const params = {}
if (values.fliter_condition) {
params.fliter_condition = values.fliter_condition.map((x, i) => { params.fliter_condition = values.fliter_condition.map((x, i) => {
return { return {
category: values[`category${x.id}`], category: values[`category${x.id}`],
@ -307,6 +275,9 @@ export default {
profit_rate: values[`profit_rate${x.id}`], profit_rate: values[`profit_rate${x.id}`],
} }
}) })
} else {
params.fliter_condition = []
}
// if (params.fliter_condition.length > 0) { // if (params.fliter_condition.length > 0) {
// params.fliter_condition.forEach((item) => { // params.fliter_condition.forEach((item) => {
// item.category = Array.from(item.category, ({ value }) => value) // item.category = Array.from(item.category, ({ value }) => value)

@ -3,61 +3,60 @@
<div class="card-title">{{ $route.meta.title }}</div> <div class="card-title">{{ $route.meta.title }}</div>
<a-spin :spinning="isLoading"> <a-spin :spinning="isLoading">
<a-form :form="form" @submit="handleSubmit"> <a-form :form="form" @submit="handleSubmit">
<div style="width:1000px">
<a-form-item v-bind="formItemLayoutWithOutLabel"> <a-form-item v-bind="formItemLayoutWithOutLabel">
<div class="msg"> <div class="msg">
<span>价格区间()</span> <span>价格区间()</span>
<span>会员加价率%</span> <span>会员加价率%</span>
<span>利润空间()</span> <span>利润空间()</span>
</div> </div>
<div class="ruleText"><span class="ruleTitle">会员说明</span>A.当加价率生效后会员价高于市场价会员价统一自动按以下标准执行
市场价-成本价x_____% +成本价=会员价 _____%为此时的加价率</div>
</a-form-item> </a-form-item>
<a-modal v-model:visible="setPriceVisible" width="450px" title="利润值" @ok="handleBatchPrice(index_1, index_2, mixPrice, maxPrice)">
<div class="fen" style="margin-top: -10px">
<input placeholder="最大利润值" style="margin-right: 25px" v-model="mixPrice" class="input" type="text" />
<input placeholder="最小利润值" v-model="maxPrice" class="input" type="text" />
</div>
<div class="setRule">
<div class="ruleTitle">设置规则</div>
<div class="ruleText">
A.当加价率生效后会员价高于市场价会员价统一自动按以下标准执行 市场价-成本价x_____% +成本价=会员价
_____%为此时的加价率 利润低于_____元的商品不展示在商城里
</div>
</div>
</a-modal>
<a-form-item v-bind="formItemLayoutWithOutLabel"> <a-form-item v-bind="formItemLayoutWithOutLabel">
<a-button type="dashed" style="width: calc(43.5% + 8px); margin-right: 50px" @click="handleAddCondition"> <div style="width: 100%;">
<a-icon type="plus-circle" /> 新增分类模版 </a-button><a-button type="dashed" style="width: calc(44.5% + 8px)" @click="handleRemoveCondition"> <a-button type="dashed" style="width: 100%" @click="handleAddCondition">
<a-icon type="minus-circle-o" /> 删除分类模版 <a-icon type="plus-circle" /> 新增分类模版 </a-button>
</a-button> </div>
</a-form-item> </a-form-item>
<a-form-item v-for="(k, index) in form.getFieldValue('list')" :key="k.id" :label="index === 0 ? '会员模版' : ''" :labelCol="labelCol" v-bind="index === 0 ? { wrapperCol } : formItemLayoutWithOutLabel" required> <a-form-item v-for="(k, index) in form.getFieldValue('list')" :key="k.id" :label="index === 0 ? '会员模版' : ''" :labelCol="labelCol" v-bind="index === 0 ? { wrapperCol } : formItemLayoutWithOutLabel" required>
<a-tree-select style="width: 100%; margin-right: 8px; margin-top: 3px" placeholder="请选择商品分类" :dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }" :treeData="formData.categoryList" treeCheckable allowClear treeCheckStrictly <div style="width: 100%;display: flex;align-items: center;justify-content: space-between">
@select="onSelect(index, $event)" @focus="handleSelectChange(index)" v-decorator="[`category${k.id}`]"></a-tree-select> <div style="width: 700px;">
<a-tree-select style="width: 100%; margin-right: 8px; margin-top: 3px" placeholder="请选择商品分类" :dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }" :treeData="formData.categoryList" treeCheckable allowClear
treeCheckStrictly @select="onSelect(index, $event)" @focus="handleSelectChange(index)" v-decorator="[`category${k.id}`]"></a-tree-select>
<div style="width: 100%"> <div style="width: 100%">
<div class="fan" v-for="(m, index2) in k.price_list" :key="m.id"> <div class="fan" v-for="(m, index2) in k.price_list" :key="m.id">
<a-form-item style="margin-right: 15px; width: 33%; cursor: pointer"> <a-form-item style="margin-right: 15px; width: 47%; cursor: pointer">
<div class="inMax" @click="setPrice(index, index2,m.min,m.max)"> <div class="inMax">
<span v-if="m.min && m.max">{{ m.min }} ~ {{ m.max }}</span><span style="color: #d9d9d9" v-else>利润值</span> <input placeholder="最小利润值" @blur="onPrice($event, index, index2)" v-model="m.min" class="input" type="text" />
~<input placeholder="最大利润值" @blur="onPrice($event, index, index2)" v-model="m.max" class="input" type="text" />
<div class="yuan"></div> <div class="yuan"></div>
</div> </div>
</a-form-item> </a-form-item>
<a-form-item style="margin-right: 15px; width: 33%"> <a-form-item style="margin-right: 15px; width: 23%">
<a-input placeholder="利润率" @input="onRate($event, index, index2)" suffix="%" v-model="m.add_price_rate" style="width: 100%; margin-right: 8px; text-align: center" /> <a-input placeholder="利润率" @input="onRate($event, index, index2)" suffix="%" v-model="m.add_price_rate" style="width: 100%; margin-right: 8px; text-align: center" />
</a-form-item> </a-form-item>
<div style="width: 33%; text-align: center"> <div style="width: 30%; text-align: center">
<span>{{ m.startProfit }}</span> ~ <span>{{ m.endProfit }}</span> <span>{{ m.startProfit }}</span> ~ <span>{{ m.endProfit }}</span>
</div> </div>
<a-button type="dashed" style="width: 120px" @click="handleRemovePriceRate(index,index2)">
<a-icon type="minus-circle-o" /> 删除价格区间</a-button>
</div> </div>
<div style="width: 100%"> <div style="width: 100%">
<a-button type="dashed" style="width: calc(40% + 8px); margin-right: 50px" @click="handleAddPriceRate(index)"> <a-button type="dashed" style="width: 100%; margin-right: 50px" @click="handleAddPriceRate(index)">
<a-icon type="plus-circle" /> 新增价格区间 </a-button><a-button type="dashed" style="width: calc(40% + 8px)" @click="handleRemovePriceRate(index)"> <a-icon type="plus-circle" /> 新增价格区间 </a-button>
<a-icon type="minus-circle-o" /> 删除价格区间 </div>
</a-button>
</div> </div>
</div> </div>
<a-button type="dashed" style="width: 120px;margin-left: 20px;" @click="handleRemoveCondition(index)">
<a-icon type="minus-circle-o" /> 删除分类模版
</a-button>
</div>
</a-form-item> </a-form-item>
<a-form-item :wrapperCol="{ span: wrapperCol.span, offset: labelCol.span }"> <a-form-item :wrapperCol="{ span: wrapperCol.span, offset: labelCol.span }">
<a-button type="primary" html-type="submit">提交</a-button> <a-button type="primary" html-type="submit">提交</a-button>
</a-form-item> </a-form-item>
</div>
</a-form> </a-form>
</a-spin> </a-spin>
</a-card> </a-card>
@ -87,11 +86,6 @@ export default {
formItemLayoutWithOutLabel: { formItemLayoutWithOutLabel: {
wrapperCol: { span: 10, offset: 3 }, wrapperCol: { span: 10, offset: 3 },
}, },
setPriceVisible: false,
index_1: '',
index_2: '',
mixPrice: '',
maxPrice: '',
} }
}, },
// //
@ -107,6 +101,50 @@ export default {
this.getDetail() this.getDetail()
}, },
methods: { methods: {
onPrice(e, index_1, index_2, type) {
const { form } = this
const list = form.getFieldValue('list')
if (0 >= list[index_1].price_list[index_2].min) {
list[index_1].price_list[index_2].min = null
this.$message.warning('最小利润值必须大于0', 1.5)
list[index_1].price_list[index_2].startProfit = 0
list[index_1].price_list[index_2].endProfit = 0
return
}
if (0 >= list[index_1].price_list[index_2].max) {
list[index_1].price_list[index_2].max = null
this.$message.warning('最大利润值必须大于0', 1.5)
list[index_1].price_list[index_2].startProfit = 0
list[index_1].price_list[index_2].endProfit = 0
return
}
if (list[index_1].price_list[index_2].min > list[index_1].price_list[index_2].max) {
list[index_1].price_list[index_2].max = null
this.$message.warning('最大利润值不能低于最小利润值', 1.5)
list[index_1].price_list[index_2].startProfit = 0
list[index_1].price_list[index_2].endProfit = 0
return
}
if (!list[index_1].price_list[index_2].min || !list[index_1].price_list[index_2].max || !list[index_1].price_list[index_2].add_price_rate) {
list[index_1].price_list[index_2].startProfit = 0
list[index_1].price_list[index_2].endProfit = 0
return
}
if (list[index_1].price_list[index_2].min && list[index_1].price_list[index_2].max) {
let rate = Number(list[index_1].price_list[index_2].add_price_rate)
list[index_1].price_list[index_2].startProfit = Number(
(list[index_1].price_list[index_2].min * (rate / 100)).toFixed(2)
)
list[index_1].price_list[index_2].endProfit = Number(
(list[index_1].price_list[index_2].max * (rate / 100)).toFixed(2)
)
list[index_1].price_list[index_2].add_price_rate = rate
form.setFieldsValue({
list: list,
})
this.$forceUpdate()
}
},
// //
onRate(e, index_1, index_2) { onRate(e, index_1, index_2) {
const { form } = this const { form } = this
@ -136,49 +174,6 @@ export default {
}) })
this.$forceUpdate() this.$forceUpdate()
}, },
handleBatchPrice(index1, index2, min, max) {
const { form } = this
if (!this.mixPrice) {
this.$message.warning('请输入最低价格', 1.5)
} else if (!this.maxPrice) {
this.$message.warning('请输入最高价格', 1.5)
} else if (0 >= this.mixPrice) {
this.mixPrice = null
this.$message.warning('最低价格必须大于0', 1.5)
} else if (0 >= this.maxPrice) {
this.maxPrice = null
this.$message.warning('最高价格必须大于0', 1.5)
} else if (this.mixPrice > this.maxPrice) {
this.maxPrice = null
this.$message.warning('最高价格不能低于最低价格', 1.5)
} else {
const condition = form.getFieldValue('list')
condition.forEach(function (item, k) {
if (k == index1) {
item.price_list.forEach(function (item1, j) {
if (j == index2) {
item1.min = min
item1.max = max
}
})
}
})
form.setFieldsValue({
list: condition,
})
this.$forceUpdate()
this.mixPrice = ''
this.maxPrice = ''
this.setPriceVisible = false
}
},
setPrice(index1, index2, min, max) {
this.index_1 = index1
this.index_2 = index2
this.mixPrice = min;
this.maxPrice = max
this.setPriceVisible = true
},
onSelect(index, event) { onSelect(index, event) {
const { form, $nextTick } = this const { form, $nextTick } = this
const key = form.getFieldValue('list') const key = form.getFieldValue('list')
@ -198,7 +193,6 @@ export default {
let that = this let that = this
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
nodes[i].disabled = false nodes[i].disabled = false
console.log(nodes[i].value, ids)
if (ids.includes(nodes[i].value) == true) { if (ids.includes(nodes[i].value) == true) {
nodes[i].disabled = true nodes[i].disabled = true
} }
@ -220,10 +214,8 @@ export default {
}) })
} }
} }
console.log(key, category)
$nextTick(() => { $nextTick(() => {
this.formData.categoryList = this.deleteNodeById(this.formData.categoryList, category) this.formData.categoryList = this.deleteNodeById(this.formData.categoryList, category)
console.log(this.deleteNodeById(this.formData.categoryList, category))
this.formData = this.formData this.formData = this.formData
this.$forceUpdate() this.$forceUpdate()
}) })
@ -232,11 +224,7 @@ export default {
handleRemoveCondition(index) { handleRemoveCondition(index) {
const { form } = this const { form } = this
const keys = form.getFieldValue('list') const keys = form.getFieldValue('list')
if (keys.length === 0) { keys.splice(index, 1) // 1
this.$message.warning('暂无可删除的分类模版', 1.5)
return
}
keys.pop()
form.setFieldsValue({ form.setFieldsValue({
list: keys, list: keys,
}) })
@ -253,22 +241,12 @@ export default {
}) })
}, },
// //
handleRemovePriceRate(index) { handleRemovePriceRate(index1, index2) {
const { form } = this const { form } = this
const priceList = form.getFieldValue('list')[index].price_list const priceList = form.getFieldValue('list')
if (priceList.length === 0) { priceList[index1].price_list.splice(index2, 1) // 1
this.$message.warning('暂无可删除的价格区间', 1.5)
return
}
priceList.pop()
const conditionList = form.getFieldValue('list')
conditionList.forEach(function (item, mm) {
if (mm == index) {
item.price_list = priceList
}
})
form.setFieldsValue({ form.setFieldsValue({
list: conditionList, list: priceList,
}) })
this.$forceUpdate() this.$forceUpdate()
}, },
@ -313,6 +291,12 @@ export default {
return { value: id } return { value: id }
}) })
}, },
convertToString(value) {
if (typeof value == 'number') {
return String(value);
}
return value;
},
// //
setFieldsValue() { setFieldsValue() {
const { record, form, $nextTick } = this const { record, form, $nextTick } = this
@ -323,10 +307,10 @@ export default {
return x return x
}) })
record.list.forEach((x, i) => { record.list.forEach((x, i) => {
record[`category${x.id}`] = this.formatCategoryIds(x.category.split(',')) record[`category${x.id}`] = this.formatCategoryIds((this.convertToString(x.category)).split(','))
categoryAry.push(`category${x.id}`) categoryAry.push(`category${x.id}`)
this.form.getFieldDecorator(`category${x.id}`, { initialValue: '', preserve: true }) this.form.getFieldDecorator(`category${x.id}`, { initialValue: '', preserve: true })
x.category = x.category.split(',') x.category = (this.convertToString(x.category)).split(',')
x.price_list.forEach((m, j) => { x.price_list.forEach((m, j) => {
m.startProfit = Number((m.min * (Number(m.add_price_rate) / 100)).toFixed(2)) m.startProfit = Number((m.min * (Number(m.add_price_rate) / 100)).toFixed(2))
m.endProfit = Number((m.max * (Number(m.add_price_rate) / 100)).toFixed(2)) m.endProfit = Number((m.max * (Number(m.add_price_rate) / 100)).toFixed(2))
@ -467,6 +451,9 @@ export default {
/deep/.ant-input-prefix { /deep/.ant-input-prefix {
font-weight: bold; font-weight: bold;
} }
/deep/.ant-col-10 {
width: 80%;
}
.fan { .fan {
display: flex; display: flex;
align-items: top; align-items: top;
@ -502,20 +489,20 @@ export default {
} }
.setRule { .setRule {
margin-top: 20px; margin-top: 20px;
.ruleTitle { }
.ruleTitle {
font-size: 14px; font-size: 14px;
font-family: PingFang SC, PingFang SC; font-family: PingFang SC, PingFang SC;
font-weight: 500; font-weight: 500;
color: #303030; color: #303030;
} }
.ruleText { .ruleText {
margin-top: 8px; margin-top: 8px;
font-size: 14px; font-size: 14px;
font-family: PingFang SC, PingFang SC; font-family: PingFang SC, PingFang SC;
font-weight: 400; font-weight: 400;
color: #8b8b8b; color: #8b8b8b;
line-height: 32px; line-height: 32px;
}
} }
.inMax { .inMax {
width: 100%; width: 100%;
@ -526,21 +513,35 @@ export default {
list-style: none; list-style: none;
display: inline-block; display: inline-block;
width: 100%; width: 100%;
height: 30px; height: 32px;
padding: 4px 11px; padding: 0 26px 0 0;
color: rgba(0, 0, 0, 0.65); color: rgba(0, 0, 0, 0.65);
font-size: 13px; font-size: 13px;
line-height: 1.8; line-height: 32px;
background-color: #fff; background-color: #fff;
background-image: none; background-image: none;
border: 1px solid #d9d9d9; border: 1px solid #d9d9d9;
border-radius: 2px; border-radius: 2px;
-webkit-transition: all 0.3s; -webkit-transition: all 0.3s;
transition: all 0.3s; transition: all 0.3s;
input {
border: none;
width: 45%;
margin: 0;
height: 100%;
text-align: center;
}
input:focus {
outline: none;
border: none;
}
input::-webkit-input-placeholder {
color: #bfbfbf;
}
.yuan { .yuan {
position: absolute; position: absolute;
right: 10px; right: 10px;
top: 2px; top: 0px;
} }
} }
</style> </style>

@ -14,19 +14,19 @@
<a-form-item label="商城简介" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="商城简介" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-textarea v-decorator="['describe']" /> <a-textarea v-decorator="['describe']" />
</a-form-item> </a-form-item>
<a-form-item label="商城Logo" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="建议尺寸: 300*300"> <a-form-item label="商城Logo" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="建议尺寸: 175*25,最大宽度175,最小高度25">
<SelectImage :defaultList="record.logoImage ? [record.logoImage] : []" v-decorator="['logo_image_id']" /> <SelectImage :defaultList="record.logoImage ? [record.logoImage] : []" v-decorator="['logo_image_id']" />
</a-form-item> </a-form-item>
<a-form-item label="登录Logo" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="建议尺寸: 300*300,为正方形图片"> <a-form-item label="登录Logo" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="建议尺寸: 132*132,请上传正方形图片">
<SelectImage :defaultList="record.loginImg ? [record.loginImg]: []" v-decorator="['login_img_id']" /> <SelectImage :defaultList="record.loginImg ? [record.loginImg]: []" v-decorator="['login_img_id']" />
</a-form-item> </a-form-item>
<a-form-item label="新品首发" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="建议尺寸: 300*300"> <a-form-item label="新品首发" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="建议尺寸: 375*326">
<SelectImage multiple :defaultList="record.newProductImg ? record.newProductImg : []" v-decorator="['new_product_img_id']" /> <SelectImage multiple :defaultList="record.newProductImg ? record.newProductImg : []" v-decorator="['new_product_img_id']" />
</a-form-item> </a-form-item>
<a-form-item label="大牌正品" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="建议尺寸: 300*300"> <a-form-item label="大牌正品" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="建议尺寸: 375*200">
<SelectImage :defaultList="record.bigBrandImg ? record.bigBrandImg : []" v-decorator="['big_brand_img_id']" /> <SelectImage :defaultList="record.bigBrandImg ? record.bigBrandImg : []" v-decorator="['big_brand_img_id']" />
</a-form-item> </a-form-item>
<a-form-item label="秒杀背景图" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="建议尺寸: 300*300"> <a-form-item label="秒杀背景图" :labelCol="labelCol" :wrapperCol="wrapperCol" extra="建议尺寸: 375*275">
<SelectImage multiple :defaultList="record.flashSaleImg ? record.flashSaleImg : []" v-decorator="['flash_sale_img_id']" /> <SelectImage multiple :defaultList="record.flashSaleImg ? record.flashSaleImg : []" v-decorator="['flash_sale_img_id']" />
</a-form-item> </a-form-item>
<!-- <a-form-item <!-- <a-form-item

Loading…
Cancel
Save