Commit e793af64 by 前端

添加或删除套餐时通知

1 parent 25ccee51
......@@ -64,3 +64,9 @@ export function getMerchantType(data) {
data.method = `merchants.api.menu.findAllDictData`
return request(data, RequestMethods.POST)
}
// 嘀加上架查看详情(上架商品及测算)
export function getGoodsDetail(data) {
data.method = `${path}detail.goods`
return request(data, RequestMethods.POST)
}
......@@ -170,6 +170,16 @@ import { limitPrice } from "@/common/format"
import selectGoodsDialog from '../../../components/selectGoodsDialog.vue'
export default {
name: "GoodTab",
props: {
info: {
type: Object,
default: () => { }
},
tabIdx: {
type: Number,
default: null
}
},
data() {
return {
businessNature: businessNature,
......@@ -225,7 +235,7 @@ export default {
computed: {},
async mounted() {
console.log('商品')
console.log('info', this.info)
},
methods: {
......
......@@ -246,10 +246,12 @@ export default {
},
data() {
return {
timeId: new Date().getTime() + parseInt(Math.random() * 1000),
// timeId: new Date().getTime() + parseInt(Math.random() * 1000),
businessNature: businessNature,
loading: false,
packageForm: {
timeId: new Date().getTime() + parseInt(Math.random() * 1000),
goodsId: null,
val1: "",
val2: "",
val3: "",
......@@ -316,7 +318,6 @@ export default {
// name: e.target.value,
// timeId: this.timeId
// }
this.packageForm.timeId = this.timeId
this.returnData()
}
},
......@@ -378,6 +379,7 @@ export default {
},
returnData() {
// this.packageForm.timeId = this.timeId
this.$emit('packageEditInfo', { info: this.packageForm, idx: this.tabIdx })
}
}
......
......@@ -19,10 +19,11 @@
:name="item.name"
closable>
<span slot="label"><i class="el-icon-warning car-error-txt"
v-if="item.valiadError == 'Y'" />{{ item.title + (idx+1) }}
v-if="item.valiadError == 'Y'" />{{ item.title ? (item.title + (idx+1)):item.goodsName }}
</span>
<span>
<good-tab />
<good-tab :info="item.info"
:tab-idx="item.tabIndex" />
</span>
</el-tab-pane>
<el-tab-pane v-for="(item, idx) in packageTabs"
......@@ -31,19 +32,19 @@
:name="item.name"
closable>
<span slot="label"><i class="el-icon-warning car-error-txt"
v-if="item.valiadError == 'Y'" />{{ item.title + (idx+1) }}
v-if="item.valiadError == 'Y'" />{{ item.title ? (item.title + (idx+1)):item.goodsName }}
</span>
<span>
<package-tab @packageEditInfo="getPackageEditInfo"
<package-tab @packageEditInfo="getPackageEditInfo_notice"
:tab-idx="item.tabIndex" />
</span>
</el-tab-pane>
<el-tab-pane key="add"
name="add">
<!-- //这是增加的按钮 -->
<span slot="label"
<!-- <el-tab-pane key="add"
name="add"> -->
<!-- //这是增加的按钮 -->
<!-- <span slot="label"
style="padding: 8px; font-size: 20px; font-weight: bold">+</span>
</el-tab-pane>
</el-tab-pane> -->
</el-tabs>
</div>
<!-- <div style="padding: 20px;">
......@@ -67,12 +68,20 @@
</template>
<script>
import { get } from "sortablejs"
import {
getGoodsDetail
} from "@api/shelfManage.js"
import goodTab from "../common/goodTab.vue"
import packageTab from "../common/packageTab.vue"
import { deepClone } from "@/common/util"
export default {
name: 'GoodsInfo',
props: {},
props: {
recordId: {
type: Number,
default: null
}
},
components: {
goodTab,
packageTab
......@@ -110,7 +119,46 @@ export default {
packageInfoList: []
}
},
mounted() {
this.getDetail()
},
methods: {
getDetail() {
console.log('getGoodsDetail')
// this.recordId
getGoodsDetail({ id: 1 })
.then((res) => {
const goodsList = deepClone(res.goodsList)
const packageGoodsList = deepClone(res.packageGoodsList)
goodsList.forEach((item, idx) => {
const length = this.goodTabs.length
const tabIndex = length == 0 ? length : this.goodTabs[length - 1].tabIndex + 1
this.goodTabs.push({
goodsName: item.goodsName,
name: 'good_' + tabIndex,
tabIndex: tabIndex,
goodId: item.id,
info: item
})
this.tabsValue = 'good_' + tabIndex
})
packageGoodsList.forEach((item, idx) => {
const length = this.packageTabs.length
const tabIndex = length == 0 ? length : this.packageTabs[length - 1].tabIndex + 1
this.packageTabs.push({
goodsName: item.packageName,
name: 'package_' + tabIndex,
tabIndex: tabIndex,
goodId: item.id,
info: item
})
this.tabsValue = 'package_' + tabIndex
})
})
.catch((err) => {
console.log(err)
})
},
addPop() {
this.chooseVisible = true
},
......@@ -127,13 +175,13 @@ export default {
console.log('currentName', currentName)
// 通过tab标签的切换事件触发增加的函数
// 如果name是add,则调用增加tab的函数
if (currentName == "add") {
// this.addTab()
this.addPop()
return false
} else {
this.currentIndex = currentName
}
// if (currentName == "add") {
// // this.addTab()
// this.addPop()
// return false
// } else {
this.currentIndex = currentName
// }
},
addTab(goodType) {
// 根据已有的tab,再增减
......@@ -242,6 +290,7 @@ export default {
} else {
this.packageTabs = tabs.filter(tab => tab.name !== targetName)
}
this.packageNotice()
// const currentTabIndex = this.goodTabs.findIndex(item => item.name == targetName)
// // currentTabIndex <= parseInt(self.goodTabsValue)
......@@ -321,13 +370,35 @@ export default {
// })
},
getPackageEditInfo(obj) {
// 填写套餐名称时通知
getPackageEditInfo_notice(obj) {
console.log('obj', obj)
this.packageTabs.find(item => item.tabIndex == obj.idx).info = obj.info
this.packageNotice()
},
// 删除套餐时通知
// removePackageTab_notice() {
// this.packageInfoList = []
// this.packageTabs.forEach(item => {
// if (item.info) {
// this.packageInfoList.push(item.info)
// }
// })
// this.$EventBus.$emit('packageInfoList', this.packageInfoList)
// },
// 填写套餐名称时或删除套餐时通知
packageNotice() {
this.packageInfoList = []
this.packageTabs.forEach(item => {
if (item.info) {
this.packageInfoList.push(item.info)
const o = {
name: item.info.val1 || item.info.packageName,
virtualCode: item.info.timeId,
id: item.info.id
}
this.packageInfoList.push(o)
}
})
console.log('this.packageInfoList', this.packageInfoList)
......
......@@ -8,28 +8,38 @@
-->
<!-- 编辑 - 运营确认 -->
<template>
<d2-container class="edit-contract" v-loading="isLoad">
<d2-container class="edit-contract"
v-loading="isLoad">
<!-- 基础信息 -->
<base-info :basicInfo="basicInfo"></base-info>
<base-info :basic-info="basicInfo"></base-info>
<!-- 流量方信息 -->
<shop-merchant-info ref="shopMerchant" :editData="merchantEditData" @addMerchant="handleAddMerchant"></shop-merchant-info>
<shop-merchant-info ref="shopMerchant"
:edit-data="merchantEditData"
@addMerchant="handleAddMerchant"></shop-merchant-info>
<!-- 流量方信息 - 新增 - 新增商户 -->
<add-merchant v-if="addMerVisible" :addMerVisible="addMerVisible" @handleClose="handleAddMerchant"></add-merchant>
<add-merchant v-if="addMerVisible"
:add-mer-visible="addMerVisible"
@handleClose="handleAddMerchant"></add-merchant>
<!-- 上架商品及测算 -->
<goods-info></goods-info>
<goods-info ref="goodsInfo"
:record-id="routeObj.id"></goods-info>
<!-- 分账配置 -->
<division-config ref="divisionConfig"></division-config>
<!-- 对账配置 -->
<finance-config ref="financeConfig"></finance-config>
<div style="margin-top: 40px;text-align: center;">
<el-button type="primary" @click="handleConfirm('save')">
<el-button type="primary"
@click="handleConfirm('save')">
提交
</el-button>
<!-- 草稿状态/已下架/新增显示 -->
<el-button type="primary" plain @click="handleConfirm('draft')">
<el-button type="primary"
plain
@click="handleConfirm('draft')">
暂存
</el-button>
<el-button class="cancel-btn" @click="handleCancel">
<el-button class="cancel-btn"
@click="handleCancel">
取消
</el-button>
</div>
......@@ -57,9 +67,9 @@ export default {
basicInfo: {},
merchantEditData: {},
editData: {
merchantName: '',
},
};
merchantName: ''
}
}
},
components: {
......@@ -75,7 +85,7 @@ export default {
this.isLoad = true
this.getBasicDetail()
},
//方法集合
// 方法集合
methods: {
...mapActions({
close: 'd2admin/page/close'
......@@ -105,7 +115,7 @@ export default {
businessCode: this.routeObj.businessCode,
merchant: this.$refs.editData,
settleDistributeRule: this.$refs.divisionConfig.submitParams,
reconciliationRule: this.$refs.financeConfig.submitParams,
reconciliationRule: this.$refs.financeConfig.submitParams
}
},
handleCancel() {
......@@ -113,8 +123,8 @@ export default {
this.$router.push({ name: 'shelfManage' })
this.close({ tagName: '/editContract' })
}
},
};
}
}
</script>
<style lang="scss" scoped>
.cancel-btn {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!