|
|
@@ -39,26 +39,26 @@
|
|
|
<div v-if="group.materialRows.length > 0" class="mt-30 input-number-panel">
|
|
|
<p class="label"><span class="mr-10">{{siteInfo.siteid == 'DLB'?'选项':'基材'}}</span></p>
|
|
|
<div>
|
|
|
- <a-button class="mr-10 mt-10" v-for="(item,index) in group.materialRows" :key="index" :disabled="!item.flag" :type="data.material == item.parm?'primary':'default'" @click="customClick('material',item.parm)">{{item.parm}}</a-button>
|
|
|
+ <a-button class="mr-10 mt-10" v-for="(item,index) in group.materialRows" :key="index" :disabled="!item.flag || load" :type="data.material == item.parm?'primary':'default'" @click="customClick('material',item.parm)">{{item.parm}}</a-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div v-if="group.colorRows.length > 0" class="mt-30 input-number-panel">
|
|
|
<p class="label"><span class="mr-10">颜色</span></p>
|
|
|
<div>
|
|
|
- <a-button class="mr-10 mt-10" v-for="(item,index) in group.colorRows" :key="index" :disabled="!item.flag" :type="data.color == item.parm?'primary':'default'" @click="customClick('color',item.parm)">{{item.parm}}</a-button>
|
|
|
+ <a-button class="mr-10 mt-10" v-for="(item,index) in group.colorRows" :key="index" :disabled="!item.flag || load" :type="data.color == item.parm?'primary':'default'" @click="customClick('color',item.parm)">{{item.parm}}</a-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div v-if="group.cheekRows.length > 0" class="mt-30 input-number-panel">
|
|
|
<p class="label"><span class="mr-10">{{siteInfo.siteid == 'DLB'?'工艺':'边框'}}</span></p>
|
|
|
<div>
|
|
|
- <a-button class="mr-10" v-for="(item,index) in group.cheekRows" :key="index" :disabled="!item.flag" :type="data.cheek == item.parm?'primary':'default'" @click="customClick('cheek',item.parm)">{{item.parm}}</a-button>
|
|
|
+ <a-button class="mr-10" v-for="(item,index) in group.cheekRows" :key="index" :disabled="!item.flag || load" :type="data.cheek == item.parm?'primary':'default'" @click="customClick('cheek',item.parm)">{{item.parm}}</a-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div v-if="group.specRows.length > 0" class="mt-30 input-number-panel">
|
|
|
<p style="flex:1 0 auto;max-width:38px;margin-bottom:10px" class="label"><span class="mr-10">尺寸</span></p>
|
|
|
<div>
|
|
|
- <a-button class="mr-10 mt-10" v-for="(item,index) in group.specRows" :key="index" :disabled="!item.flag" :type="data.spec == item.parm?'primary':'default'" @click="customClick('spec',item.parm)">{{item.parm == 'custom'?'自定义':item.parm}}</a-button>
|
|
|
+ <a-button class="mr-10 mt-10" v-for="(item,index) in group.specRows" :key="index" :disabled="!item.flag || load" :type="data.spec == item.parm?'primary':'default'" @click="customClick('spec',item.parm)">{{item.parm == 'custom'?'自定义':item.parm}}</a-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -131,6 +131,8 @@
|
|
|
import utils from '@/utils/utils'
|
|
|
import { useBaseStore } from '@/stores/modules/base'
|
|
|
import { storeToRefs } from 'pinia'
|
|
|
+ import Product from '@/class/product'
|
|
|
+
|
|
|
const base = useBaseStore()
|
|
|
let { siteInfo } = storeToRefs(base)
|
|
|
|
|
|
@@ -148,13 +150,17 @@
|
|
|
const imgIndex = ref(0)
|
|
|
const custom = ref([])
|
|
|
const qty = ref(0)
|
|
|
+ const load = ref(false)
|
|
|
const groupDetail = async (init)=>{
|
|
|
+ load.value = true
|
|
|
data.value.sa_itemgroupid = router.currentRoute.value.query.id
|
|
|
const res = await Api.requested({
|
|
|
"id": "20221223165503",
|
|
|
"content": data.value
|
|
|
})
|
|
|
+ load.value = false
|
|
|
group.value = res.data
|
|
|
+
|
|
|
group.value.specRows = group.value.specRows.reverse()
|
|
|
if(group.value.specRows.filter(item => item.parm != '自定义').every(item => !item.flag) && group.value.item[0].iscustomsize) data.value.spec = '自定义'
|
|
|
qty.value = res.data.item[0].orderminqty
|
|
|
@@ -175,7 +181,6 @@
|
|
|
if (res.data.rows.length == 1) {
|
|
|
// 遍历对象
|
|
|
for (let key in res.data.rows[0]) {
|
|
|
- console.log(key,'--')
|
|
|
data.value[key] = res.data.rows[0][key]
|
|
|
}
|
|
|
}
|
|
|
@@ -292,7 +297,6 @@
|
|
|
return res.data
|
|
|
}
|
|
|
const onInputChange = ((type)=>{
|
|
|
- console.log(schemeData.value)
|
|
|
function hasDecimal(num) {
|
|
|
const str = num.toString();
|
|
|
const decimalIndex = str.indexOf('.');
|
|
|
@@ -301,11 +305,14 @@
|
|
|
if (schemeData.value.width && hasDecimal(schemeData.value.width)){
|
|
|
message.warning('请输入整数')
|
|
|
schemeData.value.width = widthscheme.value.min
|
|
|
+ return false
|
|
|
}
|
|
|
if (schemeData.value.length && hasDecimal(schemeData.value.length)) {
|
|
|
message.warning('请输入整数')
|
|
|
schemeData.value.length = lengthscheme.value.min
|
|
|
+ return false
|
|
|
}
|
|
|
+ if (!validCustomSize()) return false
|
|
|
})
|
|
|
const getCustomsizeData = async ()=>{
|
|
|
let lengthschemeid = group.value.item[0].lengthschemeid
|
|
|
@@ -326,22 +333,21 @@
|
|
|
}
|
|
|
}
|
|
|
const validCustomSize = ()=>{
|
|
|
- let lengthValidData = {min:lengthscheme.value.min,max:lengthscheme.value.max}
|
|
|
- let widthValData = {min:widthscheme.value.min,max:widthscheme.value.max}
|
|
|
- if (!schemeData.value.width || !schemeData.value.length) {
|
|
|
- message.error({content:'定制选项不能为空!',key:1})
|
|
|
- return false
|
|
|
- } else if ((schemeData.value.width < widthValData.min || schemeData.value.width > widthValData.max) && widthscheme.value.type == '自定义') {
|
|
|
- message.error({content:'自定义宽度超出可选范围!',key:1})
|
|
|
- return false
|
|
|
- } else if ((schemeData.value.length < lengthValidData.min || schemeData.value.length > lengthValidData.max) && lengthscheme.value.type == '自定义') {
|
|
|
- message.error({content:'自定义长度超出可选范围!',key:1})
|
|
|
- return false
|
|
|
+ const pd = new Product(group.value.item[0])
|
|
|
+ // 使用该函数来检查长度和宽度
|
|
|
+ let lengthValidData = { min: lengthscheme.value.min, max: lengthscheme.value.max, type: lengthscheme.value.type };
|
|
|
+ let widthValData = { min: widthscheme.value.min, max: widthscheme.value.max, type: widthscheme.value.type };
|
|
|
+
|
|
|
+ if (!pd.checkDimension(widthValData, schemeData.value, 'width', '自定义宽度超出可选范围!')) {
|
|
|
+ return false;
|
|
|
+ } else if (!pd.checkDimension(lengthValidData, schemeData.value, 'length', '自定义长度超出可选范围!')) {
|
|
|
+ return false;
|
|
|
} else {
|
|
|
- return true
|
|
|
- }
|
|
|
-
|
|
|
+ // 如果所有检查都通过
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
const onCollection = (data)=>{
|
|
|
let collection = async (bool)=>{
|
|
|
const res = await Api.requested({
|