|
@@ -30,7 +30,7 @@
|
|
|
<p v-if="group.item[0].canuseactivity && group.item[0].canuseactivity.length > 0"><span class="mr-10" style="color:red">此商品正在促销:</span><a-tag style="cursor: pointer;" v-for="item in group.item[0].canuseactivity" :key="item.sa_promotionid" color="red" @click="linkToPromotion(item)"><FireOutlined />{{item.promname}}</a-tag></p>
|
|
|
<p class="label"><span class="mr-10">领域:</span><a-tag color="#108ee9" v-for="(item,index) in group.item[0].tradefield" :key="index">{{item.tradefield}}</a-tag></p>
|
|
|
<p class="label"><span class="mr-10">商品编码:</span>{{group.item[0].itemno}}</p>
|
|
|
- <p class="label"><span class="mr-10">价格:</span><span class="price-label"><small>¥</small>{{utils.formatAmount(group.item[0].gradeprice,{name:'hideFields',key:'maxprice'})}}</span> <p style="margin: 0;" v-if="group.item[0].gradeprice < group.item[0].price">原价:{{utils.formatAmount(group.item[0].price,{name:'hideFields',key:'maxprice'})}}</p></p>
|
|
|
+ <p class="label"><span class="mr-10">价格:</span><span class="price-label"><small>¥</small>{{utils.formatAmount(group.item[0].gradeprice,{name:'hideFields',key:'maxprice'})}}</span></p>
|
|
|
<p class="label"><span class="mr-10">型号:</span>{{group.item[0].model || '--'}}</p>
|
|
|
<p class="label"><span class="mr-10">规格:</span>{{group.item[0].standards || '--'}}</p>
|
|
|
|
|
@@ -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>
|
|
|
|
|
@@ -69,7 +69,7 @@
|
|
|
<p class="label"><span class="mr-10">长度</span></p>
|
|
|
<div>
|
|
|
<div v-if="lengthscheme.type == '自定义'">
|
|
|
- <a-input-number style="width: 150px;" :controls="false" :step="1" v-model:value="schemeData.length" @blur="onInputChange('length')" placeholder="输入区间内长度"/><span style="color:#666"> 输入范围:{{lengthscheme.min}}mm - {{lengthscheme.max}}mm,不保留小数</span>
|
|
|
+ <a-input-number style="width: 150px;" :controls="false" :step="1" v-model:value="schemeData.length" @blur="inputValid('length')" placeholder="输入区间内长度"/><span style="color:#666"> 输入范围:{{lengthscheme.min}}mm - {{lengthscheme.max}}mm,不保留小数</span>
|
|
|
</div>
|
|
|
<div>
|
|
|
<a-button class="mr-10 mt-10" v-for="(item,index) in lengthscheme.rowsdetail" :key="index" :disabled="schemeData.length != item.num && (schemeData.length != null && schemeData.length != '')" :type="schemeData.length == item.num?'primary':'default'" @click="customClick2('length',item.num)">{{item.num}}</a-button>
|
|
@@ -80,7 +80,7 @@
|
|
|
<p class="label"><span class="mr-10">宽度</span></p>
|
|
|
<div>
|
|
|
<div v-if="widthscheme.type == '自定义'">
|
|
|
- <a-input-number style="width: 150px;" :controls="false" :step="1" v-model:value="schemeData.width" @blur="onInputChange('width')" placeholder="输入区间内宽度"/><span style="color:#666"> 输入范围:{{widthscheme.min}}mm - {{widthscheme.max}}mm,不保留小数</span>
|
|
|
+ <a-input-number style="width: 150px;" :controls="false" :step="1" v-model:value="schemeData.width" @blur="inputValid('width')" placeholder="输入区间内宽度"/><span style="color:#666"> 输入范围:{{widthscheme.min}}mm - {{widthscheme.max}}mm,不保留小数</span>
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
<a-button class="mr-10 mt-10" v-for="(item,index) in widthscheme.rowsdetail" :key="index" :disabled="schemeData.width != item.num && (schemeData.width != null && schemeData.width != '')" :type="schemeData.width == item.num?'primary':'default'" @click="customClick2('width',item.num)">{{item.num}}</a-button>
|
|
@@ -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]
|
|
|
}
|
|
|
}
|
|
@@ -291,22 +296,6 @@
|
|
|
schemeInfo.value = res.data
|
|
|
return res.data
|
|
|
}
|
|
|
- const onInputChange = ((type)=>{
|
|
|
- console.log(schemeData.value)
|
|
|
- function hasDecimal(num) {
|
|
|
- const str = num.toString();
|
|
|
- const decimalIndex = str.indexOf('.');
|
|
|
- return decimalIndex !== -1;
|
|
|
- }
|
|
|
- if (schemeData.value.width && hasDecimal(schemeData.value.width)){
|
|
|
- message.warning('请输入整数')
|
|
|
- schemeData.value.width = widthscheme.value.min
|
|
|
- }
|
|
|
- if (schemeData.value.length && hasDecimal(schemeData.value.length)) {
|
|
|
- message.warning('请输入整数')
|
|
|
- schemeData.value.length = lengthscheme.value.min
|
|
|
- }
|
|
|
- })
|
|
|
const getCustomsizeData = async ()=>{
|
|
|
let lengthschemeid = group.value.item[0].lengthschemeid
|
|
|
let widthschemeid = group.value.item[0].widthschemeid
|
|
@@ -325,23 +314,27 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- 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
|
|
|
- } else {
|
|
|
- return true
|
|
|
+ const inputValid = (type)=>{
|
|
|
+ const pd = new Product(group.value.item[0])
|
|
|
+ pd.hasDecimal(schemeData.value[type])
|
|
|
+ }
|
|
|
+ const validCustomSize = (type)=>{
|
|
|
+ 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;
|
|
|
}
|
|
|
|
|
|
+ if (!pd.checkDimension(lengthValidData, schemeData.value, 'length', '自定义长度超出可选范围!')) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
}
|
|
|
+
|
|
|
const onCollection = (data)=>{
|
|
|
let collection = async (bool)=>{
|
|
|
const res = await Api.requested({
|