|
@@ -1,125 +1,127 @@
|
|
|
<template>
|
|
|
-<div class="container y-container">
|
|
|
- <a-button class="toback" size="large" type="link" @click="router.push({name:router.currentRoute.value.meta.name})">
|
|
|
- <template #icon>
|
|
|
- <left-outlined />
|
|
|
- </template>
|
|
|
- 返回列表
|
|
|
- </a-button>
|
|
|
- <div class="group-panel">
|
|
|
- <div v-if="group.item[0]">
|
|
|
- <div class="image-panel">
|
|
|
- <img :src="group.item[0].attinfos[imgIndex].url" alt="">
|
|
|
- </div>
|
|
|
- <div style="display:flex;">
|
|
|
- <div style="width:100px;height:100px;margin-right:10px" v-for="(img,index) in group.item[0].attinfos" :key="index">
|
|
|
- <img class="s-image" :src="img.url" alt="" @click="imgIndex = index">
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div style="flex:1" v-if="group.item[0]">
|
|
|
- <div style="position:relative;margin-bottom:30px">
|
|
|
- <h2>{{group.item[0].itemname}}
|
|
|
- <span>
|
|
|
- <StarOutlined v-if="group.item[0].iscollection == 0" @click="onCollection(group.item[0])"/>
|
|
|
- <StarFilled v-else @click="onCollection(group.item[0])" style="color:orange"/>
|
|
|
- </span>
|
|
|
- <a-tag v-show="group.item[0].delistingstatus" color="red">{{group.item[0].delistingstatus}}</a-tag>
|
|
|
- </h2>
|
|
|
- </div>
|
|
|
- <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>
|
|
|
- <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>
|
|
|
-
|
|
|
- <p class="label"><span class="mr-10">特殊说明:</span><span style="color:red">{{group.item[0].specalnote || '--'}}</span></p>
|
|
|
- <a-divider/>
|
|
|
- <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 || 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 || 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 || 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 || load" :type="data.spec == item.parm?'primary':'default'" @click="customClick('spec',item.parm)">{{item.parm == 'custom'?'自定义':item.parm}}</a-button>
|
|
|
+ <a-spin tip="查询中..." :spinning="load">
|
|
|
+ <div class="container y-container">
|
|
|
+ <a-button class="toback" size="large" type="link" @click="router.push({name:router.currentRoute.value.meta.name})">
|
|
|
+ <template #icon>
|
|
|
+ <left-outlined />
|
|
|
+ </template>
|
|
|
+ 返回列表
|
|
|
+ </a-button>
|
|
|
+ <div class="group-panel">
|
|
|
+ <div v-if="group.item[0]">
|
|
|
+ <div class="image-panel">
|
|
|
+ <img :src="group.item[0].attinfos[imgIndex] ? group.item[0].attinfos[imgIndex].url : ''" alt="">
|
|
|
+ </div>
|
|
|
+ <div style="display:flex;">
|
|
|
+ <div style="width:100px;height:100px;margin-right:10px" v-for="(img,index) in group.item[0].attinfos" :key="index">
|
|
|
+ <img class="s-image" :src="img.url" alt="" @click="imgIndex = index">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div v-if="group.item[0].iscustomsize == 1">
|
|
|
- <p style="color:#999;margin-top:30px">定制信息</p>
|
|
|
- <a-divider/>
|
|
|
- <div class="mt-30 input-number-panel">
|
|
|
- <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="inputValid('length')" placeholder="输入区间内长度"/><span style="color:#666"> 输入范围:{{lengthscheme.min}}mm - {{lengthscheme.max}}mm,不保留小数</span>
|
|
|
+ <div style="flex:1" v-if="group.item[0]">
|
|
|
+ <div style="position:relative;margin-bottom:30px">
|
|
|
+ <h2>{{group.item[0].itemname}}
|
|
|
+ <span>
|
|
|
+ <StarOutlined v-if="group.item[0].iscollection == 0" @click="onCollection(group.item[0])"/>
|
|
|
+ <StarFilled v-else @click="onCollection(group.item[0])" style="color:orange"/>
|
|
|
+ </span>
|
|
|
+ <a-tag v-show="group.item[0].delistingstatus" color="red">{{group.item[0].delistingstatus}}</a-tag>
|
|
|
+ </h2>
|
|
|
+ </div>
|
|
|
+ <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>
|
|
|
+ <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>
|
|
|
+
|
|
|
+ <p class="label"><span class="mr-10">特殊说明:</span><span style="color:red">{{group.item[0].specalnote || '--'}}</span></p>
|
|
|
+ <a-divider/>
|
|
|
+ <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" v-show="isonlydisplay('material')" :disabled="!item.flag" :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 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>
|
|
|
+ <a-button class="mr-10 mt-10" v-for="(item,index) in group.colorRows" :key="index" v-show="isonlydisplay('color')" :disabled="!item.flag" :type="data.color == item.parm?'primary':'default'" @click="customClick('color',item.parm)">{{item.parm}}</a-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div class="mt-30 input-number-panel">
|
|
|
- <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="inputValid('width')" placeholder="输入区间内宽度"/><span style="color:#666"> 输入范围:{{widthscheme.min}}mm - {{widthscheme.max}}mm,不保留小数</span>
|
|
|
+
|
|
|
+ <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" v-show="isonlydisplay('cheek')" :disabled="!item.flag" :type="data.cheek == item.parm?'primary':'default'" @click="customClick('cheek',item.parm)">{{item.parm}}</a-button>
|
|
|
</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>
|
|
|
+ </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" v-show="isonlydisplay('spec')" :disabled="!item.flag" :type="data.spec == item.parm?'primary':'default'" @click="customClick('spec',item.parm)">{{item.parm == 'custom'?'自定义':item.parm}}</a-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+
|
|
|
+ <div v-if="group.item[0].iscustomsize == 1">
|
|
|
+ <p style="color:#999;margin-top:30px">定制信息</p>
|
|
|
+ <a-divider/>
|
|
|
+ <div class="mt-30 input-number-panel">
|
|
|
+ <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="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>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="mt-30 input-number-panel">
|
|
|
+ <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="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>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <a-divider/>
|
|
|
+ </div>
|
|
|
|
|
|
- <a-divider/>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="input-number-panel mt-30">
|
|
|
- <p><span class="mr-10">数量:</span></p>
|
|
|
- <a-input-number style="width:150px;flex:0 0 150px" id="inputNumber" v-model:value="qty" :precision="2" :min="group.item[0].orderminqty" :step="group.item[0].orderaddqty" @blur="onChange"/>
|
|
|
- <p class="label">
|
|
|
-  
|
|
|
- <span>起订量:{{group.item[0].orderminqty}}</span>
|
|
|
-  
|
|
|
- <span>增量:{{group.item[0].orderaddqty}}</span>
|
|
|
-  
|
|
|
- <span>包装数量:{{group.item[0].packageqty}}</span>
|
|
|
- </p>
|
|
|
+ <div class="input-number-panel mt-30">
|
|
|
+ <p><span class="mr-10">数量:</span></p>
|
|
|
+ <a-input-number style="width:150px;flex:0 0 150px" id="inputNumber" v-model:value="qty" :precision="2" :min="group.item[0].orderminqty" :step="group.item[0].orderaddqty" @blur="onChange"/>
|
|
|
+ <p class="label">
|
|
|
+  
|
|
|
+ <span>起订量:{{group.item[0].orderminqty}}</span>
|
|
|
+  
|
|
|
+ <span>增量:{{group.item[0].orderaddqty}}</span>
|
|
|
+  
|
|
|
+ <span>包装数量:{{group.item[0].packageqty}}</span>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ <a-space>
|
|
|
+ <a-button style="margin-left:42px" size="large" type="primary" :disabled="checkAddShopCart()" @click="addCart">
|
|
|
+ <template #icon>
|
|
|
+ <shopping-cart-outlined />
|
|
|
+ </template>
|
|
|
+ 加入购物车
|
|
|
+ </a-button>
|
|
|
+ <a-button size="large" type="primary" :disabled="checkAddShopCart()" @click="createOrder">
|
|
|
+ <template #icon>
|
|
|
+ <shopping-cart-outlined />
|
|
|
+ </template>
|
|
|
+ 立即下单
|
|
|
+ </a-button>
|
|
|
+ </a-space>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <a-space>
|
|
|
- <a-button style="margin-left:42px" size="large" type="primary" :disabled="checkAddShopCart()" @click="addCart">
|
|
|
- <template #icon>
|
|
|
- <shopping-cart-outlined />
|
|
|
- </template>
|
|
|
- 加入购物车
|
|
|
- </a-button>
|
|
|
- <a-button size="large" type="primary" :disabled="checkAddShopCart()" @click="createOrder">
|
|
|
- <template #icon>
|
|
|
- <shopping-cart-outlined />
|
|
|
- </template>
|
|
|
- 立即下单
|
|
|
- </a-button>
|
|
|
- </a-space>
|
|
|
</div>
|
|
|
- </div>
|
|
|
-</div>
|
|
|
+ </a-spin>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
@@ -151,7 +153,8 @@
|
|
|
const custom = ref([])
|
|
|
const qty = ref(0)
|
|
|
const load = ref(false)
|
|
|
- const groupDetail = async (init)=>{
|
|
|
+ const customschemeItems = ref([])
|
|
|
+ const groupDetail = async (callback)=>{
|
|
|
load.value = true
|
|
|
data.value.sa_itemgroupid = router.currentRoute.value.query.id
|
|
|
const res = await Api.requested({
|
|
@@ -162,13 +165,10 @@
|
|
|
group.value = res.data
|
|
|
|
|
|
group.value.specRows = group.value.specRows.reverse()
|
|
|
+ customschemeItems.value = res.data.item[0].customschemeItems ? res.data.item[0].customschemeItems : []
|
|
|
+ console.log(customschemeItems.value,'customschemeItems.value')
|
|
|
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
|
|
|
- if (group.value.materialRows.length == 1) data.value.material = group.value.materialRows[0].parm
|
|
|
- if (group.value.colorRows.length == 1) data.value.color = group.value.colorRows[0].parm
|
|
|
- if (group.value.cheekRows.length == 1) data.value.cheek = group.value.cheekRows[0].parm
|
|
|
- if (group.value.specRows.length == 1) data.value.spec = group.value.specRows[0].parm
|
|
|
-
|
|
|
// 获取可定制项
|
|
|
let arr = ['cheekRows','colorRows','materialRows','specRows']
|
|
|
let reg2 = new RegExp("Rows")
|
|
@@ -178,21 +178,50 @@
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- if (res.data.rows.length == 1) {
|
|
|
- // 遍历对象
|
|
|
- for (let key in res.data.rows[0]) {
|
|
|
- data.value[key] = res.data.rows[0][key]
|
|
|
- }
|
|
|
- }
|
|
|
+ // if (res.data.rows.length == 1) {
|
|
|
+ // // 遍历对象
|
|
|
+ // for (let key in res.data.rows[0]) {
|
|
|
+ // data.value[key] = res.data.rows[0][key]
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ callback ? callback():""
|
|
|
+
|
|
|
getCustomsizeData()
|
|
|
}
|
|
|
+ const updateSingleRowProperty = (group, data, properties,type) => {
|
|
|
+ // 遍历所有需要更新的属性
|
|
|
+ properties.forEach(property => {
|
|
|
+ // 构造从 group 中获取值的路径
|
|
|
+ const rowsPath = `${property}Rows`;
|
|
|
+ const targetPath = property;
|
|
|
+ if (type == 'uncheck' && group.value[rowsPath].length === 1) {
|
|
|
+ data.value[targetPath] = '';
|
|
|
+ }
|
|
|
+ // 如果对应的 rows 数组只有一个元素
|
|
|
+ if (group.value[rowsPath].length === 1 && type == 'check') {
|
|
|
+ // 从该数组的第一个元素中获取 parm 属性,并更新到 data 中
|
|
|
+ data.value[targetPath] = group.value[rowsPath][0].parm;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
const customClick = (key,value)=>{
|
|
|
if (data.value[key] == value) {
|
|
|
data.value[key] = ''
|
|
|
+
|
|
|
+ groupDetail(()=>{
|
|
|
+ const propertiesToUpdate = ['material', 'color', 'cheek', 'spec'];
|
|
|
+ updateSingleRowProperty(group, data,propertiesToUpdate,'uncheck')
|
|
|
+ })
|
|
|
} else {
|
|
|
data.value[key] = value
|
|
|
+ groupDetail(()=>{
|
|
|
+ // 定义需要更新的属性列表
|
|
|
+ const propertiesToUpdate = ['material', 'color', 'cheek', 'spec'];
|
|
|
+
|
|
|
+ // 调用函数,传入必要的参数
|
|
|
+ updateSingleRowProperty(group, data, propertiesToUpdate,'check');
|
|
|
+ })
|
|
|
}
|
|
|
- groupDetail()
|
|
|
}
|
|
|
const customClick2 = (key,value)=>{
|
|
|
if (schemeData.value[key] == value) {
|
|
@@ -348,11 +377,15 @@
|
|
|
collection(false)
|
|
|
}
|
|
|
}
|
|
|
+ const isonlydisplay = (item)=>{
|
|
|
+ let bool = customschemeItems.value.filter(e=>e.value == item)[0].isonlydisplay
|
|
|
+ return bool == 0 ? true : false
|
|
|
+ }
|
|
|
const linkToPromotion = (item)=>{
|
|
|
router.push({path:'/promotionDetail',query:{id:item.sa_promotionid}})
|
|
|
}
|
|
|
onMounted(()=>{
|
|
|
- groupDetail(true)
|
|
|
+ groupDetail()
|
|
|
})
|
|
|
</script>
|
|
|
<style scoped>
|