Browse Source

Merge pull request '设置下一项服务交互修改' (#116) from zq-orderListTwo-0813 into master

Reviewed-on: #116
pull/119/head
zhangqi 6 days ago
parent
commit
ec259bc12c
  1. 28
      src/components/SliderScondThree.vue
  2. 452
      src/views/agent/siteServiceAdd.vue

28
src/components/SliderScondThree.vue

@ -26,6 +26,7 @@
<script> <script>
import store from '../store'; import store from '../store';
import GuipToolTip from "@/components/GuipToolTip.vue"; import GuipToolTip from "@/components/GuipToolTip.vue";
import { mapState } from 'vuex';
export default { export default {
options: { styleIsolation: "shared" }, options: { styleIsolation: "shared" },
@ -47,7 +48,7 @@ export default {
activeFloor: '', activeFloor: '',
scrollLock: false, scrollLock: false,
componentsName: '', componentsName: '',
currentMenuItem:{} currentMenuItem1:{}
}; };
}, },
computed: { computed: {
@ -72,6 +73,7 @@ export default {
// dom = domAppend + domName id // dom = domAppend + domName id
}, this.renderKey); }, this.renderKey);
}, },
...mapState(['currentMenuItem'])
}, },
components: { components: {
@ -80,6 +82,7 @@ export default {
watch: { watch: {
menuList:{ menuList:{
handler(newVal, oldVal) { handler(newVal, oldVal) {
console.log('更新了~nemulist');
this.activeNames = newVal.map(item => item.type) this.activeNames = newVal.map(item => item.type)
// oldVal // oldVal
if (!oldVal || oldVal.length === 0) { if (!oldVal || oldVal.length === 0) {
@ -95,6 +98,19 @@ export default {
} }
}, },
immediate: true immediate: true
},
'$store.state.currentMenuItem': {
handler(newVal) {
//
console.log(newVal,this.currentMenuItem1,JSON.stringify(this.currentMenuItem1) == newVal,'currentMenuItem====更新了');
// store.commit('SET_CURRENTMENUITEM', {...newVal});
this.currentMenuItem1 = newVal;
let subtitle = this.renderKeyNew.subtitle;
this.activeFloor = newVal[subtitle];
// this.setActiveCur(newVal, item, index)
},
deep: true //
} }
}, },
mounted() { mounted() {
@ -146,8 +162,8 @@ export default {
const subtitle = this.renderKeyNew.subtitle; const subtitle = this.renderKeyNew.subtitle;
this.activeFloor = menuList[0].list[0][subtitle] || menuList[0].list[0]?.componentsName || ''; this.activeFloor = menuList[0].list[0][subtitle] || menuList[0].list[0]?.componentsName || '';
this.componentsName = menuList[0].list[0]?.componentsName || ''; this.componentsName = menuList[0].list[0]?.componentsName || '';
this.currentMenuItem = {...menuList[0].list[0]} this.currentMenuItem1 = {...menuList[0].list[0]}
console.log('更新了'); console.log('更新了currentItem---');
store.commit('SET_CURRENTMENUITEM', menuList[0].list[0]); store.commit('SET_CURRENTMENUITEM', menuList[0].list[0]);
this.curIndex = 0; this.curIndex = 0;
} }
@ -231,9 +247,9 @@ export default {
// }, 1000) // }, 1000)
// } // }
setActiveCur(item1, item, index) { setActiveCur(item1, item, index) {
console.log(item1,item,'===---item1'); // console.log(item1,item,index,'===---item1');
store.commit('SET_CURRENTMENUITEM', {...item1,parentType:item.type}); store.commit('SET_CURRENTMENUITEM', {...item1});
this.currentMenuItem = item1; this.currentMenuItem1 = {...item1};
this.curIndex = index; this.curIndex = index;
let subtitle = this.renderKeyNew.subtitle; let subtitle = this.renderKeyNew.subtitle;
let domName = this.renderKeyNew.domName; let domName = this.renderKeyNew.domName;

452
src/views/agent/siteServiceAdd.vue

@ -38,7 +38,8 @@
{{ serviceAddInfo && serviceAddInfo.type_desc }} {{ serviceAddInfo && serviceAddInfo.type_desc }}
</p> </p>
</div> </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> <label>{{ serviceAddInfo.info_prompt.title }}</label>
<p :style="serviceAddInfo.info_prompt.style"> <p :style="serviceAddInfo.info_prompt.style">
{{ serviceAddInfo.info_prompt.content }} {{ serviceAddInfo.info_prompt.content }}
@ -54,21 +55,28 @@
<div class="flex"> <div class="flex">
<label>进货价格</label> <label>进货价格</label>
<p> <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> </p>
</div> </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> <label>{{ serviceAddInfo.price_prompt.title }}</label>
<p :style="serviceAddInfo.price_prompt.style"> <p :style="serviceAddInfo.price_prompt.style">
{{ serviceAddInfo.price_prompt.content }} {{ serviceAddInfo.price_prompt.content }}
</p> </p>
</div> </div>
</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"> <div class="flex gap6">
<img src="@/assets/site/price3.svg" alt=""> <img src="@/assets/site/price3.svg" alt="">
<b class="green">利润分析</b> <b class="green">利润分析</b>
</div> </div>
<div class="green_web">
依据网页端售价分析
</div>
</div>
<div class="flex"> <div class="flex">
<label>利润率</label> <label>利润率</label>
<p v-if="service_unit == '1'"> <p v-if="service_unit == '1'">
@ -82,7 +90,9 @@
<label>利润额</label> <label>利润额</label>
<p v-if="service_unit == '1'">因售卖单位设置为篇利润额无法计算</p> <p v-if="service_unit == '1'">因售卖单位设置为篇利润额无法计算</p>
<p v-if="service_unit == '0'"> <p v-if="service_unit == '0'">
每1000字赚{{ calculation.profitPerUnit }}因单位进制差异金额为约数 {{ serviceAddInfo.supply_info && serviceAddInfo.supply_info.unit_num }}字赚{{
calculation.profitPerUnit
}}因单位进制差异金额为约数
</p> </p>
</div> </div>
</div> </div>
@ -97,16 +107,13 @@
</div> </div>
<div class="flex-wrap"> <div class="flex-wrap">
<div class="flex-left"> <div class="flex-left">
<GuipRadio v-model="service_unit" :options="serviceAddInfo.set_units" label="单位类型" <GuipRadio v-model="service_unit" :options="serviceAddInfo.set_units" prop="language" />
prop="language" class="column" /> <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> </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> </div>
</template>
</div> </div>
</el-form> </el-form>
</div> </div>
@ -122,8 +129,8 @@
<div class="flex-left"> <div class="flex-left">
<GuipInput v-if="service_unit !== '0'" v-model="serviceInfo.price" width="100%" <GuipInput v-if="service_unit !== '0'" v-model="serviceInfo.price" width="100%"
ref="GuipInput" :unit="'元/篇'"></GuipInput> ref="GuipInput" :unit="'元/篇'"></GuipInput>
<GuipInput v-if="service_unit === '0'" width="100%" label="非电商支付的售价" class="column" ref="priceRef1" <GuipInput v-if="service_unit === '0'" width="100%" label="非电商支付的售价" class="column"
v-model="serviceInfo.price" @input="priceChange" ref="priceRef1" v-model="serviceInfo.price" @input="priceChange"
:unit="'元/' + (serviceInfo.unit_num || '') + serviceAddInfo.unit_name" :unit="'元/' + (serviceInfo.unit_num || '') + serviceAddInfo.unit_name"
@blur="priceBlur"> @blur="priceBlur">
</GuipInput> </GuipInput>
@ -218,7 +225,7 @@
</div> </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"> <el-form class="el-row demo-ruleForm" ref="formRef">
<div class="price-top"> <div class="price-top">
<span class="title">关联电商商品</span> <span class="title">关联电商商品</span>
@ -267,7 +274,9 @@
<div class="register-btns flex gap12"> <div class="register-btns flex gap12">
<!-- <span class="service-open-num">已开启 {{addNum}} 服务</span><GuipButton type="primary" :btnstyle="{ width: '144px', height: '46px' }" @click="jumpStep">返回服务列表</GuipButton> --> <!-- <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="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> </div>
<GuipDialog :dialogVisible="dialogDelServiceConfim" title="提示" :show-close-button="false" <GuipDialog :dialogVisible="dialogDelServiceConfim" title="提示" :show-close-button="false"
@confirm="handleDelServiceConfirm" @cancel="handleDelServiceCancel"> @confirm="handleDelServiceConfirm" @cancel="handleDelServiceCancel">
@ -289,7 +298,71 @@ import GuipDialog from "@/components/GuipDialog.vue";
import GuipRadio from "@/components/GuipRadio.vue"; import GuipRadio from "@/components/GuipRadio.vue";
import ValueAdded from "@/components/site/serviceSetting/valueAdded.vue"; import ValueAdded from "@/components/site/serviceSetting/valueAdded.vue";
import SyncPrice from "@/components/site/serviceSetting/syncPrice.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 { export default {
name: 'siteServiceAdd', name: 'siteServiceAdd',
props: [''], props: [''],
@ -306,7 +379,6 @@ export default {
}, },
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
if (!to.path.startsWith('/agent/siteServiceAdd')) { if (!to.path.startsWith('/agent/siteServiceAdd')) {
console.log('=0000走了这里');
// //
store.commit('SET_SECOND_MENU', {}); store.commit('SET_SECOND_MENU', {});
} }
@ -342,14 +414,15 @@ export default {
isValid: false isValid: false
}, },
// siteInfo: null, // siteInfo: null,
form1:{ form1: {
unit_num:'' unit_num: ''
}, },
rules:{ rules: {
unit_num: [ unit_num: [
{ required: true, message: '请设置单位数', trigger: 'blur' } { required: true, message: '请设置单位数', trigger: 'blur' }
], ],
}, },
gobackStatus: false
} }
}, },
@ -373,8 +446,20 @@ export default {
this.relatedProducts = false; this.relatedProducts = false;
}, },
deep: true // 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() { created() {
if (!this.$route.query.uid && !this.$route.query.prodid) { if (!this.$route.query.uid && !this.$route.query.prodid) {
this.$message.error('非法请求'); this.$message.error('非法请求');
@ -393,7 +478,6 @@ export default {
} }
if (!this.secondMenu || this.secondMenu.length === 0 || Object.keys(this.secondMenu).length == 0) { if (!this.secondMenu || this.secondMenu.length === 0 || Object.keys(this.secondMenu).length == 0) {
// localStorage // localStorage
// console.log(savedData,'savedData');
const savedData = localStorage.getItem('selectedServices'); const savedData = localStorage.getItem('selectedServices');
if (savedData) { if (savedData) {
this.$store.commit('SET_SECOND_MENU', JSON.parse(savedData)); this.$store.commit('SET_SECOND_MENU', JSON.parse(savedData));
@ -401,29 +485,119 @@ export default {
this.$router.go(-1); this.$router.go(-1);
} }
} }
console.log(this.menuItem, 'menuItem===', this.currentMenuItem);
// store.commit('SET_PAGETITLE', ''); // store.commit('SET_PAGETITLE', '');
// this.getAddServiceList(); // this.getAddServiceList();
}, },
methods: { 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;
}
// trueflagtrue
if (web_price_set === true && shop_price_set === true) {
return web_price_set_flag === true && shop_price_set_flag === true;
}
// web_price_settrueweb_price_set_flagtrue
if (web_price_set === true && shop_price_set !== true) {
return web_price_set_flag === true;
}
// shop_price_settrueshop_price_set_flagtrue
if (shop_price_set === true && web_price_set !== true) {
return shop_price_set_flag === true;
}
//
return false;
},
extractedNumber() { extractedNumber() {
const match = this.basePrice.match(/(\d+\.?\d*)/); const match = this.basePrice.match(/(\d+\.?\d*)/);
return match ? parseFloat(match[0]) : 0; return match ? parseFloat(match[0]) : 0;
}, },
priceInput(val){ priceInput(val) {
this.form1.unit_num = val; this.form1.unit_num = val;
}, },
priceBlur() { 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)); this.calculation = this.calculateProfitRate(this.serviceInfo.price, this.serviceInfo.unit_num, Number(price));
}, },
priceChange(){ priceChange() {
if(this.service_unit == '0' && !this.serviceInfo.unit_num){ if (this.service_unit == '0' && !this.serviceInfo.unit_num) {
this.serviceInfo.price = '' this.serviceInfo.price = ''
this.$refs.formRef1.validateField('unit_num') this.$refs.formRef1.validateField('unit_num')
// console.log(this.serviceInfo.unit_num);
this.$positionMessage({ this.$positionMessage({
type: 'error', type: 'error',
message: '请先设置单位数', message: '请先设置单位数',
@ -432,8 +606,8 @@ export default {
}) })
} }
}, },
priceChange1(){ priceChange1() {
if(this.service_unit == '0' && !this.serviceInfo.unit_num){ if (this.service_unit == '0' && !this.serviceInfo.unit_num) {
this.serviceInfo.unit_piece = '' this.serviceInfo.unit_piece = ''
this.$refs.formRef1.validateField('unit_num') this.$refs.formRef1.validateField('unit_num')
this.$positionMessage({ this.$positionMessage({
@ -486,8 +660,15 @@ export default {
for (let key in obj) { for (let key in obj) {
obj[key] = `${obj[key]}售卖` obj[key] = `${obj[key]}售卖`
} }
let secondMenu = JSON.parse(JSON.stringify(this.secondMenu));
// that.serviceAddInfo.set_units = 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 that.service_unit = that.serviceAddInfo.unit
// //
if (that.serviceAddInfo.shop_name === '拼多多') this.initPddParam(that.uid) if (that.serviceAddInfo.shop_name === '拼多多') this.initPddParam(that.uid)
@ -505,6 +686,72 @@ export default {
console.error(error, 'error') 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() { getServiceInfo() {
const that = this const that = this
@ -518,6 +765,9 @@ export default {
// //
if (response.status && response.data) { if (response.status && response.data) {
that.serviceInfo = response.data that.serviceInfo = response.data
if (that.serviceInfo.unit_piece) {
this.relatedProducts = true;
}
that.service_status = true that.service_status = true
that.getServiceBindGoods() that.getServiceBindGoods()
} }
@ -537,6 +787,7 @@ export default {
if (response.status && response.data) { if (response.status && response.data) {
that.$nextTick(() => { that.$nextTick(() => {
that.bindList = response.data that.bindList = response.data
this.relatedProducts = response.data.length > 0 ? true : false
}) })
} }
}).catch(error => { }).catch(error => {
@ -545,7 +796,6 @@ export default {
}, },
handleUnitName() { handleUnitName() {
this.serviceAddInfo.unit_name = this.serviceAddInfo.set_units[this.service_unit]; this.serviceAddInfo.unit_name = this.serviceAddInfo.set_units[this.service_unit];
console.log(this.serviceAddInfo.unit_name, 'this.serviceAddInfo.unit_name====---999');
}, },
handleDelServiceClick() { handleDelServiceClick() {
this.dialogDelServiceConfim = true this.dialogDelServiceConfim = true
@ -592,37 +842,37 @@ export default {
item['unit_num'] = that.serviceInfo.unit_num item['unit_num'] = that.serviceInfo.unit_num
item['unit'] = that.service_unit item['unit'] = that.service_unit
item['unit_price'] = that.serviceInfo.price item['unit_price'] = that.serviceInfo.price
item['web_price_set_flag'] = true;
} }
}) })
console.log(secondMenu, 'secondMenu====');
store.commit('SET_SECOND_MENU', secondMenu); store.commit('SET_SECOND_MENU', secondMenu);
// // // //
// if(that.service_unit !== '0') { if (that.service_unit !== '0') {
// that.serviceInfo.unit_num = 1 that.serviceInfo.unit_num = 1
// that.serviceInfo.base_unit_num = '' that.serviceInfo.base_unit_num = ''
// that.serviceInfo.base_unit_price = '' that.serviceInfo.base_unit_price = ''
// } }
// this.$http('POST', "/agentnew/ajax_set_service_price", { this.$http('POST', "/agentnew/ajax_set_service_price", {
// uid: that.uid, uid: that.uid,
// type: that.type, type: that.type,
// unit: that.service_unit, unit: that.service_unit,
// unit_num: that.serviceInfo.unit_num, unit_num: that.serviceInfo.unit_num,
// unit_price: that.serviceInfo.price, unit_price: that.serviceInfo.price,
// b_unit_num: that.serviceInfo.base_unit_num, b_unit_num: that.serviceInfo.base_unit_num,
// b_unit_price: that.serviceInfo.base_unit_price, b_unit_price: that.serviceInfo.base_unit_price,
// }).then(response => { }).then(response => {
// if (response.status) { if (response.status) {
// // store.commit('SET_SECOND_MENU', secondMenu); // store.commit('SET_SECOND_MENU', secondMenu);
// that.service_status = true that.service_status = true
// // that.setMenuList(that.type, true) // that.setMenuList(that.type, true)
// that.$message.success(''); that.$message.success('保存成功');
// return true; return true;
// } }
// that.$message.error(response.info); that.$message.error(response.info);
// }).catch(error => { }).catch(error => {
// console.error(error, 'error') console.error(error, 'error')
// }) })
}, },
resetShopPrice() { resetShopPrice() {
this.serviceInfo.unit_piece = '' this.serviceInfo.unit_piece = ''
@ -632,6 +882,7 @@ export default {
}, },
saveShopPrice() { saveShopPrice() {
const that = this const that = this
// 1 // 1
// //
if (that.service_unit !== '0') { if (that.service_unit !== '0') {
@ -639,7 +890,6 @@ export default {
that.serviceInfo.base_unit_num = '' that.serviceInfo.base_unit_num = ''
that.serviceInfo.base_unit_piece = '' that.serviceInfo.base_unit_piece = ''
} }
console.log(that.serviceInfo, 'ddd')
this.$http('POST', "/agentnew/ajax_set_service_price", { this.$http('POST', "/agentnew/ajax_set_service_price", {
uid: that.uid, uid: that.uid,
type: that.type, type: that.type,
@ -652,6 +902,12 @@ export default {
if (response.status) { if (response.status) {
that.service_status = true that.service_status = true
this.relatedProducts = 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.setMenuList(that.type, true)
that.$message.success('保存成功'); that.$message.success('保存成功');
return true; return true;
@ -685,6 +941,14 @@ export default {
}, },
handleBind(bindRes) { handleBind(bindRes) {
this.showBind = false 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() if (bindRes) this.getServiceBindGoods()
}, },
loadPddSDK() { loadPddSDK() {
@ -734,6 +998,17 @@ export default {
that.$message.success('删除成功'); that.$message.success('删除成功');
this.$nextTick(() => { this.$nextTick(() => {
that.bindList.splice(that.delRow.index, 1); 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; return true;
} }
@ -776,9 +1051,33 @@ export default {
}) })
}, },
jumpNextStep() { 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) { if (!price || !num || price <= 0 || num <= 0) {
return { return {
@ -791,19 +1090,15 @@ export default {
} }
try { try {
// 1000 //
const pricePerThousand = (price / num) * 1000; const pricePerThousand = (price / num) * unit_num;
console.log(pricePerThousand, 'pricePerThousand==');
// //
const profitRate = ((pricePerThousand - baseCost) / baseCost) * 100; const profitRate = ((pricePerThousand - baseCost) / baseCost) * 100;
console.log(profitRate, 'profitRate=='); //
// 1000
const profitPerUnit = pricePerThousand - baseCost; const profitPerUnit = pricePerThousand - baseCost;
// //
const totalProfit = (profitPerUnit / 1000) * num; const totalProfit = (profitPerUnit / unit_num) * num;
return { return {
profitRate: Number(profitRate.toFixed(2)), // profitRate: Number(profitRate.toFixed(2)), //
@ -892,6 +1187,21 @@ export default {
background: #EFFFE0; 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 { .serviceAdd-wrap {
height: 100%; height: 100%;
display: flex; display: flex;

Loading…
Cancel
Save