|
@@ -6,7 +6,10 @@
|
|
|
class="com-loading"></div>
|
|
|
<div v-else-if="quoteLoadState == 1">
|
|
|
<tab-nav
|
|
|
- :borderType="'allBorder'" :liWidth="100" :liHeight="40" :marginRight="5"
|
|
|
+ :borderType="'allBorder'"
|
|
|
+ :liWidth="100"
|
|
|
+ :liHeight="40"
|
|
|
+ :marginRight="5"
|
|
|
:currTab.sync="curWeek"
|
|
|
:tabList="priceList" />
|
|
|
<div
|
|
@@ -21,7 +24,7 @@
|
|
|
:allPrintTab="allPrintTab"
|
|
|
:marginTop="0"
|
|
|
:marginRight="5"
|
|
|
- :marginBottom="items.basePrice?.length>1?7:0"
|
|
|
+ :marginBottom="items.basePrice?.length > 1 ? 7 : 0"
|
|
|
@handle="sortBy(items)" />
|
|
|
<!-- <el-popover
|
|
|
placement="bottom-start"
|
|
@@ -60,13 +63,18 @@
|
|
|
<!-- decoration_multiple is_more_print 打印开关,ID1001092需求 ;additional_print 颜色数量开关
|
|
|
以上需求作废,改版为多色多面的需求-->
|
|
|
<new-price-table
|
|
|
- v-if="items.decoration?.length || items.basePrice?.[items.curPrint]?.decoration_addition?.length"
|
|
|
+ v-if="
|
|
|
+ items.decoration?.length ||
|
|
|
+ items.basePrice?.[items.curPrint]?.decoration_addition?.length
|
|
|
+ "
|
|
|
:tableData="items.decoration"
|
|
|
:tableColumns="[...decoration_columns, ...comCurBaseColumns]"
|
|
|
:tableType="'Decoration'"
|
|
|
:marginBottom="0"
|
|
|
- :hasDecAdd="items.basePrice?.[items.curPrint]?.decoration_addition?.length"></new-price-table>
|
|
|
-
|
|
|
+ :hasDecAdd="
|
|
|
+ items.basePrice?.[items.curPrint]?.decoration_addition?.length
|
|
|
+ "></new-price-table>
|
|
|
+
|
|
|
<div
|
|
|
v-for="(item, index) in items.basePrice"
|
|
|
:key="item.name + index"
|
|
@@ -78,7 +86,6 @@
|
|
|
:tableType="'Addon'"
|
|
|
:multipleSelection.sync="items.selectAdditionRow"></new-price-table>
|
|
|
</div>
|
|
|
-
|
|
|
</div>
|
|
|
<!-- <section>
|
|
|
<p class="title1">
|
|
@@ -153,13 +160,13 @@
|
|
|
<pc-switch v-model="freight_switch"></pc-switch>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <el-button
|
|
|
- size="medium"
|
|
|
- class="button-black"
|
|
|
- @click="openMailDialog">
|
|
|
- Enquiry
|
|
|
- </el-button>
|
|
|
</section> -->
|
|
|
+ <el-button
|
|
|
+ size="medium"
|
|
|
+ class="button-black"
|
|
|
+ @click="openMailDialog">
|
|
|
+ Enquiry
|
|
|
+ </el-button>
|
|
|
<!-- <section>
|
|
|
<unit-table
|
|
|
:tableData="unitData"
|
|
@@ -197,12 +204,13 @@
|
|
|
class="quote-tips">
|
|
|
Current item prices are missing, please contact<a
|
|
|
href="mailto:Info@promocollection.uk">
|
|
|
- info@promocollection.uk</a>
|
|
|
+ info@promocollection.uk</a
|
|
|
+ >
|
|
|
</div>
|
|
|
<no-ssr>
|
|
|
<div v-if="quoteLoadState == 1">
|
|
|
<!-- Enquiry按钮 -->
|
|
|
- <!-- <form-dialog
|
|
|
+ <form-dialog
|
|
|
:emailForm="enquiryForm"
|
|
|
:enquiryConfig="enquiryConfig"
|
|
|
:visible.sync="enquiryFormVisible"
|
|
@@ -210,7 +218,7 @@
|
|
|
:rules="rules"
|
|
|
:labelWidth="
|
|
|
enquiryConfig[3].selectlist?.length ? 140 : 82
|
|
|
- "></form-dialog> -->
|
|
|
+ "></form-dialog>
|
|
|
<mail-table
|
|
|
ref="mailtable"
|
|
|
:mailData="mailData"
|
|
@@ -247,7 +255,8 @@
|
|
|
size="medium"
|
|
|
@click="handleDownloadPdf"
|
|
|
:loading="pdfLoading"
|
|
|
- >Download</el-button>
|
|
|
+ >Download</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
<!-- <form-dialog
|
|
@@ -270,7 +279,8 @@
|
|
|
:emailForm="commentObj"></price-to-img>
|
|
|
<!-- 报价图片弹框 -->
|
|
|
<dialog-XX-success
|
|
|
- :visible.sync="xxContentVisible" :imgType="false"
|
|
|
+ :visible.sync="xxContentVisible"
|
|
|
+ :imgType="false"
|
|
|
:content="'This quantity is below the MOQ for this product'"></dialog-XX-success>
|
|
|
</div>
|
|
|
</no-ssr>
|
|
@@ -280,7 +290,12 @@
|
|
|
<script>
|
|
|
import { mapState, mapMutations, mapActions } from 'vuex'
|
|
|
import _ from 'lodash'
|
|
|
-import { times as npTimes,plus as npPlus, minus as npMinus, divide as npDivide } from 'number-precision';
|
|
|
+import {
|
|
|
+ times as npTimes,
|
|
|
+ plus as npPlus,
|
|
|
+ minus as npMinus,
|
|
|
+ divide as npDivide,
|
|
|
+} from 'number-precision'
|
|
|
import NewPriceTable from '@/components/table/NewPriceTable'
|
|
|
import TotalTable from '@/components/table/TotalTable'
|
|
|
import UnitTable from '@/components/table/UnitTable'
|
|
@@ -293,7 +308,7 @@ export default {
|
|
|
TotalTable,
|
|
|
UnitTable,
|
|
|
MailTable,
|
|
|
- 'dialog-XX-success': dialogXXSuccess
|
|
|
+ 'dialog-XX-success': dialogXXSuccess,
|
|
|
},
|
|
|
props: {
|
|
|
pageData: {
|
|
@@ -304,7 +319,7 @@ export default {
|
|
|
},
|
|
|
id: {
|
|
|
type: Number,
|
|
|
- default: null
|
|
|
+ default: null,
|
|
|
},
|
|
|
},
|
|
|
data() {
|
|
@@ -385,7 +400,7 @@ export default {
|
|
|
{ project: 'Setup' },
|
|
|
{ project: 'Unit' },
|
|
|
{ project: 'Freight' },
|
|
|
- { project: 'Total' }
|
|
|
+ { project: 'Total' },
|
|
|
],
|
|
|
unitData: [
|
|
|
{ total: 'Unit Rate %' },
|
|
@@ -393,11 +408,11 @@ export default {
|
|
|
{ total: 'Freight %' },
|
|
|
],
|
|
|
sellData: [
|
|
|
- { project: 'Postcode',summary: '-' },
|
|
|
- { project: 'Setup',summary: 0.00 },
|
|
|
- { project: 'Unit',summary: 0.00 },
|
|
|
- { project: 'Freight',summary: 0.00 },
|
|
|
- { project: 'Total',summary: 0.00 },
|
|
|
+ { project: 'Postcode', summary: '-' },
|
|
|
+ { project: 'Setup', summary: 0.0 },
|
|
|
+ { project: 'Unit', summary: 0.0 },
|
|
|
+ { project: 'Freight', summary: 0.0 },
|
|
|
+ { project: 'Total', summary: 0.0 },
|
|
|
],
|
|
|
POA_Config: ['111', '111.00', '999', '999.00'],
|
|
|
enquiryFormVisible: false,
|
|
@@ -491,34 +506,41 @@ export default {
|
|
|
return this.comCurWeekPrice.basePrice[this.comCurPrint]
|
|
|
},
|
|
|
comLocationNum() {
|
|
|
- return +(this.comCurWeekPrice.basePrice[this.comCurPrint].locationNum)
|
|
|
+ return +this.comCurWeekPrice.basePrice[this.comCurPrint].locationNum
|
|
|
},
|
|
|
comCurBaseColumns() {
|
|
|
return this.comCurBasePrice.part_columns
|
|
|
},
|
|
|
comCurBaseTotalColumns() {
|
|
|
- const d = this.comCurWeekPrice.basePrice[this.comCurPrint].total_part_columns
|
|
|
+ const d =
|
|
|
+ this.comCurWeekPrice.basePrice[this.comCurPrint].total_part_columns
|
|
|
const n = this.comLocationNum
|
|
|
if (n === 1) {
|
|
|
return d
|
|
|
- }else{
|
|
|
- const concatAdd = [...d,...this.comCurWeekPrice.basePrice[this.comCurPrint].remainingAttr].slice(0, n);
|
|
|
+ } else {
|
|
|
+ const concatAdd = [
|
|
|
+ ...d,
|
|
|
+ ...this.comCurWeekPrice.basePrice[this.comCurPrint].remainingAttr,
|
|
|
+ ].slice(0, n)
|
|
|
return concatAdd
|
|
|
}
|
|
|
},
|
|
|
- comTotalLabel(){
|
|
|
+ comTotalLabel() {
|
|
|
// 计算所有元素label的和
|
|
|
- return this.comCurBaseTotalColumns.reduce((sum, item) => sum + Number(item.label), 0);
|
|
|
+ return this.comCurBaseTotalColumns.reduce(
|
|
|
+ (sum, item) => sum + Number(item.label),
|
|
|
+ 0
|
|
|
+ )
|
|
|
},
|
|
|
- comSummaryColumns(){
|
|
|
- return [{ label: this.comTotalLabel.toString(), prop: 'summary' }];
|
|
|
+ comSummaryColumns() {
|
|
|
+ return [{ label: this.comTotalLabel.toString(), prop: 'summary' }]
|
|
|
},
|
|
|
comAttributeList() {
|
|
|
const obj = {}
|
|
|
this.comCurBaseTotalColumns?.forEach(item => {
|
|
|
obj[item.prop] = item.label
|
|
|
})
|
|
|
- obj.summary = this.comTotalLabel;
|
|
|
+ obj.summary = this.comTotalLabel
|
|
|
return obj
|
|
|
},
|
|
|
// 当前已选基础价
|
|
@@ -545,7 +567,9 @@ export default {
|
|
|
obj[`${i}`] = npTimes(+supplier_val, item.num)
|
|
|
}
|
|
|
} else {
|
|
|
- obj[`${i}`] = this.POA_Config.includes(item[i]) ? item[i] : npTimes(+item[i], item.num);
|
|
|
+ obj[`${i}`] = this.POA_Config.includes(item[i])
|
|
|
+ ? item[i]
|
|
|
+ : npTimes(+item[i], item.num)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -555,37 +579,34 @@ export default {
|
|
|
return arr
|
|
|
},
|
|
|
comBuyData() {
|
|
|
- this.calculateBuyData();
|
|
|
+ this.calculateBuyData()
|
|
|
return this.buyData
|
|
|
},
|
|
|
- comNoSumCol(){
|
|
|
- return [
|
|
|
- ...this.buy_columns,
|
|
|
- ...this.comCurBaseTotalColumns
|
|
|
- ]
|
|
|
+ comNoSumCol() {
|
|
|
+ return [...this.buy_columns, ...this.comCurBaseTotalColumns]
|
|
|
},
|
|
|
- comHasSumCol(){
|
|
|
+ comHasSumCol() {
|
|
|
return [
|
|
|
- ...this.buy_columns,
|
|
|
- ...this.comCurBaseTotalColumns,
|
|
|
- ...this.comSummaryColumns
|
|
|
- ];
|
|
|
+ ...this.buy_columns,
|
|
|
+ ...this.comCurBaseTotalColumns,
|
|
|
+ ...this.comSummaryColumns,
|
|
|
+ ]
|
|
|
},
|
|
|
- comMergeColumns(){
|
|
|
- return this.comLocationNum == 1 ? this.comNoSumCol:this.comHasSumCol
|
|
|
+ comMergeColumns() {
|
|
|
+ return this.comLocationNum == 1 ? this.comNoSumCol : this.comHasSumCol
|
|
|
},
|
|
|
comSellData() {
|
|
|
if (Object.keys(this.comAttributeList).length !== 0) {
|
|
|
- this.calculateSellData();
|
|
|
+ this.calculateSellData()
|
|
|
}
|
|
|
return this.sellData
|
|
|
},
|
|
|
comFilterSwitchSellData() {
|
|
|
return this.comSellData?.filter((item, i) => {
|
|
|
if (i === 1 && this.setup_switch) {
|
|
|
- return false;
|
|
|
+ return false
|
|
|
} else if (i === 3 && this.freight_switch) {
|
|
|
- return false;
|
|
|
+ return false
|
|
|
} else {
|
|
|
return item
|
|
|
}
|
|
@@ -614,13 +635,13 @@ export default {
|
|
|
// 过滤掉website_qty标签无数量
|
|
|
if (attributeList[a]) {
|
|
|
this.initZeroObj[a] = 0
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
delete attributeList[a]
|
|
|
}
|
|
|
for (const unit of this.unitData) {
|
|
|
// 如果对象中缺少 attributeList 的 key,则设置为 40
|
|
|
if (!(a in unit) || unit[a] === '') {
|
|
|
- this.$set(unit,a,40)
|
|
|
+ this.$set(unit, a, 40)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -636,42 +657,60 @@ export default {
|
|
|
vals.decorationOrign = [...decoration]
|
|
|
vals.decorationID = decoration.map(i => i.id)
|
|
|
vals.decoration = [...decoration].flatMap(item => {
|
|
|
- const result = [];
|
|
|
+ const result = []
|
|
|
if (item.max_color > 0) {
|
|
|
- result.push({ ...item, max_num: item.max_color,id:`${item.id}-1`,decName:item.max_color_name });
|
|
|
+ result.push({
|
|
|
+ ...item,
|
|
|
+ max_num: item.max_color,
|
|
|
+ id: `${item.id}-1`,
|
|
|
+ decName: item.max_color_name,
|
|
|
+ })
|
|
|
}
|
|
|
if (item.max_point > 0) {
|
|
|
- result.push({ ...item, max_num: item.max_point,id:`${item.id}-2`,decName:item.max_point_name });
|
|
|
+ result.push({
|
|
|
+ ...item,
|
|
|
+ max_num: item.max_point,
|
|
|
+ id: `${item.id}-2`,
|
|
|
+ decName: item.max_point_name,
|
|
|
+ })
|
|
|
}
|
|
|
- return result;
|
|
|
- });
|
|
|
+ return result
|
|
|
+ })
|
|
|
vals.additionlist = additionlist
|
|
|
for (const k in remaining) {
|
|
|
const o = {}
|
|
|
o.attributeList = this.copyData(attributeList)
|
|
|
- if (remaining[k]?.length>1) {
|
|
|
+ if (remaining[k]?.length > 1) {
|
|
|
// 检查数组中各元素的 website_qtyN 是否都等于 "-" or "POA",则删除key
|
|
|
for (const a in attributeList) {
|
|
|
- const is111Poa = remaining[k].every(item => this.POA_Config.includes(item[a]));
|
|
|
+ const is111Poa = remaining[k].every(item =>
|
|
|
+ this.POA_Config.includes(item[a])
|
|
|
+ )
|
|
|
if (is111Poa) {
|
|
|
delete o.attributeList[a]
|
|
|
}
|
|
|
}
|
|
|
- }else if (remaining[k]?.length === 1) {
|
|
|
+ } else if (remaining[k]?.length === 1) {
|
|
|
// 判断 remaining[k][0] 中是否包含 vals.attributeList 的键,并且对应的值都等于 "-" or "POA",则不删除key
|
|
|
- const obj = remaining[k][0];
|
|
|
- const attributeKeys = Object.keys(o.attributeList);
|
|
|
- const areAllKeysInPOAConfig = attributeKeys.every(key => {
|
|
|
- return Object.prototype.hasOwnProperty.call(obj, key) && this.POA_Config.includes(obj[key]);
|
|
|
- });
|
|
|
+ const obj = remaining[k][0]
|
|
|
+ const attributeKeys = Object.keys(o.attributeList)
|
|
|
+ const areAllKeysInPOAConfig = attributeKeys.every(key => {
|
|
|
+ return (
|
|
|
+ Object.prototype.hasOwnProperty.call(obj, key) &&
|
|
|
+ this.POA_Config.includes(obj[key])
|
|
|
+ )
|
|
|
+ })
|
|
|
|
|
|
- if (!areAllKeysInPOAConfig) {
|
|
|
- attributeKeys.forEach(key => {
|
|
|
- if (Object.prototype.hasOwnProperty.call(obj, key) && this.POA_Config.includes(obj[key])) {
|
|
|
- delete o.attributeList[key];
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ if (!areAllKeysInPOAConfig) {
|
|
|
+ attributeKeys.forEach(key => {
|
|
|
+ if (
|
|
|
+ Object.prototype.hasOwnProperty.call(obj, key) &&
|
|
|
+ this.POA_Config.includes(obj[key])
|
|
|
+ ) {
|
|
|
+ delete o.attributeList[key]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
o.name = k
|
|
|
o.data = remaining[k]
|
|
@@ -682,21 +721,21 @@ export default {
|
|
|
const freightParam = {
|
|
|
postcode: '',
|
|
|
freight_type: 1,
|
|
|
- freight: {}
|
|
|
+ freight: {},
|
|
|
}
|
|
|
o.total_part_columns = this.copyData(o.part_columns).map(obj => ({
|
|
|
...obj,
|
|
|
- ...freightParam
|
|
|
- }));
|
|
|
+ ...freightParam,
|
|
|
+ }))
|
|
|
o.remainingAttr = []
|
|
|
- const firstColumns = { ...o.part_columns[0],...freightParam}
|
|
|
- for(let i = 1; i < 9; i++){
|
|
|
- if(!Object.keys(o.attributeList).includes(`website_qty${i}`)){
|
|
|
- const newColumn = {...firstColumns}
|
|
|
- this.$set(newColumn,'prop',`website_qty${i}`)
|
|
|
+ const firstColumns = { ...o.part_columns[0], ...freightParam }
|
|
|
+ for (let i = 1; i < 9; i++) {
|
|
|
+ if (!Object.keys(o.attributeList).includes(`website_qty${i}`)) {
|
|
|
+ const newColumn = { ...firstColumns }
|
|
|
+ this.$set(newColumn, 'prop', `website_qty${i}`)
|
|
|
o.remainingAttr.push(newColumn)
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
vals.basePrice.push(o)
|
|
|
if (!this.allPrintTab.includes(k)) {
|
|
|
this.allPrintTab.push(k)
|
|
@@ -715,9 +754,12 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
// 所有周期的所有打印,进来页面时默认勾选第一条价格
|
|
|
- options.basePrice.forEach((opt,idx) => {
|
|
|
- this.$set(opt, 'selectBaseRow', opt.data[0] ||{})
|
|
|
- opt.decoration_addition = [...(options.decorationOrign?.[idx]?.decoration_addition || []),...(options.additionlist || [])]
|
|
|
+ options.basePrice.forEach((opt, idx) => {
|
|
|
+ this.$set(opt, 'selectBaseRow', opt.data[0] || {})
|
|
|
+ opt.decoration_addition = [
|
|
|
+ ...(options.decorationOrign?.[idx]?.decoration_addition || []),
|
|
|
+ ...(options.additionlist || []),
|
|
|
+ ]
|
|
|
})
|
|
|
options.decoration.forEach(opt => {
|
|
|
this.$set(opt, 'num', 0)
|
|
@@ -737,17 +779,17 @@ export default {
|
|
|
})
|
|
|
this.quoteLoadState = 1
|
|
|
})
|
|
|
- .catch((e) => {
|
|
|
- console.log('this.quoteLoadState1: ', e);
|
|
|
+ .catch(e => {
|
|
|
+ console.log('this.quoteLoadState1: ', e)
|
|
|
this.quoteLoadState = 2
|
|
|
})
|
|
|
},
|
|
|
formatDurationString(input) {
|
|
|
// 匹配数字和字符串的正则表达式
|
|
|
- const regex = /(\d+)([a-zA-Z]+)/g;
|
|
|
- const result = input.replace(regex, '$1 $2');
|
|
|
+ const regex = /(\d+)([a-zA-Z]+)/g
|
|
|
+ const result = input.replace(regex, '$1 $2')
|
|
|
|
|
|
- return result;
|
|
|
+ return result
|
|
|
},
|
|
|
// getWeight() {
|
|
|
// this.$axios
|
|
@@ -776,14 +818,14 @@ export default {
|
|
|
// },
|
|
|
getDebFreight: _.debounce(function (k) {
|
|
|
this.getFreight(k)
|
|
|
- }, 200),
|
|
|
+ }, 200),
|
|
|
getNumber(e, row, min) {
|
|
|
- if (parseInt(e.target.value) < min) {
|
|
|
- this.xxContentVisible = true;
|
|
|
- row.label = min
|
|
|
- } else {
|
|
|
- this.xxContentVisible = false;
|
|
|
- }
|
|
|
+ if (parseInt(e.target.value) < min) {
|
|
|
+ this.xxContentVisible = true
|
|
|
+ row.label = min
|
|
|
+ } else {
|
|
|
+ this.xxContentVisible = false
|
|
|
+ }
|
|
|
},
|
|
|
sortBy(items) {
|
|
|
// items.decoration.sort(this.customSort(items.decorationID))
|
|
@@ -799,27 +841,32 @@ export default {
|
|
|
dividePrice(a) {
|
|
|
return npDivide(+a, 100)
|
|
|
},
|
|
|
- // openMailDialog() {
|
|
|
- // if (this.$utils.checkLogin()) {
|
|
|
- // this.getUserInfo()
|
|
|
- // const { contacts, email, phone, crm_users_id:crmUsersId } = this.userInfo
|
|
|
- // this.enquiryForm.Name = contacts
|
|
|
- // this.enquiryForm.Email = email
|
|
|
- // this.enquiryForm.Phone = phone
|
|
|
- // if (crmUsersId?.length) {
|
|
|
- // this.enquiryConfig[3].selectlist = crmUsersId
|
|
|
- // if (crmUsersId?.length === 1) {
|
|
|
- // this.enquiryForm['Customer manager'] = crmUsersId[0].name
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // this.enquiryConfig[3].isShow = false
|
|
|
- // this.$delete(this.enquiryForm, 'Customer manager')
|
|
|
- // }
|
|
|
- // this.enquiryFormVisible = true
|
|
|
- // } else {
|
|
|
- // this.openDialog()
|
|
|
- // }
|
|
|
- // },
|
|
|
+ openMailDialog() {
|
|
|
+ if (this.$utils.checkLogin()) {
|
|
|
+ this.getUserInfo()
|
|
|
+ const {
|
|
|
+ contacts,
|
|
|
+ email,
|
|
|
+ phone,
|
|
|
+ crm_users_id: crmUsersId,
|
|
|
+ } = this.userInfo
|
|
|
+ this.enquiryForm.Name = contacts
|
|
|
+ this.enquiryForm.Email = email
|
|
|
+ this.enquiryForm.Phone = phone
|
|
|
+ if (crmUsersId?.length) {
|
|
|
+ this.enquiryConfig[3].selectlist = crmUsersId
|
|
|
+ if (crmUsersId?.length === 1) {
|
|
|
+ this.enquiryForm['Customer manager'] = crmUsersId[0].name
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.enquiryConfig[3].isShow = false
|
|
|
+ this.$delete(this.enquiryForm, 'Customer manager')
|
|
|
+ }
|
|
|
+ this.enquiryFormVisible = true
|
|
|
+ } else {
|
|
|
+ this.openDialog()
|
|
|
+ }
|
|
|
+ },
|
|
|
getMailData() {
|
|
|
this.mailData.Url = window.location.href
|
|
|
const { Name, Email, Phone, Comments } = this.enquiryForm
|
|
@@ -835,57 +882,57 @@ export default {
|
|
|
this.mailData['Quote time'] = this.$utils.formatTime(new Date())
|
|
|
},
|
|
|
// 发送价格邮件 Enquiry按钮
|
|
|
- // async sendPriceMail() {
|
|
|
- // await this.getMailData()
|
|
|
- // await this.getCustomerQuoteData()
|
|
|
- // const {
|
|
|
- // Name,
|
|
|
- // Email,
|
|
|
- // Phone,
|
|
|
- // Comments,
|
|
|
- // 'Customer manager': customerManager,
|
|
|
- // } = this.enquiryForm
|
|
|
- // this.$axios
|
|
|
- // .post('/uk-api/quote/sendenquiry', {
|
|
|
- // content: this.$refs.mailtable.$el.innerHTML,
|
|
|
- // name: Name,
|
|
|
- // email: Email,
|
|
|
- // phone: Phone,
|
|
|
- // customer_manager: customerManager || '',
|
|
|
- // url: this.mailData.Url,
|
|
|
- // product_code: this.pageData.product_code,
|
|
|
- // comments: Comments,
|
|
|
- // member_id: this.userInfo.id,
|
|
|
- // })
|
|
|
- // .then(res => {
|
|
|
- // this.setLoading(false)
|
|
|
- // this.enquiryFormVisible = false
|
|
|
- // this.$confirm('Enquiry Sent', {
|
|
|
- // confirmButtonText: 'OK',
|
|
|
- // showCancelButton: false,
|
|
|
- // type: 'success',
|
|
|
- // center: true,
|
|
|
- // showClose: false,
|
|
|
- // confirmButtonClass: 'com-btnblack',
|
|
|
- // }).then(() => {})
|
|
|
- // })
|
|
|
- // .catch(() => {
|
|
|
- // this.setLoading(false)
|
|
|
- // })
|
|
|
- // },
|
|
|
- // getCustomerQuoteData() {
|
|
|
- // const { name, selectAdditionRow } = this.comCurWeekPrice
|
|
|
- // this.specificationsObj.time = name
|
|
|
- // this.specificationsObj.model = this.comBasePrice.model
|
|
|
- // this.specificationsObj.decoration = this.comCurBasePrice.name
|
|
|
- // if (selectAdditionRow.length) {
|
|
|
- // this.specificationsObj.addonArr = selectAdditionRow.map(
|
|
|
- // item => item.name
|
|
|
- // )
|
|
|
- // } else {
|
|
|
- // this.specificationsObj.addonArr = null
|
|
|
- // }
|
|
|
- // },
|
|
|
+ async sendPriceMail() {
|
|
|
+ await this.getMailData()
|
|
|
+ await this.getCustomerQuoteData()
|
|
|
+ const {
|
|
|
+ Name,
|
|
|
+ Email,
|
|
|
+ Phone,
|
|
|
+ Comments,
|
|
|
+ 'Customer manager': customerManager,
|
|
|
+ } = this.enquiryForm
|
|
|
+ this.$axios
|
|
|
+ .post('/uk-api/quote/sendenquiry', {
|
|
|
+ content: this.$refs.mailtable.$el.innerHTML,
|
|
|
+ name: Name,
|
|
|
+ email: Email,
|
|
|
+ phone: Phone,
|
|
|
+ customer_manager: customerManager || '',
|
|
|
+ url: this.mailData.Url,
|
|
|
+ product_code: this.pageData.product_code,
|
|
|
+ comments: Comments,
|
|
|
+ member_id: this.userInfo.id,
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.setLoading(false)
|
|
|
+ this.enquiryFormVisible = false
|
|
|
+ this.$confirm('Enquiry Sent', {
|
|
|
+ confirmButtonText: 'OK',
|
|
|
+ showCancelButton: false,
|
|
|
+ type: 'success',
|
|
|
+ center: true,
|
|
|
+ showClose: false,
|
|
|
+ confirmButtonClass: 'com-btnblack',
|
|
|
+ }).then(() => {})
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.setLoading(false)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getCustomerQuoteData() {
|
|
|
+ const { name, selectAdditionRow } = this.comCurWeekPrice
|
|
|
+ this.specificationsObj.time = name
|
|
|
+ this.specificationsObj.model = this.comBasePrice.model
|
|
|
+ this.specificationsObj.decoration = this.comCurBasePrice.name
|
|
|
+ if (selectAdditionRow.length) {
|
|
|
+ this.specificationsObj.addonArr = selectAdditionRow.map(
|
|
|
+ item => item.name
|
|
|
+ )
|
|
|
+ } else {
|
|
|
+ this.specificationsObj.addonArr = null
|
|
|
+ }
|
|
|
+ },
|
|
|
// openDownloadDialog(type) {
|
|
|
// this.getCustomerQuoteData()
|
|
|
// type
|
|
@@ -925,19 +972,28 @@ export default {
|
|
|
copyData(data) {
|
|
|
return JSON.parse(JSON.stringify(data))
|
|
|
},
|
|
|
- calculateBuyData(){
|
|
|
+ calculateBuyData() {
|
|
|
const selPriceArr = []
|
|
|
if (JSON.stringify(this.comBasePrice) !== '{}') {
|
|
|
selPriceArr.push(this.comBasePrice)
|
|
|
}
|
|
|
- selPriceArr.push(...this.comDecoPrice, ...this.comCurWeekPrice.selectAdditionRow);
|
|
|
- if(selPriceArr.length === 0){
|
|
|
- this.buyData = this.buyData.map(item => ({ ...item, ...this.initZeroObj }));
|
|
|
+ selPriceArr.push(
|
|
|
+ ...this.comDecoPrice,
|
|
|
+ ...this.comCurWeekPrice.selectAdditionRow
|
|
|
+ )
|
|
|
+ if (selPriceArr.length === 0) {
|
|
|
+ this.buyData = this.buyData.map(item => ({
|
|
|
+ ...item,
|
|
|
+ ...this.initZeroObj,
|
|
|
+ }))
|
|
|
return
|
|
|
}
|
|
|
// 累加所选,初始数量对应的单价。赋值给this.initUnitObj
|
|
|
for (const i in this.initUnitObj) {
|
|
|
- const columnSum = this.copyData(selPriceArr).reduce(function (prev, cur) {
|
|
|
+ const columnSum = this.copyData(selPriceArr).reduce(function (
|
|
|
+ prev,
|
|
|
+ cur
|
|
|
+ ) {
|
|
|
if (cur[i] === '111' || cur[i] === '111.00') {
|
|
|
return (cur[i] = '-')
|
|
|
} else if (cur[i] === '999' || cur[i] === '999.00') {
|
|
@@ -949,7 +1005,8 @@ export default {
|
|
|
}
|
|
|
return npPlus(+cur[i], prev).toFixed(2)
|
|
|
}
|
|
|
- }, 0)
|
|
|
+ },
|
|
|
+ 0)
|
|
|
this.$set(this.initUnitObj, i, columnSum)
|
|
|
}
|
|
|
|
|
@@ -978,7 +1035,9 @@ export default {
|
|
|
// 计算运费
|
|
|
// 单独批次数量的总重
|
|
|
// weight定义是{},后端没数据传回[]
|
|
|
- const unitWLocal = this.weight.unit_w_local ? +this.weight.unit_w_local : 0;
|
|
|
+ const unitWLocal = this.weight.unit_w_local
|
|
|
+ ? +this.weight.unit_w_local
|
|
|
+ : 0
|
|
|
const totalWeight = Math.ceil(
|
|
|
npTimes(unitWLocal, this.comAttributeList[a])
|
|
|
)
|
|
@@ -994,10 +1053,21 @@ export default {
|
|
|
let freightType
|
|
|
let postcode
|
|
|
let freight = {}
|
|
|
- const matchIndex = this.comCurBaseTotalColumns.findIndex(item => item.prop === a)
|
|
|
+ const matchIndex = this.comCurBaseTotalColumns.findIndex(
|
|
|
+ item => item.prop === a
|
|
|
+ )
|
|
|
// 1,所有按第一个运费统计;不为1,则只计算 comCurBaseTotalColumns的[地址数]长度
|
|
|
- if (+this.comLocationNum === 1 || this.comLocationNum >= matchIndex + 1) {
|
|
|
- ({ freight, freight_type: freightType, postcode } = this.comCurBaseTotalColumns[+this.comLocationNum === 1 ? 0 : matchIndex] || {});
|
|
|
+ if (
|
|
|
+ +this.comLocationNum === 1 ||
|
|
|
+ this.comLocationNum >= matchIndex + 1
|
|
|
+ ) {
|
|
|
+ ;({
|
|
|
+ freight,
|
|
|
+ freight_type: freightType,
|
|
|
+ postcode,
|
|
|
+ } = this.comCurBaseTotalColumns[
|
|
|
+ +this.comLocationNum === 1 ? 0 : matchIndex
|
|
|
+ ] || {})
|
|
|
}
|
|
|
if (freightType === 1 && postcode >= 3) {
|
|
|
if (totalWeight > 20) {
|
|
@@ -1079,7 +1149,11 @@ export default {
|
|
|
}
|
|
|
|
|
|
if (this.setup_switch) {
|
|
|
- this.$set(this.buyData, 0, { ...this.buyData[0], ...this.initZeroObj, ...{'summary':0.00} })
|
|
|
+ this.$set(this.buyData, 0, {
|
|
|
+ ...this.buyData[0],
|
|
|
+ ...this.initZeroObj,
|
|
|
+ ...{ summary: 0.0 },
|
|
|
+ })
|
|
|
} else {
|
|
|
this.$set(this.buyData, 0, { ...this.buyData[0], ...this.initSetupObj })
|
|
|
}
|
|
@@ -1098,7 +1172,7 @@ export default {
|
|
|
this.$set(this.buyData, 3, { ...this.buyData[3], ...this.initTotalObj })
|
|
|
},
|
|
|
calculateSellData() {
|
|
|
- // 放置comSellData计算和副作用的代码
|
|
|
+ // 放置comSellData计算和副作用的代码
|
|
|
const buySetup = this.comBuyData[0]
|
|
|
const buyUnit = this.comBuyData[1]
|
|
|
const buyFright = this.comBuyData[2]
|
|
@@ -1111,8 +1185,12 @@ export default {
|
|
|
this.sellData[3][i] = buyUnit[i]
|
|
|
this.sellData[4][i] = buyUnit[i]
|
|
|
} else {
|
|
|
- const item = this.comLocationNum === 1 ? this.comCurBaseTotalColumns[0] : this.comCurBaseTotalColumns.find(element => element.prop === i);
|
|
|
- this.sellData[0][i] = item && item.postcode !== '' ? item.postcode : '-';
|
|
|
+ const item =
|
|
|
+ this.comLocationNum === 1
|
|
|
+ ? this.comCurBaseTotalColumns[0]
|
|
|
+ : this.comCurBaseTotalColumns.find(element => element.prop === i)
|
|
|
+ this.sellData[0][i] =
|
|
|
+ item && item.postcode !== '' ? item.postcode : '-'
|
|
|
|
|
|
// 分别乘以Markup %表格
|
|
|
const key = this.comCurBaseTotalColumns[0]?.prop
|
|
@@ -1135,10 +1213,13 @@ export default {
|
|
|
this.sellData[3][i] = npTimes(buyFright[i], a).toFixed(2)
|
|
|
// freight_switch会使qty的运费=0无法计算,故用了initFrightObj
|
|
|
const fa = npTimes(this.initFrightObj[i], a)
|
|
|
- frightSummary = npPlus(frightSummary,fa).toFixed(2)
|
|
|
+ frightSummary = npPlus(frightSummary, fa).toFixed(2)
|
|
|
} else {
|
|
|
this.sellData[3][i] = buyFright[i]
|
|
|
- frightSummary = npPlus(frightSummary,this.initFrightObj[i]).toFixed(2)
|
|
|
+ frightSummary = npPlus(
|
|
|
+ frightSummary,
|
|
|
+ this.initFrightObj[i]
|
|
|
+ ).toFixed(2)
|
|
|
}
|
|
|
|
|
|
const unitQTY = npTimes(this.sellData[2][i], this.comAttributeList[i])
|
|
@@ -1150,36 +1231,60 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
// 迭代加了Total列,需要统计qty的运费后才能合计运费
|
|
|
- if (this.sellData[2].summary !== '-' && this.sellData[2].summary !== 'POA') {
|
|
|
+ if (
|
|
|
+ this.sellData[2].summary !== '-' &&
|
|
|
+ this.sellData[2].summary !== 'POA'
|
|
|
+ ) {
|
|
|
if (this.freight_switch) {
|
|
|
- const num = Math.ceil((frightSummary / this.comAttributeList.summary) * 100) / 100
|
|
|
- this.sellData[2].summary = npPlus(this.sellData[2].summary, num).toFixed(2)
|
|
|
- this.sellData[3].summary = 0.00
|
|
|
- const a = npTimes(this.sellData[2].summary,this.comAttributeList.summary)
|
|
|
- this.sellData[4].summary = npPlus(this.sellData[1].summary,a).toFixed(2)
|
|
|
+ const num =
|
|
|
+ Math.ceil((frightSummary / this.comAttributeList.summary) * 100) /
|
|
|
+ 100
|
|
|
+ this.sellData[2].summary = npPlus(
|
|
|
+ this.sellData[2].summary,
|
|
|
+ num
|
|
|
+ ).toFixed(2)
|
|
|
+ this.sellData[3].summary = 0.0
|
|
|
+ const a = npTimes(
|
|
|
+ this.sellData[2].summary,
|
|
|
+ this.comAttributeList.summary
|
|
|
+ )
|
|
|
+ this.sellData[4].summary = npPlus(
|
|
|
+ this.sellData[1].summary,
|
|
|
+ a
|
|
|
+ ).toFixed(2)
|
|
|
} else {
|
|
|
this.sellData[3].summary = frightSummary
|
|
|
- this.sellData[4].summary = npPlus(frightSummary,this.sellData[4].summary).toFixed(2)
|
|
|
+ this.sellData[4].summary = npPlus(
|
|
|
+ frightSummary,
|
|
|
+ this.sellData[4].summary
|
|
|
+ ).toFixed(2)
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
// 低于最小起订量 把该栏的数值重置到最小起订量
|
|
|
- getChildIdx(idx){
|
|
|
- this.xxContentVisible = true;
|
|
|
- this.$set(this.comCurBaseTotalColumns[idx-1],'label',this.comCurBaseColumns[0]?.label)
|
|
|
+ getChildIdx(idx) {
|
|
|
+ this.xxContentVisible = true
|
|
|
+ this.$set(
|
|
|
+ this.comCurBaseTotalColumns[idx - 1],
|
|
|
+ 'label',
|
|
|
+ this.comCurBaseColumns[0]?.label
|
|
|
+ )
|
|
|
},
|
|
|
- setMaxNum(val){
|
|
|
- if(val > 7){
|
|
|
+ setMaxNum(val) {
|
|
|
+ if (val > 7) {
|
|
|
this.comCurBasePrice.locationNum = 7
|
|
|
- }else if(val < 1){
|
|
|
+ } else if (val < 1) {
|
|
|
this.comCurBasePrice.locationNum = 1
|
|
|
}
|
|
|
},
|
|
|
- ...mapMutations({ openDialog: 'openDialog', setLoading: 'product/setLoading' })
|
|
|
+ ...mapMutations({
|
|
|
+ openDialog: 'openDialog',
|
|
|
+ setLoading: 'product/setLoading',
|
|
|
+ }),
|
|
|
},
|
|
|
}
|
|
|
</script>
|
|
|
-<style lang='scss' scoped>
|
|
|
+<style lang="scss" scoped>
|
|
|
$deep-blue: #004a97;
|
|
|
|
|
|
.exclamation-icon {
|
|
@@ -1237,7 +1342,7 @@ $deep-blue: #004a97;
|
|
|
width: 120px;
|
|
|
margin-right: 10px;
|
|
|
}
|
|
|
- .entry-text{
|
|
|
+ .entry-text {
|
|
|
margin-left: 280px;
|
|
|
width: 130px;
|
|
|
text-align: center;
|