Commit 410b5a98 by crushh

update: 完成

parent ea9764e1
......@@ -11,37 +11,61 @@
</div> -->
<el-tabs :value="selectTab" type="border-card" class="card-style">
<!-- <el-tab-pane :name="index" v-for="(item, index) in ladderMemberGrade" :key="index" :label="item.gradeName" :value="item.gradeId"> -->
<el-tab-pane :name="index" v-for="(item, index) in list3" :key="index" :label="item.gradeName" :value="item.gradeId">
<el-tab-pane
:name="index"
v-for="(item, index) in list3"
:key="index"
:label="item.gradeName"
:value="item.gradeId"
>
<div class="fr" style="margin-bottom:20px" v-if="list3.length && isTable">
<el-input class="w-100" placeholder="请输入积分" v-model="integral" size="small"></el-input>
<el-input class="w-100" placeholder="请输入金额" v-model="cash" size="small"></el-input>
<el-button type="primary" size="small" @click="handleLadder(list3[index].skuList)">批量填充</el-button>
<el-input
class="w-100"
placeholder="请输入积分"
v-model="integral"
size="small"
/>
<el-input
class="w-100"
placeholder="请输入金额"
v-model="cash"
size="small"
/>
<el-button type="primary" size="small" @click="handleLadder(list3[index].skuList)">
批量填充
</el-button>
</div>
<el-table v-if="list3.length && isTable" :data="list3.length && isTable ? list3[index].skuList : []">
<el-table-column v-for="(it, i) in skuHeaderList" :key="i" :label="it.proName">
<template slot-scope="{ row }">{{ row.giftPropValues[i].valueName }}</template>
<template slot-scope="{ row }">
{{ row.giftPropValues[i].valueName }}
</template>
</el-table-column>
<el-table-column label="积分">
<template slot-scope="{ row }">
<el-input size="small" v-model.trim="row.giftProSkuIntegral"></el-input>
<el-input size="small" v-model.trim="row.giftProSkuIntegral" />
</template>
</el-table-column>
<el-table-column label="现金(元)">
<template slot-scope="{ row }">
<el-input size="small" v-model.trim="row.giftProSkuCash"></el-input>
<el-input size="small" v-model.trim="row.giftProSkuCash" />
</template>
</el-table-column>
</el-table>
<el-form v-if="list3.length && !isTable">
<el-form-item label="积分">
<el-input size="small" v-model.trim="list3[index].skuList[0].giftProSkuIntegral" style="width:180px"></el-input>
<el-input size="small" v-model.trim="list3[index].skuList[0].giftProSkuIntegral" style="width:180px" />
</el-form-item>
<el-form-item label="现金">
<el-input size="small" v-model.trim="list3[index].skuList[0].giftProSkuCash" style="width:180px" />&nbsp;&nbsp;
</el-form-item>
<el-form-item label="现金"> <el-input size="small" v-model.trim="list3[index].skuList[0].giftProSkuCash" style="width:180px"></el-input>&nbsp;&nbsp;</el-form-item>
</el-form>
</el-tab-pane>
</el-tabs>
<div style="margin-top: 20px;text-align:right">
<el-button type="primary" @click="saveLadderDetail">保存</el-button>
<el-button type="primary" @click="saveLadderDetail">
保存
</el-button>
</div>
</div>
</el-dialog>
......@@ -55,12 +79,12 @@ export default {
props: {
ladderPriceData: {
type: Object,
default() {
default () {
return {};
}
}
},
},
},
data() {
data () {
return {
selectTab: 0,
loading: false,
......@@ -76,20 +100,20 @@ export default {
memberGrade: '',
integral: '',
cash: '',
isCorrect: true
isCorrect: true,
};
},
created() {
created () {
// console.log(this.ladderPriceData);
this.dialogVisible = true;
this.id = this.ladderPriceData.id;
this.getInfo();
},
methods: {
async getInfo() {
async getInfo () {
console.log(111);
let params = {
integralMallProId: this.id
const params = {
integralMallProId: this.id,
};
this.loading = true;
request
......@@ -98,20 +122,20 @@ export default {
if (res.data.errorCode === 0) {
this.skuHeaderList = [];
if (res.data.result.skuJsonList) {
for (let item of JSON.parse(res.data.result.skuJsonList[0].giftPropValues)) {
for (const item of JSON.parse(res.data.result.skuJsonList[0].giftPropValues)) {
this.skuHeaderList.push({
proName: item.proName,
proId: item.proId
proId: item.proId,
});
}
}
this.list3 = res.data.result.gradeProSkus ? res.data.result.gradeProSkus : [];
this.list3.forEach(item => {
item.skuList.forEach(it => {
item.skuList && item.skuList.forEach(it => {
it.giftPropValues = JSON.parse(it.giftPropValuesJson);
});
});
let giftProStandardJson = res.data.result.giftProStandardJson ? JSON.parse(res.data.result.giftProStandardJson) : [];
const giftProStandardJson = res.data.result.giftProStandardJson ? JSON.parse(res.data.result.giftProStandardJson) : [];
this.isTable = giftProStandardJson.length; // giftProStandardJson存在代表有sku
// this.gradeType = res.data.result.gradeType;
// this.memberGrade = res.data.result.memberGrade;
......@@ -124,7 +148,7 @@ export default {
})
.finally(() => (this.loading = false));
},
handleLadder(value) {
handleLadder (value) {
value.forEach(item => {
item.giftProSkuIntegral = this.integral ? this.integral : item.giftProSkuIntegral;
item.giftProSkuCash = this.cash ? this.cash : item.giftProSkuCash;
......@@ -132,10 +156,10 @@ export default {
this.integral = '';
this.cash = '';
},
saveLadderDetail() {
saveLadderDetail () {
this.isCorrect = true;
for (let i = 0; i < this.list3.length; i++) {
let skuList = this.list3[i].skuList;
const skuList = this.list3[i].skuList;
if (this.isCorrect) {
for (let j = 0; j < skuList.length; j++) {
if (skuList[j].giftProSkuCash && (skuList[j].giftProSkuIntegral === '' || skuList[j].giftProSkuIntegral === null)) {
......@@ -149,7 +173,7 @@ export default {
break;
}
if (skuList[j].giftProSkuCash && skuList[j].giftProSkuIntegral) {
let itemPlus = Number(skuList[j].giftProSkuCash) + Number(skuList[j].giftProSkuIntegral);
const itemPlus = Number(skuList[j].giftProSkuCash) + Number(skuList[j].giftProSkuIntegral);
if (!itemPlus) {
this.isCorrect = false;
this.$message.error('积分和现金相加不可为0');
......@@ -162,9 +186,9 @@ export default {
}
}
if (this.isCorrect) {
let params = {
const params = {
integralMallProId: this.id,
differentialPricingJson: JSON.stringify(this.list3)
differentialPricingJson: JSON.stringify(this.list3),
};
request.post('/api-integral-mall/set-differential-pricing', qs.stringify(params)).then(res => {
if (res.data.errorCode === 0) {
......@@ -177,13 +201,13 @@ export default {
});
}
},
cancelSubmit() {
cancelSubmit () {
this.dialogVisible = false;
setInterval(() => {
this.$emit('closeUpdateLadder');
}, 10);
}
}
},
},
};
</script>
<style scoped>
......
......@@ -333,7 +333,7 @@
<el-button type="text" v-if="scope.row.canEdit">删除</el-button>
</dm-delete> -->
<el-dropdown
v-if="scope.row.isDifferentialPricing || scope.row.canEdit || $getButtonLimit($buttonCode.couponTieredPricing)|| $getButtonLimit($buttonCode.couponDelete)"
v-if="(scope.row.isDifferentialPricing || scope.row.canEdit)&& ($getButtonLimit($buttonCode.couponTieredPricing)|| $getButtonLimit($buttonCode.couponDelete))"
style="margin-left:20px;"
@command="command => handleCommand(command, scope.row, scope.$index)"
placement="bottom-start"
......
......@@ -354,7 +354,7 @@
编辑
</el-button>
<el-dropdown
v-if="(scope.row.changeType === '5' && scope.row.canEdit) || scope.row.isDifferentialPricing || scope.row.canEdit ||$getButtonLimit($buttonCode.giftCouponCode) || $getButtonLimit($buttonCode.giftTieredPricing) || $getButtonLimit($buttonCode.giftDelete)"
v-if="((scope.row.changeType === '5' && scope.row.canEdit) || scope.row.isDifferentialPricing || scope.row.canEdit) && ($getButtonLimit($buttonCode.giftCouponCode) || $getButtonLimit($buttonCode.giftTieredPricing) || $getButtonLimit($buttonCode.giftDelete))"
style="margin-left:20px;"
@command="command => handleCommand(command, scope.row, scope.$index)"
placement="bottom-start"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment