Commit bb1f8304 by chenwq

新增礼包,礼包列表

1 parent 0b314b9e
......@@ -271,6 +271,9 @@ export default {
this.$apis.giftBag
.getGiftInfoApi({ id: this.routeInfo.id })
.then(res => {
res.data.couponList.forEach(item => {
item.id = item.couponId
})
this.editForm = res.data
this.editForm.receiveWay = this.editForm.receiveWay + ''
this.recoveryCoupon()
......@@ -306,7 +309,7 @@ export default {
this.couponObj[item].list.forEach(subItem => {
// 失效券不加入预估成本
if (subItem.status != '3') {
this.totalEstimatedCost = this.totalEstimatedCost + subItem.couponAnticipatedCost * subItem.couponAmount
this.totalEstimatedCost = this.totalEstimatedCost + parseInt(subItem.couponAnticipatedCost) * parseInt(subItem.couponAmount)
}
})
})
......@@ -384,6 +387,9 @@ export default {
var params = this.$common.utils.deepClone(this.editForm)
params.staffCreateRequests = this.$common.utils.deepClone(params.staffList)
params.couponCreateRequests = this.$common.utils.deepClone(params.couponList)
params.couponCreateRequests.forEach(item => {
item.couponId = item.id
})
delete params.staffList
delete params.couponList
if (this.routeInfo.addOrEdit == 'edit') {
......
......@@ -29,8 +29,13 @@
<!-- 表格区域 开始 -->
<GLTable ref="giftListRef" :getListApi="getListApi" :hasNum="false" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div slot="giftInfo" slot-scope="scope">
<div>礼包明细</div>
<div>{{ scope.scope }}</div>
<div class="p-b-12">礼包明细</div>
<div class="gift-detail flex-default">
<div class="gift-item" v-for="(item, index) in scope.scope.couponList" :key="index">
<p :class="['gift-coupon-name', item.status == '3' ? ' txt-grey' : '']">{{ item.couponName }} × {{ item.couponAmount }}</p>
<p v-show="item.status == '3'" class="gift-tips">已失效</p>
</div>
</div>
</div>
<div slot="name" slot-scope="scope">
<el-button :size="size" type="text" @click="handleDetail(scope.scope)">{{ scope.scope.name }}</el-button>
......@@ -288,4 +293,27 @@ export default {
}
</script>
<style scoped></style>
<style lang="scss">
.p-b-12 {
margin-bottom: 14px;
}
.gift-detail .gift-item {
margin-right: 80px;
.gift-coupon-name {
display: inline-block;
margin-right: 7px;
}
.gift-tips {
display: inline-block;
font-size: 12px;
height: 18px;
line-height: 18px;
color: #999999;
background-color: #eeeded;
margin-right: 7px;
}
}
.gift-detail .gift-item:last-child {
margin-right: 0;
}
</style>
......@@ -3,10 +3,10 @@
<div class="gift-bag">
<el-tabs v-model="activeName" @tab-click="handleTabClick">
<el-tab-pane label="定向礼包" name="giftList">
<gift-list></gift-list>
<gift-list v-if="activeName == 'giftList'"></gift-list>
</el-tab-pane>
<el-tab-pane label="已领取" name="receivedGiftList">
<receivedGiftList></receivedGiftList>
<receivedGiftList v-if="activeName == 'receivedGiftList'"></receivedGiftList>
</el-tab-pane>
</el-tabs>
</div>
......
......@@ -203,7 +203,9 @@ export default {
recoverySelected() {
if (this.selectedGiftList[this.activeName].list && this.selectedGiftList[this.activeName].list.length) {
this.selectedGiftList[this.activeName].list.forEach(row => {
this.$refs.giftRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(row)
if (row.status != '3') {
this.$refs.giftRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(row)
}
})
}
},
......@@ -218,7 +220,7 @@ export default {
this.selectedSum = 0
this.orderShow.forEach(itme => {
this.selectedGiftList[itme].list.forEach(subItem => {
this.selectedSum = this.selectedSum + subItem.couponAmount
this.selectedSum = this.selectedSum + parseInt(subItem.couponAmount)
})
})
},
......@@ -230,14 +232,16 @@ export default {
this.selectedGiftList[this.activeName].list = []
val.forEach(item => {
let isSelected = list.find(k => k.id == item.id)
this.selectedGiftList[this.activeName].list.push({
id: item.id,
discountType: item.discountType,
couponName: item.couponName,
couponAmount: isSelected ? list.find(k => k.id == item.id).couponAmount : '1',
couponAnticipatedCost: item.anticipatedCost,
status: '2'
})
if (this.selectedGiftList[this.activeName].list.findIndex(k => k.id == item.id) == '-1') {
this.selectedGiftList[this.activeName].list.push({
id: item.id,
discountType: item.discountType,
couponName: item.couponName,
couponAmount: isSelected ? list.find(k => k.id == item.id).couponAmount : '1',
couponAnticipatedCost: item.anticipatedCost,
status: '2'
})
}
})
list.forEach(item => {
if (item.status == '3') {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!