|
|
@ -38,7 +38,8 @@ |
|
|
|
{{ serviceAddInfo && serviceAddInfo.type_desc }} |
|
|
|
</p> |
|
|
|
</div> |
|
|
|
<div class="flex" v-if="serviceAddInfo && serviceAddInfo.info_prompt && serviceAddInfo.info_prompt.title"> |
|
|
|
<div class="flex" |
|
|
|
v-if="serviceAddInfo && serviceAddInfo.info_prompt && serviceAddInfo.info_prompt.title"> |
|
|
|
<label>{{ serviceAddInfo.info_prompt.title }}:</label> |
|
|
|
<p :style="serviceAddInfo.info_prompt.style"> |
|
|
|
{{ serviceAddInfo.info_prompt.content }} |
|
|
@ -54,21 +55,28 @@ |
|
|
|
<div class="flex"> |
|
|
|
<label>进货价格:</label> |
|
|
|
<p> |
|
|
|
{{ serviceAddInfo.supply_price }}{{ serviceAddInfo.supply_price_warning }} |
|
|
|
{{ serviceAddInfo.supply_info && serviceAddInfo.supply_info.price_desc |
|
|
|
}}{{ serviceAddInfo.supply_info && serviceAddInfo.supply_info.price_warning }} |
|
|
|
</p> |
|
|
|
</div> |
|
|
|
<div class="flex" v-if="serviceAddInfo && serviceAddInfo.price_prompt && serviceAddInfo.price_prompt.title"> |
|
|
|
<div class="flex" |
|
|
|
v-if="serviceAddInfo && serviceAddInfo.price_prompt && serviceAddInfo.price_prompt.title"> |
|
|
|
<label>{{ serviceAddInfo.price_prompt.title }}:</label> |
|
|
|
<p :style="serviceAddInfo.price_prompt.style"> |
|
|
|
{{ serviceAddInfo.price_prompt.content }} |
|
|
|
</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="common_scss green_back" v-if="serviceAddInfo.web_price_set"> |
|
|
|
<div class="common_scss green_back"> |
|
|
|
<div class="flex-between"> |
|
|
|
<div class="flex gap6"> |
|
|
|
<img src="@/assets/site/price3.svg" alt=""> |
|
|
|
<b class="green">利润分析</b> |
|
|
|
</div> |
|
|
|
<div class="green_web"> |
|
|
|
依据网页端售价分析 |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="flex"> |
|
|
|
<label>利润率:</label> |
|
|
|
<p v-if="service_unit == '1'"> |
|
|
@ -82,7 +90,9 @@ |
|
|
|
<label>利润额:</label> |
|
|
|
<p v-if="service_unit == '1'">因售卖单位设置为篇,利润额无法计算</p> |
|
|
|
<p v-if="service_unit == '0'"> |
|
|
|
每1000字赚{{ calculation.profitPerUnit }}元(因单位进制差异,金额为约数) |
|
|
|
每{{ serviceAddInfo.supply_info && serviceAddInfo.supply_info.unit_num }}字赚{{ |
|
|
|
calculation.profitPerUnit |
|
|
|
}}元(因单位进制差异,金额为约数) |
|
|
|
</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -97,16 +107,13 @@ |
|
|
|
</div> |
|
|
|
<div class="flex-wrap"> |
|
|
|
<div class="flex-left"> |
|
|
|
<GuipRadio v-model="service_unit" :options="serviceAddInfo.set_units" label="单位类型" |
|
|
|
prop="language" class="column" /> |
|
|
|
<GuipRadio v-model="service_unit" :options="serviceAddInfo.set_units" prop="language" /> |
|
|
|
<div class="mt_12"> |
|
|
|
<GuipInput width="100%" v-if="service_unit === '0'" prop="unit_num" |
|
|
|
placeholder="填写单位数,如XX元/1000字符,单位数设为1000" v-model="serviceInfo.unit_num" |
|
|
|
@input="priceInput" @blur="priceBlur" unit="字符"></GuipInput> |
|
|
|
</div> |
|
|
|
<template v-if="service_unit === '0'"> |
|
|
|
<div class="flex-line"></div> |
|
|
|
<div class="flex-right"> |
|
|
|
<GuipInput width="100%" class="column" prop="unit_num" label="设置单位数" desc="如售价XX元/1000字符,单位数设为1000" |
|
|
|
v-model="serviceInfo.unit_num" @input="priceInput" @blur="priceBlur" unit="字符"></GuipInput> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</div> |
|
|
|
</el-form> |
|
|
|
</div> |
|
|
@ -122,8 +129,8 @@ |
|
|
|
<div class="flex-left"> |
|
|
|
<GuipInput v-if="service_unit !== '0'" v-model="serviceInfo.price" width="100%" |
|
|
|
ref="GuipInput" :unit="'元/篇'"></GuipInput> |
|
|
|
<GuipInput v-if="service_unit === '0'" width="100%" label="非电商支付的售价" class="column" ref="priceRef1" |
|
|
|
v-model="serviceInfo.price" @input="priceChange" |
|
|
|
<GuipInput v-if="service_unit === '0'" width="100%" label="非电商支付的售价" class="column" |
|
|
|
ref="priceRef1" v-model="serviceInfo.price" @input="priceChange" |
|
|
|
:unit="'元/' + (serviceInfo.unit_num || '') + serviceAddInfo.unit_name" |
|
|
|
@blur="priceBlur"> |
|
|
|
</GuipInput> |
|
|
@ -218,7 +225,7 @@ |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 店铺商品绑定--> |
|
|
|
<div class="flex-common mb12 price-set" v-if="relatedProducts"> |
|
|
|
<div class="flex-common mb12 price-set" id="relatedProducts" v-if="relatedProducts"> |
|
|
|
<el-form class="el-row demo-ruleForm" ref="formRef"> |
|
|
|
<div class="price-top"> |
|
|
|
<span class="title">关联电商商品</span> |
|
|
@ -267,7 +274,9 @@ |
|
|
|
<div class="register-btns flex gap12"> |
|
|
|
<!-- <span class="service-open-num">已开启 {{addNum}}项 服务</span><GuipButton type="primary" :btnstyle="{ width: '144px', height: '46px' }" @click="jumpStep">返回服务列表</GuipButton> --> |
|
|
|
<GuipButton type="system" size="page" @click="jumpStep">取消</GuipButton> |
|
|
|
<GuipButton type="primary" size="page" @click="jumpNextStep">设置下一项服务</GuipButton> |
|
|
|
<GuipButton type="primary" size="page" v-if="gobackStatus" @click="jumpStep">返回</GuipButton> |
|
|
|
<GuipButton type="primary" size="page" v-else ref="setNextItemRef" @click="jumpNextStep">设置下一项服务 |
|
|
|
</GuipButton> |
|
|
|
</div> |
|
|
|
<GuipDialog :dialogVisible="dialogDelServiceConfim" title="提示" :show-close-button="false" |
|
|
|
@confirm="handleDelServiceConfirm" @cancel="handleDelServiceCancel"> |
|
|
@ -289,7 +298,71 @@ import GuipDialog from "@/components/GuipDialog.vue"; |
|
|
|
import GuipRadio from "@/components/GuipRadio.vue"; |
|
|
|
import ValueAdded from "@/components/site/serviceSetting/valueAdded.vue"; |
|
|
|
import SyncPrice from "@/components/site/serviceSetting/syncPrice.vue"; |
|
|
|
|
|
|
|
// 定义数据结构 |
|
|
|
// const currentItem1 = { |
|
|
|
// type: '6', |
|
|
|
// name: '万方通用版a salads asides33', |
|
|
|
// is_select: true, |
|
|
|
// parentType:'3', |
|
|
|
// web_price_set:true, |
|
|
|
// web_price_set_flag:true, |
|
|
|
// shop_price_set:false |
|
|
|
// }; |
|
|
|
|
|
|
|
// const secondMenu1 = { |
|
|
|
// 1: { |
|
|
|
// type: 1, |
|
|
|
// name: "万方", |
|
|
|
// is_select: false, |
|
|
|
// list: [{ |
|
|
|
// checked: true, |
|
|
|
// is_select: false, |
|
|
|
// name: "万方通用版", |
|
|
|
// type: 68, |
|
|
|
// parentType:'1', |
|
|
|
// web_price_set:true, |
|
|
|
// web_price_set_flag:true, |
|
|
|
// shop_price_set:true |
|
|
|
// }, |
|
|
|
// { |
|
|
|
// checked: true, |
|
|
|
// is_select: false, |
|
|
|
// name: "万方硕博版", |
|
|
|
// type: 30, |
|
|
|
// parentType:'1', |
|
|
|
// web_price_set:true, |
|
|
|
// shop_price_set:true |
|
|
|
// }] |
|
|
|
// }, |
|
|
|
// '3': { |
|
|
|
// type: '3', |
|
|
|
// name: '万方个哥哥个', |
|
|
|
// is_select: true, |
|
|
|
// list: [ |
|
|
|
// { |
|
|
|
// type: '6', |
|
|
|
// name: '万方通用版a salads asides33', |
|
|
|
// is_select: true, |
|
|
|
// parentType:'3', |
|
|
|
// web_price_set:true, |
|
|
|
// web_price_set_flag:true, |
|
|
|
// shop_price_set:false |
|
|
|
// }, |
|
|
|
// // { |
|
|
|
// // type: '27', |
|
|
|
// // name: '通用说播版33', |
|
|
|
// // is_select: true, |
|
|
|
// // parentType:'3' |
|
|
|
// // }, |
|
|
|
// // { |
|
|
|
// // type: '109', |
|
|
|
// // name: '本科通用版33', |
|
|
|
// // is_select: true, |
|
|
|
// // parentType:'3' |
|
|
|
// // }, |
|
|
|
// ] |
|
|
|
// }, |
|
|
|
// }; |
|
|
|
export default { |
|
|
|
name: 'siteServiceAdd', |
|
|
|
props: [''], |
|
|
@ -306,7 +379,6 @@ export default { |
|
|
|
}, |
|
|
|
beforeRouteLeave(to, from, next) { |
|
|
|
if (!to.path.startsWith('/agent/siteServiceAdd')) { |
|
|
|
console.log('=0000走了这里'); |
|
|
|
// 重置侧边栏数据 |
|
|
|
store.commit('SET_SECOND_MENU', {}); |
|
|
|
} |
|
|
@ -350,6 +422,7 @@ export default { |
|
|
|
{ required: true, message: '请设置单位数', trigger: 'blur' } |
|
|
|
], |
|
|
|
}, |
|
|
|
gobackStatus: false |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
@ -373,8 +446,20 @@ export default { |
|
|
|
this.relatedProducts = false; |
|
|
|
}, |
|
|
|
deep: true // 添加深度监听 |
|
|
|
}, |
|
|
|
'$store.state.secondMenu': { |
|
|
|
handler(newVal) { |
|
|
|
let nextItem = this.findFirstIncomplete(this.currentMenuItem, newVal) |
|
|
|
if (nextItem != true) { |
|
|
|
this.gobackStatus = false |
|
|
|
}else{ |
|
|
|
this.gobackStatus = true |
|
|
|
} |
|
|
|
}, |
|
|
|
deep: true // 添加深度监听 |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
created() { |
|
|
|
if (!this.$route.query.uid && !this.$route.query.prodid) { |
|
|
|
this.$message.error('非法请求'); |
|
|
@ -393,7 +478,6 @@ export default { |
|
|
|
} |
|
|
|
if (!this.secondMenu || this.secondMenu.length === 0 || Object.keys(this.secondMenu).length == 0) { |
|
|
|
// 尝试从 localStorage 恢复 |
|
|
|
// console.log(savedData,'savedData'); |
|
|
|
const savedData = localStorage.getItem('selectedServices'); |
|
|
|
if (savedData) { |
|
|
|
this.$store.commit('SET_SECOND_MENU', JSON.parse(savedData)); |
|
|
@ -401,11 +485,103 @@ export default { |
|
|
|
this.$router.go(-1); |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(this.menuItem, 'menuItem===', this.currentMenuItem); |
|
|
|
// store.commit('SET_PAGETITLE', '站点信息'); |
|
|
|
// this.getAddServiceList(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
findFirstIncomplete(currentItem, secondMenu) { |
|
|
|
// 获取所有父级key并按数字顺序排序 |
|
|
|
const parentKeys = Object.keys(secondMenu).sort((a, b) => parseInt(a) - parseInt(b)); |
|
|
|
if (parentKeys.length === 0) return true; |
|
|
|
|
|
|
|
// 获取当前项的父级类型和索引 |
|
|
|
const currentParentType = currentItem.parentType; |
|
|
|
const currentParentIndex = parentKeys.indexOf(currentParentType); |
|
|
|
|
|
|
|
// 如果当前父级不存在,从第一个父级开始查找 |
|
|
|
if (currentParentIndex === -1) { |
|
|
|
return this.findInParentsFromStart(parentKeys, secondMenu); |
|
|
|
} |
|
|
|
|
|
|
|
// 1. 先从当前父级的当前项位置开始查找 |
|
|
|
const currentParentList = secondMenu[currentParentType].list; |
|
|
|
const currentIndex = currentParentList.findIndex(item => item.type === currentItem.type); |
|
|
|
|
|
|
|
if (currentIndex !== -1) { |
|
|
|
// 在当前父级list中从当前项开始查找 |
|
|
|
for (let i = currentIndex; i < currentParentList.length; i++) { |
|
|
|
if (!this.checkItemComplete(currentParentList[i])) { |
|
|
|
return currentParentList[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 2. 从当前父级的下一个父级开始查找剩余父级 |
|
|
|
for (let i = currentParentIndex + 1; i < parentKeys.length; i++) { |
|
|
|
const parentKey = parentKeys[i]; |
|
|
|
const incompleteItem = this.findIncompleteInParent(secondMenu[parentKey]); |
|
|
|
if (incompleteItem) return incompleteItem; |
|
|
|
} |
|
|
|
|
|
|
|
// 3. 从第一个父级开始查找到当前父级的前一个 |
|
|
|
for (let i = 0; i < currentParentIndex; i++) { |
|
|
|
const parentKey = parentKeys[i]; |
|
|
|
const incompleteItem = this.findIncompleteInParent(secondMenu[parentKey]); |
|
|
|
if (incompleteItem) return incompleteItem; |
|
|
|
} |
|
|
|
|
|
|
|
// 所有项都已完成 |
|
|
|
return true; |
|
|
|
}, |
|
|
|
|
|
|
|
// 在指定父级中查找第一个未完成的项 |
|
|
|
findIncompleteInParent(parent) { |
|
|
|
if (!parent || !parent.list) return null; |
|
|
|
|
|
|
|
for (const item of parent.list) { |
|
|
|
if (!this.checkItemComplete(item)) { |
|
|
|
return item; |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
}, |
|
|
|
|
|
|
|
// 从第一个父级开始查找所有父级 |
|
|
|
findInParentsFromStart(parentKeys, secondMenu) { |
|
|
|
for (const parentKey of parentKeys) { |
|
|
|
const incompleteItem = this.findIncompleteInParent(secondMenu[parentKey]); |
|
|
|
if (incompleteItem) return incompleteItem; |
|
|
|
} |
|
|
|
return true; |
|
|
|
}, |
|
|
|
|
|
|
|
// 检查单个项是否完成 |
|
|
|
checkItemComplete(item) { |
|
|
|
const { web_price_set, shop_price_set, web_price_set_flag, shop_price_set_flag } = item; |
|
|
|
|
|
|
|
// 如果两个设置都不存在,视为未完成 |
|
|
|
if (web_price_set === undefined && shop_price_set === undefined) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
// 如果两个设置都为true,则两个flag都必须为true |
|
|
|
if (web_price_set === true && shop_price_set === true) { |
|
|
|
return web_price_set_flag === true && shop_price_set_flag === true; |
|
|
|
} |
|
|
|
|
|
|
|
// 如果只有web_price_set为true,则web_price_set_flag必须为true |
|
|
|
if (web_price_set === true && shop_price_set !== true) { |
|
|
|
return web_price_set_flag === true; |
|
|
|
} |
|
|
|
|
|
|
|
// 如果只有shop_price_set为true,则shop_price_set_flag必须为true |
|
|
|
if (shop_price_set === true && web_price_set !== true) { |
|
|
|
return shop_price_set_flag === true; |
|
|
|
} |
|
|
|
|
|
|
|
// 其他情况视为未完成 |
|
|
|
return false; |
|
|
|
}, |
|
|
|
|
|
|
|
extractedNumber() { |
|
|
|
const match = this.basePrice.match(/(\d+\.?\d*)/); |
|
|
@ -415,15 +591,13 @@ export default { |
|
|
|
this.form1.unit_num = val; |
|
|
|
}, |
|
|
|
priceBlur() { |
|
|
|
const price = this.serviceAddInfo.supply_price.replace(/[^\d.]/g, ''); |
|
|
|
const price = this.serviceAddInfo?.supply_info?.price; |
|
|
|
this.calculation = this.calculateProfitRate(this.serviceInfo.price, this.serviceInfo.unit_num, Number(price)); |
|
|
|
}, |
|
|
|
priceChange() { |
|
|
|
if (this.service_unit == '0' && !this.serviceInfo.unit_num) { |
|
|
|
this.serviceInfo.price = '' |
|
|
|
this.$refs.formRef1.validateField('unit_num') |
|
|
|
|
|
|
|
// console.log(this.serviceInfo.unit_num); |
|
|
|
this.$positionMessage({ |
|
|
|
type: 'error', |
|
|
|
message: '请先设置单位数', |
|
|
@ -486,8 +660,15 @@ export default { |
|
|
|
for (let key in obj) { |
|
|
|
obj[key] = `按${obj[key]}售卖` |
|
|
|
} |
|
|
|
|
|
|
|
// that.serviceAddInfo.set_units = |
|
|
|
let secondMenu = JSON.parse(JSON.stringify(this.secondMenu)); |
|
|
|
let parentType = this.currentMenuItem.parentType; |
|
|
|
secondMenu[parentType].list.forEach(item => { |
|
|
|
if (item.type == this.currentMenuItem.type) { |
|
|
|
item['web_price_set'] = that.serviceAddInfo.web_price_set; |
|
|
|
item['shop_price_set'] = that.serviceAddInfo.shop_price_set; |
|
|
|
} |
|
|
|
}) |
|
|
|
store.commit('SET_SECOND_MENU', secondMenu); |
|
|
|
that.service_unit = that.serviceAddInfo.unit |
|
|
|
//拼多多渠道查询商品所需参数初始化 |
|
|
|
if (that.serviceAddInfo.shop_name === '拼多多') this.initPddParam(that.uid) |
|
|
@ -505,6 +686,72 @@ export default { |
|
|
|
console.error(error, 'error') |
|
|
|
}) |
|
|
|
}, |
|
|
|
// secondMenu: { |
|
|
|
// 1: { |
|
|
|
// type: 1, |
|
|
|
// name: "万方", |
|
|
|
// is_select: false, |
|
|
|
// list: [{ |
|
|
|
// checked: true, |
|
|
|
// is_select: false, |
|
|
|
// name: "万方通用版", |
|
|
|
// type: 68, |
|
|
|
// parentType:'1', |
|
|
|
// web_price_set:true, |
|
|
|
// web_price_set_flag:true, |
|
|
|
// shop_price_set:false |
|
|
|
// }, |
|
|
|
// { |
|
|
|
// checked: true, |
|
|
|
// is_select: false, |
|
|
|
// name: "万方硕博版", |
|
|
|
// type: 30, |
|
|
|
// parentType:'1', |
|
|
|
// web_price_set:true, |
|
|
|
// shop_price_set:true |
|
|
|
// } |
|
|
|
// ] |
|
|
|
// }, |
|
|
|
// '3': { |
|
|
|
// type: '3', |
|
|
|
// name: '万方个哥哥个', |
|
|
|
// is_select: true, |
|
|
|
// list: [ |
|
|
|
// { |
|
|
|
// type: '6', |
|
|
|
// name: '万方通用版a salads asides33', |
|
|
|
// is_select: true, |
|
|
|
// parentType:'3', |
|
|
|
// web_price_set:true, |
|
|
|
// web_price_set_flag:true, |
|
|
|
// shop_price_set:true |
|
|
|
// }, |
|
|
|
// { |
|
|
|
// type: '27', |
|
|
|
// name: '通用说播版33', |
|
|
|
// is_select: true, |
|
|
|
// parentType:'3' |
|
|
|
// }, |
|
|
|
// { |
|
|
|
// type: '109', |
|
|
|
// name: '本科通用版33', |
|
|
|
// is_select: true, |
|
|
|
// parentType:'3' |
|
|
|
// }, |
|
|
|
// ] |
|
|
|
// }, |
|
|
|
// } |
|
|
|
|
|
|
|
// currentItem = { |
|
|
|
// checked: true, |
|
|
|
// is_select: false, |
|
|
|
// name: "万方通用版", |
|
|
|
// type: 68, |
|
|
|
// parentType:'1', |
|
|
|
// web_price_set:true, |
|
|
|
// web_price_set_flag:true, |
|
|
|
// shop_price_set:false |
|
|
|
// } |
|
|
|
//查询是否添加了此服务 |
|
|
|
getServiceInfo() { |
|
|
|
const that = this |
|
|
@ -518,6 +765,9 @@ export default { |
|
|
|
//默认未开启 |
|
|
|
if (response.status && response.data) { |
|
|
|
that.serviceInfo = response.data |
|
|
|
if (that.serviceInfo.unit_piece) { |
|
|
|
this.relatedProducts = true; |
|
|
|
} |
|
|
|
that.service_status = true |
|
|
|
that.getServiceBindGoods() |
|
|
|
} |
|
|
@ -537,6 +787,7 @@ export default { |
|
|
|
if (response.status && response.data) { |
|
|
|
that.$nextTick(() => { |
|
|
|
that.bindList = response.data |
|
|
|
this.relatedProducts = response.data.length > 0 ? true : false |
|
|
|
}) |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
@ -545,7 +796,6 @@ export default { |
|
|
|
}, |
|
|
|
handleUnitName() { |
|
|
|
this.serviceAddInfo.unit_name = this.serviceAddInfo.set_units[this.service_unit]; |
|
|
|
console.log(this.serviceAddInfo.unit_name, 'this.serviceAddInfo.unit_name====---999'); |
|
|
|
}, |
|
|
|
handleDelServiceClick() { |
|
|
|
this.dialogDelServiceConfim = true |
|
|
@ -592,37 +842,37 @@ export default { |
|
|
|
item['unit_num'] = that.serviceInfo.unit_num |
|
|
|
item['unit'] = that.service_unit |
|
|
|
item['unit_price'] = that.serviceInfo.price |
|
|
|
item['web_price_set_flag'] = true; |
|
|
|
} |
|
|
|
}) |
|
|
|
console.log(secondMenu, 'secondMenu===='); |
|
|
|
store.commit('SET_SECOND_MENU', secondMenu); |
|
|
|
|
|
|
|
// //非字符计费 |
|
|
|
// if(that.service_unit !== '0') { |
|
|
|
// that.serviceInfo.unit_num = 1 |
|
|
|
// that.serviceInfo.base_unit_num = '' |
|
|
|
// that.serviceInfo.base_unit_price = '' |
|
|
|
// } |
|
|
|
// this.$http('POST', "/agentnew/ajax_set_service_price", { |
|
|
|
// uid: that.uid, |
|
|
|
// type: that.type, |
|
|
|
// unit: that.service_unit, |
|
|
|
// unit_num: that.serviceInfo.unit_num, |
|
|
|
// unit_price: that.serviceInfo.price, |
|
|
|
// b_unit_num: that.serviceInfo.base_unit_num, |
|
|
|
// b_unit_price: that.serviceInfo.base_unit_price, |
|
|
|
// }).then(response => { |
|
|
|
// if (response.status) { |
|
|
|
// // store.commit('SET_SECOND_MENU', secondMenu); |
|
|
|
// that.service_status = true |
|
|
|
// // that.setMenuList(that.type, true) |
|
|
|
// that.$message.success('保存成功'); |
|
|
|
// return true; |
|
|
|
// } |
|
|
|
// that.$message.error(response.info); |
|
|
|
// }).catch(error => { |
|
|
|
// console.error(error, 'error') |
|
|
|
// }) |
|
|
|
if (that.service_unit !== '0') { |
|
|
|
that.serviceInfo.unit_num = 1 |
|
|
|
that.serviceInfo.base_unit_num = '' |
|
|
|
that.serviceInfo.base_unit_price = '' |
|
|
|
} |
|
|
|
this.$http('POST', "/agentnew/ajax_set_service_price", { |
|
|
|
uid: that.uid, |
|
|
|
type: that.type, |
|
|
|
unit: that.service_unit, |
|
|
|
unit_num: that.serviceInfo.unit_num, |
|
|
|
unit_price: that.serviceInfo.price, |
|
|
|
b_unit_num: that.serviceInfo.base_unit_num, |
|
|
|
b_unit_price: that.serviceInfo.base_unit_price, |
|
|
|
}).then(response => { |
|
|
|
if (response.status) { |
|
|
|
// store.commit('SET_SECOND_MENU', secondMenu); |
|
|
|
that.service_status = true |
|
|
|
// that.setMenuList(that.type, true) |
|
|
|
that.$message.success('保存成功'); |
|
|
|
return true; |
|
|
|
} |
|
|
|
that.$message.error(response.info); |
|
|
|
}).catch(error => { |
|
|
|
console.error(error, 'error') |
|
|
|
}) |
|
|
|
}, |
|
|
|
resetShopPrice() { |
|
|
|
this.serviceInfo.unit_piece = '' |
|
|
@ -632,6 +882,7 @@ export default { |
|
|
|
}, |
|
|
|
saveShopPrice() { |
|
|
|
const that = this |
|
|
|
|
|
|
|
//非字符计费 单位默认为 1 |
|
|
|
//非字符计费 |
|
|
|
if (that.service_unit !== '0') { |
|
|
@ -639,7 +890,6 @@ export default { |
|
|
|
that.serviceInfo.base_unit_num = '' |
|
|
|
that.serviceInfo.base_unit_piece = '' |
|
|
|
} |
|
|
|
console.log(that.serviceInfo, 'ddd') |
|
|
|
this.$http('POST', "/agentnew/ajax_set_service_price", { |
|
|
|
uid: that.uid, |
|
|
|
type: that.type, |
|
|
@ -652,6 +902,12 @@ export default { |
|
|
|
if (response.status) { |
|
|
|
that.service_status = true |
|
|
|
this.relatedProducts = true; |
|
|
|
setTimeout(() => { |
|
|
|
const el = document.querySelector('#relatedProducts') |
|
|
|
if (el) { |
|
|
|
el.scrollIntoView({ behavior: 'smooth', block: 'start' }) |
|
|
|
} |
|
|
|
}, 500) |
|
|
|
// that.setMenuList(that.type, true) |
|
|
|
that.$message.success('保存成功'); |
|
|
|
return true; |
|
|
@ -685,6 +941,14 @@ export default { |
|
|
|
}, |
|
|
|
handleBind(bindRes) { |
|
|
|
this.showBind = false |
|
|
|
let secondMenu = JSON.parse(JSON.stringify(this.secondMenu)); |
|
|
|
let parentType = this.currentMenuItem.parentType; |
|
|
|
secondMenu[parentType].list.forEach(item => { |
|
|
|
if (item.type == this.currentMenuItem.type) { |
|
|
|
item['shop_price_set_flag'] = true; |
|
|
|
} |
|
|
|
}) |
|
|
|
store.commit('SET_SECOND_MENU', secondMenu); |
|
|
|
if (bindRes) this.getServiceBindGoods() |
|
|
|
}, |
|
|
|
loadPddSDK() { |
|
|
@ -734,6 +998,17 @@ export default { |
|
|
|
that.$message.success('删除成功'); |
|
|
|
this.$nextTick(() => { |
|
|
|
that.bindList.splice(that.delRow.index, 1); |
|
|
|
let length = that.bindList.length; |
|
|
|
if (length == 0) { |
|
|
|
let secondMenu = JSON.parse(JSON.stringify(this.secondMenu)); |
|
|
|
let parentType = this.currentMenuItem.parentType; |
|
|
|
secondMenu[parentType].list.forEach(item => { |
|
|
|
if (item.type == this.currentMenuItem.type) { |
|
|
|
item['shop_price_set_flag'] = false; |
|
|
|
} |
|
|
|
}) |
|
|
|
store.commit('SET_SECOND_MENU', secondMenu); |
|
|
|
} |
|
|
|
}) |
|
|
|
return true; |
|
|
|
} |
|
|
@ -776,9 +1051,33 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
jumpNextStep() { |
|
|
|
let parentType = this.currentMenuItem.parentType; |
|
|
|
const currentParentList = this.secondMenu[parentType].list; |
|
|
|
const currentItem = currentParentList.filter(item => item.type === this.currentMenuItem.type)[0]; |
|
|
|
let web_price_set_flag = currentItem.web_price_set_flag; |
|
|
|
let shop_price_set_flag = currentItem.shop_price_set_flag; |
|
|
|
let web_price_set = currentItem.web_price_set; |
|
|
|
let shop_price_set = currentItem.shop_price_set; |
|
|
|
// 判断当前项 |
|
|
|
if ((web_price_set && !web_price_set_flag) || (shop_price_set && !shop_price_set_flag)) { |
|
|
|
this.$positionMessage({ |
|
|
|
type: 'error', |
|
|
|
message: '当前服务还未设置完成', |
|
|
|
target: this.$refs.setNextItemRef, // 可以是DOM元素或选择器 |
|
|
|
position: 'top' |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|
// 设置下一项 |
|
|
|
let nextItem = this.findFirstIncomplete(currentItem, this.secondMenu) |
|
|
|
if (nextItem == true) { |
|
|
|
this.gobackStatus = true |
|
|
|
return |
|
|
|
} |
|
|
|
store.commit('SET_CURRENTMENUITEM', nextItem); |
|
|
|
}, |
|
|
|
calculateProfitRate(price, num, baseCost = 2.4) { |
|
|
|
calculateProfitRate(price, num, baseCost) { |
|
|
|
let unit_num = this.serviceAddInfo?.supply_info?.unit_num; |
|
|
|
// 输入验证 |
|
|
|
if (!price || !num || price <= 0 || num <= 0) { |
|
|
|
return { |
|
|
@ -791,19 +1090,15 @@ export default { |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
// 计算每1000字的售价 |
|
|
|
const pricePerThousand = (price / num) * 1000; |
|
|
|
console.log(pricePerThousand, 'pricePerThousand=='); |
|
|
|
|
|
|
|
// 计算每进价单位字符的售价 |
|
|
|
const pricePerThousand = (price / num) * unit_num; |
|
|
|
// 计算利率(利润率) |
|
|
|
const profitRate = ((pricePerThousand - baseCost) / baseCost) * 100; |
|
|
|
console.log(profitRate, 'profitRate=='); |
|
|
|
|
|
|
|
// 计算每1000字的利润 |
|
|
|
// 计算每进价单位字符的利润 |
|
|
|
const profitPerUnit = pricePerThousand - baseCost; |
|
|
|
|
|
|
|
// 计算总利润 |
|
|
|
const totalProfit = (profitPerUnit / 1000) * num; |
|
|
|
const totalProfit = (profitPerUnit / unit_num) * num; |
|
|
|
|
|
|
|
return { |
|
|
|
profitRate: Number(profitRate.toFixed(2)), // 利率(百分比) |
|
|
@ -892,6 +1187,21 @@ export default { |
|
|
|
background: #EFFFE0; |
|
|
|
} |
|
|
|
|
|
|
|
.green_web { |
|
|
|
height: 22px; |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
|
padding: 2px 10px; |
|
|
|
gap: 6px; |
|
|
|
border-radius: 4px; |
|
|
|
background: rgba(239, 255, 224, 0.5); |
|
|
|
box-sizing: border-box; |
|
|
|
border: 1px solid rgba(0, 194, 97, 0.6); |
|
|
|
letter-spacing: 0.08em; |
|
|
|
color: #0DAF49; |
|
|
|
} |
|
|
|
|
|
|
|
.serviceAdd-wrap { |
|
|
|
height: 100%; |
|
|
|
display: flex; |
|
|
|