Commit bb1f8304 by chenwq

新增礼包,礼包列表

1 parent 0b314b9e
...@@ -271,6 +271,9 @@ export default { ...@@ -271,6 +271,9 @@ export default {
this.$apis.giftBag this.$apis.giftBag
.getGiftInfoApi({ id: this.routeInfo.id }) .getGiftInfoApi({ id: this.routeInfo.id })
.then(res => { .then(res => {
res.data.couponList.forEach(item => {
item.id = item.couponId
})
this.editForm = res.data this.editForm = res.data
this.editForm.receiveWay = this.editForm.receiveWay + '' this.editForm.receiveWay = this.editForm.receiveWay + ''
this.recoveryCoupon() this.recoveryCoupon()
...@@ -306,7 +309,7 @@ export default { ...@@ -306,7 +309,7 @@ export default {
this.couponObj[item].list.forEach(subItem => { this.couponObj[item].list.forEach(subItem => {
// 失效券不加入预估成本 // 失效券不加入预估成本
if (subItem.status != '3') { 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 { ...@@ -384,6 +387,9 @@ export default {
var params = this.$common.utils.deepClone(this.editForm) var params = this.$common.utils.deepClone(this.editForm)
params.staffCreateRequests = this.$common.utils.deepClone(params.staffList) params.staffCreateRequests = this.$common.utils.deepClone(params.staffList)
params.couponCreateRequests = this.$common.utils.deepClone(params.couponList) params.couponCreateRequests = this.$common.utils.deepClone(params.couponList)
params.couponCreateRequests.forEach(item => {
item.couponId = item.id
})
delete params.staffList delete params.staffList
delete params.couponList delete params.couponList
if (this.routeInfo.addOrEdit == 'edit') { if (this.routeInfo.addOrEdit == 'edit') {
......
...@@ -29,8 +29,13 @@ ...@@ -29,8 +29,13 @@
<!-- 表格区域 开始 --> <!-- 表格区域 开始 -->
<GLTable ref="giftListRef" :getListApi="getListApi" :hasNum="false" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun"> <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 slot="giftInfo" slot-scope="scope">
<div>礼包明细</div> <div class="p-b-12">礼包明细</div>
<div>{{ scope.scope }}</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>
<div slot="name" slot-scope="scope"> <div slot="name" slot-scope="scope">
<el-button :size="size" type="text" @click="handleDetail(scope.scope)">{{ scope.scope.name }}</el-button> <el-button :size="size" type="text" @click="handleDetail(scope.scope)">{{ scope.scope.name }}</el-button>
...@@ -288,4 +293,27 @@ export default { ...@@ -288,4 +293,27 @@ export default {
} }
</script> </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 @@ ...@@ -3,10 +3,10 @@
<div class="gift-bag"> <div class="gift-bag">
<el-tabs v-model="activeName" @tab-click="handleTabClick"> <el-tabs v-model="activeName" @tab-click="handleTabClick">
<el-tab-pane label="定向礼包" name="giftList"> <el-tab-pane label="定向礼包" name="giftList">
<gift-list></gift-list> <gift-list v-if="activeName == 'giftList'"></gift-list>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="已领取" name="receivedGiftList"> <el-tab-pane label="已领取" name="receivedGiftList">
<receivedGiftList></receivedGiftList> <receivedGiftList v-if="activeName == 'receivedGiftList'"></receivedGiftList>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
......
...@@ -203,7 +203,9 @@ export default { ...@@ -203,7 +203,9 @@ export default {
recoverySelected() { recoverySelected() {
if (this.selectedGiftList[this.activeName].list && this.selectedGiftList[this.activeName].list.length) { if (this.selectedGiftList[this.activeName].list && this.selectedGiftList[this.activeName].list.length) {
this.selectedGiftList[this.activeName].list.forEach(row => { 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 { ...@@ -218,7 +220,7 @@ export default {
this.selectedSum = 0 this.selectedSum = 0
this.orderShow.forEach(itme => { this.orderShow.forEach(itme => {
this.selectedGiftList[itme].list.forEach(subItem => { 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 { ...@@ -230,14 +232,16 @@ export default {
this.selectedGiftList[this.activeName].list = [] this.selectedGiftList[this.activeName].list = []
val.forEach(item => { val.forEach(item => {
let isSelected = list.find(k => k.id == item.id) let isSelected = list.find(k => k.id == item.id)
this.selectedGiftList[this.activeName].list.push({ if (this.selectedGiftList[this.activeName].list.findIndex(k => k.id == item.id) == '-1') {
id: item.id, this.selectedGiftList[this.activeName].list.push({
discountType: item.discountType, id: item.id,
couponName: item.couponName, discountType: item.discountType,
couponAmount: isSelected ? list.find(k => k.id == item.id).couponAmount : '1', couponName: item.couponName,
couponAnticipatedCost: item.anticipatedCost, couponAmount: isSelected ? list.find(k => k.id == item.id).couponAmount : '1',
status: '2' couponAnticipatedCost: item.anticipatedCost,
}) status: '2'
})
}
}) })
list.forEach(item => { list.forEach(item => {
if (item.status == '3') { 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!