This commit is contained in:
weipengfei 2024-03-23 16:29:42 +08:00
parent 4479b33477
commit f3a26f09ea
2 changed files with 55 additions and 32 deletions

View File

@ -23,6 +23,7 @@ const state = {
marginStatus: 0,
marginDays: "",
wholesale: 0,
merchantType: {},
roles: [],
menuList: JSON.parse(localStorage.getItem("MerMenuList")),
sidebarWidth: window.localStorage.getItem("sidebarWidth"),
@ -48,6 +49,9 @@ const mutations = {
SET_WHOLESALE: (state, wholesale) => {
state.wholesale = wholesale;
},
SET_MERCHANTTYPE: (state, merchantType) => {
state.merchantType = merchantType;
},
SET_AVATAR: (state, avatar) => {
state.avatar = avatar;
},

View File

@ -1515,6 +1515,7 @@ import ueditorFrom from '@/components/ueditorFrom'
import VueUeditorWrap from 'vue-ueditor-wrap'
import vuedraggable from 'vuedraggable'
import Sortable from 'sortablejs'
import { getBaseInfo } from '@/api/user'
import {
shippingListApi,
templateLsitApi,
@ -1578,6 +1579,7 @@ const defaultObj = {
image: '',
price: null,
wholesale_price: null,
procure_price: null,
cost: null,
ot_price: null,
svip_price: null,
@ -1608,6 +1610,9 @@ const objTitle = {
wholesale_price: {
title: '批发价'
},
procure_price: {
title: '采购价'
},
svip_price: {
title: '付费会员价'
},
@ -1838,6 +1843,7 @@ export default {
attrVal: {
price: null,
wholesale_price: null,
procure_price: null,
cost: null,
ot_price: null,
stock: null,
@ -1870,6 +1876,7 @@ export default {
image: "",
price: "",
wholesale_price: "",
procure_price: "",
cost: "",
ot_price: "",
svip_price: "",
@ -1929,43 +1936,48 @@ export default {
}
},
mounted() {
if(this.$store.state.user.wholesale==0){
delete this.attrVal.wholesale_price
}
this.getCategorySelect()
this.getCategoryList()
this.getBrandListApi()
this.getShippingList()
this.getGuaranteeList()
this.productGetRule()
this.getLabelLst()
this.getFormList()
this.getUnitList()
this.$store.dispatch('settings/setEdit', true)
this.formValidate.slider_image = []
if (this.$route.params.id) {
this.product_id = this.$route.params.id
this.setTagsViewTitle()
this.getInfo()
} else {
this.getSpecsLst(this.formValidate.cate_id)
this.productCon()
if (this.deduction_set == -1) this.formValidate.integral_rate = -1
}
this.formValidate.attr.map(item => {
this.$set(item, 'inputVisible', false)
})
if (this.$route.query.type == 1) {
this.type = this.$route.query.type
this.$refs.taoBao.modals = true
} else {
this.type = 0
}
this.initInfo()
},
destroyed() {
window.removeEventListener('popstate', this.goBack, false)
},
methods: {
initInfo(){
getBaseInfo().then(res => {
if(res.data.wholesale==0) delete this.attrVal.wholesale_price
if(!(res.data.merchantType && res.data.merchantType.mer_type_id==22) || !res.data.merchantType) delete this.attrVal.procure_price
this.getCategorySelect()
this.getCategoryList()
this.getBrandListApi()
this.getShippingList()
this.getGuaranteeList()
this.productGetRule()
this.getLabelLst()
this.getFormList()
this.getUnitList()
this.$store.dispatch('settings/setEdit', true)
this.formValidate.slider_image = []
if (this.$route.params.id) {
this.product_id = this.$route.params.id
this.setTagsViewTitle()
this.getInfo()
} else {
this.getSpecsLst(this.formValidate.cate_id)
this.productCon()
if (this.deduction_set == -1) this.formValidate.integral_rate = -1
}
this.formValidate.attr.map(item => {
this.$set(item, 'inputVisible', false)
})
if (this.$route.query.type == 1) {
this.type = this.$route.query.type
this.$refs.taoBao.modals = true
} else {
this.type = 0
}
})
},
setSort() {
// reftableref
// const el = this.$refs.tableParameter.$el.querySelectorAll(
@ -2346,6 +2358,7 @@ export default {
image: '',
price: 0,
wholesale_price: 0,
procure_price: 0,
cost: 0,
ot_price: 0,
select: true,
@ -2384,6 +2397,7 @@ export default {
image: '',
price: 0,
wholesale_price: 0,
procure_price: 0,
cost: 0,
ot_price: 0,
select: true,
@ -2409,6 +2423,7 @@ export default {
res[i]['image'] = v.pic
res[i]['price'] = v.price
res[i]['wholesale_price'] = v.wholesale_price
res[i]['procure_price'] = v.procure_price
res[i]['cost'] = v.cost
res[i]['ot_price'] = v.ot_price
res[i]['sku'] = v.sku
@ -2652,6 +2667,7 @@ export default {
this.attrVal = {
price: null,
wholesale_price: null,
procure_price: null,
cost: null,
ot_price: null,
svip_price: null,
@ -2674,6 +2690,7 @@ export default {
this.attrVal = {
price: null,
wholesale_price: null,
procure_price: null,
cost: null,
ot_price: null,
stock: null,
@ -2716,6 +2733,7 @@ export default {
if(this.oneFormBatch[0].image!= '')this.$set(val, 'image', this.oneFormBatch[0].image)
if(this.oneFormBatch[0].price!= null && this.oneFormBatch[0].price!= '')this.$set(val, 'price', this.oneFormBatch[0].price)
if(this.oneFormBatch[0].wholesale_price!= null && this.oneFormBatch[0].wholesale_price!= '')this.$set(val, 'wholesale_price', this.oneFormBatch[0].wholesale_price)
if(this.oneFormBatch[0].procure_price!= null && this.oneFormBatch[0].procure_price!= '')this.$set(val, 'procure_price', this.oneFormBatch[0].procure_price)
if(this.oneFormBatch[0].cost!= null && this.oneFormBatch[0].cost!= '')this.$set(val, 'cost', this.oneFormBatch[0].cost)
if(this.oneFormBatch[0].ot_price!= null && this.oneFormBatch[0].ot_price!= '')this.$set(val, 'ot_price', this.oneFormBatch[0].ot_price)
if(this.oneFormBatch[0].svip_price!= null && this.oneFormBatch[0].svip_price!= '')this.$set(val, 'svip_price', this.oneFormBatch[0].svip_price)
@ -2920,6 +2938,7 @@ export default {
this.attrVal = {
price: null,
wholesale_price: null,
procure_price: null,
cost: null,
ot_price: null,
svip_price: null,