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

@ -10,12 +10,7 @@
<span>利润空间()</span> <span>利润空间()</span>
</div> </div>
</a-form-item> </a-form-item>
<a-modal <a-modal v-model:visible="setPriceVisible" width="450px" title="利润值" @ok="handleBatchPrice(index_1, index_2, mixPrice, maxPrice)">
v-model:visible="setPriceVisible"
width="450px"
title="利润值"
@ok="handleBatchPrice(index_1, index_2, mixPrice, maxPrice)"
>
<div class="fen" style="margin-top: -10px"> <div class="fen" style="margin-top: -10px">
<input placeholder="最大利润值" style="margin-right: 25px" v-model="mixPrice" class="input" type="text" /> <input placeholder="最大利润值" style="margin-right: 25px" v-model="mixPrice" class="input" type="text" />
<input placeholder="最小利润值" v-model="maxPrice" class="input" type="text" /> <input placeholder="最小利润值" v-model="maxPrice" class="input" type="text" />
@ -30,61 +25,31 @@
</a-modal> </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"> <a-button type="dashed" style="width: calc(43.5% + 8px); margin-right: 50px" @click="handleAddCondition">
<a-icon type="plus-circle" /> 新增分类模版 </a-button <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: calc(44.5% + 8px)" @click="handleRemoveCondition">
<a-icon type="minus-circle-o" /> 删除分类模版 <a-icon type="minus-circle-o" /> 删除分类模版
</a-button> </a-button>
</a-form-item> </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>
v-for="(k, index) in form.getFieldValue('list')" <a-tree-select style="width: 100%; margin-right: 8px; margin-top: 3px" placeholder="请选择商品分类" :dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }" :treeData="formData.categoryList" treeCheckable allowClear treeCheckStrictly
:key="k.id" @select="onSelect(index, $event)" @focus="handleSelectChange(index)" v-decorator="[`category${k.id}`]"></a-tree-select>
: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 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: 33%; cursor: pointer">
<div class="inMax" @click="setPrice(index, index2)"> <div class="inMax" @click="setPrice(index, index2,m.min,m.max)">
<span v-if="m.min && m.max">{{ m.min }} ~ {{ m.max }}</span <span v-if="m.min && m.max">{{ m.min }} ~ {{ m.max }}</span><span style="color: #d9d9d9" v-else>利润值</span>
><span style="color: #d9d9d9" v-else>利润值</span>
<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: 33%">
<a-input <a-input placeholder="利润率" @input="onRate($event, index, index2)" suffix="%" v-model="m.add_price_rate" style="width: 100%; margin-right: 8px; text-align: center" />
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: 33%; text-align: center">
<span>{{ m.startProfit }}</span> ~ <span>{{ m.endProfit }}</span> <span>{{ m.startProfit }}</span> ~ <span>{{ m.endProfit }}</span>
</div> </div>
</div> </div>
<div style="width: 100%"> <div style="width: 100%">
<a-button <a-button type="dashed" style="width: calc(40% + 8px); margin-right: 50px" @click="handleAddPriceRate(index)">
type="dashed" <a-icon type="plus-circle" /> 新增价格区间 </a-button><a-button type="dashed" style="width: calc(40% + 8px)" @click="handleRemovePriceRate(index)">
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-icon type="minus-circle-o" /> 删除价格区间
</a-button> </a-button>
</div> </div>
@ -202,12 +167,16 @@ export default {
list: condition, list: condition,
}) })
this.$forceUpdate() 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_1 = index1
this.index_2 = index2 this.index_2 = index2
this.mixPrice = min;
this.maxPrice = max
this.setPriceVisible = true this.setPriceVisible = true
}, },
onSelect(index, event) { onSelect(index, event) {
@ -229,7 +198,7 @@ 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) 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
} }
@ -251,7 +220,6 @@ 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)) console.log(this.deleteNodeById(this.formData.categoryList, category))
@ -354,13 +322,13 @@ 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(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 = 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))
}) })
}) })
} }
@ -379,7 +347,7 @@ export default {
// //
getDetail() { getDetail() {
this.isLoading = true this.isLoading = true
GoodsApi.getStorePriceInfo({type:1}) GoodsApi.getStorePriceInfo({ type: 1 })
.then((result) => { .then((result) => {
this.record = result.data this.record = result.data
// //
@ -425,7 +393,7 @@ export default {
} }
if (item.price_list.length > 0) { if (item.price_list.length > 0) {
item.price_list.forEach((item_1, index_1) => { item.price_list.forEach((item_1, index_1) => {
item_1.category=item.category item_1.category = item.category
if (!item_1.min) { if (!item_1.min) {
step++ step++
let name = '请完善第' + (index + 1) + '行分类模版的' + '第' + (index_1 + 1) + '行分类的最低价格' let name = '请完善第' + (index + 1) + '行分类模版的' + '第' + (index_1 + 1) + '行分类的最低价格'
@ -452,13 +420,12 @@ export default {
this.$message.warning(name, 1.5) this.$message.warning(name, 1.5)
return return
} }
}) })
if (step == 0) { if (step == 0) {
this.isLoading = true this.isLoading = true
GoodsApi.setStorePrice({ GoodsApi.setStorePrice({
list: list, list: list,
type: 1 type: 1,
}) })
.then((result) => { .then((result) => {
// //

@ -10,12 +10,7 @@
<span>利润空间()</span> <span>利润空间()</span>
</div> </div>
</a-form-item> </a-form-item>
<a-modal <a-modal v-model:visible="setPriceVisible" width="450px" title="利润值" @ok="handleBatchPrice(index_1, index_2, mixPrice, maxPrice)">
v-model:visible="setPriceVisible"
width="450px"
title="利润值"
@ok="handleBatchPrice(index_1, index_2, mixPrice, maxPrice)"
>
<div class="fen" style="margin-top: -10px"> <div class="fen" style="margin-top: -10px">
<input placeholder="最大利润值" style="margin-right: 25px" v-model="mixPrice" class="input" type="text" /> <input placeholder="最大利润值" style="margin-right: 25px" v-model="mixPrice" class="input" type="text" />
<input placeholder="最小利润值" v-model="maxPrice" class="input" type="text" /> <input placeholder="最小利润值" v-model="maxPrice" class="input" type="text" />
@ -30,61 +25,31 @@
</a-modal> </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"> <a-button type="dashed" style="width: calc(43.5% + 8px); margin-right: 50px" @click="handleAddCondition">
<a-icon type="plus-circle" /> 新增分类模版 </a-button <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: calc(44.5% + 8px)" @click="handleRemoveCondition">
<a-icon type="minus-circle-o" /> 删除分类模版 <a-icon type="minus-circle-o" /> 删除分类模版
</a-button> </a-button>
</a-form-item> </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>
v-for="(k, index) in form.getFieldValue('list')" <a-tree-select style="width: 100%; margin-right: 8px; margin-top: 3px" placeholder="请选择商品分类" :dropdownStyle="{ maxHeight: '500px', overflow: 'auto' }" :treeData="formData.categoryList" treeCheckable allowClear treeCheckStrictly
:key="k.id" @select="onSelect(index, $event)" @focus="handleSelectChange(index)" v-decorator="[`category${k.id}`]"></a-tree-select>
: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 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: 33%; cursor: pointer">
<div class="inMax" @click="setPrice(index, index2)"> <div class="inMax" @click="setPrice(index, index2,m.min,m.max)">
<span v-if="m.min && m.max">{{ m.min }} ~ {{ m.max }}</span <span v-if="m.min && m.max">{{ m.min }} ~ {{ m.max }}</span><span style="color: #d9d9d9" v-else>利润值</span>
><span style="color: #d9d9d9" v-else>利润值</span>
<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: 33%">
<a-input <a-input placeholder="利润率" @input="onRate($event, index, index2)" suffix="%" v-model="m.add_price_rate" style="width: 100%; margin-right: 8px; text-align: center" />
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: 33%; text-align: center">
<span>{{ m.startProfit }}</span> ~ <span>{{ m.endProfit }}</span> <span>{{ m.startProfit }}</span> ~ <span>{{ m.endProfit }}</span>
</div> </div>
</div> </div>
<div style="width: 100%"> <div style="width: 100%">
<a-button <a-button type="dashed" style="width: calc(40% + 8px); margin-right: 50px" @click="handleAddPriceRate(index)">
type="dashed" <a-icon type="plus-circle" /> 新增价格区间 </a-button><a-button type="dashed" style="width: calc(40% + 8px)" @click="handleRemovePriceRate(index)">
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-icon type="minus-circle-o" /> 删除价格区间
</a-button> </a-button>
</div> </div>
@ -202,12 +167,16 @@ export default {
list: condition, list: condition,
}) })
this.$forceUpdate() this.$forceUpdate()
this.mixPrice = ''
this.maxPrice = ''
this.setPriceVisible = false this.setPriceVisible = false
} }
}, },
setPrice(index1, index2) { setPrice(index1, index2, min, max) {
this.index_1 = index1 this.index_1 = index1
this.index_2 = index2 this.index_2 = index2
this.mixPrice = min;
this.maxPrice = max
this.setPriceVisible = true this.setPriceVisible = true
}, },
onSelect(index, event) { onSelect(index, event) {
@ -229,7 +198,7 @@ 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) 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
} }
@ -251,7 +220,7 @@ export default {
}) })
} }
} }
console.log(key,category) 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)) console.log(this.deleteNodeById(this.formData.categoryList, category))
@ -354,13 +323,13 @@ 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(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 = 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))
}) })
}) })
} }
@ -379,7 +348,7 @@ export default {
// //
getDetail() { getDetail() {
this.isLoading = true this.isLoading = true
GoodsApi.getStorePriceInfo({type:0}) GoodsApi.getStorePriceInfo({ type: 0 })
.then((result) => { .then((result) => {
this.record = result.data this.record = result.data
// //
@ -425,7 +394,7 @@ export default {
} }
if (item.price_list.length > 0) { if (item.price_list.length > 0) {
item.price_list.forEach((item_1, index_1) => { item.price_list.forEach((item_1, index_1) => {
item_1.category=item.category item_1.category = item.category
if (!item_1.min) { if (!item_1.min) {
step++ step++
let name = '请完善第' + (index + 1) + '行分类模版的' + '第' + (index_1 + 1) + '行分类的最低价格' let name = '请完善第' + (index + 1) + '行分类模版的' + '第' + (index_1 + 1) + '行分类的最低价格'
@ -452,13 +421,12 @@ export default {
this.$message.warning(name, 1.5) this.$message.warning(name, 1.5)
return return
} }
}) })
if (step == 0) { if (step == 0) {
this.isLoading = true this.isLoading = true
GoodsApi.setStorePrice({ GoodsApi.setStorePrice({
list: list, list: list,
type: 0 type: 0,
}) })
.then((result) => { .then((result) => {
// //

Loading…
Cancel
Save