main
fanfan 6 months ago
parent 71e1a0160d
commit f97d5cc205
  1. 71
      src/views/goods/distributionPrice/Index.vue
  2. 68
      src/views/goods/memberPrice/Index.vue

@ -10,12 +10,7 @@
<span>利润空间()</span>
</div>
</a-form-item>
<a-modal
v-model:visible="setPriceVisible"
width="450px"
title="利润值"
@ok="handleBatchPrice(index_1, index_2, mixPrice, maxPrice)"
>
<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" />
@ -30,61 +25,31 @@
</a-modal>
<a-form-item v-bind="formItemLayoutWithOutLabel">
<a-button type="dashed" style="width: calc(43.5% + 8px); margin-right: 50px" @click="handleAddCondition">
<a-icon type="plus-circle" /> 新增分类模版 </a-button
><a-button type="dashed" style="width: calc(44.5% + 8px)" @click="handleRemoveCondition">
<a-icon type="plus-circle" /> 新增分类模版 </a-button><a-button type="dashed" style="width: calc(44.5% + 8px)" @click="handleRemoveCondition">
<a-icon type="minus-circle-o" /> 删除分类模版
</a-button>
</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-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>
<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
@select="onSelect(index, $event)" @focus="handleSelectChange(index)" v-decorator="[`category${k.id}`]"></a-tree-select>
<div style="width: 100%">
<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">
<div class="inMax" @click="setPrice(index, index2)">
<span v-if="m.min && m.max">{{ m.min }} ~ {{ m.max }}</span
><span style="color: #d9d9d9" v-else>利润值</span>
<div class="inMax" @click="setPrice(index, index2,m.min,m.max)">
<span v-if="m.min && m.max">{{ m.min }} ~ {{ m.max }}</span><span style="color: #d9d9d9" v-else>利润值</span>
<div class="yuan"></div>
</div>
</a-form-item>
<a-form-item style="margin-right: 15px; width: 33%">
<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>
<div style="width: 33%; text-align: center">
<span>{{ m.startProfit }}</span> ~ <span>{{ m.endProfit }}</span>
</div>
</div>
<div style="width: 100%">
<a-button
type="dashed"
style="width: calc(40% + 8px); 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-button type="dashed" style="width: calc(40% + 8px); 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="minus-circle-o" /> 删除价格区间
</a-button>
</div>
@ -202,12 +167,16 @@ export default {
list: condition,
})
this.$forceUpdate()
this.setPriceVisible = false
this.setPriceVisible = false;
this.mixPrice = '';
this.maxPrice = ''
}
},
setPrice(index1, index2) {
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) {
@ -251,7 +220,6 @@ export default {
})
}
}
console.log(key,category)
$nextTick(() => {
this.formData.categoryList = this.deleteNodeById(this.formData.categoryList, category)
console.log(this.deleteNodeById(this.formData.categoryList, category))
@ -354,10 +322,10 @@ export default {
return x
})
record.list.forEach((x, i) => {
record[`category${x.id}`] = this.formatCategoryIds(x.category.split(","))
record[`category${x.id}`] = this.formatCategoryIds(x.category.split(','))
categoryAry.push(`category${x.id}`)
this.form.getFieldDecorator(`category${x.id}`, { initialValue: '', preserve: true })
x.category=x.category.split(",")
x.category = x.category.split(',')
x.price_list.forEach((m, j) => {
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))
@ -452,13 +420,12 @@ export default {
this.$message.warning(name, 1.5)
return
}
})
if (step == 0) {
this.isLoading = true
GoodsApi.setStorePrice({
list: list,
type: 1
type: 1,
})
.then((result) => {
//

@ -10,12 +10,7 @@
<span>利润空间()</span>
</div>
</a-form-item>
<a-modal
v-model:visible="setPriceVisible"
width="450px"
title="利润值"
@ok="handleBatchPrice(index_1, index_2, mixPrice, maxPrice)"
>
<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" />
@ -30,61 +25,31 @@
</a-modal>
<a-form-item v-bind="formItemLayoutWithOutLabel">
<a-button type="dashed" style="width: calc(43.5% + 8px); margin-right: 50px" @click="handleAddCondition">
<a-icon type="plus-circle" /> 新增分类模版 </a-button
><a-button type="dashed" style="width: calc(44.5% + 8px)" @click="handleRemoveCondition">
<a-icon type="plus-circle" /> 新增分类模版 </a-button><a-button type="dashed" style="width: calc(44.5% + 8px)" @click="handleRemoveCondition">
<a-icon type="minus-circle-o" /> 删除分类模版
</a-button>
</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-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>
<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
@select="onSelect(index, $event)" @focus="handleSelectChange(index)" v-decorator="[`category${k.id}`]"></a-tree-select>
<div style="width: 100%">
<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">
<div class="inMax" @click="setPrice(index, index2)">
<span v-if="m.min && m.max">{{ m.min }} ~ {{ m.max }}</span
><span style="color: #d9d9d9" v-else>利润值</span>
<div class="inMax" @click="setPrice(index, index2,m.min,m.max)">
<span v-if="m.min && m.max">{{ m.min }} ~ {{ m.max }}</span><span style="color: #d9d9d9" v-else>利润值</span>
<div class="yuan"></div>
</div>
</a-form-item>
<a-form-item style="margin-right: 15px; width: 33%">
<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>
<div style="width: 33%; text-align: center">
<span>{{ m.startProfit }}</span> ~ <span>{{ m.endProfit }}</span>
</div>
</div>
<div style="width: 100%">
<a-button
type="dashed"
style="width: calc(40% + 8px); 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-button type="dashed" style="width: calc(40% + 8px); 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="minus-circle-o" /> 删除价格区间
</a-button>
</div>
@ -202,12 +167,16 @@ export default {
list: condition,
})
this.$forceUpdate()
this.mixPrice = ''
this.maxPrice = ''
this.setPriceVisible = false
}
},
setPrice(index1, index2) {
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) {
@ -354,10 +323,10 @@ export default {
return x
})
record.list.forEach((x, i) => {
record[`category${x.id}`] = this.formatCategoryIds(x.category.split(","))
record[`category${x.id}`] = this.formatCategoryIds(x.category.split(','))
categoryAry.push(`category${x.id}`)
this.form.getFieldDecorator(`category${x.id}`, { initialValue: '', preserve: true })
x.category=x.category.split(",")
x.category = x.category.split(',')
x.price_list.forEach((m, j) => {
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))
@ -452,13 +421,12 @@ export default {
this.$message.warning(name, 1.5)
return
}
})
if (step == 0) {
this.isLoading = true
GoodsApi.setStorePrice({
list: list,
type: 0
type: 0,
})
.then((result) => {
//

Loading…
Cancel
Save